keine bluetooth services oder characteristics werden gefunden

Gast #4396086
Lesenswert?
• ▲
▼
ich schreibe an einer Windows Storapp die Daten von einem ti sensor tag 
empfangen soll.
nach Devices suchen funktioniert mit DeviceInformation::FindAllAsync 
sehr gut:

   void App1::MainPage::ScanButton_Click(Platform::Object^ sender, 
Windows::UI::Xaml::RoutedEventArgs^ e)
   {

  create_task(DeviceInformation::FindAllAsync(GattDeviceService::GetDevice 
SelectorFromUuid(GattServiceUuids::GenericAttribute),  nullptr))
    .then
    ([this](DeviceInformationCollection^ Geräteliste)
  {
    int Anzahl = Geräteliste->Size;
    auto Geräteliste_Iterator = Geräteliste->First();
    TestId = Geräteliste_Iterator->Current->Id;
    TestName = Geräteliste_Iterator->Current->Name;
  }
  );

  Geräte_Namen_Block->Text = TestName + TestId;
}



Aber wenn ich an die characteristics oder services rankommen will 
bekommen ich nur einen lehren Vektor also findet nichts.



Guid DeviceInformationServiceUuid(0xf0002800, 0x0451, 0x4000, 0xB0, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
Guid PeripheralPrivacyFlagCharacteristic(0xf0002a02, 0x0451, 0x4000, 
0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);

void App1::MainPage::___Service_Button__Click(Platform::Object^ sender, 
Windows::UI::Xaml::RoutedEventArgs^ e)
{
  create_task(GattDeviceService::FromIdAsync(TestId)).then([this](GattDevi 
ceService^  Mein_Gerät)
  {
    TestId_vonDeviceService = Mein_Gerät->DeviceId;
    //GattCharacteristic^ FirstCharacteristic = 
Mein_Gerät->GetCharacteristics(PeripheralPrivacyFlagCharacteristic)->Get 
At(0);
    ServicesVector = Mein_Gerät->GetIncludedServices(DeviceInfoUuid);
    CharacteristicsVector = 
Mein_Gerät->GetCharacteristics(PeripheralPrivacyFlagCharacteristic);
    ServicesLength = ServicesVector->Size;
      CharacteristicsLength = CharacteristicsVector->Size;

  });

  }



im Appmanifest xml habe ich die gesuchten characteristic und services 
angegeben:


<m2:Function Type="serviceId:f0002a29-0451-4000-b000-000000000000"/> 
<!--Device Name-->
        <m2:Function 
Type="serviceId:f0002a01-0451-4000-b000-000000000000"/> 
<!--Appearance-->
        <m2:Function 
Type="serviceId:f0002a02-0451-4000-b000-000000000000"/>  <!--Periperal 
Privacy Flag-->


Das sollte eigentlich stimmen. ich weis nicht was ich übersehn hab

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren