#include <Beacon.h>
Public Member Functions | |
Beacon (unsigned char *source, std::string hostname) | |
Beacon (unsigned char *buffer) | |
int | GetCrc32 (const std::string &my_string) |
std::string | getFrameAsNetworkString () |
virtual | ~Beacon () |
Public Attributes | |
bool | correct_crc_ |
Indicates whether CRC of received beacon is correct. | |
struct ethhdr * | eh_ |
Defines layer 2 Ethernet header. | |
std::string | hostname_ |
Stores host name of the beacon sender. | |
unsigned char | mac_source_ [6] |
The mac address of the source robot that emits the Beacon. | |
Static Public Attributes | |
static uint32_t | HEADER_FIXED_LEN = 23 |
The lenght of the beacon header (23 bytes) |
Beacons are transmitted periodically to enable robot detection. They allow to
Beacon::Beacon | ( | unsigned char * | source, |
std::string | hostname | ||
) |
Constructs the Beacon on the sender side.
source | The mac address of the source robot that emits the Beacon |
hostname | The hostname of the source robot that emits the Beacon |
Definition at line 22 of file Beacon.cpp.
Beacon::Beacon | ( | unsigned char * | buffer | ) |
Constructs the Beacon on the receiver side.
buffer | The received network buffer |
Definition at line 30 of file Beacon.cpp.
Beacon::~Beacon | ( | ) | [virtual] |
Definition at line 68 of file Beacon.cpp.
int Beacon::GetCrc32 | ( | const std::string & | my_string | ) |
Calculates the Crc32 of a Beacon Is needed to detect corrupt beacons caused by transmission errors.
Definition at line 120 of file Beacon.cpp.
std::string Beacon::getFrameAsNetworkString | ( | ) |
Returns a Beacon as a C++ string. Converts the beacon into a C++ string to be written to the socket.
Definition at line 73 of file Beacon.cpp.
bool Beacon::correct_crc_ |
struct ethhdr* Beacon::eh_ |
uint32_t Beacon::HEADER_FIXED_LEN = 23 [static] |
std::string Beacon::hostname_ |
unsigned char Beacon::mac_source_[6] |