public void AddDeviceTest() { BLImplements.DeviceBL dbl = new DeviceBL(); dbl.AddDevice(new Device { IMEI = "", URI = "", OSId = 1, ReceiverNewID = 15232 }); }
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); }
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); } }
// 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); } }
public DeviceController(DeviceBL deviceBL, IMapper mapper) { this.deviceBL = deviceBL; this._mapper = mapper; }