/// <summary>
 /// This used to get the values form the device id
 /// </summary>
 /// <param name="deviceID"></param>
 public List <BACnetClass.parameter_class> ScanForParameters(int deviceID)
 {
     parameterListValue.Clear();//Resetting the values
     parameterListValue = BACnetClass.ReadParameterUsigBacnetID(deviceID);
     // parameterListValue = BACnetClass.ReadParameterUsingBacnetIDForTemperatureAndHumidityBoth(deviceID);
     return(parameterListValue);
 }
        //Now here we are going to get the connected device value

        ////Lets build the function we need to do the task
        //public class ca{
        //    public  string deviceName { get; set; }
        //    public string deviceInstance { get; set; }
        //    public string ConnectedPort { get; set; }
        //}

        /// <summary>
        /// This function is used to scan bacnet devices  connected
        /// </summary>
        /// <returns>returns the list of devices</returns>
        public List <BacNode> ScanForDevice()
        {
            //List<BacNode> DevicesList = new List<BacNode>();

            try
            {
                BACnetClass.StartActivity();
                //Console.WriteLine("Started");

                Thread.Sleep(3000); // Wait a fiew time for WhoIs responses (managed in handler_OnIam)
            }
            catch { }

            return(BACnetClass.DevicesList);
        }
示例#3
0
        /// <summary>
        /// function to take input of controller and variable name and id and scan the hardware values
        /// </summary>
        /// <param name="controllerInstanceID"></param>
        /// <param name="variableName"></param>
        /// <param name="variableNumber"></param>
        public double InputDeviceInfoAndValue(int controllerInstanceID, string variableName, int variableNumber)
        {
            /*
             * Task by this function :
             * 1. Filter which object to call.
             * 2. call a function and a value
             * 3.
             */

            string inputNameForYabee = "";

            if (variableName == "VAR")
            {
                // ANALOG_INPUT_VALUE
                inputNameForYabee = "OBJECT_ANALOG_VALUE";
            }
            else if (variableName == "IN")
            {
                // ANALOG_INPUT_INPUT
                inputNameForYabee = "OBJECT_ANALOG_INPUT";
            }
            else if (variableName == "OUT")
            {
                //variableName == OUT so for this we have
                inputNameForYabee = "OBJECT_ANALOG_OUTPUT";
            }
            double           valueFromDevice = 0;
            DeviceConnection db = new DeviceConnection();

            lock (db)
            {
                db.ScanForDevice();
                //==Now calling yabee for this values
                BACnetClass bc = new BACnetClass();
                valueFromDevice = bc.ReadSingleParameterUsigBacnetID(controllerInstanceID, inputNameForYabee, variableNumber);
                db.ScanForDevice();
            }
            //db.ScanForDevice();
            return(valueFromDevice);
        }
        public void ReadDataFromDeviceForTemperature(int deviceID, uint temp_panID, string param1_identifier_type)
        {
            //lets do some operation regarding the pannel id and stuff

            //then perform this task 
            try
            {
                uint panID_1 = temp_panID;//0; //uint.Parse(panelID1);

                // uint panID_2 = hum_panID;//1;//uint.Parse(panelID2);
                BACnetClass b = new BACnetClass();

                //for temperature value
                b.StartProgramForScanHardware(deviceID, panID_1, param1_identifier_type);
                double temperary1 = double.Parse(b.PresentValueFromBacnet.ToString());
                //tb_temp_panel_value.Text = temp;
                //For humidity value
                //  b.StartProgramForScanHardware(deviceID, panID_2, param2_identifier_type);
                //double temperary2 = double.Parse(b.PresentValueFromBacnet.ToString());
                //tb_hum_panel_value.Text = humidity;
                hardwareValue1 = temperary1;  //--This one is temperature 
                                              // hardwareValue2 = temperary2;
                                              //lets store these two values in a temporary list

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }

        }
      public  List<HumTempDataType> HumTempList = new List<HumTempDataType>();//list to store the data form the device...
        public void ReadDataFromDevice(int deviceID,uint panel1ID,uint panel2ID)
        {
            //lets do some operation regarding the pannel id and stuff

            uint panelID1 = panel1ID;// tb_temp_panel_ID.Text;
            uint panelID2 = panel2ID;//tb_hum_panel_ID.Text;
            //if ((panelID1 != "") &&  (panelID2 != ""))
            //{
            //then perform this task 
            try
            {
                uint panID_1 =panelID1;

                uint panID_2 =panelID2;
                BACnetClass b = new BACnetClass();

                //for temperature value
           //  b.StartProgram(panID_1);
               string temp = b.PresentValueFromBacnet.ToString();
                tb_temp_panel_value.Text = temp;
                //For humidity value
            // b.StartProgram(panID_2);
               string humidity = b.PresentValueFromBacnet.ToString();
                tb_hum_panel_value.Text = humidity;
                //lets store these two values in a temporary list

                HumTempList.Add(new HumTempDataType
                {
                    Temp = double.Parse(temp),
                    Hum = double.Parse(humidity)

                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }

        }