示例#1
0
        void 检查风扇状态(IPEndPoint ipEndPoint)
        {
            DeviceCommandManager.setCommandCallback(enumDeviceCommand.查询风扇状态,
                                                    (data) =>
            {
                Debug.WriteLine("风扇状态 => " + data);
                IDeviceCommand idc = DeviceCommandManager.getDeivceCommand(enumDeviceCommand.查询风扇状态);
                if (null != idc)
                {
                    LightState ls = idc.parseResponse(data);
                    if (null != ls)
                    {
                        switch (ls.State)
                        {
                        case true:
                            if (myCommand != null)
                            {
                                myCommand.Name = stateName.打开;
                            }
                            this.invokeCallback(myCommand);
                            break;

                        case false:
                            if (myCommand != null)
                            {
                                myCommand.Name = stateName.关闭;
                            }
                            this.invokeCallback(myCommand);
                            break;
                        }
                    }
                }
            });
            DeviceCommandManager.executeCommand(enumDeviceCommand.查询风扇状态, ipEndPoint, 1000);
        }
示例#2
0
 void 查询风扇状态(IPEndPoint ipEndPoint)
 {
     DeviceCommandManager.setCommandCallback(enumDeviceCommand.查询风扇状态,
                                             (data) =>
     {
         Debug.WriteLine("风扇状态 => " + data);
         IDeviceCommand idc = DeviceCommandManager.getDeivceCommand(enumDeviceCommand.查询风扇状态);
         if (null != idc)
         {
             LightState ls = idc.parseResponse(data);
             if (null != ls)
             {
                 if (ls.State)
                 {
                     string log = "风扇已经打开";
                     this.add_log(log);
                     Debug.WriteLine(log);
                     //FanService.last_effective_command = new command("open", "");
                     command cmd      = new command(stateName.打开, "");
                     cmd.TargetDevice = TargetDeiveName.电风扇;
                     cmd.Initializing = "true";
                     this.sendInitialInfo(ws, cmd);
                 }
                 else
                 {
                     string log = "风扇已经关闭";
                     this.add_log(log);
                     Debug.WriteLine(log);
                     FanService.last_effective_command = new command("close", "");
                 }
             }
         }
     });
     DeviceCommandManager.executeCommand(enumDeviceCommand.查询风扇状态, ipEndPoint);
 }
示例#3
0
 void 查询电机状态(IPEndPoint ipEndPoint)
 {
     DeviceCommandManager.setCommandCallback(enumDeviceCommand.查询电机状态,
                                             (data) =>
     {
         Debug.WriteLine("电机状态 => " + data);
         IDeviceCommand idc = DeviceCommandManager.getDeivceCommand(enumDeviceCommand.查询电机状态);
         if (null != idc)
         {
             LightState ls = idc.parseResponse(data);
             if (null != ls)
             {
                 if (ls.State)
                 {
                     string log = "电机已经打开";
                     this.add_log(log);
                     Debug.WriteLine(log);
                     EngineService.last_effective_command = new command("open", "");
                 }
                 else
                 {
                     string log = "电机已经关闭";
                     this.add_log(log);
                     Debug.WriteLine(log);
                     EngineService.last_effective_command = new command("close", "");
                 }
             }
         }
     });
     DeviceCommandManager.executeCommand(enumDeviceCommand.查询电机状态, ipEndPoint);
 }
示例#4
0
        void 关闭风扇(IPEndPoint ipEndPoint)
        {
            //if (myCommand != null)
            //{
            //    myCommand.Name = stateName.关闭;
            //    //myCommand.Name = stateName.打开;
            //}
            //this.invokeCallback(myCommand);
            //return;

            DeviceCommandManager.executeCommand(enumDeviceCommand.关闭风扇, ipEndPoint);
            检查风扇状态(ipEndPoint);
        }
示例#5
0
 private void btnGroup_Click(object sender, EventArgs e)
 {
     DeviceCommandManager.executeCommand(enumDeviceCommand.组网, Program.getRemoteIPEndPoint());
 }