WFA_psychometric_chart.DeviceConnection.ScanForParameters C# (CSharp) 메소드

ScanForParameters() 공개 메소드

This used to get the values form the device id
public ScanForParameters ( int deviceID ) : List
deviceID int
리턴 List
        public List<BACnetClass.parameter_class> ScanForParameters(int deviceID)
        {
            parameterListValue.Clear();//Resetting the values
               parameterListValue =   BACnetClass.ReadParameterUsigBacnetID(deviceID);
               // parameterListValue = BACnetClass.ReadParameterUsingBacnetIDForTemperatureAndHumidityBoth(deviceID);
            return parameterListValue;
        }

Usage Example

예제 #1
0
        int deviceInstanceValuTemp = 0;//This for particular device
        private void CB_Device_SelectedIndexChanged(object sender, EventArgs e)
        {
            groupBox3.Enabled = true;
            //Lets clear the combobox first
            CB_param_temp.Items.Clear();
            CB_param_hum.Items.Clear();
            parameterValFromBacnet.Clear();//Clearing the list value

            if (CB_Device.SelectedIndex > -1)
            {
                //On this index change the we need to get the values from the
                indexSelectedDevice = CB_Device.SelectedIndex;
                int instanceId = (int)copyOfMainControllerList[indexSelectedDevice].controllerInstanceId;//Device instance selected.

                deviceInstanceValuTemp = instanceId;

                // MessageBox.Show("instance id = " + instanceId);
                // MessageBox.Show("Device checkonline offline = " + CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0));
                if (CheckDeviceOnlineOffline(deviceInstanceValuTemp, 0) == true)
                {
                    //This uint has to be converted to int because that is what is required...
                    DeviceConnection db = new DeviceConnection();
                    db.ScanForDevice();
                    db.ScanForParameters(instanceId);//This will return the parameters
                    //resert first
                    device_info.Clear();
                    foreach (var bn in BACnetClass.DevicesList)
                    {
                        device_info.Add(new DeviceClass
                        {
                            deviceInstance = bn.device_id,
                            deviceIP       = bn.device_id + "." + bn.adr.adr[0] + "." + bn.adr.adr[1] + "." + bn.adr.adr[2] + "." + bn.adr.adr[3]
                        });
                    }

                    //Now we can use the value strored int  the db.parameterList1
                    string s = "";
                    foreach (var bac in db.parameterListValue)
                    {
                        parameterValFromBacnet.Add(new parameter_class1
                        {
                            device_object_name = bac.device_object_name,
                            indexID            = bac.indexID,
                            presentValue       = bac.presentValue
                        });
                        //    s += bac.device_object_name + "," + bac.presentValue;
                    }

                    //  MessageBox.Show("value = " + s);

                    //Now that we have the parameter list lets display the list in the combobox...
                    // string s = "";
                    foreach (var item in parameterValFromBacnet)
                    {
                        CB_param_temp.Items.Add(item.device_object_name + ":" + item.indexID);
                        CB_param_hum.Items.Add(item.device_object_name + ":" + item.indexID);
                        CB_param_enthalpy.Items.Add(item.device_object_name + ":" + item.indexID);
                        //     s += item.device_object_name + ":" + item.indexID + " value = " + item.presentValue+"\n";
                    }
                }//close of the device is online or offline
                else
                {
                    MessageBox.Show("Device is offline");
                }
                //TEST
                // MessageBox.Show("s = " + s);
            }//Close of if
        }
All Usage Examples Of WFA_psychometric_chart.DeviceConnection::ScanForParameters