Commit b0f55ede authored by wangxuhui's avatar wangxuhui

Merge branch 'develop' into 'release'

合并请求241219

See merge request !14
parents dffbd138 3f1edad1
...@@ -13,12 +13,18 @@ BT_User_Control_Struct BT_User; ...@@ -13,12 +13,18 @@ BT_User_Control_Struct BT_User;
#define BT_ReConn_T 300 #define BT_ReConn_T 300
#define IPHNOE_ACTIVE_CONNENT 0X113
void BT_User_Init(void ) void BT_User_Init(void )
{ {
BT_User.BT_Sts = BT_Idle; BT_User.BT_Sts = BT_Idle;
BT_User.Call_Sts = Call_Idle; BT_User.Call_Sts = Call_Idle;
BT_User.ReconnTime = BT_ReConn_T - 50; BT_User.ReconnTime = BT_ReConn_T - 50;
BT_User.HF_Ctrl = HF_Idle; BT_User.HF_Ctrl = HF_Idle;
BT_User.BT_DisConnReason = 0xffff;
BT_User.Get_Call_Num = 0;
BT_User.Call_Fitter_sts = Call_Idle;
BT_User.HfClient_Req_Cnt = 0;
} }
...@@ -29,6 +35,11 @@ void BT_Connect_Event_Pro(void ) ...@@ -29,6 +35,11 @@ void BT_Connect_Event_Pro(void )
BT_User.ReconnTime = BT_ReConn_T - 50; BT_User.ReconnTime = BT_ReConn_T - 50;
BT_User.HF_Ctrl = HF_Idle; BT_User.HF_Ctrl = HF_Idle;
// printf("TB CONN\r\n"); // printf("TB CONN\r\n");
BT_User.BT_DisConnReason = 0xffff;
BT_User.Get_Call_Num = 0;
BT_User.Call_Fitter_sts = Call_Idle;
BT_User.HfClient_Req_Cnt = 0;
} }
...@@ -39,6 +50,10 @@ void BT_DisConnect_Event_Pro(void ) ...@@ -39,6 +50,10 @@ void BT_DisConnect_Event_Pro(void )
BT_User.ReconnTime = BT_ReConn_T - 50; BT_User.ReconnTime = BT_ReConn_T - 50;
BT_User.HF_Ctrl = HF_Idle; BT_User.HF_Ctrl = HF_Idle;
// printf("TB DISCONN\r\n"); // printf("TB DISCONN\r\n");
BT_User.Get_Call_Num = 0;
BT_User.Call_Fitter_sts = Call_Idle;
BT_User.HfClient_Req_Cnt = 0;
} }
void BT_User_Process(void ) void BT_User_Process(void )
...@@ -98,7 +113,8 @@ void BT_User_Process(void ) ...@@ -98,7 +113,8 @@ void BT_User_Process(void )
BT_User.HF_Ctrl = HF_Idle; BT_User.HF_Ctrl = HF_Idle;
// if(BT_User.BT_DisConnReason != IPHNOE_ACTIVE_CONNENT)
{
if(BT_User.BT_Sts == BT_Idle) if(BT_User.BT_Sts == BT_Idle)
{ {
BT_User.ReconnTime++; BT_User.ReconnTime++;
...@@ -115,8 +131,6 @@ void BT_User_Process(void ) ...@@ -115,8 +131,6 @@ void BT_User_Process(void )
BT_User.ReconnTime = 0; BT_User.ReconnTime = 0;
} }
} }
else
{
} }
} }
......
...@@ -31,6 +31,7 @@ typedef enum ...@@ -31,6 +31,7 @@ typedef enum
typedef struct typedef struct
{ {
uint8_t BT_Sts; uint8_t BT_Sts;
uint32_t BT_DisConnReason;
uint8_t Call_Sts; uint8_t Call_Sts;
uint16_t ReconnTime; uint16_t ReconnTime;
uint8_t HF_Ctrl; uint8_t HF_Ctrl;
...@@ -38,6 +39,7 @@ typedef struct ...@@ -38,6 +39,7 @@ typedef struct
// char CCLC[11]; // char CCLC[11];
char Get_Call_Num; char Get_Call_Num;
char Call_Fitter_sts; char Call_Fitter_sts;
uint8_t HfClient_Req_Cnt;
}BT_User_Control_Struct; }BT_User_Control_Struct;
extern BT_User_Control_Struct BT_User; extern BT_User_Control_Struct BT_User;
......
...@@ -669,7 +669,6 @@ void Ble_User_Task_Event(void *pvParameter) ...@@ -669,7 +669,6 @@ void Ble_User_Task_Event(void *pvParameter)
vTaskDelete(NULL); vTaskDelete(NULL);
} }
uint8_t BT_User_HfClient_Req_Cnt;
void Ble_User_Task_Cyc(void *pvParameter) void Ble_User_Task_Cyc(void *pvParameter)
{ {
while (1) while (1)
...@@ -690,15 +689,15 @@ void Ble_User_Task_Cyc(void *pvParameter) ...@@ -690,15 +689,15 @@ void Ble_User_Task_Cyc(void *pvParameter)
if(BT_User.Call_Sts != Call_Idle) if(BT_User.Call_Sts != Call_Idle)
{ {
if(BT_User_HfClient_Req_Cnt ++ >= 15) if(BT_User.HfClient_Req_Cnt ++ >= 15)
{ {
BT_User_HfClient_Req_Cnt = 0; BT_User.HfClient_Req_Cnt = 0;
esp_hf_client_query_current_calls(); esp_hf_client_query_current_calls();
} }
} }
else else
{ {
BT_User_HfClient_Req_Cnt = 0; BT_User.HfClient_Req_Cnt = 0;
} }
BT_User_Process(); BT_User_Process();
......
...@@ -184,6 +184,24 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param) ...@@ -184,6 +184,24 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
// printf("event state %d\n", event); // printf("event state %d\n", event);
break; break;
case ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT:
// ESP_LOGE(BT_HF_TAG, "BT CONN");
// printf("stat :%d \r\n",param->acl_conn_cmpl_stat.stat);
if (param->acl_conn_cmpl_stat.stat == ESP_BT_STATUS_HCI_SUCCESS)
{
// BT_Connect_Event_Pro();
ESP_LOGI(BT_HF_TAG, "BT CONN");
}
break;
/* when ACL disconnection completed, this event comes */
case ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT:
// ESP_LOGW(BT_HF_TAG, "BT DISCONN REASON %x", param->acl_disconn_cmpl_stat.reason);
// BT_DisConnect_Event_Pro();
BT_User.BT_DisConnReason = param->acl_disconn_cmpl_stat.reason;
break;
default: { default: {
ESP_LOGI(BT_HF_TAG, "event: %d", event); ESP_LOGI(BT_HF_TAG, "event: %d", event);
// printf("event state %d\n", event); // printf("event state %d\n", event);
......
...@@ -902,24 +902,48 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_ ...@@ -902,24 +902,48 @@ static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_
void Get_Mac_Init(void ) void Get_Mac_Init(void )
{ {
unsigned int i = 0;
uint64_t ble_mac_num = 0;
uint8_t ble_mac[10] = {0}; uint8_t ble_mac[10] = {0};
char temp[10] = {0}; char temp[10] = {0};
char temp1[20] = {0}; char temp1[20] = {0};
esp_read_mac(ble_mac, ESP_MAC_BT); esp_read_mac(ble_mac, ESP_MAC_BT);
// printf("%d\n",temp); // printf("%d\n",temp);
for(i = 6; i > 0; i--)
{
ble_mac_num = (ble_mac_num << 8) | ble_mac[i-1];
// printf("%x ",ble_mac[i-1]);
}
// printf("%llx\r\n",ble_mac_num);
ble_mac_num = ble_mac_num % 500000;
// printf("%llx\r\n",ble_mac_num);
// sprintf(temp, "%02X%02X", ble_mac[4], ble_mac[5]); // sprintf(temp, "%02X%02X", ble_mac[4], ble_mac[5]);
int g; ble_mac[0] = ble_mac_num/100000;
ble_mac_num %= 100000;
ble_mac[1] = ble_mac_num/10000;
ble_mac_num %= 10000;
ble_mac[2] = ble_mac_num/1000;
ble_mac_num %= 1000;
ble_mac[3] = ble_mac_num/100;
ble_mac_num %= 100;
ble_mac[4] = ble_mac_num/10;
ble_mac_num %= 10;
ble_mac[5] = ble_mac_num%10;
// for (i = 1; i < 6; i++)
// {
// printf("%d ",ble_mac[i]);
// }
// printf("\r\n");
unsigned int g;
for(g=0;g<6;g++) for(g=0;g<6;g++)
{ {
srand ((int)ble_mac[g]);
if(g == 0) if(g == 0)
{ {
temp[g] = (char)rand()%5; temp[g] = (ble_mac[g] % 5);
} }
else else
{ {
temp[g] = (char)rand()%10; temp[g] = (ble_mac[g] % 10);
temp[g] += 48; temp[g] += 48;
} }
// printf("%d ",temp[g]); // printf("%d ",temp[g]);
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#define _MAIN_USER_H_ #define _MAIN_USER_H_
#define BL_INTERNAL_SW_YEAR 0x24 #define BL_INTERNAL_SW_YEAR 0x24
#define BL_INTERNAL_SW_MONTH 0x11 #define BL_INTERNAL_SW_MONTH 0x12
#define BL_INTERNAL_SW_DAY 0x12 #define BL_INTERNAL_SW_DAY 0x19
#endif #endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment