C4EV3
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Macros | Typedefs | Functions
ev3_bluetooth.h File Reference

Go to the source code of this file.

Macros

#define ev3_bluetooth_h
 
#define BLUETOOTH_ADDRESS_LENGTH   18
 
#define MAX_BLUETOOTH_NAME_LENGTH   128
 

Typedefs

typedef int BluetoothConnectionHandle
 

Functions

BluetoothConnectionHandle ConnectTo (char *nameOrAddress)
 
BluetoothConnectionHandle WaitConnection ()
 
void SendStringTo (BluetoothConnectionHandle to, char *str)
 
int ReceiveStringFrom (BluetoothConnectionHandle from, char *buffer, int bufferLength)
 
void DisconnectFrom (BluetoothConnectionHandle from)
 

Macro Definition Documentation

#define BLUETOOTH_ADDRESS_LENGTH   18
#define ev3_bluetooth_h
#define MAX_BLUETOOTH_NAME_LENGTH   128

Typedef Documentation

Function Documentation

BluetoothConnectionHandle ConnectTo ( char *  nameOrAddress)

Connect to the remote device given his bluetooth name or address. This function will block until the connection has been established.

Parameters
nameOrAddress
Returns
Connection handle or -1 if wasn't possible to find the address given the device name
void DisconnectFrom ( BluetoothConnectionHandle  from)
int ReceiveStringFrom ( BluetoothConnectionHandle  from,
char *  buffer,
int  bufferLength 
)

Receives a string from a bluetooth connection. This function will block until a message has been received from the connection. It's guaranteed that the string copied in the buffer will be null-terminated. If the incoming message is longer that the buffer length, only the first characters will be copied. A successive call to this function will allow to read the remaining characters.

Parameters
from
bufferBuffer to which the incoming message will be copied to
bufferLengthMaximum Size of the buffer
Returns
Length of the received message.
void SendStringTo ( BluetoothConnectionHandle  to,
char *  str 
)
BluetoothConnectionHandle WaitConnection ( )

Wait for an incoming bluetooth connection. This function will block until a connection has been established.

Returns
Connection handle