Beispiel #1
0
        private void CheckLastSentAndDequeueIt(BaseDeviceCommand dc)
        {
            string LastCmd = LastSent.GetText(String.Empty);

            if (LastSent != null)
            {
                if (LastSent.IsExpired())
                {
                    LastSent = null;
                }
                else
                {
                    var lastDC = BaseDeviceCommand.createFrom(LastCmd, this, null);
                    var result = lastDC.isExpectedResponse(dc);
                    if (result == DeviceCommandResponseStatus.Valid)
                    {
                        Fota.Dequeue(this, lastDC.MessageId);
                    }
                }
            }
        }
Beispiel #2
0
        // TODO: unificar GTEDeviceCommand e INodeMessage si se puede
        private void SendPendingFota(ref IMessage msg)
        {
            string pending = Fota.Peek(this);

            if (String.IsNullOrEmpty(pending))
            {
                return;
            }

            #region SendPending

            var gteDC = BaseDeviceCommand.createFrom(pending, this, null);
            pending = gteDC.ToString(true);

            msg = (msg ?? new UserMessage(Id, 0));
            msg.AddStringToPostSend(pending);

            if (LastSent == null || LastSent.GetText(null) != pending)
            {
                LastSent = new INodeMessage((ulong)Id, pending, DateTime.UtcNow);
            }

            #endregion SendPending
        }