internal InsteonDevice(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) { this.network = network; Address = address; Identity = identity; ackTimer = new Timer(PendingCommandTimerCallback, null, Timeout.Infinite, Constants.deviceAckTimeout); }
private void OnSetButtonPressed(InsteonMessage message) { if (Identity.IsEmpty) { var devCat = (byte)message.Properties[PropertyKey.DevCat]; var subCat = (byte)message.Properties[PropertyKey.SubCat]; var firmwareVersion = (byte)message.Properties[PropertyKey.FirmwareVersion]; Identity = new InsteonIdentity(devCat, subCat, firmwareVersion); } OnDeviceIdentified(); }
public static InsteonDevice GetDevice(this InsteonIdentity insteonIdentity, InsteonNetwork network, InsteonAddress address) { if (insteonIdentity.IsEmpty) { return(new InsteonDevice(network, address, insteonIdentity)); } if (DeviceTypeLookup.ContainsKey(insteonIdentity.DevCat)) { if (DeviceTypeLookup[insteonIdentity.DevCat].ContainsKey(insteonIdentity.SubCat)) { return(DeviceTypeLookup[insteonIdentity.DevCat][insteonIdentity.SubCat](insteonIdentity, network, address)); } } return(new InsteonDevice(network, address, insteonIdentity)); }
/// <summary> /// Adds an INSTEON device to the list of known devices. /// </summary> /// <param name="address">The INSTEON address of the device to add.</param> /// <param name="identity">The INSTEON identity of the device to add.</param> /// <returns>Returns an object representing the specified device.</returns> /// <remarks>This method does not perform any INSTEON messaging, it only adds the specified device to a list of known devices.</remarks> public InsteonDevice Add(InsteonAddress address, InsteonIdentity identity) { if (identity.IsEmpty) { throw new Exception("Identity is empty."); } if (devices.ContainsKey(address.Value)) { return(devices[address.Value]); } InsteonDevice device = identity.GetDevice(network, address); devices.Add(address.Value, device); OnDeviceAdded(device); return(device); }
/// <summary> /// Determines the type of INSTEON device by querying the device. /// </summary> /// <remarks> /// This method does not throw an exception. /// This is a non-blocking method that sends an INSTEON message to the target device and returns immediately (as long as another command is not already pending for the device). /// Only one command can be pending to an INSTEON device at a time. This method will block if a second command is sent while a first command is still pending. /// The <see cref="DeviceIdentified">DeviceIdentified</see> event will be invoked if the command is successful. /// The <see cref="DeviceCommandTimeout">DeviceCommandTimeout</see> event will be invoked if the device does not respond within the expected timeout period. /// </remarks> public bool TryIdentify() { Identity = new InsteonIdentity(); return TryCommand(InsteonDirectCommands.IdRequest, Byte.MinValue); }
//TODO: probably remove from here now? /// <summary> /// Determines the type of INSTEON device by querying the device. /// </summary> /// <remarks> /// This is a non-blocking method that sends an INSTEON message to the target device and returns immediately (as long as another command is not already pending for the device). /// Only one command can be pending to an INSTEON device at a time. This method will block if a second command is sent while a first command is still pending. /// The <see cref="DeviceIdentified">DeviceIdentified</see> event will be invoked if the command is successful. /// The <see cref="DeviceCommandTimeout">DeviceCommandTimeout</see> event will be invoked if the device does not respond within the expected timeout period. /// </remarks> public void Identify() { Identity = new InsteonIdentity(); Command(InsteonDirectCommands.IdRequest, byte.MinValue); }
/// <summary> /// Determines the type of INSTEON device by querying the device. /// </summary> /// <remarks> /// This method does not throw an exception. /// This is a non-blocking method that sends an INSTEON message to the target device and returns immediately (as long as another command is not already pending for the device). /// Only one command can be pending to an INSTEON device at a time. This method will block if a second command is sent while a first command is still pending. /// The <see cref="DeviceIdentified">DeviceIdentified</see> event will be invoked if the command is successful. /// The <see cref="DeviceCommandTimeout">DeviceCommandTimeout</see> event will be invoked if the device does not respond within the expected timeout period. /// </remarks> public bool TryIdentify() { Identity = new InsteonIdentity(); return(TryCommand(InsteonDirectCommands.IdRequest, Byte.MinValue)); }
internal IoLinc(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) : base(network, address, identity) { }
internal DimmableLighting(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) : base(network, address, identity) { }
internal SwitchedLighting(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) : base(network, address, identity) { }
internal PowerLincUsbModem(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) : base(network, address, identity) { }
internal LeakSensor(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity) : base(network, address, identity) { }
internal MiniRemote(InsteonNetwork network, InsteonAddress address, InsteonIdentity identity, int buttonCount) : base(network, address, identity) { NumberOfButtons = buttonCount; }