gusimplewhiteboard
Giraff_MainSerialInterface.hpp File Reference
#include "wb_giraff_main_serial.h"
#include <arpa/inet.h>
#include <sstream>
Include dependency graph for Giraff_MainSerialInterface.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  guWhiteboard::Giraff_MainSerialInterface
 Serial interface for the main giraff board. More...
 

Namespaces

namespace  guWhiteboard
 /file APM_Interface.h
 

Macros

#define DELIMITER   ','
 
#define SEP   ':'
 
#define PARSER(s, c, p)   if (k.compare(s) == 0) { set_##c ( p ); continue; }
 
#define SV   std::vector<std::string>
 
#define COMP(v, s)   v.compare(0, 2, s) == 0
 
#define IS_HEX(v)   COMP(v, "F*") || COMP(v, "I*")
 
#define READ_HEX(v)   htonl(strtol(v.c_str()+2, NULL, 16))
 
#define PARSE_HEX_FLOAT(v)   static_cast<float>(READ_HEX(v))
 
#define PARSE_HEX_INT32(v)   static_cast<int32_t>(READ_HEX(v))
 
#define PARSE_HEX_INT16(v)   static_cast<int16_t>(READ_HEX(v))
 
#define PARSE_HEX_INT8(v)   static_cast<int8_t>(READ_HEX(v))
 
#define PARSE_FLOAT   IS_HEX(v) ? PARSE_HEX_FLOAT(v) : static_cast<float>(atof(v.c_str()))
 
#define PARSE_INT16   IS_HEX(v) ? PARSE_HEX_INT16(v) : static_cast<int16_t>(atoi(v.c_str()))
 
#define PARSE_INT32   IS_HEX(v) ? PARSE_HEX_INT32(v) : static_cast<int32_t>(atoi(v.c_str()))
 
#define PARSE_INT8   IS_HEX(v) ? PARSE_HEX_INT8(v) : static_cast<uint8_t>(atoi(v.c_str()))
 

Macro Definition Documentation

◆ COMP

#define COMP (   v,
 
)    v.compare(0, 2, s) == 0

Definition at line 64 of file Giraff_MainSerialInterface.hpp.

◆ DELIMITER

#define DELIMITER   ','

Definition at line 60 of file Giraff_MainSerialInterface.hpp.

◆ IS_HEX

#define IS_HEX (   v)    COMP(v, "F*") || COMP(v, "I*")

Definition at line 65 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_FLOAT

#define PARSE_FLOAT   IS_HEX(v) ? PARSE_HEX_FLOAT(v) : static_cast<float>(atof(v.c_str()))

Definition at line 73 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_HEX_FLOAT

#define PARSE_HEX_FLOAT (   v)    static_cast<float>(READ_HEX(v))

Definition at line 68 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_HEX_INT16

#define PARSE_HEX_INT16 (   v)    static_cast<int16_t>(READ_HEX(v))

Definition at line 70 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_HEX_INT32

#define PARSE_HEX_INT32 (   v)    static_cast<int32_t>(READ_HEX(v))

Definition at line 69 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_HEX_INT8

#define PARSE_HEX_INT8 (   v)    static_cast<int8_t>(READ_HEX(v))

Definition at line 71 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_INT16

#define PARSE_INT16   IS_HEX(v) ? PARSE_HEX_INT16(v) : static_cast<int16_t>(atoi(v.c_str()))

Definition at line 74 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_INT32

#define PARSE_INT32   IS_HEX(v) ? PARSE_HEX_INT32(v) : static_cast<int32_t>(atoi(v.c_str()))

Definition at line 75 of file Giraff_MainSerialInterface.hpp.

◆ PARSE_INT8

#define PARSE_INT8   IS_HEX(v) ? PARSE_HEX_INT8(v) : static_cast<uint8_t>(atoi(v.c_str()))

Definition at line 76 of file Giraff_MainSerialInterface.hpp.

◆ PARSER

#define PARSER (   s,
  c,
 
)    if (k.compare(s) == 0) { set_##c ( p ); continue; }

Definition at line 62 of file Giraff_MainSerialInterface.hpp.

◆ READ_HEX

#define READ_HEX (   v)    htonl(strtol(v.c_str()+2, NULL, 16))

Definition at line 67 of file Giraff_MainSerialInterface.hpp.

◆ SEP

#define SEP   ':'

Definition at line 61 of file Giraff_MainSerialInterface.hpp.

◆ SV

#define SV   std::vector<std::string>

Definition at line 63 of file Giraff_MainSerialInterface.hpp.