public virtual void _DataReceived(string text) { Log(Core.Logger.Level.Debug, String.Format("Received Data:>{0}< ({1})", text, Conversions.AsciiToHex(text))); }
private bool DispatchIncomingExpected(string data) { foreach (var key in _outgoingCommandQueueDetail.Keys) { var commandDetail = _outgoingCommandQueueDetail[key]; Log(String.Format("Received Something in Queue: {0} {1} {2}", Conversions.AsciiToHex(data), Conversions.AsciiToHex(commandDetail.Success), Conversions.AsciiToHex(commandDetail.Failure) )); if (commandDetail.Success == data) { Log("Success"); commandDetail.Status = CommandStatus.Success; commandDetail.CommandResponseEvent.Set(); return(true); } if (commandDetail.Failure == data) { Log("Failure"); commandDetail.Status = CommandStatus.Failure; commandDetail.CommandResponseEvent.Set(); return(true); } } return(false); }
public virtual void _DataReceived(string data) { Log(String.Format("HA Interface Received: >{0}< ({1})", data, Conversions.AsciiToHex(data))); _receivedData.Enqueue(data); }
public void AsciiToHexForLeadingZeroTests() { var d = "026219057B0F11FF"; var r1 = Conversions.HexToAscii(d); var r4 = Conversions.HexToBytes(d); var r5 = Conversions.BytesToAscii(r4); var r3 = Conversions.AsciiToBytes(r1); var r2 = Conversions.AsciiToHex(r1); Assert.AreEqual(d, r2); }
private void DispatchOutgoing() { var outgoingList = _outgoingCommandQueueDetail.Values .Where((x) => x.Status == CommandStatus.Pending); foreach (var outgoing in outgoingList) { Log(String.Format("HA Interface Sending: >{0}< ({1})", outgoing.Command, Conversions.AsciiToHex(outgoing.Command))); _interface.Send(outgoing.Command); outgoing.OriginalSentTime = DateTime.Now; outgoing.Status = CommandStatus.Sent; } }
public void CommandOnTests() { var sentData = "026219057B0F11FF"; var aSentData = Conversions.HexToAscii(sentData); var result = _i.Command(new Command() { Primary = CommandType.On, Destination = "19.05.7b" }); Assert.IsFalse(result.Result); // Thread.Sleep(2000); var aData = Conversions.AsciiToHex(_data); Assert.AreEqual(sentData, aData); }