コード例 #1
0
 public void AddDeviceTest()
 {
     BLImplements.DeviceBL dbl = new DeviceBL();
     dbl.AddDevice(new Device {
         IMEI = "", URI = "", OSId = 1, ReceiverNewID = 15232
     });
 }
コード例 #2
0
ファイル: GatewayServer.cs プロジェクト: okankilic/LisconVT
        void HandleV101Message(V101Message message, DeviceClient client, LisconDbEntities db)
        {
            var device = DeviceBL.TryGet(message.DevIDNO, db);

            if (device == null)
            {
                DeviceBL.Register(message.DevIDNO, client.Runtime, db);
            }

            SendResponse(message, MdvrResponseTypes.Auto, "1");
            SendAlarmServerConfig(client.DevIDNO, "", 6602, (int)ConnectionTypes.Udp);
        }
コード例 #3
0
        public BaseServiceResult RemoveDevice(string DeviceIMEI, long ReceiverId, string ReceiverToken)
        {
            try
            {
                using (var ReceiverBL = new ReceiverBL())
                {
                    if (!ReceiverBL.CheckTokenValid(ReceiverToken, ReceiverId))
                    {
                        return(new BaseServiceResult <byte[]>(ResultStatusCodes.UnAuthorised, null));
                    }
                }

                using (IDeviceBL DeviceBL = new DeviceBL())
                {
                    return(DeviceBL.RemoveDeviceByIMEI(DeviceIMEI));
                }
            } catch (Exception ex)
            {
                Logger.Error("AddDevice", ex);
                return(BaseServiceResult.InternalErrorResult);
            }
        }
コード例 #4
0
        // return StatusCodes:
        // UnAuthorised: Invalid receiver Token
        // InternalServerError: Internal error
        public BaseServiceResult AddDevice(long ReceiverId, Device deviceInfo, string ReceiverToken)
        {
            try
            {
                using (IReceiverBL ReceiverBL = new ReceiverBL())
                {
                    if (!ReceiverBL.CheckTokenValid(ReceiverToken, ReceiverId))
                    {
                        return(new BaseServiceResult(ResultStatusCodes.UnAuthorised, null));
                    }
                }

                using (var DeviceBL = new DeviceBL())
                {
                    return(DeviceBL.AddDevice(deviceInfo));
                }
            } catch (Exception ex)
            {
                Logger.Error("AddDevice", ex);
                return(BaseServiceResult.InternalErrorResult);
            }
        }
コード例 #5
0
 public DeviceController(DeviceBL deviceBL, IMapper mapper)
 {
     this.deviceBL = deviceBL;
     this._mapper  = mapper;
 }