AW: BLE central device as GATT server
Hi Sergey, Thanks for your comments.
Stephan, you are asking: "I would like to know if it's possible in iOS to implement a GATT server when acting as a central". In my opinion, you don't have to do anything to implement GATT server, it's already implemented in iOS internals. And it already has Battery, Time and ANCS services available to any GATT client that wants to use them. You can use CBPeripheralManager to add/remove your own proprietary services if you wish.
I am aware that it's possible, but I think it's weird (and undocumented), because the CBPeripheralManager documentation only states that it will make these services available to *Central* devices.
1) When iOS device is not yet connected to any Bluetooth LE device and wants to make its services available. Then you have to use CBPeripheralManager to start advertising. Then, some remote device can establish connection to iOS. So, iOS becomes Peripheral and GATT Server.
I agree, in this case the use of CBPeripheralManager (and its documentation) makes sense.
I think case 2) is more suitable to what you're trying to achieve. Actually, when you say " from the nRF8001, I was able to connect to the Time Service published by iOS", I guess you have set Bluetooth LE link from iOS side (iOS being Central and nRF8001 - Peripheral) and then you established GATT connection from nRF8001 side.
I wouldn't call it a "GATT connection" but your understanding is correct: * iOS is the GAP Central and GATT Server providing the Time Service * nRF8001 is the GAP Peripheral and GATT Client accessing the Time Service. I got this working and could read the current time; and also get time updates as GATT Notifications.
Cenral and Peripheral only pertain to the stage of connection establishment. Central initiates the establishment of a physical connection and becomes Master. Peripheral accepts connection requests and becomes Slave. Once this physical connection is established, both devices can be GATT Client and/or GATT Server. Though it is more natural for Peripherals to be Servers. May be names of classes in Core Bluetooth are a bit misleading. Because actually CBCentralManager (and its associated delegate) also implements GATT client functionality and CBPeripheralManager (and peripheral delegate) also implements GATT server functionality. But, if you already has physical link in Central role, you can deploy CBPeripheralManager for only GATT server functionality without using any Peripheral role-specific things (like advertising). And vice versa, in Peripheral role you can use CBCentralManager to perform GATT service discovery and etc.
That's what I think is happening, but since I did not find any documentation or examples I was unsure if we could rely on that. I have sent a mail to Jason Conn at Apple to hopefully clarify that. Best regards, --Stephan Walter _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Walter Stephan