CrabtreeOn,印度客户定制APP,迁移2.0平台版本
JLChen
2021-01-28 7286553a34ce9b9cc45c3f6786eff7cd5c086146
2021-01-28 1.增加设备列表获取方法。2.增加oid和sid上传方法。
6个文件已修改
9070 ■■■■■ 已修改文件
Crabtree/.vs/SmartHome/xs/UserPrefs.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON/Resources/Resource.designer.cs 8054 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs 854 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/UserPrefs.xml
@@ -1,13 +1,11 @@
<Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default">
  <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
  <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/HDL/Operation/MyEnum.cs">
  <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/HDL/Common/HDLLinkUtlis.cs">
    <Files>
      <File FileName="SmartHome/HDL/Common/HDLLinkUtlis.cs" Line="312" Column="36" />
      <File FileName="SmartHome/UI/SimpleControl/CommonPage.cs" />
      <File FileName="SmartHome/HDL/Operation/Device/Common.cs" />
      <File FileName="SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs" />
      <File FileName="SmartHome/HDL/Operation/Device/ABase.cs" />
      <File FileName="SmartHome/HDL/Operation/MyEnum.cs" Line="76" Column="9" />
      <File FileName="SmartHome/HDL/Common/HDLLinkUtlis.cs" Line="1724" Column="21" />
      <File FileName="SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs" Line="220" Column="100" />
      <File FileName="SmartHome/HDL/Operation/UserConfig.cs" Line="162" Column="34" />
      <File FileName="SmartHome/HDL/Operation/UserInfo.cs" Line="1" Column="1" />
    </Files>
    <Pads>
      <Pad Id="ProjectPad">
@@ -17,25 +15,35 @@
            <Node name="ON.Ios" expanded="True" />
            <Node name="Shared" expanded="True">
              <Node name="HDL" expanded="True">
                <Node name="Common" expanded="True" />
                <Node name="Common" expanded="True">
                  <Node name="HttpUtil" expanded="True" />
                  <Node name="HDLLinkUtlis.cs" selected="True" />
                </Node>
                <Node name="Operation" expanded="True">
                  <Node name="Device" expanded="True" />
                  <Node name="MyEnum.cs" selected="True" />
                </Node>
              </Node>
              <Node name="IO" expanded="True" />
              <Node name="UI" expanded="True">
                <Node name="SimpleControl" expanded="True">
                  <Node name="Phone" expanded="True">
                    <Node name="AC" expanded="True" />
                    <Node name="Alexa" expanded="True" />
                    <Node name="Guide" expanded="True" />
                    <Node name="Register" expanded="True" />
                    <Node name="Room" expanded="True" />
                    <Node name="Schedule" expanded="True" />
                    <Node name="Sensor" expanded="True" />
                    <Node name="User" expanded="True" />
                    <Node name="Warning" expanded="True" />
                  </Node>
                </Node>
              </Node>
            </Node>
          </Node>
        </State>
      </Pad>
      <Pad Id="MonoDevelop.Debugger.WatchPad">
        <State />
      </Pad>
    </Pads>
  </MonoDevelop.Ide.Workbench>
@@ -50,7 +58,10 @@
  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
  <MonoDevelop.Ide.ItemProperties.ON.Ios PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008030-00014C392121802E" />
  <MonoDevelop.Ide.DebuggingService.Breakpoints>
    <BreakpointStore />
    <BreakpointStore>
      <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/CrabtreeOnNew/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs" relfile="SmartHome/HDL/Common/HttpUtil/HttpUtil.cs" line="219" column="1" />
      <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/CrabtreeOnNew/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs" relfile="SmartHome/HDL/Common/HttpUtil/HttpUtil.cs" line="215" column="1" />
    </BreakpointStore>
  </MonoDevelop.Ide.DebuggingService.Breakpoints>
  <MultiItemStartupConfigurations />
</Properties>
Crabtree/ON/Resources/Resource.designer.cs
Diff too large
Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using Shared;
using Shared.IO;
namespace SmartHome
namespace Shared
{
    /// <summary>
    /// HDLLink协议 工具类
@@ -28,6 +29,156 @@
        #endregion
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool UploadOidAndSidList ()
        {
            var res = false;
            try {
                IotCloud currentProject = new IotCloud ();
                var list = GetAllDeviceList ();
                ConvertOidListToIotStruct (UserConfig.Instance.CurrentRegion.Id, UserConfig.Instance.HomeGateway.gatewayId, list, ref currentProject);
                Utlis.WriteLine ("list: " + list.Count + "currentProject : " + currentProject.functions.devices.Count);
                var revertObj = HttpServerRequest.Current.UploadDeviceOidList (currentProject.modules);
                if(revertObj.Code == StateCode.SUCCESS) {
                    var revertObj2 = HttpServerRequest.Current.UploadDeviceSidList (currentProject.functions);
                    if (revertObj2.Code == StateCode.SUCCESS) {
                        res = true;
                    } else {
                        IMessageCommon.Current.ShowErrorInfoAlter (revertObj2.Code);
                    }
                } else {
                    IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code);
                }
            } catch {
            }
            return res;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public List<Common> GetAllDeviceList ()
        {
            List<Common> TargetList = new List<Common> ();
            //找出需要显示的设备
            var filesList = FileUtils.ReadFiles ().FindAll ((obj) => {
                string [] str = obj.Split ('_');
                return obj.StartsWith ("Equipment_") && str.Length == 5;
            });
            var localEquipments = filesList.FindAll ((obj) => {
                string typeString = obj.Split ('_') [1];
                return (
                #region light
                    typeString.ToString () == DeviceType.LightCCT.ToString () ||
                typeString.ToString () == DeviceType.LightRGB.ToString () ||
                typeString.ToString () == DeviceType.LightDALI.ToString () ||
                typeString.ToString () == DeviceType.LightRGBW.ToString () ||
                typeString.ToString () == DeviceType.LightLogic.ToString () ||
                typeString.ToString () == DeviceType.LightSwitch.ToString () ||
                typeString.ToString () == DeviceType.LightDimming.ToString () ||
                typeString.ToString () == DeviceType.LightMixSwitch.ToString () ||
                typeString.ToString () == DeviceType.LightRGBandCCT.ToString () ||
                typeString.ToString () == DeviceType.LightMixDimming.ToString () ||
                typeString.ToString () == DeviceType.LightEnergySwitch.ToString () ||
                typeString.ToString () == DeviceType.LightEnergySocket.ToString () ||
                typeString.ToString () == DeviceType.LightSwitchSocket.ToString ()
                || typeString.ToString () == DeviceType.DMX48.ToString ()
                #endregion
                #region light
                    || typeString.ToString () == DeviceType.SensorCH4.ToString () ||
                typeString.ToString () == DeviceType.SensorCO2.ToString () ||
                typeString.ToString () == DeviceType.SensorLPG.ToString () ||
                typeString.ToString () == DeviceType.SensorCOH2.ToString () ||
                typeString.ToString () == DeviceType.SensorPM25.ToString () ||
                typeString.ToString () == DeviceType.SensorTVOC.ToString () ||
                typeString.ToString () == DeviceType.SensorPower.ToString () ||
                typeString.ToString () == DeviceType.SensorSmoke.ToString () ||
                typeString.ToString () == DeviceType.SensorWater.ToString () ||
                typeString.ToString () == DeviceType.SensorWeight.ToString () ||
                typeString.ToString () == DeviceType.SensorCurrent.ToString () ||
                typeString.ToString () == DeviceType.SensorVoltage.ToString ()
                || typeString.ToString () == DeviceType.SensorRainfall.ToString ()
                || typeString.ToString () == DeviceType.SensorVelocity.ToString ()
                || typeString.ToString () == DeviceType.SensorMenciAndwindowMagnetic.ToString ()
                || typeString.ToString () == DeviceType.SensorMobileDetection.ToString ()
                || typeString.ToString () == DeviceType.SensorLiquidPressure.ToString ()
                || typeString.ToString () == DeviceType.SensorVibration.ToString ()
                || typeString.ToString () == DeviceType.SensorLiquidFlow.ToString ()
                || typeString.ToString () == DeviceType.SensorLiquidDepth.ToString ()
                || typeString.ToString () == DeviceType.SensorTemperature.ToString ()
                || typeString.ToString () == DeviceType.SensorHeightLength.ToString ()
                || typeString.ToString () == DeviceType.SensorIllumination.ToString ()
                || typeString.ToString () == DeviceType.SensorWindPressure.ToString ()
                || typeString.ToString () == DeviceType.SensorHumidity.ToString ()
                #endregion
                #region curtain
                    || typeString.ToString () == DeviceType.CurtainModel.ToString ()
                || typeString.ToString () == DeviceType.CurtainRoller.ToString ()
                || typeString.ToString () == DeviceType.CurtainTrietex.ToString ()
                #endregion
                #region ac
                    || typeString.ToString () == DeviceType.ACPanel.ToString ()
                || typeString.ToString () == DeviceType.ACDevice.ToString ()
                || typeString.ToString () == DeviceType.ACInfrared.ToString ()
                || typeString.ToString () == DeviceType.ACCoolmaster.ToString ()
                || typeString.ToString () == DeviceType.CustomAC.ToString ()
                || typeString.ToString () == DeviceType.HVAC.ToString ()
                #endregion
                #region foolheat
                    || typeString.ToString () == DeviceType.FoolHeat.ToString ()
                || typeString.ToString () == DeviceType.FoolHeatPanel.ToString ()
                #endregion
                #region
                    || typeString.ToString () == DeviceType.InfraredMode.ToString ()
                || typeString.ToString () == DeviceType.DoorLock.ToString ()
                || typeString.ToString () == DeviceType.FanModule.ToString ()
                || typeString.ToString () == DeviceType.FreshAir.ToString ()
                || typeString.ToString () == DeviceType.InfraredTV.ToString ()
                || typeString.ToString () == DeviceType.UniversalDevice.ToString ()
                || typeString.ToString () == DeviceType.MusicModel.ToString ()
                || typeString.ToString () == DeviceType.SecurityModule.ToString ()
                || typeString.ToString () == DeviceType.LogicModule.ToString ()
                || typeString.ToString () == DeviceType.SecurityPanel.ToString ()
                #endregion
                    );
            });
            foreach (string deviceFilePath in localEquipments) {
                try {
                    string [] str = deviceFilePath.Split ('_');
                    var commonBytes = FileUtils.ReadFile (deviceFilePath);
                    if (commonBytes.Length == 0) {
                        Utlis.WriteLine ("length loss");
                        continue;
                    }
                    if (commonBytes.Length == 1) {
                        Utlis.WriteLine ("length loss 1");
                        continue;
                    }
                    Common commonDevice = Newtonsoft.Json.JsonConvert.DeserializeObject<Common> (System.Text.Encoding.UTF8.GetString (commonBytes));
                    if (commonDevice == null) {
                        continue;
                    }
                    TargetList.Add (commonDevice);
                } catch {
                }
            }
            return TargetList;
        }
        /// <summary>
@@ -35,35 +186,24 @@
        /// </summary>
        /// <param name="moduleCommon">模块设备</param>
        /// <returns></returns>
        public List<Sid> ConvertToSidListToIotCloud (string sOid, Common moduleCommon)
        public List<Sid> ConvertToSidListToIotCloud (string sOid, Common loopCommon)
        {
            List<Sid> tmpResult = new List<Sid> ();
            List<Sid> sidList = new List<Sid> ();
            try {
                if (moduleCommon != null && moduleCommon.LoopCount > 0) {
                    for (int intI = 0; intI < moduleCommon.LoopCount; intI++) {
                        //byte BigType = moduleCommon.bytSimpleParam [0 + intI * 3];
                        //byte SmallType = moduleCommon.bytSimpleParam [1 + intI * 3];
                        int Count = moduleCommon.LoopCount;
                        if (Count > 0) {
                            for (int j = 1; j <= Count; j++) {
                                //模块里面的单个回路
                                Common deviceCommon = new Common ();
                                Sid tmpSid = new Sid ();
                                tmpSid.sid = FormingNewSid (sOid, deviceCommon);
                                tmpSid.oid = sOid;
                                tmpSid.name = deviceCommon.Name;
                Sid tmpSid = new Sid ();
                tmpSid.sid = FormingNewSid (sOid, loopCommon);
                tmpSid.oid = sOid;
                tmpSid.name = loopCommon.Name;
                                SidObject tmp = UpdateSidAttributesToDeviceList (deviceCommon, sOid);
                                tmpSid.attributes = tmp.attributes;//UpdateSidAttributesToDeviceList(onlineDevice.DeviceType, sOid, j, BigType, SmallType, ref spk);
                                tmpSid.spk = tmp.spk;
                                tmpResult.Add (tmpSid);
                            }
                        }
                    }
                }
                return tmpResult;
                SidObject tmp = UpdateSidAttributesToDeviceList (loopCommon, sOid);
                tmpSid.attributes = tmp.attributes;
                //UpdateSidAttributesToDeviceList(onlineDevice.DeviceType, sOid, j, BigType, SmallType, ref spk);
                tmpSid.spk = tmp.spk;
                sidList.Add (tmpSid);
                return sidList;
            } catch (Exception) {
                return tmpResult;
                return sidList;
            }
        }
@@ -74,26 +214,18 @@
        /// <param name="onlineDevices"></param>
        /// <param name="gatewayId"></param>
        /// <param name="currentProject"></param>
        public void ConvertOidListToIotStruct (string homeId, string gatewayId, List<Common> moduleCommonList, ref IotCloud currentProject)
        public void ConvertOidListToIotStruct (string homeId, string gatewayId, List<Common> loopCommonList, ref IotCloud currentProject)
        {
            try {
                //step 1 转换类型
                Sids functionList = new Sids();
                List<Sid> tmpFunction = new List<Sid> ();
                //step 2 转换类型
                Oids mOidList = ConvertToOidListToIotCloud (moduleCommonList, ref tmpFunction);
                if (currentProject.modules == null || currentProject.modules.devices == null || currentProject.modules.devices.Count == 0) {
                    currentProject.modules = mOidList;
                } else {
                    foreach (Oid tmpModule in mOidList.devices) {
                        Oid tmpFind = currentProject.modules.devices.Find (P => P.mac.Equals (tmpModule.mac));
                        if (tmpFind == null) currentProject.modules.devices.Add (tmpModule);
                    }
                }
                //step 2 转换生成Oids列表和sid 设备列表
                Oids mOidList = ConvertToOidListToIotCloud (loopCommonList, ref tmpFunction);
                mOidList.homeId = homeId;
                //step 3
                functionList.devices = new List<Sid> ();
                functionList.homeId = homeId;
                functionList.gatewayId = gatewayId;
@@ -115,31 +247,46 @@
        /// </summary>
        /// <param name="onlineDevices"></param>
        /// <returns></returns>
        public Oids ConvertToOidListToIotCloud (List<Common> moduleCommonList, ref List<Sid> functionLists)
        public Oids ConvertToOidListToIotCloud (List<Common> loopCommonListlolooloopl, ref List<Sid> functionLists)
        {
            Oids tmpResult = new Oids ();
            Oids mOidsList = new Oids ();
            try {
                tmpResult.devices = new List<Oid> ();
                mOidsList.devices = new List<Oid> ();
                //HDLSysPF.IniDeviceChannelRemark (); //整理全部设备备注到缓存列表
                foreach (Common tmp in moduleCommonList) {
                    Oid tmpOid = new Oid ();
                    tmpOid.protocolType = "bus";
                    tmpOid.device_name = tmp.Name;
                    tmpOid.oid = FormingNewOid (tmp.Type);
                    tmpOid.addresses = string.Format ("{0}{1}", tmp.SubnetID.ToString ("X2"), tmp.DeviceID.ToString ("X2"));
                    tmpOid.device_model = tmp.Type.ToString ();
                    tmpOid.fw_version = "";
                    tmpOid.deviceType = tmp.Type.ToString ();
                    tmpOid.hw_info = "";
                    tmpOid.mac = tmp.MAC;
                    tmpResult.devices.Add (tmpOid);
                foreach (Common tmp in loopCommonListlolooloopl) {
                    //1.deviceType标识 云端是int类型
                    var deviceType = ((int)tmp.Type);
                    //2.addresses标识 子网号、设备号
                    var addresses = string.Format ("{0}{1}", tmp.SubnetID.ToString ("X2"), tmp.DeviceID.ToString ("X2"));
                    //3.判断当前回路设备之前是否生成过相同模块的oid,存在则取之前的oid 没有则创建新增新的oid
                    var deviceOid = mOidsList.devices.Find (o => o.deviceType == deviceType && o.addresses == addresses);
                    if (deviceOid == null) {
                        //3.1没有则创建新增新的oid
                        Oid tmpOid = new Oid ();
                        tmpOid.protocolType = "bus";
                        tmpOid.device_name = tmp.Type.ToString ();
                        tmpOid.oid = FormingNewOid (tmp.Type);
                        tmpOid.addresses = addresses;
                        tmpOid.device_model = tmp.Type.ToString ();
                        tmpOid.fw_version = "";
                        tmpOid.deviceType = deviceType;
                        tmpOid.hw_info = "";
                        tmpOid.mac = tmp.MAC;
                        mOidsList.devices.Add (tmpOid);
                    functionLists.AddRange (ConvertToSidListToIotCloud (tmpOid.oid, tmp));
                        functionLists.AddRange (ConvertToSidListToIotCloud (tmpOid.oid, tmp));
                        Utlis.WriteLine ("新的模块,新的的OID:" + tmpOid.addresses + " deviceType:" + tmpOid.deviceType);
                    } else {
                        //3.2存在则取之前的oid
                        functionLists.AddRange (ConvertToSidListToIotCloud (deviceOid.oid, tmp));
                        Utlis.WriteLine ("相同的模块,取之前的OID:" + deviceOid.addresses + " deviceType:" + deviceOid.deviceType);
                    }
                }
                return tmpResult;
                return mOidsList;
            } catch (Exception ex) {
                return tmpResult;
                //throw;
                return mOidsList;
            }
        }
@@ -432,7 +579,7 @@
                tmp.oid = sOid;
                tmp.sid = sSid;
                tmp.name = loopCommon.Name;
                tmp.attributes = new List<Function> ();
                tmp.attributes = new List<FunctionSid> ();
                tmp.omodel = loopCommon.Type.ToString ();
                //继电器开关类
                if (loopCommon.Type == DeviceType.LightSwitch
@@ -442,7 +589,7 @@
                    || loopCommon.Type == DeviceType.LightMixSwitch) {
                    tmp.spk = "light.switch";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -458,7 +605,7 @@
                    //调光类
                    tmp.spk = "light.dimming";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -470,7 +617,7 @@
                    #endregion
                    #region brightness
                    Function tempFunction1 = new Function ();
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "brightness";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
@@ -481,7 +628,7 @@
                    #endregion
                    #region fade_time
                    Function tempFunction3 = new Function ();
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "fade_time";
                    tempFunction3.data_type = "integer";
                    tempFunction3.value = new List<string> ();
@@ -499,7 +646,7 @@
                    {
                        tmp.spk = "light.cct";
                        #region cct
                        Function tempFunction2 = new Function ();
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "cct";
                        tempFunction2.data_type = "integer";
                        tempFunction2.value = new List<string> ();
@@ -518,7 +665,7 @@
                    tmp.spk = "light.rgb";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -530,7 +677,7 @@
                    #endregion
                    #region brightness
                    Function tempFunction2 = new Function ();
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "brightness";
                    tempFunction2.data_type = "integer";
                    tempFunction2.value = new List<string> ();
@@ -544,7 +691,7 @@
                    if (loopCommon.Type == DeviceType.LightRGBW) {
                        tmp.spk = "light.rgbw";
                        #region color
                        Function tempFunction3 = new Function ();
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "rgb";
                        tempFunction3.data_type = "integer";
                        tempFunction3.value = new List<string> ();
@@ -557,7 +704,7 @@
                        #endregion
                    } else {
                        #region color
                        Function tempFunction3 = new Function ();
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "rgb";
                        tempFunction3.data_type = "integer";
                        tempFunction3.value = new List<string> ();
@@ -569,7 +716,7 @@
                    if (loopCommon.Type == DeviceType.LightRGBandCCT) {
                        #region CCT
                        Function tempFunctionCCT = new Function ();
                        FunctionSid tempFunctionCCT = new FunctionSid ();
                        tempFunctionCCT.key = "cct";
                        tempFunctionCCT.data_type = "integer";
                        tempFunctionCCT.value = new List<string> ();
@@ -585,7 +732,7 @@
                } else if (loopCommon.Type == DeviceType.CurtainModel || loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex) {
                    tmp.spk = "curtain.switch";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -600,7 +747,7 @@
                    {
                        tmp.spk = "curtain.trietex";
                        #region openlevel
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "percent";
                        tempFunction1.data_type = "integer";
                        tempFunction1.value = new List<string> ();
@@ -620,7 +767,7 @@
                    //空调类
                    tmp.spk = "ac.standard";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -632,7 +779,7 @@
                    #endregion
                    #region mode
                    Function tempFunction1 = new Function ();
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "mode";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
@@ -648,7 +795,7 @@
                    #endregion
                    #region fan
                    Function tempFunction2 = new Function ();
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "fan";
                    tempFunction2.data_type = "integer";
                    tempFunction2.value = new List<string> ();
@@ -662,7 +809,7 @@
                    #endregion
                    #region temp
                    Function tempFunction3 = new Function ();
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "set_temp";
                    //2020 08 11  hvac 温度控制 1°-> int 0.5°->float
                    //if (HVACModuleDeviceTypeList.HDLHVACwithAcControlHighPrecision.Contains(DevOnLineTmp.DeviceType))
@@ -681,7 +828,7 @@
                    #endregion
                    #region temp_step
                    Function tempFunction5 = new Function ();
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "set_temp_step";
                    tempFunction5.data_type = "string";
                    tempFunction5.value = new List<string> ();
@@ -693,7 +840,7 @@
                    #endregion
                    #region room_temp
                    Function tempFunction6 = new Function ();
                    FunctionSid tempFunction6 = new FunctionSid ();
                    tempFunction6.key = "room_temp";
                    tempFunction6.data_type = "float";
                    tempFunction6.value = new List<string> ();
@@ -703,7 +850,7 @@
                    #endregion
                    #region swing
                    Function tempFunction4 = new Function ();
                    FunctionSid tempFunction4 = new FunctionSid ();
                    tempFunction4.key = "swing";
                    tempFunction4.data_type = "string";
                    tempFunction4.value = new List<string> ();
@@ -725,7 +872,7 @@
                    || loopCommon.Type == DeviceType.FoolHeatPanel) {
                    tmp.spk = "floorHeat.standard";
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -737,7 +884,7 @@
                    #endregion
                    #region mode
                    Function tempFunction1 = new Function ();
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "mode";
                    tempFunction1.data_type = "string";
                    tempFunction1.value = new List<string> ();
@@ -752,7 +899,7 @@
                    #endregion
                    #region temp
                    Function tempFunction3 = new Function ();
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "set_temp";
                    tempFunction3.data_type = "float";
                    tempFunction3.value = new List<string> ();
@@ -765,7 +912,7 @@
                    #endregion
                    #region temp
                    Function tempFunction4 = new Function ();
                    FunctionSid tempFunction4 = new FunctionSid ();
                    tempFunction4.key = "set_temp_step";
                    tempFunction4.data_type = "string";
                    tempFunction4.value = new List<string> ();
@@ -777,7 +924,7 @@
                    #endregion
                    #region room_temp
                    Function tempFunction5 = new Function ();
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "room_temp";
                    tempFunction5.data_type = "float";
                    tempFunction5.value = new List<string> ();
@@ -796,7 +943,7 @@
                    tmp.spk = "music.standard";
                    // on_off  volume song_step  audio  list_channel  mode  song_num  special_song  volume_level
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -813,7 +960,7 @@
                    #endregion
                    #region volume
                    Function tempFunction1 = new Function ();
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "volume";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
@@ -824,7 +971,7 @@
                    #endregion
                    #region volume_step
                    Function tempFunction9 = new Function ();
                    FunctionSid tempFunction9 = new FunctionSid ();
                    tempFunction9.key = "volume_step";
                    tempFunction9.data_type = "string";
                    tempFunction9.value = new List<string> ();
@@ -837,7 +984,7 @@
                    #region volume_level
                    Function tempFunction10 = new Function ();
                    FunctionSid tempFunction10 = new FunctionSid ();
                    tempFunction10.key = "volume_level";
                    tempFunction10.data_type = "integer";
                    tempFunction10.value = new List<string> ();
@@ -848,7 +995,7 @@
                    #endregion
                    #region volume_level_step
                    Function tempFunction11 = new Function ();
                    FunctionSid tempFunction11 = new FunctionSid ();
                    tempFunction11.key = "volume_level_step";
                    tempFunction11.data_type = "string";
                    tempFunction11.value = new List<string> ();
@@ -860,7 +1007,7 @@
                    #endregion
                    #region treble
                    Function tempFunction14 = new Function ();
                    FunctionSid tempFunction14 = new FunctionSid ();
                    tempFunction14.key = "treble";
                    tempFunction14.data_type = "integer";
                    tempFunction14.max = 10;
@@ -869,7 +1016,7 @@
                    #endregion
                    #region treble_step
                    Function tempFunction12 = new Function ();
                    FunctionSid tempFunction12 = new FunctionSid ();
                    tempFunction12.key = "treble_step";
                    tempFunction12.data_type = "string";
                    tempFunction12.value = new List<string> ();
@@ -882,7 +1029,7 @@
                    #region bass
                    Function tempFunction15 = new Function ();
                    FunctionSid tempFunction15 = new FunctionSid ();
                    tempFunction15.key = "bass";
                    tempFunction15.data_type = "integer";
                    tempFunction15.max = 10;
@@ -891,7 +1038,7 @@
                    #endregion
                    #region bass_step
                    Function tempFunction13 = new Function ();
                    FunctionSid tempFunction13 = new FunctionSid ();
                    tempFunction13.key = "bass_step";
                    tempFunction13.data_type = "string";
                    tempFunction13.value = new List<string> ();
@@ -903,7 +1050,7 @@
                    #endregion
                    #region mode
                    Function tempFunction5 = new Function ();
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "mode";
                    tempFunction5.data_type = "string";
                    tempFunction5.value = new List<string> ();
@@ -922,7 +1069,7 @@
                    #region source
                    //1    = SD, 2 = External Input, 3 = FTP, 4 = Radio
                    //sdcard/external_input/ftp/radio
                    Function tempFunction3 = new Function ();
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "source";
                    tempFunction3.data_type = "string";
                    tempFunction3.value = new List<string> ();
@@ -937,7 +1084,7 @@
                    #endregion
                    #region song_step
                    Function tempFunction2 = new Function ();
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "song_step";
                    tempFunction2.data_type = "string";
                    tempFunction2.value = new List<string> ();
@@ -949,28 +1096,28 @@
                    #endregion
                    #region bass
                    Function tempFunction16 = new Function ();
                    FunctionSid tempFunction16 = new FunctionSid ();
                    tempFunction16.key = "playlist_name";
                    tempFunction16.data_type = "string";
                    tmp.attributes.Add (tempFunction16);
                    #endregion
                    #region bass
                    Function tempFunction17 = new Function ();
                    FunctionSid tempFunction17 = new FunctionSid ();
                    tempFunction17.key = "song_name";
                    tempFunction17.data_type = "string";
                    tmp.attributes.Add (tempFunction17);
                    #endregion
                    #region bass
                    Function tempFunction19 = new Function ();
                    FunctionSid tempFunction19 = new FunctionSid ();
                    tempFunction19.key = "song_time";
                    tempFunction19.data_type = "string";
                    tmp.attributes.Add (tempFunction19);
                    #endregion
                    #region bass
                    Function tempFunction20 = new Function ();
                    FunctionSid tempFunction20 = new FunctionSid ();
                    tempFunction20.key = "playing_time";
                    tempFunction20.data_type = "string";
                    tmp.attributes.Add (tempFunction20);
@@ -980,7 +1127,7 @@
                    if (loopCommon.Type == DeviceType.SensorMobileDetection) {
                        tmp.spk = "sensor.pir";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -992,7 +1139,7 @@
                        #endregion
                        #region status
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "status";
                        tempFunction1.data_type = "string";
                        tempFunction1.value = new List<string> ();
@@ -1004,7 +1151,7 @@
                        #endregion
                        #region sensitivity
                        Function tempFunction2 = new Function ();
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "sensitivity";
                        tempFunction2.data_type = "integer";
                        tempFunction2.max = 100;
@@ -1014,7 +1161,7 @@
                    }else if (loopCommon.Type == DeviceType.SensorTemperature) {
                        tmp.spk = "sensor.temperature";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1026,7 +1173,7 @@
                        #endregion
                        #region temp
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";  //2020 12 22 
                        tempFunction1.data_type = "float";
                        tempFunction1.max = 50;
@@ -1035,7 +1182,7 @@
                        #endregion
                        #region type
                        Function tempFunction2 = new Function ();
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "type";
                        tempFunction2.data_type = "string";
                        tempFunction2.value = new List<string> ();
@@ -1061,7 +1208,7 @@
                    }else if (loopCommon.Type == DeviceType.SensorIllumination) {
                        tmp.spk = "sensor.light";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1073,21 +1220,21 @@
                        #endregion
                        #region lux
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";  //2020 12 22 
                        tempFunction1.data_type = "integer";
                        tmp.attributes.Add (tempFunction1);
                        #endregion
                        #region error_value
                        Function tempFunction2 = new Function ();
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "error_value";
                        tempFunction2.data_type = "integer";
                        tmp.attributes.Add (tempFunction2);
                        #endregion
                        #region precision
                        Function tempFunction3 = new Function ();
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "precision";
                        tempFunction3.data_type = "string";
                        tempFunction3.value = new List<string> ();
@@ -1101,7 +1248,7 @@
                    } else if (loopCommon.Type == DeviceType.SensorPM25) {
                        tmp.spk = "sensor.pm25";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1113,21 +1260,21 @@
                        #endregion
                        #region value
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tmp.attributes.Add (tempFunction1);
                        #endregion
                        #region error_value
                        Function tempFunction2 = new Function ();
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "error_value";
                        tempFunction2.data_type = "integer";
                        tmp.attributes.Add (tempFunction2);
                        #endregion
                        #region precision
                        Function tempFunction3 = new Function ();
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "precision";
                        tempFunction3.data_type = "string";
                        tempFunction3.value = new List<string> ();
@@ -1141,7 +1288,7 @@
                    }else if (loopCommon.Type == DeviceType.SensorHumidity) {
                        tmp.spk = "sensor.humidity";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1152,7 +1299,7 @@
                        tmp.attributes.Add (tempFunction);
                        #endregion
                        #region value
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "float";
                        tempFunction1.max = 10000;
@@ -1162,7 +1309,7 @@
                    }else if (loopCommon.Type == DeviceType.SensorTVOC) {
                        tmp.spk = "sensor.tvoc";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1173,7 +1320,7 @@
                        tmp.attributes.Add (tempFunction);
                        #endregion
                        #region value
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
@@ -1183,7 +1330,7 @@
                    }else if (loopCommon.Type == DeviceType.SensorCO2) {
                        tmp.spk = "sensor.co2";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1194,7 +1341,7 @@
                        tmp.attributes.Add (tempFunction);
                        #endregion
                        #region value
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
@@ -1204,7 +1351,7 @@
                    }else if (loopCommon.Type == DeviceType.Sensor) {
                        tmp.spk = "dryContact.standard";
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1216,7 +1363,7 @@
                        #endregion
                        #region status
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "status";
                        tempFunction1.data_type = "string";
                        tempFunction1.value = new List<string> ();
@@ -1228,7 +1375,7 @@
                        #endregion
                    } else {
                        #region on_off
                        Function tempFunction = new Function ();
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
@@ -1239,7 +1386,7 @@
                        tmp.attributes.Add (tempFunction);
                        #endregion
                        #region value
                        Function tempFunction1 = new Function ();
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
@@ -1252,7 +1399,7 @@
                } else {
                    #region on_off
                    Function tempFunction = new Function ();
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
@@ -1407,7 +1554,7 @@
        public string fw_version { get; set; }
        public string hw_info { get; set; }
        public string mac { get; set; }
        public string deviceType { get; set; }
        public int deviceType { get; set; }
    }
    [Serializable]
@@ -1420,12 +1567,12 @@
        public string oid { get; set; }  //设备模块地址
        public string omodel { get; set; }    //型号
        public List<Function> attributes { get; set; } //属性列表
        public List<FunctionSid> attributes { get; set; } //属性列表
    }
    [Serializable]
    public class Function
    public class FunctionSid
    {
        //public string name { get; set; }
        public string key { get; set; }
@@ -1448,6 +1595,461 @@
        public Sids functions { get; set; } //功能列表
    }
    /// <summary>
    /// 设备列表响应data参数
    /// </summary>
    public class DevcieFunctionRes
    {
        public List<Function> list = new List<Function> ();
        //public string totalCount = "0";
        //public string totalPage = "0";
        //public string pageNo = "0";
        //public string pageSize = "0";
    }
    /// <summary>
    /// 功能类能满足数据使用要求,子类只是为了方便使用属性
    /// </summary>
    public class Function
    {
        public Function ()
        {
        }
        #region base info
        /// <summary>
        /// HDL统一协议格式:14bytes
        /// 举例: 来源   厂商代码 通讯方式  产品时间戳   产品类别 物模型类  通道号   大小类别
        ///       1byte    1byte    1byte      4byte        1byte    2byte   2byte   2byte
        /// 来源:00    默认原生态系统数据 、01    网关或者其他A设备、02    调试软件、03    APP应用程序、04    第三方网关或者平台
        /// 厂商代码:01    HDL
        /// 通讯方式:01    HDL Bus、02    Zigbee、03 KNX、04 Z-Wave
        /// 产品时间戳:4bytes    以2020年1月1日算出的时间戳0.1s为单位
        /// 产品类别:01    调光器、02 继电器、03    干接点模块、04    传感器、05 面板
        /// 物模型类型:
        ///     01    开关类:01 开关、02 插座、03
        ///     02    照明: 01 开关、02    调光、03    色温、04    LED
        ///     03    遮阳: 01    窗帘电机、02 百叶窗、03 开合帘、04 卷帘
        ///     04    恒温器:01 空调、02 地暖、03 毛细空调
        ///     05    新风
        ///     06    影音
        ///     07    音乐
        ///     08    能源
        ///     09    安防
        /// 大类别    1bytes    (预留)
        /// 小类别    1byte    (预留)
        /// </summary>
        public string sid = "0301011234567801012301230123";
        /// <summary>
        ///
        /// </summary>
        public string oid;
        /// <summary>
        /// 备注
        /// </summary>
        public string name;
        /// <summary>
        /// 设备ID
        /// 云端负责生成
        /// </summary>
        public string deviceId = "0";
        /// <summary>
        /// 设备spk
        /// </summary>
        public string spk = "";
        /// <summary>
        ///
        /// </summary>
        string spk_Prefix;
        /// <summary>
        /// spk前缀
        /// 大类
        /// 功能类别
        /// 如:空调类、灯光类、窗帘类
        /// </summary>
        public string Spk_Prefix {
            get {
                if (string.IsNullOrEmpty (spk_Prefix)) {
                    spk_Prefix = spk.Split (".") [0];
                }
                return spk_Prefix;
            }
        }
        string spk_Suffix;
        /// <summary>
        /// A协议功能的特性
        /// 如:是AC功能:特性:on_off,mode,fan,temperature
        /// attri
        /// </summary>
        public List<FunctionAttributes> attributes = new List<FunctionAttributes> ();
        /// <summary>
        /// 房间ID列表
        /// 该功能添加到到房间列表
        /// </summary>
        public List<string> roomIds = new List<string> ();
        /// <summary>
        /// bus协议数据格式
        /// 使用A协议控制时,改属性为空
        /// </summary>
        public BusData bus;
        /// <summary>
        /// 是否收藏
        /// </summary>
        public bool collect = false;
        /// <summary>
        /// 是否在线
        /// </summary>
        public bool online = true;
        /// <summary>
        /// 云端数据创建的时间
        /// </summary>
        public string createTime = "";
        /// <summary>
        /// 云端数据修改的最后时间
        /// </summary>
        public string modifyTime = "";
        /// <summary>
        /// 删除标记
        /// 需要删除数据时,标记为:true
        /// 由云端删除成功之后,返回数据再清除本地数据
        /// </summary>
        public bool DeleteSign = false;
        #endregion
        /// <summary>
        /// 延时
        /// </summary>
        public int delay = 0;
        /// <summary>
        /// 最后控制的一次状态
        /// </summary>
        [Newtonsoft.Json.JsonIgnore]
        public string lastState = "";
        FunctionAttributes _trait_on_off;
        [Newtonsoft.Json.JsonIgnore]
        public FunctionAttributes trait_on_off {
            get {
                if (_trait_on_off == null) {
                    _trait_on_off = attributes.Find ((obj) => obj.key == FunctionAttributeKey.OnOff);
                    //找不到属性需要声明一个,防止报错闪退
                    if (_trait_on_off == null) {
                        _trait_on_off = new FunctionAttributes () {
                            key = "on_off",
                            value = new List<string> { "on", "off" },
                            max = 1,
                            min = 0,
                        };
                        _trait_on_off.curValue = "off";
                    }
                }
                if (_trait_on_off.curValue.ToString () != "on" && _trait_on_off.curValue.ToString () != "off") {
                    _trait_on_off.curValue = "off";
                }
                return _trait_on_off;
            }
            //set
            //{
            //    _trait_on_off = value;
            //}
        }
        /// <summary>
        /// 使用次数
        /// </summary>
        public double controlCounter = 0;
        /// <summary>
        /// 使用频率
        /// </summary>
        public double usageFrequency {
            get {
                return controlCounter / 7;
            }
        }
        /// <summary>
        /// 固定的序号
        /// </summary>
        public int fixedSerialNumber = int.MaxValue;
    }
    /// <summary>
    /// 功能属性
    /// 属性字段解析:attri :属性内容,value 属性的值,max 最大值 min 最小值
    /// </summary>
    [System.Serializable]
    public class FunctionAttributes
    {
        /// <summary>
        /// 属性键名
        /// </summary>
        public string key;
        /// <summary>
        /// 属性的值列表
        /// </summary>
        public List<string> value = new List<string> ();
        /// <summary>
        /// 最大值
        /// </summary>
        public int max = 100;
        /// <summary>
        /// 最小值
        /// </summary>
        public int min = 0;
        /// <summary>
        /// 数据类型
        /// </summary>
        public string data_type = "";
        /// <summary>
        /// 当前值
        /// </summary>
        public object curValue = new object ();
    }
    /// <summary>
    /// 功能属性键名列表
    /// </summary>
    public static class FunctionAttributeKey
    {
        /// <summary>
        /// 开关
        /// </summary>
        public const string OnOff = "on_off";
        /// <summary>
        /// 亮度
        /// </summary>
        public const string Brightness = "brightness";
        /// <summary>
        /// 颜色
        /// </summary>
        public const string RGB = "rgb";
        /// <summary>
        /// 渐变时间
        /// </summary>
        public const string FadeTime = "fade_time";
        /// <summary>
        /// 模式
        /// </summary>
        public const string Mode = "mode";
        /// <summary>
        /// 风速
        /// </summary>
        public const string FanSpeed = "fan";
        /// <summary>
        /// 设置温度
        /// </summary>
        public const string SetTemp = "set_temp";
        /// <summary>
        /// 延时
        /// </summary>
        public const string Delay = "delay";
        /// <summary>
        /// 色温
        /// </summary>
        public const string CCT = "cct";
        /// <summary>
        /// 百分比
        /// </summary>
        public const string Percent = "percent";
        /// <summary>
        /// 室内温度
        /// </summary>
        public const string IndoorTemp = "room_temp";
        /// <summary>
        /// value
        /// </summary>
        public const string Value = "value";
    }
    /// <summary>
    /// 兼容旧协议控制
    /// </summary>
    public class BusData
    {
        public string addresses = "FFFF";
        [Newtonsoft.Json.JsonIgnore]
        public byte SubnetID {
            get {
                return Convert.ToByte (addresses.Substring (0, 2), 16);
            }
        }
        [Newtonsoft.Json.JsonIgnore]
        public byte DeviceID {
            get {
                return Convert.ToByte (addresses.Substring (2, 2), 16);
            }
        }
        public byte LoopId {
            get {
                return Convert.ToByte (loopId, 16);
            }
        }
        public string loopId;
    }
    public static class SPK
    {
        /// <summary>
        /// (开关灯)
        /// </summary>
        public const string LightSwitch = "light.switch";
        /// <summary>
        /// (调光灯)
        /// </summary>
        public const string LightDimming = "light.dimming";
        /// <summary>
        /// (RGB灯)
        /// </summary>
        public const string LightRGB = "light.rgb";
        /// <summary>
        /// (RGBW灯)
        /// </summary>
        public const string LightRGBW = "light.rgbw";
        /// <summary>
        /// (CCT灯)
        /// </summary>
        public const string LightCCT = "light.cct";
        /// <summary>
        /// (开关窗帘)
        /// </summary>
        public const string CurtainSwitch = "curtain.switch";
        /// <summary>
        /// (开合帘)
        /// </summary>
        public const string CurtainTrietex = "curtain.trietex";
        /// <summary>
        /// (百叶帘)
        /// </summary>
        public const string CurtainShades = "curtain.shades";
        /// <summary>
        /// (卷帘)
        /// </summary>
        public const string CurtainRoller = "curtain.roller";
        /// <summary>
        /// (空调)
        /// </summary>
        public const string AcStandard = "ac.standard";
        /// <summary>
        /// (地热)
        /// </summary>
        public const string FloorHeatStandard = "floorHeat.standard";
        /// <summary>
        /// (新风)
        /// </summary>
        public const string AirFreshStandard = "airFresh.standard";
        /// <summary>
        /// (音乐)
        /// </summary>
        public const string MusicStandard = "music.standard";
        /// <summary>
        /// (亮度传感器)
        /// </summary>
        public const string SensorLight = "sensor.light";
        /// <summary>
        /// (温度传感器)
        /// </summary>
        public const string SensorTemperature = "sensor.temperature";
        /// <summary>
        /// (红外移动传感器)
        /// </summary>
        public const string SensorPir = "sensor.pir";
        /// <summary>
        /// (门窗传感器)
        /// </summary>
        public const string SensorDoorWindow = "sensor.doorwindow";
        /// <summary>
        /// (PM2.5传感器)
        /// </summary>
        public const string SensorPm25 = "sensor.pm25";
        /// <summary>
        /// co2传感器
        /// </summary>
        public const string SensorCO2 = "sensor.co2";
        /// <summary>
        /// tvoc传感器
        /// </summary>
        public const string SensorTVOC = "sensor.tvoc";
        /// <summary>
        /// 湿度传感器
        /// </summary>
        public const string SensorHumidity = "sensor.humidity";
        /// <summary>
        /// (干接点)
        /// </summary>
        public const string DryContact = "dryContact.standard";
        /// <summary>
        /// 家电、插座
        /// </summary>
        public const string ElectricSocket = "electrical.socket";
        /// <summary>
        /// 家电、电视
        /// </summary>
        public const string ElectricTV = "electrical.tv";
        /// <summary>
        /// 家电、风扇
        /// </summary>
        public const string ElectricFan = "electrical.fan";
    }
    /// <summary>
    /// 功能类别
    /// </summary>
    public static class FunctionCategory
    {
        /// <summary>
        ///(灯)
        /// </summary>
        public const string Light = "light";
        /// <summary>
        /// (窗帘)
        /// </summary>
        public const string Curtain = "curtain";
        /// <summary>
        /// (空调)
        /// </summary>
        public const string AC = "ac";
        /// <summary>
        /// (地热)
        /// </summary>
        public const string FloorHeat = "floorHeat";
        /// <summary>
        /// (新风)
        /// </summary>
        public const string AirFresh = "airFresh";
        /// <summary>
        /// (音乐)
        /// </summary>
        public const string Music = "music";
        /// <summary>
        /// (传感器)
        /// </summary>
        public const string Sensor = "sensor";
        /// <summary>
        /// (干接点)
        /// </summary>
        public const string DryContact = "dryContact";
        /// <summary>
        /// 家电
        /// </summary>
        public const string Electric = "electrical";
        //Music = 0x09,
    }
    ///// <summary>
    ///// 上传Oid列表
    ///// </summary>
Crabtree/SmartHome/HDL/Common/HttpUtil/HttpServerRequest.cs
@@ -853,6 +853,46 @@
        #endregion
        #region * 上传设备列表___________________________
        /// <summary>
        ///
        /// </summary>
        /// <param name="mOids"></param>
        /// <returns></returns>
        public ResponsePackNew UploadDeviceOidList (Oids mOids)
        {
            var requestJson = HttpUtil.GetSignRequestJson (mOids);
            return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_Device_Oid_Add, requestJson);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mOids"></param>
        /// <returns></returns>
        public ResponsePackNew UploadDeviceSidList (Sids mSids)
        {
            var requestJson = HttpUtil.GetSignRequestJson (mSids);
            return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_Device_Sid_Add, requestJson);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="mOids"></param>
        /// <returns></returns>
        public ResponsePackNew GetDeviceList ()
        {
            var requestJson = HttpUtil.GetSignRequestJson (new HomeIdObj {
                homeId = UserConfig.Instance.CurrentRegion.Id,
            });
            return HttpUtil.RequestHttpsPostFroHome (NewAPI.Api_Post_GetDevcieList, requestJson);
        }
        #endregion
        //#region Kaede --设备功能——————————————————————————————————
        ///// <summary>
        ///// 获取设备列表
@@ -1164,7 +1204,7 @@
        //    d.Add("pageSize", "1000");
        //    var requestJson = HttpUtil.GetSignRequestJson(d);
        //    var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson);
        //    return pack;
        //}
        ///// <summary>
Crabtree/SmartHome/HDL/Common/HttpUtil/NewAPI.cs
@@ -463,6 +463,16 @@
        public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable";
        #endregion
        #region 上传设备列表 oid sid
        /// <summary>
        /// 子设备基本信息(oid)全量添加
        /// </summary>
        public const string API_POST_Device_Oid_Add = "/home-wisdom/program/device/oid/add";
        /// <summary>
        /// 设备(功能)全量更新
        /// </summary>
        public const string API_POST_Device_Sid_Add = "/home-wisdom/program/device/add";
        #endregion
        #endregion
Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/HelpView.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Shared.SimpleControl.Phone.Music;
using SmartHome;
namespace Shared.SimpleControl.Phone
{
@@ -139,6 +140,13 @@
            };
            msgView.AddChidren (btnMail2);
            btnMail2.MouseUpEventHandler += (e, e2) => {
#if DEBUG
                GetDeviceList ();
#endif
            };
            var btnFAQ = new Button () { 
                Height = Application.GetRealHeight(100),
                Y = msgView.Bottom + Application.GetRealHeight(20),
@@ -150,6 +158,15 @@
            };
            AddChidren (btnFAQ);
            btnFAQ.MouseUpEventHandler += (e,e2) =>{
#if DEBUG
                upload ();
#endif
            };
   
            var btnLine = new Button () { 
@@ -160,5 +177,65 @@
            AddChidren (btnLine);
        }
        /// <summary>
        ///
        /// </summary>
        void upload ()
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
                try {
                    var RES = HDLLinkUtlis.Current.UploadOidAndSidList ();
                    Application.RunOnMainThread (() => {
                        if (RES) {
                            Utlis.ShowTip ("上传成功");
                        } else {
                            Utlis.ShowTip ("上传失败");
                        }
                    });
                } catch {
                    MainPage.FailureToServer ();
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                    });
                }
            });
        }
        /// <summary>
        ///
        /// </summary>
        void GetDeviceList ()
        {
            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
            System.Threading.Tasks.Task.Run (() => {
                try {
                    var deviceResult = HttpServerRequest.Current.GetDeviceList ();
                    if (deviceResult.Code == StateCode.SUCCESS) {
                        var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieFunctionRes> (deviceResult.Data.ToString ());
                        Utlis.WriteLine ("deviceList Count" + deviceList.list.Count);
                    } else {
                        Utlis.ShowTip ("设备列表");
                    }
                    //Application.RunOnMainThread (() => {
                    //});
                } catch {
                    MainPage.FailureToServer ();
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                    });
                }
            });
        }
    }
}