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);
#define IMPLEMENTS_GENERIC_SENSOR(class_name, NameSpace)
This must be inserted in all CGenericSensor classes implementation files:
This class implements an interface to an Impinj RFID reader.
void closeReader()
Close the connection to the reader.
void doProcess()
This method will be invoked at a minimum rate of "process_rate" (Hz)
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...
void initialize()
This method can or cannot be implemented in the derived class, depending on the need for it.
void startDriver()
start the external driver
static void dummy_startDriver(CImpinjRFID *o)
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,...
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
This represents one or more RFID tags observed by a receiver.
std::vector< TTagReading > tag_readings
The vector of individual tag observations.
static CObservationRFIDPtr Create()
This class allows loading and storing values and vectors of different types from a configuration text...
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
A TCP socket that can be wait for client connections to enter.
GLsizei const GLchar ** string
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...
char BASE_IMPEXP * strcpy(char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
An OS-independent version of strcpy.
TThreadHandle createThread(void(*func)(T), T param)
Creates a new thread from a function (or static method) with one generic parameter.
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.
void BASE_IMPEXP exitThread() MRPT_NO_THROWS
Explicit close of the current (running) thread.
char BASE_IMPEXP * strtok(char *str, const char *strDelimit, char **context) MRPT_NO_THROWS
An OS-independent method for tokenizing a string.
Contains classes for various device interfaces.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Each of the individual readings of a RFID tag.
double power
The power or signal strength as sensed by the RFID receiver (in dBm)
std::string antennaPort
Port of the antenna that did the reading.
std::string epc
EPC code of the observed tag.