Пример #1
0
        public override void OnMessage(string msg)
        {
            Debug.WriteLine(string.Format("YellowLight OnMessage => {0}", msg));
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
                last_command = cmd;
                switch (cmd.Name)
                {
                case "open":
                    ´ò¿ªµÆ(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} ÊÔͼ´ò¿ª»ÆµÆ", cmd.Commander));
                    break;

                case "close":
                    ¹Ø±ÕµÆ(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} ¹Ø±Õ»ÆµÆ", cmd.Commander));
                    break;
                }
                ¼ì²éµÆ״̬(Program.getRemoteIPEndPoint());
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
        }
Пример #2
0
        public override void OnMessage(string msg)
        {
            Debug.WriteLine(string.Format("EngineService OnMessage => {0}", msg));
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
                last_command = cmd;
                switch (cmd.Name)
                {
                case "open":
                    打开电机(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} 试图打开电机", cmd.Commander));
                    break;

                case "close":
                    关闭电机(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} 试图关闭电机", cmd.Commander));
                    break;
                }
                检查电机状态(Program.getRemoteIPEndPoint());
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
        }
Пример #3
0
        public override void OnMessage(string msg)
        {
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
                last_command = cmd;
                switch (cmd.Name)
                {
                case "open":
                    //打开风扇(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} 试图打开风扇", cmd.Commander));
                    break;

                case "close":
                    //关闭风扇(Program.getRemoteIPEndPoint());
                    Debug.WriteLine(string.Format("{0} 试图关闭风扇", cmd.Commander));
                    break;
                }
                //检查风扇状态(Program.getRemoteIPEndPoint());
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
        }
Пример #4
0
        public override void OnMessage(string msg)
        {
            Debug.WriteLine(string.Format("GPS OnMessage => {0}", msg));
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
                //Send(cmd.print_string());
                switch (cmd.Name)
                {
                case "open":
                    Debug.WriteLine("打开GPS");
                    //services.add_log("打开GPS");
                    //moduleMannager.reset_module_state("gps", "open");
                    break;

                case "close":
                    Debug.WriteLine("关闭GPS");
                    //services.add_log("关闭GPS");
                    //moduleMannager.reset_module_state("gps", "close");
                    break;
                }
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
        }
Пример #5
0
        protected override void OnMessage(object sender, MessageEventArgs e)
        {
            var msg = e.Data;

            Debug.WriteLine(string.Format("GPS OnMessage => {0}", msg));
            //Send("echo -> " + msg);
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
            services.add_log(GPS.raw_data_parser(msg));
        }
Пример #6
0
        public override void OnMessage(string msg)
        {
            Debug.WriteLine(string.Format("UHF OnMessage => {0}", msg));
            try
            {
                command cmd = (command)JsonConvert.DeserializeObject(msg, typeof(command));
                Debug.WriteLine(cmd.print_string());
                //Send(cmd.print_string());
                switch (cmd.Name)
                {
                case "open":
                    Debug.WriteLine("打开UHF");
                    break;

                case "close":
                    Debug.WriteLine("关闭UHF");
                    break;
                }
            }
            catch
            {
                Debug.WriteLine("parse error!");
            }
        }