# ecrobot::BTConnection Class Reference

Bluetooth connection helper class. More...

`#include <BTConnection.h>`

List of all members.

## Public Member Functions
| BTConnection (Bluetooth &bt, Lcd &lcd, Nxt &nxt)
| Constructor.
SINT | connect (const CHAR *passkey, const CHAR *devname=0)
| Establish Bluetooth connection as a slave device and display the status in the LCD.
SINT | connect (const CHAR *passkey, const U8 address[7])
| Establish Bluetooth connection as a master device and display the status in the LCD.

## Detailed Description

Bluetooth connection helper class.

## Constructor & Destructor Documentation

ecrobot::BTConnection::BTConnection | ( | Bluetooth & | bt,
|  | Lcd & | lcd,
|  | Nxt & | nxt |
| ) |  |  | `[inline]`

Constructor.

Parameters:

  | bt | Reference of a Bluetooth object.
  | lcd | Reference of a LCD object.
  | nxt | Reference of a NXT object.

Returns:
  -

## Member Function Documentation

SINT ecrobot::BTConnection::connect | ( | const CHAR * | passkey,
|  | const U8 | address[7] |
| ) |  |  |

Establish Bluetooth connection as a master device and display the status in the LCD.

Note that the connection process can be canceled by keep pushing ENTR button on the NXT for longer than 0.5sec.

Parameters:

  | passkey | Bluetooth passkey (up to 16 characters. I.e. "1234")
  | address | Bluetooth Device Address to be connected (7bytes hex array data)

Returns:
  1(connected)/0(canceled)/-1(failed)

SINT ecrobot::BTConnection::connect | ( | const CHAR * | passkey,
|  | const CHAR * | devname = `0` |
| ) |  |  |

Establish Bluetooth connection as a slave device and display the status in the LCD.

Note that the connection process can be canceled by keep pushing ENTR button on the NXT for longer than 0.5sec.

Parameters:

  | passkey | Bluetooth passkey (up to 16 characters. I.e. "1234")
  | devname | Bluetooth user freindly device name (optional parameter. e.g. "NXT")

Returns:
  1(connected)/0(canceled)/-1(failed)

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

- util/BTConnection.h