示例#1
0
        public bool UnloadRoute(ulong messageId, Destination[] route, int routeId)
        {
            string cmd = null;
            var    md  = GetMessagingDevice();

            switch (md)
            {
            case MessagingDevice.Garmin:
                var config = new StringBuilder();
                config.AppendFormat("{0}{1}", BaseDeviceCommand.createFrom(">SSG160<", this, null).ToString(false), Environment.NewLine);
                config.Append(GarminFmi.EncodeDataDeletionFor(DataDeletionProtocolId.DeleteAllStopsOnTheClient).ToTraxFM(this, false));
                foreach (var p in route)
                {
                    config.Append(GarminFmi.EncodeDeleteTextmessage((UInt32)p.Code).ToTraxFM(this, false));
                }
                config.Append(Environment.NewLine);
                config.Append(Fota.VirtualMessageFactory(MessageIdentifier.UnloadRouteSuccess, 0));
                cmd = config.ToString();
                break;

            case MessagingDevice.Mpx01:
                break;
            }

            SendMessages(cmd, messageId, md);
            return(true);
        }
示例#2
0
        public bool UnloadStop(ulong messageId, Destination[] route)
        {
            string cmd = null;
            var    md  = GetMessagingDevice();

            switch (md)
            {
            case MessagingDevice.Garmin:
                var config = new StringBuilder();
                foreach (var p in route)
                {
                    config.Append(GarminFmi.EncodeDeleteTextmessage((UInt32)p.Code).ToTraxFM(this, false));

                    var stopStr =
                        GarminFmi.EncodeA603StopStatusProtocol(p.Code, StopStatusValue.DeleteStop).ToTraxFM(this,
                                                                                                            false);
                    STrace.Debug(typeof(GarminFmi).FullName, Id, "UnloadStop: Stop ID=" + Convert.ToString(p.Code) + " - " + stopStr);
                    config.Append(stopStr);
                }
                config.Append(Environment.NewLine);
                cmd = config.ToString();
                break;

            case MessagingDevice.Mpx01:
                break;
            }
            SendMessages(cmd, messageId, md);
            return(true);
        }
示例#3
0
        public bool SubmitTextMessage(ulong messageId, uint textMessageId, String textMessage, uint[] replies, int ackEvent)
        {
            STrace.Debug(typeof(Parser).FullName, Id, "SubmitTextMessage: messageId=" + messageId.ToString() + ",textMessageId=" + textMessageId.ToString() + ",textMessage=" + textMessage + ",replies=" + (replies == null?"null":String.Join(",", replies.Select(b => b.ToString()).ToArray())));
            var md = GetMessagingDevice();

            switch (md)
            {
            case MessagingDevice.Garmin:
            {
                var cnf = new StringBuilder();
//			            cnf.Append(GarminFmi.EncodeDeleteTextmessage(textMessageId).ToTraxFM(this, false));
                if (replies != null && replies.Length > 0)
                {
                    cnf.Append(GarminFmi.EncodeCannedResponseList(textMessageId, replies).ToTraxFM(this, false));
                }
                else
                {
                    cnf.Append(GarminFmi.EncodeDeleteTextmessage(textMessageId).ToTraxFM(this, false));
                }

                cnf.Append(GarminFmi.EncodeOpenTextMessage(textMessageId, textMessage, true).ToTraxFM(this, false));

                if (ackEvent != -1)
                {
                    cnf.Append(Fota.VirtualMessageFactory((MessageIdentifier)ackEvent, NextSequence));
                }

                var cmd = cnf.ToString();
                SendMessages(cmd, messageId, md);
                break;
            }

            case MessagingDevice.Mpx01:
            {
                var cmd = EncodeMpx01Msg(textMessage, messageId, this);
                SendMessages(cmd, messageId, md);
                break;
            }

            case MessagingDevice.Sms:
            {
                var cmd = EncodeSmsMsg(textMessage, messageId, this);
                SendMessages(cmd, messageId, md);
                break;
            }
            }
            return(true);
        }
示例#4
0
        public bool SubmitLongTextMessage(ulong messageId, uint textMessageId, String textMessage, int ackEvent)
        {
            STrace.Debug(typeof(Parser).FullName, Id, "SubmitLongTextMessage: messageId=" + messageId.ToString() + ",textMessageId=" + textMessageId.ToString() + ",textMessage=" + textMessage);
            var md = GetMessagingDevice();

            switch (md)
            {
            case MessagingDevice.Garmin:
            {
                var cnf = new StringBuilder();

                cnf.Append(GarminFmi.EncodeDeleteTextmessage(textMessageId).ToTraxFM(this, false));

                cnf.Append(GarminFmi.EncodeOpenLongTextMessage(textMessageId, textMessage, true).ToTraxFM(this, false));

                if (ackEvent != -1)
                {
                    cnf.Append(Fota.VirtualMessageFactory((MessageIdentifier)ackEvent, NextSequence));
                }

                var cmd = cnf.ToString();
                SendMessages(cmd, messageId, md);
                break;
            }

            case MessagingDevice.Mpx01:
            {
                var cmd = EncodeMpx01Msg(textMessage, messageId, this);
                SendMessages(cmd, messageId, md);
                break;
            }

            case MessagingDevice.Sms:
            {
                var cmd = EncodeSmsMsg(textMessage, messageId, this);
                SendMessages(cmd, messageId, md);
                break;
            }
            }
            return(true);
        }