Microchip® Advanced Software Framework

multilink_multirole_app.c File Reference

Multilink-Multirole application.

Copyright (c) 2018 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 "multilink_multirole_app.h"
#include "bno055_port.h"
#include "bno055.h"
#include "acc_gyro_sensor_service.h"

Functions

static ble_status_t app_adv_param_set (const uint8_t *ad_data, uint8_t ad_data_length, const uint8_t *scan_data, uint8_t scan_data_len)
 
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}
 
uint8_t found_cccd_index = 0
 
bool gyro_notify_enabled = false
 
gyro_sensor_t gyro_sensor_value = {0}
 
uint8_t remote_central_device_count = 0
 
app_ble_remote_device_info_t remote_device_info [MAX_REMOTE_DEVICE] = {0}
 
uint8_t remote_peripheral_device_count = 0
 
static const uint8_t scan_resp_data [] = {0x0C, 0x09, 0x53, 0x65, 0x6E, 0x73, 0x6F, 0x72, 0x2D, 0x44, 0x65, 0x6D, 0x6F}
 
bool service_disc_pending = false
 
acc_sensor_value_t sonsor_data = {0}
 

static ble_status_t app_adv_param_set ( const uint8_t *  ad_data,
uint8_t  ad_data_length,
const uint8_t *  scan_data,
uint8_t  scan_data_len 
)
static
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
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  )
int main ( void  )

References acc_gyro_sensor_service_init(), ACCE_GYRO_SENSOR_SERVICE_UUID, acce_notify_enabled, acce_sensor_data_send(), ACCE_UUID, adv_data, app_adv_param_set(), APP_DEVICE_ROLE_CENTRAL, app_init(), app_notify_timer_expired, APP_STATE_DISCOVERY_PENDING, APP_STATE_READY, ble_adv_start(), ble_gatt_service_read(), BLE_MATCHING_PARAM_PAYLOAD, ble_mgr_adv_stop(), ble_mgr_characteristic_notify_set(), ble_mgr_device_init(), ble_mgr_get_event(), ble_mgr_peripheral_device_match_params(), ble_mgr_scan_start(), ble_mgr_scan_stop(), ble_primary_service_characteristics_discover(), BLE_SCAN_DUPLICATE_FILTER_ENABLED, BLE_SCAN_ENABLED, ble_scan_start(), ble_set_connection_params(), BLE_SUCCESS, BLE_UUID_128B, BLE_UUID_128B_LEN, bno055_initialize(), bno055_read_accel_xyz(), bno055_read_gyro_xyz(), PACKED::cccd_handle, ble_mgr_adv_report_match_param_t::data, ble_mgr_adv_report_match_param_t::data_len, ble_mgr_adv_report_match_param_t::data_start, DBG_LOG, event_buf, found_cccd_index, gyro_notify_enabled, gyro_sensor_data_send(), GYRO_UUID, hw_timer_init(), hw_timer_register_callback(), ble_mgr_adv_report_match_param_t::matching_param, MAX_REMOTE_CENTRAL_DEVICE, MAX_REMOTE_DEVICE, MAX_REMOTE_PERIPHERAL_DEVICE, PACKED::min_conn_interval, NUMBER_OF_SENSORS, remote_central_device_count, remote_peripheral_device_count, scan_resp_data, SENSOR_1_ACCELEROMETER, SENSOR_2_GYROSCOPE, PACKED::sensor_char_list, sensor_service, serial_console_init(), service_disc_pending, PACKED::service_uuid, state, system_init(), timer_callback_fn(), ble_uuid_t::type, ble_uuid_t::uuid, PACKED::uuid, ble_uuid_val_t::uuid_128b, and ble_uuid_val_t::uuid_16b.

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

Referenced by app_disconnected_cb(), and main().

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,
}
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,
}
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,
}
const ble_gatt_server_event_cb_t app_gatt_server_event_handle
static
Initial value:
= {
.char_value_write = app_char_value_write_cb,
}
bool app_notify_timer_expired = false

Referenced by main(), and timer_callback_fn().

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,
}
const ble_gatt_transparent_event_cb_t app_transparent_event_handle
static
Initial value:
= {
.trans_data_received = app_trans_data_received_cb,
}
ble_service_t* ble_service = NULL
static
uint8_t event_buf[EVENT_BUFFER_LENGTH]

Referenced by main().

event_t evt_param = {.event_msg.data = event_buf, .event_msg.data_len = 0, .event_id = 0}
uint8_t found_cccd_index = 0

Referenced by main().

bool gyro_notify_enabled = false

Referenced by app_disconnected_cb(), and main().

gyro_sensor_t gyro_sensor_value = {0}
uint8_t remote_central_device_count = 0
uint8_t remote_peripheral_device_count = 0
const uint8_t scan_resp_data[] = {0x0C, 0x09, 0x53, 0x65, 0x6E, 0x73, 0x6F, 0x72, 0x2D, 0x44, 0x65, 0x6D, 0x6F}
static

Referenced by main().

bool service_disc_pending = false
acc_sensor_value_t sonsor_data = {0}