#include <framerecv.hh>
Public Member Functions | |
| frameRecv (int QoS=1) | |
| ~frameRecv () | |
| bool | open (const char *mcast_addr, const char *interface=0, int port=frameXmitPort) |
| bool | open (int port=frameXmitPort) |
| void | close () |
| bool | purge () |
| int | receive (char *&data, int maxlen, unsigned int *sequence=0, unsigned int *timestamp=0, unsigned int *duration=0) |
| const char * | logmsg () |
| void | clearlog () |
| void | logging (bool set=true) |
| void | setmaxlog (int max=25) |
brief Class for receiving frame broadcast data
| framexmit::frameRecv::frameRecv | ( | int | QoS = 1 |
) | [inline, explicit] |
Constructs a broadcast receiver. An optional parameter specifies the quality of service: 0 - up to 30% retransmission; 1 - 10% retransmission; 2 - 3% retransmission. The QoS limit is determined by averaging over the retransmission of the last few data buffers. This allows for higher burst retransmission, but enforces a limit of the averaged retransmission.
| QoS | quality of service brief Default constructor. |
| framexmit::frameRecv::~frameRecv | ( | ) | [inline] |
Destructs the broadcast receiver. brief Destructor.
| bool framexmit::frameRecv::open | ( | const char * | mcast_addr, | |
| const char * | interface = 0, |
|||
| int | port = frameXmitPort | |||
| ) |
Opens the conenction to the transmitter. If no multicast address is supplied, the function will listen to UDP/IP broadcast transmission at the specified port. Otherwise, it tries to join the specified multicast group at the given interface. If the interface is obmitted, the default interface will be used. In general, one can use the subnet address as the interface address argument. The function will then go through the list of all local interfaces and determine the closest match.
brief Open function.
| mcast_addr | multicast address | |
| interface | interface or subnet used by multicast | |
| port | port number to listen |
| bool framexmit::frameRecv::open | ( | int | port = frameXmitPort |
) | [inline] |
Opens the conenction to the transmitter. Uses UDP/IP broadcast. brief Open function.
| port | port number |
| void framexmit::frameRecv::close | ( | ) |
Closes the conenction. brief Close function.
| bool framexmit::frameRecv::purge | ( | ) |
Purges the receiver. This function will empty the receiver socket buffer and put the data into an internal buffer. Returns true if there is data in the internal buffer. This function only checks if at least one packet was received. There is no guarantee that a full data buffer was received. brief Purge function.
| int framexmit::frameRecv::receive | ( | char *& | data, | |
| int | maxlen, | |||
| unsigned int * | sequence = 0, |
|||
| unsigned int * | timestamp = 0, |
|||
| unsigned int * | duration = 0 | |||
| ) |
Gets a data buffer. If the supplied data buffer is 0, the function allocates a new memory buffer upon return. Upon success the function returns the length of the received data. A value between -10 and -1 indicates a connection or memory allocation error, whereas a value below <10 indicates that the preallocated memory buffer is too small. In this case the negative of the needed length is returned.
brief receive function.
| data | data array | |
| maxlen | maximum length of data array (in bytes) | |
| sequence | sender sequence number (return) | |
| timestamp | time stamp of data array (return) | |
| duration | time length of data array (return) |
| const char* framexmit::frameRecv::logmsg | ( | ) |
Last few log messages. brief log message function.
| void framexmit::frameRecv::clearlog | ( | ) |
Clear old log messages. brief clear log function.
| void framexmit::frameRecv::logging | ( | bool | set = true |
) | [inline] |
Turn logging on/off. brief turn log on function.
| set | true = on |
| void framexmit::frameRecv::setmaxlog | ( | int | max = 25 |
) | [inline] |
Set maximum number of log messages. brief Maximum log messages function.
| max | Maximum messages |
1.5.4