boolean accept( size_t time_out = 20 );
boolean accept( size_t time_out = 20 );
Accepts a Bluetooth SPP client's connection request. Returns as long as the connection is made or the request has reached timeout limit.
|
Parameters |
Description |
|
size_t time_out = 20 |
The timeout for accepting connection. |
true: Successful.
false: Failed.
#include <LBT.h> #include <LBTServer.h> void setup() { Serial.begin(9600); bool success = LBTServer.begin(); if( !success ) { Serial.println("Cannot begin Bluetooth Server successfully"); // Do nothing. while(true); } else { Serial.println("Bluetooth Server begins successfully"); } // Waiting for SPP Client to connect. bool connected = LBTServer.accept(20); if( !connected ) { Serial.println("No connection request yet"); // Do nothing. while(true); } else { Serial.println("Connected"); } } void loop() { }
LBTServer.h