Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public NoiseControl(ParrotClient parrotClient)
 {
     _parrotClient = parrotClient;
     _parrotClient.ConnectedEvent    += ParrotClientOnConnectedEvent;
     _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent;
 }
Esempio n. 5
0
 public ConcertHallControl(ParrotClient parrotClient)
 {
     _parrotClient = parrotClient;
     _parrotClient.ConnectedEvent    += ParrotClientOnConnectedEvent;
     _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent;
 }
Esempio n. 6
0
 public Battery(ParrotClient parrotClient)
 {
     _parrotClient = parrotClient;
     _parrotClient.ConnectedEvent    += ParrotClientOnConnectedEvent;
     _parrotClient.NotificationEvent += ParrotClientOnNotificationEvent;
 }