commponent bt:add bt_prf_task.c file for proceess the profile task event
add bt_prf_task.h for defined the data & struct used for the profile task add prodile_sys.h defined the profile system data used for profile task modified component.mk
This commit is contained in:
parent
d85ff46bdf
commit
3c792f427b
5 changed files with 155 additions and 2 deletions
|
@ -512,7 +512,7 @@ void bta_sys_event(BT_HDR *p_msg)
|
||||||
UINT8 id;
|
UINT8 id;
|
||||||
BOOLEAN freebuf = TRUE;
|
BOOLEAN freebuf = TRUE;
|
||||||
|
|
||||||
APPL_TRACE_EVENT("BTA got event 0x%x", p_msg->event);
|
APPL_TRACE_EVENT("BTA got event 0x%x\n", p_msg->event);
|
||||||
|
|
||||||
/* get subsystem id from event */
|
/* get subsystem id from event */
|
||||||
id = (UINT8) (p_msg->event >> 8);
|
id = (UINT8) (p_msg->event >> 8);
|
||||||
|
@ -524,7 +524,7 @@ void bta_sys_event(BT_HDR *p_msg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
APPL_TRACE_WARNING("BTA got unregistered event id %d", id);
|
APPL_TRACE_WARNING("BTA got unregistered event id %d\n", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freebuf)
|
if (freebuf)
|
||||||
|
|
72
components/bt/bluedroid/profiles/core/bt_prf_task.c
Normal file
72
components/bt/bluedroid/profiles/core/bt_prf_task.c
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/**
|
||||||
|
****************************************************************************************
|
||||||
|
*
|
||||||
|
* @file bt_prf_task.c
|
||||||
|
*
|
||||||
|
* @brief Application entry point
|
||||||
|
*
|
||||||
|
* Copyright (C) Espressif 2016
|
||||||
|
* Created by Yulong at 2016/10/11
|
||||||
|
*
|
||||||
|
*
|
||||||
|
****************************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bt_prf_task.h"
|
||||||
|
#include "allocator.h"
|
||||||
|
#include "thread.h"
|
||||||
|
#include "gki.h"
|
||||||
|
|
||||||
|
//thread_t *bt_workqueue_thread;
|
||||||
|
//static const char *BT_WORKQUEUE_NAME = "bt_workqueue";
|
||||||
|
xTaskHandle xProfileTaskHandle = NULL;
|
||||||
|
xQueueHandle xProfileQueue = 0;
|
||||||
|
|
||||||
|
// Communication queue between bt_proflie_task and app.
|
||||||
|
extern fixed_queue_t *bt_profile_msg_queue;
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
**
|
||||||
|
** Function bt_prf_task_thread_handler
|
||||||
|
**
|
||||||
|
** Description Process profile Task Thread.
|
||||||
|
******************************************************************************/
|
||||||
|
void bt_prf_task_thread_handler(void *arg)
|
||||||
|
{
|
||||||
|
//ke_event_clear(KE_EVENT_BTU_TASK_THREAD);
|
||||||
|
|
||||||
|
TaskEvt_t *e;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
if (pdTRUE == xQueueReceive(xProfileQueue, &e, (portTickType)portMAX_DELAY)) {
|
||||||
|
|
||||||
|
if (e->sig == SIG_BTU_WORK) {
|
||||||
|
fixed_queue_process(bt_profile_msg_queue);
|
||||||
|
}
|
||||||
|
else if (e->sig == SIG_BTU_START_UP) {
|
||||||
|
bt_prf_task_start_up();
|
||||||
|
}
|
||||||
|
osi_free(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_profile_msg_ready(fixed_queue_t *queue) {
|
||||||
|
BT_HDR *p_msg;
|
||||||
|
|
||||||
|
while (!fixed_queue_is_empty(queue)) {
|
||||||
|
p_msg = (BT_HDR *)fixed_queue_dequeue(queue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void bt_prf_task_start_up(void)
|
||||||
|
{
|
||||||
|
fixed_queue_register_dequeue(bt_profile_msg_queue, bt_profile_msg_ready);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
46
components/bt/bluedroid/profiles/core/include/bt_prf_task.h
Normal file
46
components/bt/bluedroid/profiles/core/include/bt_prf_task.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
****************************************************************************************
|
||||||
|
*
|
||||||
|
* @file bt_prf_task.h
|
||||||
|
*
|
||||||
|
* @brief Application entry point
|
||||||
|
*
|
||||||
|
* Copyright (C) Espressif 2016
|
||||||
|
* Created by Yulong at 2016/10/11
|
||||||
|
*
|
||||||
|
*
|
||||||
|
****************************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include "fixed_queue.h"
|
||||||
|
|
||||||
|
#ifndef BT_PRF_TASK_H__
|
||||||
|
#define BT_PRF_TASK_H__
|
||||||
|
|
||||||
|
/* Functions provided by btu_core.c
|
||||||
|
************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void bt_prf_task_thread_handler(void *arg);
|
||||||
|
|
||||||
|
void bt_prf_init_core(void);
|
||||||
|
void bt_prf_free_core(void);
|
||||||
|
|
||||||
|
void bt_prf_StartUp(void);
|
||||||
|
void bt_prf_ShutDown(void);
|
||||||
|
|
||||||
|
void bt_prf_task_start_up(void);
|
||||||
|
void bt_prf_task_shut_down(void);
|
||||||
|
|
||||||
|
void bt_profile_msg_ready(fixed_queue_t *queue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /// BT_PRF_TASK_H__
|
33
components/bt/bluedroid/profiles/core/include/profile_sys.h
Normal file
33
components/bt/bluedroid/profiles/core/include/profile_sys.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
****************************************************************************************
|
||||||
|
*
|
||||||
|
* @file profile_sys.h
|
||||||
|
*
|
||||||
|
* @brief Application entry point
|
||||||
|
*
|
||||||
|
* Copyright (C) Espressif 2016
|
||||||
|
* Created by Yulong at 2016/10/12
|
||||||
|
*
|
||||||
|
*
|
||||||
|
****************************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PROFILE_SYS_H__
|
||||||
|
#define _PROFILE_SYS_H__
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PRF_ID_SYS,
|
||||||
|
PRF_ID_CONN,
|
||||||
|
PRF_ID_HIDD_LE,
|
||||||
|
PRF_ID_HIDH_LE,
|
||||||
|
PRF_ID_DISS_LE,
|
||||||
|
PRF_ID_DISC_LE,
|
||||||
|
PRF_ID_AIRSYNC_LE,
|
||||||
|
PRF_ID_ANCC_LE,
|
||||||
|
PRF_ID_BUT_LE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif ///_PROFILE_SYS_H__
|
|
@ -9,6 +9,7 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
|
||||||
bluedroid/gki/include \
|
bluedroid/gki/include \
|
||||||
bluedroid/hci/include \
|
bluedroid/hci/include \
|
||||||
bluedroid/osi/include \
|
bluedroid/osi/include \
|
||||||
|
bluedroid/profiles/core/include \
|
||||||
bluedroid/profiles/esp/include \
|
bluedroid/profiles/esp/include \
|
||||||
bluedroid/profiles/std/avrc/include \
|
bluedroid/profiles/std/avrc/include \
|
||||||
bluedroid/profiles/std/battery/include \
|
bluedroid/profiles/std/battery/include \
|
||||||
|
@ -48,6 +49,7 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \
|
||||||
bluedroid/hci \
|
bluedroid/hci \
|
||||||
bluedroid/main \
|
bluedroid/main \
|
||||||
bluedroid/osi \
|
bluedroid/osi \
|
||||||
|
bluedroid/profiles/core \
|
||||||
bluedroid/profiles/esp/ble_button \
|
bluedroid/profiles/esp/ble_button \
|
||||||
bluedroid/profiles/esp/wechat_AirSync \
|
bluedroid/profiles/esp/wechat_AirSync \
|
||||||
bluedroid/profiles/esp \
|
bluedroid/profiles/esp \
|
||||||
|
|
Loading…
Reference in a new issue