public Task AlertAsync([NotNull] WirelessNetworkAddress destinationAddress,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            Guard.NotNull(destinationAddress, nameof(destinationAddress));

            var operation = new AlertOperation(destinationAddress);

            return sessionGuard.SendAsync(operation, cancellationToken);
        }
 void IWirelessDevice.Accept(AlertOperation operation)
 {
     // Not applicable for a mediator.
 }
 public void Accept(AlertOperation operation)
 {
 }
            void IOperationAcceptor.Accept(AlertOperation operation)
            {
                Guard.NotNull(operation, nameof(operation));

                IWirelessDevice targetDevice = GetPoweredOnDeviceWithAddressOrNull(operation.DestinationAddress);
                targetDevice?.Accept(operation);
            }
 void IWirelessDevice.Accept(AlertOperation operation)
 {
     this.EnsureOnMainThread(() => powerStatus.BlinkAsync());
 }
 public void Accept(AlertOperation operation)
 {
     WarnForUnexpectedOperation(operation);
 }
        public void When_reading_alert_operation_it_must_be_correct()
        {
            // Arrange
            byte[] buffer =
            {
                2,
                ByteFor('0'),
                ByteFor('3'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('4'),
                ByteFor(':'),
                ByteFor('A'),
                ByteFor('B'),
                ByteFor('C'),
                ByteFor('D'),
                ByteFor('E'),
                ByteFor('F'),
                ByteFor('\t'),
                3
            };
            var reader = new PacketReader();

            // Act
            Operation operation = reader.Read(buffer);

            // Assert
            var expected = new AlertOperation(new WirelessNetworkAddress("ABCDEF"));
            operation.ShouldBeEquivalentTo(expected, options => options.IncludingAllRuntimeProperties());
        }
        public void When_writing_alert_operation_it_must_be_correct()
        {
            // Arrange
            var operation = new AlertOperation(new WirelessNetworkAddress("ABCDEF"));

            // Act
            byte[] buffer = PacketWriter.Write(operation, false);

            // Assert
            buffer.ShouldBeEquivalentTo(new byte[]
            {
                2,
                ByteFor('0'),
                ByteFor('3'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('4'),
                ByteFor(':'),
                ByteFor('A'),
                ByteFor('B'),
                ByteFor('C'),
                ByteFor('D'),
                ByteFor('E'),
                ByteFor('F'),
                ByteFor('\t'),
                3
            });
        }