Re: iOS peripheral as GATT Client
Re: iOS peripheral as GATT Client
- Subject: Re: iOS peripheral as GATT Client
- From: Roland King <email@hidden>
- Date: Wed, 14 Jan 2015 09:38:02 +0800
That’s very clever, thanks for that. I was just thinking through that process, I assume that in this instance the CBPeripheral you retrieve counts as already connected and you just start calling discovery and other methods on it, you don’t, you can’t, call connectPeripheral:options: on it first.
> I’m reasonably sure however looking at the iOS functions that you cannot have an iOS device be a peripheral and, when a central connects to it, use that connected central as a server, discover its characteristics, read and write to it.
Unfortunately, there is no "-centralDidConnect:" delegate method. So just letting the other device connect to the iOS device is not enough to get any delegate methods fired on your CBPeripheralManagerDelegate.
But... once you do get hold of a CBCentral object -- either through -peripheralManager:central:didSubscribeToCharacteristic: or via the CBATTRequest's `central` property that you get when receiving a read/write -- you can use the identifier of that CBCentral object and use it with CBCentralManager's -retrievePeripheralsWithIdentifiers: to get the CBPeripheral for the same device. Once you've got that you can do service discovery and read/write etc.
Agree it's extremely clumsy, but not impossible :)
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden