public Task NetworkSetupAsync([NotNull] WirelessNetworkAddress destinationAddress, bool joinNetwork, DeviceRoles roles, CancellationToken cancellationToken = default(CancellationToken)) { Guard.NotNull(destinationAddress, nameof(destinationAddress)); var operation = new NetworkSetupOperation(destinationAddress, joinNetwork, roles); return sessionGuard.SendAsync(operation, cancellationToken); }
void IWirelessDevice.Accept(NetworkSetupOperation operation) { // Not applicable for a mediator. }
public void Accept(NetworkSetupOperation operation) { }
void IOperationAcceptor.Accept(NetworkSetupOperation operation) { Guard.NotNull(operation, nameof(operation)); IWirelessDevice targetDevice = GetPoweredOnDeviceWithAddressOrNull(operation.DestinationAddress); targetDevice?.Accept(operation); }
void IWirelessDevice.Accept(NetworkSetupOperation operation) { this.EnsureOnMainThread(() => { // ReSharper disable PossibleInvalidOperationException // Reason: Operation has been validated for required parameters when this code is reached. settings.IsInNetwork = operation.SetMembership.Value; settings.RolesAssigned = operation.Roles.Value; // ReSharper restore PossibleInvalidOperationException UpdateControlsFromSettings(); UpdateLastStatusFromSettings(); }); }
public void Accept(NetworkSetupOperation operation) { WarnForUnexpectedOperation(operation); }
public void When_reading_network_setup_operation_it_must_be_correct() { // Arrange byte[] buffer = { 2, ByteFor('0'), ByteFor('4'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('4'), ByteFor(':'), ByteFor('A'), ByteFor('B'), ByteFor('C'), ByteFor('D'), ByteFor('E'), ByteFor('F'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('7'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('0'), ByteFor(':'), ByteFor('7'), ByteFor('\t'), 3 }; var reader = new PacketReader(); // Act Operation operation = reader.Read(buffer); // Assert var expected = new NetworkSetupOperation(new WirelessNetworkAddress("ABCDEF"), true, DeviceRoles.StartTimer | DeviceRoles.FinishTimer | DeviceRoles.Keypad); operation.ShouldBeEquivalentTo(expected, options => options.IncludingAllRuntimeProperties()); }
public void When_writing_network_setup_operation_it_must_be_correct() { // Arrange var operation = new NetworkSetupOperation(new WirelessNetworkAddress("ABCDEF"), true, DeviceRoles.StartTimer | DeviceRoles.FinishTimer | DeviceRoles.Keypad); // Act byte[] buffer = PacketWriter.Write(operation, false); // Assert buffer.ShouldBeEquivalentTo(new byte[] { 2, ByteFor('0'), ByteFor('4'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('4'), ByteFor(':'), ByteFor('A'), ByteFor('B'), ByteFor('C'), ByteFor('D'), ByteFor('E'), ByteFor('F'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('7'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('0'), ByteFor(':'), ByteFor('7'), ByteFor('\t'), 3 }); }