encode.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2004
4  * Andrew Howard
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /*
23  * Desc: Useful encoding/decoding routines
24  * Author: Andrew Howard
25  * Date: 16 Sep 2005
26  * CVS: $Id$
27  */
28 
29 #ifndef ENCODE_H_
30 #define ENCODE_H_
31 
32 
34 size_t EncodeHexSize(size_t src_len);
35 
37 void EncodeHex(char *dst, size_t dst_len, const void *src, size_t src_len);
38 
40 size_t DecodeHexSize(size_t src_len);
41 
43 void DecodeHex(void *dst, size_t dst_len, const char *src, size_t src_len);
44 
45 
46 #endif
Definition: types.hh:80
#define PLAYER_WARN1(msg, a)
Error message macros.
Definition: error.h:89
#define PLAYER_MSG1(level, msg, a)
Error message macros.
Definition: error.h:105
#define PLAYER_MSG3(level, msg, a, b, c)
Error message macros.
Definition: error.h:107
#define PLAYER_LASER_DATA_SCAN
Data subtype: scan.
Definition: player_interfaces.h:845
static bool MatchMessage(player_msghdr_t *hdr, int type, int subtype, player_devaddr_t addr)
Helper for message processing.
Definition: message.h:158
double ReadFloat(int section, const char *name, double value)
Read a floating point (double) value.
int AddInterface(player_devaddr_t addr)
Add an interface.
double px
X [m].
Definition: player.h:230
player_pose3d_t pose
Laser pose, in robot cs (m, m, m, rad, rad, rad).
Definition: player_interfaces.h:948
Definition: localize.hh:29
double y1
Endpoints [m].
Definition: player.h:299
#define PLAYER_SIMULATION_REQ_GET_POSE2D
Request/reply subtype: set 2D pose.
Definition: player_interfaces.h:2655
double ReadTupleLength(int section, const char *name, int index, double value)
Read a length from a tuple (includes units conversion)
Generic message header.
Definition: player.h:160
float max_angle
Start and end angles for the laser scan [rad].
Definition: player_interfaces.h:888
virtual int MainSetup(void)
Sets up the resources needed by the driver thread.
Definition: driver.h:657
virtual void MainQuit(void)
Cleanup method for driver thread (called when main exits)
Definition: driver.h:663
double x1
Endpoints [m].
Definition: player.h:297
A color descriptor.
Definition: player.h:319
uint8_t type
Message type; must be one of PLAYER_MSGTYPE_*.
Definition: player.h:165
#define PLAYER_WARN3(msg, a, b, c)
Error message macros.
Definition: error.h:91
Encapsulates a device (i.e., a driver bound to an interface)
Definition: device.h:73
const char * ReadString(int section, const char *name, const char *value)
Read a string value.
double px
X [m].
Definition: player.h:219
Definition: types.hh:42
Data: hypotheses (PLAYER_LOCALIZE_DATA_HYPOTHS)
Definition: player_interfaces.h:2351
#define PLAYER_POSITION2D_CMD_VEL
Command: velocity (PLAYER_POSITION2D_CMD_VEL)
Definition: player_interfaces.h:581
double pyaw
yaw [rad]
Definition: player.h:240
uint8_t subtype
Message subtype; interface specific.
Definition: player.h:167
virtual void Main(void)=0
Main method for driver thread.
double ReadAngle(int section, const char *name, double value)
Read an angle (includes unit conversion).
Definition: types.hh:29
#define PLAYER_MSG4(level, msg, a, b, c, d)
Error message macros.
Definition: error.h:108
int ReadInt(int section, const char *name, int value)
Read an integer value.
double ReadLength(int section, const char *name, double value)
Read a length (includes unit conversion, if any).
void * GetPayload()
Get pointer to payload.
Definition: message.h:187
#define PLAYER_OPAQUE_DATA_STATE
Data subtype: generic state.
Definition: player_interfaces.h:3434
Request/reply: get/set 2D pose of a named simulation object.
Definition: player_interfaces.h:2710
#define PLAYER_MSGTYPE_DATA
A data message.
Definition: player.h:94
double py
Y [m].
Definition: player.h:221
Hypothesis format.
Definition: player_interfaces.h:2335
#define PLAYER_MSGTYPE_RESP_ACK
A positive response message.
Definition: player.h:111
double x0
Endpoints [m].
Definition: player.h:293
Command: Draw polyline (PLAYER_GRAPHICS2D_CMD_POLYLINE) Draw a series of straight line segments betwe...
Definition: player_interfaces.h:4230
float * ranges
Range readings [m].
Definition: player_interfaces.h:896
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr *hdr, void *data)
Message handler.
Definition: types.hh:73
player_segment_t * segments
Line segments.
Definition: player_interfaces.h:3095
#define PLAYER_MSGTYPE_REQ
A request message.
Definition: player.h:105
#define PLAYER_LOCALIZE_DATA_HYPOTHS
Data subtype: pose hypotheses.
Definition: player_interfaces.h:2320
#define PLAYER_LASER_REQ_GET_GEOM
Request/reply subtype: get geometry.
Definition: player_interfaces.h:854
#define PLAYER_GRAPHICS2D_CMD_POLYLINE
Command subtype: draw a polyline.
Definition: player_interfaces.h:4200
Request/reply: Get geometry.
Definition: player_interfaces.h:945
double ReadTupleAngle(int section, const char *name, int index, double value)
Read an angle form a tuple (includes units conversion)
int ReadDeviceAddr(player_devaddr_t *addr, int section, const char *name, int code, int index, const char *key)
Read a device id.
Class for loading configuration file information.
Definition: configfile.h:195
A device address.
Definition: player.h:144
An autopointer for the message queue.
Definition: message.h:72
double py
Y [m].
Definition: player.h:232
void SetError(int code)
Set/reset error code.
Definition: driver.h:144
position2d data
Definition: player_interfaces.h:606
#define PLAYER_ERROR1(msg, a)
Error message macros.
Definition: error.h:81
#define PLAYER_ERROR(msg)
Error message macros.
Definition: error.h:80
double y0
Endpoints [m].
Definition: player.h:295
float min_angle
Start and end angles for the laser scan [rad].
Definition: player_interfaces.h:886
Base class for drivers which oeprate with a thread.
Definition: driver.h:551
A point in the plane.
Definition: player.h:183
#define PLAYER_POSITION2D_DATA_STATE
Data: state (PLAYER_POSITION2D_DATA_STATE)
Definition: player_interfaces.h:568
double timestamp
Time associated with message contents (seconds since epoch)
Definition: player.h:169
player_pose2d_t pos
position [m,m,rad] (x, y, yaw)
Definition: player_interfaces.h:609
#define PLAYER_POSITION2D_CMD_POS
Command: position (PLAYER_POSITION2D_CMD_POS)
Definition: player_interfaces.h:588
uint32_t size
Size in bytes of the payload to follow.
Definition: player.h:173
Reference-counted message objects.
Definition: message.h:131
#define PLAYER_WARN(msg)
Warning message macros.
Definition: error.h:88
#define PLAYER_MSGTYPE_CMD
A command message.
Definition: player.h:98
data
Definition: player_interfaces.h:3449
double pa
yaw [rad]
Definition: player.h:223
Base class for all drivers.
Definition: driver.h:107
#define PLAYER_MSG0(level, msg)
General messages.
Definition: error.h:104
#define PLAYER_MSG2(level, msg, a, b)
Error message macros.
Definition: error.h:106
Request/reply: get vector map.
Definition: player_interfaces.h:3082
#define PLAYER_MAP_REQ_GET_VECTOR
Request/reply subtype: get vector map.
Definition: player_interfaces.h:3027
uint32_t ranges_count
Number of range readings.
Definition: player_interfaces.h:894
uint32_t segments_count
The number of line segments
Definition: player_interfaces.h:3093
#define PLAYER_GRAPHICS2D_CMD_CLEAR
Command subtype: clear the drawing area (send an empty message)
Definition: player_interfaces.h:4194
Data: scan (PLAYER_LASER_DATA_SCAN)
Definition: player_interfaces.h:883
player_msghdr_t * GetHeader()
Get pointer to header.
Definition: message.h:185
player_devaddr_t addr
Device to which this message pertains.
Definition: player.h:163
Definition: transf.hh:36
position2d position command
Definition: player_interfaces.h:626
player_pose2d_t pos
position [m,m,rad] (x, y, yaw)
Definition: player_interfaces.h:629