|
ruuvi.drivers.c ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
|
#include "ruuvi_driver_enabled_modules.h"#include "ruuvi_driver_error.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | ri_comm_message_t |
| Application message structure used for communication. More... | |
| struct | ri_comm_dis_init_t |
| struct | ri_comm_channel_t |
| control API for communication via outside world More... | |
Macros | |
| #define | RI_COMM_DIS_STRLEN 48 |
| Maximum length for device information strings. | |
| #define | RI_COMM_MSG_REPEAT_FOREVER (0U) |
| Set ri_comm_message_t->repeat_count to this value to e.g. advertise fixed data until explicitly stopped. | |
| #define | RI_COMM_BLE_PAYLOAD_MAX_LENGTH (24U) |
| Standard BLE advertisement manufacturer specific data payload length is the maximum length - does not include header data, 4 bytes. | |
| #define | RI_COMM_MESSAGE_MAX_LENGTH (RI_COMM_BLE_PAYLOAD_MAX_LENGTH) |
| The maximum length for the application message for sending over BLE, which depends on whether extended advertising is enabled or not. | |
Typedefs | |
| typedef struct ri_comm_message_t | ri_comm_message_t |
| Application message structure used for communication. | |
| typedef struct ri_comm_channel_t | ri_comm_channel_t |
| typedef void(* | ri_comm_cb_t) (void *p_data, size_t data_len) |
| typedef rd_status_t(* | ri_comm_xfer_fp_t) (ri_comm_message_t *const msg) |
| Asynchronous transfer function. Puts/gets message in driver queue. | |
| typedef rd_status_t(* | ri_comm_init_fp_t) (ri_comm_channel_t *const channel) |
| (Un-)Initialization function. | |
| typedef rd_status_t(* | ri_comm_evt_handler_fp_t) (const ri_comm_evt_t evt, void *p_data, size_t data_len) |
| Application event handler for communication events. | |
Enumerations | |
| enum | ri_comm_evt_t { RI_COMM_CONNECTED , RI_COMM_DISCONNECTED , RI_COMM_SENT , RI_COMM_RECEIVED , RI_COMM_TIMEOUT , RI_COMM_ABORTED } |
| Communication event type. More... | |
| enum | ri_gatt_params_t { RI_GATT_TURBO , RI_GATT_STANDARD , RI_GATT_LOW_POWER } |
Functions | |
| rd_status_t | ri_comm_id_get (uint64_t *const id) |
Commmon definitions and functions for all radio operations.
Definition in file ruuvi_interface_communication.h.
| #define RI_COMM_BLE_PAYLOAD_MAX_LENGTH (24U) |
Standard BLE advertisement manufacturer specific data payload length is the maximum length - does not include header data, 4 bytes.
Definition at line 44 of file ruuvi_interface_communication.h.
| #define RI_COMM_DIS_STRLEN 48 |
Maximum length for device information strings.
Definition at line 25 of file ruuvi_interface_communication.h.
| #define RI_COMM_MESSAGE_MAX_LENGTH (RI_COMM_BLE_PAYLOAD_MAX_LENGTH) |
The maximum length for the application message for sending over BLE, which depends on whether extended advertising is enabled or not.
Definition at line 61 of file ruuvi_interface_communication.h.
| #define RI_COMM_MSG_REPEAT_FOREVER (0U) |
Set ri_comm_message_t->repeat_count to this value to e.g. advertise fixed data until explicitly stopped.
Definition at line 30 of file ruuvi_interface_communication.h.
| typedef void(* ri_comm_cb_t) (void *p_data, size_t data_len) |
Definition at line 120 of file ruuvi_interface_communication.h.
| typedef struct ri_comm_channel_t ri_comm_channel_t |
Definition at line 117 of file ruuvi_interface_communication.h.
| typedef rd_status_t(* ri_comm_evt_handler_fp_t) (const ri_comm_evt_t evt, void *p_data, size_t data_len) |
Application event handler for communication events.
| [in] | evt | Type of event, ri_comm_evt_t. |
| [in] | p_data | Data associated with the event. May be NULL. |
| [in] | data_len | Length of event data. Must be 0 if data is NULL. Must be at maximum RI_COMM_MESSAGE_MAX_LENGTH. |
Definition at line 153 of file ruuvi_interface_communication.h.
| typedef rd_status_t(* ri_comm_init_fp_t) (ri_comm_channel_t *const channel) |
(Un-)Initialization function.
| [in,out] | channel | A control API. Event handler must be set by application. |
Definition at line 143 of file ruuvi_interface_communication.h.
| typedef struct ri_comm_message_t ri_comm_message_t |
Application message structure used for communication.
This structure is used for both UART and BLE messages.
ruuvi.endpoints.c library, function re_ca_uart_encode for details.The structure includes a static assertion to ensure the data length fits within a uint8_t type.
| typedef rd_status_t(* ri_comm_xfer_fp_t) (ri_comm_message_t *const msg) |
Asynchronous transfer function. Puts/gets message in driver queue.
| [in,out] | msg | A message to put/get to/from driver queue |
Definition at line 133 of file ruuvi_interface_communication.h.
| enum ri_comm_evt_t |
Communication event type.
Definition at line 90 of file ruuvi_interface_communication.h.
| enum ri_gatt_params_t |
| Enumerator | |
|---|---|
| RI_GATT_TURBO | |
| RI_GATT_STANDARD | |
| RI_GATT_LOW_POWER | |
Definition at line 110 of file ruuvi_interface_communication.h.
| rd_status_t ri_comm_id_get | ( | uint64_t *const | id | ) |
Writes maximum 64-bit unique id of the device to the pointer. This ID must remain same across reboots and reflashes of the device
param id: Output, value of id. return RD_SUCCESS on success return RD_ERROR_NOT_SUPPORTED if ID cannot be returned on given platform