Microchip® Advanced Software Framework

peripheral_app.c File Reference

GAP-Peripheral 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 "peripheral_app.h"
#include "bno055_port.h"
#include "bno055.h"
#include "acc_gyro_sensor_service.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)
 
static void timer_callback_fn (void)
 

Variables

acc_sensor_t acc_sensor_value = {0}
 
bool acce_notify_enabled = false
 
static const uint8_t adv_data []
 
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
 
bool app_notify_timer_expired = false
 
static const ble_pairing_event_cb_t app_pairing_event_handle
 
static const
ble_gatt_transparent_event_cb_t 
app_transparent_event_handle
 
static ble_service_tble_service = NULL
 
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 gyro_notify_enabled = false
 
gyro_sensor_t gyro_sensor_value = {0}
 
app_ble_remote_device_info_t remote_device_info
 
static const uint8_t scan_resp_data [] = {0x0C, 0x09, 0x53, 0x65, 0x6E, 0x73, 0x6F, 0x72, 0x2D, 0x44, 0x65, 0x6D, 0x6F}
 

static ble_status_t app_adv_report_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_char_descriptor_disc_resp_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_char_disc_resp_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_char_value_received_cb ( event_msg_t msg)
static

References BLE_SUCCESS.

static ble_status_t app_char_value_write_cb ( event_msg_t msg)
static
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_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.

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.

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  )
static void timer_callback_fn ( void  )
static

References app_notify_timer_expired.

Referenced by main().

acc_sensor_t acc_sensor_value = {0}
bool acce_notify_enabled = false
const uint8_t adv_data[]
static
Initial value:
= { 0x02,ADV_FLAGS,0x05,
0x15, ADV_MANUFATURER_SPECIFIC_DATA, 0xCD, 0x00, 0xFE, 0x14, 0xAD, 0x11, 0xCF, 0x40, 0x06, 0x3F, 0x11, 0xE5, 0xBE, 0x3E, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x2C,
}
Definition: ble_host_sdk/ble_services/ble_mgr/ble_manager.h:121
Definition: ble_host_sdk/ble_services/ble_mgr/ble_manager.h:112
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: peripheral_app.c:240
static ble_status_t app_status_report_cb(event_msg_t *msg)
Definition: peripheral_app.c:245
static ble_status_t app_config_mode_status_cb(event_msg_t *msg)
Definition: peripheral_app.c:255
static ble_status_t app_le_end_test_result_cb(event_msg_t *msg)
Definition: peripheral_app.c:250
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_connected_cb(event_msg_t *msg)
Definition: peripheral_app.c:139
static ble_status_t app_adv_report_cb(event_msg_t *msg)
Definition: peripheral_app.c:134
static ble_status_t app_disconnected_cb(event_msg_t *msg)
Definition: peripheral_app.c:154
static ble_status_t app_conn_param_update_cb(event_msg_t *msg)
Definition: peripheral_app.c:166
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_char_disc_resp_cb(event_msg_t *msg)
Definition: peripheral_app.c:225
static ble_status_t app_service_disc_resp_cb(event_msg_t *msg)
Definition: peripheral_app.c:220
static ble_status_t app_char_descriptor_disc_resp_cb(event_msg_t *msg)
Definition: peripheral_app.c:230
static ble_status_t app_char_value_received_cb(event_msg_t *msg)
Definition: peripheral_app.c:235
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: peripheral_app.c:171
bool app_notify_timer_expired = false
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_entry_req_cb(event_msg_t *msg)
Definition: peripheral_app.c:260
static ble_status_t app_passkey_confirm_req_cb(event_msg_t *msg)
Definition: peripheral_app.c:270
static ble_status_t app_pairing_complete_cb(event_msg_t *msg)
Definition: peripheral_app.c:265
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: peripheral_app.c:275
ble_service_t* ble_service = NULL
static
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 gyro_notify_enabled = false
gyro_sensor_t gyro_sensor_value = {0}
app_ble_remote_device_info_t remote_device_info
const uint8_t scan_resp_data[] = {0x0C, 0x09, 0x53, 0x65, 0x6E, 0x73, 0x6F, 0x72, 0x2D, 0x44, 0x65, 0x6D, 0x6F}
static

Referenced by app_disconnected_cb(), and main().