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>();
std::string antennaPort
Port of the antenna that did the reading.
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
This class implements an interface to an Impinj RFID reader.
Contains classes for various device interfaces.
void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it...
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
This class allows loading and storing values and vectors of different types from a configuration text...
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)
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.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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::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 loadConfig_sensorSpecific(const mrpt::config::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 config::CConfigFileBase and derived classes)
void closeReader()
Close the connection to the reader.