All Classes Namespaces Files Functions Variables Enumerations Enumerator
libs/range_sensor/c/urg_errno.c
Go to the documentation of this file.
00001 
00010 #include "urg_errno.h"
00011 
00012 
00013 /* Returns error message */
00014 const char* urg_strerror(const int errno)
00015 {
00016   const char *errorStr[] = {
00017     "Unknown",
00018     "Not Implemented.",
00019     "Send fail.",
00020     "Receive fail.",
00021     "SCIP1.1 protocol is not supported. Please update URG firmware.",
00022     "SS fail.",
00023     "Adjust baudrate fail.",
00024     "Invalid parameters.",
00025     "Urg invalid response.",
00026     "Serial connection fail.",
00027     "Serial receive fail.",
00028     "Response mismatch.",
00029     "No Response.",
00030     "UTM-30LX is not supported GD_INTENSITY. Please use MD_INTENSITY",
00031     "dummy.",
00032   };
00033 
00034   int n = sizeof(errorStr) / sizeof(errorStr[0]);
00035   if ((-errno >= n) || (errno > 0)) {
00036     return errorStr[0];
00037   }
00038 
00039   return errorStr[-errno];
00040 }