You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BirdyFlash.Lib {
|
|
|
|
|
public class CommPort : IDisposable {
|
|
|
|
|
public CommPort() {
|
|
|
|
|
}
|
|
|
|
|
public virtual string ToString() {
|
|
|
|
|
return "CommPort";
|
|
|
|
|
}
|
|
|
|
|
public async virtual void ForceGotoProg() {
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
public async virtual Task<bool> SwitchHighspeed() {
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
public async virtual Task<bool> SwitchLowspeed() {
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
public virtual TaskCompletionSource<RXPacket> SendCommand(byte[] cmd) {
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
public virtual void SendRawSimplex(byte[] data) {
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
public virtual void Dispose() {
|
|
|
|
|
}
|
|
|
|
|
public static CommPort From(string url) {
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
switch (uri.Scheme) {
|
|
|
|
|
case "serial":
|
|
|
|
|
return new CommPortSerial(uri.Host);
|
|
|
|
|
case "tcp":
|
|
|
|
|
return new CommPortTCP(uri);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|