Exemplo n.º 1
0
        /**
         * Given relevant information string, attempts to create a device capable of communicating with a device through the server.
         * \param[in] info JSON string representing the device, which came from the server
         * \param[in] frame TimeFrame for timestamping data for this device
         */
        public Device CreateDevice(string info, TimeFrame frame)
        {
            var inp  = new ServerInput(_server.ToString());
            var outp = new ServerOutput(_server.ToString());

            return(Interfaces.DeserializeDevice(info, inp, outp, frame));
        }
Exemplo n.º 2
0
        /**
         * Given relevant configuration strings, attempts to create a device capable of communicating with the device inside
         * the house.
         * \param[in] info JSON string representing the device configuration.
         * \param[in] house_json JSON string representing the house configuration.
         * \param[in] frame TimeFrame for the Device to use for time stamping
         * \param[out] Instance of Device representing the requested device, or null if the inputs are invalid.
         */
        public static Device CreateDevice(FullID id, string house_json, string device_json, TimeFrame frame)
        {
            var inp    = new HouseInput(house_json, device_json);
            var outp   = new HouseOutput(house_json, device_json);
            var device = Interfaces.DeserializeDevice(device_json, inp, outp, frame);

            if (device != null)
            {
                device.ID = id;
            }
            return(device);
        }