22 m_sensorLabel =
"RFID";
58 std::stringstream cmdline;
59 std::cout <<
"Waiting for the driver to start ... ";
62 cmdline << driver_path <<
" " << reader_name.c_str() <<
" " << IPm.c_str() <<
" " << port;
67 const int ret = ::system(cmdline.str().c_str());
69 std::cerr <<
"[CImpinjRFID::startDriver] Error ("<< ret <<
") invoking command:\n" << cmdline.str() << std::endl;
95 IPm = configSource.
read_string(iniSection,
"local_IP",
"127.0.0.1",
false);
96 reader_name = configSource.
read_string(iniSection,
"reader_name",
"",
true);
97 port = configSource.
read_int(iniSection,
"listen_port",0,
true);
98 driver_path = configSource.
read_string(iniSection,
"driver_path",
"",
true);
114 client = server->accept();
128 bool receivedSomething =
false;
137 client->writeAsync(cmd,10);
140 while (client->readAsync(msg,34,100) > 0)
142 receivedSomething =
true;
147 std::cerr <<
"[CImpinjRFID::getObservation] Unexpected format in sensor data! (skipping).\n";
150 const char ant_port = *ant_port_ptr;
161 new_tag.
power = atof(rx_pwr);
166 if (receivedSomething)
172 catch (std::exception &e)
174 std::cerr << e.what() << std::endl;
188 client->writeAsync(cmd,10);
197 appendObservation(obs);
std::string antennaPort
Port of the antenna that did the reading.
static CObservationRFIDPtr Create()
OBSERVATION_T::Ptr getObservation(mrpt::obs::CSensoryFramePtr &observations, mrpt::obs::CObservationPtr &observation, bool priority_to_sf=true)
Given an mrpt::obs::CSensoryFrame and a mrpt::obs::CObservation pointer if a OBSERVATION_T type obser...
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...
char BASE_IMPEXP * strcpy(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
An OS-independent version of strcpy.
A TCP socket that can be wait for client connections to enter.
TThreadHandle createThread(void(*func)(T), T param)
Creates a new thread from a function (or static method) with one generic parameter.
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
void BASE_IMPEXP sleep(int time_ms) MRPT_NO_THROWS
An OS-independent method for sending the current thread to "sleep" for a given period of time...
std::string epc
EPC code of the observed tag.
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)
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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.
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 BASE_IMPEXP * strtok(char *str, const char *strDelimit, char **context) MRPT_NO_THROWS
An OS-independent method for tokenizing a string.
void BASE_IMPEXP exitThread() MRPT_NO_THROWS
Explicit close of the current (running) thread.
void closeReader()
Close the connection to the reader.