26 m_sensorLabel =
"RFID";
38 std::thread(dummy_startDriver,
this).detach();
50 std::stringstream cmdline;
51 std::cout <<
"Waiting for the driver to start ... ";
54 cmdline << driver_path <<
" " << reader_name.c_str() <<
" " << IPm.c_str()
58 std::this_thread::sleep_for(2
s);
60 const int ret = ::system(cmdline.str().c_str());
62 std::cerr <<
"[CImpinjRFID::startDriver] Error (" << ret
63 <<
") invoking command:\n" 64 << cmdline.str() << std::endl;
93 IPm = configSource.
read_string(iniSection,
"local_IP",
"127.0.0.1",
false);
94 reader_name = configSource.
read_string(iniSection,
"reader_name",
"",
true);
95 port = configSource.
read_int(iniSection,
"listen_port", 0,
true);
96 driver_path = configSource.
read_string(iniSection,
"driver_path",
"",
true);
110 server = std::make_unique<mrpt::comms::CServerTCPSocket>(port);
113 client = server->accept();
115 std::this_thread::sleep_for(1
s);
127 bool receivedSomething =
false;
136 client->writeAsync(cmd, 10);
139 while (client->readAsync(msg, 34, 100) > 0)
141 receivedSomething =
true;
147 std::cerr <<
"[CImpinjRFID::getObservation] Unexpected format " 148 "in sensor data! (skipping).\n";
151 const char ant_port = *ant_port_ptr;
166 new_tag.
power = atof(rx_pwr);
173 if (receivedSomething)
178 catch (std::exception& e)
180 std::cerr << e.what() << std::endl;
194 client->writeAsync(cmd, 10);
202 mrpt::make_aligned_shared<mrpt::obs::CObservationRFID>();
std::string antennaPort
Port of the antenna that did the reading.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
This class implements an interface to an Impinj RFID reader.
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
void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it...
This class allows loading and storing values and vectors of different types from a configuration text...
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
std::string epc
EPC code of the observed tag.
char * strtok(char *str, const char *strDelimit, char **context) noexcept
An OS-independent method for tokenizing a string.
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
void startDriver()
start the external driver
double power
The power or signal strength as sensed by the RFID receiver (in dBm)
void loadConfig_sensorSpecific(const mrpt::utils::CConfigFileBase &configSource, const std::string §ion)
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)
GLsizei const GLchar ** string
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
static void dummy_startDriver(CImpinjRFID *o)
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
void connect()
Connect to the reader.
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...
bool getObservation(mrpt::obs::CObservationRFID &obs)
Gets the information of the tags as a timestamped observation NOTE: Deprecated, use getObservations i...
std::shared_ptr< CObservationRFID > Ptr
std::vector< TTagReading > tag_readings
The vector of individual tag observations.
Each of the individual readings of a RFID tag.
This represents one or more RFID tags observed by a receiver.
char * strcpy(char *dest, size_t destSize, const char *source) noexcept
An OS-independent version of strcpy.
void closeReader()
Close the connection to the reader.