Exemplo n.º 1
0
        public static void EnqueueOnTheFly(IFoteable Device, ulong MessageId, string command, ref IMessage msg)
        {
            var lines    = command.SplitLines().Reverse();
            var reversed = lines.JoinLines();

            var toSendStr = lines.Last();

            if (msg != null)
            {
                msg.AddStringToPostSend(toSendStr);
            }

            if (Device.LastSent == null)
            {
                EnqueuePrivate(Device, MessageId, reversed, ".txR");
                if (msg != null)
                {
                    Device.LastSent = new INodeMessage(MessageId, toSendStr, DateTime.UtcNow);
                }
            }
            else
            {
                InsertAfterLastFotaCommand(Device, reversed.ToString());
            }
        }
Exemplo n.º 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;
            }
            if (CheckImageSession(pending))
            {
                return;
            }

            //procesar primero el pendiente
            pending = CheckConditionsBeforeSendPending(pending);

            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
        }