lib_utils.h
Go to the documentation of this file.
1 #ifndef TOPOSENS_ECHO_DRIVER_LIB_UTILS_H
2 #define TOPOSENS_ECHO_DRIVER_LIB_UTILS_H
3 
4 #include <iomanip>
5 #include <sstream>
6 #include <string>
7 
8 #include <toposens/sensor_lib.h>
9 
10 namespace toposens_echo_driver
11 {
13 // NOLINTNEXTLINE (cppcoreguidelines-avoid-magic-numbers)
14 void InitCanInterface(const std::string& can_device, int data_rate = 1000000);
15 void DeinitCanInterface();
16 
18 // NOLINTNEXTLINE (cppcoreguidelines-avoid-magic-numbers)
19 void InitUARTInterface(const std::string& uart_device, int data_rate = 0010002);
20 void DeinitUARTInterface();
21 
25 
29 auto SetTargetSensor(uint16_t TargetSensor_u16) -> bool;
30 
32 
34 void LogSettings();
36 
39 // NOLINTNEXTLINE (cppcoreguidelines-avoid-magic-numbers)
40 void LogKnownSensors(double log_interval = 3.0);
41 
44 void LogVersions();
45 
48 void LogSessionData(const Sensor_Session_t* session);
49 
51 
53 void ConfigureSensorLogMessages(void (*Callback)(uint16_t Sender_u16, uint8_t* ReceivedPayload_pu8),
54  LogLevel_t log_level);
55 
57 void LogMsgCallback(uint16_t SenderId_u16, uint8_t* ReceivedPayload_pu8);
58 
62 inline auto toHexString(const uint16_t i) -> std::string
63 {
64  std::stringstream hex_ss;
65  hex_ss << "0x" << std::setfill('0') << std::setw(2) << std::uppercase << std::hex << i;
66  return hex_ss.str();
67 };
68 
69 } // namespace toposens_echo_driver
70 
71 #endif // TOPOSENS_ECHO_DRIVER_LIB_UTILS_H
toposens_echo_driver::LogSessionData
void LogSessionData(const Sensor_Session_t *session)
Log given session data to ROS concole.
Definition: lib_utils.cpp:148
toposens_echo_driver::toHexString
auto toHexString(const uint16_t i) -> std::string
Convert given i to hex string.
Definition: lib_utils.h:62
toposens_echo_driver::SetTargetSensor
auto SetTargetSensor(uint16_t TargetSensor_u16) -> bool
Checks if TargetSensor_u16 is known and sets current target accordingly.
Definition: lib_utils.cpp:35
toposens_echo_driver::InitCanInterface
void InitCanInterface(const std::string &can_device, int data_rate=1000000)
Inits the driver on given can_device with hard-coded data rate.
Definition: lib_utils.cpp:8
LogLevel_t
LogLevel_t
Definition: custom_types.h:101
toposens_echo_driver::ConfigureSensorLogMessages
void ConfigureSensorLogMessages(void(*Callback)(uint16_t Sender_u16, uint8_t *ReceivedPayload_pu8), LogLevel_t log_level)
Sets log level with the sensor and registers callback.
Definition: lib_utils.cpp:202
toposens_echo_driver::DeinitUARTInterface
void DeinitUARTInterface()
Definition: lib_utils.cpp:20
toposens_echo_driver::LogVersions
void LogVersions()
Read all version information (such as bootloader version, app versionetc.) from sensor and log to ROS...
Definition: lib_utils.cpp:123
toposens_echo_driver::LogKnownSensors
void LogKnownSensors(double log_interval=3.0)
Get currently known sensors from driver and log to ROS console every log_interval seconds.
Definition: lib_utils.cpp:96
toposens_echo_driver::DeinitCanInterface
void DeinitCanInterface()
Definition: lib_utils.cpp:13
toposens_echo_driver
Definition: adc_dump.h:8
toposens_echo_driver::LogMsgCallback
void LogMsgCallback(uint16_t SenderId_u16, uint8_t *ReceivedPayload_pu8)
Callback handling log messages from sensor.
Definition: lib_utils.cpp:216
Sensor_Session_t
Definition: sensor_lib.h:61
toposens_echo_driver::LogSettings
void LogSettings()
Read current configuration from sensor and log to ROS console.
Definition: lib_utils.cpp:54
sensor_lib.h
This file contains the highlevel interface prototypes to the low-level Protocol.
toposens_echo_driver::InitUARTInterface
void InitUARTInterface(const std::string &uart_device, int data_rate=0010002)
Inits the driver on given uart_device with hard-coded data rate.
Definition: lib_utils.cpp:15
toposens_echo_driver::RequestSessionData
auto RequestSessionData() -> Sensor_Session_t *
Requesting single shot measurement from first sensor in known sensors array.
Definition: lib_utils.cpp:22


toposens_echo_driver
Author(s): Tobias Roth , Dennis Maier , Baris Yazici
autogenerated on Wed Mar 2 2022 01:12:32