@@ -118,6 +118,36 @@ bool bluetoothIsConnected()
118
118
return (false );
119
119
}
120
120
121
+ // Return true if the BLE Command channel is connected
122
+ bool bluetoothCommandIsConnected ()
123
+ {
124
+ #ifdef COMPILE_BT
125
+ if (bluetoothGetState () == BT_OFF)
126
+ return (false );
127
+
128
+ if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_AND_BLE)
129
+ {
130
+ if (bluetoothSerialBleCommands->connected () == true )
131
+ return (true );
132
+ }
133
+ else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP)
134
+ {
135
+ return (false );
136
+ }
137
+ else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE)
138
+ {
139
+ if (bluetoothSerialBleCommands->connected () == true )
140
+ return (true );
141
+ }
142
+ else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_SPP_ACCESSORY_MODE)
143
+ {
144
+ return (false );
145
+ }
146
+ #endif // COMPILE_BT
147
+
148
+ return (false );
149
+ }
150
+
121
151
// Return the Bluetooth state
122
152
byte bluetoothGetState ()
123
153
{
@@ -254,23 +284,19 @@ int bluetoothCommandAvailable()
254
284
}
255
285
256
286
// Pass a command string to the BLE Serial interface
257
- void bluetoothProcessCommand (char *rxData)
287
+ void bluetoothSendCommand (char *rxData)
258
288
{
259
289
#ifdef COMPILE_BT
260
290
// Direct output to Bluetooth Command
261
291
PrintEndpoint originalPrintEndpoint = printEndpoint;
262
292
263
- printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
264
- if (settings.debugCLI == true )
265
- printEndpoint = PRINT_ENDPOINT_ALL;
266
- else
267
- printEndpoint = PRINT_ENDPOINT_BLUETOOTH_COMMAND;
293
+ printEndpoint = PRINT_ENDPOINT_ALL;
268
294
269
- processCommand (rxData); // Send command proccesor output to BLE
295
+ systemPrint (rxData); // Send command output to BLE, SPP, and Serial
270
296
printEndpoint = originalPrintEndpoint;
271
297
272
298
#else // COMPILE_BT
273
- processCommand (rxData); // Send command proccesor output to Serial
299
+ systemPrint (rxData); // Send command output to Serial
274
300
#endif // COMPILE_BT
275
301
}
276
302
@@ -534,9 +560,9 @@ void bluetoothStart()
534
560
memcpy (record.uuid .uuid .uuid128 , UUID_IAP2, sizeof (UUID_IAP2));
535
561
record.service_name_length = strlen (sdp_service_name) + 1 ;
536
562
record.service_name = (char *)sdp_service_name;
537
- // record.service_name_length = strlen(deviceName) + 1; // Doesn't seem to help the failed connects
538
- // record.service_name = (char *)deviceName;
539
- // record.rfcomm_channel_number = 1; // Doesn't seem to help the failed connects
563
+ // record.service_name_length = strlen(deviceName) + 1; // Doesn't seem to help the failed connects
564
+ // record.service_name = (char *)deviceName;
565
+ // record.rfcomm_channel_number = 1; // Doesn't seem to help the failed connects
540
566
esp_sdp_create_record ((esp_bluetooth_sdp_record_t *)&record);
541
567
}
542
568
}
0 commit comments