8000 Add hasClient for BluetoothSerial (#1183) · torst3n/arduino-esp32@3a4ec66 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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
#define SPP_SERVER_NAME "ESP32_SPP_SERVER"
32+
#define SPP_TAG "BluetoothSerial"
3233

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

192+
bool BluetoothSerial::hasClient(void)
193+
{
194+
if (client)
195+
return true;
196+
197+
return false;
198+
}
199+
191200
int BluetoothSerial::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
bool begin(String localName=String());
4141
int available(void);
4242
int peek(void);
43+
bool hasClient(void);
4344
int read(void);
4445
size_t write(uint8_t c);
4546
size_t write(const uint8_t *buffer, size_t size);

0 commit comments

Comments
 (0)
0