rfcomm.h File Reference

Go to the source code of this file.

Functions

BOOL authenticationFunctionRFCOMM (LPVOID *param, BLUETOOTH_DEVICE_INFO *bdi)
 callback function for authenticating remote device
int checkEOL (char *text)
 Checks wether null terminated string contains 13+10.
int checkIfNoFlagsSet (struct parseoptsOptionStruct myOpts)
 Checks wether parseoptsOptionStruct has no flags set.
int checkString (char *text, char *target)
 Checks wether null terminated string contains target string.
void cleanup (void)
 cleanup
BOOL CtrlHandler (DWORD fdwCtrlType)
 Handle control events.
void help (void)
 Print helps.
SOCKET openChannel (char *address, int channel, BOOL silent)
 Opens channel.
 printDataInHex (int length)
 Print out data in stdinBuffer in hex format.
int readAT (SOCKET sock, char *buffer, int bufferSize)
 Reads AT channel.
int readFromStream (FILE *stream)
 Reads from stream to stdinBuffer.
void scan (char *address)
 Performs scan for each channel at target device.


Function Documentation

BOOL authenticationFunctionRFCOMM ( LPVOID *  param,
BLUETOOTH_DEVICE_INFO *  bdi 
)

callback function for authenticating remote device

Authentication callback function registered by opptool and called by system when remote device requsts authentication

Parameters:
param LPVOID*, Parameter from opptool given when registering the callback.
bdi BLUETOOTH_DEVICE_INFO*, Pointer to the bluetooth device info specifying the device which requests authentication
Remarks:
The param contains the ascii string given to the program in --pin parameter, or NULL if it's not given. The functions calls BluetoothSendAuthenticationResponse to send the authentication response. If pin was NULL tries to guess PIN value.
Returns:
TRUE if function succeeds and FALSE if not. The system does not use the return value for anything.

int checkEOL ( char *  text  ) 

Checks wether null terminated string contains 13+10.

Checks wether null terminated string contains 13+10

Parameters:
text char*, null terminated string
Returns:
Returns 1 if 13+10 found otherwise returns zero

int checkIfNoFlagsSet ( struct parseoptsOptionStruct  myOpts  ) 

Checks wether parseoptsOptionStruct has no flags set.

This function goes through all the flags in parseoptsOptionStruct if no flag set then return value is 1. Otherwise 0.

Parameters:
myOpts parseoptsOptionStruct
Returns:
int, 0 If at least one flag is set. 1 If no flag is set.

int checkString ( char *  text,
char *  target 
)

Checks wether null terminated string contains target string.

Checks wether null terminated string contains target string

Parameters:
text char*, null terminated string
target char* null terminated string
Returns:
Returns 1 if target found otherwise returns zero

void cleanup ( void   ) 

cleanup

Free memory, clean up socket and WinSock

BOOL CtrlHandler ( DWORD  fdwCtrlType  ) 

Handle control events.

Currently handles Ctrl-C event. Which run program down gracefully.

void help ( void   ) 

Print helps.

This function print help to the screen.

SOCKET openChannel ( char *  address,
int  channel,
BOOL  silent 
)

Opens channel.

Opens socket in target address and channel

Parameters:
address char*, device address
channel int, channel number. Must be between 1..30
silent BOOL, if true openChannel will not print out error messages
Returns:
SOCKET, which is opened

printDataInHex ( int  length  ) 

Print out data in stdinBuffer in hex format.

Prints out data in stdinBuffer in hex format

Parameters:
length int, Data length in buffer

int readAT ( SOCKET  sock,
char *  buffer,
int  bufferSize 
)

Reads AT channel.

Reads AT channel until 13+10 has received or Timeout happens

Parameters:
sock SOCKET, socket which is read
buffer char*, buffer where the data is read
bufferSize int, maximum buffer size
Returns:
Returns zero if no error, -1 Reading channel, -2 Timeout occurs

int readFromStream ( FILE *  stream  ) 

Reads from stream to stdinBuffer.

Reads stream to stdinBuffer. If buffer would overflow then reallocate will done.

Parameters:
stream *FILE
Returns:
Returns zero if no error, -1 If system runs out of memory -2 if EOF received

void scan ( char *  address  ) 

Performs scan for each channel at target device.

Performs scan for each channel at target device and tries to identify channel type.

Parameters:
address char*, Address to device

footer


 SourceForge.net Logo