Go to the documentation of this file.
21 using namespace std::literals;
27 m_sensorLabel =
"RFID";
39 std::thread(dummy_startDriver,
this).detach();
51 std::stringstream cmdline;
52 std::cout <<
"Waiting for the driver to start ... ";
55 cmdline << driver_path <<
" " << reader_name.c_str() <<
" " << IPm.c_str()
59 std::this_thread::sleep_for(2
s);
61 const int ret = ::system(cmdline.str().c_str());
63 std::cerr <<
"[CImpinjRFID::startDriver] Error (" << ret
64 <<
") invoking command:\n"
65 << cmdline.str() << std::endl;
94 IPm = configSource.
read_string(iniSection,
"local_IP",
"127.0.0.1",
false);
95 reader_name = configSource.
read_string(iniSection,
"reader_name",
"",
true);
96 port = configSource.
read_int(iniSection,
"listen_port", 0,
true);
97 driver_path = configSource.
read_string(iniSection,
"driver_path",
"",
true);
111 server = std::make_unique<mrpt::comms::CServerTCPSocket>(port);
114 client = server->accept();
116 std::this_thread::sleep_for(1
s);
128 bool receivedSomething =
false;
137 client->writeAsync(cmd, 10);
140 while (client->readAsync(msg, 34, 100) > 0)
142 receivedSomething =
true;
148 std::cerr <<
"[CImpinjRFID::getObservation] Unexpected format "
149 "in sensor data! (skipping).\n";
152 const char ant_port = *ant_port_ptr;
167 new_tag.
power = atof(rx_pwr);
174 if (receivedSomething)
179 catch (std::exception& e)
181 std::cerr << e.what() << std::endl;
195 client->writeAsync(cmd, 10);
203 mrpt::make_aligned_shared<mrpt::obs::CObservationRFID>();
void startDriver()
start the external driver
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
std::string antennaPort
Port of the antenna that did the reading.
std::vector< TTagReading > tag_readings
The vector of individual tag observations.
Contains classes for various device interfaces.
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
static void dummy_startDriver(CImpinjRFID *o)
bool getObservation(mrpt::obs::CObservationRFID &obs)
Gets the information of the tags as a timestamped observation NOTE: Deprecated, use getObservations i...
void connect()
Connect to the reader.
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
This class allows loading and storing values and vectors of different types from a configuration text...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
char * strtok(char *str, const char *strDelimit, char **context) noexcept
An OS-independent method for tokenizing a string.
void loadConfig_sensorSpecific(const mrpt::config::CConfigFileBase &configSource, const std::string §ion)
Loads specific configuration for the device from a given source of configuration parameters,...
char * strcpy(char *dest, size_t destSize, const char *source) noexcept
An OS-independent version of strcpy.
This class implements an interface to an Impinj RFID reader.
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
This represents one or more RFID tags observed by a receiver.
Each of the individual readings of a RFID tag.
void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it.
GLsizei const GLchar ** string
double power
The power or signal strength as sensed by the RFID receiver (in dBm)
std::shared_ptr< CObservationRFID > Ptr
std::string epc
EPC code of the observed tag.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
OBSERVATION_T::Ptr getObservation(mrpt::obs::CSensoryFrame::Ptr &observations, mrpt::obs::CObservation::Ptr &observation, bool priority_to_sf=true)
Given an mrpt::obs::CSensoryFrame and a mrpt::obs::CObservation pointer if a OBSERVATION_T type obser...
void closeReader()
Close the connection to the reader.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |