USB Host Shield 2.0
|
#include <SPP.h>
Public Member Functions | |
SPP (BTD *p, const char *name="Arduino", const char *pin="0000") | |
operator bool () | |
Serial port profile (SPP) Print functions | |
int | available (void) |
void | flush (void) |
int | peek (void) |
int | read (void) |
size_t | write (uint8_t data) |
size_t | write (const uint8_t *data, size_t size) |
void | discard (void) |
void | send (void) |
Public Member Functions inherited from BluetoothService | |
BluetoothService (BTD *p) | |
void | attachOnInit (void(*funcOnInit)(void)) |
Public Attributes | |
bool | connected |
BluetoothService implementation | |
void | disconnect () |
void | ACLData (uint8_t *ACLData) |
void | Run () |
void | Reset () |
void | onInit () |
Additional Inherited Members | |
Protected Member Functions inherited from BluetoothService | |
bool | checkHciHandle (uint8_t *buf, uint16_t handle) |
Protected Attributes inherited from BluetoothService | |
void(* | pFuncOnInit )(void) |
BTD * | pBtd |
uint16_t | hci_handle |
uint32_t | l2cap_event_flag |
uint8_t | identifier |
This BluetoothService class implements the Serial Port Protocol (SPP). It inherits the Arduino Stream class. This allows it to use all the standard Arduino print and stream functions.
SPP::SPP | ( | BTD * | p, |
const char * | name = "Arduino" , |
||
const char * | pin = "0000" |
||
) |
Constructor for the SPP class.
p | Pointer to BTD class instance. |
name | Set the name to BTD::btdName. If argument is omitted, then "Arduino" will be used. |
pin | Write the pin to BTD::btdPin. If argument is omitted, then "0000" will be used. |
|
virtual |
Used this to disconnect the virtual serial port.
Implements BluetoothService.
|
inline |
int SPP::available | ( | void | ) |
|
inline |
int SPP::peek | ( | void | ) |
int SPP::read | ( | void | ) |
size_t SPP::write | ( | uint8_t | data | ) |
size_t SPP::write | ( | const uint8_t * | data, |
size_t | size | ||
) |
void SPP::discard | ( | void | ) |
void SPP::send | ( | void | ) |
|
protectedvirtual |
Used to pass acldata to the services.
ACLData | Incoming acldata. |
Implements BluetoothService.
|
protectedvirtual |
Used to establish the connection automatically.
Implements BluetoothService.
|
protectedvirtual |
|
protectedvirtual |
Called when a device is successfully initialized. Use attachOnInit(void (*funcOnInit)(void)) to call your own function. This is useful for instance if you want to set the LEDs in a specific way.
Implements BluetoothService.
bool SPP::connected |