ros.h
Go to the documentation of this file.
00001 #ifndef ROSSERIAL_ROS_H
00002 #define ROSSERIAL_ROS_H
00003 
00004 #include "rosserial/ros/node_handle.h"
00005 #include "rosserial/duration.cpp"
00006 #include "rosserial/time.cpp"
00007 #include <iostream>
00008 
00009 class ClientComms {
00010 public:
00011   // Can smuggle in an fd representing either the back end of 
00012   // a socket or serial pty, and run the same tests over both.
00013   static int fd;
00014 
00015   // Accessible to be manipulated by tests, for test behaviours
00016   // dependent on the passage of time.
00017   static unsigned long millis;
00018 
00019   void init() {
00020   }
00021   int read() {
00022     unsigned char ch;
00023     ssize_t ret = ::read(fd, &ch, 1);
00024     return ret == 1 ? ch : -1;
00025   }
00026   void write(uint8_t* data, int length) {
00027     ::write(fd, data, length);
00028   }
00029   unsigned long time() {
00030     return millis;
00031   } 
00032 };
00033 
00034 int ClientComms::fd = -1;
00035 unsigned long ClientComms::millis = 0;
00036 
00037 namespace ros {
00038 typedef NodeHandle_<ClientComms, 5, 5, 200, 200> NodeHandle;
00039 }
00040 
00041 #endif  // ROSSERIAL_ROS_H


rosserial_test
Author(s):
autogenerated on Sat Oct 7 2017 03:08:56