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 SwitchHighspeed() { throw new NotImplementedException(); } public async virtual Task SwitchLowspeed() { throw new NotImplementedException(); } public virtual TaskCompletionSource 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; } } }