package com.codename1.bluetooth.le.server

BLE peripheral role: the local GATT server (GattServer, GattLocalService, GattLocalCharacteristic, request envelopes) and advertising (AdvertiseSettings, AdvertiseData, BleAdvertisement).

Obtain via Bluetooth.getInstance().getLE().openGattServer(...) and startAdvertising(...); branch on Bluetooth.getInstance().isPeripheralModeSupported() first.

Referencing this package is what triggers the automatic injection of advertise permissions (Android BLUETOOTH_ADVERTISE) at build time – central-only apps that never touch it are not burdened with them.

Types

class AdvertiseDataThe payload to advertise via BluetoothLE.startAdvertising.
enum AdvertiseModeAdvertising-interval trade-off, mirroring Android’s advertise modes.
class AdvertiseSettingsOptions for BluetoothLE.startAdvertising.
class BleAdvertisementLive handle of a running advertisement returned by BluetoothLE.startAdvertising.
class BleCentralA remote central connected to the local GattServer – the mirror image of BlePeripheral when this device acts as the peripheral.
class GattLocalCharacteristicA characteristic definition of a local GattLocalService served by this device’s GattServer.
class GattLocalDescriptorA descriptor definition of a local GattLocalCharacteristic served by this device’s GattServer.
class GattLocalServiceA service definition added to this device’s GattServer via GattServer.addService(GattLocalService).
class GattReadRequestA read request from a connected central, delivered to GattServerListener.characteristicReadRequest(GattReadRequest) or GattServerListener.descriptorReadRequest(GattReadRequest).
class GattServerThe local GATT server, opened via BluetoothLE.openGattServer when this device acts as a BLE peripheral.
class GattServerAdapterConvenience GattServerListener with empty implementations – extend it and override only the events you handle.
interface GattServerListenerReceives the events of a local GattServer: requests from centrals, subscription changes and central connections.
class GattWriteRequestA write request from a connected central, delivered to GattServerListener.characteristicWriteRequest(GattWriteRequest) or GattServerListener.descriptorWriteRequest(GattWriteRequest).
enum TxPowerLevelTransmit power for advertising, trading range against battery.