25 #ifndef MERCURY_SDK_INCLUDE_MERCURY_SDK_PROTOCOL2PACKETHANDLER_H_
26 #define MERCURY_SDK_INCLUDE_MERCURY_SDK_PROTOCOL2PACKETHANDLER_H_
44 uint16_t updateCRC(uint16_t crc_accum, uint8_t *data_blk_ptr, uint16_t data_blk_size);
45 void addStuffing(uint8_t *packet);
46 void removeStuffing(uint8_t *packet);
68 const char *getTxRxResult (
int result);
75 const char *getRxPacketError (uint8_t error);
92 int txPacket (
PortHandler *port, uint8_t *txpacket);
113 int rxPacket (
PortHandler *port, uint8_t *rxpacket);
129 int txRxPacket (
PortHandler *port, uint8_t *txpacket, uint8_t *rxpacket, uint8_t *error = 0);
140 int ping (
PortHandler *port, uint8_t
id, uint8_t *error = 0);
158 int ping (
PortHandler *port, uint8_t
id, uint16_t *model_number, uint8_t *error = 0);
166 int broadcastPing (
PortHandler *port, std::vector<uint8_t> &id_list);
190 int reboot (
PortHandler *port, uint8_t
id, uint8_t *error = 0);
201 int clearMultiTurn (
PortHandler *port, uint8_t
id, uint8_t *error = 0);
214 int factoryReset (
PortHandler *port, uint8_t
id, uint8_t option, uint8_t *error = 0);
230 int readTx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length);
242 int readRx (
PortHandler *port, uint8_t
id, uint16_t length, uint8_t *data, uint8_t *error = 0);
261 int readTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length, uint8_t *data, uint8_t *error = 0);
271 int read1ByteTx (
PortHandler *port, uint8_t
id, uint16_t address);
282 int read1ByteRx (
PortHandler *port, uint8_t
id, uint8_t *data, uint8_t *error = 0);
296 int read1ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint8_t *data, uint8_t *error = 0);
306 int read2ByteTx (
PortHandler *port, uint8_t
id, uint16_t address);
317 int read2ByteRx (
PortHandler *port, uint8_t
id, uint16_t *data, uint8_t *error = 0);
331 int read2ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t *data, uint8_t *error = 0);
341 int read4ByteTx (
PortHandler *port, uint8_t
id, uint16_t address);
352 int read4ByteRx (
PortHandler *port, uint8_t
id, uint32_t *data, uint8_t *error = 0);
366 int read4ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint32_t *data, uint8_t *error = 0);
379 int writeTxOnly (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length, uint8_t *data);
394 int writeTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length, uint8_t *data, uint8_t *error = 0);
405 int write1ByteTxOnly(
PortHandler *port, uint8_t
id, uint16_t address, uint8_t data);
418 int write1ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint8_t data, uint8_t *error = 0);
429 int write2ByteTxOnly(
PortHandler *port, uint8_t
id, uint16_t address, uint16_t data);
442 int write2ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t data, uint8_t *error = 0);
453 int write4ByteTxOnly(
PortHandler *port, uint8_t
id, uint16_t address, uint32_t data);
466 int write4ByteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint32_t data, uint8_t *error = 0);
480 int regWriteTxOnly (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length, uint8_t *data);
496 int regWriteTxRx (
PortHandler *port, uint8_t
id, uint16_t address, uint16_t length, uint8_t *data, uint8_t *error = 0);
509 int syncReadTx (
PortHandler *port, uint16_t start_address, uint16_t data_length, uint8_t *param, uint16_t param_length);
522 int syncWriteTxOnly (
PortHandler *port, uint16_t start_address, uint16_t data_length, uint8_t *param, uint16_t param_length);
534 int synchronise (
PortHandler *port, uint8_t
id, uint8_t *error);
The class that inherits Protocol1PacketHandler class or Protocol2PacketHandler class.
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac,...
The class for control Mercury by using Protocol2.0.
static Protocol2PacketHandler * getInstance()
The function that returns Protocol2PacketHandler instance.
virtual ~Protocol2PacketHandler()
float getProtocolVersion()
The function that returns Protocol version used in Protocol2PacketHandler (2.0)