public InsteonIdentity(byte devCat, byte subCat, byte firmwareVersion, InsteonProductKey productKey) : this() { DevCat = devCat; SubCat = subCat; FirmwareVersion = firmwareVersion; ProductKey = productKey; }
private bool GetProductData(InsteonDeviceLinkRecord link, out InsteonIdentity?identity) { Dictionary <PropertyKey, int> properties; logger.DebugFormat("Controller {0} GetLinkProductData", Address.ToString()); byte[] message = { (byte)InsteonModemSerialCommand.StandardOrExtendedMessage, link.Address[2], link.Address[1], link.Address[0], (byte)MessageFlagsStandard.ThreeHopsThreeRemaining, (byte)InsteonDirectCommands.ProductDataRequest, Byte.MinValue }; var status = network.Messenger.TrySendReceive(message, false, (byte)InsteonModemSerialCommand.ExtendedMessage, InsteonMessageType.ProductDataResponse, out properties); if (status == EchoStatus.NAK) { logger.ErrorFormat("received NAK trying to get ProductData information"); identity = null; return(false); } if (status == EchoStatus.ACK) { if (properties == null) { logger.ErrorFormat("Device Id {0} has null properties object", Address.ToString()); identity = null; return(false); } var pk = new InsteonProductKey((byte)properties[PropertyKey.ProductKeyHigh], (byte)properties[PropertyKey.ProductKeyMid], (byte)properties[PropertyKey.ProductKeyLow]); identity = new InsteonIdentity((byte)properties[PropertyKey.DevCat], (byte)properties[PropertyKey.SubCat], (byte)properties[PropertyKey.FirmwareVersion], pk); return(true); } logger.ErrorFormat("received unknown status trying to get productdata information"); identity = null; return(false); // echo was not ACK or NAK }
public InsteonIdentity(byte devCat, byte subCat, byte firmwareVersion, InsteonProductKey productKey): this() { DevCat = devCat; SubCat = subCat; FirmwareVersion = firmwareVersion; ProductKey = productKey; }
private bool GetProductData(InsteonDeviceLinkRecord link, out InsteonIdentity? identity) { Dictionary<PropertyKey, int> properties; logger.DebugFormat("Controller {0} GetLinkProductData", Address.ToString()); byte[] message = { (byte)InsteonModemSerialCommand.StandardOrExtendedMessage, link.Address[2], link.Address[1], link.Address[0], (byte) MessageFlagsStandard.ThreeHopsThreeRemaining, (byte)InsteonDirectCommands.ProductDataRequest, Byte.MinValue }; var status = network.Messenger.TrySendReceive(message, false, (byte)InsteonModemSerialCommand.ExtendedMessage, InsteonMessageType.ProductDataResponse, out properties); if (status == EchoStatus.NAK) { logger.ErrorFormat("received NAK trying to get ProductData information"); identity = null; return false; } if (status == EchoStatus.ACK) { if (properties == null) { logger.ErrorFormat("Device Id {0} has null properties object", Address.ToString()); identity = null; return false; } var pk = new InsteonProductKey((byte)properties[PropertyKey.ProductKeyHigh], (byte)properties[PropertyKey.ProductKeyMid], (byte)properties[PropertyKey.ProductKeyLow]); identity = new InsteonIdentity((byte)properties[PropertyKey.DevCat], (byte)properties[PropertyKey.SubCat], (byte)properties[PropertyKey.FirmwareVersion], pk); return true; } logger.ErrorFormat("received unknown status trying to get productdata information"); identity = null; return false; // echo was not ACK or NAK }