Ejemplo n.º 1
0
        public Message Receive(Dictionary <string, object> args = null)
        {
            string text;
            CCU    ccu = new CCU();

            ccu.Initialize(args["ccuAddress"].ToString(), Convert.ToInt16(args["timeOut"]));
            string sensor = args["sensor"].ToString();
            string action = args["action"].ToString();

            try
            {
                if (String.Compare(sensor, "DEVICE") == 0)
                {
                    text = ccu.DeviceList();//This API lists the device connected to the CCU
                }
                else
                {
                    text = ccu.GetValue(sensor, action);//This API gets the value of the particular sensor
                }
            }
            catch
            {
                throw;
            }


            Message msg = new Message(text);

            return(msg);

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        public void Send(Message msg, Dictionary <string, object> args = null)
        {
            CCU ccu = new CCU();

            ccu.Initialize(args["ccuAddress"].ToString(), Convert.ToInt16(args["timeOut"]));
            string sensor = args["sensor"].ToString();
            string action = args["action"].ToString();
            string value  = args["value"].ToString();

            try
            {
                ccu.SetValue(sensor, action, value);
            }
            catch
            {
                throw;
            }
        }