core/bluetooth/bluetooth.h File Reference

Go to the source code of this file.

Defines

#define BLUETOOTH_OFF   0
#define BLUETOOTH_ON   1

Functions

void bluetooth_power (int power)
bool_t bluetooth_init (int baudrate)
bool_t bluetooth_set_friendly_name (char *p_name)
bool_t bluetooth_set_pin (char *p_pin)
int bluetooth_send (char *p_data, int data_size)
uint8_t bluetooth_scan (void)
bool_t bluetooth_connect (bool_t as_slave, char *p_pin, uint8_t device, uint32_t timeout_ms, bool_t reconnect)
bool_t bluetooth_is_connected (void)
void bluetooth_get_module_info (void)

Detailed Description

High-level Bluetooth driver interface.

Definition in file bluetooth.h.


Function Documentation

bool_t bluetooth_connect ( bool_t  as_slave,
char *  p_pin,
uint8_t  device,
uint32_t  timeout_ms,
bool_t  reconnect 
)

Try to connect to another Bluetooth device.

Parameters:
as_slave true for connecting as slave (passive), false for master.
p_pin ID as ASCII string.
device Number of the device (1..8) to connect to (master mode only).
timeout_ms Time (ms) to wait (block) for a connection.
reconnect Keep a background connection "thread" running (slave mode only).
Returns:
true if a connection was established, false otherwise.
Todo:
Implement master mode.

Definition at line 117 of file bluetooth.c.

void bluetooth_get_module_info ( void   ) 

Get some information concerning the Bluetooth module.

Returns:
true if a connection exists, false if not.
Todo:
Format the module info in some structure.

Definition at line 152 of file bluetooth.c.

bool_t bluetooth_init ( int  baudrate  ) 

Initialize the Bluetooth driver.

Parameters:
baudrate Speed of the serial port that talks to the BT module.
Returns:
true if the initialization went well, false otherwise.

Definition at line 45 of file bluetooth.c.

bool_t bluetooth_is_connected ( void   ) 

Check if this device is connected.

Returns:
true if a connection exists, false if not.

Definition at line 139 of file bluetooth.c.

void bluetooth_power ( int  power  ) 

Switch module power on or off.

Parameters:
power BLUETOOTH_OFF or BLUETOOTH_ON.

Definition at line 32 of file bluetooth.c.

uint8_t bluetooth_scan ( void   ) 

Do a search for other Bluetooth devices.

Returns:
the number of devices found.
Todo:
Make more useful.

Definition at line 99 of file bluetooth.c.

int bluetooth_send ( char *  p_data,
int  data_size 
)

Send data over the Bluetooth connection.

Parameters:
p_data Pointer to the data to send.
data_size Number of bytes to send.
Returns:
true if a connection was established, false otherwise.
Todo:
Implement. While doing that, implement also a receive function.

Definition at line 86 of file bluetooth.c.

bool_t bluetooth_set_friendly_name ( char *  p_name  ) 

Set the human readable name of the Bluetooth device.

Parameters:
p_name Friendly name as ASCII string (16 characters max).
Returns:
true if name was set, false otherwise.

Definition at line 59 of file bluetooth.c.

bool_t bluetooth_set_pin ( char *  p_pin  ) 

Set the pin (ID) code of the Bluetooth device.

Parameters:
p_pin Pin (ID) as ASCII string (4 characters max).
Returns:
true if name was set, false otherwise.

Definition at line 71 of file bluetooth.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Defines

Generated by  doxygen 1.6.2