simplejsble 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroSimplejsble.podspec +22 -8
- package/dependencies/internal/include/simplejni/VM.hpp +0 -1
- package/lib/specs/Adapter.nitro.js +1 -1
- package/macos/CMakeLists.txt +21 -0
- package/macos/SimpleBLE-macos.xcframework/Info.plist +30 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Adapter.h +102 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/AdapterSafe.h +58 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Advanced.h +50 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Characteristic.h +39 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Config.h +64 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Descriptor.h +30 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Exceptions.h +72 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Logging.h +73 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Peripheral.h +82 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/PeripheralSafe.h +64 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Service.h +34 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/SimpleBLE.h +8 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Types.h +49 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/Utils.h +13 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/export.h +43 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/Headers/simpleble/kvn/kvn_bytearray.h +297 -0
- package/macos/SimpleBLE-macos.xcframework/macos-arm64_x86_64/libsimpleble.a +0 -0
- package/macos/build_simpleble.sh +61 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Adapter.h +102 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/AdapterSafe.h +58 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Advanced.h +50 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Characteristic.h +39 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Config.h +64 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Descriptor.h +30 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Exceptions.h +72 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Logging.h +73 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Peripheral.h +82 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/PeripheralSafe.h +64 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Service.h +34 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/SimpleBLE.h +8 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Types.h +49 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/Utils.h +13 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/export.h +43 -0
- package/macos/simpleble_macosx_arm64/include/simpleble/kvn/kvn_bytearray.h +297 -0
- package/macos/simpleble_macosx_arm64/lib/cmake/simpleble/simpleble-config-release.cmake +19 -0
- package/macos/simpleble_macosx_arm64/lib/cmake/simpleble/simpleble-config.cmake +107 -0
- package/macos/simpleble_macosx_arm64/lib/libsimpleble.a +0 -0
- package/macos/simpleble_macosx_arm64/lib/pkgconfig/simpleble.pc +11 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Adapter.h +102 -0
- package/macos/simpleble_macosx_universal/include/simpleble/AdapterSafe.h +58 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Advanced.h +50 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Characteristic.h +39 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Config.h +64 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Descriptor.h +30 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Exceptions.h +72 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Logging.h +73 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Peripheral.h +82 -0
- package/macos/simpleble_macosx_universal/include/simpleble/PeripheralSafe.h +64 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Service.h +34 -0
- package/macos/simpleble_macosx_universal/include/simpleble/SimpleBLE.h +8 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Types.h +49 -0
- package/macos/simpleble_macosx_universal/include/simpleble/Utils.h +13 -0
- package/macos/simpleble_macosx_universal/include/simpleble/export.h +43 -0
- package/macos/simpleble_macosx_universal/include/simpleble/kvn/kvn_bytearray.h +297 -0
- package/macos/simpleble_macosx_universal/lib/libsimpleble.a +0 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Adapter.h +102 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/AdapterSafe.h +58 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Advanced.h +50 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Characteristic.h +39 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Config.h +64 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Descriptor.h +30 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Exceptions.h +72 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Logging.h +73 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Peripheral.h +82 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/PeripheralSafe.h +64 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Service.h +34 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/SimpleBLE.h +8 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Types.h +49 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/Utils.h +13 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/export.h +43 -0
- package/macos/simpleble_macosx_x86_64/include/simpleble/kvn/kvn_bytearray.h +297 -0
- package/macos/simpleble_macosx_x86_64/lib/cmake/simpleble/simpleble-config-release.cmake +19 -0
- package/macos/simpleble_macosx_x86_64/lib/cmake/simpleble/simpleble-config.cmake +107 -0
- package/macos/simpleble_macosx_x86_64/lib/libsimpleble.a +0 -0
- package/macos/simpleble_macosx_x86_64/lib/pkgconfig/simpleble.pc +11 -0
- package/package.json +5 -3
- package/react-native.config.js +4 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
#ifndef KVN_BYTEARRAY_H
|
|
2
|
+
#define KVN_BYTEARRAY_H
|
|
3
|
+
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <cstring>
|
|
6
|
+
#include <iomanip>
|
|
7
|
+
#include <iostream>
|
|
8
|
+
#include <memory>
|
|
9
|
+
#include <sstream>
|
|
10
|
+
#include <stdexcept>
|
|
11
|
+
#include <type_traits>
|
|
12
|
+
#include <vector>
|
|
13
|
+
|
|
14
|
+
namespace kvn {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @class bytearray
|
|
18
|
+
* @brief A class to handle byte arrays and their conversion from/to hex strings.
|
|
19
|
+
*/
|
|
20
|
+
class bytearray {
|
|
21
|
+
public:
|
|
22
|
+
/**
|
|
23
|
+
* @brief Default constructor.
|
|
24
|
+
*/
|
|
25
|
+
bytearray() = default;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @brief Constructs byte array from a vector of uint8_t.
|
|
29
|
+
* @param vec A vector of uint8_t.
|
|
30
|
+
*/
|
|
31
|
+
bytearray(const std::vector<uint8_t>& vec) : data_(vec) {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @brief Constructs byte array from a raw pointer and size.
|
|
35
|
+
* @param ptr A pointer to uint8_t data.
|
|
36
|
+
* @param size The size of the data.
|
|
37
|
+
*/
|
|
38
|
+
bytearray(const uint8_t* ptr, size_t size) : data_(ptr, ptr + size) {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @brief Constructs byte array from iterators.
|
|
42
|
+
* @tparam InputIt Iterator type.
|
|
43
|
+
* @param first Iterator to the first element.
|
|
44
|
+
* @param last Iterator to one past the last element.
|
|
45
|
+
*/
|
|
46
|
+
template <typename InputIt>
|
|
47
|
+
bytearray(InputIt first, InputIt last) : data_(first, last) {}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @brief Constructs byte array from a std::string.
|
|
51
|
+
* @param byteArr A string containing byte data.
|
|
52
|
+
*/
|
|
53
|
+
bytearray(const std::string& byteArr) : data_(byteArr.begin(), byteArr.end()) {}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @brief Constructs byte array from a C-style string and size.
|
|
57
|
+
* @param byteArr A C-style string.
|
|
58
|
+
* @param size The size of the string.
|
|
59
|
+
*/
|
|
60
|
+
bytearray(const char* byteArr, size_t size) : bytearray(std::string(byteArr, size)) {}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @brief Constructs byte array from a C-style string.
|
|
64
|
+
* @param byteArr A C-style string.
|
|
65
|
+
*/
|
|
66
|
+
bytearray(const char* byteArr) : bytearray(std::string(byteArr)) {}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @brief Constructs a byte array of specified size, initialized with zeros.
|
|
70
|
+
* @param size The number of bytes to allocate.
|
|
71
|
+
*/
|
|
72
|
+
explicit bytearray(size_t size) : data_(size) {}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @brief Creates a ByteArray from a hex string.
|
|
76
|
+
*
|
|
77
|
+
* Case is ignored and the string may have a '0x' hex prefix or not.
|
|
78
|
+
*
|
|
79
|
+
* @param hexStr A string containing hex data.
|
|
80
|
+
* @return A ByteArray object.
|
|
81
|
+
* @throws std::invalid_argument If the hex string contains non-hexadecimal characters.
|
|
82
|
+
* @throws std::length_error If the hex string length is not even.
|
|
83
|
+
*/
|
|
84
|
+
static bytearray fromHex(const std::string& hexStr) {
|
|
85
|
+
std::string cleanString(hexStr);
|
|
86
|
+
|
|
87
|
+
// Check and skip the '0x' prefix if present
|
|
88
|
+
if (cleanString.size() >= 2 && cleanString.substr(0, 2) == "0x") {
|
|
89
|
+
cleanString = cleanString.substr(2);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
size_t size = cleanString.size();
|
|
93
|
+
if (size % 2 != 0) {
|
|
94
|
+
throw std::length_error("Hex string length must be even.");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
bytearray byteArray;
|
|
98
|
+
byteArray.data_.reserve(size / 2);
|
|
99
|
+
|
|
100
|
+
for (size_t i = 0; i < size; i += 2) {
|
|
101
|
+
uint8_t byte = static_cast<uint8_t>(std::stoi(cleanString.substr(i, 2), nullptr, 16));
|
|
102
|
+
byteArray.data_.push_back(byte);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return byteArray;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @overload
|
|
110
|
+
*/
|
|
111
|
+
static bytearray fromHex(const char* byteArr) { return fromHex(std::string(byteArr)); }
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @overload
|
|
115
|
+
*/
|
|
116
|
+
static bytearray fromHex(const char* byteArr, size_t size) { return fromHex(std::string(byteArr, size)); }
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @brief Converts the byte array to a lowercase hex string without '0x' prefix.
|
|
120
|
+
* @param spacing Whether to include spaces between bytes.
|
|
121
|
+
*
|
|
122
|
+
* @return A hex string representation of the byte array.
|
|
123
|
+
*/
|
|
124
|
+
std::string toHex(bool spacing = false) const {
|
|
125
|
+
std::ostringstream oss;
|
|
126
|
+
for (auto byte : data_) {
|
|
127
|
+
oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte);
|
|
128
|
+
if (spacing) {
|
|
129
|
+
oss << " ";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return oss.str();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @brief Slices the byte array from a specified start index to an end index.
|
|
137
|
+
*
|
|
138
|
+
* This method creates a new byte array containing bytes from the specified range.
|
|
139
|
+
* The start index is inclusive, while the end index is exclusive.
|
|
140
|
+
*
|
|
141
|
+
* @param start The starting index from which to begin slicing.
|
|
142
|
+
* @param end The ending index up to which to slice (exclusive).
|
|
143
|
+
* @return byte array A new byte array containing the sliced segment.
|
|
144
|
+
* @throws std::out_of_range If the start index is greater than the end index or if the end index is out of bounds.
|
|
145
|
+
*/
|
|
146
|
+
bytearray slice(size_t start, size_t end) const {
|
|
147
|
+
if (start > end || end > data_.size()) {
|
|
148
|
+
throw std::out_of_range("Invalid slice range");
|
|
149
|
+
}
|
|
150
|
+
return bytearray(std::vector<uint8_t>(data_.begin() + start, data_.begin() + end));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @brief Slices the byte array from a specified start index to the end of the array.
|
|
155
|
+
*
|
|
156
|
+
* This method creates a new byte array containing all bytes from the specified start index to the end of the
|
|
157
|
+
* byte array.
|
|
158
|
+
*
|
|
159
|
+
* @param start The starting index from which to begin slicing.
|
|
160
|
+
* @return byte array A new byte array containing the sliced segment from the start index to the end.
|
|
161
|
+
* @throws std::out_of_range If the start index is out of the bounds of the byte array.
|
|
162
|
+
*/
|
|
163
|
+
bytearray slice_from(size_t start) const { return slice(start, data_.size()); }
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @brief Slices the byte array from the beginning to a specified end index.
|
|
167
|
+
*
|
|
168
|
+
* This method creates a new byte array containing all bytes from the beginning of the byte array to the specified
|
|
169
|
+
* end index.
|
|
170
|
+
*
|
|
171
|
+
* @param end The ending index up to which to slice (exclusive).
|
|
172
|
+
* @return byte array A new byte array containing the sliced segment from the beginning to the end index.
|
|
173
|
+
* @throws std::out_of_range If the end index is out of the bounds of the byte array.
|
|
174
|
+
*/
|
|
175
|
+
bytearray slice_to(size_t end) const { return slice(0, end); }
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @brief Overloaded stream insertion operator for byte array.
|
|
179
|
+
* @param os The output stream.
|
|
180
|
+
* @param byteArray The byte array object.
|
|
181
|
+
* @return The output stream.
|
|
182
|
+
*/
|
|
183
|
+
friend std::ostream& operator<<(std::ostream& os, const bytearray& byteArray) {
|
|
184
|
+
os << byteArray.toHex(true);
|
|
185
|
+
return os;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @brief Conversion operator to convert byte array to std::string.
|
|
190
|
+
*
|
|
191
|
+
* @note This is provided to support code that relies on byte array
|
|
192
|
+
* being representd as a string.
|
|
193
|
+
* @return String containing the raw bytes of the byte array
|
|
194
|
+
*/
|
|
195
|
+
operator std::string() const { return std::string(data_.begin(), data_.end()); }
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @brief Conversion operator to convert byte array to std::vector<uint8_t>.
|
|
199
|
+
* @return Vector containing the raw bytes of the byte array
|
|
200
|
+
*/
|
|
201
|
+
operator std::vector<uint8_t>() const { return data_; }
|
|
202
|
+
|
|
203
|
+
//! @cond Doxygen_Suppress
|
|
204
|
+
// Expose vector-like functionality
|
|
205
|
+
size_t size() const { return data_.size(); }
|
|
206
|
+
const uint8_t* data() const { return data_.data(); }
|
|
207
|
+
uint8_t* data() { return data_.data(); }
|
|
208
|
+
bool empty() const { return data_.empty(); }
|
|
209
|
+
void clear() { data_.clear(); }
|
|
210
|
+
uint8_t& operator[](size_t index) { return data_[index]; }
|
|
211
|
+
const uint8_t& operator[](size_t index) const { return data_[index]; }
|
|
212
|
+
void push_back(uint8_t byte) { data_.push_back(byte); }
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @brief Appends a uint16_t value as 2 little-endian bytes.
|
|
216
|
+
* @param value The uint16_t value to append.
|
|
217
|
+
*/
|
|
218
|
+
void push_back(uint16_t value) {
|
|
219
|
+
for (size_t i = 0; i < 2; ++i) {
|
|
220
|
+
data_.push_back(static_cast<uint8_t>(value >> (i * 8)));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @brief Appends a uint32_t value as 4 little-endian bytes.
|
|
226
|
+
* @param value The uint32_t value to append.
|
|
227
|
+
*/
|
|
228
|
+
void push_back(uint32_t value) {
|
|
229
|
+
for (size_t i = 0; i < 4; ++i) {
|
|
230
|
+
data_.push_back(static_cast<uint8_t>(value >> (i * 8)));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @brief Appends a uint64_t value as 8 little-endian bytes.
|
|
236
|
+
* @param value The uint64_t value to append.
|
|
237
|
+
*/
|
|
238
|
+
void push_back(uint64_t value) {
|
|
239
|
+
for (size_t i = 0; i < 8; ++i) {
|
|
240
|
+
data_.push_back(static_cast<uint8_t>(value >> (i * 8)));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
auto begin() { return data_.begin(); }
|
|
244
|
+
auto begin() const { return data_.begin(); }
|
|
245
|
+
auto end() { return data_.end(); }
|
|
246
|
+
auto end() const { return data_.end(); }
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @brief Inserts a single byte at the specified position.
|
|
250
|
+
* @param pos Iterator to the position where the element is inserted.
|
|
251
|
+
* @param value The byte to insert.
|
|
252
|
+
* @return Iterator pointing to the inserted element.
|
|
253
|
+
*/
|
|
254
|
+
auto insert(typename std::vector<uint8_t>::iterator pos, uint8_t value) { return data_.insert(pos, value); }
|
|
255
|
+
auto insert(typename std::vector<uint8_t>::const_iterator pos, uint8_t value) { return data_.insert(pos, value); }
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* @brief Inserts multiple copies of a byte at the specified position.
|
|
259
|
+
* @param pos Iterator to the position where the elements are inserted.
|
|
260
|
+
* @param count Number of copies to insert.
|
|
261
|
+
* @param value The byte to insert.
|
|
262
|
+
* @return Iterator pointing to the first inserted element.
|
|
263
|
+
*/
|
|
264
|
+
auto insert(typename std::vector<uint8_t>::iterator pos, size_t count, uint8_t value) { return data_.insert(pos, count, value); }
|
|
265
|
+
auto insert(typename std::vector<uint8_t>::const_iterator pos, size_t count, uint8_t value) { return data_.insert(pos, count, value); }
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @brief Inserts elements from a range at the specified position.
|
|
269
|
+
* @tparam InputIt Iterator type.
|
|
270
|
+
* @param pos Iterator to the position where the elements are inserted.
|
|
271
|
+
* @param first Iterator to the first element of the range.
|
|
272
|
+
* @param last Iterator to one past the last element of the range.
|
|
273
|
+
* @return Iterator pointing to the first inserted element.
|
|
274
|
+
*/
|
|
275
|
+
template <typename InputIt>
|
|
276
|
+
auto insert(typename std::vector<uint8_t>::iterator pos, InputIt first, InputIt last) { return data_.insert(pos, first, last); }
|
|
277
|
+
template <typename InputIt>
|
|
278
|
+
auto insert(typename std::vector<uint8_t>::const_iterator pos, InputIt first, InputIt last) { return data_.insert(pos, first, last); }
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @brief Inserts another bytearray at the specified position.
|
|
282
|
+
* @param pos Iterator to the position where the elements are inserted.
|
|
283
|
+
* @param other The bytearray to insert.
|
|
284
|
+
* @return Iterator pointing to the first inserted element.
|
|
285
|
+
*/
|
|
286
|
+
auto insert(typename std::vector<uint8_t>::iterator pos, const bytearray& other) { return data_.insert(pos, other.begin(), other.end()); }
|
|
287
|
+
auto insert(typename std::vector<uint8_t>::const_iterator pos, const bytearray& other) { return data_.insert(pos, other.begin(), other.end()); }
|
|
288
|
+
|
|
289
|
+
//! @endcond
|
|
290
|
+
|
|
291
|
+
private:
|
|
292
|
+
std::vector<uint8_t> data_;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
} // namespace kvn
|
|
296
|
+
|
|
297
|
+
#endif // KVN_BYTEARRAY_H
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#----------------------------------------------------------------
|
|
2
|
+
# Generated CMake target import file for configuration "Release".
|
|
3
|
+
#----------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
# Commands may need to know the format version.
|
|
6
|
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
7
|
+
|
|
8
|
+
# Import target "simpleble::simpleble" for configuration "Release"
|
|
9
|
+
set_property(TARGET simpleble::simpleble APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
|
10
|
+
set_target_properties(simpleble::simpleble PROPERTIES
|
|
11
|
+
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C;CXX;OBJCXX"
|
|
12
|
+
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libsimpleble.a"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
list(APPEND _cmake_import_check_targets simpleble::simpleble )
|
|
16
|
+
list(APPEND _cmake_import_check_files_for_simpleble::simpleble "${_IMPORT_PREFIX}/lib/libsimpleble.a" )
|
|
17
|
+
|
|
18
|
+
# Commands beyond this point should not need to know the version.
|
|
19
|
+
set(CMAKE_IMPORT_FILE_VERSION)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Generated by CMake
|
|
2
|
+
|
|
3
|
+
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
|
4
|
+
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
5
|
+
endif()
|
|
6
|
+
if(CMAKE_VERSION VERSION_LESS "2.8.12")
|
|
7
|
+
message(FATAL_ERROR "CMake >= 2.8.12 required")
|
|
8
|
+
endif()
|
|
9
|
+
cmake_policy(PUSH)
|
|
10
|
+
cmake_policy(VERSION 2.8.12...4.0)
|
|
11
|
+
#----------------------------------------------------------------
|
|
12
|
+
# Generated CMake target import file.
|
|
13
|
+
#----------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
# Commands may need to know the format version.
|
|
16
|
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
17
|
+
|
|
18
|
+
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
|
19
|
+
set(_cmake_targets_defined "")
|
|
20
|
+
set(_cmake_targets_not_defined "")
|
|
21
|
+
set(_cmake_expected_targets "")
|
|
22
|
+
foreach(_cmake_expected_target IN ITEMS simpleble::simpleble)
|
|
23
|
+
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
|
24
|
+
if(TARGET "${_cmake_expected_target}")
|
|
25
|
+
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
|
26
|
+
else()
|
|
27
|
+
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
|
28
|
+
endif()
|
|
29
|
+
endforeach()
|
|
30
|
+
unset(_cmake_expected_target)
|
|
31
|
+
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
|
32
|
+
unset(_cmake_targets_defined)
|
|
33
|
+
unset(_cmake_targets_not_defined)
|
|
34
|
+
unset(_cmake_expected_targets)
|
|
35
|
+
unset(CMAKE_IMPORT_FILE_VERSION)
|
|
36
|
+
cmake_policy(POP)
|
|
37
|
+
return()
|
|
38
|
+
endif()
|
|
39
|
+
if(NOT _cmake_targets_defined STREQUAL "")
|
|
40
|
+
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
|
41
|
+
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
|
42
|
+
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
|
43
|
+
endif()
|
|
44
|
+
unset(_cmake_targets_defined)
|
|
45
|
+
unset(_cmake_targets_not_defined)
|
|
46
|
+
unset(_cmake_expected_targets)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Compute the installation prefix relative to this file.
|
|
50
|
+
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
51
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
52
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
53
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
54
|
+
if(_IMPORT_PREFIX STREQUAL "/")
|
|
55
|
+
set(_IMPORT_PREFIX "")
|
|
56
|
+
endif()
|
|
57
|
+
|
|
58
|
+
# Create imported target simpleble::simpleble
|
|
59
|
+
add_library(simpleble::simpleble STATIC IMPORTED)
|
|
60
|
+
|
|
61
|
+
set_target_properties(simpleble::simpleble PROPERTIES
|
|
62
|
+
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
63
|
+
INTERFACE_LINK_LIBRARIES "-framework Foundation;-framework CoreBluetooth;ObjC;-framework IOBluetooth;-framework IOKit"
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Load information for each installed configuration.
|
|
67
|
+
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/simpleble-config-*.cmake")
|
|
68
|
+
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
|
69
|
+
include("${_cmake_config_file}")
|
|
70
|
+
endforeach()
|
|
71
|
+
unset(_cmake_config_file)
|
|
72
|
+
unset(_cmake_config_files)
|
|
73
|
+
|
|
74
|
+
# Cleanup temporary variables.
|
|
75
|
+
set(_IMPORT_PREFIX)
|
|
76
|
+
|
|
77
|
+
# Loop over all imported files and verify that they actually exist
|
|
78
|
+
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
|
79
|
+
if(CMAKE_VERSION VERSION_LESS "3.28"
|
|
80
|
+
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
|
81
|
+
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
|
82
|
+
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
|
83
|
+
if(NOT EXISTS "${_cmake_file}")
|
|
84
|
+
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
|
85
|
+
\"${_cmake_file}\"
|
|
86
|
+
but this file does not exist. Possible reasons include:
|
|
87
|
+
* The file was deleted, renamed, or moved to another location.
|
|
88
|
+
* An install or uninstall procedure did not complete successfully.
|
|
89
|
+
* The installation package was faulty and contained
|
|
90
|
+
\"${CMAKE_CURRENT_LIST_FILE}\"
|
|
91
|
+
but not all the files it references.
|
|
92
|
+
")
|
|
93
|
+
endif()
|
|
94
|
+
endforeach()
|
|
95
|
+
endif()
|
|
96
|
+
unset(_cmake_file)
|
|
97
|
+
unset("_cmake_import_check_files_for_${_cmake_target}")
|
|
98
|
+
endforeach()
|
|
99
|
+
unset(_cmake_target)
|
|
100
|
+
unset(_cmake_import_check_targets)
|
|
101
|
+
|
|
102
|
+
# This file does not depend on other imported targets which have
|
|
103
|
+
# been exported from the same project but in a separate export set.
|
|
104
|
+
|
|
105
|
+
# Commands beyond this point should not need to know the version.
|
|
106
|
+
set(CMAKE_IMPORT_FILE_VERSION)
|
|
107
|
+
cmake_policy(POP)
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
prefix=/Users/alejorojas/work/caos/simpleble/simplejsble/packages/simplejsble/macos/simpleble_macosx_x86_64
|
|
2
|
+
exec_prefix=/Users/alejorojas/work/caos/simpleble/simplejsble/packages/simplejsble/macos/simpleble_macosx_x86_64
|
|
3
|
+
libdir=/Users/alejorojas/work/caos/simpleble/simplejsble/packages/simplejsble/macos/simpleble_macosx_x86_64/lib
|
|
4
|
+
includedir=/Users/alejorojas/work/caos/simpleble/simplejsble/packages/simplejsble/macos/simpleble_macosx_x86_64/include
|
|
5
|
+
|
|
6
|
+
Name: SimpleBLE
|
|
7
|
+
Description: "The ultimate fully-fledged cross-platform library for Bluetooth Low Energy (BLE)."
|
|
8
|
+
Version: 0.10.4
|
|
9
|
+
Libs: -L${libdir} -lsimpleble
|
|
10
|
+
Cflags: -I${includedir}
|
|
11
|
+
Conflicts:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simplejsble",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "React Native Bluetooth Low Energy library using SimpleBLE with Nitro Modules",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"nitrogen",
|
|
14
14
|
"android/",
|
|
15
15
|
"ios/",
|
|
16
|
+
"macos/",
|
|
16
17
|
"cpp/",
|
|
17
18
|
"simpleble/",
|
|
18
19
|
"simpledroidbridge/",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"scripts": {
|
|
28
29
|
"prepack": "node scripts/prepare-package.js",
|
|
29
30
|
"typecheck": "tsc --noEmit",
|
|
30
|
-
"build": "
|
|
31
|
+
"build": "tsc --composite false",
|
|
31
32
|
"clean": "rm -rf android/build android/.cxx android/.gradle lib",
|
|
32
33
|
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
33
34
|
"prepublishOnly": "npm run build",
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
"nitro",
|
|
43
44
|
"nitro-modules",
|
|
44
45
|
"ios",
|
|
45
|
-
"android"
|
|
46
|
+
"android",
|
|
47
|
+
"macos"
|
|
46
48
|
],
|
|
47
49
|
"repository": {
|
|
48
50
|
"type": "git",
|
package/react-native.config.js
CHANGED