using Shared.Phone.UserCenter;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
|
namespace Shared.Phone.ModelData
|
{
|
#region ■ 共通模板数据定义___________________
|
|
/// <summary>
|
/// 模板缓存数据
|
/// </summary>
|
public class ModelMemoryData
|
{
|
/// <summary>
|
/// 全部的缓存数据
|
/// </summary>
|
public Dictionary<string, List<ModelDeviceDataCommon>> dicAllData = new Dictionary<string, List<ModelDeviceDataCommon>>();
|
}
|
|
/// <summary>
|
/// 一个设备的模板数据的共通
|
/// </summary>
|
public class ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 设备Mac地址
|
/// </summary>
|
public string DeviceMac = string.Empty;
|
/// <summary>
|
/// 设备端点
|
/// </summary>
|
public int DeviceEpoint = -1;
|
/// <summary>
|
/// 数据保存的区分(不需要再次设置)
|
/// </summary>
|
public ModelDeviceSaveEnum DataSaveDiv = ModelDeviceSaveEnum.A未定义;
|
/// <summary>
|
/// 发送模板数据的区分,用以标识是以什么方式发送给网关(需要再次指定)
|
/// </summary>
|
public ModelDataSendEnum DataSendDiv = ModelDataSendEnum.A未定义;
|
/// <summary>
|
/// 数据发送成功的返回标识(此变量是给【透传数据】使用,借以让网关知道透传之后,怎么判断成功)
|
/// </summary>
|
public string SuccessFlage = string.Empty;
|
/// <summary>
|
/// 主题名字(需要再次指定)
|
/// </summary>
|
public string TopicName = string.Empty;
|
|
/// <summary>
|
/// 获取更改设备配置的命令字符(因为有些东西需要考虑镞ID,所以有可能会出现多条命令)
|
/// </summary>
|
/// <returns></returns>
|
public virtual List<string> GetSendGatewayValue()
|
{
|
return new List<string>();
|
}
|
}
|
|
#endregion
|
|
#region ■ 窗帘模板数据定义___________________
|
|
/// <summary>
|
/// 窗帘手拉控制模板定义
|
/// </summary>
|
public class ModelCurtainHandPullControl : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 状态
|
/// </summary>
|
public bool Statu = false;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = HdlDeviceCurtainLogic.Current.GetHandPullControlText(DeviceMac, DeviceEpoint, Statu);
|
return new List<string>() { command };
|
}
|
}
|
|
/// <summary>
|
/// 窗帘手拉控制模板定义
|
/// </summary>
|
public class ModelCurtainDirectionAndLimite : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// false:电机方向正向;true:电机方向反向
|
/// </summary>
|
public bool Direction = false;
|
/// <summary>
|
/// 开限位
|
/// </summary>
|
public int upLimit = 2;
|
/// <summary>
|
/// 合限位
|
/// </summary>
|
public int downLimit = 98;
|
/// <summary>
|
/// 导轨长度
|
/// </summary>
|
public int curtainLength = 100;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
//方向
|
var command1 = HdlDeviceCurtainLogic.Current.GetCurtainDirectionCommadText(DeviceMac, DeviceEpoint, Direction);
|
//限位
|
var command2 = HdlDeviceCurtainLogic.Current.GetAutoOpenCurtainLimitPointCommandText(DeviceMac, DeviceEpoint, upLimit, downLimit);
|
return new List<string>() { command1, command2 };
|
}
|
}
|
|
#endregion
|
|
#region ■ 空调模板数据定义___________________
|
|
/// <summary>
|
/// 空调自定义模式模板数据定义
|
/// </summary>
|
public class ModelAcModeSupport : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 值
|
/// </summary>
|
public int data = 0;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = HdlDeviceAttributeLogic.Current.GetWriteDeviceAttributeText(DeviceMac, DeviceEpoint, 513, 4099, 25, data);
|
return new List<string>() { command };
|
}
|
}
|
|
/// <summary>
|
/// 空调摆风模式模板数据定义
|
/// </summary>
|
public class ModelAcSwingModeSupport : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 值
|
/// </summary>
|
public int data = 0;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = HdlDeviceAttributeLogic.Current.GetWriteDeviceAttributeText(DeviceMac, DeviceEpoint, 513, 4099, 25, data);
|
return new List<string>() { command };
|
}
|
}
|
|
#endregion
|
|
#region ■ 设备绑定模板数据定义_______________
|
|
/// <summary>
|
/// 设备绑定模板数据定义
|
/// </summary>
|
public class ModelDeviceBindData : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 按键的功能模式
|
/// </summary>
|
public ZigBee.Device.Panel.KeyMode keyMode = ZigBee.Device.Panel.KeyMode.Default;
|
/// <summary>
|
/// 按键的功能模式的镞ID
|
/// </summary>
|
public int keyModeClusterID = 0;
|
/// <summary>
|
/// 按键的功能模式的主题
|
/// </summary>
|
public string TopicName2 = string.Empty;
|
/// <summary>
|
/// 绑定列表
|
/// </summary>
|
public List<ZigBee.Device.BindObj.BindListResponseObj> BindList = new List<ZigBee.Device.BindObj.BindListResponseObj>();
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var addBindData = new ZigBee.Device.BindObj.AddBindData();
|
addBindData.DeviceAddr = this.DeviceMac;
|
addBindData.Epoint = this.DeviceEpoint;
|
|
foreach (var data in BindList)
|
{
|
var addData = new ZigBee.Device.BindObj.AddBindListObj();
|
addBindData.BindList.Add(addData);
|
addData.BindCluster = data.BindCluster;
|
addData.BindEpoint = data.BindEpoint;
|
addData.BindMacAddr = data.BindMacAddr;
|
addData.BindScenesId = data.BindScenesId;
|
addData.BindType = data.BindType == 0 ? 0 : 1;
|
}
|
//功能配置
|
var command1 = HdlDeviceBindLogic.Current.GetConfigureHdlKeyCommandText(this.DeviceMac, this.DeviceEpoint, keyMode, keyModeClusterID);
|
//绑定列表
|
var command2 = HdlDeviceBindLogic.Current.GetAddDeviceListBindCommandText(addBindData);
|
return new List<string>() { command1, command2 };
|
}
|
}
|
|
#endregion
|
|
#region ■ Pir传感器模板数据定义______________
|
|
/// <summary>
|
/// Pir传感器模板数据定义
|
/// </summary>
|
public class ModelPirSensorSettion : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// pir的配置信息
|
/// </summary>
|
public ZigBee.Device.IASZone.ConfigureParamates pirConfigure = new ZigBee.Device.IASZone.ConfigureParamates();
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = HdlDevicePirSensorLogic.Current.GetPirSensorSettionCommandText(DeviceMac, pirConfigure);
|
return new List<string>() { command };
|
}
|
}
|
|
#endregion
|
|
#region ■ 面板模板数据定义___________________
|
|
/// <summary>
|
/// 面板震动功能模板数据定义
|
/// </summary>
|
public class ModelPanelVibrationInfo : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 震动功能
|
/// </summary>
|
public HdlDevicePanelLogic.PanelVibrationInfo vibrationInfo = new HdlDevicePanelLogic.PanelVibrationInfo();
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = HdlDevicePanelLogic.Current.GetPanelVibrationCommandText(DeviceMac, vibrationInfo);
|
return new List<string>() { command };
|
}
|
}
|
|
/// <summary>
|
/// 面板背光灯模板数据定义
|
/// </summary>
|
public class ModelPanelBackLightInfo : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 亮度调节的信息
|
/// </summary>
|
public ModelPanelSwitchLevelInfo linghtLevelInfo = new ModelPanelSwitchLevelInfo();
|
/// <summary>
|
/// 节能模式
|
/// </summary>
|
public ZigBee.Device.Panel.PanelSaveEnergyModeInfo energyModeInfo = new ZigBee.Device.Panel.PanelSaveEnergyModeInfo();
|
/// <summary>
|
/// 按键的颜色数据
|
/// </summary>
|
public ZigBee.Device.Panel.KeyColorData keyColorData = new ZigBee.Device.Panel.KeyColorData();
|
/// <summary>
|
/// 和keyColorData一起用的东西
|
/// </summary>
|
public ZigBee.Device.Panel.KeyNumStatus KeyNum = new ZigBee.Device.Panel.KeyNumStatus();
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
//亮度调节
|
var command1 = HdlDevicePanelLogic.Current.GetPanelLevelCommadText(DeviceMac, linghtLevelInfo.panelDirectionsLevel, linghtLevelInfo.panelBacklightLevel);
|
//节能模式
|
var command2 = HdlDevicePanelLogic.Current.GetDeviceEnergyConservationModeCommandText(DeviceMac, energyModeInfo.enable, energyModeInfo.time, energyModeInfo.level);
|
return new List<string>() { command1, command2 };
|
}
|
}
|
|
/// <summary>
|
/// 按键指示灯面板开关亮度配置回复
|
/// </summary>
|
public class ModelPanelSwitchLevelInfo
|
{
|
/// <summary>
|
///按键开状态(指示)亮度(这个是点击后的值)
|
/// </summary>
|
public int panelDirectionsLevel = -1;
|
|
/// <summary>
|
/// 按键关状态(背光)亮度(这个是点击前的值)
|
/// </summary>
|
public int panelBacklightLevel = -1;
|
}
|
|
#endregion
|
|
#region ■ 设备名称模板数据定义_______________
|
|
/// <summary>
|
/// 设备端点名称模板数据定义
|
/// </summary>
|
public class ModelDeviceEpointNameInfo : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 设备端点名称
|
/// </summary>
|
public string deviceEpointName = string.Empty;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = Common.LocalDevice.Current.GetReDeviceEpointNameCommandText(DeviceMac, DeviceEpoint, deviceEpointName);
|
return new List<string>() { command };
|
}
|
}
|
|
/// <summary>
|
/// 设备Mac名称模板数据定义
|
/// </summary>
|
public class ModelDeviceMacNameInfo : ModelDeviceDataCommon
|
{
|
/// <summary>
|
/// 设备Mac名称
|
/// </summary>
|
public string deviceMacName = string.Empty;
|
/// <summary>
|
/// 获取更改设备配置的命令字符
|
/// </summary>
|
/// <returns></returns>
|
public override List<string> GetSendGatewayValue()
|
{
|
var command = Common.LocalDevice.Current.GetReDeviceMacNameCommandText(DeviceMac, DeviceEpoint, deviceMacName);
|
return new List<string>() { command };
|
}
|
}
|
|
#endregion
|
|
#region ■ 自定义枚举_________________________
|
|
/// <summary>
|
/// 模板设备保存的区分
|
/// </summary>
|
public enum ModelDeviceSaveEnum
|
{
|
A未定义 = -1,
|
A设备名称 = 1,
|
A端点名称 = 2,
|
APir配置 = 3,
|
A干接点颜色调节 = 4,
|
A干接点亮度调节 = 5,
|
A干接点节能模式 = 6,
|
A干接点第三级别私有属性 = 7,
|
A窗帘方向及限位 = 8,
|
A窗帘手拉控制 = 9,
|
A空调自定义模式 = 10,
|
A面板震动功能 = 11,
|
A空调摆风功能 = 12,
|
A面板接近感应功能 = 13,
|
A设备绑定列表 = 14,
|
A面板背光灯 = 15
|
}
|
|
/// <summary>
|
/// 发送模板数据的区分
|
/// </summary>
|
public enum ModelDataSendEnum
|
{
|
A未定义 = -1,
|
A私有属性 = 1,
|
A私有协议 = 2,
|
A透传数据 = 3
|
}
|
|
#endregion
|
}
|