component/bt: fix of compiler errors after previous merge of code;

This commit is contained in:
wangmengyang
2016-10-17 23:53:02 +08:00
parent 9476dc2eb8
commit 0574f2f55a
3 changed files with 32 additions and 9 deletions

View File

@@ -78,6 +78,7 @@ static void bt_app_task_handler(void *arg)
#endif ///BUT_PROFILE_CFG #endif ///BUT_PROFILE_CFG
} }
osi_free(e);
} }
} }

View File

@@ -15,12 +15,14 @@
#include "bt_app_common.h" #include "bt_app_common.h"
#include "controller.h" #include "controller.h"
#include "prf_defs.h"
#include "hash_map.h" #include "hash_map.h"
#include "hash_functions.h" #include "hash_functions.h"
#include "alarm.h" #include "alarm.h"
#include "app_button.h" //#include "app_button.h"
#if (BUT_PROFILE_CFG)
#include "button_pro.h" #include "button_pro.h"
#endif ///BUT_PROFILE_CFG
#include "thread.h" #include "thread.h"
#include "bt_app_common.h" #include "bt_app_common.h"
#include "dis_api.h" #include "dis_api.h"
@@ -64,11 +66,17 @@ static void bt_app_task_handler(void *arg)
if (e->sig == 0xff) { if (e->sig == 0xff) {
fixed_queue_process(bta_app_msg_queue); fixed_queue_process(bta_app_msg_queue);
fixed_queue_process(bt_app_general_alarm_queue); fixed_queue_process(bt_app_general_alarm_queue);
}else if(e->sig == BUTTON_PRESS_EVT){ }
#if (BUT_PROFILE_CFG)
else if(e->sig == BUTTON_PRESS_EVT){
LOG_ERROR("button_press_event come in,button_value=%x\n",e->par); LOG_ERROR("button_press_event come in,button_value=%x\n",e->par);
button_msg[1] = e->par; button_msg[1] = e->par;
button_msg_notify(2,button_msg); button_msg_notify(2,button_msg);
} }
#endif ///BUT_PROFILE_CFG
} }
osi_free(e); osi_free(e);
} }
@@ -200,7 +208,7 @@ void bt_app_task_start_up(void)
return; return;
error_exit: error_exit:
LOG_ERROR("%s Unable to allocate resources for bt_app", __func__); LOG_ERROR("%s Unable to allocate resources for bt_app\n", __func__);
bt_app_task_shut_down(); bt_app_task_shut_down();
} }
@@ -271,6 +279,12 @@ static void bt_app_dm_upstreams_evt(UINT16 event, char *p_param)
smp_set_state(SMP_STATE_WAIT_CONFIRM); smp_set_state(SMP_STATE_WAIT_CONFIRM);
//BTA_DmConfirm(p_data->ble_req.bd_addr,true); //BTA_DmConfirm(p_data->ble_req.bd_addr,true);
break; break;
case BTA_DM_BLE_KEY_EVT:
if(p_data->ble_key.key_type == BTM_LE_KEY_PENC)
{
smp_set_state(SMP_STATE_IDLE);
}
break;
default: default:
break; break;
} }
@@ -319,7 +333,7 @@ void bt_app_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec)
alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle); alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle);
pthread_mutex_unlock(&bt_app_general_alarm_lock); pthread_mutex_unlock(&bt_app_general_alarm_lock);
if (alarm == NULL) { if (alarm == NULL) {
LOG_ERROR("%s Unable to create alarm", __func__); LOG_ERROR("%s Unable to create alarm\n", __func__);
return; return;
} }

View File

@@ -12,6 +12,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include "prf_defs.h"
#include "bta_api.h" #include "bta_api.h"
#include "bta_gatt_api.h" #include "bta_gatt_api.h"
#include "controller.h" #include "controller.h"
@@ -26,7 +28,7 @@
//#include "app_button.h" //#include "app_button.h"
#include "button_pro.h" #include "button_pro.h"
#include "hid_le_prf.h" #include "hid_le_prf.h"
#include "prf_defs.h"
#include "hcimsgs.h" #include "hcimsgs.h"
#include "bt_app_defs.h" #include "bt_app_defs.h"
@@ -104,8 +106,9 @@ tESP_BLE_ADV_DATA ijiazu_adv_data[ADV_SCAN_IDX_MAX] =
} }
}; };
#if (BUT_PROFILE_CFG)
static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data); static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data);
#endif
typedef struct { typedef struct {
uint8_t uu[16]; uint8_t uu[16];
@@ -182,8 +185,11 @@ static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
//bas_register(); //bas_register();
/*instantiate the driver for button profile*/ /*instantiate the driver for button profile*/
//app_button_init(); //app_button_init();
#if (BUT_PROFILE_CFG)
/*instantiate a button service*/ /*instantiate a button service*/
button_init(SimpleDataCallBack); button_init(SimpleDataCallBack);
#endif ///BUT_PROFILE_CFG
/*instantiate a hid device service*/ /*instantiate a hid device service*/
//hidd_le_init(); //hidd_le_init();
/*start advetising*/ /*start advetising*/
@@ -229,6 +235,7 @@ void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data)
} }
#if (BUT_PROFILE_CFG)
#define HEADER_SSID "ssid" #define HEADER_SSID "ssid"
#define HEADER_PASSWD "passwd" #define HEADER_PASSWD "passwd"
#define HEADER_CONFIRM "confirm" #define HEADER_CONFIRM "confirm"
@@ -270,6 +277,7 @@ static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_da
} }
} }
#endif ///BUT_PROFILE_CFG
static void ble_server_appRegister(void) static void ble_server_appRegister(void)
{ {