ros.h
Go to the documentation of this file.
1 #ifndef ROSSERIAL_ROS_H
2 #define ROSSERIAL_ROS_H
3 
4 #include "rosserial/ros/node_handle.h"
5 #include "rosserial/duration.cpp"
6 #include "rosserial/time.cpp"
7 #include <iostream>
8 
9 class ClientComms {
10 public:
11  // Can smuggle in an fd representing either the back end of
12  // a socket or serial pty, and run the same tests over both.
13  static int fd;
14 
15  // Accessible to be manipulated by tests, for test behaviours
16  // dependent on the passage of time.
17  static unsigned long millis;
18 
19  void init() {
20  }
21  int read() {
22  unsigned char ch;
23  ssize_t ret = ::read(fd, &ch, 1);
24  return ret == 1 ? ch : -1;
25  }
26  void write(uint8_t* data, int length) {
27  ::write(fd, data, length);
28  }
29  unsigned long time() {
30  return millis;
31  }
32 };
33 
34 int ClientComms::fd = -1;
35 unsigned long ClientComms::millis = 0;
36 
37 namespace ros {
39 }
40 
41 #endif // ROSSERIAL_ROS_H
static unsigned long millis
Definition: ros.h:17
Definition: ros.h:9
static int fd
Definition: ros.h:13
void init()
Definition: ros.h:19
int read()
Definition: ros.h:21
void write(uint8_t *data, int length)
Definition: ros.h:26
NodeHandle_< ClientComms, 5, 5, 200, 200 > NodeHandle
Definition: ros.h:38
unsigned long time()
Definition: ros.h:29


rosserial_test
Author(s):
autogenerated on Fri Jun 7 2019 22:03:01