00001 #ifndef __RFID_NODE_H__ 00002 #define __RFID_NODE_H__ 00003 00029 #include <iostream> 00030 #include <ros/ros.h> 00031 #include "rfid_driver_interface.h" 00032 00033 // services 00034 #include <rfid_msgs/RfidTag.h> 00035 #include <rfid_msgs/WriteCard.h> 00036 00037 using namespace std; 00038 00039 class RfidNode { 00040 public: 00045 RfidNode(RfidDriverInterface *rfid_driver); 00046 00050 ~RfidNode(); 00051 00057 void init(); 00058 00064 void spin(); 00065 00067 // services 00069 00076 bool write_card(rfid_msgs::WriteCard::Request & req, rfid_msgs::WriteCard::Response & resp); 00077 00079 // class methods 00081 00085 int read_card(); 00086 00091 void set_data(card_data); 00092 00098 card_data read_tag_data(int num_blocks); 00099 00104 void write_tag_data(card_data card); 00105 00106 private: 00111 int get_num_blocks(); 00112 00113 ros::NodeHandle _nh; 00114 ros::NodeHandle _nh_private; 00115 00116 ros::Publisher _write_pub; 00117 00118 ros::ServiceServer _rfid_write_srv; 00119 00120 ros::Rate _publish_rate; 00121 00122 RfidDriverInterface *_rfid_driver; 00123 card_data _rfid_card; 00124 00125 int _num_device; 00126 }; 00127 00128 #endif