/** * 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); }
public Device(IDeviceInput inp, IDeviceOutput outp, TimeFrame frame) { resetIO(inp, outp); if (frame == null) { frame = new TimeFrame(); } _frame = frame; _last_time = DateTime.MinValue; //Set to minimum possible time _id = new FullID(); _name = ""; _update_ok = false; }