Multi-Role Peripheral Multi-connection Application.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "platform.h"
#include "multirole_peripheral_multiconnect.h"
#include "console_serial.h"
#include "ble_manager.h"
#include "at_ble_api.h"
#include "find_me_locator.h"
#include "immediate_alert.h"
#include "timer_hw.h"
#include "conf_extint.h"
#include "battery.h"
Macros | |
#define | APP_BUTTON_EVENT_ID (2) |
#define | APP_INVALID_EVENT_ID (0) |
#define | APP_TIMER_EVENT_ID (1) |
#define APP_BUTTON_EVENT_ID (2) |
Referenced by multirole_app_custom_event().
#define APP_INVALID_EVENT_ID (0) |
#define APP_TIMER_EVENT_ID (1) |
Referenced by multirole_app_custom_event().
at_ble_status_t app_connect_request | ( | at_ble_scan_info_t * | scan_buffer, |
uint8_t | index | ||
) |
Connect to a peer device.
References AT_BLE_FAILURE, AT_BLE_SUCCESS, DBG_LOG, at_ble_scan_info_t::dev_addr, fmp_app_state::fmp_peer_address, and gap_dev_connect().
Referenced by ble_scan_report_app_event().
|
static |
References AT_BLE_SUCCESS, DBG_LOG, fmp_app_scan_state, FMP_IDLE, FMP_SCANNING, gap_dev_scan(), and getchar_timeout().
Referenced by ble_scan_report_app_event().
|
static |
|
static |
|
static |
References AT_BLE_FAILURE, AT_BLE_SUCCESS, bas_app_state::bas_level_notified, BAS_MAX_DEVICE_CONNECTION, BAS_NOTIFICATION_CONFIRMED, BAS_NOTIFICATION_ENABLED, BAS_NOTIFICATION_SENT, bat_update_char_value(), battery_level, BLE_INVALID_CONNECTION_HANDLE, bas_app_state::notification_state, status, and UNUSED.
Referenced by battery_simulation_task(), and ble_notification_confirmed_app_event().
|
static |
References AT_BLE_FAILURE, AT_BLE_SUCCESS, ble_advertisement_data_set(), DBG_LOG, and status.
Referenced by main().
|
static |
|
static |
References APP_BAS_ADV_TIMEOUT, APP_BAS_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_FAILURE, AT_BLE_SUCCESS, BAS_MAX_DEVICE_CONNECTION, BLE_INVALID_CONNECTION_HANDLE, DBG_LOG, fmp_app_scan_state, FMP_IDLE, FMP_SCANNING, gap_dev_scan(), NULL, and status.
Referenced by ble_adv_report_app_event(), ble_connected_app_event(), ble_disconnected_app_event(), ble_scan_report_app_event(), and main().
|
static |
|
static |
|
static |
References AT_BLE_SUCCESS, bas_app_state::bas_level_notified, BAS_MAX_DEVICE_CONNECTION, bat_device_adv, battery_start_advertisement(), ble_check_iscentral(), ble_check_ispheripheral(), BLE_INVALID_CONNECTION_HANDLE, BLE_MAX_DEVICE_CONNECTION, bas_app_state::conn_handle, at_ble_connected_t::conn_status, connected, DBG_LOG, fmp_app_scan_state, fmp_app_state::fmp_conn_handle, FMP_CONNECTED, FMP_IDLE, FMP_SCANNING, gap_dev_scan(), and at_ble_connected_t::handle.
|
static |
References ALL_UNUSED, AT_BLE_SUCCESS, bas_app_state::bas_level_notified, BAS_MAX_DEVICE_CONNECTION, BAS_NOTIFICATION_DISABLED, bat_device_adv, battery_start_advertisement(), ble_disconnected(), BLE_INVALID_CONNECTION_HANDLE, bas_app_state::conn_handle, DBG_LOG, fmp_app_scan_state, fmp_app_state::fmp_conn_handle, FMP_IDLE, FMP_SCANNING, gap_dev_scan(), at_ble_disconnected_t::handle, and bas_app_state::notification_state.
|
static |
|
static |
Handles AT_BLE_SCAN_REPORT event from stack.
References AD_TYPE_COMPLETE_LIST_UUID, at_ble_addr_t::addr, ALL_UNUSED, app_connect_request(), app_no_device_found_handler(), AT_BLE_ADV_TYPE_DIRECTED, AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_FAILURE, at_ble_scan_stop(), AT_BLE_SUCCESS, AT_BLE_UUID_16, bat_device_adv, battery_start_advertisement(), DBG_LOG, DBG_LOG_CONT, at_ble_scan_info_t::dev_addr, fmp_app_scan_state, FMP_ASCII_TO_DECIMAL_VALUE, FMP_IDLE, FMP_SCANNING, fmp_supp_scan_index, gap_dev_scan(), getchar_timeout(), IMMEDIATE_ALERT_SERVICE_UUID, MAX_SCAN_DEVICE, scan_index, scan_info_parse(), scan_response_count, at_ble_uuid_t::type, and at_ble_uuid_t::uuid.
void button_cb | ( | void | ) |
References app_init_done, and at_ble_event_user_defined_post().
|
static |
References findme_timer_done, fmp_app_scan_state, fmp_app_state::fmp_conn_handle, FMP_CONNECTED, and rssi_update().
Referenced by multirole_app_custom_event().
int main | ( | void | ) |
References app_init_done, AT_BLE_SUCCESS, bas_app_state::bas_level_notified, BAS_MAX_DEVICE_CONNECTION, BAS_NOTIFICATION_DISABLED, bat_init_service(), bat_primary_service_define(), battery_level, battery_set_advertisement_data(), battery_start_advertisement(), BLE_CUSTOM_EVENT_TYPE, ble_device_init(), ble_event_task(), BLE_GAP_EVENT_TYPE, BLE_GATT_SERVER_EVENT_TYPE, BLE_INVALID_CONNECTION_HANDLE, ble_mgr_events_callback_handler(), board_init(), bas_app_state::conn_handle, DBG_LOG, fmp_locator_init(), hw_timer_init(), hw_timer_register_callback(), bas_app_state::notification_state, NULL, REGISTER_CALL_BACK, serial_console_init(), status, system_init(), and timer_callback_handler().
|
static |
|
static |
Check for Link Loss and Path Loss alert check for Low Alert value if crossed write Low Alert value to Immediate Alert Service.
High Alert value if crossed write High Alert value to IAS service
[in] | conn_handle | Connection handle of a connected device |
References alert_level, at_ble_rx_power_get(), AT_BLE_SUCCESS, gatt_ias_char_handler::char_handle, DBG_LOG, DBG_LOG_CONT, FMP_HIGH_ALERT, FMP_HIGH_ALERT_RANGE, FMP_LOW_ALERT_RANGE, FMP_MID_ALERT, FMP_NO_ALERT, ias_alert_level_write(), IAS_HIGH_ALERT, IAS_MID_ALERT, IAS_NO_ALERT, rssi_power, and status.
Referenced by fmp_simulation_task().
|
static |
References battery_level, battery_level_flag, BATTERY_MAX_LEVEL, and BATTERY_MIN_LEVEL.
Referenced by battery_simulation_task().
|
static |
References at_ble_event_user_defined_post(), bat_timer_done, findme_timer_done, and hw_timer_stop().
fmp_locator_alert_level_t alert_level = FMP_NO_ALERT |
user_custom_event_t app_custom_event[2] |
bas_app_state_t bas_app_info[BAS_MAX_DEVICE_CONNECTION] |
bat_gatt_service_handler_t bas_service_handler |
Referenced by battery_simulation_task(), and timer_callback_handler().
|
static |
|
static |
uint8_t battery_level = BATTERY_MIN_LEVEL |
Referenced by simulate_battery_level().
ble_connected_dev_info_t ble_dev_info[BLE_MAX_DEVICE_CONNECTION] |
Initialize the service with its included service, characteristics, and descriptors.
[in] | scan_param | gatt service information |
Referenced by fmp_simulation_task(), and timer_callback_handler().
fmp_app_state_t fmp_app_info |
volatile fmp_scan_state_t fmp_app_scan_state = FMP_IDLE |
Referenced by app_no_device_found_handler(), bas_encryption_status_changed_app_event(), bas_paired_app_event(), battery_start_advertisement(), ble_adv_report_app_event(), ble_connected_app_event(), ble_disconnected_app_event(), ble_scan_report_app_event(), fmp_simulation_task(), and multirole_app_custom_event().
uint8_t fmp_supp_scan_index[MAX_SCAN_DEVICE] |
Referenced by ble_scan_report_app_event().
gatt_ias_char_handler_t ias_handle |
|
static |
at_ble_scan_info_t scan_info[MAX_SCAN_DEVICE] |
Referenced by pxp_monitor_scan_data_handler().
volatile uint8_t scan_response_count |