2016-09-26 13:37:39 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "fixed_queue.h"
|
|
|
|
#include "gki.h"
|
|
|
|
#include "bt_defs.h"
|
|
|
|
#include "bt_trace.h"
|
|
|
|
#include "bt_types.h"
|
|
|
|
#include "allocator.h"
|
|
|
|
|
|
|
|
#include "bta_api.h"
|
|
|
|
#include "bta_gatt_api.h"
|
|
|
|
#include "bt_app_common.h"
|
|
|
|
|
|
|
|
#include "controller.h"
|
|
|
|
|
|
|
|
#include "hash_map.h"
|
|
|
|
#include "hash_functions.h"
|
|
|
|
#include "alarm.h"
|
|
|
|
#include "app_button.h"
|
|
|
|
#include "button_pro.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "bt_app_common.h"
|
2016-09-27 13:38:07 +00:00
|
|
|
#include "dis_api.h"
|
2016-09-26 13:37:39 +00:00
|
|
|
#include "gattc_profile.h"
|
|
|
|
#include "smp_int.h"
|
|
|
|
#include "smp_api.h"
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static fixed_queue_t *bta_app_msg_queue;
|
|
|
|
fixed_queue_t *bt_app_general_alarm_queue;
|
|
|
|
hash_map_t *bt_app_general_alarm_hash_map;
|
|
|
|
pthread_mutex_t bt_app_general_alarm_lock;
|
|
|
|
static const size_t BT_APP_GENERAL_ALARM_HASH_MAP_SIZE = 10;
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
xQueueHandle xBtaApp1Queue;
|
|
|
|
xTaskHandle xBtaApp1TaskHandle;
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
#define BT_APP_TTYPE_MAIN_ENTRY (1)
|
2016-09-26 13:37:39 +00:00
|
|
|
static TIMER_LIST_ENT main_boot_tle;
|
|
|
|
|
|
|
|
tSMP_CB smp_cmd;
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_context_switched(void *p_msg);
|
|
|
|
static void bt_app_send_msg(void *p_msg);
|
|
|
|
static void bt_app_task_handler(void *arg);
|
|
|
|
static void bta_app_msg_ready(fixed_queue_t *queue);
|
|
|
|
static void bt_app_task_shut_down(void);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_general_alarm_ready(fixed_queue_t *queue);
|
|
|
|
static void bt_app_general_alarm_process(TIMER_LIST_ENT *p_tle);
|
|
|
|
void bt_app_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
//extern void ble_test_conn(void);
|
|
|
|
//extern void bt_test_start_inquiry(void);
|
|
|
|
extern void ble_server_test(void);
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_task_handler(void *arg)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
TaskEvt_t *e;
|
|
|
|
UINT8 button_msg[2] = {0x01,0x00};
|
|
|
|
for (;;) {
|
|
|
|
if (pdTRUE == xQueueReceive(xBtaApp1Queue, &e, (portTickType)portMAX_DELAY)) {
|
|
|
|
if (e->sig == 0xff) {
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_process(bta_app_msg_queue);
|
|
|
|
fixed_queue_process(bt_app_general_alarm_queue);
|
2016-09-26 13:37:39 +00:00
|
|
|
}else if(e->sig == BUTTON_PRESS_EVT){
|
|
|
|
LOG_ERROR("button_press_event come in,button_value=%x\n",e->par);
|
|
|
|
button_msg[1] = e->par;
|
|
|
|
button_msg_notify(2,button_msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
osi_free(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_task_post(void)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
TaskEvt_t *evt = (TaskEvt_t *)osi_malloc(sizeof(TaskEvt_t));
|
|
|
|
if (evt == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
evt->sig = 0xff;
|
|
|
|
evt->par = 0;
|
|
|
|
|
|
|
|
if (xQueueSend(xBtaApp1Queue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
|
|
|
ets_printf("btdm_post failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bta_app_msg_ready(fixed_queue_t *queue) {
|
2016-09-26 13:37:39 +00:00
|
|
|
BT_HDR *p_msg;
|
|
|
|
while (!fixed_queue_is_empty(queue)) {
|
|
|
|
p_msg = (BT_HDR *)fixed_queue_dequeue(queue);
|
2016-09-27 13:38:07 +00:00
|
|
|
LOG_ERROR("bta_app_msg_ready, evt: %d\n", p_msg->event);
|
2016-09-26 13:37:39 +00:00
|
|
|
switch (p_msg->event) {
|
2016-09-27 13:38:07 +00:00
|
|
|
case BT_EVT_APP_CONTEXT_SWITCH:
|
|
|
|
bt_app_context_switched(p_msg);
|
2016-09-26 13:37:39 +00:00
|
|
|
break;
|
|
|
|
default:
|
2016-09-27 13:38:07 +00:00
|
|
|
LOG_ERROR("unhandled BT_APP event (%d)\n", p_msg->event & BT_EVT_MASK);
|
2016-09-26 13:37:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
GKI_freebuf(p_msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_context_switched(void *p_msg)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
tBTAPP_CONTEXT_SWITCH_CBACK *p = (tBTAPP_CONTEXT_SWITCH_CBACK *) p_msg;
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
if (p->p_cb)
|
|
|
|
p->p_cb(p->event, p->p_param);
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_send_msg(void *p_msg)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
if (bta_app_msg_queue) {
|
|
|
|
fixed_queue_enqueue(bta_app_msg_queue, p_msg);
|
|
|
|
//ke_event_set(KE_EVENT_BT_APP_TASK);
|
|
|
|
bt_app_task_post();
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_status_t bt_app_transfer_context (tBTAPP_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP_COPY_CBACK *p_copy_cback)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
tBTAPP_CONTEXT_SWITCH_CBACK *p_msg;
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
LOG_ERROR("btapp_transfer_context evt %d, len %d", event, param_len);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
/* allocate and send message that will be executed in btif context */
|
2016-09-27 13:38:07 +00:00
|
|
|
if ((p_msg = (tBTAPP_CONTEXT_SWITCH_CBACK *) GKI_getbuf(sizeof(tBTAPP_CONTEXT_SWITCH_CBACK) + param_len)) != NULL)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
p_msg->hdr.event = BT_EVT_APP_CONTEXT_SWITCH; /* internal event */
|
2016-09-26 13:37:39 +00:00
|
|
|
p_msg->p_cb = p_cback;
|
|
|
|
|
|
|
|
p_msg->event = event; /* callback event */
|
|
|
|
|
|
|
|
/* check if caller has provided a copy callback to do the deep copy */
|
|
|
|
if (p_copy_cback)
|
|
|
|
{
|
|
|
|
p_copy_cback(event, p_msg->p_param, p_params);
|
|
|
|
}
|
|
|
|
else if (p_params)
|
|
|
|
{
|
|
|
|
memcpy(p_msg->p_param, p_params, param_len); /* callback parameter data */
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_send_msg(p_msg);
|
2016-09-26 13:37:39 +00:00
|
|
|
return BT_STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* let caller deal with a failed allocation */
|
|
|
|
return BT_STATUS_NOMEM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
void bt_app_task_start_up(void)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
bta_app_msg_queue = fixed_queue_new(SIZE_MAX);
|
|
|
|
if (bta_app_msg_queue == NULL)
|
2016-09-26 13:37:39 +00:00
|
|
|
goto error_exit;
|
2016-09-27 13:38:07 +00:00
|
|
|
//ke_event_callback_set(KE_EVENT_BT_APP_TASK, &bt_app_task_handler);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
xBtaApp1Queue = xQueueCreate(3, sizeof(void *));
|
2016-09-27 13:38:07 +00:00
|
|
|
xTaskCreate(bt_app_task_handler, "BtaApp1T", 8192, NULL, configMAX_PRIORITIES - 3, xBtaApp1TaskHandle);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_register_dequeue(bta_app_msg_queue, bta_app_msg_ready);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_general_alarm_hash_map = hash_map_new(BT_APP_GENERAL_ALARM_HASH_MAP_SIZE,
|
2016-09-26 13:37:39 +00:00
|
|
|
hash_function_pointer, NULL, (data_free_fn)osi_alarm_free, NULL);
|
2016-09-27 13:38:07 +00:00
|
|
|
if (bt_app_general_alarm_hash_map == NULL)
|
2016-09-26 13:37:39 +00:00
|
|
|
goto error_exit;
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
pthread_mutex_init(&bt_app_general_alarm_lock, NULL);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_general_alarm_queue = fixed_queue_new(SIZE_MAX);
|
|
|
|
if (bt_app_general_alarm_queue == NULL)
|
2016-09-26 13:37:39 +00:00
|
|
|
goto error_exit;
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_register_dequeue(bt_app_general_alarm_queue, bt_app_general_alarm_ready);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
memset(&main_boot_tle, 0, sizeof(TIMER_LIST_ENT));
|
|
|
|
return;
|
|
|
|
|
|
|
|
error_exit:
|
2016-09-27 13:38:07 +00:00
|
|
|
LOG_ERROR("%s Unable to allocate resources for bt_app", __func__);
|
|
|
|
bt_app_task_shut_down();
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_task_shut_down(void)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_unregister_dequeue(bta_app_msg_queue);
|
|
|
|
fixed_queue_free(bta_app_msg_queue, NULL);
|
|
|
|
bta_app_msg_queue = NULL;
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
// todo: hash map, pthread_mutex...
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_unregister_dequeue(bt_app_general_alarm_queue);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
vTaskDelete(xBtaApp1TaskHandle);
|
|
|
|
vTaskDelete(xBtaApp1Queue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_dm_data_copy(uint16_t event, char *dst, char *src)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
tBTA_DM_SEC *dst_dm_sec = (tBTA_DM_SEC*)dst;
|
|
|
|
tBTA_DM_SEC *src_dm_sec = (tBTA_DM_SEC*)src;
|
|
|
|
|
|
|
|
if (!src_dm_sec)
|
|
|
|
return;
|
|
|
|
|
|
|
|
assert(dst_dm_sec);
|
|
|
|
memcpy(dst_dm_sec, src_dm_sec, sizeof(tBTA_DM_SEC));
|
|
|
|
|
|
|
|
if (event == BTA_DM_BLE_KEY_EVT)
|
|
|
|
{
|
|
|
|
dst_dm_sec->ble_key.p_key_value = osi_malloc(sizeof(tBTM_LE_KEY_VALUE));
|
|
|
|
assert(src_dm_sec->ble_key.p_key_value);
|
|
|
|
assert(dst_dm_sec->ble_key.p_key_value);
|
|
|
|
memcpy(dst_dm_sec->ble_key.p_key_value, src_dm_sec->ble_key.p_key_value, sizeof(tBTM_LE_KEY_VALUE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_dm_data_free(uint16_t event, tBTA_DM_SEC *dm_sec)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
if (event == BTA_DM_BLE_KEY_EVT)
|
|
|
|
osi_free(dm_sec->ble_key.p_key_value);
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_dm_upstreams_evt(UINT16 event, char *p_param)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param;
|
|
|
|
switch (event) {
|
|
|
|
case BTA_DM_ENABLE_EVT: {
|
|
|
|
|
|
|
|
// BTA_DmSetDeviceName("ijiazu");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*set connectable,discoverable, pairable and paired only modes of local device*/
|
|
|
|
tBTA_DM_DISC disc_mode = BTA_DM_GENERAL_DISC | BTA_DM_BLE_GENERAL_DISCOVERABLE;
|
|
|
|
tBTA_DM_CONN conn_mode = BTA_DM_CONN | BTA_DM_BLE_CONNECTABLE;
|
|
|
|
BTA_DmSetVisibility(disc_mode, conn_mode, BTA_DM_IGNORE, BTA_DM_IGNORE);
|
|
|
|
|
|
|
|
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
|
|
|
|
/* Enable local privacy */
|
|
|
|
BTA_DmBleConfigLocalPrivacy(BLE_LOCAL_PRIVACY_ENABLED);
|
|
|
|
do {
|
|
|
|
const controller_t *controller = controller_get_interface();
|
|
|
|
char bdstr[18];
|
|
|
|
bdaddr_to_string(controller->get_address(), bdstr, sizeof(bdstr));
|
|
|
|
LOG_ERROR("BDA is: %s\n", bdstr);
|
|
|
|
} while (0);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BTA_DM_BLE_SEC_REQ_EVT:
|
|
|
|
|
|
|
|
smp_cmd.local_io_capability = 0x03; //no input no output
|
|
|
|
smp_cmd.loc_oob_flag = 0x00; //oob data not present
|
|
|
|
smp_cmd.loc_auth_req = 0x05;
|
|
|
|
smp_cmd.loc_enc_size = 0x10;
|
|
|
|
smp_cmd.local_i_key = 0x07;
|
|
|
|
smp_cmd.local_r_key = 0x07;
|
|
|
|
memcpy(smp_cmd.pairing_bda,p_data->ble_req.bd_addr,0x06);
|
|
|
|
smp_send_cmd(SMP_OPCODE_PAIRING_RSP,&smp_cmd);
|
|
|
|
smp_set_state(SMP_STATE_WAIT_CONFIRM);
|
|
|
|
//BTA_DmConfirm(p_data->ble_req.bd_addr,true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_dm_data_free(event, p_data);
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data)
|
|
|
|
{
|
|
|
|
LOG_ERROR("bte_dm_evt: %d\n", (uint16_t)event);
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_transfer_context(bt_app_dm_upstreams_evt, (uint16_t)event,
|
|
|
|
(void *)p_data, sizeof(tBTA_DM_SEC), bt_app_dm_data_copy);
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
void bt_app_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
BTA_EnableBluetooth(bte_dm_evt);
|
|
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_start_timer(&main_boot_tle, BT_APP_TTYPE_MAIN_ENTRY, 8);
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alarm timer */
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_general_alarm_cb(void *data) {
|
2016-09-26 13:37:39 +00:00
|
|
|
assert(data != NULL);
|
|
|
|
TIMER_LIST_ENT *p_tle = (TIMER_LIST_ENT *)data;
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
fixed_queue_enqueue(bt_app_general_alarm_queue, p_tle);
|
|
|
|
//ke_event_set(KE_EVENT_BT_APP_TASK);
|
|
|
|
bt_app_task_post();
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
void bt_app_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec) {
|
2016-09-26 13:37:39 +00:00
|
|
|
osi_alarm_t *alarm = NULL;
|
|
|
|
|
|
|
|
assert(p_tle != NULL);
|
|
|
|
|
|
|
|
// Get the alarm for the timer list entry.
|
2016-09-27 13:38:07 +00:00
|
|
|
pthread_mutex_lock(&bt_app_general_alarm_lock);
|
|
|
|
if (!hash_map_has_key(bt_app_general_alarm_hash_map, p_tle)) {
|
|
|
|
alarm = osi_alarm_new("bt_app", bt_app_general_alarm_cb, (void *)p_tle, 0);
|
|
|
|
hash_map_set(bt_app_general_alarm_hash_map, p_tle, alarm);
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
2016-09-27 13:38:07 +00:00
|
|
|
pthread_mutex_unlock(&bt_app_general_alarm_lock);
|
2016-09-26 13:37:39 +00:00
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
pthread_mutex_lock(&bt_app_general_alarm_lock);
|
|
|
|
alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle);
|
|
|
|
pthread_mutex_unlock(&bt_app_general_alarm_lock);
|
2016-09-26 13:37:39 +00:00
|
|
|
if (alarm == NULL) {
|
|
|
|
LOG_ERROR("%s Unable to create alarm", __func__);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
osi_alarm_cancel(alarm);
|
|
|
|
|
|
|
|
p_tle->event = type;
|
|
|
|
// NOTE: This value is in seconds but stored in a ticks field.
|
|
|
|
p_tle->ticks = timeout_sec;
|
|
|
|
p_tle->in_use = TRUE;
|
|
|
|
osi_alarm_set(alarm, (period_ms_t)(timeout_sec * 1000));
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
void bt_app_stop_timer(TIMER_LIST_ENT *p_tle)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
assert(p_tle != NULL);
|
|
|
|
|
|
|
|
if (p_tle->in_use == FALSE)
|
|
|
|
return;
|
|
|
|
p_tle->in_use = FALSE;
|
|
|
|
|
|
|
|
// Get the alarm for the timer list entry.
|
2016-09-27 13:38:07 +00:00
|
|
|
osi_alarm_t *alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle);
|
2016-09-26 13:37:39 +00:00
|
|
|
if (alarm == NULL) {
|
|
|
|
LOG_WARN("%s Unable to find expected alarm in hashmap", __func__);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
osi_alarm_cancel(alarm);
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_general_alarm_process(TIMER_LIST_ENT *p_tle)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
assert(p_tle != NULL);
|
|
|
|
LOG_ERROR("general_alarm_process\n");
|
|
|
|
switch (p_tle->event) {
|
2016-09-27 13:38:07 +00:00
|
|
|
case BT_APP_TTYPE_MAIN_ENTRY:
|
|
|
|
LOG_ERROR("BT_APP main boot**********\n");
|
2016-09-26 13:37:39 +00:00
|
|
|
|
|
|
|
// ble_test_conn();
|
|
|
|
// ble_server_test();
|
|
|
|
|
|
|
|
|
|
|
|
// bt_test_start_inquiry();
|
|
|
|
|
|
|
|
gatts_server_test();
|
|
|
|
//gattc_client_test();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
static void bt_app_general_alarm_ready(fixed_queue_t *queue)
|
2016-09-26 13:37:39 +00:00
|
|
|
{
|
|
|
|
TIMER_LIST_ENT *p_tle;
|
|
|
|
|
|
|
|
while (!fixed_queue_is_empty(queue)) {
|
|
|
|
p_tle = (TIMER_LIST_ENT *)fixed_queue_dequeue(queue);
|
2016-09-27 13:38:07 +00:00
|
|
|
bt_app_general_alarm_process(p_tle);
|
2016-09-26 13:37:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-27 13:38:07 +00:00
|
|
|
void bt_app_core_start(void) {
|
|
|
|
bt_app_transfer_context(bt_app_init_ok, 0, NULL, 0, NULL);
|
|
|
|
}
|
|
|
|
|