示例#1
0
        private async void ButtonAction1_Click(object sender, RoutedEventArgs e)
        {
            DevicesInformation = "Load devices started";
            _rsServiceDiscovery = new RsServiceDiscovery();
            _dicCharacteristics = await _rsServiceDiscovery.InitServices();
            DevicesInformation = $@"Load devices completed
Chars Found:";

            foreach (var rsCharacteristic in _dicCharacteristics)
            {
                DevicesInformation += $"  {rsCharacteristic.Value.CharName}{Environment.NewLine}";
            }
        }
示例#2
0
        private async void ButtonAction4_Click(object sender, RoutedEventArgs e)
        {
            DevicesInformation = $"Load devices started{Environment.NewLine}";
            var rsServiceDiscovery = new RsServiceDiscovery();
            _dicCharacteristics = await rsServiceDiscovery.InitServices();
            DevicesInformation += $@"Load devices completed
Chars Found:{Environment.NewLine}";

            foreach (var rsCharacteristic in _dicCharacteristics)
            {
                DevicesInformation += $"  {rsCharacteristic.Value.CharName}{Environment.NewLine}";
            }

            DevicesInformation += $"Start enabling chars{Environment.NewLine}";

            foreach (var rsCharacteristic in _dicCharacteristics)
            {
                DevicesInformation += $"  Char {rsCharacteristic.Value.CharName}{ Environment.NewLine}";
                await WriteConfigurationInChar(rsCharacteristic, GattClientCharacteristicConfigurationDescriptorValue.Indicate);
                await WriteConfigurationInChar(rsCharacteristic, GattClientCharacteristicConfigurationDescriptorValue.Notify);
            }
            DevicesInformation += $"Done enabling chars{Environment.NewLine}";

        }