A59 -V1.1版本提交
This commit is contained in:
@ -8,6 +8,7 @@ QueueHandle_t rx_queue = NULL;
|
||||
int initialize_timeout = 0;
|
||||
bt_at_callback gCallback = NULL;
|
||||
static void* gCbContex = NULL;
|
||||
static TaskHandle_t console_task_handle = NULL;
|
||||
|
||||
/*
|
||||
example to demonstrate that:
|
||||
@ -17,11 +18,11 @@ static void* gCbContex = NULL;
|
||||
note:
|
||||
the applicaton should process data as soon as possilbe (otherwise the queue may overflow)
|
||||
*/
|
||||
static void* console_task(void* arg)
|
||||
static void console_task(void* arg)
|
||||
{
|
||||
char buf[AT_CMD_PAYLOAD_LEN];
|
||||
char buf[AT_CMD_PAYLOAD_LEN];
|
||||
|
||||
gCbContex = gCbContex;//make iar happy
|
||||
gCbContex = gCbContex;//make iar happy
|
||||
for (;;)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
@ -40,6 +41,7 @@ static void* console_task(void* arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
response[response_len-2] = '\0';
|
||||
response += 2;
|
||||
|
||||
@ -50,23 +52,28 @@ static void* console_task(void* arg)
|
||||
if(strlen(response) > 4 && !memcmp(response,"+VER",4))
|
||||
{
|
||||
console_send_atcmd("AT+NAME\r\n", strlen("AT+NAME\r\n"));
|
||||
// }else{
|
||||
// parseBtATCommand(response,response_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int console_init(bt_at_callback cb)
|
||||
{
|
||||
pthread_t task;
|
||||
pthread_attr_t attr;
|
||||
if (NULL == gCallback)
|
||||
gCallback = cb;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setstacksize(&attr, 4096 * 3);
|
||||
pthread_create(&task, &attr, console_task, NULL);
|
||||
pthread_t task;
|
||||
pthread_attr_t attr;
|
||||
if (NULL == gCallback)
|
||||
{
|
||||
gCallback = cb;
|
||||
}
|
||||
|
||||
if (xTaskCreate(console_task, "console", 4096, NULL,
|
||||
configMAX_PRIORITIES / 3, &console_task_handle) != pdPASS) {
|
||||
printf("create console_task task fail.\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user