aero3_command.h
Go to the documentation of this file.
1 #ifndef AERO_COMMAND_H_
2 #define AERO_COMMAND_H_
3 
4 #include <boost/asio.hpp>
5 #include <boost/thread.hpp>
6 #include <vector>
7 #include <unordered_map>
8 
9 using namespace boost::asio;
10 
11 namespace aero
12 {
13  namespace controller
14  {
16  {
17  public:
20 
21  bool openPort(std::string _port, unsigned int _baud_rate);
22  void closePort();
23  void writeAsync(std::vector<uint8_t>& _send_data);
24  void onReceive(const boost::system::error_code& _error, size_t _bytes_transferred);
25  void onTimer(const boost::system::error_code& _error);
26  void readBufferAsync(uint8_t _size, uint16_t _timeout);
27  void readBuffer(std::vector<uint8_t>& _receive_data, uint8_t _size);
28  void flushPort();
29 
30  std::string receive_buffer_;
31  bool comm_err_;
32 
33  private:
34  io_service io_;
35  serial_port serial_;
36  deadline_timer timer_;
37 
39  boost::asio::streambuf stream_buffer_;
40 
41  };
42 
43  class AeroCommand{
44  public:
45  AeroCommand();
46  ~AeroCommand();
47 
48  bool is_open_,comm_err_;
49 
50  bool openPort(std::string _port, unsigned int _baud_rate);
51  void closePort();
52  void flushPort();
53 
54  void setCurrent(uint8_t _number,uint8_t _max, uint8_t _down);
55  void onServo(uint8_t _number,uint16_t _data);
56  std::vector<int16_t> getPosition(uint8_t _number);
57  std::vector<uint16_t> getCurrent(uint8_t _number);
58  std::vector<uint16_t> getTemperatureVoltage(uint8_t _number);
59  std::string getVersion(uint8_t _number);
60  std::vector<uint16_t> getStatus(uint8_t _number);
61  void throughCAN(uint8_t _send_no,uint8_t _command,
62  uint8_t _data1, uint8_t _data2, uint8_t _data3, uint8_t _data4, uint8_t _data5);
63  std::vector<int16_t> actuateByPosition(uint16_t _time, int16_t *_data);
64  std::vector<int16_t> actuateBySpeed(int16_t *_data);
65  void runScript(uint8_t _number,uint16_t _data);
66 
67  private:
68  //Value
69  unsigned int check_sum_,count_,length_;
70  std::vector<uint8_t> send_data_;
71 
72  protected:
74  };
75 
76  } //end namesapce controller
77 } //end namespaace aero
78 
79 #endif
boost::asio::streambuf stream_buffer_
Definition: aero3_command.h:39
std::vector< uint8_t > send_data_
Definition: aero3_command.h:70
SerialCommunication serial_com_
Definition: aero3_command.h:73


seed_smartactuator_sdk
Author(s):
autogenerated on Mon Nov 2 2020 03:39:20