35 #include "tHardwareCanSinkFactory.h" 36 #include "tHardwareCanSinkCanfile.h" 37 #include "tHardwareCanSinkConsole.h" 38 #include "tHardwareCanSinkInterpretMessage.h" 40 #include "tHardwareCanSinkPeak.h" 66 LOGGING_DEBUG(icl_hardware::can::CAN,
"No specifier was set, read settings from configfile" <<
"\n");
74 for (
unsigned int i = 0; i < lspecifier.size(); ++i)
76 lspecifier[i] = tolower(lspecifier[i]);
79 LOGGING_DEBUG(icl_hardware::can::CAN,
"tHardwareCanSinkFactory parser result: \n");
87 tHardwareCanSinkCanfile * hardware_data_sink =
new tHardwareCanSinkCanfile();
89 unsigned int baud_rate = 0;
90 for (
unsigned int i=0; i<query_list.size(); ++i)
92 if (query_list[i].name ==
"baud")
94 baud_rate = atoi(query_list[i].value.c_str());
105 return hardware_data_sink;
111 if (icl_core::config::getDefault<bool>(
"/icl_hardware_can/use_interpret",
false))
113 icl_core::String can_matrix = icl_core::config::getDefault<icl_core::String>(
"/icl_hardware_can/can_mask",
"");
114 if (can_matrix !=
"")
116 tHardwareCanSinkInterpretMessage * hardware_data_sink =
new tHardwareCanSinkInterpretMessage();
118 return hardware_data_sink;
127 tHardwareCanSinkConsole * hardware_data_sink =
new tHardwareCanSinkConsole();
129 return hardware_data_sink;
134 #ifdef _SYSTEM_POSIX_ 135 tHardwareCanSinkPeak * hardware_data_sink =
new tHardwareCanSinkPeak();
137 unsigned int baud_rate = 0;
138 for (
unsigned int i=0; i<query_list.size(); ++i)
140 if (query_list[i].name ==
"baud")
142 baud_rate = atoi(query_list[i].value.c_str());
154 return hardware_data_sink;
156 LOGGING_WARNING(icl_hardware::can::CAN,
"can:// devices only available on posix platforms.");
174 std::string specifier;
176 icl_core::String sink_specifier = icl_core::config::getDefault<icl_core::String>(
"/icl_hardware_can/sink_factory/sink",
"");
177 icl_core::String device_name = icl_core::config::getDefault<icl_core::String>(
"/icl_hardware_can/sink_factory/device",
"");
178 icl_core::String baud_rate = icl_core::config::getDefault<icl_core::String>(
"/icl_hardware_can/sink_factory/baudrate",
"");
180 specifier = sink_specifier + device_name;
182 if (sink_specifier ==
"can://")
186 specifier.append(
"?baud=" + baud_rate);
189 else if (sink_specifier ==
"file://")
193 specifier.append(
"baud=" + baud_rate);
#define LOGGING_DEBUG(streamname, arg)
bool parseScheme(const String &str)
#define LOGGING_ERROR(streamname, arg)
std::string interpretConfigFile()
ThreadStream & endl(ThreadStream &stream)
virtual ~tHardwareCanSinkFactory()
tHardwareCanSinkFactory()
#define LOGGING_WARNING(streamname, arg)
tHardwareCanSink * Construct(std::string specifier)
const icl_core::Scheme & getSchemeResult() const
std::vector< Query > QueryList