protected virtual void RaiseMessageRecieved(ArduinoCommand command) { if (MessageRecieved != null && NamesAndPorts.ContainsKey(Name)) { MessageRecieved(this, new ArduinoEventArgs() { Command = command, ComPort = NamesAndPorts[Name]}); } }
public void Send(ArduinoCommand ardCommand) { try { // Beware of the Krakens -1 ... you ******* ***** Microsoft. _sp.Write(ardCommand.ParseString()); //Console.WriteLine("Sent this:" + ardCommand.ParseString()); } catch (Exception e) { throw e; } }
private bool SendBroadcastInternally(string message) { // Print Interface Broadcast message if (ArduinoCollection.Count == 1) { ArduinoConsole.AddConsoleText("Interface Broadcast: @nobreak", ConsoleViewModel.TextColors.Orange); } else { //ArduinoConsole.AddParagraph(); ArduinoConsole.AddConsoleText("Interface Broadcast:", ConsoleViewModel.TextColors.Orange); } ArduinoCommand tmpCommand; for (int i = 0; i < ArduinoCollection.Count; i++) { tmpCommand = new ArduinoCommand(ArduinoCommand.CommandTypes.Interface_Broadcast, "unspecified", message, "Interface"); // Print commands to console if (ArduinoCollection.Count == 1) ArduinoConsole.AddConsoleText(String.Format("»{0}«", tmpCommand.ParseString())); else ArduinoConsole.AddConsoleText(String.Format("\t»{0}«", tmpCommand.ParseString())); // Send the actual commannd try { ArduinoCollection[i].Send(tmpCommand); } catch (Exception e) { return false; } } return true; }
// Send a command to the Arduino instance. public void Send(string command) { ArduinoCommand ardCommand = new ArduinoCommand(ArduinoCommand.CommandTypes.Interface_To_Arduino, Name, command, "Interface"); try { // Beware of the Krakens -1 ... you ******* ***** Microsoft. _sp.Write(ardCommand.ParseString()); //Console.WriteLine("Sent this:" + ardCommand.ParseString()); } catch (Exception e) { throw e; } }
private void ArduinoSendExecute(int sendIndex) { if (ArduinoCollection[sendIndex].Send(ArduinoSendMessage)) { ArduinoCommand tmpCommand = new ArduinoCommand(ArduinoCommand.CommandTypes.Interface_To_Arduino, ArduinoCollection[sendIndex].ArduinoName, ArduinoSendMessage, "Interface"); ArduinoConsole.AddConsoleText("Interface to Arduino: @nobreak", ConsoleViewModel.TextColors.Cyan); ArduinoConsole.AddConsoleText(String.Format("»{0}«", tmpCommand.ParseString())); } else PrintWarning("Problem occured during sending user command."); }