Class GattServerAdapter
java.lang.Object
com.codename1.bluetooth.le.server.GattServerAdapter
- All Implemented Interfaces:
GattServerListener
Convenience
GattServerListener with empty implementations -- extend
it and override only the events you handle. Unanswered read/write
requests are rejected with GattStatus.REQUEST_NOT_SUPPORTED so
centrals fail fast instead of timing out.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcentralConnected(BleCentral central) A central connected to the local server.voidcentralDisconnected(BleCentral central) A central disconnected from the local server.voidcharacteristicReadRequest(GattReadRequest request) A central reads a characteristic without a static value; answer via [GattReadRequest#respond(byte[])] orGattReadRequest.reject(GattStatus).voidA central writes a characteristic; acknowledge viaGattWriteRequest.respond()when required.voiddescriptorReadRequest(GattReadRequest request) A central reads a descriptor without a static value.voiddescriptorWriteRequest(GattWriteRequest request) A central writes a descriptor.voidsubscriptionChanged(BleCentral central, GattLocalCharacteristic characteristic, boolean subscribed) A central subscribed to or unsubscribed from a characteristic's notifications.
-
Constructor Details
-
GattServerAdapter
public GattServerAdapter()
-
-
Method Details
-
characteristicReadRequest
Description copied from interface:GattServerListenerA central reads a characteristic without a static value; answer via [GattReadRequest#respond(byte[])] orGattReadRequest.reject(GattStatus).- Specified by:
characteristicReadRequestin interfaceGattServerListener
-
characteristicWriteRequest
Description copied from interface:GattServerListenerA central writes a characteristic; acknowledge viaGattWriteRequest.respond()when required.- Specified by:
characteristicWriteRequestin interfaceGattServerListener
-
descriptorReadRequest
Description copied from interface:GattServerListenerA central reads a descriptor without a static value. Platform note: iOS serves descriptors from their static values only, so this never fires there -- always give local descriptors a static value for cross-platform behavior.- Specified by:
descriptorReadRequestin interfaceGattServerListener
-
descriptorWriteRequest
Description copied from interface:GattServerListenerA central writes a descriptor. Never fires on iOS -- seeGattServerListener.descriptorReadRequest(GattReadRequest).- Specified by:
descriptorWriteRequestin interfaceGattServerListener
-
subscriptionChanged
public void subscriptionChanged(BleCentral central, GattLocalCharacteristic characteristic, boolean subscribed) Description copied from interface:GattServerListenerA central subscribed to or unsubscribed from a characteristic's notifications.- Specified by:
subscriptionChangedin interfaceGattServerListener
-
centralConnected
Description copied from interface:GattServerListenerA central connected to the local server.- Specified by:
centralConnectedin interfaceGattServerListener
-
centralDisconnected
Description copied from interface:GattServerListenerA central disconnected from the local server.- Specified by:
centralDisconnectedin interfaceGattServerListener
-