J'ai des problèmes avec le foulage sur ce code bluetooth. J'utilise cette bibliothèque https://github.com/xabre/xamarin-bluetooth-le. Il fonctionne comme prévu pour android (Samsung SM G900V Api 23) mais quand je l'exécute sur iOS (iphone 6 10.3) les mises à jour ne sont jamais déclenchées à moins que j'ajoute un point de rupture. J'ai essayé quelques choses différentes mais je suis nouveau sur C# et threading. Qu'est-ce que je fais mal?C# méthodes async avec BLE
public async void ConnectToDeviceService(IDevice device)
{
service = await device.GetServiceAsync(Guid.Parse(_UUIDS.SERVICE_UUID));
infoCharacter = await service.GetCharacteristicAsync(Guid.Parse(_UUIDS.DEVICE_INFO_UUID));
infoCharacter.ValueUpdated += (o, args) =>
{
var bytes = args.Characteristic.Value;
Console.WriteLine("Characteristic Value: {0}", bytes);
PrintByteArray(bytes);
};
await infoCharacter.StartUpdatesAsync();
}
Essayé cela aussi bien
await infoCharacter.StartUpdatesAsync().ContinueWith(result =>
{
infoCharacter.ValueUpdated += (o, args) =>
{
var bytes = args.Characteristic.Value;
Console.WriteLine("Characteristic Value: {0}", bytes);
PrintByteArray(bytes);
};
});