public byte[] HandDeviceControl(MasProtocol masProtocol, DeviceControlRequest deviceControl, ref string deviceCode, ref int commPort)
        {
            DeviceInfo                  deviceinfoobject = null;
            DeviceTypeInfo              devicetypeobject = null;
            NetworkDeviceInfo           netmacobject     = null;
            DeviceControlRequestCommand commandobject    = new DeviceControlRequestCommand();

            byte[] sendbuff = null;
            if (masProtocol == null || deviceControl == null)
            {
                return(sendbuff);
            }
            if (!GetDeviceObject(ref deviceinfoobject, ref devicetypeobject, ref netmacobject, ProtocolType.DeviceControlRequest, deviceControl.DeviceCode))
            {
                return(sendbuff);
            }
            if (netmacobject.NetID > 0)
            {
                commPort      = deviceinfoobject.K3;
                deviceCode    = netmacobject.IP;
                commandobject = Basic.Framework.Common.ObjectConverter.Copy <DeviceControlRequest, DeviceControlRequestCommand>(deviceControl); //得到基础数据
                commandobject.OrderVersion = (byte)devicetypeobject.LC2;                                                                        //设备设备类型
                commandobject.def          = deviceinfoobject;
                sendbuff = commandobject.ToBytes();                                                                                             //得到通讯命令的返回Buffer数组
            }
            return(sendbuff);
        }
Exemplo n.º 2
0
 /// <summary>
 ///  下发设备控制指令
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <DeviceControlResponse> DeviceControl(DeviceControlRequest request)
 {
     return(await new DeviceControlExecutor().Client(this).Execute <DeviceControlResponse, DeviceControlResult, DeviceControlRequest>(request).ConfigureAwait(false));
 }
Exemplo n.º 3
0
 /// <summary>
 ///  下发设备控制指令
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public DeviceControlResponse DeviceControl(DeviceControlRequest request)
 {
     return(new DeviceControlExecutor().Client(this).Execute <DeviceControlResponse, DeviceControlResult, DeviceControlRequest>(request));
 }
Exemplo n.º 4
0
 public async Task <ListBaseResponse <DeviceControlResponse> > DoControl(DeviceControlRequest model)
 {
     return(await _deviceService.DoControl(model));
 }