public void ConnectA2DP()
        {
            ValueSet a2dpConnectDeviceMessage = new ValueSet
            {
                { "opcode", "a2dp" },
                { "command", "connect" },
                { "id", Earbuds.BtID }
            };

            SysAppConnection.SendMessageAsync(a2dpConnectDeviceMessage);
        }
        // Post Initalization
        private async void OnIntialized(Object sender, EventArgs eventArgs)
        {
            postInitializationTimer.Stop();

            BluetoothAdapter defaultBtAdapter = await BluetoothAdapter.GetDefaultAsync();

            localBtAddress = string.Join(":",
                                         BitConverter.GetBytes(defaultBtAdapter.BluetoothAddress).Reverse().Select(b => b.ToString("X2"))).Substring(6).ToLower();

            InitMenuItems();

            // Init BLE Advertisment Watcher
            bleAdvertisementWatcher.InitBleWatcher(0x0007, userKey);
            bleAdvertisementWatcher.Received += OnBleAdvertisementUpdated;
            // bleAdvertisementWatcher.Stop();
            bleAdvertisementWatcher.Start();

            // Start PairedDevice Monitoring
            bluetoothWatcher.Received += OnBluetoothDeviceUpdated;
            bluetoothWatcher.Start();

            // Start Audio Monitor
            AudioMonitor.Start();
            AudioMonitor.Changed += OnAudioStateChanged;

            systrayApplicationServiceConnection.SendMessageAsync($"Working on background\nUser Name: {userName}");
        }
Ejemplo n.º 3
0
        private void SendLogMessage(string level, string message)
        {
            if (AppServiceConnection == null)
            {
                return;
            }

            ValueSet vlueSet = new ValueSet
            {
                { "opcode", "log" },
                { "level", level },
                { "message", message }
            };

            AppServiceConnection.SendMessageAsync(vlueSet);
        }