| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.DAL.Net; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.Entity |
| | |
| | | public DB_ResidenceData() |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 主人token |
| | | /// </summary> |
| | | public string MasterToken; |
| | | /// <summary> |
| | | /// 0:bus网关 |
| | | /// 1:A协议网关 |
| | |
| | | } |
| | | else |
| | | { |
| | | var curRegion = MainPage.LoginUser.regionList.Find((obj) => obj.RegionID == CurReginID); |
| | | var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == CurReginID); |
| | | //if (curRegion == null) |
| | | //{ |
| | | // CurReginID = MainPage.LoginUser.regionList[0].RegionID; |
| | | // return MainPage.LoginUser.regionList[0]; |
| | | // CurReginID = UserInfo.Current.regionList[0].RegionID; |
| | | // return UserInfo.Current.regionList[0]; |
| | | //} |
| | | return curRegion; |
| | | } |
| | |
| | | { |
| | | sid = "030101123456780202010005ABCD", |
| | | name = "灯光1", |
| | | function = new List<Trait>() { |
| | | new Trait { name="on_off", max=100,min = 0, value_key= new List<string> { "on","off"} }, |
| | | function = new List<FunctionAttributes>() { |
| | | new FunctionAttributes { key="on_off", max=100,min = 0, value= new List<string> { "on","off"} }, |
| | | }, |
| | | roomIdList = new List<string>() { "0001" }, |
| | | bus_Data = new BusData |
| | |
| | | ins_Function = null; |
| | | if (MainPage.IsRemote) |
| | | { |
| | | Mqtt_Cloud.DisConnectRemoteMqttClient("退出登录,或者切换住宅"); |
| | | DAL.Mqtt.MqttClient.DisConnectRemote("退出登录,或者切换住宅"); |
| | | } |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 当前住宅的网关MAC |
| | | /// </summary> |
| | | public string residenceGatewayMAC = "0281B9078C000000";// "00964E19C4467B1E"; |
| | | public string residenceGatewayMAC = "4E47323347591243";//"0281B9078C000000";// "00964E19C4467B1E"; |
| | | /// <summary> |
| | | /// 保存住宅数据 |
| | | /// </summary> |
| | |
| | | case FunctionCategory.Thermostat: |
| | | if (DB_ResidenceData.residenceData.GatewayType == 0) |
| | | { |
| | | DriverLayer.Control.ins.SendReadCommand(function); |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | } |
| | | break; |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region oid列表 a协议转bus协议控制使用 |
| | | /// <summary> |
| | | /// oid数据保存的文件名 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public static string OidSavePathName = "AProtocolData_FunctionOid"; |
| | | static List<FunctionOid> ins_OidList; |
| | | public static List<FunctionOid> functionOidList |
| | | { |
| | |
| | | { |
| | | if (ins_OidList == null) |
| | | { |
| | | var bytes = FileUtils.ReadFile("AProtocolData_FunctionOid"); |
| | | var bytes = FileUtils.ReadFile(OidSavePathName); |
| | | if (bytes == null || bytes.Length == 0) |
| | | { |
| | | ins_OidList = new List<FunctionOid>(); |
| | |
| | | /// <summary> |
| | | /// 保存oid数据,每次保存都会覆盖 |
| | | /// </summary> |
| | | public static void SaveFunctionOidJsonDataList(string oidJsonString) |
| | | public static void SaveOidList(string oidJsonString) |
| | | { |
| | | oidJsonString = oidJsonString.Replace("add", "get_list_response"); |
| | | var oidBytes = System.Text.Encoding.UTF8.GetBytes(oidJsonString); |
| | | |
| | | FileUtils.WriteFileByBytes("AProtocolData_FunctionOid", oidBytes); |
| | | FileUtils.WriteFileByBytes(OidSavePathName, oidBytes); |
| | | } |
| | | |
| | | #endregion |