serial.h
Go to the documentation of this file.
1 
41 #ifndef SERIAL_H_
42 #define SERIAL_H_
43 
44 #include <stdint.h>
45 #include <stdio.h>
46 
47 #include <stdio.h> /* Standard input/output definitions */
48 #include <string.h> /* String function definitions */
49 #include <unistd.h> /* UNIX standard function definitions */
50 #include <fcntl.h> /* File control definitions */
51 #include <errno.h> /* Error number definitions */
52 #include <termios.h> /* POSIX terminal control definitions */
53 #include <stdlib.h> /* Malloc */
54 #include <assert.h>
55 
56 namespace sawyer{
57  class base_data{
58  public:
59 
60  static const size_t MAX_MSG_LENGTH = 256;
61  struct RawData{
62  unsigned char data[MAX_MSG_LENGTH];
63  int length;
65  data(),length(0)
66  { memset(data, 0xba, base_data::MAX_MSG_LENGTH);}
67  }rawData;
68  void clear(){memset(rawData.data, 0xba, MAX_MSG_LENGTH);rawData.length=0;}
69  };
70  class roch_driver: public base_data{
71 
72  public:
73 
79  {
80  static roch_driver instance;
81  return instance;
82  }
83  int OpenSerial(void **handle, const char *port_name);
84 
85  int SetupSerial(void *handle);
86 
87  int WriteData(void *handle, const char *buffer, int length);
88 
89  int ReadData(void *handle, char *buffer, int length);
90 
91  int CloseSerial(void *handle);
93  return rawData_.rawData; }
95 
96  };
97 };
98 #endif /* SERIAL_H_ */
void clear()
Definition: serial.h:68
static const size_t MAX_MSG_LENGTH
Definition: serial.h:60
base_data::RawData getGpInputData() const
Definition: serial.h:92
roch_driver & instance()
Definition: serial.h:78
base_data rawData_
Definition: serial.h:94
unsigned char data[MAX_MSG_LENGTH]
Definition: serial.h:62
struct sawyer::base_data::RawData rawData


roch_base
Author(s): Mike Purvis , Paul Bovbel , Chen
autogenerated on Mon Jun 10 2019 14:41:14