| | |
| | | { |
| | | } |
| | | |
| | | |
| | | #region base info |
| | | /// <summary> |
| | | /// HDL统一协议格式:14bytes
|
| | |
| | | /// 该功能添加到到房间列表 |
| | | /// </summary> |
| | | public List<string> roomIds = new List<string>(); |
| | | /// <summary> |
| | | /// 绑定房间 |
| | | /// </summary> |
| | | public void BindRoom(string roomId) |
| | | { |
| | | roomIds.Add(roomId); |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | pm.BindDeviceToRoom(deviceId, roomId); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// bus协议数据格式 |
| | |
| | | /// <summary> |
| | | /// 保存功能数据 |
| | | /// </summary> |
| | | public void SaveFunctionData() |
| | | public void SaveFunctionData(bool upSevser) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | FileUtils.WriteFileByBytes(savePath, ssd); |
| | | MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); |
| | | if (upSevser) |
| | | { |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var pack = pm.UpdataDevcieInfo(this); |
| | | if (pack.Code == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | FileUtils.WriteFileByBytes(savePath, ssd); |
| | | MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.ShowTip(Language.StringByID(StringId.EditFunctionInfoFail) + "Code:" + pack.Code); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | FileUtils.WriteFileByBytes(savePath, ssd); |
| | | MainPage.Log($"Save FunctionData {this.functionType} : {this.sid}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 获取本地控制数据 |
| | | /// </summary> |
| | | public GatewayAlinkControlObj GetGatewayAlinkControlData(Dictionary<string, string> commandDictionary) |
| | | public AlinkFunctionStatusObj GetGatewayAlinkControlData(Dictionary<string, string> commandDictionary) |
| | | { |
| | | var sendDataObj = new GatewayAlinkControlObj(); |
| | | var sendDataObj = new AlinkFunctionStatusObj(); |
| | | sendDataObj.id = Control.Ins.msg_id.ToString(); |
| | | sendDataObj.time_stamp = Control.Ins.Get_TimeStamp(); |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 本地控制 |
| | | /// A协议控制数据的对象 |
| | | /// </summary> |
| | | public class GatewayAlinkControlObj |
| | | public class AlinkFunctionStatusObj |
| | | { |
| | | public List<AlinkControlData> objects = new List<AlinkControlData>(); |
| | | |
| | |
| | | /// 本地状态读取 |
| | | /// A协议状态读取格式对象 |
| | | /// </summary> |
| | | public class GatewayAlinkReadObj |
| | | public class AlinkReadFunctionStatusObj |
| | | { |
| | | public string id = "0"; |
| | | public List<Dictionary<string, string>> objects = new List<Dictionary<string, string>>(); |
| | |
| | | /// <summary> |
| | | /// 最大值 |
| | | /// </summary> |
| | | public int max; |
| | | public int max=100; |
| | | /// <summary> |
| | | /// 最小值 |
| | | /// </summary> |
| | | public int min; |
| | | public int min=0; |
| | | /// <summary> |
| | | /// 数据类型 |
| | | /// </summary> |