protected Device(Network network, DeviceType type = null) { Network = network; Location = new Location(); Type = type ?? DeviceType.Unknown; Name = null; IsConnected = null; CurrentStateGenerator = new CurrentStateGenerator(); }
public Device(string address, DateTime? lastPing, int id, string name, Network network, IScriptRepository scripts, IDeviceState state, ITaskRepository tasks, DeviceType type) : this() { Address = address; LastPing = lastPing; Id = id; Name = name; Network = network; ScriptRepository = scripts; TaskRepository = tasks; Type = type; if (state != null) { Update(state, false); } }
public ReadOnlyDeviceState(string name, string address, ILocation location, INetwork network, bool? isConnected, DeviceType type, string currentAction, IBinarySwitchState toggleSwitchState, IMultilevelSwitchState dimmerSwitchState, IColorSwitchState colorSwitchState, IBinarySensorState binarySensorState, IMultilevelSensorState<IPower> powerSensorState, IMultilevelSensorState<ITemperature> temperatureSensorState, IMultilevelSensorState<IHumidity> humiditySensorState, IMultilevelSensorState<IIlluminance> illuminanceSensorState, IThermostatState thermostatState, IKeypadState keypadState) { Name = name; Address = address; Location = location; NetworkState = network; IsConnected = isConnected; Type = type; CurrentAction = currentAction; BinarySwitchState = toggleSwitchState; MultilevelSwitchState = dimmerSwitchState; ColorSwitchState = colorSwitchState; BinarySensorState = binarySensorState; PowerSensorState = powerSensorState; TemperatureSensorState = temperatureSensorState; HumiditySensorState = humiditySensorState; IlluminanceSensorState = illuminanceSensorState; ThermostatState = thermostatState; KeypadState = keypadState; }
public static Device Create(string address, bool? isConnected, string name, Network network, ILocation location, DeviceType type, string currentAction = null) { var result = new Device( address: address, lastPing: null, id: 0, name: name, network: network, scripts: null, state: null, tasks: null, type: type ); result.CurrentAction = currentAction; return result; }
public bool Equals(DeviceType that) { if (that == null) { return false; } var one = GetTypeFromString(Name); var two = GetTypeFromString(that.Name); return one == two; }