public FrmControl(NotifyIcon trayIcon, BluetoothDeviceInfo device) { WindowState = FormWindowState.Minimized; ShowInTaskbar = false; InitializeComponent(); RefreshTimer = new Timer(RefreshTrayIcon, null, Timeout.Infinite, Timeout.Infinite); TrayIcon = trayIcon; Parrot = new ParrotClient(device); Parrot.ConnectedEvent += ParrotOnConnectedEvent; Parrot.Battery.ChangedEvent += BatteryOnChangedEvent; Parrot.NoiseControl.ChangedEvent += NoiseControlOnChangedEvent; Parrot.ConcertHall.ChangedEvent += ConcertHallOnChangedEvent; }
public async Task TestCurrent() { var options = GetOptions(); var runner = NewServiceRunner(); await runner.SetUpAsync(options); var httpClient = runner.Runner.Context.RestfulClient; ParrotClient client = new ParrotClient(runner.Runner.Context.RestfulServer.Context.GetUri().ToString(), httpClient); await Task.Delay(1000); var result = await client.GetCurrent(); Assert.Equal("hello world!", result); await runner.TearDownAsync(); }
public async Task TestNewMessage() { var options = GetOptions(); var runner = NewServiceRunner(); await runner.SetUpAsync(options); var httpClient = runner.Runner.Context.RestfulClient; ParrotClient client = new ParrotClient(runner.Runner.Context.RestfulServer.Context.GetUri().ToString(), httpClient); await client.PostMessage("wow"); await Task.Delay(1500); int Id = await client.GetMaxId(); await Task.Delay(500); output.WriteLine(Id.ToString()); ParrotRecord record = await client.GetRecord(Id); Assert.Equal("wow", record.contents); await runner.TearDownAsync(); }
public NoiseControl(ParrotClient parrotClient) { _parrotClient = parrotClient; _parrotClient.ConnectedEvent += ParrotClientOnConnectedEvent; _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent; }
public ConcertHallControl(ParrotClient parrotClient) { _parrotClient = parrotClient; _parrotClient.ConnectedEvent += ParrotClientOnConnectedEvent; _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent; }
public Battery(ParrotClient parrotClient) { _parrotClient = parrotClient; _parrotClient.ConnectedEvent += ParrotClientOnConnectedEvent; _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent; }