Health Thermometer Profile Application.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "profiles.h"
#include "platform.h"
#include "at_ble_api.h"
#include "htpt_app.h"
#include "console_serial.h"
#include "device_info.h"
#include "timer_hw.h"
#include "conf_extint.h"
#include "conf_serialdrv.h"
#include "at_ble_trace.h"
#include "ble_utils.h"
#include "ble_manager.h"
Macros | |
#define | APP_BUTTON_PRESS_ID (2) |
#define | APP_INVALID_EVENT_ID (0) |
#define | APP_TIMER_EVENT_ID (1) |
#define | BLE_DEVICE_NAME "ATMEL-HTP" |
Variables | |
at_ble_LTK_t | app_bond_info |
user_custom_event_t | app_custom_event [2] |
bool | app_device_bond = false |
uint8_t | app_exec = true |
static const ble_gap_event_cb_t | app_gap_handle |
static const ble_htpt_event_cb_t | app_htpt_handle |
volatile bool | app_init_done = false |
volatile bool | app_timer_done = false |
at_ble_auth_t | auth_info |
volatile bool | button_pressed = false |
dis_gatt_service_handler_t | dis_service_handler |
device information service handler More... | |
htp_app_t | htp_data |
at_ble_handle_t | htpt_conn_handle |
static const ble_custom_event_cb_t | HTPT_custom_event_cb |
static uint8_t | scan_rsp_data [SCAN_RESP_LEN] = {0x09, 0xFF, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
static const char * | temp_measurement_loc [] |
bool | temp_send_notification = false |
#define APP_BUTTON_PRESS_ID (2) |
Referenced by htpt_custom_event().
#define APP_INVALID_EVENT_ID (0) |
#define APP_TIMER_EVENT_ID (1) |
Referenced by htpt_custom_event().
#define BLE_DEVICE_NAME "ATMEL-HTP" |
Referenced by ble_device_config().
|
static |
app_connected_state blemanager notifies the application about state
[in] | at_ble_connected_t |
References at_ble_addr_t::addr, at_ble_htpt_enable(), AT_BLE_SUCCESS, DBG_LOG, at_ble_connected_t::handle, HTPT_CFG_STABLE_MEAS_IND, and at_ble_connected_t::peer_addr.
|
static |
app_connected_state ble manager notifies the application about state
[in] | connected |
References APP_HT_ADV_TIMEOUT, APP_HT_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, DBG_LOG, hw_timer_stop(), NULL, and temp_send_notification.
|
static |
|
static |
|
static |
References AT_BLE_SUCCESS, DBG_LOG, and at_ble_htpt_create_db_cfm_t::status.
|
static |
|
static |
References ALL_UNUSED, AT_BLE_SUCCESS, DBG_LOG, and at_ble_htpt_enable_rsp_t::status.
|
static |
|
static |
References AT_BLE_SUCCESS, DBG_LOG, at_ble_htpt_meas_intv_chg_ind_t::intv, and htp_app::measurement_interval.
|
static |
References ALL_UNUSED, and AT_BLE_SUCCESS.
|
static |
|
static |
References ALL_UNUSED, and AT_BLE_SUCCESS.
|
static |
|
static |
Referenced by app_htpt_temp_send_cfm().
void ble_device_config | ( | at_ble_addr_t * | addr | ) |
References addr, at_ble_addr_t::addr, at_ble_dev_config_t::address, at_ble_addr_get(), at_ble_addr_set(), AT_BLE_ADDRESS_PUBLIC, AT_BLE_AUTO_ALLOC_HANDLE, at_ble_device_name_set(), AT_BLE_ROLE_ALL, at_ble_set_dev_config(), AT_BLE_SUCCESS, AT_BLE_WRITE_DISABLE, AT_MTU_VAL_RECOMMENDED, AT_RENEW_DUR_VAL_MIN, at_ble_dev_config_t::att_cfg, at_ble_att_cfg_t::b1EnableServiceChanged, at_ble_att_cfg_t::b1EnableSpcs, at_ble_att_cfg_t::b2AppearancePerm, at_ble_att_cfg_t::b2NamePerm, at_ble_att_cfg_t::b2Rfu, BLE_DEVICE_NAME, DBG_LOG, at_ble_dev_config_t::gap_start_hdl, at_ble_dev_config_t::gatt_start_hdl, at_ble_dev_config_t::max_mtu, NULL, at_ble_dev_config_t::renew_dur, at_ble_dev_config_t::role, and UNUSED.
Referenced by main().
|
static |
References ble_device_init(), and NULL.
Referenced by main().
void button_cb | ( | void | ) |
References app_init_done, at_ble_event_user_defined_post(), and button_pressed.
|
static |
References at_ble_htpt_create_db(), AT_BLE_SUCCESS, DBG_LOG, dis_init_service(), dis_primary_service_define(), htp_init_defaults(), htpt_conn_handle, htpt_set_advertisement_data(), htp_app::max_meaurement_intv, htp_app::measurement_interval, htp_app::min_measurement_intv, htp_app::optional, htp_app::security_lvl, status, and htp_app::temperature_type.
Referenced by main().
|
static |
References htp_app::flags, HTP_TYPE_ARMPIT, HTPT_AUTH, HTPT_FLAG_CELSIUS, HTPT_FLAG_TYPE, HTPT_TEMP_TYPE_CHAR_SUP, htp_app::max_meaurement_intv, htp_app::measurement_interval, htp_app::min_measurement_intv, htp_app::optional, htp_app::security_lvl, htp_app::temperature, and htp_app::temperature_type.
Referenced by htp_init().
|
static |
References at30tse_read_temperature(), at_ble_htpt_temp_send(), AT_BLE_SUCCESS, button_pressed, convert_ieee754_ieee11073_float(), at_ble_prf_date_time_t::day, DBG_LOG, htp_app::flags, HTPT_FLAG_FAHRENHEIT, hw_timer_stop(), STABLE_TEMPERATURE_VAL, status, temp_measurement_loc, htp_app::temperature_type, and update_temperature_type_location().
Referenced by app_htpt_cfg_indntf_ind_handler(), and htpt_custom_event().
|
static |
void htpt_set_advertisement_data | ( | void | ) |
References APP_HT_ADV_TIMEOUT, APP_HT_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, ble_advertisement_data_set(), DBG_LOG, NULL, and status.
Referenced by htp_init().
int main | ( | void | ) |
References app_exec, app_init_done, AT30TSE_CONFIG_RES, AT30TSE_CONFIG_RES_12_bit, at30tse_init(), at30tse_write_config_register(), BLE_CUSTOM_EVENT_TYPE, ble_device_config(), ble_event_task(), BLE_GAP_EVENT_TYPE, BLE_GATT_HTPT_EVENT_TYPE, ble_init(), ble_mgr_events_callback_handler(), board_init(), DBG_LOG, DBG_LOG_PTS, htp_init(), hw_timer_init(), hw_timer_register_callback(), NULL, REGISTER_CALL_BACK, serial_console_init(), system_init(), htp_app::temperature_type, and timer_callback_handler().
|
static |
References app_init_done, app_timer_done, at_ble_event_user_defined_post(), and hw_timer_stop().
|
static |
References htp_app::flags, HTP_TYPE_ARMPIT, HTPT_FLAG_CELSIUS, HTPT_FLAG_FAHRENHEIT, HTPT_FLAG_TYPE, and htp_app::temperature_type.
Referenced by htp_temperature_send().
at_ble_LTK_t app_bond_info |
user_custom_event_t app_custom_event[2] |
Referenced by anp_custom_event(), and ble_observer_custom_event().
uint8_t app_exec = true |
|
static |
|
static |
at_ble_auth_t auth_info |
dis_gatt_service_handler_t dis_service_handler |
device information service handler
htp_app_t htp_data |
at_ble_handle_t htpt_conn_handle |
Referenced by htp_init().
|
static |
|
static |
|
static |
Referenced by htp_temperature_send().
Referenced by app_disconnected_event_handler(), app_htpt_cfg_indntf_ind_handler(), and htpt_custom_event().