Nordic Semiconductor nRF5 AirFuel SDK
version 2.2.0
|
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "nrf_assert.h"
#include "ble_hci.h"
#include "ptu_sensors.h"
#include "ptu_conn_man.h"
#include "ptu_power_ctl.h"
#include "ptu_distant_list_handler.h"
Go to the source code of this file.
Functions | |
API implementation | |
void | ptu_cm_remove_device (ptu_reg_item_t *reg_item_p) |
Disconnect and/or unregister any device. More... | |
bool | ptu_cm_mode_trans_in_progress (void) |
Get mode transition status. More... | |
uint32_t | ptu_cm_init (ptu_sm_handler_t sm_handler) |
Initialize connection manager. More... | |
void | ptu_cm_on_ble_evt (ble_evt_t *p_ble_evt) |
BLE event handler. More... | |
void | ptu_cm_on_wpt_service_evt (ble_wpts_c_t *p_wpts_c, ble_wpts_c_evt_t *const p_wpts_c_evt) |
Handle service events. More... | |
void | ptu_cm_scan_disable (void) |
Disable scanning. | |
void | ptu_cm_scan_enable (void) |
Enable scanning. | |
void | ptu_cm_disconnect_all (void) |
Disconnect all PRUs. | |
void | ptu_cm_dynamic_read_all (void) |
Issue read request for the PRU dynamic characteristic to all registerred PRUs. | |
Static functions and variables | |
enum | ptu_cm_time_set_state_t { PTU_CM_TIME_SET_STATE_IDLE = 0, PTU_CM_TIME_SET_STATE_P_TX_LOW, PTU_CM_TIME_SET_STATE_P_TX_HIGH } |
static ptu_cm_status_t | m_status |
static ptu_static_t | m_ptu_static |
static ptu_sm_handler_t | m_sm_handler |
static const ble_gap_conn_params_t | m_conn_params |
APP_TIMER_DEF (m_mode_trans_timer_id) | |
APP_TIMER_DEF (m_time_set_check_timer_id) | |
static void | m_connect (ble_gap_addr_t const *p_addr) |
static void | m_disconnect (uint16_t conn_handle) |
static void | m_on_fully_accepted_adv_packet (ptu_reg_item_t *reg_item_p, ble_gap_evt_adv_report_t *p_adv_report) |
static void | m_connection_init (ptu_reg_item_t *reg_item) |
static void | m_on_reg_timeout (ptu_reg_item_t *reg_item_p) |
static void | m_mode_trans_timer_handle (void *p_context) |
static void | m_set_reg_item_fully_accepted (ptu_reg_item_t *reg_item_p) |
static void | m_reg_timer_handle (void *p_context) |
static void | m_send_ctrl_denied_due_to_cc (ptu_reg_item_t *reg_item_p) |
static void | m_stop_time_set_procedure (ptu_cm_timeset_data_t *p_ts) |
static void | m_ptu_time_set_check_timer_handler (void *p_context) |
Timeout handler for the time set functionality. More... | |
static void | m_scan_maintain (void) |
static bool | m_imp_shift_required (uint8_t adv_flags) |
static void | m_update_pre_connect_adv_cnt_for_reg_item (ptu_reg_item_t *reg_item_p) |
static void | m_ensure_device_is_in_registry (ptu_reg_item_t **reg_item_p, ble_gap_evt_adv_report_t *p_adv_report, ptu_reg_item_state_t init_state) |
static bool | m_load_var_detected (void) |
static void | m_on_partially_accepted_adv_packet (ptu_reg_item_t *reg_item_p, ble_gap_evt_adv_report_t *p_adv_report) |
static void | m_on_wpt_adv_report (ble_evt_t *p_ble_evt, uint8_t adv_flags) |
static void | m_on_scan_response (ble_evt_t *p_ble_evt) |
static void | m_device_registration_complete (ptu_reg_item_t *reg_item_p) |
static void | m_on_evt_connected (ble_evt_t *p_ble_evt) |
static void | m_on_evt_timeout (ble_evt_t *p_ble_evt) |
static void | m_on_evt_disconnected (ble_evt_t *p_ble_evt) |
static void | m_pairing_start (uint16_t conn_handle) |
static void | m_on_evt_rw_response (ble_evt_t *p_ble_evt) |
static void | m_on_evt_seq_request (ble_evt_t *p_ble_evt) |
static void | m_on_evt_sec_params_request (ble_evt_t *p_ble_evt) |
static void | m_on_evt_conn_sec_update (ble_evt_t *p_ble_evt) |
static void | m_on_wpt_alert (ble_wpts_c_t *p_wpts_c, ble_wpts_c_evt_t *const p_wpts_c_evt) |
static void | ptu_char_pru_dynamic_read (uint16_t conn_handle) |
Set pending dynamic read for PRU. | |
Substates during recognition of load variance shift "time set pattern"
Definition at line 33 of file ptu_conn_man.c.
APP_TIMER_DEF | ( | m_mode_trans_timer_id | ) |
Mode transition timer ID.
APP_TIMER_DEF | ( | m_time_set_check_timer_id | ) |
"Time set check" timer ID.
|
static |
Wrapper function for calling sd_ble_gap_connect(). Will update current state of m_status.
[in] | p_addr | Pointer to GAP address to connect to |
Definition at line 90 of file ptu_conn_man.c.
|
static |
Disconnect from conn_handle. Will not fail if disconnection has already been initialized.
conn_handle | Connection handle to disconnect from. |
Definition at line 132 of file ptu_conn_man.c.
|
static |
Initiate connection and registration of PRU. Shall be called after adv. report only.
reg_item | PRU for which to start connection/registration. |
Definition at line 148 of file ptu_conn_man.c.
|
static |
Timeout handler for the time set functionality.
Will be called every PTU_TIME_SET_CHECK_INTERVAL_MS after receiving CONTROL RSP from PRU that the PTU will perform time set on. To handle artifacts and jitter in the timer, the upper and lower limits are expanded compared to the BSS.
p_context | Timeout context, contains pointer to registry item for time set target PRU. |
Definition at line 270 of file ptu_conn_man.c.
|
static |
Function evaluating flag m_scanning_requested and starts / stops scanning accordingly. Updates flag m_scanning_on.
Definition at line 314 of file ptu_conn_man.c.
|
static |
Function to be when advertise packet with WPT UUID has been received.
p_ble_evt | event data forwarded from softdevice. |
adv_flags | the adv flags from the adv packet. |
Definition at line 447 of file ptu_conn_man.c.
|
static |
Function to be called after "scan response".
p_ble_evt | event data forwarded from softdevice. |
Definition at line 492 of file ptu_conn_man.c.
|
static |
Function to be called after connection to a device is established. on BLE_GAP_EVT_CONNECTED.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 528 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GAP_EVT_TIMEOUT event.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 577 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GAP_EVT_DISCONNECTED event.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 610 of file ptu_conn_man.c.
|
static |
Function starting pairing sequence.
conn_handle | connection handle. |
Definition at line 669 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GATTC_EVT_READ_RSP and BLE_GATTC_EVT_WRITE_RSP events.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 687 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GAP_EVT_SEC_REQUEST event.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 699 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GAP_EVT_SEC_PARAMS_REQUEST event.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 708 of file ptu_conn_man.c.
|
static |
Function to be called on BLE_GAP_EVT_CONN_SEC_UPDATE event.
p_ble_evt | event data forwarded from softdevice. |
Definition at line 719 of file ptu_conn_man.c.
|
static |
Connection manager status variables
Definition at line 64 of file ptu_conn_man.c.
|
static |
PTU Static parameter.
Definition at line 65 of file ptu_conn_man.c.
|
static |
PTU Connection parameters.
Definition at line 79 of file ptu_conn_man.c.