Go to the documentation of this file.00001
00005 #ifndef TOOLBOX_HPP
00006 #define TOOLBOX_HPP
00007
00008 #include <stdio.h>
00009 #include <sys/socket.h>
00010 #include <arpa/inet.h>
00011 #include <stdlib.h>
00012 #include <string.h>
00013 #include "sick_scan/tcp/BasicDatatypes.hpp"
00014
00015
00016 int hexCharToValue(char c);
00017
00018
00019 char convertNibbleToHexChar(int value, bool useLowerCaseLetters = false);
00020
00021
00022 void convertUINT8toHexString(UINT8 byte, char* buffer);
00023
00024
00025 void convertRGBtoHexString(UINT8 r, UINT8 g, UINT8 b, char* buffer);
00026
00027
00028 double makeAngleValid(double angle);
00029
00030
00031 std::string ipTargetToString(UINT32 ipAddress, UINT16 port);
00032
00033 std::string ipAdrToString(UINT32 ipAddress);
00034
00035
00036
00037 void stringToIpTarget(std::string ipAdrStr, UINT32& ipAddress, UINT16& port);
00038
00039
00040 std::string toHexString(UINT32 val);
00041 std::string toHexString(UINT16 val);
00042 std::string toHexString(UINT8 val);
00043 std::string toHexStringNbble(UINT8 val);
00044
00045
00046 std::string toString(UINT32 val);
00047 std::string toString(INT32 val);
00048 #if INTPTR_MAX != INT32_MAX
00049 std::string toString(size_t val);
00050 #endif
00051
00052
00053 std::string toString(double val, int digits_after_decimal_point);
00054 std::string doubleToString(double val, int digits_after_decimal_point);
00055 std::string doubleToString(double val, int digits_before_decimal_point, int digits_after_decimal_point);
00056
00057
00058 std::string convertMeterToFeetAndInch(double m);
00059
00060
00061 UINT16 fromString(const std::string& text);
00062
00063
00064 std::string toLower(const std::string& text);
00065
00066
00067
00068
00069
00070 void traceBuffer(std::string headerText, BYTE* buffer, UINT32 len);
00071
00072
00073
00074
00075 UINT32 memread_UINT32(BYTE*& buffer);
00076 UINT16 memread_UINT16(BYTE*& buffer);
00077 UINT8 memread_UINT8(BYTE*& buffer);
00078 INT32 memread_INT32(BYTE*& buffer);
00079 INT16 memread_INT16(BYTE*& buffer);
00080 float memread_float(BYTE*& buffer);
00081 std::string memread_string(BYTE*& buffer, UINT16 length);
00082
00083 void memwrite_float(BYTE*& buffer, float value);
00084 void memwrite_INT32(BYTE*& buffer, INT32 value);
00085 void memwrite_UINT32(BYTE*& buffer, UINT32 value);
00086 void memwrite_INT16(BYTE*& buffer, INT16 value);
00087 void memwrite_UINT16(BYTE*& buffer, UINT16 value);
00088 void memwrite_INT8(BYTE*& buffer, INT8 value);
00089 void memwrite_UINT8(BYTE*& buffer, UINT8 value);
00090 void memwrite_string(BYTE*& buffer, std::string text);
00091
00092 #endif // TOOLBOX_HPP