Exemplo n.º 1
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;
 }
Exemplo n.º 2
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);
 }
 /// <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);
 }
 /// <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;
 }