old mode 100644
new mode 100755
| | |
| | | |
| | | namespace ZigBee.Device |
| | | { |
| | | public class ZbGatewayData : CommonDevice |
| | | public class ZbGatewayData |
| | | { |
| | | #region 网关在线标识 |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | #region 一堆变量 |
| | | /// <summary> |
| | | /// 判断网关是否在线的标识,APP界面会改变它的值,Application会重新刷新它的值 |
| | | /// </summary> |
| | | public bool GatewayOnlineFlage = false; |
| | | /// <summary>
|
| | | /// 住宅ID |
| | | /// </summary> |
| | | public string HomeId = string.Empty; |
| | | /// <summary> |
| | | /// 网关所在的房间ID
|
| | | /// </summary> |
| | | public string RoomId = string.Empty; |
| | | ///<summary> |
| | | ///网关序列号,该网关唯一标识 |
| | | /// </summary> |
| | | public string GwId = string.Empty; |
| | | /// <summary> |
| | | ///网关名称 |
| | | /// </summary> |
| | | public string GwName = string.Empty; |
| | | /// <summary> |
| | | /// 网关的序列号 |
| | | /// </summary> |
| | | public string GwSerialNum = string.Empty; |
| | | /// <summary> |
| | | ///是否为主网关。(因为在外网的情况下,这个字段可以获取到,用来更新局域网中基本信息的对象中的主网关信息) |
| | | ///<para>0:否</para> |
| | | ///<para>1:是</para> |
| | | /// </summary> |
| | | public bool IsMainGateWay; |
| | | /// <summary> |
| | | ///网关所在局域网的ip地址 |
| | | /// </summary> |
| | | public string GwIP = string.Empty; |
| | | /// <summary> |
| | | /// 该网关应用程序版本(网关固件日期??) |
| | | /// </summary> |
| | | public long GwVersionDate = 0; |
| | | /// <summary> |
| | | ///Linux网关类型 |
| | | /// </summary> |
| | | public int LinuxImageType = -1; |
| | | /// <summary> |
| | | ///Linux网关硬件版本 |
| | | /// </summary> |
| | | public int LinuxHardVersion = -1; |
| | | /// <summary> |
| | | /// Linux网关固件版本 |
| | | /// </summary> |
| | | public int LinuxFirmwareVersion = -1; |
| | | /// <summary> |
| | | /// 协调器硬件版本 |
| | | /// </summary> |
| | | public int CoordinatorHardVersion = -1; |
| | | /// <summary> |
| | | /// 协调器固件版本 |
| | | /// </summary> |
| | | public int CoordinatorFirmwareVersion = -1; |
| | | /// <summary> |
| | | /// 协调器镜像ID(也叫网关镜像类型) |
| | | /// </summary> |
| | | public int CoordinatorImageId = -1; |
| | | /// <summary> |
| | | /// 虚拟驱动信息 |
| | | /// </summary> |
| | | public List<DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>(); |
| | | |
| | | #endregion |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | /// <summary> |
| | | /// 虚拟网关 |
| | | /// </summary> |
| | | public bool IsVirtual; |
| | | |
| | | #region 网关基本信息 |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public bool IsVirtual;
|
| | | /// <summary> |
| | | /// 该网关应用程序版本 |
| | | /// 最后的更新时间 |
| | | /// </summary> |
| | | public int AppVersion; |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public DateTime LastDateTime = DateTime.MinValue; |
| | | |
| | | /// <summary> |
| | | /// Zigbee协议器程序版本 |
| | | /// </summary> |
| | | public int ZigbeeVersion; |
| | | #endregion |
| | | |
| | | #region 网关信息. |
| | | /// <summary> |
| | | /// 网关版本信息,网关反馈信息 |
| | | /// </summary> |
| | | public GetGwVersionAllData getGwVersionAllData; |
| | | /// <summary> |
| | | /// 网关版本信息,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GetGwVersionAllData |
| | | public class GetGwVersionAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 网关版本信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 网关版本信息 |
| | | /// </summary> |
| | | public GetGwVersionData getGwVersion; |
| | | /// <summary> |
| | | /// 网关版本信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GetGwVersionData |
| | | { |
| | | /// <summary> |
| | | /// 该网关应用程序版本 |
| | | /// </summary> |
| | | public int AppVersion; |
| | | public long AppVersion; |
| | | /// <summary> |
| | | /// Zigbee协议器程序版本 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region 获取网关信息. |
| | | /// <summary> |
| | | /// 网关信息,网关反馈具体信息. |
| | | /// </summary> |
| | | public GetGwAllData getGwAllData; |
| | | |
| | | /// <summary> |
| | | /// 网关信息,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GetGwAllData |
| | | public class GetGwAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 网关信息 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关信息. |
| | | /// </summary> |
| | | public GetGwData getGwInfo; |
| | | /// <summary> |
| | | /// 网关信息 |
| | | /// 网关信息(屏蔽掉了一些目前不使用的变量) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GetGwData |
| | |
| | | ///<summary> |
| | | ///网关序列号,该网关唯一标识 |
| | | /// </summary> |
| | | public string GwId; |
| | | public string GwId;
|
| | | /// <summary> |
| | | ///网关绑定网卡的mac地址 |
| | | /// </summary> |
| | |
| | | ///网关名称 |
| | | /// </summary> |
| | | public string GwName; |
| | | /// <summary>
|
| | | /// 网关的序列号
|
| | | /// </summary> |
| | | public string GWSN = string.Empty; |
| | | /// <summary> |
| | | ///是否为主网关。(因为在外网的情况下,这个字段可以获取到,用来更新局域网中基本信息的对象中的主网关信息) |
| | | ///<para>0:否</para> |
| | | ///<para>1:是</para> |
| | | /// </summary> |
| | | public int IsDominant; |
| | | public int IsDominant;
|
| | | ///<summary> |
| | | ///utc时间戳,程序启动时网关的系统时间 |
| | | ///</summary> |
| | | public int StartTime; |
| | | public long StartTime;
|
| | | /// <summary> |
| | | ///加入局域网模式 |
| | | ///<para>0:wifi连接局域网</para> |
| | |
| | | /// <summary> |
| | | ///网关所在局域网的ip地址 |
| | | /// </summary> |
| | | public string GwIP; |
| | | public string GwIP;
|
| | | /// <summary>
|
| | | /// 主人的Guid(即使是管理员,这里也是主人的Guid)
|
| | | /// </summary> |
| | | public string AccountId;
|
| | | /// <summary> |
| | | ///当前局域网网络号占用位数,用于计算子网掩码,如Mask=32,则子网掩码为255.255.255.0 |
| | | /// </summary> |
| | | public int Mask; |
| | | public int Mask;
|
| | | /// <summary> |
| | | ///上级路由器无线名称 |
| | | ///<para>当 JoinMode = 0时存在 </para> |
| | | /// </summary> |
| | | public string RouteESSID; |
| | | public string RouteESSID;
|
| | | /// <summary> |
| | | ///DNS服务器地址 |
| | | /// </summary> |
| | | public string DNSServer; |
| | | /// <summary> |
| | | /// 该网关应用程序版本 |
| | | /// 该网关应用程序版本(网关固件日期??) |
| | | /// </summary> |
| | | public int AppVersion; |
| | | public long AppVersion;
|
| | | /// <summary> |
| | | /// Zigbee协议器程序版本 |
| | | /// </summary> |
| | | public int ZigbeeVersion; |
| | | public int ZigbeeVersion;
|
| | | /// <summary> |
| | | ///协调器mac地址 |
| | | /// </summary> |
| | | public string ZigbeeMacAddr; |
| | | public string ZigbeeMacAddr;
|
| | | /// <summary> |
| | | ///网关宅id |
| | | /// </summary> |
| | | public string HomeId; |
| | | public string HomeId;
|
| | | /// <summary> |
| | | ///是否已经连接云端mqtt |
| | | ///<para>0:否</para> |
| | | ///<para>1:是</para> |
| | | /// </summary> |
| | | public int IsConnectCloud; |
| | | public int IsConnectCloud;
|
| | | /// <summary> |
| | | ///(用于网关程序调试) |
| | | ///<para>https登陆云端时,最近一次获取的响应状态码。根据云端的定义,有如下状态码。</para> |
| | |
| | | /// <summary> |
| | | /// 网关镜像类型 |
| | | /// </summary> |
| | | public int ZbImageType; |
| | | |
| | | public int ZbImageType;
|
| | | /// <summary> |
| | | /// 虚拟驱动信息 |
| | | /// </summary> |
| | | public List <DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>(); |
| | | public List<DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>(); |
| | | }
|
| | |
|
| | | public class DriveCodeListObj |
| | |
| | | /// <summary> |
| | | /// 修改网关名称,网关反馈具体信息 |
| | | /// </summary> |
| | | public GwReNameAllData gwReNameAllData; |
| | | /// <summary> |
| | | /// 修改网关名称,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GwReNameAllData |
| | | public class GwReNameAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 修改网关名称 |
| | | /// </summary> |
| | | public GwReNameData gwReNameData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改网关名称 |
| | | /// </summary> |
| | | public GwReNameData gwRename; |
| | | /// <summary> |
| | | /// 修改网关名称 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 网关住宅id数据,网关反馈具体信息 |
| | | /// </summary> |
| | | public GwSetHomeIdAllData gwSetHomeIdAllData; |
| | | /// <summary> |
| | | /// 网关住宅id数据,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GwSetHomeIdAllData |
| | | public class GwSetHomeIdAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 网关住宅id数据 |
| | | /// </summary> |
| | | public GwSetHomeIdData gwSetHomeIdData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关住宅id数据 |
| | | /// </summary> |
| | | public GwSetHomeIdData gwSetHomeId; |
| | | /// <summary> |
| | | /// 网关住宅id数据 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 广播发现协议 |
| | | /// </summary> |
| | | public GatewayBaseInfo getGatewayBaseInfo = new GatewayBaseInfo { }; |
| | | /// <summary> |
| | | /// 广播发现协议 |
| | | /// 广播发现协议(屏蔽掉了一些目前不用的变量) |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GatewayBaseInfo |
| | |
| | | /// <summary> |
| | | /// 住宅id,4字节整型。(小端结构)如果网关不设置宅id,将默认为0 |
| | | /// </summary> |
| | | public string HomeId = string.Empty; |
| | | public string HomeId = string.Empty;
|
| | | /// <summary> |
| | | /// 网关当前时间戳(小端结构) |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int Time; |
| | | /// <summary> |
| | | /// 是否为主网关 |
| | |
| | | /// </summary> |
| | | public string GwName; |
| | | /// <summary> |
| | | /// RSA公钥 |
| | | /// </summary> |
| | | //public string PubKey; |
| | | //string id; |
| | | /// <summary> |
| | | /// 网关ID |
| | | /// </summary> |
| | | public string gwID; |
| | | //{ |
| | | // get{ |
| | | // return id; |
| | | // } |
| | | // set{ |
| | | // id = value; |
| | | // //System.Console.WriteLine("===========123456"); |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网关成为主网关时广播通知 |
| | | /// </summary> |
| | | public MainGatewayBaseInfo getMainGatewayBaseInfo; |
| | | /// <summary> |
| | | /// 网关成为主网关时广播通知 |
| | | /// </summary> |
| | |
| | | }
|
| | | #endregion |
| | |
|
| | | #region 获取所有网关的节点设备信息(用于主网关) |
| | | ///// <summary>
|
| | | ///// 获取所有网关的节点设备信息(用于主网关)
|
| | | ///// </summary>
|
| | | //public static async System.Threading.Tasks.Task<List<CommonDevice>> GetAllGatewayDeviceInfoList()
|
| | | //{
|
| | | // if (ZbGateway.MainGateWay == null)
|
| | | // {
|
| | | // return null;
|
| | | // }
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Clear();
|
| | | // return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<CommonDevice>>>)(async () =>
|
| | | // {
|
| | | // var dateTime = DateTime.Now;
|
| | | // Action<string, string> action = (topic, message) =>
|
| | | // {
|
| | |
|
| | | // var gatewayID = topic.Split('/')[0];
|
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message);
|
| | | // if (topic == gatewayID + "/" + "DeviceInfoRespon")
|
| | | // {
|
| | | // dateTime = DateTime.Now;
|
| | | // var deviceID = jobject.Value<int>("Device_ID");
|
| | | // switch ((DeviceType)(deviceID))
|
| | | // {
|
| | | // case DeviceType.ColorDimmableLight:
|
| | | // var dimmableLight = new ColorDimmableLight() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") };
|
| | | // dimmableLight.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ColorDimmableLight.AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (dimmableLight.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // dimmableLight.CurrentGateWayId = dimmableLight.getAllGatewayDeviceInfo.GwId;
|
| | | // var light = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == dimmableLight.DeviceID && obj.DeviceAddr == dimmableLight.DeviceAddr && obj.DeviceEpoint == dimmableLight.DeviceEpoint);
|
| | | // if (light == null)
|
| | | // {
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(dimmableLight);
|
| | | // dimmableLight.DeviceName = dimmableLight.getAllGatewayDeviceInfo.MacName;
|
| | | // dimmableLight.DeviceEpointName = dimmableLight.getAllGatewayDeviceInfo.DeviceName;
|
| | | // dimmableLight.ImgVersion = dimmableLight.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // dimmableLight.IsOnline = dimmableLight.getAllGatewayDeviceInfo.IsOnline;
|
| | | // dimmableLight.IasDeviceType = dimmableLight.getAllGatewayDeviceInfo.DeviceType;
|
| | | // dimmableLight.Profile = dimmableLight.getAllGatewayDeviceInfo.Profile;
|
| | | // dimmableLight.ImgTypeId = dimmableLight.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // dimmableLight.InClusterList = dimmableLight.getAllGatewayDeviceInfo.InClusterList;
|
| | | // dimmableLight.OutClusterList = dimmableLight.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // dimmableLight.AttributeStatus = dimmableLight.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // dimmableLight.Save();
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // light.getAllGatewayDeviceInfo = dimmableLight.getAllGatewayDeviceInfo;
|
| | | // light.DeviceName = dimmableLight.getAllGatewayDeviceInfo.MacName;
|
| | | // light.DeviceEpointName = dimmableLight.getAllGatewayDeviceInfo.DeviceName;
|
| | | // light.ImgVersion = dimmableLight.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // light.IsOnline = dimmableLight.getAllGatewayDeviceInfo.IsOnline;
|
| | | // light.IasDeviceType = dimmableLight.getAllGatewayDeviceInfo.DeviceType;
|
| | | // light.Profile = dimmableLight.getAllGatewayDeviceInfo.Profile;
|
| | | // light.ImgTypeId = dimmableLight.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // light.InClusterList = dimmableLight.getAllGatewayDeviceInfo.InClusterList;
|
| | | // light.OutClusterList = dimmableLight.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // light.AttributeStatus = dimmableLight.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // light.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | |
|
| | | // break;
|
| | | // case DeviceType.OnOffOutput:
|
| | | // var toggleLight = new ToggleLight() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") };
|
| | | // toggleLight.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ToggleLight.AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (toggleLight.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // toggleLight.CurrentGateWayId = toggleLight.getAllGatewayDeviceInfo.GwId;
|
| | |
|
| | | // var localToggleLight = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == toggleLight.DeviceID && obj.DeviceAddr == toggleLight.DeviceAddr && obj.DeviceEpoint == toggleLight.DeviceEpoint);
|
| | | // if (localToggleLight == null)
|
| | | // {
|
| | | // toggleLight.DeviceName = toggleLight.getAllGatewayDeviceInfo.MacName;
|
| | | // toggleLight.DeviceEpointName = toggleLight.getAllGatewayDeviceInfo.DeviceName;
|
| | | // toggleLight.ImgVersion = toggleLight.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // toggleLight.IsOnline = toggleLight.getAllGatewayDeviceInfo.IsOnline;
|
| | | // toggleLight.IasDeviceType = toggleLight.getAllGatewayDeviceInfo.DeviceType;
|
| | | // toggleLight.Profile = toggleLight.getAllGatewayDeviceInfo.Profile;
|
| | | // toggleLight.ImgTypeId = toggleLight.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // toggleLight.InClusterList = toggleLight.getAllGatewayDeviceInfo.InClusterList;
|
| | | // toggleLight.OutClusterList = toggleLight.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // toggleLight.AttributeStatus = toggleLight.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(toggleLight);
|
| | | // toggleLight.Save();
|
| | |
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // localToggleLight.getAllGatewayDeviceInfo = toggleLight.getAllGatewayDeviceInfo;
|
| | | // localToggleLight.DeviceName = toggleLight.getAllGatewayDeviceInfo.MacName;
|
| | | // localToggleLight.DeviceEpointName = toggleLight.getAllGatewayDeviceInfo.DeviceName;
|
| | | // localToggleLight.ImgVersion = toggleLight.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // localToggleLight.IsOnline = toggleLight.getAllGatewayDeviceInfo.IsOnline;
|
| | | // localToggleLight.IasDeviceType = toggleLight.getAllGatewayDeviceInfo.DeviceType;
|
| | | // localToggleLight.Profile = toggleLight.getAllGatewayDeviceInfo.Profile;
|
| | | // localToggleLight.ImgTypeId = toggleLight.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // localToggleLight.InClusterList = toggleLight.getAllGatewayDeviceInfo.InClusterList;
|
| | | // localToggleLight.OutClusterList = toggleLight.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // localToggleLight.AttributeStatus = toggleLight.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // localToggleLight.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | |
|
| | | // break;
|
| | | // case DeviceType.OnOffSwitch:
|
| | | // var panel = new Panel() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") };
|
| | | // panel.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Panel.AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (panel.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // panel.CurrentGateWayId = panel.getAllGatewayDeviceInfo.GwId;
|
| | |
|
| | | // var localPanel = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == panel.DeviceID && obj.DeviceAddr == panel.DeviceAddr && obj.DeviceEpoint == panel.DeviceEpoint);
|
| | | // if (localPanel == null)
|
| | | // {
|
| | | // panel.DeviceName = panel.getAllGatewayDeviceInfo.MacName;
|
| | | // panel.DeviceEpointName = panel.getAllGatewayDeviceInfo.DeviceName;
|
| | | // panel.ImgVersion = panel.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // panel.IsOnline = panel.getAllGatewayDeviceInfo.IsOnline;
|
| | | // panel.IasDeviceType = panel.getAllGatewayDeviceInfo.DeviceType;
|
| | | // panel.Profile = panel.getAllGatewayDeviceInfo.Profile;
|
| | | // panel.ImgTypeId = panel.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // panel.InClusterList = panel.getAllGatewayDeviceInfo.InClusterList;
|
| | | // panel.OutClusterList = panel.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // panel.AttributeStatus = panel.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // if (panel.DeviceAddr != null)
|
| | | // {
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(panel);
|
| | | // }
|
| | | // panel.Save();
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // localPanel.getAllGatewayDeviceInfo = panel.getAllGatewayDeviceInfo;
|
| | | // localPanel.DeviceName = panel.getAllGatewayDeviceInfo.MacName;
|
| | | // localPanel.DeviceEpointName = panel.getAllGatewayDeviceInfo.DeviceName;
|
| | | // localPanel.ImgVersion = panel.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // localPanel.IsOnline = panel.getAllGatewayDeviceInfo.IsOnline;
|
| | | // localPanel.IasDeviceType = panel.getAllGatewayDeviceInfo.DeviceType;
|
| | | // localPanel.Profile = panel.getAllGatewayDeviceInfo.Profile;
|
| | | // localPanel.ImgTypeId = panel.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // localPanel.InClusterList = panel.getAllGatewayDeviceInfo.InClusterList;
|
| | | // localPanel.OutClusterList = panel.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // localPanel.AttributeStatus = panel.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // localPanel.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | |
|
| | | // break;
|
| | | // case DeviceType.WindowCoveringDevice:
|
| | | // var windowCovering = new Rollershade() { DeviceID = jobject.Value<int>((object)"Device_ID"), DeviceAddr = jobject.Value<string>((object)"DeviceAddr"), DeviceEpoint = jobject.Value<int>((object)"Epoint"), DataID = jobject.Value<int>((object)"Data_ID") };
|
| | | // windowCovering.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<Rollershade.AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (windowCovering.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // windowCovering.CurrentGateWayId = windowCovering.getAllGatewayDeviceInfo.GwId;
|
| | |
|
| | | // var wc = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == windowCovering.DeviceID && obj.DeviceAddr == windowCovering.DeviceAddr && obj.DeviceEpoint == windowCovering.DeviceEpoint);
|
| | | // if (wc == null)
|
| | | // {
|
| | | // windowCovering.DeviceName = windowCovering.getAllGatewayDeviceInfo.MacName;
|
| | | // windowCovering.DeviceEpointName = windowCovering.getAllGatewayDeviceInfo.DeviceName;
|
| | | // windowCovering.ImgVersion = windowCovering.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // windowCovering.IsOnline = windowCovering.getAllGatewayDeviceInfo.IsOnline;
|
| | | // windowCovering.IasDeviceType = windowCovering.getAllGatewayDeviceInfo.DeviceType;
|
| | | // windowCovering.Profile = windowCovering.getAllGatewayDeviceInfo.Profile;
|
| | | // windowCovering.ImgTypeId = windowCovering.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // windowCovering.InClusterList = windowCovering.getAllGatewayDeviceInfo.InClusterList;
|
| | | // windowCovering.OutClusterList = windowCovering.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // windowCovering.AttributeStatus = windowCovering.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(windowCovering);
|
| | | // windowCovering.Save();
|
| | |
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // wc.getAllGatewayDeviceInfo = windowCovering.getAllGatewayDeviceInfo;
|
| | | // wc.DeviceName = windowCovering.getAllGatewayDeviceInfo.MacName;
|
| | | // wc.DeviceEpointName = windowCovering.getAllGatewayDeviceInfo.DeviceName;
|
| | | // wc.ImgVersion = windowCovering.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // wc.IsOnline = windowCovering.getAllGatewayDeviceInfo.IsOnline;
|
| | | // wc.IasDeviceType = windowCovering.getAllGatewayDeviceInfo.DeviceType;
|
| | | // wc.Profile = windowCovering.getAllGatewayDeviceInfo.Profile;
|
| | | // wc.ImgTypeId = windowCovering.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // wc.InClusterList = windowCovering.getAllGatewayDeviceInfo.InClusterList;
|
| | | // wc.OutClusterList = windowCovering.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // wc.AttributeStatus = windowCovering.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // wc.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | |
|
| | | // break;
|
| | | // case DeviceType.IASZone:
|
| | | // var ias = new IASZone() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") };
|
| | | // ias.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<IASZone.AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (ias.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // ias.CurrentGateWayId = ias.getAllGatewayDeviceInfo.GwId;
|
| | |
|
| | | // var infoIAS = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == ias.DeviceID && obj.DeviceAddr == ias.DeviceAddr && obj.DeviceEpoint == ias.DeviceEpoint);
|
| | | // if (infoIAS == null)
|
| | | // {
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(ias);
|
| | | // ias.DeviceName = ias.getAllGatewayDeviceInfo.MacName;
|
| | | // ias.DeviceEpointName = ias.getAllGatewayDeviceInfo.DeviceName;
|
| | | // ias.ImgVersion = ias.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // ias.IsOnline = ias.getAllGatewayDeviceInfo.IsOnline;
|
| | | // ias.IasDeviceType = ias.getAllGatewayDeviceInfo.DeviceType;
|
| | | // ias.Profile = ias.getAllGatewayDeviceInfo.Profile;
|
| | | // ias.ImgTypeId = ias.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // ias.InClusterList = ias.getAllGatewayDeviceInfo.InClusterList;
|
| | | // ias.OutClusterList = ias.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // ias.AttributeStatus = ias.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ias.Save();
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // infoIAS.DeviceName = ias.getAllGatewayDeviceInfo.MacName;
|
| | | // infoIAS.DeviceEpointName = ias.getAllGatewayDeviceInfo.DeviceName;
|
| | | // infoIAS.getAllGatewayDeviceInfo = ias.getAllGatewayDeviceInfo;
|
| | | // infoIAS.ImgVersion = ias.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // infoIAS.IsOnline = ias.getAllGatewayDeviceInfo.IsOnline;
|
| | | // infoIAS.IasDeviceType = ias.getAllGatewayDeviceInfo.DeviceType;
|
| | | // infoIAS.Profile = ias.getAllGatewayDeviceInfo.Profile;
|
| | | // infoIAS.ImgTypeId = ias.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // infoIAS.InClusterList = ias.getAllGatewayDeviceInfo.InClusterList;
|
| | | // infoIAS.OutClusterList = ias.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // infoIAS.AttributeStatus = ias.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ias.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | | // break;
|
| | | // case DeviceType.OtaDevice:
|
| | | // case DeviceType.OtaPanelDevice:
|
| | | // var ota = new OTADevice() { Time = jobject.Value<int>("Time"), DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID") };
|
| | | // ota.getAllGatewayDeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<AllGatewayDeviceInfo>(jobject["Data"].ToString());
|
| | | // if (ota.getAllGatewayDeviceInfo == null)
|
| | | // {
|
| | | // return;
|
| | | // }
|
| | | // ota.CurrentGateWayId = ota.getAllGatewayDeviceInfo.GwId;
|
| | |
|
| | | // var infoOta = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == ota.DeviceID && obj.DeviceAddr == ota.DeviceAddr && obj.DeviceEpoint == ota.DeviceEpoint);
|
| | | // if (infoOta == null)
|
| | | // {
|
| | | // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(ota);
|
| | | // ota.DeviceName = ota.getAllGatewayDeviceInfo.MacName;
|
| | | // ota.DeviceEpointName = ota.getAllGatewayDeviceInfo.DeviceName;
|
| | | // ota.ImgVersion = ota.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // ota.IsOnline = ota.getAllGatewayDeviceInfo.IsOnline;
|
| | | // ota.IasDeviceType = ota.getAllGatewayDeviceInfo.DeviceType;
|
| | | // ota.Profile = ota.getAllGatewayDeviceInfo.Profile;
|
| | | // ota.ImgTypeId = ota.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // ota.InClusterList = ota.getAllGatewayDeviceInfo.InClusterList;
|
| | | // ota.OutClusterList = ota.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // ota.AttributeStatus = ota.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ota.Save();
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // infoOta.DeviceName = ota.getAllGatewayDeviceInfo.MacName;
|
| | | // infoOta.DeviceEpointName = ota.getAllGatewayDeviceInfo.DeviceName;
|
| | | // infoOta.getAllGatewayDeviceInfo = ota.getAllGatewayDeviceInfo;
|
| | | // infoOta.ImgVersion = ota.getAllGatewayDeviceInfo.ImgVersion;
|
| | | // infoOta.IsOnline = ota.getAllGatewayDeviceInfo.IsOnline;
|
| | | // infoOta.IasDeviceType = ota.getAllGatewayDeviceInfo.DeviceType;
|
| | | // infoOta.Profile = ota.getAllGatewayDeviceInfo.Profile;
|
| | | // infoOta.ImgTypeId = ota.getAllGatewayDeviceInfo.ImgTypeId;
|
| | | // infoOta.InClusterList = ota.getAllGatewayDeviceInfo.InClusterList;
|
| | | // infoOta.OutClusterList = ota.getAllGatewayDeviceInfo.OutClusterList;
|
| | | // infoOta.AttributeStatus = ota.getAllGatewayDeviceInfo.AttributeStatus;
|
| | | // ota.ReSave();
|
| | | // }
|
| | | // System.Console.WriteLine($"收到通知后的主题_{ topic}");
|
| | | // break;
|
| | | // //case DeviceType.Thermostat:
|
| | | // //var thermostat = new ThermostatObj() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID };
|
| | | // //thermostat.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ThermostatObj.DeviceInfoData>(jobject["Data"].ToString());
|
| | | // //if (thermostat.DeviceInfo == null)
|
| | | // //{
|
| | | // // return;
|
| | | // //}
|
| | | // // var ther = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == thermostat.DeviceID && obj.DeviceAddr == thermostat.DeviceAddr && obj.DeviceEpoint == thermostat.DeviceEpoint);
|
| | | // //if (ther == null)
|
| | | // //{
|
| | | // // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName;
|
| | | // // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(thermostat);
|
| | | // //}
|
| | | // //else
|
| | | // //{
|
| | | // // thermostat.DeviceName = thermostat.DeviceInfo.DeviceName;
|
| | | // // ZigBee.IO.LocalFileUtils.SaveDeviceInfo(thermostat, thermostat.DeviceEpoint.ToString());
|
| | | // //}
|
| | | // //break;
|
| | | // //case DeviceType.TemperatureSensor:
|
| | | // // var temperatureSensor = new TemperatureSensor() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo.gwID };
|
| | | // // temperatureSensor.DeviceInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<TemperatureSensor.DeviceInfoData>(jobject["Data"].ToString());
|
| | | // // if (temperatureSensor.DeviceInfo == null)
|
| | | // // {
|
| | | // // return;
|
| | | // // }
|
| | | // // var ts = ZbGateway.MainGateWay.AllGatewayDeviceList.Find(obj => obj.DeviceID == temperatureSensor.DeviceID && obj.DeviceAddr == temperatureSensor.DeviceAddr && obj.DeviceEpoint == temperatureSensor.DeviceEpoint);
|
| | | // // if (ts == null)
|
| | | // // {
|
| | | // // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName;
|
| | | // // ZbGateway.MainGateWay.AllGatewayDeviceList.Add(temperatureSensor);
|
| | |
|
| | | // // }
|
| | | // // else
|
| | | // // {
|
| | | // // temperatureSensor.DeviceName = temperatureSensor.DeviceInfo.DeviceName;
|
| | | // // IO.LocalFileUtils.SaveDeviceInfo(temperatureSensor, temperatureSensor.DeviceEpoint.ToString());
|
| | | // // }
|
| | | // // break;
|
| | |
|
| | | // }
|
| | | // }
|
| | | // };
|
| | |
|
| | | // ZbGateway.MainGateWay.Actions += action;
|
| | | // System.Console.WriteLine("MainGatewayDeviceInfo_Actions 启动" + System.DateTime.Now.ToString());
|
| | |
|
| | | // var jObject = new JObject { { "Cluster_ID", 0 }, { "Command", 90 } };
|
| | | // ZbGateway.MainGateWay.CurrentGateWayId = ZbGateway.MainGateWay.getGatewayBaseInfo?.gwID;
|
| | | // ZbGateway.MainGateWay.Send("GetAllDeviceInfo", Common.SecuritySet.Encryption(jObject.ToString()));
|
| | |
|
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 4000)
|
| | | // {
|
| | | // await System.Threading.Tasks.Task.Delay(100);
|
| | | // }
|
| | |
|
| | | // ZbGateway.MainGateWay.Actions -= action;
|
| | | // System.Console.WriteLine("MainGatewayDeviceInfo_Actions 退出" + System.DateTime.Now.ToString());
|
| | | // return ZbGateway.MainGateWay.AllGatewayDeviceList;
|
| | | // }));
|
| | | //}
|
| | | #endregion |
| | |
|
| | | #region 网关恢复出厂设置 |
| | | /// <summary> |
| | | /// 网关恢复出厂设置返回的数据. |
| | | /// </summary> |
| | | public GwLinuxResetResponData gwLinuxResetResponData; |
| | | /// <summary> |
| | | /// 网关恢复出厂设置返回的数据. |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GwLinuxResetResponData |
| | | public class GwLinuxResetResponData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>网关恢复出厂设置</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | ///<summary > |
| | | /// <para>0:命令已接收,系统即将恢复出厂并重启。</para> |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 重启网关系统返回数据 |
| | | /// </summary> |
| | | public GwRebootResponAllData gwRebootResponAllData; |
| | | /// <summary> |
| | | /// 重启网关系统返回数据 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GwRebootResponAllData |
| | | public class GwRebootResponAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | ///<summary > |
| | | /// <para>返回值是0:命令已接收,系统即将重启。</para> |
| | | /// </summary> |
| | | public int Result = 999; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重启网关系统返回数据 |
| | | /// </summary> |
| | | public GwRebootResponData gwRebootResponData; |
| | | /// <summary> |
| | | /// 重启网关系统返回数据 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 保存zigbee协调器组网信息,网关反馈具体信息 |
| | | /// </summary> |
| | | public SaveNVFileResponseAllData saveNVFileResponseData; |
| | | /// <summary> |
| | | /// 保存zigbee协调器组网信息,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SaveNVFileResponseAllData |
| | | public class SaveNVFileResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 保存zigbee协调器组网信息 |
| | | /// </summary> |
| | | public SaveNVFileResponseData saveNVFileResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保存zigbee协调器组网信息 |
| | | /// </summary> |
| | | public SaveNVFileResponseData zbGwOperationSaveNVFileData; |
| | | /// <summary> |
| | | /// 保存zigbee协调器组网信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 协调器恢复组网信息,网关反馈具体信息 |
| | | /// </summary> |
| | | public RestoreNVAllDtta restoreNVAllDtta; |
| | | /// <summary> |
| | | /// 协调器恢复组网信息,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class RestoreNVAllDtta |
| | | public class RestoreNVAllDtta : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 协调器恢复组网信息 |
| | | /// </summary> |
| | | public RestoreNVDtta restoreNVDtta; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 协调器恢复组网信息 |
| | | /// </summary> |
| | | public RestoreNVDtta restoreNVDtta; |
| | | /// <summary> |
| | | /// 协调器恢复组网信息 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region 协调器升级 |
| | | |
| | | /// <summary> |
| | | /// 协调器升级,网关反馈具体信息 |
| | | /// 下载进度 |
| | | /// </summary |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public CommonDevice.DownloadFileProgressResponData downloadFileProgressResponData = null; |
| | | /// <summary> |
| | | /// 启动升级 |
| | | /// </summary> |
| | | public ZbGwOperationUpgradeAllData zbGwOperationUpgradeAllData; |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public CommonDevice.OTAScheduleResponData oTAScheduleResponData = null; |
| | | |
| | | /// <summary> |
| | | /// 协调器升级,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ZbGwOperationUpgradeAllData |
| | | public class ZbGwOperationUpgradeAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 协调器升级 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 协调器升级 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public ZbGwOperationUpgradeData zbGwOperationUpgradeData; |
| | | /// <summary> |
| | | /// 协调器升级 |
| | |
| | | /// <summary> |
| | | /// 升级虚拟驱动设备,网关反馈具体信息 |
| | | /// </summary> |
| | | public VirtualDriveUpgradeResponseAllData virtualDriveUpgradeResponseAllData; |
| | | /// <summary> |
| | | /// 升级虚拟驱动设备,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class VirtualDriveUpgradeResponseAllData |
| | | public class VirtualDriveUpgradeResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 升级虚拟驱动设备 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 升级虚拟驱动设备 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public VirtualDriveUpgradeResponData virtualDriveUpgradeResponData; |
| | | /// <summary> |
| | | /// 升级虚拟驱动设备 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class VirtualDriveUpgradeResponData |
| | | { |
| | |
| | | /// <summary> |
| | | /// 查看网关记录的虚拟驱动,网关反馈具体信息 |
| | | /// </summary> |
| | | public CheckVDDriveCodeResponseAllData checkVDDriveCodeResponseAllData; |
| | | /// <summary> |
| | | /// 查看网关记录的虚拟驱动,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class CheckVDDriveCodeResponseAllData |
| | | public class CheckVDDriveCodeResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 查看网关记录的虚拟驱动 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 查看网关记录的虚拟驱动 |
| | | /// </summary> |
| | | public VDriveDriveCodeResponData vDriveDriveCodeResponData; |
| | | [System.Serializable] |
| | | public class VDriveDriveCodeResponData |
| | | { |
| | |
| | | /// <summary> |
| | | /// 网关系统升级,网关反馈具体信息 |
| | | /// </summary> |
| | | public LinuxUpgradeAllData linuxUpgradeAllData; |
| | | /// <summary> |
| | | /// 网关系统升级,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class LinuxUpgradeAllData |
| | | public class LinuxUpgradeAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 0:正常(默认回复) |
| | | ///<para>1:找不到升级固件,路径或升级固件名称错误。</para> |
| | |
| | | /// <summary> |
| | | /// 获取协调器当前信道,网关反馈具体信息 |
| | | /// </summary> |
| | | public GwGetChannelResponData zbGwGetChannelResponData; |
| | | /// <summary> |
| | | /// 获取协调器当前信道,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GwGetChannelResponData |
| | | public class GwGetChannelResponData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 协调器当前信道 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 更改协调器当前信道,网关反馈具体信息 |
| | | /// </summary> |
| | | public ChangeChannelResponAllData changeChannelResponAllData; |
| | | /// <summary> |
| | | /// 更改协调器当前信道,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ChangeChannelResponAllData |
| | | public class ChangeChannelResponAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 更改协调器当前信道数据 |
| | | /// </summary> |
| | | public ChangeChannelResponData changeChannelResponData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更改协调器当前信道数据 |
| | | /// </summary> |
| | | public ChangeChannelResponData changeChannelResponData; |
| | | /// <summary> |
| | | /// 更改协调器当前信道数据 |
| | | /// </summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | //#region 获取协调器获取协调器当前发射功率. |
| | | /////<summary > |
| | | ///// 获取协调器获取协调器当前发射功率 |
| | | ///// </summary> |
| | | //public static async System.Threading.Tasks.Task<GwGetPowerResponData> GetPowerAsync(ZigBee.Device.ZbGateway gateway) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // GwGetPowerResponData d = null; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d = new GwGetPowerResponData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GwGetPowerResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/GetPower_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | // var power = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["Power"].ToString()); |
| | | |
| | | // if (power == 0) |
| | | // { |
| | | // d = new GwGetPowerResponData { errorMessageBase = "网关返回的数据为空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GwGetPowerResponData { power = power }; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | |
| | | // gateway.Actions += action; |
| | | // System.Console.WriteLine("GetPower_Actions 启动" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 10 } };
|
| | | // gateway.Send(("ZbGw/GetPower"), Common.SecuritySet.Encryption((jObject.ToString()))); |
| | | |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // if (d != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) |
| | | // { |
| | | // d = new GwGetPowerResponData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // System.Console.WriteLine("GetPower_Actions 退出" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 获取协调器获取协调器当前发射功率,网关反馈具体信息 |
| | | ///// </summary> |
| | | //public GwGetPowerResponData gwGetPowerResponData; |
| | | ///// <summary> |
| | | ///// 获取协调器获取协调器当前发射功率,网关反馈具体信息 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class GwGetPowerResponData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 错误信息 |
| | | // /// </summary> |
| | | // public string errorMessageBase; |
| | | // /// <summary> |
| | | // /// 网关信息错误反馈 |
| | | // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | // /// </summary> |
| | | // public ErrorResponData errorResponData; |
| | | // /// <summary> |
| | | // /// 协调器发射功率 |
| | | // /// </summary> |
| | | // public int power = 999; |
| | | //} |
| | | |
| | | //#endregion |
| | | |
| | | //#region 设置发射功. |
| | | /////<summary > |
| | | /////设置发射功率 |
| | | ///// <para>power:要更改的设备发射功率,可设置8,10,11,13,15,16,18,19,20,21,22(dBm)</para> |
| | | ///// </summary> |
| | | //public static async System.Threading.Tasks.Task<SetPowerResponAllData> GwSetPowerAsync(ZigBee.Device.ZbGateway gateway, int power) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // SetPowerResponAllData d = null; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d = new SetPowerResponAllData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new SetPowerResponAllData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/SetPower_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | // var tempInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<SetPoweResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempInfo == null) |
| | | // { |
| | | // d = new SetPowerResponAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new SetPowerResponAllData { setPoweResponData = tempInfo }; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | |
| | | // gateway.Actions += action; |
| | | // System.Console.WriteLine("ZbGw/SetPower_Actions 启动" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 11 } }; |
| | | // var data = new JObject { { "Power", power } }; |
| | | // jObject.Add("Data", data);
|
| | | // gateway.Send(("ZbGw/SetPower"), Common.SecuritySet.Encryption(jObject.ToString(),Password)); |
| | | |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // if (d != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) |
| | | // { |
| | | // d = new SetPowerResponAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // System.Console.WriteLine("ZbGw/SetPower_Actions退出" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 设置发射功率,网关反馈具体信息 |
| | | ///// </summary> |
| | | //public SetPowerResponAllData setPoweResponAllData; |
| | | ///// <summary> |
| | | ///// 设置发射功率,网关反馈具体信息 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class SetPowerResponAllData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 错误信息 |
| | | // /// </summary> |
| | | // public string errorMessageBase; |
| | | // /// <summary> |
| | | // /// 网关信息错误反馈 |
| | | // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | // /// </summary> |
| | | // public ErrorResponData errorResponData; |
| | | // /// <summary> |
| | | // /// 设置发射功率数据 |
| | | // /// </summary> |
| | | // public SetPoweResponData setPoweResponData; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 设置发射功率数据 |
| | | ///// </summary> |
| | | //public SetPoweResponData setPoweResponData; |
| | | ///// <summary> |
| | | ///// 设置发射功率数据 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class SetPoweResponData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 是否配置成功 |
| | | // ///<para>0:成功</para> |
| | | // ///<para>2:配置的信道为无效值</para> |
| | | // /// </summary> |
| | | // public int Status = 999; |
| | | // /// <summary> |
| | | // /// 功率 |
| | | // /// </summary> |
| | | // public int Power = 999; |
| | | //} |
| | | //#endregion |
| | | |
| | | //#region 读取当前局域网的PANID. |
| | | /////<summary > |
| | | ///// 读取当前局域网的PANID |
| | | ///// </summary> |
| | | //public static async System.Threading.Tasks.Task<GetPanIdResponData> ReadPanIdAsync(ZigBee.Device.ZbGateway gateway) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // GetPanIdResponData d = null; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d = new GetPanIdResponData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GetPanIdResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/GetPanId_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | // var panID = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"]["PANID"].ToString()); |
| | | |
| | | // if (panID == null) |
| | | // { |
| | | // d = new GetPanIdResponData { errorMessageBase = "网关返回的数据为空" }; |
| | | |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GetPanIdResponData { panID = panID }; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | |
| | | // gateway.Actions += action; |
| | | // System.Console.WriteLine("ZbGw/GetPanId_Actions 启动" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 12 } };
|
| | | // gateway.Send(("ZbGw/GetPanId"), Common.SecuritySet.Encryption((jObject.ToString()))); |
| | | |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // if (d != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) |
| | | // { |
| | | // d = new GetPanIdResponData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // System.Console.WriteLine("ZbGw/GetPanId_Actions 退出" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 读取当前局域网的PANID,网关反馈具体信息 |
| | | ///// </summary> |
| | | //public GetPanIdResponData getPanIdResponData; |
| | | ///// <summary> |
| | | ///// 读取当前局域网的PANID,网关反馈具体信息 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class GetPanIdResponData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 错误信息 |
| | | // /// </summary> |
| | | // public string errorMessageBase; |
| | | // /// <summary> |
| | | // /// 网关信息错误反馈 |
| | | // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | // /// </summary> |
| | | // public ErrorResponData errorResponData; |
| | | // /// <summary> |
| | | // /// 当前网络的PANID |
| | | // /// </summary> |
| | | // public int panID = 999; |
| | | //} |
| | | |
| | | //#endregion |
| | | |
| | | //#region 读取协调器MAC地址. |
| | | /////<summary > |
| | | ///// 读取协调器MAC地址 |
| | | ///// </summary> |
| | | //public static async System.Threading.Tasks.Task<GetMacResponData> ReadMacAsync(ZigBee.Device.ZbGateway gateway) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // GetMacResponData d = null; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d = new GetMacResponData { errorMessageBase = "网关错误回复,且数据是空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GetMacResponData { errorResponData = temp, errorMessageBase = ErrorMess(temp.Error) }; |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/GetMac_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | // var tempData = Newtonsoft.Json.JsonConvert.DeserializeObject<MacAddrData>(jobject["Data"].ToString()); |
| | | |
| | | // if (tempData == null) |
| | | // { |
| | | // d = new GetMacResponData { errorMessageBase = "网关返回的数据为空" }; |
| | | // } |
| | | // else |
| | | // { |
| | | // d = new GetMacResponData { macAddrData = tempData }; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | |
| | | // gateway.Actions += action; |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 13 } };
|
| | | // gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jObject.ToString()))); |
| | | |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // if (d != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 10000) |
| | | // { |
| | | // d = new GetMacResponData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 读取协调器MAC地址,网关反馈具体信息 |
| | | /// </summary> |
| | | public GetMacResponData getMacResponData; |
| | | #region 读取协调器MAC地址 |
| | | /// <summary> |
| | | /// 读取协调器MAC地址,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class GetMacResponData |
| | | public class GetMacResponData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 协调器mac地址 |
| | | /// </summary> |
| | |
| | | public string MacAddr; |
| | | } |
| | | |
| | | //#endregion |
| | | |
| | | #region 添加Install Codes码 |
| | | /////<summary > |
| | | /////添加Install Codes码 |
| | | ///// <para>installCode:InstallCode码 36个字符</para> |
| | | ///// <para>installCodeAddr:InstallCodes码设备的mac地址16个字符</para> |
| | | ///// </summary> |
| | | //public static async System.Threading.Tasks.Task<InstallCodeResponData> InstallCodeAsync(ZigBee.Device.ZbGateway gateway, string installCode, string installCodeAddr) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // var d = new InstallCodeResponData { }; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { Time = jobject.Value<int>("Time"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d.errorMessageBase = "网关错误回复,且数据是空"; |
| | | // } |
| | | // else |
| | | // { |
| | | // d.errorResponData = temp; |
| | | // d.errorMessageBase = ErrorMess(temp.Error); |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/InstallCode_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID") }; |
| | | // var code = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(jobject["Data"].ToString()); |
| | | |
| | | // if (code == null) |
| | | // { |
| | | // d.errorMessageBase = "网关返回的数据为空"; |
| | | // } |
| | | // else |
| | | // { |
| | | // d.Status = code; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | |
| | | // gateway.Actions += action; |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 13 } };
|
| | | // gateway.Send(("ZbGw/GetMac"), Common.SecuritySet.Encryption((jObject.ToString()))); |
| | | |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // //if (d.Status != 999) |
| | | // //{ |
| | | // // break; |
| | | // //} |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 1000) |
| | | // { |
| | | // d.errorMessageBase = " 回复超时,请重新操作"; |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 添加Install Codes码,网关反馈具体信息 |
| | | /// </summary> |
| | | public InstallCodeResponData installCodeResponData; |
| | | /// <summary> |
| | | /// 添加Install Codes码,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class InstallCodeResponData |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 0:成功,1:失败 |
| | | /// </summary> |
| | | public int Status = 999; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 启用或关闭透传数据上传接口 |
| | | /// <summary> |
| | | /// 透传数据上传接口,网关反馈信息 |
| | | /// </summary> |
| | | public PassthroughAllData passthroughAllData; |
| | | /// <summary> |
| | | /// 透传数据上传接口,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class PassthroughAllData |
| | | public class PassthroughAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 已经转换成字符格式的16进制的透传数据 |
| | | /// </summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | //#region 协调器通用功能操作接口 |
| | | ///// <summary> |
| | | ///// 协调器通用功能操作接口 |
| | | ///// </summary> |
| | | ///// <returns>The or get all data async.</returns> |
| | | ///// <param name="gateway">Gateway.</param> |
| | | ///// <param name="commandID">Command identifier.</param> |
| | | ///// <param name="payload">Payload.</param> |
| | | //public static async System.Threading.Tasks.Task<SetOrGetAllData> SetOrGetAllDataAsync(ZigBee.Device.ZbGateway gateway, int commandID, string payload) |
| | | //{ |
| | | // if (gateway == null) |
| | | // { |
| | | // return null; |
| | | // } |
| | | // return await System.Threading.Tasks.Task.Run(async () => |
| | | // { |
| | | // var d = new SetOrGetAllData { }; |
| | | // Action<string, string> action = (topic, message) => |
| | | // { |
| | | // var gatewayID = topic.Split('/')[0]; |
| | | // var jobject = Newtonsoft.Json.Linq.JObject.Parse(message); |
| | | |
| | | // if (topic == gatewayID + "/" + "Error_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DeviceID = jobject.Value<int>("Device_ID"), DeviceAddr = jobject.Value<string>("DeviceAddr"), DeviceEpoint = jobject.Value<int>("Epoint"), DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<ZbGateway.ErrorResponData>(jobject["Data"].ToString()); |
| | | |
| | | // if (temp == null) |
| | | // { |
| | | // d.errorMessageBase = "网关错误回复,且数据是空"; |
| | | // } |
| | | // else |
| | | // { |
| | | // d.errorResponData = temp; |
| | | // d.errorMessageBase = ErrorMess(temp.Error); |
| | | // } |
| | | // } |
| | | |
| | | // if (topic == gatewayID + "/" + "ZbGw/SetOrGetData_Respon") |
| | | // { |
| | | // var gatewayTemp = new ZbGateway() { DataID = jobject.Value<int>("Data_ID"), CurrentGateWayId = gateway.getGatewayBaseInfo.gwID }; |
| | | // var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<SetOrGetData>(jobject["Data"].ToString()); |
| | | |
| | | // if (gatewayTemp.getGwVersion == null) |
| | | // { |
| | | // d.errorMessageBase = "网关返回的数据为空"; |
| | | // } |
| | | // else |
| | | // { |
| | | // d.setOrGetData = temp; |
| | | // DebugPrintLog($"UI收到通知后的主题_{ topic}"); |
| | | // } |
| | | // } |
| | | // }; |
| | | // gateway.Actions += action; |
| | | // System.Console.WriteLine("ZbDataPassthrough_Actions 启动" + "_" + System.DateTime.Now.ToString()); |
| | | |
| | | // var jObject = new JObject { { "Cluster_ID", 64512 }, { "Command", 2 } }; |
| | | // var data = new JObject { { "Command_ID", commandID }, { "Payload", payload } }; |
| | | // jObject.Add("Data", data);
|
| | | // gateway.Send("ZbGw/SetOrGetData", Common.SecuritySet.Encryption(jObject.ToString())); |
| | | // var dateTime = DateTime.Now; |
| | | // while ((DateTime.Now - dateTime).TotalMilliseconds < 1000) |
| | | // { |
| | | // await System.Threading.Tasks.Task.Delay(10); |
| | | // if (d.setOrGetData != null) |
| | | // { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if ((DateTime.Now - dateTime).TotalMilliseconds > 10000) |
| | | // { |
| | | // d.errorMessageBase = " 回复超时,请重新操作"; |
| | | // } |
| | | // gateway.Actions -= action; |
| | | // System.Console.WriteLine("GetGwVersionData_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | | // return d; |
| | | // }); |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// BDB接口,网关反馈信息 |
| | | ///// </summary> |
| | | //public SetOrGetAllData setOrGetAllData; |
| | | ///// <summary> |
| | | ///// BDB接口,网关反馈信息 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class SetOrGetAllData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 错误信息 |
| | | // /// </summary> |
| | | // public string errorMessageBase; |
| | | // /// <summary> |
| | | // /// 网关信息错误反馈 |
| | | // /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | // /// </summary> |
| | | // public ErrorResponData errorResponData; |
| | | // /// <summary> |
| | | // /// BDB数据 |
| | | // /// </summary> |
| | | // public SetOrGetData setOrGetData; |
| | | |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// BDB数据 |
| | | ///// </summary> |
| | | //public SetOrGetData setOrGetData; |
| | | ///// <summary> |
| | | ///// BDB数据 |
| | | ///// </summary> |
| | | //[System.Serializable] |
| | | //public class SetOrGetData |
| | | //{ |
| | | // /// <summary> |
| | | // /// 协调器指令的command_ID。对应《协调器串口通信协议规范》第2章节指令的command_ID |
| | | // /// </summary> |
| | | // public int commandID; |
| | | // /// <summary> |
| | | // /// 已经转换成字符格式的16进制的data数据。对应《协调器串口通信协议规范》第2章节指令的“数据”内容 |
| | | // /// </summary> |
| | | // public string payload; |
| | | //} |
| | | //#endregion |
| | | |
| | | #region 客户端发送文件流到网关 |
| | | /// <summary> |
| | | /// 客户端发送文件流到网关 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SendFileResponseAllData |
| | | public class SendFileResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 0: 数据写入成功,请求发送下一个数据包 |
| | | ///<para>1:数据写入失败</para> |
| | |
| | | /// <summary> |
| | | /// 客户端发送创建文件命令,网关反馈信息 |
| | | /// </summary> |
| | | public CreateFileResponseAllData createFileResponseAllData; |
| | | /// <summary> |
| | | /// 客户端发送创建文件命令,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class CreateFileResponseAllData |
| | | public class CreateFileResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData;
|
| | | /// <summary> |
| | | /// 0:创建成功 |
| | | ///<para>1:失败,无法创建文件</para> |
| | | ///<para>2:失败,该客户端有文件还没上传完成,请等待文件上传完毕(一个客户端只能同时上传一个文件)</para> |
| | | /// </summary> |
| | | public int Result = 999;
|
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 查看网关目录文件信息 |
| | | /// <summary> |
| | | /// 查看网关目录文件信息,网关反馈信息 |
| | | /// </summary> |
| | | public FileTransferLsDiResponseAllData fileTransferLsDiResponseAllData; |
| | | /// <summary> |
| | | /// 查看网关目录文件信息,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class FileTransferLsDiResponseAllData |
| | | public class FileTransferLsDiResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData;
|
| | | /// <summary> |
| | | /// 查看网关目录文件信息 |
| | | /// </summary> |
| | | public FileTransferLsDiResponseData fileTransferLsDiResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查看网关目录文件信息,网关反馈信息 |
| | | /// </summary> |
| | | public FileTransferLsDiResponseData fileTransferLsDiResponseData; |
| | | /// <summary> |
| | | /// 客户端发送创建文件命令,网关反馈信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 客户端设定要下载的文件名称和路径,网关反馈信息 |
| | | /// </summary> |
| | | public SetDownloadFileResponseAllData setDownloadFileResponseAllData; |
| | | /// <summary> |
| | | /// 客户端设定要下载的文件名称和路径,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SetDownloadFileResponseAllData |
| | | public class SetDownloadFileResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 客户端设定要下载的文件名称和路径 |
| | | /// </summary> |
| | | public SetDownloadFileResponseData setDownloadFileResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 客户端设定要下载的文件名称和路径,网关反馈信息 |
| | | /// </summary> |
| | | public SetDownloadFileResponseData setDownloadFileResponseData; |
| | | /// <summary> |
| | | /// 客户端设定要下载的文件名称和路径,网关反馈信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 查看单个文件信息数据 |
| | | /// </summary> |
| | | public FileTransferGetFileInfoResponseAllData fileTransferGetFileInfoResponseAllData; |
| | | /// <summary> |
| | | /// 查看单个文件信息数据 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class FileTransferGetFileInfoResponseAllData |
| | | public class FileTransferGetFileInfoResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 查看单个文件信息返回的数据 |
| | | /// </summary> |
| | | public FileTransferGetFileInfoResponseData fileTransferGetFileInfoResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查看单个文件信息返回的数据 |
| | | /// </summary> |
| | | public FileTransferGetFileInfoResponseData fileTransferGetFileInfoResponseData; |
| | | /// <summary> |
| | | /// 查看单个文件信息返回的数据 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 客户端接收到网关发色数据格式后应反馈给网关到格式数据 |
| | | /// </summary> |
| | | public DownloadFileResponseAllData downloadFileResponseAllData; |
| | | /// <summary> |
| | | /// 客户端接收到网关发色数据格式后应反馈给网关到格式数据 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DownloadFileResponseAllData |
| | | public class DownloadFileResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 0: 数据写入成功,请求发送下一个数据包 |
| | | ///<para>1:终止下载。当下载出现错误,或者下载已经完成可以发送该值。</para> |
| | |
| | | public int Result = -1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 客户端接收到网关发色数据格式后应反馈给网关 |
| | | /// </summary> |
| | | public FileTransferDownloadFileRespon fileTransferDownloadFileRespon; |
| | | /// <summary> |
| | | /// 客户端接收到网关发色数据格式后应反馈给网关 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 删除文件或目录,网关反馈信息 |
| | | /// </summary> |
| | | public DelFileOrDirResponseAllData delFileOrDirResponseAllData; |
| | | /// <summary> |
| | | /// 删除文件或目录,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class DelFileOrDirResponseAllData |
| | | public class DelFileOrDirResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 删除文件或目录 |
| | | /// </summary> |
| | | public DelFileOrDirResponseData delFileOrDirResponseData; |
| | | }
|
| | |
|
| | | /// <summary> |
| | | /// 删除文件或目录,网关反馈信息 |
| | | /// </summary> |
| | | public DelFileOrDirResponseData delFileOrDirResponseData; |
| | | /// <summary> |
| | | /// 删除文件或目录,网关反馈信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 创建一个目录,网关反馈信息 |
| | | /// </summary> |
| | | public CreateDirResponseAllData createDirResponseAllData; |
| | | /// <summary> |
| | | /// 创建一个目录,网关反馈信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class CreateDirResponseAllData |
| | | public class CreateDirResponseAllData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 创建一个目录 |
| | | /// </summary> |
| | | public CreateDirResponseData createDirResponseData; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建一个目录,网关反馈信息 |
| | | /// </summary> |
| | | public CreateDirResponseData createDirResponseData; |
| | | /// <summary> |
| | | /// 创建一个目录,网关反馈信息 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 客户端发送DES密钥到网关,网关反馈具体信息 |
| | | /// </summary> |
| | | public SendKeyResponData sendDESKeyResponData; |
| | | /// <summary> |
| | | /// 客户端发送DES密钥到网关,网关反馈具体信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class SendKeyResponData |
| | | public class SendKeyResponData : CommonDevice.ErrorResponCommon |
| | | { |
| | | /// <summary> |
| | | /// 错误信息 |
| | | /// </summary> |
| | | public string errorMessageBase; |
| | | /// <summary> |
| | | /// 网关信息错误反馈 |
| | | /// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para> |
| | | /// </summary> |
| | | public ErrorResponData errorResponData; |
| | | /// <summary> |
| | | /// 0:成功 |
| | | ///<para>1:失败,RSA私钥解密失败</para> |