353 lines
14 KiB
C#
353 lines
14 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace Domain.IoTLZEntity
|
|||
|
|
{
|
|||
|
|
public class Header
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 指令的名称。DiscoverAppliancesRequest,DiscoverAppliancesResponse,TurnOnRequest,TurnOnConfirmation,GetTurnOnStateRequest,GetTurnOnStateResponse
|
|||
|
|
/// </summary>
|
|||
|
|
public string name { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 指令的类别。 LZOS.Discovery,LZOS.Control,LZOS.Query
|
|||
|
|
/// </summary>
|
|||
|
|
public string @namespace { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的属性信息。当设备没有属性信息时,协议中不需要传入该字段。每个设备允许同步的最大的属性数量是10。
|
|||
|
|
/// </summary>
|
|||
|
|
public class Attributes
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 属性名称,支持数字、字母和下划线,长度不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string name { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 属性值,支持多种json类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public string value { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 属性值的单位名称,支持数字、字母和下划线,长度不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string scale { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 属性值取样的时间戳,单位是秒。
|
|||
|
|
/// </summary>
|
|||
|
|
public string timestampOfSample { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 属性值取样的时间误差,单位是ms。如果设备使用的是轮询时间间隔的取样方式,那么uncertaintyInMilliseconds就等于时间间隔。如温度传感器每1秒取样1次,那么uncertaintyInMilliseconds的值就是1000。
|
|||
|
|
/// </summary>
|
|||
|
|
public string uncertaintyInMilliseconds { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class DiscoveredAppliances
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 支持的设备、场景类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<string> applianceTypes { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备标识符。标识符在用户拥有的所有设备上必须是唯一的。此外,标识符需要在同一设备的多个发现请求之间保持一致。标识符可以包含任何字母或数字和以下特殊字符:_ - = # ; : ? @ &。标识符不能超过256个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string applianceId { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备型号名称,是字符串类型,长度不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string modelName { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 供应商提供的设备版本。是字符串类型,长度不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string version { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 用户用来识别设备的名称。 是字符串类型,不能包含特殊字符和标点符号,长度不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string friendlyName { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备相关的描述,描述内容提需要提及设备厂商,使用场景及连接方式,长度不超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string friendlyDescription { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 别名
|
|||
|
|
/// </summary>
|
|||
|
|
public List<string> nicknames { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备当前是否能够到达。true表示设备当前可以到达,false表示当前设备不能到达。
|
|||
|
|
/// </summary>
|
|||
|
|
public bool isReachable { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备环境
|
|||
|
|
/// </summary>
|
|||
|
|
public string environment { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的分区
|
|||
|
|
/// </summary>
|
|||
|
|
public string partition { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备支持的操作类型数组。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<string> actions { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 提供给设备云使用,存放设备或场景相关的附加信息,是键值对。DuerOS不解析或使用这些数据。该属性的内容不能超过5000字节。
|
|||
|
|
/// </summary>
|
|||
|
|
public Dictionary<string, string> additionalApplianceDetails { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备厂商的名字。
|
|||
|
|
/// </summary>
|
|||
|
|
public string manufacturerName { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的属性信息。当设备没有属性信息时,协议中不需要传入该字段。每个设备允许同步的最大的属性数量是10。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<Attributes> attributes { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// discoveredGroups 对象的数组,该对象包含可发现分组,与用户设备帐户相关联的。 如果没有与用户帐户关联的分组,此属性应包含一个空数组。 如果发生错误,该属性可以为空数组[]。阵列中允许的最大项目数量为10。
|
|||
|
|
/// </summary>
|
|||
|
|
public class DiscoveredGroups
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 分组id
|
|||
|
|
/// </summary>
|
|||
|
|
public string groupId { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 用户用来识别分组的名称, 不应包含特殊字符或标点符号,长度不超过20字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string groupName { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 分组所包含设备ID的数组,要求设备ID必须是已经发现的设备中的ID,否则会同步失败,每个分组设备ID数量不超过50。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<string> applianceIds { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 分组备注信息,不能超过128个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string groupNotes { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 提供给技能使用的分组相关的附加信息的键值对。该属性的内容不能超过2000字符。而且DuerOS也不了解或使用这些数据。
|
|||
|
|
/// </summary>
|
|||
|
|
public Dictionary<string, string> additionalGroupDetails { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class Appliance
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备标识符。标识符在用户拥有的所有设备上必须是唯一的。此外,标识符需要在同一设备的多个发现请求之间保持一致。标识符可以包含任何字母或数字和以下特殊字符:_ - = # ; : ? @ &。标识符不能超过256个字符。
|
|||
|
|
/// </summary>
|
|||
|
|
public string applianceId { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的亮度
|
|||
|
|
/// </summary>
|
|||
|
|
public class Brightness
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯光亮度的百分比值,是double类型,取值范围为0~100。其中0表示灯在打开时的最小亮度,100表示灯的最大亮度。
|
|||
|
|
/// </summary>
|
|||
|
|
public double value { get; set; }
|
|||
|
|
}
|
|||
|
|
public class DeltaPercentage
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 亮度增加的百分比值,是float类型,取值范围是0~100。
|
|||
|
|
/// </summary>
|
|||
|
|
public float value { get; set; }
|
|||
|
|
}
|
|||
|
|
public class Color
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯光设置的色相,是double类型,取值范围为0.00〜360.00。
|
|||
|
|
/// </summary>
|
|||
|
|
public double hue { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯光设置饱和度,是double类型,取值范围为0.0000〜1.0000。
|
|||
|
|
/// </summary>
|
|||
|
|
public double saturation { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯光设置的亮度,是double类型,取值范围为0.0000〜1.0000。
|
|||
|
|
/// </summary>
|
|||
|
|
public double brightness { get; set; }
|
|||
|
|
}
|
|||
|
|
public class AchievedState
|
|||
|
|
{
|
|||
|
|
public Color color { get; set; }
|
|||
|
|
}
|
|||
|
|
public class DeltaValue
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备调整温度值,是float类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public string value { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度计量单位。有CELSIUS(摄氏温度)和FAHRENHEIT(华氏温度)两种计量单位,默认使用CELSIUS。
|
|||
|
|
/// </summary>
|
|||
|
|
public string scale { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设定之前的设备模式。
|
|||
|
|
/// </summary>
|
|||
|
|
public class Mode
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备类型
|
|||
|
|
/// </summary>
|
|||
|
|
public string deviceType { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备模式,与设备类型相关,不同设备类型的模式不同
|
|||
|
|
/// </summary>
|
|||
|
|
public string value { get; set; }
|
|||
|
|
}
|
|||
|
|
public class Temperature
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设定之前设备的温度,是double类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public double value { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度计量单位
|
|||
|
|
/// </summary>
|
|||
|
|
public string scale { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的风速对象,包含一个属性值value或者一个属性值level,取决于用户自然表达。
|
|||
|
|
/// </summary>
|
|||
|
|
public class FanSpeed
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的风速值,是int类型,取值范围是1~10。用户表达具体风速值时,会出该字段。
|
|||
|
|
/// </summary>
|
|||
|
|
public int value { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的风速档位级别,是string类型,取值范围是(min、low、middle、high、max、auto))。用户表达风速级别时,会出该字段。
|
|||
|
|
/// </summary>
|
|||
|
|
public string level { get; set; }
|
|||
|
|
}
|
|||
|
|
public class PreviousState
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 亮度设置前的对象。
|
|||
|
|
/// </summary>
|
|||
|
|
public Brightness brightness { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设置成功后的设备模式。
|
|||
|
|
/// </summary>
|
|||
|
|
public Mode mode { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设置成功后设备的温度,是double类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public Temperature temperature { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的风速对象,包含一个属性值value。
|
|||
|
|
/// </summary>
|
|||
|
|
public FanSpeed fanSpeed { get; set; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class Payload
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备云端获取的access token。
|
|||
|
|
/// </summary>
|
|||
|
|
public string accessToken { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 客房音箱设备序列码
|
|||
|
|
/// </summary>
|
|||
|
|
public string cuid { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 以对象数组返回客户关联设备云帐户的设备、场景。如客户关联帐户没有设备、场景则返回空数组。如果在发现过程中出现错误,字段值设置为null, 用户允许接入的最大的设备数量是300。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<DiscoveredAppliances> discoveredAppliances { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 对象的数组,该对象包含可发现分组,与用户设备帐户相关联的。 如果没有与用户帐户关联的分组,此属性应包含一个空数组。 如果发生错误,该属性可以为空数组[]。阵列中允许的最大项目数量为10。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<DiscoveredGroups> discoveredGroups { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备操作的具体对象,包括applianceId和additionalApplianceDetails。
|
|||
|
|
/// </summary>
|
|||
|
|
public Appliance appliance { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的属性信息。当设备没有属性信息时,协议中不需要传入该字段。每个设备允许同步的最大的属性数量是10。
|
|||
|
|
/// </summary>
|
|||
|
|
public List<Attributes> attributes { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯光亮度的对象。
|
|||
|
|
/// </summary>
|
|||
|
|
public Brightness brightness { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设置成功后的设备模式。
|
|||
|
|
/// </summary>
|
|||
|
|
public Mode mode { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 温度设置成功后设备的温度,是double类型。
|
|||
|
|
/// </summary>
|
|||
|
|
public Temperature targetTemperature { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备的风速对象,包含一个属性值value。
|
|||
|
|
/// </summary>
|
|||
|
|
public FanSpeed fanSpeed { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 亮度设置前的对象。
|
|||
|
|
/// </summary>
|
|||
|
|
public PreviousState previousState { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 亮度增加的百分比对象。
|
|||
|
|
/// </summary>
|
|||
|
|
public DeltaPercentage deltaPercentage { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 灯设置的颜色。包括色相、饱和度、亮度(HSB)颜色模型。
|
|||
|
|
/// </summary>
|
|||
|
|
public Color color { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 颜色更改后设备的状态
|
|||
|
|
/// </summary>
|
|||
|
|
public AchievedState achievedState { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设备温度调整信息
|
|||
|
|
/// </summary>
|
|||
|
|
public DeltaValue deltaValue { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 发现设备请求
|
|||
|
|
/// </summary>
|
|||
|
|
public class DiscoverAppliancesRequest
|
|||
|
|
{
|
|||
|
|
public Header header { get; set; }
|
|||
|
|
public Payload payload { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 发现设备响应
|
|||
|
|
/// </summary>
|
|||
|
|
public class DiscoverAppliancesResponse
|
|||
|
|
{
|
|||
|
|
public Header header { get; set; }
|
|||
|
|
public Payload payload { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 控制设备请求
|
|||
|
|
/// </summary>
|
|||
|
|
public class ControlAppliancesRequest
|
|||
|
|
{
|
|||
|
|
public Header header { get; set; }
|
|||
|
|
public Payload payload { get; set; }
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 控制设备响应
|
|||
|
|
/// </summary>
|
|||
|
|
public class ControlAppliancesResponse
|
|||
|
|
{
|
|||
|
|
public Header header { get; set; }
|
|||
|
|
public Payload payload { get; set; }
|
|||
|
|
}
|
|||
|
|
public class ErrorResponse
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// Header
|
|||
|
|
/// </summary>
|
|||
|
|
public Header header { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// Payload
|
|||
|
|
/// </summary>
|
|||
|
|
public Payload payload { get; set; }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|