/// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode for the controller.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// </remarks>
 public void EnterLinkMode(InsteonLinkMode mode, byte group)
 {
     if (!TryEnterLinkMode(mode, group))
     {
         throw new IOException();
     }
 }
 /// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode as controller, responder, either, or delete.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// This method does not throw an exception.
 /// </remarks>
 public bool TryEnterLinkMode(InsteonLinkMode mode, byte group)
 {
     linkingMode = mode;
     byte[] message = { 0x64, (byte)mode, group };
     Log.WriteLine("Controller {0} EnterLinkMode(mode:{1}, group:{2:X2})", Address.ToString(), mode.ToString(), group);
     if (network.Messenger.TrySend(message) != EchoStatus.ACK)
     {
         return(false);
     }
     timer.Start();
     IsInLinkingMode = true;
     return(true);
 }
示例#3
0
 /// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode as controller, responder, either, or delete.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// This method does not throw an exception.
 /// </remarks>
 public bool TryEnterLinkMode(InsteonLinkMode mode, byte group)
 {
     linkingMode = mode;
     byte[] message = { (byte)InsteonModemSerialCommand.StartAllLink, (byte)mode, group };
     logger.DebugFormat("Controller {0} EnterLinkMode(mode:{1}, group:{2:X2})", Address.ToString(), mode.ToString(), group);
     if (network.Messenger.TrySend(message) != EchoStatus.ACK)
     {
         return(false);
     }
     timer.Start();
     IsInLinkingMode = true;
     return(true);
 }
示例#4
0
 /// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode as controller, responder, either, or delete.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// This method does not throw an exception.
 /// </remarks>
 public bool TryEnterLinkMode(InsteonLinkMode mode, byte group)
 {
     linkingMode = mode;
     byte[] message = { 0x64, (byte)mode, group };
     Log.WriteLine("Controller {0} EnterLinkMode(mode:{1}, group:{2:X2})", Address.ToString(), mode.ToString(), group);
     if (network.Messenger.TrySend(message) != EchoStatus.ACK)
         return false;
     timer.Start();
     IsInLinkingMode = true;
     return true;
 }
示例#5
0
 /// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode for the controller.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// </remarks>
 public void EnterLinkMode(InsteonLinkMode mode, byte group)
 {
     if (!TryEnterLinkMode(mode, group))
         throw new IOException();
 }
 /// <summary>
 /// Places the INSTEON controller into linking mode in order to link or unlink a device.
 /// </summary>
 /// <param name="mode">Determines the linking mode as controller, responder, either, or delete.</param>
 /// <param name="group">Specifies the INSTEON group number to which the device will be linked.</param>
 /// <remarks>
 /// The <see cref="DeviceLinked">DeviceLinked</see> event will be raised when a device has been linked to the controller.
 /// The <see cref="DeviceUnlinked">DeviceUnlinked</see> event will be raised when a device has been unklinked from the controller.
 /// The <see cref="DeviceLinkTimeout">DeviceLinkTimeout</see> event will be raised if a device is not added within the 4 minute timeout period.
 /// This method does not throw an exception.
 /// </remarks>
 public bool TryEnterLinkMode(InsteonLinkMode mode, byte group)
 {
     linkingMode = mode;
     byte[] message = { (byte)InsteonModemSerialCommand.StartAllLink, (byte)mode, group };
     logger.DebugFormat("Controller {0} EnterLinkMode(mode:{1}, group:{2:X2})", Address.ToString(), mode.ToString(), group);
     if (network.Messenger.TrySend(message) != EchoStatus.ACK)
     {
         return false;
     }
     timer.Start();
     IsInLinkingMode = true;
     return true;
 }