Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaError.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Dynamixel
4 //
5 // Library: librnr_dynamixel
6 //
7 // File: DynaError.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-01-12 10:56:06 -0700 (Mon, 12 Jan 2015) $
12  * $Rev: 3845 $
13  *
14  * \ingroup dyna_lib_hdrs
15  *
16  * \brief RoadNarrows Dynamixel Library Error and Logging Routines.
17  *
18  * \author Robin Knight (robin.knight@roadnarrows.com)
19  *
20  * \copyright
21  * \h_copy 2011-2017. RoadNarrows LLC.\n
22  * http://www.roadnarrows.com\n
23  * All Rights Reserved
24  */
25 /*
26  * @EulaBegin@
27  *
28  * Unless otherwise stated explicitly, all materials contained are copyrighted
29  * and may not be used without RoadNarrows LLC's written consent,
30  * except as provided in these terms and conditions or in the copyright
31  * notice (documents and software) or other proprietary notice provided with
32  * the relevant materials.
33  *
34  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
35  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
36  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
37  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
38  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
39  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
42  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
43  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
44  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
45  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
46  *
47  * @EulaEnd@
48  */
49 ////////////////////////////////////////////////////////////////////////////////
50 
51 #ifndef _DYNA_ERROR_H
52 #define _DYNA_ERROR_H
53 
54 #include "rnr/rnrconfig.h"
55 #include "rnr/log.h"
56 
57 #include "Dynamixel/Dynamixel.h"
58 
59 #ifndef SWIG
60 C_DECLS_BEGIN
61 #endif // SWIG
62 
63 // ---------------------------------------------------------------------------
64 // Defines and Types
65 // ---------------------------------------------------------------------------
66 
67 // ---------------------------------------------------------------------------
68 // Prototypes
69 // ---------------------------------------------------------------------------
70 
71 /*!
72  * \brief Get the error string describing the Dynamixel error code.
73  *
74  * The absolute value of the error code is taken prior retrieving the string.
75  * An unknown or out-of-range error code will be mapped to
76  * \ref DYNA_ECODE_BADEC.
77  *
78  * \param ecode Dynamixel error code.
79  *
80  * \return Returns the appropriate error code string.
81  */
82 extern const char *DynaStrError(int ecode);
83 
84 /*!
85  * \brief Pretty print a byte buffer to opened file stream.
86  *
87  * \param fp File pointer.
88  * \param sPreface Optional buffer preface string (set to NULL for no preface).
89  * \param buf Buffer to print.
90  * \param sFmt Buffer entry format string.
91  * \param uCount Number of entries to print.
92  * \param uNLFreq Newline frequency (set to 0 for no newlines).
93  * \param uCol Column alignment number.
94  */
95 extern void DynaPrintBuf(FILE *fp,
96  const char *sPreface,
97  byte_t buf[],
98  const char *sFmt,
99  size_t uCount,
100  size_t uNLFreq,
101  uint_t uCol);
102 
103 #ifdef LOG
104 /*!
105  * \brief Log servo alarms.
106  *
107  * \param nServoId Servo id.
108  * \param uAlarms Alarm bits fields.
109  */
110 extern void DynaLogServoAlarms(int nServoId, uint_t uAlarms);
111 
112 /*!
113  * \brief Log integer data.
114  *
115  * Print diagnostic logging of the contents of a buffer of bytes.
116  *
117  * \param sPreface Buffer preface string.
118  * \param buf Buffer contents to log.
119  * \param uCount Number of entries to log.
120  * \param sFmt Buffer entry format string.
121  */
122 extern void DynaLogBuf(const char *sPreface,
123  byte_t buf[],
124  size_t uCount,
125  const char *sFmt);
126 #endif // LOG
127 
128 #ifndef SWIG
129 C_DECLS_END
130 #endif // SWIG
131 
132 
133 #endif // _DYNA_ERROR_H
const char * DynaStrError(int ecode)
Get the error string describing the Dynamixel error code.
Definition: DynaError.cxx:141
void DynaLogServoAlarms(int nServoId, uint_t uAlarms)
Log servo alarms.
Definition: DynaError.cxx:183
void DynaLogBuf(const char *sPreface, byte_t buf[], size_t uCount, const char *sFmt)
Log integer data.
Definition: DynaError.cxx:206
RoadNarrows Dynamixel Top-Level Package Header File.
void DynaPrintBuf(FILE *fp, const char *sPreface, byte_t buf[], const char *sFmt, size_t uCount, size_t uNLFreq, uint_t uCol)
Pretty print a byte buffer to opened file stream.
Definition: DynaError.cxx:155