MicroEJ BLUETOOTH low level API.
More...
#include <stdint.h>
#include <intern/LLBLUETOOTH_impl.h>
#include <LLBLUETOOTH_defines.h>
Go to the source code of this file.
|
uint8_t | LLBLUETOOTH_IMPL_enable (void) |
|
void | LLBLUETOOTH_IMPL_disable (void) |
|
uint32_t | LLBLUETOOTH_IMPL_waitEvent (LLBLUETOOTH_event_t *event, uint32_t max_event_size) |
|
uint8_t | LLBLUETOOTH_IMPL_startScanning (uint8_t filter_action, uint8_t filter_type, const uint8_t *filter_data, uint32_t filter_data_size) |
|
uint8_t | LLBLUETOOTH_IMPL_stopScanning (void) |
|
uint8_t | LLBLUETOOTH_IMPL_startAdvertising (const uint8_t *adv_data, uint32_t adv_data_size) |
|
uint8_t | LLBLUETOOTH_IMPL_stopAdvertising (void) |
|
uint8_t | LLBLUETOOTH_IMPL_connect (const LLBLUETOOTH_address_t *addr) |
|
uint8_t | LLBLUETOOTH_IMPL_disconnect (uint16_t conn_handle) |
|
uint8_t | LLBLUETOOTH_IMPL_sendPairRequest (uint16_t conn_handle) |
|
uint8_t | LLBLUETOOTH_IMPL_sendPairResponse (uint16_t conn_handle, uint8_t accept) |
|
uint8_t | LLBLUETOOTH_IMPL_sendPasskeyResponse (uint16_t conn_handle, uint8_t accept, uint32_t passkey) |
|
uint8_t | LLBLUETOOTH_IMPL_discoverServices (uint16_t conn_handle, const LLBLUETOOTH_uuid_t *uuid) |
|
uint8_t | LLBLUETOOTH_IMPL_addService (const LLBLUETOOTH_gatts_service_t *service, uint16_t *handles) |
|
uint8_t | LLBLUETOOTH_IMPL_sendReadRequest (uint16_t conn_handle, uint16_t attr_handle) |
|
uint8_t | LLBLUETOOTH_IMPL_sendWriteRequest (uint16_t conn_handle, uint16_t attr_handle, const uint8_t *value, uint32_t value_size, uint8_t no_response) |
|
uint8_t | LLBLUETOOTH_IMPL_sendReadResponse (uint16_t conn_handle, uint16_t attr_handle, uint8_t status, const uint8_t *value, uint32_t value_size) |
|
uint8_t | LLBLUETOOTH_IMPL_sendWriteResponse (uint16_t conn_handle, uint16_t attr_handle, uint8_t status) |
|
uint8_t | LLBLUETOOTH_IMPL_sendNotification (uint16_t conn_handle, uint16_t attr_handle, const uint8_t *value, uint32_t value_size, uint8_t confirm) |
|
MicroEJ BLUETOOTH low level API.
- Author
- MicroEJ Developer Team
- Version
- 2.0.2
- Date
- 8 July 2021
Definition in file LLBLUETOOTH_impl.h.
§ LLBLUETOOTH_IMPL_addService()
Adds a service to the GATT server.
The handles buffer is filled with the handle of the service, the value handle of each characteristic and the handle of each descriptor.
- Parameters
-
service | the service. |
handles | the handles buffer. |
- Returns
- true if the service was added successfully, false otherwise.
§ LLBLUETOOTH_IMPL_connect()
Initiates connection with a device.
- Parameters
-
- Returns
- true if connection was initiated successfully, false otherwise.
§ LLBLUETOOTH_IMPL_disable()
void LLBLUETOOTH_IMPL_disable |
( |
void |
| ) |
|
Disables Bluetooth.
This function frees up all resources allocated during Bluetooth operations and resumes the event thread. If Bluetooth is not enabled, this function returns without performing any operation. After this function has been called, the enable function may be called again.
§ LLBLUETOOTH_IMPL_disconnect()
uint8_t LLBLUETOOTH_IMPL_disconnect |
( |
uint16_t |
conn_handle | ) |
|
Initiates disconnection with a device.
- Parameters
-
conn_handle | the connection handle of the device. |
- Returns
- true if disconnection was initiated successfully, false otherwise.
§ LLBLUETOOTH_IMPL_discoverServices()
uint8_t LLBLUETOOTH_IMPL_discoverServices |
( |
uint16_t |
conn_handle, |
|
|
const LLBLUETOOTH_uuid_t * |
uuid |
|
) |
| |
Discovers the services which are provided by this device.
- Parameters
-
conn_handle | the connection handle of the device. |
uuid | the UUID of the service to discover, or NULL to discover all services. |
- Returns
- true if services discovery was initiated successfully, false otherwise.
§ LLBLUETOOTH_IMPL_enable()
uint8_t LLBLUETOOTH_IMPL_enable |
( |
void |
| ) |
|
Enables Bluetooth.
If Bluetooth is already enabled, this function returns true without performing any operation.
- Returns
- true if Bluetooth was enabled successfully, false otherwise.
§ LLBLUETOOTH_IMPL_sendNotification()
uint8_t LLBLUETOOTH_IMPL_sendNotification |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle, |
|
|
const uint8_t * |
value, |
|
|
uint32_t |
value_size, |
|
|
uint8_t |
confirm |
|
) |
| |
Sends a notification or indication on a characteristic to the given device.
- Parameters
-
conn_handle | the connection handle of the device. |
attr_handle | the attribute handle. |
value | the value to send. |
value_size | the size of the value. |
confirm | true to request a confirmation (GATT indication), false otherwise (GATT notification). |
- Returns
- true if the notification was sent successfully.
§ LLBLUETOOTH_IMPL_sendPairRequest()
uint8_t LLBLUETOOTH_IMPL_sendPairRequest |
( |
uint16_t |
conn_handle | ) |
|
Sends a pair request to a device.
- Parameters
-
conn_handle | the connection handle of the device. |
- Returns
- true if the pair request was sent successfully, false otherwise.
§ LLBLUETOOTH_IMPL_sendPairResponse()
uint8_t LLBLUETOOTH_IMPL_sendPairResponse |
( |
uint16_t |
conn_handle, |
|
|
uint8_t |
accept |
|
) |
| |
Replies to the pair request of a device.
- Parameters
-
conn_handle | the connection handle of the device. |
accept | true if the pairing request should be accepted, false otherwise. |
- Returns
- true if the reply was sent successfully, false otherwise.
§ LLBLUETOOTH_IMPL_sendPasskeyResponse()
uint8_t LLBLUETOOTH_IMPL_sendPasskeyResponse |
( |
uint16_t |
conn_handle, |
|
|
uint8_t |
accept, |
|
|
uint32_t |
passkey |
|
) |
| |
Replies to the passkey request of a device.
- Parameters
-
conn_handle | the connection handle of the device. |
accept | true if the pairing request should be accepted, false otherwise. |
passkey | the passkey value (6-digits PIN code). |
- Returns
- true if the reply was sent successfully, false otherwise.
§ LLBLUETOOTH_IMPL_sendReadRequest()
uint8_t LLBLUETOOTH_IMPL_sendReadRequest |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle |
|
) |
| |
Sends a read request on one of the attributes provided by a device.
- Parameters
-
conn_handle | the connection handle of the device. |
attr_handle | the attribute handle. |
- Returns
- true if the read request was sent successfully.
§ LLBLUETOOTH_IMPL_sendReadResponse()
uint8_t LLBLUETOOTH_IMPL_sendReadResponse |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle, |
|
|
uint8_t |
status, |
|
|
const uint8_t * |
value, |
|
|
uint32_t |
value_size |
|
) |
| |
Sends the response to a read request sent by the given device on an attribute.
- Parameters
-
conn_handle | the connection handle of the device. |
attr_handle | the attribute handle. |
status | the status to send back. |
value | the value to send back. |
value_size | the size of the value. |
- Returns
- true if the read response was sent successfully.
§ LLBLUETOOTH_IMPL_sendWriteRequest()
uint8_t LLBLUETOOTH_IMPL_sendWriteRequest |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle, |
|
|
const uint8_t * |
value, |
|
|
uint32_t |
value_size, |
|
|
uint8_t |
no_response |
|
) |
| |
Sends a write request on one of the attributes provided by a device.
- Parameters
-
conn_handle | the connection handle of the device. |
attr_handle | the attribute handle. |
value | the value to write. |
value_size | the size of the value. |
no_response | true to use the write without response procedure, false to use the write procedure. |
- Returns
- true if the write request was sent successfully.
§ LLBLUETOOTH_IMPL_sendWriteResponse()
uint8_t LLBLUETOOTH_IMPL_sendWriteResponse |
( |
uint16_t |
conn_handle, |
|
|
uint16_t |
attr_handle, |
|
|
uint8_t |
status |
|
) |
| |
Sends the response to a write request sent by the given device on an attribute.
- Parameters
-
conn_handle | the connection handle of the device. |
attr_handle | the attribute handle. |
status | the status to send back. |
- Returns
- true if the write response was sent successfully.
§ LLBLUETOOTH_IMPL_startAdvertising()
uint8_t LLBLUETOOTH_IMPL_startAdvertising |
( |
const uint8_t * |
adv_data, |
|
|
uint32_t |
adv_data_size |
|
) |
| |
Starts advertising. If a device connects while advertising, the advertisement is stopped. It may be started again once the connection is established.
- Parameters
-
adv_data | the advertisement data. |
adv_data_size | the size of the advertisement data. |
- Returns
- true if advertising was started successfully, false otherwise.
§ LLBLUETOOTH_IMPL_startScanning()
uint8_t LLBLUETOOTH_IMPL_startScanning |
( |
uint8_t |
filter_action, |
|
|
uint8_t |
filter_type, |
|
|
const uint8_t * |
filter_data, |
|
|
uint32_t |
filter_data_size |
|
) |
| |
Starts scanning. If a connection is initiated while scanning, the scan is stopped. It may be started again once the connection is established.
- Parameters
-
filter_action | the filter action. |
filter_type | the filter type. |
filter_data | the filter data. |
filter_data_size | the size of the filter data. |
- Returns
- true if scanning was started successfully, false otherwise.
§ LLBLUETOOTH_IMPL_stopAdvertising()
uint8_t LLBLUETOOTH_IMPL_stopAdvertising |
( |
void |
| ) |
|
Stops advertising.
- Returns
- true if advertising was stopped successfully, false otherwise.
§ LLBLUETOOTH_IMPL_stopScanning()
uint8_t LLBLUETOOTH_IMPL_stopScanning |
( |
void |
| ) |
|
Stops scanning.
- Returns
- true if scanning was stopped successfully, false otherwise.
§ LLBLUETOOTH_IMPL_waitEvent()
Waits for a Bluetooth event.
If an event is available, this function writes the event data in the structure and returns the number of bytes written. If no event is available, this function returns zero immediately and suspends the calling Java thread until an event is available.
- Parameters
-
event | the event structure to fill. |
max_event_size | the maximum size of the event, in bytes. |
- Returns
- the number of bytes written if an event is available, zero if no event is available.