- Main Page
- Modules
- Data Structures
- Files
- Directories

# e_bluetooth.c File Reference

Manage Bluetooth. More...

`#include "./../uart/e_uart_char.h"`
`#include "./../motor_led/e_epuck_ports.h"`
`#include "e_bluetooth.h"`
`#include "stdio.h"`
`#include "string.h"`
`#include "stdlib.h"`

## Functions
int | e_bt_find_epuck (void)
| Try to find other e-puck.
char | e_bt_connect_epuck (void)
int | e_bt_reset (void)
| Reset the bluetooth module.
char | e_bt_factory_reset (void)
| Factory reset of the bluetooth module.
char | e_bt_tranparent_mode (void)
| Change to transparent mode.
void | e_bt_exit_tranparent_mode (void)
| Exit from the transparent mode.
char | e_bt_read_local_pin_number (char *PIN)
| Read the PIN number of this e-puck's bluetooth module.
char | e_bt_read_local_name (char *name)
| Read the name of this e-puck's bluetooth module.
char | e_bt_write_local_pin_number (char *PIN)
| Write the PIN number on this e-puck's bluetooth module.
char | e_bt_write_local_name (char *name)
| Write the name on this e-puck's bluetooth module.
int | e_bt_inquiry (struct BtDevice *device)
| Research all the accessible bluetooth devices.
char | e_bt_get_friendly_name (struct BtDevice *device)
| To get the friendly name of a bluetooth device.
char | e_bt_etablish_SPP_link (char *address)
| Try to connect to another bluetooth device.
char | e_bt_release_SPP_link (void)
| Unconnect from the current bluetooth device.
char | e_bt_send_SPP_data (char *data, char datalength)
| Send data to the current bluetooth device.
char | e_bt_list_local_paired_device (void)
| Make a list of the bluetooth address of paired device.
char | e_bt_remove_local_paired_device (int j)
| Remove a paired bluetooth device.
## Variables
unsigned char | e_bt_local_paired_device [6 *8]
struct BtDevice | e_bt_present_device [10]
struct BtEPuck | e_bt_present_epuck [10]
char | local_bt_PIN [4]

## Detailed Description

Manage Bluetooth.

This module manage the Bluetooth device.

Author:
  Code: Michael Bonani
  Doc: Jonathan Besuchet

## Function Documentation

char e_bt_connect_epuck | ( | void |  | ) |

char e_bt_etablish_SPP_link | ( | char * | address | ) |

Try to connect to another bluetooth device.

Parameters:

  | address | A pointer on the device address which you want to connect

Returns:
  bluetooth error if one occur, 0 otherwise

void e_bt_exit_tranparent_mode | ( | void |  | ) |

Exit from the transparent mode.

char e_bt_factory_reset | ( | void |  | ) |

Factory reset of the bluetooth module.

Warning:
  use this function only if you are sure, your e-puck must be restarted, and renamed!!!

Returns:
  bluetooth error if one occur, 0 otherwise

int e_bt_find_epuck | ( | void |  | ) |

Try to find other e-puck.

This function make global inguiry and check which device are e-puck, and list them in globales tables.

Returns:
  number of e-puck found

See also:
  e_bt_present_device, e_bt_present_epuck

char e_bt_get_friendly_name | ( | struct BtDevice * | device | ) |

To get the friendly name of a bluetooth device.

Parameters:

  | device | A pointer on the device that you want the name

Returns:
  bluetooth error if one occur, 0 otherwise

See also:
  BtDevice

int e_bt_inquiry | ( | struct BtDevice * | device | ) |

Research all the accessible bluetooth devices.

Parameters:

  | device | A pointer to BtDevice to store all the caracteristics of each devices found

Returns:
  the number of device found

See also:
  BtDevice, e_bt_present_device

char e_bt_list_local_paired_device | ( | void |  | ) |

Make a list of the bluetooth address of paired device.

Returns:
  The number of device found

See also:
  e_bt_local_paired_device

char e_bt_read_local_name | ( | char * | name | ) |

Read the name of this e-puck's bluetooth module.

Parameters:

  | name | A pointer to store the name

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_read_local_pin_number | ( | char * | PIN | ) |

Read the PIN number of this e-puck's bluetooth module.

Parameters:

  | PIN | A pointer to store the PIN number

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_release_SPP_link | ( | void |  | ) |

Unconnect from the current bluetooth device.

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_remove_local_paired_device | ( | int | j | ) |

Remove a paired bluetooth device.

Parameters:

  | j | The number of the paired device to remove from the e_bt_local_paired_device array.

Returns:
  bluetooth error if one occur, 0 otherwise

int e_bt_reset | ( | void |  | ) |

Reset the bluetooth module.

Returns:
  The version number

char e_bt_send_SPP_data | ( | char * | data,
|  | char | datalength |
| ) |  |  |

Send data to the current bluetooth device.

Warning:
  send maximum 127 bytes if you are in non transparent mode

Parameters:

  | data | The datas to send
  | datalength | The length of the datas to send

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_tranparent_mode | ( | void |  | ) |

Change to transparent mode.

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_write_local_name | ( | char * | name | ) |

Write the name on this e-puck's bluetooth module.

Parameters:

  | name | A pointer to store the name

Returns:
  bluetooth error if one occur, 0 otherwise

char e_bt_write_local_pin_number | ( | char * | PIN | ) |

Write the PIN number on this e-puck's bluetooth module.

Parameters:

  | PIN | A pointer to store the PIN number

Returns:
  bluetooth error if one occur, 0 otherwise

## Variable Documentation

unsigned char e_bt_local_paired_device[6 *8]

struct BtDevice e_bt_present_device[10]

An extern array containing all the bluetooth device detected. It's carried out by the fonction e_bt_find_epuck

See also:
  e_bt_find_epuck

struct BtEPuck e_bt_present_epuck[10]

An extern array containing all the e-puck detected. It's carried out by the fonction e_bt_find_epuck

See also:
  e_bt_find_epuck

char local_bt_PIN[4]