File tree 1 file changed +12
-2
lines changed
Filter options
libraries/BluetoothSerial/src 1 file changed +12
-2
lines changed
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ static xQueueHandle _spp_tx_queue = NULL;
50
50
static SemaphoreHandle_t _spp_tx_done = NULL ;
51
51
static TaskHandle_t _spp_task_handle = NULL ;
52
52
static EventGroupHandle_t _spp_event_group = NULL ;
53
+ static boolean secondConnectionAttempt;
53
54
54
55
#define SPP_RUNNING 0x01
55
56
#define SPP_CONNECTED 0x02
@@ -162,13 +163,22 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
162
163
break ;
163
164
164
165
case ESP_SPP_SRV_OPEN_EVT:// Server connection open
165
- _spp_client = param->open .handle ;
166
+ if (!_spp_client){
167
+ _spp_client = param->open .handle ;
168
+ } else {
169
+ secondConnectionAttempt = true ;
170
+ esp_spp_disconnect (param->open .handle );
171
+ }
166
172
xEventGroupSetBits (_spp_event_group, SPP_CONNECTED);
167
173
log_i (" ESP_SPP_SRV_OPEN_EVT" );
168
174
break ;
169
175
170
176
case ESP_SPP_CLOSE_EVT:// Client connection closed
171
- _spp_client = 0 ;
177
+ if (secondConnectionAttempt) {
178
+ secondConnectionAttempt = false ;
179
+ } else {
180
+ _spp_client = 0 ;
181
+ }
172
182
xEventGroupClearBits (_spp_event_group, SPP_CONNECTED);
173
183
log_i (" ESP_SPP_CLOSE_EVT" );
174
184
break ;
You can’t perform that action at this time.
0 commit comments