Skip to content

Commit 533c170

Browse files
committed
Change BTSerial log calls
1 parent 07a0fff commit 533c170

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,47 +56,47 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
5656
switch (event)
5757
{
5858
case ESP_SPP_INIT_EVT:
59-
ESP_LOGI(SPP_TAG, "ESP_SPP_INIT_EVT");
59+
log_i("ESP_SPP_INIT_EVT");
6060
esp_bt_gap_set_scan_mode(ESP_BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
6161
esp_spp_start_srv(sec_mask, role_slave, 0, SPP_SERVER_NAME);
6262
break;
63-
case ESP_SPP_DISCOVERY_COMP_EVT:
64-
ESP_LOGI(SPP_TAG, "ESP_SPP_DISCOVERY_COMP_EVT");
63+
case ESP_SPP_DISCOVERY_COMP_EVT://discovery complete
64+
log_i("ESP_SPP_DISCOVERY_COMP_EVT");
6565
break;
66-
case ESP_SPP_OPEN_EVT:
67-
ESP_LOGI(SPP_TAG, "ESP_SPP_OPEN_EVT");
66+
case ESP_SPP_OPEN_EVT://Client connection open
67+
log_i("ESP_SPP_OPEN_EVT");
6868
break;
69-
case ESP_SPP_CLOSE_EVT:
69+
case ESP_SPP_CLOSE_EVT://Client connection closed
7070
client = 0;
71-
ESP_LOGI(SPP_TAG, "ESP_SPP_CLOSE_EVT");
71+
log_i("ESP_SPP_CLOSE_EVT");
7272
break;
73-
case ESP_SPP_START_EVT:
74-
ESP_LOGI(SPP_TAG, "ESP_SPP_START_EVT");
73+
case ESP_SPP_START_EVT://server started
74+
log_i("ESP_SPP_START_EVT");
7575
break;
76-
case ESP_SPP_CL_INIT_EVT:
77-
ESP_LOGI(SPP_TAG, "ESP_SPP_CL_INIT_EVT");
76+
case ESP_SPP_CL_INIT_EVT://client initiated a connection
77+
log_i("ESP_SPP_CL_INIT_EVT");
7878
break;
79-
case ESP_SPP_DATA_IND_EVT:
80-
ESP_LOGV(SPP_TAG, "ESP_SPP_DATA_IND_EVT len=%d handle=%d", param->data_ind.len, param->data_ind.handle);
79+
case ESP_SPP_DATA_IND_EVT://connection received data
80+
log_v("ESP_SPP_DATA_IND_EVT len=%d handle=%d", param->data_ind.len, param->data_ind.handle);
8181
//esp_log_buffer_hex("",param->data_ind.data,param->data_ind.len); //for low level debug
8282

8383
if (SerialQueueBT != 0){
8484
for (int i = 0; i < param->data_ind.len; i++)
8585
xQueueSend(SerialQueueBT, param->data_ind.data + i, (TickType_t)0);
8686
}
8787
else {
88-
ESP_LOGE(SPP_TAG, "SerialQueueBT ERROR");
88+
log_e("SerialQueueBT ERROR");
8989
}
9090
break;
91-
case ESP_SPP_CONG_EVT:
92-
ESP_LOGI(SPP_TAG, "ESP_SPP_CONG_EVT");
91+
case ESP_SPP_CONG_EVT://connection congestion status changed
92+
log_i("ESP_SPP_CONG_EVT");
9393
break;
94-
case ESP_SPP_WRITE_EVT:
95-
ESP_LOGV(SPP_TAG, "ESP_SPP_WRITE_EVT");
94+
case ESP_SPP_WRITE_EVT://write operation completed
95+
log_v("ESP_SPP_WRITE_EVT");
9696
break;
97-
case ESP_SPP_SRV_OPEN_EVT:
97+
case ESP_SPP_SRV_OPEN_EVT://Server connection open
9898
client = param->open.handle;
99-
ESP_LOGI(SPP_TAG, "ESP_SPP_SRV_OPEN_EVT");
99+
log_i("ESP_SPP_SRV_OPEN_EVT");
100100
break;
101101
default:
102102
break;
@@ -106,38 +106,38 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
106106
static bool _init_bt(const char *deviceName)
107107
{
108108
if (!btStarted() && !btStart()){
109-
ESP_LOGE(SPP_TAG, "%s initialize controller failed\n", __func__);
109+
log_e("%s initialize controller failed\n", __func__);
110110
return false;
111111
}
112112

113113
esp_bluedroid_status_t bt_state = esp_bluedroid_get_status();
114114
if (bt_state == ESP_BLUEDROID_STATUS_UNINITIALIZED){
115115
if (esp_bluedroid_init()) {
116-
ESP_LOGE(SPP_TAG, "%s initialize bluedroid failed\n", __func__);
116+
log_e("%s initialize bluedroid failed\n", __func__);
117117
return false;
118118
}
119119
}
120120

121121
if (bt_state != ESP_BLUEDROID_STATUS_ENABLED){
122122
if (esp_bluedroid_enable()) {
123-
ESP_LOGE(SPP_TAG, "%s enable bluedroid failed\n", __func__);
123+
log_e("%s enable bluedroid failed\n", __func__);
124124
return false;
125125
}
126126
}
127127

128128
if (esp_spp_register_callback(esp_spp_cb) != ESP_OK){
129-
ESP_LOGE(SPP_TAG, "%s spp register failed\n", __func__);
129+
log_e("%s spp register failed\n", __func__);
130130
return false;
131131
}
132132

133133
if (esp_spp_init(esp_spp_mode) != ESP_OK){
134-
ESP_LOGE(SPP_TAG, "%s spp init failed\n", __func__);
134+
log_e("%s spp init failed\n", __func__);
135135
return false;
136136
}
137137

138138
SerialQueueBT = xQueueCreate(QUEUE_SIZE, sizeof(uint8_t)); //initialize the queue
139139
if (SerialQueueBT == NULL){
140-
ESP_LOGE(SPP_TAG, "%s Queue creation error\n", __func__);
140+
log_e("%s Queue creation error\n", __func__);
141141
return false;
142142
}
143143
esp_bt_dev_set_device_name(deviceName);

0 commit comments

Comments
 (0)