using System;
|
using System.Collections.Generic;
|
using Newtonsoft.Json.Linq;
|
|
namespace ZigBee.Device
|
{
|
public class ZbGatewayData : CommonDevice
|
{
|
#region 网关在线标识
|
/// <summary>
|
/// 判断网关是否在线的标识,APP界面会改变它的值,Application会重新刷新它的值
|
/// </summary>
|
public bool GatewayOnlineFlage = false;
|
|
#endregion
|
|
[Newtonsoft.Json.JsonIgnore]
|
/// <summary>
|
/// 虚拟网关
|
/// </summary>
|
public bool IsVirtual;
|
|
#region 网关基本信息
|
/// <summary>
|
/// 该网关应用程序版本
|
/// </summary>
|
public long AppVersion;
|
|
/// <summary>
|
/// Zigbee协议器程序版本
|
/// </summary>
|
public int ZigbeeVersion;
|
#endregion
|
|
#region 网关信息.
|
/// <summary>
|
/// 网关版本信息,网关反馈信息
|
/// </summary>
|
public GetGwVersionAllData getGwVersionAllData;
|
/// <summary>
|
/// 网关版本信息,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class GetGwVersionAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 网关版本信息
|
/// </summary>
|
public GetGwVersionData getGwVersion;
|
}
|
|
/// <summary>
|
/// 网关版本信息
|
/// </summary>
|
public GetGwVersionData getGwVersion;
|
/// <summary>
|
/// 网关版本信息
|
/// </summary>
|
[System.Serializable]
|
public class GetGwVersionData
|
{
|
/// <summary>
|
/// 该网关应用程序版本
|
/// </summary>
|
public long AppVersion;
|
/// <summary>
|
/// Zigbee协议器程序版本
|
/// </summary>
|
public int ZigbeeVersion;
|
}
|
#endregion
|
|
#region 获取网关信息.
|
/// <summary>
|
/// 网关信息,网关反馈具体信息.
|
/// </summary>
|
public GetGwAllData getGwAllData;
|
/// <summary>
|
/// 网关信息,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class GetGwAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 网关信息
|
/// </summary>
|
public GetGwData getGwData;
|
}
|
|
/// <summary>
|
/// 网关信息.
|
/// </summary>
|
public GetGwData getGwInfo;
|
/// <summary>
|
/// 网关信息
|
/// </summary>
|
[System.Serializable]
|
public class GetGwData
|
{
|
///<summary>
|
///网关序列号,该网关唯一标识
|
/// </summary>
|
public string GwId;
|
/// <summary>
|
///网关绑定网卡的mac地址
|
/// </summary>
|
public string GwMac;
|
/// <summary>
|
///网关名称
|
/// </summary>
|
public string GwName;
|
/// <summary>
|
/// 网关的序列号
|
/// </summary>
|
public string GWSN = string.Empty;
|
/// <summary>
|
///是否为主网关。(因为在外网的情况下,这个字段可以获取到,用来更新局域网中基本信息的对象中的主网关信息)
|
///<para>0:否</para>
|
///<para>1:是</para>
|
/// </summary>
|
public int IsDominant;
|
///<summary>
|
///utc时间戳,程序启动时网关的系统时间
|
///</summary>
|
public long StartTime;
|
/// <summary>
|
///加入局域网模式
|
///<para>0:wifi连接局域网</para>
|
///<para>1:有线连接局域网</para>
|
///<para>2:未加入局域网</para>
|
/// </summary>
|
public int JoinMode;
|
/// <summary>
|
///网关所在局域网的ip地址
|
/// </summary>
|
public string GwIP;
|
/// <summary>
|
///当前局域网网络号占用位数,用于计算子网掩码,如Mask=32,则子网掩码为255.255.255.0
|
/// </summary>
|
public int Mask;
|
/// <summary>
|
///上级路由器无线名称
|
///<para>当 JoinMode = 0时存在 </para>
|
/// </summary>
|
public string RouteESSID;
|
/// <summary>
|
///DNS服务器地址
|
/// </summary>
|
public string DNSServer;
|
/// <summary>
|
/// 该网关应用程序版本
|
/// </summary>
|
public long AppVersion;
|
/// <summary>
|
/// Zigbee协议器程序版本
|
/// </summary>
|
public int ZigbeeVersion;
|
/// <summary>
|
///协调器mac地址
|
/// </summary>
|
public string ZigbeeMacAddr;
|
/// <summary>
|
///网关宅id
|
/// </summary>
|
public string HomeId;
|
/// <summary>
|
///是否已经连接云端mqtt
|
///<para>0:否</para>
|
///<para>1:是</para>
|
/// </summary>
|
public int IsConnectCloud;
|
/// <summary>
|
///(用于网关程序调试)
|
///<para>https登陆云端时,最近一次获取的响应状态码。根据云端的定义,有如下状态码。</para>
|
///<para>(1)Success,则[调用此接口操作成功]</para>
|
///<para>(2)ParameterOrEmpty,则响应字段中[ErrorInfo] 为错误信息[提交错误信息]</para>
|
///<para>(3)NoBind,则响应字段中[ErrorInfo] 为错误信息[您所提交的[GatewayUniqueId 网关唯一Id(MAC)]和[住宅主键Id]不存在绑定的关系]</para>
|
///<para>(4)YouDataNoIsLocalRegion,则响应字段中[ErrorInfo] 为错误信息[您的的数据并不在此HDL区域服务器, 请重定向到如下HDL区域服务器进行处理.]</para>
|
/// </summary>
|
public string StateCode;
|
/// <summary>
|
///Linux网关类型
|
/// </summary>
|
public int LinuxImageType;
|
/// <summary>
|
///Linux网关HW版本
|
/// </summary>
|
public int LinuxHWVersion;
|
/// <summary>
|
/// Linux网关FW版本
|
/// </summary>
|
public int LinuxFWVersion;
|
/// <summary>
|
/// 协调器HW版本
|
/// </summary>
|
public int ZbHWVersion;
|
/// <summary>
|
/// 协调器FW版本
|
/// </summary>
|
public int ZbFWVersion;
|
/// <summary>
|
/// 网关镜像类型
|
/// </summary>
|
public int ZbImageType;
|
|
/// <summary>
|
/// 虚拟驱动信息
|
/// </summary>
|
public List <DriveCodeListObj> DriveCodeList = new List<DriveCodeListObj>();
|
}
|
|
public class DriveCodeListObj
|
{
|
/// <summary>
|
/// 驱动代号(由网关为驱动分配唯一标识)
|
/// </summary>
|
public int DriveCode;
|
/// <summary>
|
/// 驱动硬件版本
|
/// </summary>
|
public int DriveHwVersion;
|
/// <summary>
|
/// 驱动软件版
|
/// </summary>
|
public int DriveFwVersion;
|
/// <summary>
|
/// 驱动固件类型
|
/// </summary>
|
public int DriveImageType;
|
/// <summary>
|
/// 驱动id
|
/// </summary>
|
public int DriveId;
|
}
|
#endregion
|
|
#region 修改网关名称
|
/// <summary>
|
/// 修改网关名称,网关反馈具体信息
|
/// </summary>
|
public GwReNameAllData gwReNameAllData;
|
/// <summary>
|
/// 修改网关名称,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class GwReNameAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 修改网关名称
|
/// </summary>
|
public GwReNameData gwReNameData;
|
}
|
|
/// <summary>
|
/// 修改网关名称
|
/// </summary>
|
public GwReNameData gwRename;
|
/// <summary>
|
/// 修改网关名称
|
/// </summary>
|
[System.Serializable]
|
public class GwReNameData
|
{
|
/// <summary>
|
/// 修改后的网关名称
|
/// </summary>
|
public string GwName;
|
}
|
#endregion
|
|
#region 设定网关住宅id
|
/// <summary>
|
/// 网关住宅id数据,网关反馈具体信息
|
/// </summary>
|
public GwSetHomeIdAllData gwSetHomeIdAllData;
|
/// <summary>
|
/// 网关住宅id数据,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class GwSetHomeIdAllData
|
{
|
/// <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>
|
[System.Serializable]
|
public class GwSetHomeIdData
|
{
|
/// <summary>
|
/// 住宅id
|
/// </summary>
|
public string HomeId;
|
}
|
|
/// <summary>
|
/// 广播发现协议
|
/// </summary>
|
public GatewayBaseInfo getGatewayBaseInfo = new GatewayBaseInfo { };
|
/// <summary>
|
/// 广播发现协议
|
/// </summary>
|
[System.Serializable]
|
public class GatewayBaseInfo
|
{
|
/// <summary>
|
/// 网关Ip地址
|
/// </summary>
|
public string IpAddress;
|
/// <summary>
|
/// 住宅id,4字节整型。(小端结构)如果网关不设置宅id,将默认为0
|
/// </summary>
|
public string HomeId = string.Empty;
|
/// <summary>
|
/// 网关当前时间戳(小端结构)
|
/// </summary>
|
public int Time;
|
/// <summary>
|
/// 是否为主网关
|
/// </summary>
|
public bool IsMainGateWay;
|
/// <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>
|
[System.Serializable]
|
public class MainGatewayBaseInfo
|
{
|
/// <summary>
|
/// 发送方的ip地址
|
/// </summary>
|
public string IpAddress;
|
/// <summary>
|
/// 住宅id,4字节整型。(小端结构)如果网关不设置住宅id,将默认为0
|
/// </summary>
|
public string HomeId;
|
/// <summary>
|
/// 数据命令标识
|
/// </summary>
|
public int Command_Id = 0x03;
|
/// <summary>
|
/// 保留
|
/// </summary>
|
public int Retain = 0x00;
|
/// <summary>
|
/// 网关当前时间戳(小端结构)
|
/// </summary>
|
public int Time;
|
/// <summary>
|
/// RSA公钥
|
/// </summary>
|
public string PubKey;
|
/// <summary>
|
/// 网关名称
|
/// </summary>
|
public string gwName;
|
|
/// <summary>
|
/// 网关ID
|
/// </summary>
|
public string gwID;
|
|
}
|
#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
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>网关恢复出厂设置</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
///<summary >
|
/// <para>0:命令已接收,系统即将恢复出厂并重启。</para>
|
/// </summary>
|
public int Result = 2;
|
}
|
#endregion
|
|
#region 重启网关系统
|
|
/// <summary>
|
/// 重启网关系统返回数据
|
/// </summary>
|
public GwRebootResponAllData gwRebootResponAllData;
|
/// <summary>
|
/// 重启网关系统返回数据
|
/// </summary>
|
[System.Serializable]
|
public class GwRebootResponAllData
|
{
|
/// <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>
|
[System.Serializable]
|
public class GwRebootResponData
|
{
|
///<summary >
|
/// 0:命令已接收,系统即将重启。
|
/// </summary>
|
public int Result = 999;
|
}
|
|
#endregion
|
|
#region 网关和协调器升级
|
/// <summary>
|
/// 保存zigbee协调器组网信息,网关反馈具体信息
|
/// </summary>
|
public SaveNVFileResponseAllData saveNVFileResponseData;
|
/// <summary>
|
/// 保存zigbee协调器组网信息,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class SaveNVFileResponseAllData
|
{
|
/// <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>
|
[System.Serializable]
|
public class SaveNVFileResponseData
|
{
|
/// <summary>
|
/// 修改后的网关名称
|
///<para>0:保存成功</para>
|
///<para>1:文件创建失败</para>
|
///<para>2:NV分区读取出错 </para>
|
/// </summary>
|
public int Flag = 999;
|
}
|
#endregion
|
|
#region 协调器恢复组网信息
|
/// <summary>
|
/// 协调器恢复组网信息,网关反馈具体信息
|
/// </summary>
|
public RestoreNVAllDtta restoreNVAllDtta;
|
/// <summary>
|
/// 协调器恢复组网信息,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class RestoreNVAllDtta
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 协调器恢复组网信息
|
/// </summary>
|
public RestoreNVDtta restoreNVDtta;
|
}
|
|
/// <summary>
|
/// 协调器恢复组网信息
|
/// </summary>
|
public RestoreNVDtta restoreNVDtta;
|
/// <summary>
|
/// 协调器恢复组网信息
|
/// </summary>
|
[System.Serializable]
|
public class RestoreNVDtta
|
{
|
/// <summary>
|
/// 修改后的网关名称
|
/// <para>0:恢复成功</para>
|
///<para>1:文件不存在,恢复失败</para>
|
///<para>2:NV分区写入错误,恢复失败</para>
|
///<para>7:文件不合法</para>
|
/// </summary>
|
public int Flag = 999;
|
}
|
#endregion
|
|
#region 协调器升级
|
/// <summary>
|
/// 协调器升级,网关反馈具体信息
|
/// </summary>
|
public ZbGwOperationUpgradeAllData zbGwOperationUpgradeAllData;
|
/// <summary>
|
/// 协调器升级,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class ZbGwOperationUpgradeAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 协调器升级
|
/// </summary>
|
public ZbGwOperationUpgradeData bGwOperationUpgradeData;
|
}
|
|
/// <summary>
|
/// 协调器升级
|
/// </summary>
|
public ZbGwOperationUpgradeData zbGwOperationUpgradeData;
|
/// <summary>
|
/// 协调器升级
|
/// </summary>
|
[System.Serializable]
|
public class ZbGwOperationUpgradeData
|
{
|
/// <summary>
|
/// 修改后的网关名称
|
/// <para>0:升级完成</para>
|
///<para>1:没有找到升级文件,或升级文件打开失败。</para>
|
///<para>2:正在升级</para>
|
///<para>3:写入分区出错</para>
|
///<para>7:升级文件不合法。</para>
|
///<para>8:未知错误</para>
|
///<para>9:升级文件名称中无“ZBMODULE”标识。</para>
|
/// </summary>
|
public int Flag = 999;
|
/// <summary>
|
/// 修改后的网关名称
|
/// <para>升级进度。0-100表示0-100% ,该字段在Flag =2时才存在</para>
|
/// </summary>
|
public int Percent;
|
}
|
#endregion
|
|
#region 升级虚拟驱动设备数据
|
/// <summary>
|
/// 升级虚拟驱动设备,网关反馈具体信息
|
/// </summary>
|
public VirtualDriveUpgradeResponseAllData virtualDriveUpgradeResponseAllData;
|
/// <summary>
|
/// 升级虚拟驱动设备,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class VirtualDriveUpgradeResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 升级虚拟驱动设备
|
/// </summary>
|
public VirtualDriveUpgradeResponData virtualDriveUpgradeResponData;
|
}
|
/// <summary>
|
/// 升级虚拟驱动设备
|
/// </summary>
|
public VirtualDriveUpgradeResponData virtualDriveUpgradeResponData;
|
[System.Serializable]
|
public class VirtualDriveUpgradeResponData
|
{
|
/// 0:升级完成
|
///<para>1:没有找到升级文件,或升级文件打开失败。v
|
///<para>2:正在升级</para>
|
///<para>3:写入分区出错</para>
|
///<para>7:升级文件不合法。</para>
|
///<para>8:未知错误</para>
|
///<para>10:错误,驱动代号不存在</para>
|
public int Flag;
|
|
/// <summary>
|
///驱动代号
|
/// </summary>
|
public int DriveCode;
|
|
/// <summary>
|
///升级进度。0-100表示0-100%(该字段在Flag =2时才有效)
|
/// </summary>
|
public int Percent;
|
}
|
#endregion
|
|
#region 查看网关记录的虚拟驱动数据
|
/// <summary>
|
/// 查看网关记录的虚拟驱动,网关反馈具体信息
|
/// </summary>
|
public CheckVDDriveCodeResponseAllData checkVDDriveCodeResponseAllData;
|
/// <summary>
|
/// 查看网关记录的虚拟驱动,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class CheckVDDriveCodeResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 查看网关记录的虚拟驱动
|
/// </summary>
|
public VDriveDriveCodeResponData vDriveDriveCodeResponData;
|
}
|
/// <summary>
|
/// 查看网关记录的虚拟驱动
|
/// </summary>
|
public VDriveDriveCodeResponData vDriveDriveCodeResponData;
|
[System.Serializable]
|
public class VDriveDriveCodeResponData
|
{
|
/// <summary>
|
/// 驱动代号列表
|
/// </summary>
|
public List<DriveCodeObj> DriveCodeList = new List<DriveCodeObj>();
|
}
|
/// <summary>
|
/// 虚拟驱动
|
/// </summary>
|
[System.Serializable]
|
public class DriveCodeObj
|
{
|
/// <summary>
|
/// 驱动代号
|
/// </summary>
|
public int DriveCode;
|
/// <summary>
|
/// 驱动硬件版本
|
/// </summary>
|
public int DriveHwVersion;
|
/// <summary>
|
/// 驱动软件版本
|
/// </summary>
|
public int DriveFwVersion;
|
/// <summary>
|
/// 驱动固件类型
|
/// </summary>
|
public int DriveImageType;
|
/// <summary>
|
/// 驱动标识符
|
/// </summary>
|
public int DriveId;
|
}
|
#endregion
|
|
#region 网关系统升级
|
/// <summary>
|
/// 网关系统升级,网关反馈具体信息
|
/// </summary>
|
public LinuxUpgradeAllData linuxUpgradeAllData;
|
/// <summary>
|
/// 网关系统升级,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class LinuxUpgradeAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 0:正常(默认回复)
|
///<para>1:找不到升级固件,路径或升级固件名称错误。</para>
|
///<para>2:固件不合法。(如果强制升级,则返回正常,Result=0)</para>
|
///<para>3:升级固件过大(使用16MFlash时固件大小不得超过16449536B)</para>
|
///<para>4:升级文件名称中无“LINUXMODULE”标识。</para>
|
///</summary>
|
public int Result = 999;
|
}
|
#endregion
|
|
#region 获取协调器当前信道.
|
/// <summary>
|
/// 获取协调器当前信道,网关反馈具体信息
|
/// </summary>
|
public GwGetChannelResponData zbGwGetChannelResponData;
|
/// <summary>
|
/// 获取协调器当前信道,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class GwGetChannelResponData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 协调器当前信道
|
/// </summary>
|
public int channel = 999;
|
}
|
|
#endregion
|
|
#region 更改协调器当前信道.
|
/// <summary>
|
/// 更改协调器当前信道,网关反馈具体信息
|
/// </summary>
|
public ChangeChannelResponAllData changeChannelResponAllData;
|
/// <summary>
|
/// 更改协调器当前信道,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class ChangeChannelResponAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 更改协调器当前信道数据
|
/// </summary>
|
public ChangeChannelResponData changeChannelResponData;
|
}
|
|
/// <summary>
|
/// 更改协调器当前信道数据
|
/// </summary>
|
public ChangeChannelResponData changeChannelResponData;
|
/// <summary>
|
/// 更改协调器当前信道数据
|
/// </summary>
|
[System.Serializable]
|
public class ChangeChannelResponData
|
{
|
/// <summary>
|
/// 是否配置成功
|
///<para>0:成功</para>
|
///<para>1:失败</para>
|
///<para>2:配置的信道为无效值</para>
|
/// </summary>
|
public int Status = 999;
|
/// <summary>
|
/// 协调器当前信道
|
/// </summary>
|
public int Channel = 999;
|
}
|
#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;
|
/// <summary>
|
/// 读取协调器MAC地址,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class GetMacResponData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 协调器mac地址
|
/// </summary>
|
public MacAddrData macAddrData;
|
}
|
/// <summary>
|
/// 读取协调器MAC地址,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class MacAddrData
|
{
|
/// <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
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 已经转换成字符格式的16进制的透传数据
|
/// </summary>
|
public string passData;
|
}
|
#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
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 0: 数据写入成功,请求发送下一个数据包
|
///<para>1:数据写入失败</para>
|
///<para>2:数据解析错误</para>
|
///<para>3:发送数据大小超出限制</para>
|
/// </summary>
|
public int Result = -1;
|
|
}
|
|
#endregion
|
|
#region 客户端发送创建文件命令
|
/// <summary>
|
/// 客户端发送创建文件命令,网关反馈信息
|
/// </summary>
|
public CreateFileResponseAllData createFileResponseAllData;
|
/// <summary>
|
/// 客户端发送创建文件命令,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class CreateFileResponseAllData
|
{
|
/// <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
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 查看网关目录文件信息
|
/// </summary>
|
public FileTransferLsDiResponseData fileTransferLsDiResponseData;
|
}
|
|
/// <summary>
|
/// 查看网关目录文件信息,网关反馈信息
|
/// </summary>
|
public FileTransferLsDiResponseData fileTransferLsDiResponseData;
|
/// <summary>
|
/// 客户端发送创建文件命令,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class FileTransferLsDiResponseData
|
{
|
/// <summary>
|
///0: 成功
|
///<para>1:查看失败</para>
|
/// </summary>
|
public int Result;
|
/// <summary>
|
/// 目录文件列表
|
/// </summary>
|
public List<DriObj> Dir = new List<DriObj>();
|
}
|
|
/// <summary>
|
/// 目录文件
|
/// </summary>
|
[System.Serializable]
|
public class DriObj
|
{
|
/// <summary>
|
///文件(包含所在路径和文件名称:如/usr/sbin/aa.txt)
|
/// </summary>
|
public string File;
|
|
/// <summary>
|
///文件大小(byte)
|
/// </summary>
|
public int FileSize;
|
|
/// <summary>
|
///文件最后修改的utc时间戳
|
/// </summary>
|
public int LastModifyTime;
|
}
|
#endregion
|
|
#region 客户端设定要下载的文件名称和路径
|
/// <summary>
|
/// 客户端设定要下载的文件名称和路径,网关反馈信息
|
/// </summary>
|
public SetDownloadFileResponseAllData setDownloadFileResponseAllData;
|
/// <summary>
|
/// 客户端设定要下载的文件名称和路径,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class SetDownloadFileResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 客户端设定要下载的文件名称和路径
|
/// </summary>
|
public SetDownloadFileResponseData setDownloadFileResponseData;
|
}
|
|
/// <summary>
|
/// 客户端设定要下载的文件名称和路径,网关反馈信息
|
/// </summary>
|
public SetDownloadFileResponseData setDownloadFileResponseData;
|
/// <summary>
|
/// 客户端设定要下载的文件名称和路径,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class SetDownloadFileResponseData
|
{
|
/// <summary>
|
///0:默认
|
///<para>1:失败,文件不存在。</para>
|
///<para>2:BlockStartAddress设置不合理,超出文件大小范围。</para>
|
///<para>3:当前有文件在下载,需要等待正在进行的下载任务结束。</para>
|
/// </summary>
|
public int Result = -1;
|
/// <summary>
|
/// 网关文件名称
|
/// </summary>
|
//public string BackupFileName ;
|
/// <summary>
|
/// 网关中对应文件中的数据内容
|
/// </summary>
|
//public byte[] BackupFileContent;
|
}
|
|
#endregion
|
|
#region 查看单个文件信息
|
/// <summary>
|
/// 查看单个文件信息数据
|
/// </summary>
|
public FileTransferGetFileInfoResponseAllData fileTransferGetFileInfoResponseAllData;
|
/// <summary>
|
/// 查看单个文件信息数据
|
/// </summary>
|
[System.Serializable]
|
public class FileTransferGetFileInfoResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 查看单个文件信息返回的数据
|
/// </summary>
|
public FileTransferGetFileInfoResponseData fileTransferGetFileInfoResponseData;
|
}
|
|
/// <summary>
|
/// 查看单个文件信息返回的数据
|
/// </summary>
|
public FileTransferGetFileInfoResponseData fileTransferGetFileInfoResponseData;
|
/// <summary>
|
/// 查看单个文件信息返回的数据
|
/// </summary>
|
[System.Serializable]
|
public class FileTransferGetFileInfoResponseData
|
{
|
/// <summary>
|
/// 0: 成功
|
///<para>1:查看失败,文件不存在</para>
|
/// </summary>
|
public int Result = -1;
|
/// <summary>
|
///文件(包含所在路径和文件名称:如/etc/hdlDat/aa.txt)
|
/// </summary>
|
public string File;
|
/// <summary>
|
/// 文件大小(byte)(当Result = 0 时存在)
|
/// </summary>
|
public int FileSize;
|
/// <summary>
|
/// 文件最后修改的utc时间戳(当Result = 0 时存在)
|
/// </summary>
|
public int LastModifyTime;
|
}
|
#endregion
|
|
#region 客户端接收到网关发色数据格式后应反馈给网关到格式数据
|
/// <summary>
|
/// 客户端接收到网关发色数据格式后应反馈给网关到格式数据
|
/// </summary>
|
public DownloadFileResponseAllData downloadFileResponseAllData;
|
/// <summary>
|
/// 客户端接收到网关发色数据格式后应反馈给网关到格式数据
|
/// </summary>
|
[System.Serializable]
|
public class DownloadFileResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 0: 数据写入成功,请求发送下一个数据包
|
///<para>1:终止下载。当下载出现错误,或者下载已经完成可以发送该值。</para>
|
/// </summary>
|
public int Result = -1;
|
}
|
|
/// <summary>
|
/// 客户端接收到网关发色数据格式后应反馈给网关
|
/// </summary>
|
public FileTransferDownloadFileRespon fileTransferDownloadFileRespon;
|
/// <summary>
|
/// 客户端接收到网关发色数据格式后应反馈给网关
|
/// </summary>
|
[System.Serializable]
|
public class FileTransferDownloadFileRespon
|
{
|
/// <summary>
|
/// 0: 数据写入成功,请求发送下一个数据包
|
///<para>1:终止下载。当下载出现错误,或者下载已经完成可以发送该值。</para>
|
/// </summary>
|
public int Result = -1;
|
}
|
#endregion
|
|
#region 删除文件或目录
|
/// <summary>
|
/// 删除文件或目录,网关反馈信息
|
/// </summary>
|
public DelFileOrDirResponseAllData delFileOrDirResponseAllData;
|
/// <summary>
|
/// 删除文件或目录,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class DelFileOrDirResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 删除文件或目录
|
/// </summary>
|
public DelFileOrDirResponseData delFileOrDirResponseData;
|
}
|
|
/// <summary>
|
/// 删除文件或目录,网关反馈信息
|
/// </summary>
|
public DelFileOrDirResponseData delFileOrDirResponseData;
|
/// <summary>
|
/// 删除文件或目录,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class DelFileOrDirResponseData
|
{
|
/// <summary>
|
///0: 删除成功
|
///<para>1:删除失败,路径不存在</para>
|
///<para>2:无法删除。</para>
|
/// </summary>
|
public int Result;
|
|
/// <summary>
|
///目录或文件的路径
|
/// </summary>
|
public string Path;
|
}
|
#endregion
|
|
#region 创建一个目录
|
/// <summary>
|
/// 创建一个目录,网关反馈信息
|
/// </summary>
|
public CreateDirResponseAllData createDirResponseAllData;
|
/// <summary>
|
/// 创建一个目录,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class CreateDirResponseAllData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 创建一个目录
|
/// </summary>
|
public CreateDirResponseData createDirResponseData;
|
}
|
|
/// <summary>
|
/// 创建一个目录,网关反馈信息
|
/// </summary>
|
public CreateDirResponseData createDirResponseData;
|
/// <summary>
|
/// 创建一个目录,网关反馈信息
|
/// </summary>
|
[System.Serializable]
|
public class CreateDirResponseData
|
{
|
/// <summary>
|
///0: 创建成功
|
///<para>1:创建失败</para>
|
/// </summary>
|
public int Result;
|
|
/// <summary>
|
///目录或文件的路径
|
/// </summary>
|
public string Path;
|
}
|
#endregion
|
|
#region 客户端发送DES密钥到网关
|
/// <summary>
|
/// 客户端发送DES密钥到网关,网关反馈具体信息
|
/// </summary>
|
public SendKeyResponData sendDESKeyResponData;
|
/// <summary>
|
/// 客户端发送DES密钥到网关,网关反馈具体信息
|
/// </summary>
|
[System.Serializable]
|
public class SendKeyResponData
|
{
|
/// <summary>
|
/// 错误信息
|
/// </summary>
|
public string errorMessageBase;
|
/// <summary>
|
/// 网关信息错误反馈
|
/// <para>当网关接收到客户端信息后,出现以下异常情况将反馈错误。</para>
|
/// </summary>
|
public ErrorResponData errorResponData;
|
/// <summary>
|
/// 0:成功
|
///<para>1:失败,RSA私钥解密失败</para>
|
/// </summary>
|
public int Result = -1;
|
}
|
|
#endregion
|
}
|
}
|