All Functions Modules Pages
adhoc

Functions

BOOLEAN adhoc.init (NUMBER mode)
 Initialize Adhoc module. More...
 
BOOLEAN adhoc.init (NUMBER mode, NUMBER timeout)
 Initialize Adhoc module. More...
 
STRING adhoc.getmac ()
 Obtain physical address (MAC) of our console. More...
 
TABLE adhoc.scan ()
 Obtain a list of available devices consoles to successfully make an adhoc connection. More...
 
NUMBER adhoc.available ()
 Allows to know the number of the remote devices available. More...
 
BOOLEAN adhoc.sendrequest (STRING addr)
 Request connection to a remote device. More...
 
BOOLEAN adhoc.getrequest ()
 Allows you to know if a device has sent a connection request. More...
 
NUMBER adhoc.send (STRING data)
 Send data to a Remote device (when accepted or successfully connection). More...
 
NUMBER adhoc.send (STRING data, NUMBER size)
 Send data to a Remote device (when accepted or successfully connection). More...
 
STRING adhoc.recv (NUMBER size)
 Allow to receive data from a Remote device (when accepted or successfully connection). More...
 
NIL adhoc.term ()
 Finalizes adhoc module. More...
 

Detailed Description

Adhoc functions.

Function Documentation

BOOLEAN adhoc.init ( NUMBER  mode)

Initialize Adhoc module.

Parameters
modeAny of the following values:
  • __ADHOC_CONN: Server mode
  • __ADHOC_JOIN: Client mode
Note
When you start the module, you can not use any network function until the adhoc is finalized.
Returns
If everything started correctly true, otherwise false.
BOOLEAN adhoc.init ( NUMBER  mode,
NUMBER  timeout 
)

Initialize Adhoc module.

Parameters
modeAny of the following values:
  • __ADHOC_CONN: Server mode
  • __ADHOC_JOIN: Client mode
timeoutIt is the 'us' time limit in which the connection request will be open, only necessary for the '__ADHOC_JOIN' mode.
Note
When you start the module, you can not use any network function until the adhoc is finalized.
Returns
If everything started correctly true, otherwise false.
STRING adhoc.getmac ( )

Obtain physical address (MAC) of our console.

Returns
MAC address in format: XX:XX:XX:XX:XX:XX
TABLE adhoc.scan ( )

Obtain a list of available devices consoles to successfully make an adhoc connection.

Returns
A table with those fields:
  • name: Name of the remote device (Nick).
  • mac: MAC address of the remote device.
NUMBER adhoc.available ( )

Allows to know the number of the remote devices available.

Returns
Total number of remote devices available.
BOOLEAN adhoc.sendrequest ( STRING  addr)

Request connection to a remote device.

Parameters
addrIt is the physical address (MAC) obtained from the table adhoc.scan().
Returns
true As if the connection was accepted / established or False otherwise.
BOOLEAN adhoc.getrequest ( )

Allows you to know if a device has sent a connection request.

Returns
true As if the connection was accepted / established or False otherwise.
NUMBER adhoc.send ( STRING  data)

Send data to a Remote device (when accepted or successfully connection).

Parameters
dataString with the message or text.
Returns
The number of bytes sent.
NUMBER adhoc.send ( STRING  data,
NUMBER  size 
)

Send data to a Remote device (when accepted or successfully connection).

Parameters
dataString with the message or text.
sizeSize data to be sending.
Returns
The number of bytes sent.
STRING adhoc.recv ( NUMBER  size)

Allow to receive data from a Remote device (when accepted or successfully connection).

Parameters
sizeSize data to be received for save them in buffer. Default to 1024 if there is no value.
Returns
The data plus the number of bytes received.
NIL adhoc.term ( )

Finalizes adhoc module.

Returns
nothing.