COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
unixgpio.h
Go to the documentation of this file.
1 #ifndef UnixGpio_H
2 #define UnixGpio_H
3 
5 #include <fstream>
6 namespace Cosmos {
7  namespace Devices {
8  namespace General {
9  class UnixGpio
10  {
11  public:
12 
13  enum Direction {
16  };
17 
18  enum Value {
19  LOW = 0,
20  HIGH = 1
21  };
22 
23  UnixGpio(Direction dir, string pin , string name="");
24 
25  int32_t setDirection(Direction dir);
26  int32_t write(string filename, string value);
27  string read(string filename);
28 
29 
30  int32_t write(Value val);
31  int32_t read();
32  int32_t geterror();
33  bool isopen();
34  string getpath();
35 
36 
37  private:
38  std::ofstream stream;
40  string pinname;
41  string path;
42  string pin;
43  int32_t error;
44  bool open;
45 
46  };
47  }
48  }
49 }
50 
51 #endif // UnixGpio_H
Definition: agentclass.cpp:54
Value
Definition: unixgpio.h:18
int32_t geterror()
Definition: unixgpio.cpp:132
std::ofstream stream
Definition: unixgpio.h:38
Direction
Definition: unixgpio.h:13
Definition: unixgpio.h:9
int32_t write(string filename, string value)
Definition: unixgpio.cpp:61
string pinname
Definition: unixgpio.h:40
Direction direction
Definition: unixgpio.h:39
bool open
Definition: unixgpio.h:44
int32_t error
Definition: unixgpio.h:43
string name
Definition: cubesat2obj.cpp:6
UnixGpio(Direction dir, string pin, string name="")
Definition: unixgpio.cpp:13
int32_t setDirection(Direction dir)
Definition: unixgpio.cpp:47
bool isopen()
Definition: unixgpio.cpp:137
string path
Definition: unixgpio.h:41
int32_t read()
Definition: unixgpio.cpp:120
string pin
Definition: unixgpio.h:42
string getpath()
Definition: unixgpio.cpp:142