![]() |
BSB Developer Docs
|
Characteristic logic. More...
Go to the source code of this file.
Typedefs | |
| typedef struct BleCharacteristicObject | BleCharacteristicObject |
| Opaque BleCharacteristicObject type declaration. | |
Functions | |
| BleCharacteristicObject * | ble_characteristic_alloc (const BleCharacteristicConfig *config, BleServiceObject *parent_service) |
| Creates characteristic from predefined config. | |
| void | ble_characteristic_free (BleCharacteristicObject *instance) |
| Free characteristic. | |
| void | ble_characteristic_reset (BleCharacteristicObject *instance) |
| Reset characteristic internals. | |
| const void * | ble_characteristic_get_data (BleCharacteristicObject *instance) |
| Get pointer to internal data buffer. | |
| size_t | ble_characteristic_get_data_size (BleCharacteristicObject *instance) |
| Get actual data size. | |
| void | ble_characteristic_set_data (BleCharacteristicObject *instance, const void *data, const size_t data_size) |
| Set data to characteristic. | |
| bool | ble_characteristic_is_modified (BleCharacteristicObject *instance) |
| Get characteristic modification status. | |
| const BleCharacteristicConfig * | ble_characteristic_get_config (BleCharacteristicObject *instance) |
| Get pointer to characteristic config struct. | |
| void | ble_characteristic_set_handle (BleCharacteristicObject *instance, uint16_t handle) |
| Store characteristic handle retrieved during registration process. | |
| uint16_t | ble_characteristic_get_handle (BleCharacteristicObject *instance) |
| Get characteristic handle. | |
| void | ble_characteristic_set_cccd_handle (BleCharacteristicObject *instance, uint16_t cccd_handle) |
| Store CCCD handle retrieved during registration process. | |
| bool | ble_characteristic_is_cccd_handle (BleCharacteristicObject *instance, uint16_t possible_cccd) |
| Check if provided handle is CCCD or not. | |
| void | ble_characteristic_set_cccd_value (BleCharacteristicObject *instance, uint8_t value) |
| Set new CCCD value for characteristic. | |
| uint8_t | ble_characteristic_get_cccd_value (BleCharacteristicObject *instance) |
| Get current CCCD value from characteristic. | |
| size_t | ble_characteristic_encode (BleCharacteristicObject *instance, BleCharacteristicData *output) |
| Pack characteristic data into intercom frame before sending to other side. | |
| bool | ble_characteristic_decode (BleCharacteristicObject *instance, const BleCharacteristicData *input) |
| Decode characteristic data from intercom frame received from other side. | |
| void | ble_characteristic_register_update_callback (BleCharacteristicObject *instance, BleDataUpdatedCallback callback, void *ctx) |
| Register update callback. | |
| void | ble_characteristic_register_tx_done_callback (BleCharacteristicObject *instance, BleDataTransmitDoneCallback callback, void *ctx) |
| Register transmission done callback. | |
Characteristic logic.
| BleCharacteristicObject * ble_characteristic_alloc | ( | const BleCharacteristicConfig * | config, |
| BleServiceObject * | parent_service ) |
Creates characteristic from predefined config.
This method is called during service allocation
| [in] | config | Characteristic config |
| [in] | parent_service | Service which stores this characteristic |
| bool ble_characteristic_decode | ( | BleCharacteristicObject * | instance, |
| const BleCharacteristicData * | input ) |
Decode characteristic data from intercom frame received from other side.
| [in] | instance | pointer to characteristic instance |
| [in] | input | pointer to intercom frame with data for characteristic |
| size_t ble_characteristic_encode | ( | BleCharacteristicObject * | instance, |
| BleCharacteristicData * | output ) |
Pack characteristic data into intercom frame before sending to other side.
| [in] | instance | pointer to characteristic instance |
| [in] | output | pointer to intercom frame with data packed from characteristic |
| void ble_characteristic_free | ( | BleCharacteristicObject * | instance | ) |
Free characteristic.
| [in] | instance | pointer to characteristic instance |
| uint8_t ble_characteristic_get_cccd_value | ( | BleCharacteristicObject * | instance | ) |
Get current CCCD value from characteristic.
| [in] | instance | pointer to characteristic instance |
| const BleCharacteristicConfig * ble_characteristic_get_config | ( | BleCharacteristicObject * | instance | ) |
Get pointer to characteristic config struct.
| [in] | instance | pointer to characteristic instance |
| const void * ble_characteristic_get_data | ( | BleCharacteristicObject * | instance | ) |
Get pointer to internal data buffer.
| [in] | instance | pointer to characteristic instance |
| size_t ble_characteristic_get_data_size | ( | BleCharacteristicObject * | instance | ) |
Get actual data size.
Size can be less than maximum buffer size
| [in] | instance | pointer to characteristic instance |
| uint16_t ble_characteristic_get_handle | ( | BleCharacteristicObject * | instance | ) |
Get characteristic handle.
| [in] | instance | pointer to characteristic instance |
| bool ble_characteristic_is_cccd_handle | ( | BleCharacteristicObject * | instance, |
| uint16_t | possible_cccd ) |
Check if provided handle is CCCD or not.
| [in] | instance | pointer to characteristic instance |
| [in] | possible_cccd | handle which need to be tested if it represents CCCD field or not |
| bool ble_characteristic_is_modified | ( | BleCharacteristicObject * | instance | ) |
Get characteristic modification status.
Characteristic can be modified from both sides Locally - when this side stores data to characteristic for further transmission Remote - when new data were received from other side via intercom
| [in] | instance | pointer to characteristic instance |
| void ble_characteristic_register_tx_done_callback | ( | BleCharacteristicObject * | instance, |
| BleDataTransmitDoneCallback | callback, | ||
| void * | ctx ) |
Register transmission done callback.
Callback will be triggered when data stored in characteristic were successfully received and processed by other side
| [in] | instance | pointer to characteristic instance |
| [in] | callback | callback function |
| [in] | ctx | callback context |
| void ble_characteristic_register_update_callback | ( | BleCharacteristicObject * | instance, |
| BleDataUpdatedCallback | callback, | ||
| void * | ctx ) |
Register update callback.
Callback will be triggered when new data were received
| [in] | instance | pointer to characteristic instance |
| [in] | callback | callback function |
| [in] | ctx | callback context |
| void ble_characteristic_reset | ( | BleCharacteristicObject * | instance | ) |
Reset characteristic internals.
| [in] | instance | pointer to characteristic instance |
| void ble_characteristic_set_cccd_handle | ( | BleCharacteristicObject * | instance, |
| uint16_t | cccd_handle ) |
Store CCCD handle retrieved during registration process.
| [in] | instance | pointer to characteristic instance |
| [in] | cccd_handle | handle value for CCCD field returned by NWP during registration |
| void ble_characteristic_set_cccd_value | ( | BleCharacteristicObject * | instance, |
| uint8_t | value ) |
Set new CCCD value for characteristic.
| [in] | instance | pointer to characteristic instance |
| [in] | value | new CCCD value |
| void ble_characteristic_set_data | ( | BleCharacteristicObject * | instance, |
| const void * | data, | ||
| const size_t | data_size ) |
Set data to characteristic.
This marks the characteristic as locally modified. The caller must enqueue parent service processing, or use ble_service_write_data(), to transmit the data.
| [in] | instance | pointer to characteristic instance |
| [in] | data | pointer to buffer with new data |
| [in] | data_size | size of new data |
| void ble_characteristic_set_handle | ( | BleCharacteristicObject * | instance, |
| uint16_t | handle ) |
Store characteristic handle retrieved during registration process.
| [in] | instance | pointer to characteristic instance |
| [in] | handle | handle value returned by NWP during registration |