public async Task <object> Connect(string input) { return(await Task.Run(() => { ArduinoInfo = JsonConvert.DeserializeObject <SettingsModel>(File.ReadAllText(input)).ArduinoInfo; Receiver.DisConnect(); Receiver.PortName = ArduinoInfo.PortName; Receiver.BaudRate = ArduinoInfo.BaudRate; Receiver.Parity = ArduinoInfo.Parity; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return Receiver.Connect(); })); }
static void Main(string[] args) { Receiver.DisConnect(); Receiver.PortName = "COM3"; Receiver.BaudRate = 9600; Receiver.Parity = Parity.None; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; Receiver.Connect(); FPSAndCPUTemperature Reader = new FPSAndCPUTemperature(); Reader.Start(); Console.ReadLine(); }
public async Task <object> Invoke(dynamic input) { var KeyButtons = JsonConvert.DeserializeObject <List <KeyButton> >(File.ReadAllText(@"KeyButtons.json")); CurrentProfile.Buttons = KeyButtons; var Receiver = new SerialPortReceiver(new CoderDeckArduinoMachine()); Receiver.PortName = "COM3"; Receiver.BaudRate = 9600; Receiver.Parity = Parity.None; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return(Receiver.Connect()); }
public async Task <object> Connect(string input) { var KeyButtons = JsonConvert.DeserializeObject <List <object> >(File.ReadAllText("KeyButtons.json")); GetActions(KeyButtons); var SerialInfo = JsonConvert.DeserializeObject <SerialPortInfoModel>(input); var Receiver = new SerialPortReceiver(new CoderDeckArduinoMachine()); Receiver.PortName = SerialInfo.PortName; Receiver.BaudRate = SerialInfo.BaudRate; Receiver.Parity = SerialInfo.Parity; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return(Receiver.Connect()); }
public async Task <object> Connect(string input) { return(await Task.Run(() => { GifbuModel = JsonConvert.DeserializeObject <GifbuAppModel>(File.ReadAllText(input)); WebSocketClient.URI = "ws://localhost:13100"; WebSocketClient.Connect(); Receiver.DisConnect(); Receiver.PortName = "COM" + GifbuModel.Machine.PortName; Receiver.BaudRate = GifbuModel.Machine.BaudRate; Receiver.Parity = GifbuModel.Machine.Parity; Receiver.DataBits = 8; Receiver.StopBits = StopBits.One; Receiver.Handshake = Handshake.None; return Receiver.Connect(); })); }