Reputation: 1749
Upon inspection of the Android BluetoothLE Peripheral API I was wondering how you could do the following things?
How do you send updates to a central that subscribed to one of your characterisitics?
Why has google not given out any extensive documentation of these features?
Upvotes: 3
Views: 1206
Reputation: 27549
You are looking for Bluetooth Gatt Server role, BluetoothLeAdvertiser can not include characteristics. read for BluetoothGattServer Android
also tried answering all of your questions.
You do not add characteristics directly, you have to add characteristic into Service, you can give above permissions(read,write,notify) to chars. read this BluetoothGattCharacteristic
you gets your callback method(onWriteRequest something) called by system, then you change your data and you should call sendResponse method, read the link.
onReadRequest method gets called by system. read about gatt server callbacks on the android docs(link shared already)
Yes, You can. add chars into service, register them with gattServer(read above), and if monitor role asks for notification registration, you send notification, each time your data changes.
you call notifyCharacteristicChanged
BLE is new, android is still struggling to have stable solution first, no comments on why Google not given.
Upvotes: 4