dynamixel_reader.h File Reference

Interface definition for Dynamixel packet reader. More...

Detailed Description

Interface definition for Dynamixel packet reader.

Author
Loïc Dauphin loic..nosp@m.daup.nosp@m.hin@i.nosp@m.nria.nosp@m..fr

Definition in file dynamixel_reader.h.

#include <stdlib.h>
#include <stdbool.h>
#include "dynamixel_protocol.h"
+ Include dependency graph for dynamixel_reader.h:

Go to the source code of this file.

Data Structures

struct  dynamixel_reader_t
 Dynamixel packet reader struct. More...
 
#define DXL_PING_SIZE   (10)
 
#define DXL_STATUS_SIZE(len)   (11+len)
 
#define DXL_READ_SIZE   (14)
 
#define DXL_WRITE_SIZE(len)   (12+len)
 
static void dynamixel_reader_init (dynamixel_reader_t *reader, const uint8_t *buffer, size_t size)
 Initialize the Dynamixel packet reader. More...
 
bool dynamixel_reader_is_valid (const dynamixel_reader_t *reader)
 Check if the packet is valid. More...
 
static uint8_t dynamixel_reader_get_id (const dynamixel_reader_t *reader)
 Get the packet's device id. More...
 
static uint8_t dynamixel_reader_get_instr (const dynamixel_reader_t *reader)
 Get the packet's instruction code. More...
 
static uint16_t dynamixel_reader_get_length (const dynamixel_reader_t *reader)
 Get the packet's length field. More...
 
static uint16_t dynamixel_reader_get_crc (const dynamixel_reader_t *reader)
 Get the packet's crc. More...
 
static const uint8_t * dynamixel_reader_status_get_payload (const dynamixel_reader_t *reader)
 Get the packet's payload (response) More...
 
static size_t dynamixel_reader_status_get_payload_size (const dynamixel_reader_t *reader)
 Get the packet's payload size (response) More...
 

Function Documentation

◆ dynamixel_reader_get_crc()

static uint16_t dynamixel_reader_get_crc ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's crc.

Parameters
[in]readerthe packet reader
Returns
the packet's length field

Definition at line 114 of file dynamixel_reader.h.

◆ dynamixel_reader_get_id()

static uint8_t dynamixel_reader_get_id ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's device id.

Parameters
[in]readerthe packet reader
Returns
the packet's device id

Definition at line 76 of file dynamixel_reader.h.

◆ dynamixel_reader_get_instr()

static uint8_t dynamixel_reader_get_instr ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's instruction code.

Parameters
[in]readerthe packet reader
Returns
the packet's instruction code

Definition at line 88 of file dynamixel_reader.h.

◆ dynamixel_reader_get_length()

static uint16_t dynamixel_reader_get_length ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's length field.

Parameters
[in]readerthe packet reader
Returns
the packet's length field

Definition at line 100 of file dynamixel_reader.h.

◆ dynamixel_reader_init()

static void dynamixel_reader_init ( dynamixel_reader_t reader,
const uint8_t *  buffer,
size_t  size 
)
inlinestatic

Initialize the Dynamixel packet reader.

Parameters
[out]readerthe packet reader
[in]bufferthe buffer used to store data
[in]sizethe size of the buffer

Definition at line 52 of file dynamixel_reader.h.

◆ dynamixel_reader_is_valid()

bool dynamixel_reader_is_valid ( const dynamixel_reader_t reader)

Check if the packet is valid.

Parameters
[in]readerthe packet reader
Returns
true if the packet is valid
false otherwise

◆ dynamixel_reader_status_get_payload()

static const uint8_t* dynamixel_reader_status_get_payload ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's payload (response)

Parameters
[in]readerthe packet reader
Returns
the address of the beginning of the payload

Definition at line 128 of file dynamixel_reader.h.

◆ dynamixel_reader_status_get_payload_size()

static size_t dynamixel_reader_status_get_payload_size ( const dynamixel_reader_t reader)
inlinestatic

Get the packet's payload size (response)

Parameters
[in]readerthe packet reader
Returns
the size of the payload

Definition at line 140 of file dynamixel_reader.h.