public GetDoorStateResponse GetDoorState(GetDoorStateRequest request) { if (WebSocketClientManager.GetInstance().GetClientById(request.DeviceCode) == null) { var msg = string.Format("设备:[{0}]未连接", string.Join(",", request.DeviceCode)); return(new GetDoorStateResponse() { ResultType = ResultTypes.DeviceNotConnected, Messages = new[] { msg } }); } var bOpened = new DoorStateOp().GetDoorState(request.DeviceCode, request.DoorIndex); return(new GetDoorStateResponse() { ResultType = ResultTypes.Ok, IsOpened = bOpened }); }
public UpdateDoorStateResponse UpdateDoorState(UpdateDoorStateRequest request) { if (WebSocketClientManager.GetInstance().GetClientById(request.DeviceCode) == null) { var msg = string.Format("设备:[{0}]未连接", string.Join(",", request.DeviceCode)); return(new UpdateDoorStateResponse() { ResultType = ResultTypes.DeviceNotConnected, Messages = new[] { msg } }); } var op = new DoorStateOp(); var resultTypes = op.UpdateDoorState(request.DeviceCode, request.DoorIndex, request.Option); return(new UpdateDoorStateResponse() { ResultType = (resultTypes == ResultType.NotSupport) ? ResultTypes.NotSupportError : ResultTypes.Ok }); }