USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Public Attributes | List of all members
SPP Class Reference

#include <SPP.h>

Inheritance diagram for SPP:
Inheritance graph
[legend]
Collaboration diagram for SPP:
Collaboration graph
[legend]

Public Member Functions

 SPP (BTD *p, const char *name="Arduino", const char *pin="1234")
 
 operator bool ()
 
BluetoothService implementation
virtual void ACLData (uint8_t *ACLData)
 
virtual void Run ()
 
virtual void Reset ()
 
virtual void disconnect ()
 
Serial port profile (SPP) Print functions
virtual int available (void)
 
virtual void flush (void)
 
virtual int peek (void)
 
virtual int read (void)
 
virtual size_t write (uint8_t data)
 
virtual size_t write (const uint8_t *data, size_t size)
 
void send (void)
 

Public Attributes

bool connected
 

Detailed Description

This BluetoothService class implements the Serial Port Protocol (SPP).

Definition at line 93 of file SPP.h.

Constructor & Destructor Documentation

SPP::SPP ( BTD p,
const char *  name = "Arduino",
const char *  pin = "1234" 
)

Constructor for the SPP class.

Parameters
pPointer to BTD class instance.
nameSet the name to BTD::btdName. If argument is omitted, then "Arduino" will be used.
pinWrite the pin to BTD::btdPin. If argument is omitted, then "1234" will be used.

Definition at line 45 of file SPP.cpp.

Member Function Documentation

SPP::operator bool ( )
inline

Used to provide Boolean tests for the class.

Returns
Return true if SPP communication is connected.

Definition at line 107 of file SPP.h.

void SPP::ACLData ( uint8_t *  ACLData)
virtual

Used to pass acldata to the services.

Parameters
ACLDataIncoming acldata.

Reimplemented from BluetoothService.

Definition at line 86 of file SPP.cpp.

void SPP::Run ( )
virtual

Used to establish the connection automatically.

Reimplemented from BluetoothService.

Definition at line 429 of file SPP.cpp.

void SPP::Reset ( )
virtual

Use this to reset the service.

Reimplemented from BluetoothService.

Definition at line 63 of file SPP.cpp.

void SPP::disconnect ( )
virtual

Used this to disconnect the virtual serial port.

Reimplemented from BluetoothService.

Definition at line 74 of file SPP.cpp.

int SPP::available ( void  )
virtual

Get number of bytes waiting to be read.

Returns
Return the number of bytes ready to be read.

Definition at line 800 of file SPP.cpp.

void SPP::flush ( void  )
virtual

Discard all the bytes in the buffer.

Definition at line 804 of file SPP.cpp.

int SPP::peek ( void  )
virtual

Used to read the next value in the buffer without advancing to the next one.

Returns
Return the byte. Will return -1 if no bytes are available.

Definition at line 808 of file SPP.cpp.

int SPP::read ( void  )
virtual

Used to read the buffer.

Returns
Return the byte. Will return -1 if no bytes are available.

Definition at line 814 of file SPP.cpp.

size_t SPP::write ( uint8_t  data)
virtual

Writes the byte to send to a buffer. The message is send when either send() or after Usb.Task() is called.

Parameters
dataThe byte to write.
Returns
Return the number of bytes written.

Definition at line 759 of file SPP.cpp.

size_t SPP::write ( const uint8_t *  data,
size_t  size 
)
virtual

Writes the bytes to send to a buffer. The message is send when either send() or after Usb.Task() is called.

Parameters
dataThe data array to send.
sizeSize of the data.
Returns
Return the number of bytes written.

Definition at line 763 of file SPP.cpp.

void SPP::send ( void  )

This will send all the bytes in the buffer. This is called whenever Usb.Task() is called, but can also be called via this function.

Definition at line 772 of file SPP.cpp.

Member Data Documentation

bool SPP::connected

Variable used to indicate if the connection is established.

Definition at line 111 of file SPP.h.


The documentation for this class was generated from the following files: