![]() |
BSB Developer Docs
|
Responsible for all operations with ble and exists only on 917. More...
#include "../service/ble_service.h"Go to the source code of this file.
Macros | |
| #define | BLE_REMOTE_ADDRESS_STRING_SIZE (18) |
Typedefs | |
| typedef struct BleWorker | BleWorker |
| Opaque BleWorker type declaration. | |
| typedef void(* | BleConnectionStateChanged) (void *context, bool connected, const uint8_t *remote_dev_address) |
| Type definition for connection state change. | |
Functions | |
| BleWorker * | ble_worker_init (BleConnectionStateChanged connect_callback, void *ctx) |
| Initializes worker when BleCommandInit is process by 917 at startup. | |
| bool | ble_worker_register_service (BleServiceObject *service) |
| Performs registration of each inner ble service during service initialization. | |
| void | ble_worker_send (uint16_t handle, uint16_t data_size, const uint8_t *data, uint16_t cccd_value) |
| Send payload to characteristic set by handle. | |
| void | ble_worker_receive_confirm (uint16_t handle, uint8_t cccd_value) |
| Used by services in order to confirm data receiving. | |
| void | ble_worker_start () |
| Starts ble on BleCommandEnable from U5. | |
| void | ble_worker_stop () |
| Stops ble on BleCommandDisable from U5. | |
| bool | ble_worker_forget_pairing () |
| Forgets pairing with remote device on BleCommandForgetPairing. | |
| bool | ble_worker_pairing_exists () |
| Checks whether pairing with remote device exists. | |
| void | ble_worker_set_name (const char *new_name) |
| Sets new device name used for advertising. | |
Responsible for all operations with ble and exists only on 917.
| typedef void( * BleConnectionStateChanged) (void *context, bool connected, const uint8_t *remote_dev_address) |
Type definition for connection state change.
Worker will trigger this callback if connection state was changed
| [in] | context | used for this call |
| [in] | connected | actual connection state |
| [in] | remote_dev_address | address of connected remote device |
| bool ble_worker_forget_pairing | ( | ) |
Forgets pairing with remote device on BleCommandForgetPairing.
| BleWorker * ble_worker_init | ( | BleConnectionStateChanged | connect_callback, |
| void * | ctx ) |
Initializes worker when BleCommandInit is process by 917 at startup.
| [in] | connect_callback | callback which will be used by worker for connection events |
| [in] | ctx | context for connect_callback |
TODO:Remove this in future
| bool ble_worker_pairing_exists | ( | ) |
Checks whether pairing with remote device exists.
This function returns value nevertheless of actual connection state.
| void ble_worker_receive_confirm | ( | uint16_t | handle, |
| uint8_t | cccd_value ) |
Used by services in order to confirm data receiving.
This function is called only by U5 response that it received data
| [in] | handle | unique pointer to particular ble characteristic |
| [in] | cccd_value | special field with properties which each characteristic in ble has |
| bool ble_worker_register_service | ( | BleServiceObject * | service | ) |
Performs registration of each inner ble service during service initialization.
During this process each service and characteristics inside are registered in nwp and get their own handles which are then used as indexes during requesting those fields
| [in] | service | instance to service object |
| void ble_worker_send | ( | uint16_t | handle, |
| uint16_t | data_size, | ||
| const uint8_t * | data, | ||
| uint16_t | cccd_value ) |
Send payload to characteristic set by handle.
| [in] | handle | unique pointer to particular ble characteristic. BleServiceObject and all inner BleCharacteristicObject get such handle during ble_worker_register_service call |
| [in] | data_size | size of payload to be send |
| [in] | data | payload |
| [in] | cccd_value | special field with properties which each characteristic in ble has |
| void ble_worker_set_name | ( | const char * | new_name | ) |
Sets new device name used for advertising.
| [in] | new_name | name got from U5 side |