void sendColour(Color colour) { if (port == null) { return; } char colourType = COLOUR_TYPE_SOLID; if (radFade.Checked) { colourType = COLOUR_TYPE_FADE; } else if (radBlink.Checked) { colourType = COLOUR_TYPE_BLINK; } int cycleTimeDeciseconds = (int)numCycleTimeMs.Value / 100; var msg = new MessageByteList { (byte)colourType, colour.R, colour.G, colour.B, (byte)cycleTimeDeciseconds }; writeMessage(msg); }
void writeMessage(MessageByteList msg) { var bytes = msg.GetBytes(); StringBuilder sb = new StringBuilder("Send message: "); sb.Append(BitConverter.ToString(bytes)); AddLog(sb.ToString()); port.Write(bytes, 0, bytes.Length); }
void requestVersion() { if (port == null) { return; } var msg = new MessageByteList { (byte)'v' }; writeMessage(msg); }