| | |
| | | { |
| | | /// <summary> |
| | | /// 定义一个静态对象 |
| | | /// </summary> |
| | | private static LogicMethod logicMethod = null; |
| | | /// </summary> |
| | | private static LogicMethod s_Current = null; |
| | | /// <summary> |
| | | /// 获取静态对象 |
| | | /// </summary> |
| | | public static LogicMethod CurrLogicMethod |
| | | public static LogicMethod Current |
| | | { |
| | | get |
| | | { |
| | | if (logicMethod == null) |
| | | if (s_Current == null) |
| | | { |
| | | return new LogicMethod(); |
| | | } |
| | | return logicMethod; |
| | | return s_Current; |
| | | } |
| | | |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public List<HDL_ON.Entity.Function> GetGatewayDeviceList() |
| | | { |
| | | var list = Entity.FunctionList.List.GetDeviceFunctionList(); |
| | | //return GetTestDevice(list, true); |
| | | var list = new List<HDL_ON.Entity.Function>(); |
| | | var list1 = Entity.FunctionList.List.GetDeviceFunctionList(); |
| | | var list2 = this.GetVideoDeviceList(); |
| | | list.AddRange(list1); |
| | | list.AddRange(list2); |
| | | GetTestDevice(ref list, true); |
| | | return list; |
| | | } |
| | | /// <summary> |
| | | /// 获取可视对讲设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<HDL_ON.Entity.Function> GetVideoDeviceList() |
| | | { |
| | | var functionList = new List<Function>(); |
| | | foreach (var videoDevice in FunctionList.List.videoIntercom) { |
| | | Function function = new Function(); |
| | | function.spk = videoDevice.spk; |
| | | function.name = videoDevice.deviceName; |
| | | function.deviceId = videoDevice.deviceId; |
| | | function.online = videoDevice.status== "online"; |
| | | function.sid = videoDevice.sid; |
| | | var video = functionList.Find((o) => o.deviceId == function.deviceId); |
| | | if (video == null) { |
| | | functionList.Add(function); |
| | | } |
| | | |
| | | } |
| | | return functionList; |
| | | } |
| | | /// <summary> |
| | | /// 获取场景列表 |
| | |
| | | string strPath = ""; |
| | | switch (functionType) |
| | | { |
| | | |
| | | case SPK.doorgate: |
| | | { |
| | | strPath = "VideoIcon/keshiduijiang.png"; |
| | | } |
| | | break; |
| | | case SPK.AirSwitch: |
| | | { |
| | | strPath = "FunctionIcon/Icon/electricalbreaker.png"; |
| | |
| | | case SPK.DoorLock: |
| | | { |
| | | strPath = "FunctionIcon/DoorLock/DoorLock.png"; |
| | | } |
| | | break; |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | strPath = "MusicIcon/localMusic.png"; |
| | | } |
| | | break; |
| | | |
| | |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.DoorLock)); |
| | | } |
| | | ///音乐类 |
| | | var music = deviceList.Find((device) => device.spk == SPK.MusicStandard || device.spk == SPK.AvMusic); |
| | | if (music != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Music)); |
| | | } |
| | | ///可视对讲 |
| | | var doorgate = deviceList.Find((device) => device.spk == SPK.doorgate); |
| | | if (doorgate != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.VideoIntercom)); |
| | | } |
| | | return deviceStrTypeList; |
| | | |
| | | } |
| | |
| | | { |
| | | functionTypeList.Add(SPK.DoorLock); |
| | | } |
| | | ///音乐类 |
| | | else if (deviceType == Language.StringByID(StringId.Music)) |
| | | { |
| | | functionTypeList.Add(SPK.MusicStandard); |
| | | functionTypeList.Add(SPK.AvMusic); |
| | | } |
| | | ///HDL可视对讲 |
| | | else if (deviceType == Language.StringByID(StringId.VideoIntercom)) |
| | | { |
| | | functionTypeList.Add(SPK.doorgate); |
| | | } |
| | | else |
| | | { |
| | | //全部区域 |
| | |
| | | functionTypeList.Add(SPK.SensorHelp); |
| | | functionTypeList.Add(SPK.DoorLock); |
| | | functionTypeList.Add(SPK.CurtainDream); |
| | | functionTypeList.Add(SPK.MusicStandard); |
| | | functionTypeList.Add(SPK.AvMusic); |
| | | functionTypeList.Add(SPK.doorgate); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | deviceTypeList.Add(SPK.HvacCac); |
| | | deviceTypeList.Add(SPK.SensorHelp); |
| | | deviceTypeList.Add(SPK.DoorLock); |
| | | deviceTypeList.Add(SPK.doorgate); |
| | | |
| | | } |
| | | break; |
| | |
| | | deviceTypeList.Add(SPK.PanelSocket); |
| | | deviceTypeList.Add(SPK.ElectricSocket); |
| | | deviceTypeList.Add(SPK.CurtainDream); |
| | | deviceTypeList.Add(SPK.MusicStandard); |
| | | deviceTypeList.Add(SPK.AvMusic); |
| | | } |
| | | break; |
| | | } |
| | |
| | | try |
| | | { |
| | | //获取逻辑ID列表,目前针对所有<备注:如果只针对当前手机的话,可以直接拿缓存数据自动化列表遍历> |
| | | var idStr = Send.GetLogicIdList(); |
| | | if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "") |
| | | var idStr = Send.Current.GetLogicIdList(); |
| | | if (idStr != null) |
| | | { |
| | | var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data); |
| | | logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date); |
| | |
| | | if (isPush == null) |
| | | { |
| | | //推送给云端是否成功 |
| | | bool push = Send.GeoFenceStateReport(logicDate.userLogicId, logicDate.sid, direction); |
| | | bool push = Send.Current.GetFenceStateReport(logicDate.userLogicId, logicDate.sid, direction); |
| | | if (push) |
| | | { |
| | | ///添加到推送列表 |
| | |
| | | /// </summary> |
| | | /// <param name="isBool">是否开启</param> |
| | | /// <returns></returns> |
| | | private List<Entity.Function> GetTestDevice(List<HDL_ON.Entity.Function> list, bool isBool) |
| | | private List<Entity.Function> GetTestDevice(ref List<HDL_ON.Entity.Function> list, bool isBool) |
| | | { |
| | | if (isBool) |
| | | { |
| | | Entity.Function function = new Entity.Function { sid = "0123456789", name = "超声波传感器", spk = Entity.SPK.SensorUtrasonic }; |
| | | var device = list.Find((o) => { return o.sid == function.sid; }); |
| | | if (device == null) |
| | | //模拟设备 |
| | | var functions = new List<Function> { |
| | | //new Entity.Function { sid = "1234567890", name = "超声波传感器", spk = Entity.SPK.SensorUtrasonic }, |
| | | // new Entity.Function { sid = "1234567891", name = "温度传感器", spk = Entity.SPK.SensorTemperature }, |
| | | // new Entity.Function { sid = "1234567892", name = "湿度传感器", spk = Entity.SPK.SensorHumidity }, |
| | | // new Entity.Function { sid = "1234567893", name = "红外对射传感器", spk = Entity.SPK.SensorDuiShe }, |
| | | // new Entity.Function { sid = "1234567895", name = "超声波传感器", spk = Entity.SPK.SensorUtrasonic }, |
| | | new Entity.Function { sid = "1234567896", name = "毫米波传感器", spk = Entity.SPK.SenesorMegahealth }, |
| | | new Entity.Function { sid = "1234567897", name = "毫米波传感器1", spk = Entity.SPK.SenesorMegahealth2 }, |
| | | new Entity.Function { sid = "1234567899", name = "门磁传感器", spk = Entity.SPK.SensorDoorWindow }, |
| | | }; |
| | | foreach (var function in functions) |
| | | { |
| | | list.Add(function); |
| | | var device = list.Find((o) => { return o.sid == function.sid; }); |
| | | if (device == null) |
| | | { |
| | | list.Add(function); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return list; |
| | | |
| | | |
| | | } |
| | | |