|
| 1 | +diff --git a/include/ur_client_library/comm/bin_parser.h b/include/ur_client_library/comm/bin_parser.h |
| 2 | +index e13aba6..6931af3 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,31 @@ |
| 6 | + #pragma once |
| 7 | + |
| 8 | + #include <assert.h> |
| 9 | ++#ifdef __APPLE__ |
| 10 | ++ |
| 11 | ++#include <machine/endian.h> |
| 12 | ++#include <libkern/OSByteOrder.h> |
| 13 | ++ |
| 14 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 15 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 16 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 17 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 18 | ++ |
| 19 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 20 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 21 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 22 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 23 | ++ |
| 24 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 25 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 26 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 27 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 28 | ++ |
| 29 | ++#else |
| 30 | ++ |
| 31 | + #include <endian.h> |
| 32 | ++ |
| 33 | ++#endif /* __APPLE__ */ |
| 34 | + #include <inttypes.h> |
| 35 | + #include <array> |
| 36 | + #include <bitset> |
| 37 | +diff --git a/include/ur_client_library/comm/package_serializer.h b/include/ur_client_library/comm/package_serializer.h |
| 38 | +index 7745da9..78859d9 100644 |
| 39 | +--- a/include/ur_client_library/comm/package_serializer.h |
| 40 | ++++ b/include/ur_client_library/comm/package_serializer.h |
| 41 | +@@ -29,7 +29,31 @@ |
| 42 | + #ifndef UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED |
| 43 | + #define UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED |
| 44 | + |
| 45 | ++#ifdef __APPLE__ |
| 46 | ++ |
| 47 | ++#include <machine/endian.h> |
| 48 | ++#include <libkern/OSByteOrder.h> |
| 49 | ++ |
| 50 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 51 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 52 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 53 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 54 | ++ |
| 55 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 56 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 57 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 58 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 59 | ++ |
| 60 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 61 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 62 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 63 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 64 | ++ |
| 65 | ++#else |
| 66 | ++ |
| 67 | + #include <endian.h> |
| 68 | ++ |
| 69 | ++#endif /* __APPLE__ */ |
| 70 | + #include <cstring> |
| 71 | + |
| 72 | + namespace urcl |
| 73 | +diff --git a/include/ur_client_library/control/reverse_interface.h b/include/ur_client_library/control/reverse_interface.h |
| 74 | +index 9919dbd..077403e 100644 |
| 75 | +--- a/include/ur_client_library/control/reverse_interface.h |
| 76 | ++++ b/include/ur_client_library/control/reverse_interface.h |
| 77 | +@@ -35,7 +35,31 @@ |
| 78 | + #include "ur_client_library/log.h" |
| 79 | + #include "ur_client_library/ur/robot_receive_timeout.h" |
| 80 | + #include <cstring> |
| 81 | ++#ifdef __APPLE__ |
| 82 | ++ |
| 83 | ++#include <machine/endian.h> |
| 84 | ++#include <libkern/OSByteOrder.h> |
| 85 | ++ |
| 86 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 87 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 88 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 89 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 90 | ++ |
| 91 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 92 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 93 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 94 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 95 | ++ |
| 96 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 97 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 98 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 99 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 100 | ++ |
| 101 | ++#else |
| 102 | ++ |
| 103 | + #include <endian.h> |
| 104 | ++ |
| 105 | ++#endif /* __APPLE__ */ |
| 106 | + #include <condition_variable> |
| 107 | + |
| 108 | + namespace urcl |
| 109 | +diff --git a/include/ur_client_library/primary/package_header.h b/include/ur_client_library/primary/package_header.h |
| 110 | +index cd64bda..b4738dd 100644 |
| 111 | +--- a/include/ur_client_library/primary/package_header.h |
| 112 | ++++ b/include/ur_client_library/primary/package_header.h |
| 113 | +@@ -32,7 +32,31 @@ |
| 114 | + |
| 115 | + #include <inttypes.h> |
| 116 | + #include <cstddef> |
| 117 | ++#ifdef __APPLE__ |
| 118 | ++ |
| 119 | ++#include <machine/endian.h> |
| 120 | ++#include <libkern/OSByteOrder.h> |
| 121 | ++ |
| 122 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 123 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 124 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 125 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 126 | ++ |
| 127 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 128 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 129 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 130 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 131 | ++ |
| 132 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 133 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 134 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 135 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 136 | ++ |
| 137 | ++#else |
| 138 | ++ |
| 139 | + #include <endian.h> |
| 140 | ++ |
| 141 | ++#endif /* __APPLE__ */ |
| 142 | + #include "ur_client_library/types.h" |
| 143 | + |
| 144 | + namespace urcl |
| 145 | +diff --git a/include/ur_client_library/rtde/package_header.h b/include/ur_client_library/rtde/package_header.h |
| 146 | +index f910a08..4013e26 100644 |
| 147 | +--- a/include/ur_client_library/rtde/package_header.h |
| 148 | ++++ b/include/ur_client_library/rtde/package_header.h |
| 149 | +@@ -31,7 +31,31 @@ |
| 150 | + #define UR_CLIENT_LIBRARY_RTDE__HEADER_H_INCLUDED |
| 151 | + |
| 152 | + #include <cstddef> |
| 153 | ++#ifdef __APPLE__ |
| 154 | ++ |
| 155 | ++#include <machine/endian.h> |
| 156 | ++#include <libkern/OSByteOrder.h> |
| 157 | ++ |
| 158 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 159 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 160 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 161 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 162 | ++ |
| 163 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 164 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 165 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 166 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 167 | ++ |
| 168 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 169 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 170 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 171 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 172 | ++ |
| 173 | ++#else |
| 174 | ++ |
| 175 | + #include <endian.h> |
| 176 | ++ |
| 177 | ++#endif /* __APPLE__ */ |
| 178 | + #include "ur_client_library/types.h" |
| 179 | + #include "ur_client_library/comm/package_serializer.h" |
| 180 | + |
| 181 | +diff --git a/src/comm/tcp_socket.cpp b/src/comm/tcp_socket.cpp |
| 182 | +index 8803664..f75f381 100644 |
| 183 | +--- a/src/comm/tcp_socket.cpp |
| 184 | ++++ b/src/comm/tcp_socket.cpp |
| 185 | +@@ -21,7 +21,31 @@ |
| 186 | + */ |
| 187 | + |
| 188 | + #include <arpa/inet.h> |
| 189 | ++#ifdef __APPLE__ |
| 190 | ++ |
| 191 | ++#include <machine/endian.h> |
| 192 | ++#include <libkern/OSByteOrder.h> |
| 193 | ++ |
| 194 | ++#define htobe16(x) OSSwapHostToBigInt16(x) |
| 195 | ++#define htole16(x) OSSwapHostToLittleInt16(x) |
| 196 | ++#define be16toh(x) OSSwapBigToHostInt16(x) |
| 197 | ++#define le16toh(x) OSSwapLittleToHostInt16(x) |
| 198 | ++ |
| 199 | ++#define htobe32(x) OSSwapHostToBigInt32(x) |
| 200 | ++#define htole32(x) OSSwapHostToLittleInt32(x) |
| 201 | ++#define be32toh(x) OSSwapBigToHostInt32(x) |
| 202 | ++#define le32toh(x) OSSwapLittleToHostInt32(x) |
| 203 | ++ |
| 204 | ++#define htobe64(x) OSSwapHostToBigInt64(x) |
| 205 | ++#define htole64(x) OSSwapHostToLittleInt64(x) |
| 206 | ++#define be64toh(x) OSSwapBigToHostInt64(x) |
| 207 | ++#define le64toh(x) OSSwapLittleToHostInt64(x) |
| 208 | ++ |
| 209 | ++#else |
| 210 | ++ |
| 211 | + #include <endian.h> |
| 212 | ++ |
| 213 | ++#endif /* __APPLE__ */ |
| 214 | + #include <netinet/tcp.h> |
| 215 | + #include <unistd.h> |
| 216 | + #include <chrono> |
| 217 | +@@ -48,7 +72,9 @@ void TCPSocket::setupOptions() |
| 218 | + { |
| 219 | + int flag = 1; |
| 220 | + setsockopt(socket_fd_, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int)); |
| 221 | ++#ifndef __APPLE__ |
| 222 | + setsockopt(socket_fd_, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(int)); |
| 223 | ++#endif |
| 224 | + |
| 225 | + if (recv_timeout_ != nullptr) |
| 226 | + { |
0 commit comments