Skip to content

Commit 3a4ec66

Browse files
copercinime-no-dev
authored andcommitted
Add hasClient for BluetoothSerial (espressif#1183)
* Add hasClient for BluetoothSerial * Add SPP_TAG
1 parent e9ee0ab commit 3a4ec66

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

‎libraries/BluetoothSerial/keywords.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BluetoothSerial KEYWORD1
1919
#######################################
2020

2121
SerialBT KEYWORD2
22-
22+
hasClient KEYWORD2
2323

2424
#######################################
2525
# Constants (LITERAL1)

‎libraries/BluetoothSerial/src/BluetoothSerial.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include"esp_spp_api.h"
3030

3131
#defineSPP_SERVER_NAME"ESP32_SPP_SERVER"
32+
#defineSPP_TAG"BluetoothSerial"
3233

3334
#defineQUEUE_SIZE256
3435
uint32_t client;
@@ -188,6 +189,14 @@ int BluetoothSerial::peek(void)
188189
return -1;
189190
}
190191

192+
boolBluetoothSerial::hasClient(void)
193+
{
194+
if (client)
195+
returntrue;
196+
197+
returnfalse;
198+
}
199+
191200
intBluetoothSerial::read(void)
192201
{
193202
if (available()){

‎libraries/BluetoothSerial/src/BluetoothSerial.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class BluetoothSerial: public Stream
4040
boolbegin(String localName=String());
4141
intavailable(void);
4242
intpeek(void);
43+
boolhasClient(void);
4344
intread(void);
4445
size_twrite(uint8_t c);
4546
size_twrite(constuint8_t *buffer, size_t size);

0 commit comments

Comments
(0)