roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
radioCommand.h File Reference

Controls radio commands sent between robots. More...

Go to the source code of this file.

Data Structures

struct  RadioCmd
 A radio command is a linked list of the radio commands received. More...
 

Typedefs

typedef struct RadioCmd RadioCmd
 A radio command is a linked list of the radio commands received.
 

Functions

void radioCommandInit (void)
 Initializes radio command processing. More...
 
void radioCommandAddCallback (RadioCmd *radioCmdPtr, const char *name, void(*funcPtr)(RadioCmd *radioCmdPtr, RadioMessage *message))
 Creates radio command that will call function. More...
 
void radioCommandAddQueue (RadioCmd *radioCmdPtr, const char *name, uint8 messageQueueSize)
 Create radio command that uses a queue of specified size. More...
 
void radioCommandAdd (RadioCmd *radioCmdPtr, const char *name, void(*funcPtr)(RadioCmd *radioCmdPtr, RadioMessage *message), uint8 messageQueueSize, void *externalDataPtr)
 Creates a radio command that can call a function or a queue. More...
 
boolean radioCommandReceive (RadioCmd *radioCmdPtr, RadioMessage *messagePtr, uint32 maxDelay)
 Receives specific radio commands. More...
 
boolean radioCommandReceiveNonBlocking (RadioCmd *radioCmdPtr, RadioMessage *messagePtr)
 Receives specific radio commands. More...
 
void radioCommandXmit (RadioCmd *radioCmdPtr, uint8 destinationID, RadioMessage *message)
 Sends a radio message to the specified ID if RC mode is off. More...
 
boolean radioCommandTimeout (RadioCmd *radioCmdPtr, uint32 timeout)
 Check if time since last time stamp has exceeded timeout. More...
 
uint8 radioCommandGetType (RadioMessage *messagePtr)
 Get radio command type. More...
 
uint8 radioCommandGetSubnet (RadioMessage *messagePtr)
 Get radio command subnet. More...
 
void radioCommandSetSubnet (uint8 subnet)
 Sets the radio command subnet. More...
 
char * radioCommandGetDataPtr (RadioMessage *messagePtr)
 Get radio command data pointer. More...
 

Detailed Description

Controls radio commands sent between robots.

Since
March 17, 2012
Author
James McLurkin

Function Documentation

void radioCommandAdd ( RadioCmd radioCmdPtr,
const char *  name,
void(*)(RadioCmd *radioCmdPtr, RadioMessage *message)  funcPtr,
uint8  messageQueueSize,
void *  externalDataPtr 
)

Creates a radio command that can call a function or a queue.

Parameters
radioCmdPtris pointer to specific radio command group to be sent
nameis the name of the command
funcPtrpoints to function that radio message will be sent to
messageQueueSizeis maximum size of queue - the number of messages that it can hold, not the size of the message. The radio message size is RADIO_COMMAND_MESSAGE_DATA_LENGTH, currently
externalDataPtris a void* that can be set to whatever structure the user needs access to during the callback.
Returns
void
void radioCommandAddCallback ( RadioCmd radioCmdPtr,
const char *  name,
void(*)(RadioCmd *radioCmdPtr, RadioMessage *message)  funcPtr 
)

Creates radio command that will call function.

Parameters
radioCmdPtris pointer to specific radio command group to be sent
nameis the name of the command
funcPtrpoints to function that radio message will be sent to
Returns
void
void radioCommandAddQueue ( RadioCmd radioCmdPtr,
const char *  name,
uint8  messageQueueSize 
)

Create radio command that uses a queue of specified size.

Parameters
radioCmdPtris pointer to specific radio command
nameis the name of the command
messageQueueSizeis maximum size of queue - the number of messages that it can hold, not the size of the message. The radio message size is RADIO_COMMAND_MESSAGE_DATA_LENGTH, currently
Returns
void
char* radioCommandGetDataPtr ( RadioMessage messagePtr)

Get radio command data pointer.

Parameters
messagePtris the message to examine
Returns
pointer to data associated with the message
uint8 radioCommandGetSubnet ( RadioMessage messagePtr)

Get radio command subnet.

Parameters
messagePtris the message to examine
Returns
radio command message subnet
uint8 radioCommandGetType ( RadioMessage messagePtr)

Get radio command type.

Parameters
messagePtris the message to examine
Returns
radio command message type
void radioCommandInit ( void  )

Initializes radio command processing.

Returns
void
boolean radioCommandReceive ( RadioCmd radioCmdPtr,
RadioMessage messagePtr,
uint32  maxDelay 
)

Receives specific radio commands.

Parameters
radioCmdPtrThe command group of radio messages that will go into messagePtr
messagePtrWill contain the next message for the given radio command group
maxDelayThe maximum time the call will take before returning. If 0, will not block (call radioCommandReceiveNonBlocking() instead)..
Returns
TRUE if there is a message. FALSE otherwise.
boolean radioCommandReceiveNonBlocking ( RadioCmd radioCmdPtr,
RadioMessage messagePtr 
)

Receives specific radio commands.

Parameters
radioCmdPtrThe command group of radio messages that will go into messagePtr
messagePtrWill contain the next message for the given radio command group
Returns
TRUE if there is a message. FALSE otherwise.
void radioCommandSetSubnet ( uint8  subnet)

Sets the radio command subnet.

Parameters
subnetis the subnet to join. Range is from 0-3.
Returns
void
boolean radioCommandTimeout ( RadioCmd radioCmdPtr,
uint32  timeout 
)

Check if time since last time stamp has exceeded timeout.

Parameters
radioCmdPtrThe command group of the radio message to be sent
timeoutis the amount of time in milliseconds before the function returns
Returns
if timeout has been exceeded, return True; else, return False
void radioCommandXmit ( RadioCmd radioCmdPtr,
uint8  destinationID,
RadioMessage message 
)

Sends a radio message to the specified ID if RC mode is off.

Parameters
radioCmdPtrThe command group of the radio message to be sent
destinationIDWhich robots the message is being sent to. 0xFF (ROBOT_ID_ALL) sends to all robots
messagethe message to be sent