当前位置: 首页>>代码示例>>C#>>正文


C# SensorType.ToString方法代码示例

本文整理汇总了C#中SensorType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SensorType.ToString方法的具体用法?C# SensorType.ToString怎么用?C# SensorType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SensorType的用法示例。


在下文中一共展示了SensorType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFileName

 /// <summary>
 /// Gets the name of the file.
 /// </summary>
 /// <param name="sensorType">Type of the sensor.</param>
 /// <param name="updateInterval">The update interval.</param>
 /// <param name="annLogicType">Type of the ANN logic.</param>
 /// <returns></returns>
 public string GetFileName(SensorType sensorType, int updateInterval, ANNLogicType annLogicType)
 {
     return string.Format(sensorType.ToString(), "_", updateInterval.ToString(), "_", annLogicType.ToString());
 }
开发者ID:BigEgg,项目名称:Sunny,代码行数:11,代码来源:ANNDocumentHelper.cs

示例2: cfg_OnUserAddDevice

        //         void cfg_OnUserUpdateControledDevices(List<DeviceAssociation> ControledDevices)
        //         {
        //             //             ZBClass class2 = new ZBClass();
        //             //             class2.header = class2.GetBytesFromString("ZSIG");
        //             //             class2.command = 11;
        //             //             class2.alphacommand = class2.GetBytesFromString("SendCmd");
        //             //             class2.label_base = class2.GetBytesFromString("");
        //             //             class2.command_text = class2.GetBytesFromString("");
        //             //             class2.serial = 0;
        //             //             class2.param1 = 1;
        //             //             class2.param2 = 22;
        //             //             class2.param3 = 0;
        //             //             class2.param4 = 0;
        //             //             byte[] rBuff = null;
        //             //             byte[] bytes = class2.GetBytes();
        //             //             ZibaseDll.ZBClass zb = new ZibaseDll.ZBClass();
        //             //             zb.UDPDataTransmit(bytes, ref rBuff, "192.168.0.210", 0xc34f);
        //
        //             m_Config.ControledDevices = ControledDevices;
        //             //m_ControledDevices = ControledDevices;
        //             try
        //             {
        //                 Util.SerializeToXml(m_Config, ConfigFilePath);
        //             }
        //             catch (Exception ex)
        //             {
        //                 HsObjet.getInstance().WriteLog("Error", ex.Message);
        //             }
        //
        //         }
        void cfg_OnUserAddDevice(char hc, int dc, string DeviceName, SensorType st)
        {
            Scheduler.Classes.DeviceClass dev = HsObjet.getInstance().NewDeviceEx(DeviceName);
            dev.dc = dc.ToString();
            dev.hc = hc.ToString();
            [email protected] = HSPI.PlugInName;
            dev.iomisc = DeviceName + " " + st.ToString() + " zibase_sensor";
            dev.misc = 0x10; //status only

            var q = m_SensorDataManager.SensorList.Where(x => x.ID == DeviceName);
            if (q.Any())
            {
                Device AddedDevice = q.First();
                var AddedDeviceValue = AddedDevice.Values.First(x => x.ValueType == st);
                if (AddedDeviceValue != null)
                {
                    AddedDeviceValue.AlreadyInHS = true;
                    AddedDeviceValue.HSDevice = dev;
                    AddedDeviceValue.HSUpdate();
                }
            }
            m_SensorDataManager.HSDevice.Add(dev);
        }
开发者ID:BGCX261,项目名称:zibase-homeseer-plugin-svn-to-git,代码行数:53,代码来源:HSPI.cs

示例3: UpdateValue

        private void UpdateValue(Device sd, ZibaseDll.ZiBase.SensorInfo si, SensorType st)
        {
            DeviceValue dv = null;

            var q = sd.Values.Where(x => x.ValueType == st);
            if (q.Any())
            {
                dv = q.First();
                dv.Value = si.sHTMLValue;

                if (st == SensorType.ENERGY_KW || st == SensorType.ENERGY_KWH)
                {
                    String[] splitted = si.sValue.Split(new char[] { ' ' });
                    if (splitted.Length == 2)
                    {
                        float val = Convert.ToSingle(dv.Value,System.Globalization.CultureInfo.InvariantCulture); // Convert.ToInt32(splitted[0]);
                        //val /= 1000.0F;
                        dv.DisplayValue = val + " " + splitted[1];
                    }
                }
                else
                    dv.DisplayValue = si.sValue;
            }
            else
            {
                dv = new DeviceValue {Value = si.sHTMLValue, ValueType = st};
                if (st == SensorType.ENERGY_KW || st == SensorType.ENERGY_KWH)
                {
                    String[] splitted = si.sValue.Split(new char[] { ' ' });
                    if (splitted.Length == 2)
                    {
                        //float val = Convert.ToInt32(splitted[0]);
                        //val /= 1000.0F;
                        float val = Convert.ToSingle(dv.Value, System.Globalization.CultureInfo.InvariantCulture); // Convert.ToInt32(splitted[0]);
                        dv.DisplayValue = val + " " + splitted[1];
                    }
                }
                else
                    dv.DisplayValue = si.sValue;
                sd.Values.Add(dv);
            }

            // if no HSDevice associated,look for the current device in HS
            // IOMisc contains the ID followed by the SensorType
            if (dv.HSDevice == null)
            {
                var q2 = HSDevice.Where(x => x.iomisc.Contains(si.sID) && x.iomisc.Contains(st.ToString()));

                if (q2.Any())
                {
                    dv.AlreadyInHS = true;
                    dv.HSDevice = q2.First();
                }
            }
            dv.DwValue = si.dwValue;
            dv.HSUpdate();
        }
开发者ID:BGCX261,项目名称:zibase-homeseer-plugin-svn-to-git,代码行数:57,代码来源:SensorDataManager.cs


注:本文中的SensorType.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。