MercurySDK
Software development kit for Mercury digital servos
group_sync_read.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2017 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
21 
22 #ifndef MERCURY_SDK_INCLUDE_MERCURY_SDK_GROUPSYNCREAD_H_
23 #define MERCURY_SDK_INCLUDE_MERCURY_SDK_GROUPSYNCREAD_H_
24 
25 
26 #include "port_handler.h"
27 #include "packet_handler.h"
28 #include "group_handler.h"
29 
30 namespace mercury
31 {
32 
36 class WINDECLSPEC GroupSyncRead : public GroupHandler
37 {
38 protected:
39  std::map<uint8_t, uint8_t *> error_list_; // <id, error>
40 
42 
43  uint16_t start_address_;
44  uint16_t data_length_;
45 
46  void makeParam();
47 
48 public:
56  GroupSyncRead(PortHandler *port, PacketHandler *ph, uint16_t start_address, uint16_t data_length);
57 
61  ~GroupSyncRead() { clearParam(); }
62 
71  bool addParam (uint8_t id);
72 
77  void removeParam (uint8_t id);
78 
82  void clearParam ();
83 
91  int txPacket();
92 
102  int rxPacket();
103 
114  int txRxPacket();
115 
126  bool isAvailable (uint8_t id, uint16_t address, uint16_t data_length);
127 
135  uint32_t getData (uint8_t id, uint16_t address, uint16_t data_length);
136 
145  bool getError (uint8_t id, uint8_t* error);
146 };
147 
148 }
149 
150 
151 #endif /* MERCURY_SDK_INCLUDE_MERCURY_SDK_GROUPSYNCREAD_H_ */
The class for reading multiple Dynamixel data from same address with same length at once.
std::map< uint8_t, uint8_t * > error_list_
~GroupSyncRead()
The function that calls clearParam function to clear the parameter list for Sync Read.
The class that inherits Protocol1PacketHandler class or Protocol2PacketHandler class.
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac,...
Definition: port_handler.h:56