CrabtreeOn,印度客户定制APP,迁移2.0平台版本
JLChen
2021-02-05 ce692e704b6342680f4ded9538471c119a412e53
Crabtree/SmartHome/HDL/Common/HDLLinkUtlis.cs
@@ -579,7 +579,7 @@
                tmp.oid = sOid;
                tmp.sid = sSid;
                tmp.name = loopCommon.Name;
                tmp.attributes = new List<FunctionSid> ();
                tmp.attributes = new List<Attribute> ();
                tmp.omodel = loopCommon.Type.ToString ();
                //继电器开关类
                if (loopCommon.Type == DeviceType.LightSwitch
@@ -589,15 +589,15 @@
                    || loopCommon.Type == DeviceType.LightMixSwitch) {
                    tmp.spk = "light.switch";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                } else if (loopCommon.Type == DeviceType.LightDimming
                    || loopCommon.Type == DeviceType.LightCCT
@@ -605,56 +605,56 @@
                    //调光类
                    tmp.spk = "light.dimming";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    #region brightness
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "brightness";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
                    Attribute tempAttribute1 = new Attribute ();
                    tempAttribute1.key = "brightness";
                    tempAttribute1.data_type = "integer";
                    tempAttribute1.value = new List<string> ();
                    tempFunction1.max = 100;
                    tempFunction1.min = 0;
                    tmp.attributes.Add (tempFunction1);
                    tempAttribute1.max = 100;
                    tempAttribute1.min = 0;
                    tmp.attributes.Add (tempAttribute1);
                    #endregion
                    #region fade_time
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "fade_time";
                    tempFunction3.data_type = "integer";
                    tempFunction3.value = new List<string> ();
                    //tempFunction1.value.Add("percent");
                    Attribute tempAttribute3 = new Attribute ();
                    tempAttribute3.key = "fade_time";
                    tempAttribute3.data_type = "integer";
                    tempAttribute3.value = new List<string> ();
                    //tempAttribute1.value.Add("percent");
                    //for (int iPercent = 0; iPercent <= 100; iPercent++)
                    //{
                    //    tempFunction1.value.Add(iPercent.ToString());
                    //    tempAttribute1.value.Add(iPercent.ToString());
                    //}
                    tempFunction3.max = 100;
                    tempFunction3.min = 0;
                    tmp.attributes.Add (tempFunction3);
                    tempAttribute3.max = 100;
                    tempAttribute3.min = 0;
                    tmp.attributes.Add (tempAttribute3);
                    #endregion
                    if (loopCommon.Type == DeviceType.LightCCT || loopCommon.Type == DeviceType.LightDALI)//色温类别
                    {
                        tmp.spk = "light.cct";
                        #region cct
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "cct";
                        tempFunction2.data_type = "integer";
                        tempFunction2.value = new List<string> ();
                        //tempFunction2.value.Add("warm light ");
                        //tempFunction2.value.Add("cold light ");
                        tempFunction2.max = 65535;
                        tempFunction2.min = 0;
                        tmp.attributes.Add (tempFunction2);
                        Attribute tempAttribute2 = new Attribute ();
                        tempAttribute2.key = "cct";
                        tempAttribute2.data_type = "integer";
                        tempAttribute2.value = new List<string> ();
                        //tempAttribute2.value.Add("warm light ");
                        //tempAttribute2.value.Add("cold light ");
                        tempAttribute2.max = 65535;
                        tempAttribute2.min = 0;
                        tmp.attributes.Add (tempAttribute2);
                        #endregion
                    }
                } else if (loopCommon.Type == DeviceType.LightRGB
@@ -665,25 +665,25 @@
                    tmp.spk = "light.rgb";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    #region brightness
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "brightness";
                    tempFunction2.data_type = "integer";
                    tempFunction2.value = new List<string> ();
                    tempFunction2.max = 100;
                    tempFunction2.min = 0;
                    tmp.attributes.Add (tempFunction2);
                    Attribute tempAttribute2 = new Attribute ();
                    tempAttribute2.key = "brightness";
                    tempAttribute2.data_type = "integer";
                    tempAttribute2.value = new List<string> ();
                    tempAttribute2.max = 100;
                    tempAttribute2.min = 0;
                    tmp.attributes.Add (tempAttribute2);
                    #endregion
@@ -691,70 +691,70 @@
                    if (loopCommon.Type == DeviceType.LightRGBW) {
                        tmp.spk = "light.rgbw";
                        #region color
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "rgb";
                        tempFunction3.data_type = "integer";
                        tempFunction3.value = new List<string> ();
                        //tempFunction2.value.Add("red");
                        //tempFunction2.value.Add("green");
                        //tempFunction2.value.Add("blue");
                        tempFunction3.max = 255;
                        tempFunction3.min = 0;
                        tmp.attributes.Add (tempFunction3);
                        Attribute tempAttribute3 = new Attribute ();
                        tempAttribute3.key = "rgb";
                        tempAttribute3.data_type = "integer";
                        tempAttribute3.value = new List<string> ();
                        //tempAttribute2.value.Add("red");
                        //tempAttribute2.value.Add("green");
                        //tempAttribute2.value.Add("blue");
                        tempAttribute3.max = 255;
                        tempAttribute3.min = 0;
                        tmp.attributes.Add (tempAttribute3);
                        #endregion
                    } else {
                        #region color
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "rgb";
                        tempFunction3.data_type = "integer";
                        tempFunction3.value = new List<string> ();
                        tempFunction3.min = 0;
                        tmp.attributes.Add (tempFunction3);
                        Attribute tempAttribute3 = new Attribute ();
                        tempAttribute3.key = "rgb";
                        tempAttribute3.data_type = "integer";
                        tempAttribute3.value = new List<string> ();
                        tempAttribute3.min = 0;
                        tmp.attributes.Add (tempAttribute3);
                        #endregion
                    }
                    if (loopCommon.Type == DeviceType.LightRGBandCCT) {
                        #region CCT
                        FunctionSid tempFunctionCCT = new FunctionSid ();
                        tempFunctionCCT.key = "cct";
                        tempFunctionCCT.data_type = "integer";
                        tempFunctionCCT.value = new List<string> ();
                        //tempFunction2.value.Add("red");
                        //tempFunction2.value.Add("green");
                        //tempFunction2.value.Add("blue");
                        tempFunctionCCT.max = 65535;
                        tempFunctionCCT.min = 0;
                        tmp.attributes.Add (tempFunctionCCT);
                        Attribute tempAttributeCCT = new Attribute ();
                        tempAttributeCCT.key = "cct";
                        tempAttributeCCT.data_type = "integer";
                        tempAttributeCCT.value = new List<string> ();
                        //tempAttribute2.value.Add("red");
                        //tempAttribute2.value.Add("green");
                        //tempAttribute2.value.Add("blue");
                        tempAttributeCCT.max = 65535;
                        tempAttributeCCT.min = 0;
                        tmp.attributes.Add (tempAttributeCCT);
                        #endregion
                    }
                } else if (loopCommon.Type == DeviceType.CurtainModel || loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex) {
                    tmp.spk = "curtain.switch";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.value.Add ("stop");
                    tempFunction.max = 2;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.value.Add ("stop");
                    tempAttribute.max = 2;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    if (loopCommon.Type == DeviceType.CurtainRoller || loopCommon.Type == DeviceType.CurtainTrietex)//所有卷帘控制器 
                    {
                        tmp.spk = "curtain.trietex";
                        #region openlevel
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "percent";
                        tempFunction1.data_type = "integer";
                        tempFunction1.value = new List<string> ();
                        //tempFunction1.value.Add("percent");
                        tempFunction1.max = 100;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "percent";
                        tempAttribute1.data_type = "integer";
                        tempAttribute1.value = new List<string> ();
                        //tempAttribute1.value.Add("percent");
                        tempAttribute1.max = 100;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    }
                } else if (loopCommon.Type == DeviceType.ACPanel
@@ -767,101 +767,101 @@
                    //空调类
                    tmp.spk = "ac.standard";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    #region mode
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "mode";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
                    tempFunction1.value.Add ("cool");
                    tempFunction1.value.Add ("heat");
                    tempFunction1.value.Add ("fan");
                    tempFunction1.value.Add ("auto");
                    tempFunction1.value.Add ("dry");
                    Attribute tempAttribute1 = new Attribute ();
                    tempAttribute1.key = "mode";
                    tempAttribute1.data_type = "integer";
                    tempAttribute1.value = new List<string> ();
                    tempAttribute1.value.Add ("cool");
                    tempAttribute1.value.Add ("heat");
                    tempAttribute1.value.Add ("fan");
                    tempAttribute1.value.Add ("auto");
                    tempAttribute1.value.Add ("dry");
                    tempFunction1.max = 4;
                    tempFunction1.min = 0;
                    tmp.attributes.Add (tempFunction1);
                    tempAttribute1.max = 4;
                    tempAttribute1.min = 0;
                    tmp.attributes.Add (tempAttribute1);
                    #endregion
                    #region fan
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "fan";
                    tempFunction2.data_type = "integer";
                    tempFunction2.value = new List<string> ();
                    tempFunction2.value.Add ("high");
                    tempFunction2.value.Add ("medium");
                    tempFunction2.value.Add ("low");
                    tempFunction2.value.Add ("auto");
                    tempFunction2.max = 3;
                    tempFunction2.min = 0;
                    tmp.attributes.Add (tempFunction2);
                    Attribute tempAttribute2 = new Attribute ();
                    tempAttribute2.key = "fan";
                    tempAttribute2.data_type = "integer";
                    tempAttribute2.value = new List<string> ();
                    tempAttribute2.value.Add ("high");
                    tempAttribute2.value.Add ("medium");
                    tempAttribute2.value.Add ("low");
                    tempAttribute2.value.Add ("auto");
                    tempAttribute2.max = 3;
                    tempAttribute2.min = 0;
                    tmp.attributes.Add (tempAttribute2);
                    #endregion
                    #region temp
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "set_temp";
                    Attribute tempAttribute3 = new Attribute ();
                    tempAttribute3.key = "set_temp";
                    //2020 08 11  hvac 温度控制 1°-> int 0.5°->float
                    //if (HVACModuleDeviceTypeList.HDLHVACwithAcControlHighPrecision.Contains(DevOnLineTmp.DeviceType))
                    //{
                    //20201224 设置温度数据类型统一float 伟南后续ai+数据类型网关处理
                    tempFunction3.data_type = "float";
                    tempAttribute3.data_type = "float";
                    //}
                    //else
                    //{
                    //    tempFunction3.data_type = "integer";
                    //    tempAttribute3.data_type = "integer";
                    //}
                    tempFunction3.value = new List<string> ();
                    tempFunction3.max = 30;
                    tempFunction3.min = 16;
                    tmp.attributes.Add (tempFunction3);
                    tempAttribute3.value = new List<string> ();
                    tempAttribute3.max = 30;
                    tempAttribute3.min = 16;
                    tmp.attributes.Add (tempAttribute3);
                    #endregion
                    #region temp_step
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "set_temp_step";
                    tempFunction5.data_type = "string";
                    tempFunction5.value = new List<string> ();
                    tempFunction5.value.Add ("up");
                    tempFunction5.value.Add ("down");
                    tempFunction5.max = 1;
                    tempFunction5.min = 0;
                    tmp.attributes.Add (tempFunction5);
                    Attribute tempAttribute5 = new Attribute ();
                    tempAttribute5.key = "set_temp_step";
                    tempAttribute5.data_type = "string";
                    tempAttribute5.value = new List<string> ();
                    tempAttribute5.value.Add ("up");
                    tempAttribute5.value.Add ("down");
                    tempAttribute5.max = 1;
                    tempAttribute5.min = 0;
                    tmp.attributes.Add (tempAttribute5);
                    #endregion
                    #region room_temp
                    FunctionSid tempFunction6 = new FunctionSid ();
                    tempFunction6.key = "room_temp";
                    tempFunction6.data_type = "float";
                    tempFunction6.value = new List<string> ();
                    tempFunction6.max = 50;
                    tempFunction6.min = -50;
                    tmp.attributes.Add (tempFunction6);
                    Attribute tempAttribute6 = new Attribute ();
                    tempAttribute6.key = "room_temp";
                    tempAttribute6.data_type = "float";
                    tempAttribute6.value = new List<string> ();
                    tempAttribute6.max = 50;
                    tempAttribute6.min = -50;
                    tmp.attributes.Add (tempAttribute6);
                    #endregion
                    #region swing
                    FunctionSid tempFunction4 = new FunctionSid ();
                    tempFunction4.key = "swing";
                    tempFunction4.data_type = "string";
                    tempFunction4.value = new List<string> ();
                    tempFunction4.value.Add ("up_down");
                    //tempFunction4.value.Add("down");
                    tempFunction4.value.Add ("left_right");
                    //tempFunction4.value.Add("right");
                    tempFunction4.value.Add ("stop");
                    tempFunction4.max = 3;
                    tempFunction4.min = 0;
                    tmp.attributes.Add (tempFunction4);
                    Attribute tempAttribute4 = new Attribute ();
                    tempAttribute4.key = "swing";
                    tempAttribute4.data_type = "string";
                    tempAttribute4.value = new List<string> ();
                    tempAttribute4.value.Add ("up_down");
                    //tempAttribute4.value.Add("down");
                    tempAttribute4.value.Add ("left_right");
                    //tempAttribute4.value.Add("right");
                    tempAttribute4.value.Add ("stop");
                    tempAttribute4.max = 3;
                    tempAttribute4.min = 0;
                    tmp.attributes.Add (tempAttribute4);
                    #endregion
                    #region lock
@@ -872,65 +872,65 @@
                    || loopCommon.Type == DeviceType.FoolHeatPanel) {
                    tmp.spk = "floorHeat.standard";
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    #region mode
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "mode";
                    tempFunction1.data_type = "string";
                    tempFunction1.value = new List<string> ();
                    tempFunction1.value.Add ("day");
                    tempFunction1.value.Add ("night");
                    tempFunction1.value.Add ("away");
                    tempFunction1.value.Add ("normal");
                    tempFunction1.value.Add ("timer");
                    tempFunction1.max = 4;
                    tempFunction1.min = 0;
                    tmp.attributes.Add (tempFunction1);
                    Attribute tempAttribute1 = new Attribute ();
                    tempAttribute1.key = "mode";
                    tempAttribute1.data_type = "string";
                    tempAttribute1.value = new List<string> ();
                    tempAttribute1.value.Add ("day");
                    tempAttribute1.value.Add ("night");
                    tempAttribute1.value.Add ("away");
                    tempAttribute1.value.Add ("normal");
                    tempAttribute1.value.Add ("timer");
                    tempAttribute1.max = 4;
                    tempAttribute1.min = 0;
                    tmp.attributes.Add (tempAttribute1);
                    #endregion
                    #region temp
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "set_temp";
                    tempFunction3.data_type = "float";
                    tempFunction3.value = new List<string> ();
                    //tempFunction3.value.Add("up");
                    //tempFunction3.value.Add("down");
                    //tempFunction3.value.Add("value");
                    tempFunction3.max = 35;
                    tempFunction3.min = 0;
                    tmp.attributes.Add (tempFunction3);
                    Attribute tempAttribute3 = new Attribute ();
                    tempAttribute3.key = "set_temp";
                    tempAttribute3.data_type = "float";
                    tempAttribute3.value = new List<string> ();
                    //tempAttribute3.value.Add("up");
                    //tempAttribute3.value.Add("down");
                    //tempAttribute3.value.Add("value");
                    tempAttribute3.max = 35;
                    tempAttribute3.min = 0;
                    tmp.attributes.Add (tempAttribute3);
                    #endregion
                    #region temp
                    FunctionSid tempFunction4 = new FunctionSid ();
                    tempFunction4.key = "set_temp_step";
                    tempFunction4.data_type = "string";
                    tempFunction4.value = new List<string> ();
                    tempFunction4.value.Add ("up");
                    tempFunction4.value.Add ("down");
                    tempFunction4.max = 1;
                    tempFunction4.min = 0;
                    tmp.attributes.Add (tempFunction4);
                    Attribute tempAttribute4 = new Attribute ();
                    tempAttribute4.key = "set_temp_step";
                    tempAttribute4.data_type = "string";
                    tempAttribute4.value = new List<string> ();
                    tempAttribute4.value.Add ("up");
                    tempAttribute4.value.Add ("down");
                    tempAttribute4.max = 1;
                    tempAttribute4.min = 0;
                    tmp.attributes.Add (tempAttribute4);
                    #endregion
                    #region room_temp
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "room_temp";
                    tempFunction5.data_type = "float";
                    tempFunction5.value = new List<string> ();
                    tempFunction5.max = 50;
                    tempFunction5.min = -50;
                    tmp.attributes.Add (tempFunction5);
                    Attribute tempAttribute5 = new Attribute ();
                    tempAttribute5.key = "room_temp";
                    tempAttribute5.data_type = "float";
                    tempAttribute5.value = new List<string> ();
                    tempAttribute5.max = 50;
                    tempAttribute5.min = -50;
                    tmp.attributes.Add (tempAttribute5);
                    #endregion
                    #region lock
@@ -943,455 +943,455 @@
                    tmp.spk = "music.standard";
                    // on_off  volume song_step  audio  list_channel  mode  song_num  special_song  volume_level
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("play");
                    tempFunction.value.Add ("pause");
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("play");
                    tempAttribute.value.Add ("pause");
                    //tempFunction.value.Add("play");
                    //tempFunction.value.Add("stop");
                    //tempFunction.value.Add("pause");
                    //tempAttribute.value.Add("play");
                    //tempAttribute.value.Add("stop");
                    //tempAttribute.value.Add("pause");
                    //play stop pause
                    tempFunction.max = 2;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    tempAttribute.max = 2;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                    #region volume
                    FunctionSid tempFunction1 = new FunctionSid ();
                    tempFunction1.key = "volume";
                    tempFunction1.data_type = "integer";
                    tempFunction1.value = new List<string> ();
                    //tempFunction1.value.Add("percent");
                    tempFunction1.max = 100;
                    tempFunction1.min = 0;
                    tmp.attributes.Add (tempFunction1);
                    Attribute tempAttribute1 = new Attribute ();
                    tempAttribute1.key = "volume";
                    tempAttribute1.data_type = "integer";
                    tempAttribute1.value = new List<string> ();
                    //tempAttribute1.value.Add("percent");
                    tempAttribute1.max = 100;
                    tempAttribute1.min = 0;
                    tmp.attributes.Add (tempAttribute1);
                    #endregion
                    #region volume_step
                    FunctionSid tempFunction9 = new FunctionSid ();
                    tempFunction9.key = "volume_step";
                    tempFunction9.data_type = "string";
                    tempFunction9.value = new List<string> ();
                    tempFunction9.value.Add ("up");
                    tempFunction9.value.Add ("down");
                    tempFunction9.max = 1;
                    tempFunction9.min = 0;
                    tmp.attributes.Add (tempFunction9);
                    Attribute tempAttribute9 = new Attribute ();
                    tempAttribute9.key = "volume_step";
                    tempAttribute9.data_type = "string";
                    tempAttribute9.value = new List<string> ();
                    tempAttribute9.value.Add ("up");
                    tempAttribute9.value.Add ("down");
                    tempAttribute9.max = 1;
                    tempAttribute9.min = 0;
                    tmp.attributes.Add (tempAttribute9);
                    #endregion
                    #region volume_level
                    FunctionSid tempFunction10 = new FunctionSid ();
                    tempFunction10.key = "volume_level";
                    tempFunction10.data_type = "integer";
                    tempFunction10.value = new List<string> ();
                    //tempFunction1.value.Add("percent");
                    tempFunction10.max = 10;
                    tempFunction10.min = 0;
                    tmp.attributes.Add (tempFunction10);
                    Attribute tempAttribute10 = new Attribute ();
                    tempAttribute10.key = "volume_level";
                    tempAttribute10.data_type = "integer";
                    tempAttribute10.value = new List<string> ();
                    //tempAttribute1.value.Add("percent");
                    tempAttribute10.max = 10;
                    tempAttribute10.min = 0;
                    tmp.attributes.Add (tempAttribute10);
                    #endregion
                    #region volume_level_step
                    FunctionSid tempFunction11 = new FunctionSid ();
                    tempFunction11.key = "volume_level_step";
                    tempFunction11.data_type = "string";
                    tempFunction11.value = new List<string> ();
                    tempFunction11.value.Add ("up");
                    tempFunction11.value.Add ("down");
                    tempFunction11.max = 1;
                    tempFunction11.min = 0;
                    tmp.attributes.Add (tempFunction11);
                    Attribute tempAttribute11 = new Attribute ();
                    tempAttribute11.key = "volume_level_step";
                    tempAttribute11.data_type = "string";
                    tempAttribute11.value = new List<string> ();
                    tempAttribute11.value.Add ("up");
                    tempAttribute11.value.Add ("down");
                    tempAttribute11.max = 1;
                    tempAttribute11.min = 0;
                    tmp.attributes.Add (tempAttribute11);
                    #endregion
                    #region treble
                    FunctionSid tempFunction14 = new FunctionSid ();
                    tempFunction14.key = "treble";
                    tempFunction14.data_type = "integer";
                    tempFunction14.max = 10;
                    tempFunction14.min = -10;
                    tmp.attributes.Add (tempFunction14);
                    Attribute tempAttribute14 = new Attribute ();
                    tempAttribute14.key = "treble";
                    tempAttribute14.data_type = "integer";
                    tempAttribute14.max = 10;
                    tempAttribute14.min = -10;
                    tmp.attributes.Add (tempAttribute14);
                    #endregion
                    #region treble_step
                    FunctionSid tempFunction12 = new FunctionSid ();
                    tempFunction12.key = "treble_step";
                    tempFunction12.data_type = "string";
                    tempFunction12.value = new List<string> ();
                    tempFunction12.value.Add ("up");
                    tempFunction12.value.Add ("down");
                    tempFunction12.max = 1;
                    tempFunction12.min = 0;
                    tmp.attributes.Add (tempFunction12);
                    Attribute tempAttribute12 = new Attribute ();
                    tempAttribute12.key = "treble_step";
                    tempAttribute12.data_type = "string";
                    tempAttribute12.value = new List<string> ();
                    tempAttribute12.value.Add ("up");
                    tempAttribute12.value.Add ("down");
                    tempAttribute12.max = 1;
                    tempAttribute12.min = 0;
                    tmp.attributes.Add (tempAttribute12);
                    #endregion
                    #region bass
                    FunctionSid tempFunction15 = new FunctionSid ();
                    tempFunction15.key = "bass";
                    tempFunction15.data_type = "integer";
                    tempFunction15.max = 10;
                    tempFunction15.min = -10;
                    tmp.attributes.Add (tempFunction15);
                    Attribute tempAttribute15 = new Attribute ();
                    tempAttribute15.key = "bass";
                    tempAttribute15.data_type = "integer";
                    tempAttribute15.max = 10;
                    tempAttribute15.min = -10;
                    tmp.attributes.Add (tempAttribute15);
                    #endregion
                    #region bass_step
                    FunctionSid tempFunction13 = new FunctionSid ();
                    tempFunction13.key = "bass_step";
                    tempFunction13.data_type = "string";
                    tempFunction13.value = new List<string> ();
                    tempFunction13.value.Add ("up");
                    tempFunction13.value.Add ("down");
                    tempFunction13.max = 1;
                    tempFunction13.min = 0;
                    tmp.attributes.Add (tempFunction13);
                    Attribute tempAttribute13 = new Attribute ();
                    tempAttribute13.key = "bass_step";
                    tempAttribute13.data_type = "string";
                    tempAttribute13.value = new List<string> ();
                    tempAttribute13.value.Add ("up");
                    tempAttribute13.value.Add ("down");
                    tempAttribute13.max = 1;
                    tempAttribute13.min = 0;
                    tmp.attributes.Add (tempAttribute13);
                    #endregion
                    #region mode
                    FunctionSid tempFunction5 = new FunctionSid ();
                    tempFunction5.key = "mode";
                    tempFunction5.data_type = "string";
                    tempFunction5.value = new List<string> ();
                    Attribute tempAttribute5 = new Attribute ();
                    tempAttribute5.key = "mode";
                    tempAttribute5.data_type = "string";
                    tempAttribute5.value = new List<string> ();
                    //singel/single_circle/order/all
                    //single/single_cycle/order/list_cycle/random
                    tempFunction5.value.Add ("single");
                    tempFunction5.value.Add ("single_cycle");
                    tempFunction5.value.Add ("order");
                    tempFunction5.value.Add ("list_cycle");
                    tempFunction5.value.Add ("random");
                    tempFunction5.max = 3;
                    tempFunction5.min = 0;
                    tmp.attributes.Add (tempFunction5);
                    tempAttribute5.value.Add ("single");
                    tempAttribute5.value.Add ("single_cycle");
                    tempAttribute5.value.Add ("order");
                    tempAttribute5.value.Add ("list_cycle");
                    tempAttribute5.value.Add ("random");
                    tempAttribute5.max = 3;
                    tempAttribute5.min = 0;
                    tmp.attributes.Add (tempAttribute5);
                    #endregion
                    #region source
                    //1   = SD, 2 = External Input, 3 = FTP, 4 = Radio
                    //sdcard/external_input/ftp/radio
                    FunctionSid tempFunction3 = new FunctionSid ();
                    tempFunction3.key = "source";
                    tempFunction3.data_type = "string";
                    tempFunction3.value = new List<string> ();
                    tempFunction3.value.Add ("sdcard");
                    tempFunction3.value.Add ("audio_in");
                    tempFunction3.value.Add ("ftp");
                    tempFunction3.value.Add ("radio");
                    tempFunction3.value.Add ("bluetooth");
                    tempFunction3.max = 3;
                    tempFunction3.min = 0;
                    tmp.attributes.Add (tempFunction3);
                    Attribute tempAttribute3 = new Attribute ();
                    tempAttribute3.key = "source";
                    tempAttribute3.data_type = "string";
                    tempAttribute3.value = new List<string> ();
                    tempAttribute3.value.Add ("sdcard");
                    tempAttribute3.value.Add ("audio_in");
                    tempAttribute3.value.Add ("ftp");
                    tempAttribute3.value.Add ("radio");
                    tempAttribute3.value.Add ("bluetooth");
                    tempAttribute3.max = 3;
                    tempAttribute3.min = 0;
                    tmp.attributes.Add (tempAttribute3);
                    #endregion
                    #region song_step
                    FunctionSid tempFunction2 = new FunctionSid ();
                    tempFunction2.key = "song_step";
                    tempFunction2.data_type = "string";
                    tempFunction2.value = new List<string> ();
                    tempFunction2.value.Add ("up");
                    tempFunction2.value.Add ("down");
                    tempFunction2.max = 1;
                    tempFunction2.min = 0;
                    tmp.attributes.Add (tempFunction2);
                    Attribute tempAttribute2 = new Attribute ();
                    tempAttribute2.key = "song_step";
                    tempAttribute2.data_type = "string";
                    tempAttribute2.value = new List<string> ();
                    tempAttribute2.value.Add ("up");
                    tempAttribute2.value.Add ("down");
                    tempAttribute2.max = 1;
                    tempAttribute2.min = 0;
                    tmp.attributes.Add (tempAttribute2);
                    #endregion
                    #region bass
                    FunctionSid tempFunction16 = new FunctionSid ();
                    tempFunction16.key = "playlist_name";
                    tempFunction16.data_type = "string";
                    tmp.attributes.Add (tempFunction16);
                    Attribute tempAttribute16 = new Attribute ();
                    tempAttribute16.key = "playlist_name";
                    tempAttribute16.data_type = "string";
                    tmp.attributes.Add (tempAttribute16);
                    #endregion
                    #region bass
                    FunctionSid tempFunction17 = new FunctionSid ();
                    tempFunction17.key = "song_name";
                    tempFunction17.data_type = "string";
                    tmp.attributes.Add (tempFunction17);
                    Attribute tempAttribute17 = new Attribute ();
                    tempAttribute17.key = "song_name";
                    tempAttribute17.data_type = "string";
                    tmp.attributes.Add (tempAttribute17);
                    #endregion
                    #region bass
                    FunctionSid tempFunction19 = new FunctionSid ();
                    tempFunction19.key = "song_time";
                    tempFunction19.data_type = "string";
                    tmp.attributes.Add (tempFunction19);
                    Attribute tempAttribute19 = new Attribute ();
                    tempAttribute19.key = "song_time";
                    tempAttribute19.data_type = "string";
                    tmp.attributes.Add (tempAttribute19);
                    #endregion
                    #region bass
                    FunctionSid tempFunction20 = new FunctionSid ();
                    tempFunction20.key = "playing_time";
                    tempFunction20.data_type = "string";
                    tmp.attributes.Add (tempFunction20);
                    Attribute tempAttribute20 = new Attribute ();
                    tempAttribute20.key = "playing_time";
                    tempAttribute20.data_type = "string";
                    tmp.attributes.Add (tempAttribute20);
                    #endregion
                } else if (loopCommon.BigClass == 5) {
                    //传感器
                    if (loopCommon.Type == DeviceType.SensorMobileDetection) {
                        tmp.spk = "sensor.pir";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region status
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "status";
                        tempFunction1.data_type = "string";
                        tempFunction1.value = new List<string> ();
                        tempFunction1.value.Add ("true");
                        tempFunction1.value.Add ("false");
                        tempFunction1.max = 1;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "status";
                        tempAttribute1.data_type = "string";
                        tempAttribute1.value = new List<string> ();
                        tempAttribute1.value.Add ("true");
                        tempAttribute1.value.Add ("false");
                        tempAttribute1.max = 1;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                        #region sensitivity
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "sensitivity";
                        tempFunction2.data_type = "integer";
                        tempFunction2.max = 100;
                        tempFunction2.min = 0;
                        tmp.attributes.Add (tempFunction2);
                        Attribute tempAttribute2 = new Attribute ();
                        tempAttribute2.key = "sensitivity";
                        tempAttribute2.data_type = "integer";
                        tempAttribute2.max = 100;
                        tempAttribute2.min = 0;
                        tmp.attributes.Add (tempAttribute2);
                        #endregion
                    }else if (loopCommon.Type == DeviceType.SensorTemperature) {
                        tmp.spk = "sensor.temperature";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region temp
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";  //2020 12 22
                        tempFunction1.data_type = "float";
                        tempFunction1.max = 50;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";  //2020 12 22
                        tempAttribute1.data_type = "float";
                        tempAttribute1.max = 50;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                        #region type
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "type";
                        tempFunction2.data_type = "string";
                        tempFunction2.value = new List<string> ();
                        tempFunction2.value.Add ("C");
                        tempFunction2.value.Add ("F");
                        tempFunction2.max = 1;
                        tempFunction2.min = 0;
                        tmp.attributes.Add (tempFunction2);
                        Attribute tempAttribute2 = new Attribute ();
                        tempAttribute2.key = "type";
                        tempAttribute2.data_type = "string";
                        tempAttribute2.value = new List<string> ();
                        tempAttribute2.value.Add ("C");
                        tempAttribute2.value.Add ("F");
                        tempAttribute2.max = 1;
                        tempAttribute2.min = 0;
                        tmp.attributes.Add (tempAttribute2);
                        #endregion
                        //#region precision
                        //Function tempFunction3 = new GateWay.Function();
                        //tempFunction3.key = "precision";
                        //tempFunction3.data_type = "string";
                        //tempFunction3.value = new List<string>();
                        //tempFunction3.value.Add("0.01");
                        //tempFunction3.value.Add("0.1");
                        //tempFunction3.value.Add("100");
                        //tempFunction3.max = 2;
                        //tempFunction3.min = 0;
                        //tmp.attributes.Add(tempFunction3);
                        //Function tempAttribute3 = new GateWay.Function();
                        //tempAttribute3.key = "precision";
                        //tempAttribute3.data_type = "string";
                        //tempAttribute3.value = new List<string>();
                        //tempAttribute3.value.Add("0.01");
                        //tempAttribute3.value.Add("0.1");
                        //tempAttribute3.value.Add("100");
                        //tempAttribute3.max = 2;
                        //tempAttribute3.min = 0;
                        //tmp.attributes.Add(tempAttribute3);
                        //#endregion
                    }else if (loopCommon.Type == DeviceType.SensorIllumination) {
                        tmp.spk = "sensor.light";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region lux
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";  //2020 12 22
                        tempFunction1.data_type = "integer";
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";  //2020 12 22
                        tempAttribute1.data_type = "integer";
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                        #region error_value
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "error_value";
                        tempFunction2.data_type = "integer";
                        tmp.attributes.Add (tempFunction2);
                        Attribute tempAttribute2 = new Attribute ();
                        tempAttribute2.key = "error_value";
                        tempAttribute2.data_type = "integer";
                        tmp.attributes.Add (tempAttribute2);
                        #endregion
                        #region precision
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "precision";
                        tempFunction3.data_type = "string";
                        tempFunction3.value = new List<string> ();
                        tempFunction3.value.Add ("0.01");
                        tempFunction3.value.Add ("0.1");
                        tempFunction3.value.Add ("100");
                        tempFunction3.max = 2;
                        tempFunction3.min = 0;
                        tmp.attributes.Add (tempFunction3);
                        Attribute tempAttribute3 = new Attribute ();
                        tempAttribute3.key = "precision";
                        tempAttribute3.data_type = "string";
                        tempAttribute3.value = new List<string> ();
                        tempAttribute3.value.Add ("0.01");
                        tempAttribute3.value.Add ("0.1");
                        tempAttribute3.value.Add ("100");
                        tempAttribute3.max = 2;
                        tempAttribute3.min = 0;
                        tmp.attributes.Add (tempAttribute3);
                        #endregion
                    } else if (loopCommon.Type == DeviceType.SensorPM25) {
                        tmp.spk = "sensor.pm25";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region value
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";
                        tempAttribute1.data_type = "integer";
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                        #region error_value
                        FunctionSid tempFunction2 = new FunctionSid ();
                        tempFunction2.key = "error_value";
                        tempFunction2.data_type = "integer";
                        tmp.attributes.Add (tempFunction2);
                        Attribute tempAttribute2 = new Attribute ();
                        tempAttribute2.key = "error_value";
                        tempAttribute2.data_type = "integer";
                        tmp.attributes.Add (tempAttribute2);
                        #endregion
                        #region precision
                        FunctionSid tempFunction3 = new FunctionSid ();
                        tempFunction3.key = "precision";
                        tempFunction3.data_type = "string";
                        tempFunction3.value = new List<string> ();
                        tempFunction3.value.Add ("0.01");
                        tempFunction3.value.Add ("0.1");
                        tempFunction3.value.Add ("100");
                        tempFunction3.max = 2;
                        tempFunction3.min = 0;
                        tmp.attributes.Add (tempFunction3);
                        Attribute tempAttribute3 = new Attribute ();
                        tempAttribute3.key = "precision";
                        tempAttribute3.data_type = "string";
                        tempAttribute3.value = new List<string> ();
                        tempAttribute3.value.Add ("0.01");
                        tempAttribute3.value.Add ("0.1");
                        tempAttribute3.value.Add ("100");
                        tempAttribute3.max = 2;
                        tempAttribute3.min = 0;
                        tmp.attributes.Add (tempAttribute3);
                        #endregion
                    }else if (loopCommon.Type == DeviceType.SensorHumidity) {
                        tmp.spk = "sensor.humidity";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region value
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "float";
                        tempFunction1.max = 10000;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";
                        tempAttribute1.data_type = "float";
                        tempAttribute1.max = 10000;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    }else if (loopCommon.Type == DeviceType.SensorTVOC) {
                        tmp.spk = "sensor.tvoc";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region value
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";
                        tempAttribute1.data_type = "integer";
                        tempAttribute1.max = 10000;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    }else if (loopCommon.Type == DeviceType.SensorCO2) {
                        tmp.spk = "sensor.co2";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region value
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";
                        tempAttribute1.data_type = "integer";
                        tempAttribute1.max = 10000;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    }else if (loopCommon.Type == DeviceType.Sensor) {
                        tmp.spk = "dryContact.standard";
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region status
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "status";
                        tempFunction1.data_type = "string";
                        tempFunction1.value = new List<string> ();
                        tempFunction1.value.Add ("on");
                        tempFunction1.value.Add ("off");
                        tempFunction1.max = 1;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "status";
                        tempAttribute1.data_type = "string";
                        tempAttribute1.value = new List<string> ();
                        tempAttribute1.value.Add ("on");
                        tempAttribute1.value.Add ("off");
                        tempAttribute1.max = 1;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    } else {
                        #region on_off
                        FunctionSid tempFunction = new FunctionSid ();
                        tempFunction.key = "enable";
                        tempFunction.data_type = "string";
                        tempFunction.value = new List<string> ();
                        tempFunction.value.Add ("true");
                        tempFunction.value.Add ("false");
                        tempFunction.max = 1;
                        tempFunction.min = 0;
                        tmp.attributes.Add (tempFunction);
                        Attribute tempAttribute = new Attribute ();
                        tempAttribute.key = "enable";
                        tempAttribute.data_type = "string";
                        tempAttribute.value = new List<string> ();
                        tempAttribute.value.Add ("true");
                        tempAttribute.value.Add ("false");
                        tempAttribute.max = 1;
                        tempAttribute.min = 0;
                        tmp.attributes.Add (tempAttribute);
                        #endregion
                        #region value
                        FunctionSid tempFunction1 = new FunctionSid ();
                        tempFunction1.key = "value";
                        tempFunction1.data_type = "integer";
                        tempFunction1.max = 10000;
                        tempFunction1.min = 0;
                        tmp.attributes.Add (tempFunction1);
                        Attribute tempAttribute1 = new Attribute ();
                        tempAttribute1.key = "value";
                        tempAttribute1.data_type = "integer";
                        tempAttribute1.max = 10000;
                        tempAttribute1.min = 0;
                        tmp.attributes.Add (tempAttribute1);
                        #endregion
                    }
@@ -1399,21 +1399,27 @@
                } else {
                    #region on_off
                    FunctionSid tempFunction = new FunctionSid ();
                    tempFunction.key = "on_off";
                    tempFunction.data_type = "string";
                    tempFunction.value = new List<string> ();
                    tempFunction.value.Add ("on");
                    tempFunction.value.Add ("off");
                    tempFunction.max = 1;
                    tempFunction.min = 0;
                    tmp.attributes.Add (tempFunction);
                    Attribute tempAttribute = new Attribute ();
                    tempAttribute.key = "on_off";
                    tempAttribute.data_type = "string";
                    tempAttribute.value = new List<string> ();
                    tempAttribute.value.Add ("on");
                    tempAttribute.value.Add ("off");
                    tempAttribute.max = 1;
                    tempAttribute.min = 0;
                    tmp.attributes.Add (tempAttribute);
                    #endregion
                }
            } catch { }
            return tmp;
        }
        #region 获取属性
        #endregion
        //#region 判断类型
        ///// <summary>
@@ -1567,12 +1573,14 @@
        public string oid { get; set; }  //设备模块地址
        public string omodel { get; set; }    //型号
        public List<FunctionSid> attributes { get; set; } //属性列表
        public List<Attribute> attributes { get; set; } //属性列表
    }
    /// <summary>
    /// 属性
    /// </summary>
    [Serializable]
    public class FunctionSid
    public class Attribute
    {
        //public string name { get; set; }
        public string key { get; set; }