public void Register() { lastCommandSentTime = DateTime.Now; SocketsHelper.SendMessageToUDPSocket(localEndPoint, targetEndPoint, Encoding.ASCII.GetBytes("001,!F*p|")); //Old Command, apparently been replaced in the new firmware version //SocketsHelper.SendMessageToUDPSocket(localEndPoint, targetEndPoint, Encoding.ASCII.GetBytes("693,!R1Fa|")); }
public void SendCommand(string commandText) { //LightwaveRF seems to get confused if commands are sent one directly after another so introducing //a pause of 500 milliseconds between commands TimeSpan ts = DateTime.Now - lastCommandSentTime; if (ts.Milliseconds < 500) { Thread.Sleep(500 - ts.Milliseconds); } SocketsHelper.SendMessageToUDPSocket(localEndPoint, targetEndPoint, Encoding.ASCII.GetBytes(commandText)); lastCommandSentTime = DateTime.Now; }