|
| 1 | +diff --git a/include/ur_client_library/comm/bin_parser.h b/include/ur_client_library/comm/bin_parser.h |
| 2 | +index e13aba6..6de673e 100644 |
| 3 | +--- a/include/ur_client_library/comm/bin_parser.h |
| 4 | ++++ b/include/ur_client_library/comm/bin_parser.h |
| 5 | +@@ -21,7 +21,6 @@ |
| 6 | + #pragma once |
| 7 | + |
| 8 | + #include <assert.h> |
| 9 | +-#include <endian.h> |
| 10 | + #include <inttypes.h> |
| 11 | + #include <array> |
| 12 | + #include <bitset> |
| 13 | +@@ -29,6 +28,7 @@ |
| 14 | + #include <cstring> |
| 15 | + #include <string> |
| 16 | + #include <memory> |
| 17 | ++#include "ur_client_library/endian.h" |
| 18 | + #include "ur_client_library/log.h" |
| 19 | + #include "ur_client_library/types.h" |
| 20 | + #include "ur_client_library/exceptions.h" |
| 21 | +diff --git a/include/ur_client_library/comm/package_serializer.h b/include/ur_client_library/comm/package_serializer.h |
| 22 | +index 7745da9..ebf128e 100644 |
| 23 | +--- a/include/ur_client_library/comm/package_serializer.h |
| 24 | ++++ b/include/ur_client_library/comm/package_serializer.h |
| 25 | +@@ -29,7 +29,7 @@ |
| 26 | + #ifndef UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED |
| 27 | + #define UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED |
| 28 | + |
| 29 | +-#include <endian.h> |
| 30 | ++#include "ur_client_library/endian.h" |
| 31 | + #include <cstring> |
| 32 | + |
| 33 | + namespace urcl |
| 34 | +diff --git a/include/ur_client_library/control/reverse_interface.h b/include/ur_client_library/control/reverse_interface.h |
| 35 | +index e68acd9..aa9d1c1 100644 |
| 36 | +--- a/include/ur_client_library/control/reverse_interface.h |
| 37 | ++++ b/include/ur_client_library/control/reverse_interface.h |
| 38 | +@@ -29,13 +29,13 @@ |
| 39 | + #ifndef UR_CLIENT_LIBRARY_REVERSE_INTERFACE_H_INCLUDED |
| 40 | + #define UR_CLIENT_LIBRARY_REVERSE_INTERFACE_H_INCLUDED |
| 41 | + |
| 42 | ++#include "ur_client_library/endian.h" |
| 43 | + #include "ur_client_library/comm/tcp_server.h" |
| 44 | + #include "ur_client_library/comm/control_mode.h" |
| 45 | + #include "ur_client_library/types.h" |
| 46 | + #include "ur_client_library/log.h" |
| 47 | + #include "ur_client_library/ur/robot_receive_timeout.h" |
| 48 | + #include <cstring> |
| 49 | +-#include <endian.h> |
| 50 | + #include <condition_variable> |
| 51 | + |
| 52 | + namespace urcl |
| 53 | +diff --git a/include/ur_client_library/endian.h b/include/ur_client_library/endian.h |
| 54 | +new file mode 100644 |
| 55 | +index 0000000..9c5500b |
| 56 | +--- /dev/null |
| 57 | ++++ b/include/ur_client_library/endian.h |
| 58 | +@@ -0,0 +1,103 @@ |
| 59 | ++// |
| 60 | ++// endian.h |
| 61 | ++// |
| 62 | ++// https://gist.github.com/panzi/6856583 |
| 63 | ++// |
| 64 | ++// I, Mathias Panzenböck, place this file hereby into the public domain. Use |
| 65 | ++// it at your own risk for whatever you like. In case there are |
| 66 | ++// jurisdictions that don't support putting things in the public domain you |
| 67 | ++// can also consider it to be "dual licensed" under the BSD, MIT and Apache |
| 68 | ++// licenses, if you want to. This code is trivial anyway. Consider it an |
| 69 | ++// example on how to get the endian conversion functions on different |
| 70 | ++// platforms. |
| 71 | ++ |
| 72 | ++#ifndef PORTABLE_ENDIAN_H__ |
| 73 | ++#define PORTABLE_ENDIAN_H__ |
| 74 | ++ |
| 75 | ++// Byte order |
| 76 | ++#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__CYGWIN__) |
| 77 | ++# include <endian.h> |
| 78 | ++#elif defined(__APPLE__) |
| 79 | ++# include <libkern/OSByteOrder.h> |
| 80 | ++ |
| 81 | ++# define htobe16(x) OSSwapHostToBigInt16(x) |
| 82 | ++# define htole16(x) OSSwapHostToLittleInt16(x) |
| 83 | ++# define be16toh(x) OSSwapBigToHostInt16(x) |
| 84 | ++# define le16toh(x) OSSwapLittleToHostInt16(x) |
| 85 | ++ |
| 86 | ++# define htobe32(x) OSSwapHostToBigInt32(x) |
| 87 | ++# define htole32(x) OSSwapHostToLittleInt32(x) |
| 88 | ++# define be32toh(x) OSSwapBigToHostInt32(x) |
| 89 | ++# define le32toh(x) OSSwapLittleToHostInt32(x) |
| 90 | ++ |
| 91 | ++# define htobe64(x) OSSwapHostToBigInt64(x) |
| 92 | ++# define htole64(x) OSSwapHostToLittleInt64(x) |
| 93 | ++# define be64toh(x) OSSwapBigToHostInt64(x) |
| 94 | ++# define le64toh(x) OSSwapLittleToHostInt64(x) |
| 95 | ++ |
| 96 | ++# define __BYTE_ORDER BYTE_ORDER |
| 97 | ++# define __BIG_ENDIAN BIG_ENDIAN |
| 98 | ++# define __LITTLE_ENDIAN LITTLE_ENDIAN |
| 99 | ++# define __PDP_ENDIAN PDP_ENDIAN |
| 100 | ++#elif defined(__OpenBSD__) |
| 101 | ++# include <sys/endian.h> |
| 102 | ++#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) |
| 103 | ++# include <sys/endian.h> |
| 104 | ++ |
| 105 | ++# define be16toh(x) betoh16(x) |
| 106 | ++# define le16toh(x) letoh16(x) |
| 107 | ++ |
| 108 | ++# define be32toh(x) betoh32(x) |
| 109 | ++# define le32toh(x) letoh32(x) |
| 110 | ++ |
| 111 | ++# define be64toh(x) betoh64(x) |
| 112 | ++# define le64toh(x) letoh64(x) |
| 113 | ++#elif defined(_WIN32) |
| 114 | ++# include <stdlib.h> |
| 115 | ++# if BYTE_ORDER == LITTLE_ENDIAN |
| 116 | ++# if defined(_MSC_VER) |
| 117 | ++# define htobe16(x) _byteswap_ushort(x) |
| 118 | ++# define htole16(x) (x) |
| 119 | ++# define be16toh(x) _byteswap_ushort(x) |
| 120 | ++# define le16toh(x) (x) |
| 121 | ++ |
| 122 | ++# define htobe32(x) _byteswap_ulong(x) |
| 123 | ++# define htole32(x) (x) |
| 124 | ++# define be32toh(x) _byteswap_ulong(x) |
| 125 | ++# define le32toh(x) (x) |
| 126 | ++ |
| 127 | ++# define htobe64(x) _byteswap_uint64(x) |
| 128 | ++# define htole64(x) (x) |
| 129 | ++# define be64toh(x) _byteswap_uint64(x) |
| 130 | ++# define le64toh(x) (x) |
| 131 | ++# elif defined(__GNUC__) || defined(__clang__) |
| 132 | ++# define htobe16(x) __builtin_bswap16(x) |
| 133 | ++# define htole16(x) (x) |
| 134 | ++# define be16toh(x) __builtin_bswap16(x) |
| 135 | ++# define le16toh(x) (x) |
| 136 | ++ |
| 137 | ++# define htobe32(x) __builtin_bswap32(x) |
| 138 | ++# define htole32(x) (x) |
| 139 | ++# define be32toh(x) __builtin_bswap32(x) |
| 140 | ++# define le32toh(x) (x) |
| 141 | ++ |
| 142 | ++# define htobe64(x) __builtin_bswap64(x) |
| 143 | ++# define htole64(x) (x) |
| 144 | ++# define be64toh(x) __builtin_bswap64(x) |
| 145 | ++# define le64toh(x) (x) |
| 146 | ++# else |
| 147 | ++# error Compiler is not supported |
| 148 | ++# endif |
| 149 | ++# else |
| 150 | ++# error Byte order is not supported |
| 151 | ++# endif |
| 152 | ++ |
| 153 | ++# define __BYTE_ORDER BYTE_ORDER |
| 154 | ++# define __BIG_ENDIAN BIG_ENDIAN |
| 155 | ++# define __LITTLE_ENDIAN LITTLE_ENDIAN |
| 156 | ++# define __PDP_ENDIAN PDP_ENDIAN |
| 157 | ++#else |
| 158 | ++# error Platform is not supported |
| 159 | ++#endif |
| 160 | ++ |
| 161 | ++#endif // PORTABLE_ENDIAN_H__ |
| 162 | +diff --git a/include/ur_client_library/primary/package_header.h b/include/ur_client_library/primary/package_header.h |
| 163 | +index cd64bda..b5c2754 100644 |
| 164 | +--- a/include/ur_client_library/primary/package_header.h |
| 165 | ++++ b/include/ur_client_library/primary/package_header.h |
| 166 | +@@ -32,7 +32,7 @@ |
| 167 | + |
| 168 | + #include <inttypes.h> |
| 169 | + #include <cstddef> |
| 170 | +-#include <endian.h> |
| 171 | ++#include "ur_client_library/endian.h" |
| 172 | + #include "ur_client_library/types.h" |
| 173 | + |
| 174 | + namespace urcl |
| 175 | +diff --git a/include/ur_client_library/rtde/package_header.h b/include/ur_client_library/rtde/package_header.h |
| 176 | +index f910a08..066e004 100644 |
| 177 | +--- a/include/ur_client_library/rtde/package_header.h |
| 178 | ++++ b/include/ur_client_library/rtde/package_header.h |
| 179 | +@@ -31,7 +31,7 @@ |
| 180 | + #define UR_CLIENT_LIBRARY_RTDE__HEADER_H_INCLUDED |
| 181 | + |
| 182 | + #include <cstddef> |
| 183 | +-#include <endian.h> |
| 184 | ++#include "ur_client_library/endian.h" |
| 185 | + #include "ur_client_library/types.h" |
| 186 | + #include "ur_client_library/comm/package_serializer.h" |
| 187 | + |
| 188 | +diff --git a/src/comm/tcp_socket.cpp b/src/comm/tcp_socket.cpp |
| 189 | +index 778e5f1..55f60c8 100644 |
| 190 | +--- a/src/comm/tcp_socket.cpp |
| 191 | ++++ b/src/comm/tcp_socket.cpp |
| 192 | +@@ -20,7 +20,6 @@ |
| 193 | + * limitations under the License. |
| 194 | + */ |
| 195 | + |
| 196 | +-#include <endian.h> |
| 197 | + #include <chrono> |
| 198 | + #include <cstring> |
| 199 | + #include <sstream> |
| 200 | +@@ -31,6 +30,7 @@ |
| 201 | + # include <netinet/tcp.h> |
| 202 | + #endif |
| 203 | + |
| 204 | ++#include "ur_client_library/endian.h" |
| 205 | + #include "ur_client_library/log.h" |
| 206 | + #include "ur_client_library/comm/tcp_socket.h" |
| 207 | + |
0 commit comments