1
votes

I am building a xamarin.ios app which will connect to peripheral using bluetooth. So far I have successfully discovered and connected to the peripheral i wanted to connect to.

Now, the issue is that I don't want to scan and discover for device every time i need to connect to the device. I am trying to use CBCentralManager.RetrievePeripheralsWithIdentifiers (uuid) but i don't seem to have success using this method. I can retrieve the known peripheral using this method. When i see what it returns in the debug mode, it gives me the device name but the service list( which i want to use) is null.

Did anyone have any success using this method? Thanks in advance !

Here's a small snippet of my code (calling this method):

NSUuid ns = new NSUuid ("known device id");


var  uuid = new NSUuid[]{ ns};

CBPeripheral []per= manager.RetrievePeripheralsWithIdentifiers (uuid);
1
FYI---- I have also tried manager.RetrievePeripherals (device_cbuuid_id) but this one returning no peripherals in the call event (manager.RetrievedPeripherals += (sender, e) => {}) Snippet: CBUUID device_cbuuid_id = CBUUID.FromString ("device_id"); - Bhupinder Singh
Okay, I have figured out . The problem was not the list of services returning null.Because , the services list to be null before connecting to the devices. The problem was how should i used that method in appropriate delegate object. It works perfect. - Bhupinder Singh
Consider adding this comment as an answer, and accept the answer when the option becomes available. This ensures clarity for future visitors :-) - Etan

1 Answers

0
votes

Okay, I have figured out . The problem was not the list of services returning null.Because , the services list has to be null before connecting to the devices. The problem was how should i used that method in appropriate delegate object. It works perfect.