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