mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
component/bt : delete extra GATTAPP_REGISTER
This commit is contained in:
parent
5fbfa2a01d
commit
8e247f3b4c
@ -1,23 +1,23 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file bt_app.c
|
||||
*
|
||||
* @brief Application entry point
|
||||
*
|
||||
* Copyright (C) Espressif 2016
|
||||
* Created by Yulong at 2016/9/9
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "blufi_adv.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function ESP_AppConfigadvData
|
||||
** Function BlufiConfigadvData
|
||||
**
|
||||
** Description This function is called to override the BTA default ADV parameters.
|
||||
**
|
||||
@ -29,7 +29,7 @@
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void ESP_AppBleConfigadvData(tESP_BLE_ADV_DATA *adv_data,
|
||||
void BlufiBleConfigadvData(tBLUFI_BLE_ADV_DATA *adv_data,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback)
|
||||
{
|
||||
tBTA_BLE_AD_MASK data_mask = 0;
|
||||
@ -103,7 +103,7 @@
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function ESP_BleSetScanRsp
|
||||
** Function BLUFI_BleSetScanRsp
|
||||
**
|
||||
** Description This function is called to override the app scan response.
|
||||
**
|
||||
@ -112,7 +112,7 @@
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void ESP_AppBleSetScanRsp(tESP_BLE_ADV_DATA *scan_rsp_data,
|
||||
void BlufiBleSetScanRsp(tBLUFI_BLE_ADV_DATA *scan_rsp_data,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback)
|
||||
{
|
||||
tBTA_BLE_AD_MASK data_mask = 0;
|
@ -1,16 +1,16 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file blufi_pro.c
|
||||
*
|
||||
* @brief Application entry point
|
||||
*
|
||||
* Copyright (C) Espressif 2016
|
||||
* Created by Yulong at 2016/8/18
|
||||
*
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -28,6 +28,63 @@
|
||||
#include "bta_gatts_int.h"
|
||||
|
||||
#include "blufi_prf.h"
|
||||
#include "blufi_adv.h"
|
||||
|
||||
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
|
||||
UINT16 esp32_uuid = SVC_BLUFI_UUID;
|
||||
UINT8 esp32_manu[17] = {0xff,0x20,0x14,0x07,0x22,0x00,0x02,0x5B,0x00,0x33,0x49,0x31,0x30,0x4a,0x30,0x30,0x31};
|
||||
tBTA_BLE_MANU p_esp32_manu = {sizeof(esp32_manu),esp32_manu}; /* manufacturer data */
|
||||
|
||||
tBTA_BLE_SERVICE esp32_service = {
|
||||
0x01, //only one service in the ijiazu button profile
|
||||
false,
|
||||
&esp32_uuid
|
||||
}; /* 16 bits services */
|
||||
|
||||
|
||||
tBLUFI_BLE_ADV_DATA esp32_adv_data[ADV_SCAN_IDX_MAX] =
|
||||
{
|
||||
[BLE_ADV_DATA_IDX] = {
|
||||
.adv_name = "Espressif_008",
|
||||
{
|
||||
{0,0},
|
||||
NULL, //no manufature data to be setting in the esp32 adervetisiing datas
|
||||
&esp32_service,
|
||||
NULL, //the 128 bits service uuid set to null(not used)
|
||||
NULL, //the 32 bits Service UUID set to null(not used)
|
||||
NULL, //16 bits services Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //proprietary data set to null(not used)
|
||||
NULL, //service data set not null(no service data to be sent)
|
||||
0x0200, //device type : generic display
|
||||
BTA_DM_GENERAL_DISC, // General discoverable.
|
||||
0xFE //the tx power value,defult value is 0
|
||||
},
|
||||
},
|
||||
|
||||
[BLE_SCAN_RSP_DATA_IDX] = {
|
||||
.adv_name = NULL,
|
||||
{
|
||||
{0,0},
|
||||
&p_esp32_manu,
|
||||
NULL,
|
||||
NULL, //the 128 bits service uuid set to null(not used)
|
||||
NULL, //the 32 bits Service UUID set to null(not used)
|
||||
NULL, //16 bits services Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //proprietary data set to null(not used)
|
||||
NULL, //service data set not null(no service data to be sent)
|
||||
0x0000, //device type : generic display
|
||||
0x00, // General discoverable.
|
||||
0x00}, //the tx power value,defult value is 0
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
static tBLUFI_CB_ENV blufi_cb_env;
|
||||
|
||||
@ -56,11 +113,13 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
UINT8 net_event = 0xff;
|
||||
UINT8 len = 0;
|
||||
UINT8 *p_rec_data = NULL;
|
||||
tBTA_GATT_STATUS status;
|
||||
|
||||
LOG_ERROR("blufi profile cb event = %x\n",event);
|
||||
switch(event) {
|
||||
case BTA_GATTS_REG_EVT:
|
||||
|
||||
status = p_data->reg_oper.status;
|
||||
|
||||
LOG_ERROR("p_data->reg_oper.status = %x\n",p_data->reg_oper.status);
|
||||
LOG_ERROR("(p_data->reg_oper.uuid.uu.uuid16=%x\n",p_data->reg_oper.uuid.uu.uuid16);
|
||||
if(p_data->reg_oper.status != BTA_GATT_OK) {
|
||||
@ -70,6 +129,15 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
|
||||
blufi_cb_env.gatt_if = p_data->reg_oper.server_if;
|
||||
blufi_cb_env.enabled = true;
|
||||
LOG_ERROR("register complete: event=%d, status=%d, server_if=%d\n",
|
||||
event, status, blufi_cb_env.gatt_if);
|
||||
|
||||
LOG_ERROR("set advertising parameters\n");
|
||||
//set the advertising data to the btm layer
|
||||
BlufiBleConfigadvData(&esp32_adv_data[BLE_ADV_DATA_IDX], NULL);
|
||||
//set the adversting data to the btm layer
|
||||
BlufiBleSetScanRsp(&esp32_adv_data[BLE_SCAN_RSP_DATA_IDX],NULL);
|
||||
BTA_GATTS_Listen(blufi_cb_env.gatt_if, true, NULL);
|
||||
|
||||
//create the blufi service to the service data base.
|
||||
if(p_data->reg_oper.uuid.uu.uuid16 == SVC_BLUFI_UUID) {
|
||||
@ -118,24 +186,9 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
if(p_data->add_result.char_uuid.uu.uuid16 == CHAR_BLUFI_UUID)
|
||||
{
|
||||
uuid.uu.uuid16 = CHAR_BLUFI_UUID;
|
||||
//tBTA_GATT_PERM perm = GATT_PERM_READ;
|
||||
//save the att handle to the env
|
||||
blufi_cb_env.blufi_inst.blufi_hdl = p_data->add_result.attr_id;
|
||||
//add the frist blufi characteristic --> Notify characteristic
|
||||
//BTA_GATTS_AddCharacteristic(blufi_cb_env.clcb.cur_srvc_id,&uuid,
|
||||
// GATT_PERM_READ,(GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY));
|
||||
}
|
||||
#if 0
|
||||
else if(p_data->add_result.char_uuid.uu.uuid16 == CHAR_BLUFI_UUID){ // add the gattc config descriptor to the notify charateristic
|
||||
//tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_WRITE);
|
||||
uuid.uu.uuid16 = GATT_UUID_CHAR_CLIENT_CONFIG;
|
||||
blufi_cb_env.blufi_inst.blufi_hdl = p_data->add_result.attr_id;
|
||||
BTA_GATTS_AddCharDescriptor (blufi_cb_env.clcb.cur_srvc_id,
|
||||
(GATT_PERM_WRITE|GATT_PERM_WRITE),
|
||||
&uuid);
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
case BTA_GATTS_ADD_CHAR_DESCR_EVT:
|
||||
if(p_data->add_result.char_uuid.uu.uuid16 == GATT_UUID_CHAR_CLIENT_CONFIG)
|
||||
@ -146,6 +199,13 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
case BTA_GATTS_CONNECT_EVT:
|
||||
//set the connection flag to true
|
||||
blufi_env_clcb_alloc(p_data->conn.conn_id, p_data->conn.remote_bda);
|
||||
LOG_ERROR("\ndevice is connected "BT_BD_ADDR_STR", server_if=%d,reason=0x%x,connect_id=%d\n",
|
||||
BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if,
|
||||
p_data->conn.reason, p_data->conn.conn_id);
|
||||
/*return whether the remote device is currently connected*/
|
||||
int is_connected = BTA_DmGetConnectionState(p_data->conn.remote_bda);
|
||||
LOG_ERROR("is_connected=%d\n",is_connected);
|
||||
BTA_DmBleBroadcast(0); //stop adv
|
||||
break;
|
||||
case BTA_GATTS_DISCONNECT_EVT:
|
||||
//set the connection flag to true
|
||||
|
@ -15,12 +15,12 @@ typedef struct
|
||||
{
|
||||
char *adv_name; //set the device name to be sent on the advertising
|
||||
tBTA_BLE_ADV_DATA ble_adv_data;
|
||||
}tESP_BLE_ADV_DATA;
|
||||
}tBLUFI_BLE_ADV_DATA;
|
||||
|
||||
extern void ESP_AppBleConfigadvData(tESP_BLE_ADV_DATA *adv_data,
|
||||
extern void BlufiBleConfigadvData(tBLUFI_BLE_ADV_DATA *adv_data,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
|
||||
|
||||
extern void ESP_AppBleSetScanRsp(tESP_BLE_ADV_DATA *scan_rsp_data,
|
||||
extern void BlufiBleSetScanRsp(tBLUFI_BLE_ADV_DATA *scan_rsp_data,
|
||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
|
||||
|
||||
#endif /* __BLUFI_ADV_H__ */
|
@ -9,6 +9,7 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
|
||||
bluedroid/gki/include \
|
||||
bluedroid/hci/include \
|
||||
bluedroid/osi/include \
|
||||
bluedroid/profiles/esp/blufi/include \
|
||||
bluedroid/profiles/esp/include \
|
||||
bluedroid/profiles/std/avrc/include \
|
||||
bluedroid/profiles/std/battery/include \
|
||||
|
@ -30,189 +30,13 @@
|
||||
#include "blufi.h"
|
||||
#include "blufi_adv.h"
|
||||
|
||||
static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data);
|
||||
static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data);
|
||||
|
||||
struct dm_evt {
|
||||
tBTA_DM_SEC_EVT event;
|
||||
tBTA_DM_SEC* p_data;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t uu[16];
|
||||
} bt_uuid_t;
|
||||
|
||||
|
||||
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
tBTA_GATTS_IF server_if;
|
||||
|
||||
static unsigned char BASE_UUID[16] = {
|
||||
0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
|
||||
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
UINT16 esp32_uuid = 0xffff;
|
||||
tBTA_BLE_SERVICE esp32_service = {
|
||||
0x01, //only one service in the esp32 button profile
|
||||
false,
|
||||
&esp32_uuid
|
||||
}; /* 16 bits services */
|
||||
|
||||
|
||||
UINT8 beacon_manu[25] = {
|
||||
0x4c, 0x00,0x02, 0x15, 0xfd, 0xa5, 0x06, 0x93, 0xa4, 0xe2,
|
||||
0x4f, 0xb1, 0xaf, 0xcf, 0xc6, 0xeb, 0x07, 0x64, 0x78, 0x25,
|
||||
0x27, 0x32, 0xe6, 0x08, 0xc5
|
||||
};
|
||||
|
||||
UINT8 esp32_manu[17] = {0xff,0x20,0x14,0x07,0x22,0x00,0x02,0x5B,0x00,0x33,0x49,0x31,0x30,0x4a,0x30,0x30,0x31};
|
||||
tBTA_BLE_MANU p_esp32_manu = {sizeof(esp32_manu),esp32_manu}; /* manufacturer data */
|
||||
|
||||
|
||||
BD_ADDR rand_esp32_addr = {0x00,0x02,0x5B,0x00,0x32,0x55};
|
||||
|
||||
tESP_BLE_ADV_DATA esp32_adv_data[ADV_SCAN_IDX_MAX] =
|
||||
{
|
||||
[BLE_ADV_DATA_IDX] = {
|
||||
.adv_name = "Espressif_008",
|
||||
{
|
||||
{0,0},
|
||||
NULL, //no manufature data to be setting in the esp32 adervetisiing datas
|
||||
&esp32_service,
|
||||
NULL, //the 128 bits service uuid set to null(not used)
|
||||
NULL, //the 32 bits Service UUID set to null(not used)
|
||||
NULL, //16 bits services Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //proprietary data set to null(not used)
|
||||
NULL, //service data set not null(no service data to be sent)
|
||||
0x0200, //device type : generic display
|
||||
BTA_DM_GENERAL_DISC, // General discoverable.
|
||||
0xFE //the tx power value,defult value is 0
|
||||
},
|
||||
},
|
||||
|
||||
[BLE_SCAN_RSP_DATA_IDX] = {
|
||||
.adv_name = NULL,
|
||||
{
|
||||
{0,0},
|
||||
&p_esp32_manu,
|
||||
NULL,
|
||||
NULL, //the 128 bits service uuid set to null(not used)
|
||||
NULL, //the 32 bits Service UUID set to null(not used)
|
||||
NULL, //16 bits services Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used)
|
||||
NULL, //proprietary data set to null(not used)
|
||||
NULL, //service data set not null(no service data to be sent)
|
||||
0x0000, //device type : generic display
|
||||
0x00, // General discoverable.
|
||||
0x00}, //the tx power value,defult value is 0
|
||||
}
|
||||
};
|
||||
|
||||
int uuidType(unsigned char* p_uuid)
|
||||
{
|
||||
int i = 0;
|
||||
int match = 0;
|
||||
int all_zero = 1;
|
||||
|
||||
for(i = 0; i != 16; ++i)
|
||||
{
|
||||
if (i == 12 || i == 13)
|
||||
continue;
|
||||
|
||||
if (p_uuid[i] == BASE_UUID[i])
|
||||
++match;
|
||||
|
||||
if (p_uuid[i] != 0)
|
||||
all_zero = 0;
|
||||
}
|
||||
if (all_zero)
|
||||
return 0;
|
||||
if (match == 12)
|
||||
return LEN_UUID_32;
|
||||
if (match == 14)
|
||||
return LEN_UUID_16;
|
||||
return LEN_UUID_128;
|
||||
}
|
||||
|
||||
/*16-bits uuid to the structure of holding any type of UUID*/
|
||||
void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src)
|
||||
{
|
||||
char *p_byte = (char*)p_src;
|
||||
|
||||
int i = 0;
|
||||
|
||||
p_dest->len = uuidType(p_src->uu);
|
||||
|
||||
switch (p_dest->len)
|
||||
{
|
||||
case LEN_UUID_16:
|
||||
p_dest->uu.uuid16 = (p_src->uu[13] << 8) + p_src->uu[12];
|
||||
break;
|
||||
|
||||
case LEN_UUID_32:
|
||||
p_dest->uu.uuid32 = (p_src->uu[13] << 8) + p_src->uu[12];
|
||||
p_dest->uu.uuid32 += (p_src->uu[15] << 24) + (p_src->uu[14] << 16);
|
||||
break;
|
||||
|
||||
case LEN_UUID_128:
|
||||
for(i = 0; i != 16; ++i)
|
||||
p_dest->uu.uuid128[i] = p_byte[i];
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR("%s: Unknown UUID length %d!", __FUNCTION__, p_dest->len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*set advertising config callback*/
|
||||
static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
|
||||
{
|
||||
LOG_ERROR("set advertising config:status=%d\n", call_status);
|
||||
blufi_profile_init(SimpleDataCallBack);
|
||||
}
|
||||
|
||||
/*register callback*/
|
||||
void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case BTA_GATTS_REG_EVT:
|
||||
{
|
||||
tBTA_GATT_STATUS status = p_data->reg_oper.status;
|
||||
server_if = p_data->reg_oper.server_if;
|
||||
LOG_ERROR("register complete: event=%d, status=%d, server_if=%d\n",
|
||||
event, status, server_if);
|
||||
|
||||
LOG_ERROR("set advertising parameters\n");
|
||||
//set the advertising data to the btm layer
|
||||
ESP_AppBleConfigadvData(&esp32_adv_data[BLE_ADV_DATA_IDX],
|
||||
bta_gatts_set_adv_data_cback);
|
||||
//set the adversting data to the btm layer
|
||||
ESP_AppBleSetScanRsp(&esp32_adv_data[BLE_SCAN_RSP_DATA_IDX],NULL);
|
||||
BTA_GATTS_Listen(server_if, true, NULL);
|
||||
}
|
||||
break;
|
||||
/*connect callback*/
|
||||
case BTA_GATTS_CONNECT_EVT:
|
||||
{
|
||||
LOG_ERROR("\ndevice is connected "BT_BD_ADDR_STR", server_if=%d,reason=0x%x,connect_id=%d\n",
|
||||
BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if,
|
||||
p_data->conn.reason, p_data->conn.conn_id);
|
||||
/*return whether the remote device is currently connected*/
|
||||
int is_connected = BTA_DmGetConnectionState(p_data->conn.remote_bda);
|
||||
LOG_ERROR("is_connected=%d\n",is_connected);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR("unsettled event: %d\n", event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#define HEADER_SSID "ssid"
|
||||
#define HEADER_PASSWD "passwd"
|
||||
#define HEADER_CONFIRM "confirm"
|
||||
@ -220,7 +44,7 @@ extern void wifi_set_blue_config(char *ssid, char *passwd);
|
||||
static char tmp_ssid[33];
|
||||
static char tmp_passwd[33];
|
||||
|
||||
static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
|
||||
static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
|
||||
{
|
||||
char *p = NULL;
|
||||
LOG_ERROR("the data is:%s\n", p_data);
|
||||
@ -255,17 +79,6 @@ static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_da
|
||||
|
||||
}
|
||||
|
||||
static void blufi_ble_server_appRegister(void)
|
||||
{
|
||||
bt_uuid_t uuid;
|
||||
tBT_UUID t_uuid;
|
||||
memcpy(&uuid, BASE_UUID, sizeof(bt_uuid_t));
|
||||
btif_to_bta_uuid(&t_uuid, &uuid);
|
||||
|
||||
LOG_ERROR("register gatts application\n");
|
||||
BTA_GATTS_AppRegister(&t_uuid, bta_gatts_callback);
|
||||
}
|
||||
|
||||
static BtStatus_t blufi_dm_upstreams_evt(void *arg)
|
||||
{
|
||||
struct dm_evt *evt = (struct dm_evt *)arg;
|
||||
@ -288,7 +101,7 @@ static BtStatus_t blufi_dm_upstreams_evt(void *arg)
|
||||
LOG_ERROR("BDA is: %s\n", bdstr);
|
||||
} while (0);
|
||||
#endif
|
||||
blufi_ble_server_appRegister();
|
||||
blufi_profile_init(BlufiDataCallBack);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -87,23 +87,23 @@ void wifiTestTask(void *pvParameters)
|
||||
|
||||
while (1) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
if (confirm) {
|
||||
confirm = false;
|
||||
BTA_DisableBluetooth();
|
||||
if (confirm) {
|
||||
confirm = false;
|
||||
//BTA_DisableBluetooth();
|
||||
|
||||
strcpy(sta_config.sta.ssid, tmp_ssid);
|
||||
strcpy(sta_config.sta.password, tmp_passwd);
|
||||
sta_config.sta.bssid_set = 0;
|
||||
strcpy(sta_config.sta.ssid, tmp_ssid);
|
||||
strcpy(sta_config.sta.password, tmp_passwd);
|
||||
sta_config.sta.bssid_set = 0;
|
||||
|
||||
ret = esp_wifi_disconnect();
|
||||
printf("esp_wifi config\n");
|
||||
esp_wifi_set_config(WIFI_IF_STA, &sta_config);
|
||||
printf("esp_wifi connect\n");
|
||||
ret = esp_wifi_connect();
|
||||
if (ret != ESP_OK) {
|
||||
printf("esp_wifi connect failed\n");
|
||||
ret = esp_wifi_disconnect();
|
||||
printf("esp_wifi config\n");
|
||||
esp_wifi_set_config(WIFI_IF_STA, &sta_config);
|
||||
printf("esp_wifi connect\n");
|
||||
ret = esp_wifi_connect();
|
||||
if (ret != ESP_OK) {
|
||||
printf("esp_wifi connect failed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user