Microchip® Advanced Software Framework

central_app.c File Reference

GAP-Central application.

Copyright (c) 2018-2021 Microchip Technology Inc. and its subsidiaries.

#include "platform_files.h"
#include "bm_mode.h"
#include "bm_application_mode.h"
#include "bm_utils.h"
#include "event_mem.h"
#include "ble_api.h"
#include "platform.h"
#include "ble_manager.h"
#include "central_app.h"

Functions

static ble_status_t app_adv_report_cb (event_msg_t *msg)
 
static ble_status_t app_char_descriptor_disc_resp_cb (event_msg_t *msg)
 
static ble_status_t app_char_disc_resp_cb (event_msg_t *msg)
 
static ble_status_t app_char_value_received_cb (event_msg_t *msg)
 
static ble_status_t app_char_value_write_cb (event_msg_t *msg)
 
static ble_status_t app_cmd_complete_cb (event_msg_t *msg)
 
static ble_status_t app_config_mode_status_cb (event_msg_t *msg)
 
static ble_status_t app_conn_param_update_cb (event_msg_t *msg)
 
static ble_status_t app_connected_cb (event_msg_t *msg)
 
static ble_status_t app_disconnected_cb (event_msg_t *msg)
 
static void app_init (void)
 
static ble_status_t app_le_end_test_result_cb (event_msg_t *msg)
 
static ble_status_t app_pairing_complete_cb (event_msg_t *msg)
 
static ble_status_t app_passkey_confirm_req_cb (event_msg_t *msg)
 
static ble_status_t app_passkey_entry_req_cb (event_msg_t *msg)
 
static ble_status_t app_service_disc_resp_cb (event_msg_t *msg)
 
static ble_status_t app_status_report_cb (event_msg_t *msg)
 
static ble_status_t app_trans_data_received_cb (event_msg_t *msg)
 
void button_cb (void)
 
int main (void)
 

Variables

static const ble_common_event_cb_t app_common_event_handle
 
static const ble_gap_event_cb_t app_gap_event_handle
 
static const
ble_gatt_client_event_cb_t 
app_gatt_client_event_handle
 
static const
ble_gatt_server_event_cb_t 
app_gatt_server_event_handle
 
static const ble_pairing_event_cb_t app_pairing_event_handle
 
static const
ble_gatt_transparent_event_cb_t 
app_transparent_event_handle
 
uint8_t event_buf [EVENT_BUFFER_LENGTH]
 
event_t evt_param = {.event_msg.data = event_buf, .event_msg.data_len = 0, .event_id = 0}
 
bool is_cccd_found = false
 
app_ble_remote_device_info_t remote_device_info = {0}
 
sensor_char_t sensor_char_list [NUMBER_OF_SENSORS]
 
sensor_service_t sensor_service
 
bool service_disc_pending = false
 
acc_sensor_value_t sonsor_data = {0}
 

static ble_status_t app_char_descriptor_disc_resp_cb ( event_msg_t msg)
static
static ble_status_t app_char_value_write_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_cmd_complete_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_config_mode_status_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_conn_param_update_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_disconnected_cb ( event_msg_t msg)
static
static ble_status_t app_le_end_test_result_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_pairing_complete_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_passkey_confirm_req_cb ( event_msg_t msg)
static

References BLE_SUCCESS, and DBG_LOG.

static ble_status_t app_passkey_entry_req_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_service_disc_resp_cb ( event_msg_t msg)
static

References BLE_SUCCESS, and DBG_LOG.

static ble_status_t app_status_report_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_trans_data_received_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

void button_cb ( void  )

const ble_common_event_cb_t app_common_event_handle
static
Initial value:
= {
.cmd_complete = app_cmd_complete_cb,
.status_report = app_status_report_cb,
.le_end_test_result = app_le_end_test_result_cb,
.config_mode_status = app_config_mode_status_cb,
}
static ble_status_t app_cmd_complete_cb(event_msg_t *msg)
Definition: central_app.c:315
static ble_status_t app_status_report_cb(event_msg_t *msg)
Definition: central_app.c:320
static ble_status_t app_le_end_test_result_cb(event_msg_t *msg)
Definition: central_app.c:325
static ble_status_t app_config_mode_status_cb(event_msg_t *msg)
Definition: central_app.c:330
const ble_gap_event_cb_t app_gap_event_handle
static
Initial value:
= {
.adv_report = app_adv_report_cb,
.connected = app_connected_cb,
.disconnected = app_disconnected_cb,
.conn_param_update = app_conn_param_update_cb,
}
static ble_status_t app_adv_report_cb(event_msg_t *msg)
Definition: central_app.c:148
static ble_status_t app_conn_param_update_cb(event_msg_t *msg)
Definition: central_app.c:188
static ble_status_t app_connected_cb(event_msg_t *msg)
Definition: central_app.c:160
static ble_status_t app_disconnected_cb(event_msg_t *msg)
Definition: central_app.c:177
const ble_gatt_client_event_cb_t app_gatt_client_event_handle
static
Initial value:
= {
.service_disc_resp = app_service_disc_resp_cb,
.char_disc_resp = app_char_disc_resp_cb,
.char_descriptor_disc_resp = app_char_descriptor_disc_resp_cb,
.char_value_received = app_char_value_received_cb,
}
static ble_status_t app_service_disc_resp_cb(event_msg_t *msg)
Definition: central_app.c:198
static ble_status_t app_char_disc_resp_cb(event_msg_t *msg)
Definition: central_app.c:204
static ble_status_t app_char_value_received_cb(event_msg_t *msg)
Definition: central_app.c:296
static ble_status_t app_char_descriptor_disc_resp_cb(event_msg_t *msg)
Definition: central_app.c:260
const ble_gatt_server_event_cb_t app_gatt_server_event_handle
static
Initial value:
= {
.char_value_write = app_char_value_write_cb,
}
static ble_status_t app_char_value_write_cb(event_msg_t *msg)
Definition: central_app.c:193
const ble_pairing_event_cb_t app_pairing_event_handle
static
Initial value:
= {
.passkey_entry_req = app_passkey_entry_req_cb,
.pairing_complete = app_pairing_complete_cb,
.passkey_confirm_req = app_passkey_confirm_req_cb,
}
static ble_status_t app_passkey_confirm_req_cb(event_msg_t *msg)
Definition: central_app.c:345
static ble_status_t app_passkey_entry_req_cb(event_msg_t *msg)
Definition: central_app.c:335
static ble_status_t app_pairing_complete_cb(event_msg_t *msg)
Definition: central_app.c:340
const ble_gatt_transparent_event_cb_t app_transparent_event_handle
static
Initial value:
= {
.trans_data_received = app_trans_data_received_cb,
}
static ble_status_t app_trans_data_received_cb(event_msg_t *msg)
Definition: central_app.c:351
uint8_t event_buf[EVENT_BUFFER_LENGTH]
event_t evt_param = {.event_msg.data = event_buf, .event_msg.data_len = 0, .event_id = 0}
bool is_cccd_found = false

Referenced by main().

app_ble_remote_device_info_t remote_device_info = {0}
sensor_char_t sensor_char_list[NUMBER_OF_SENSORS]
Initial value:
= {
{
.char_attr_handle = 0,
.property = 0x00,
.char_value_attr_handle = 0,
.uuid.type = BLE_UUID_128B,
.uuid.uuid.uuid_128b = {ACCE_UUID},
.cccd_handle = 0,
.cccd_value = 0,
},
{
.char_attr_handle = 0,
.property = 0x00,
.char_value_attr_handle = 0,
.uuid.type = BLE_UUID_128B,
.uuid.uuid.uuid_128b = {GYRO_UUID},
.cccd_handle = 0,
.cccd_value = 0,
}
}
Definition: ble_api.h:349
#define ACCE_UUID
Definition: acc_gyro_sensor_service.h:40
#define GYRO_UUID
Definition: acc_gyro_sensor_service.h:41
sensor_service_t sensor_service
Initial value:
= {
.service_uuid.type = BLE_UUID_128B,
.service_uuid.uuid.uuid_128b = {ACCE_GYRO_SENSOR_SERVICE_UUID},
.num_of_sensor_chars = NUMBER_OF_SENSORS,
.sensor_char_list = sensor_char_list,
}
Definition: ble_api.h:349
#define NUMBER_OF_SENSORS
Definition: acc_gyro_sensor_service.h:43
#define ACCE_GYRO_SENSOR_SERVICE_UUID
Definition: acc_gyro_sensor_service.h:39
sensor_char_t sensor_char_list[NUMBER_OF_SENSORS]
Definition: central_app.c:119
bool service_disc_pending = false
acc_sensor_value_t sonsor_data = {0}