simplejsble 0.0.31 → 0.0.33
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 +13 -117
- package/README.md +51 -0
- package/{ios → apple}/CMakeLists.txt +2 -2
- package/apple/SimpleBLE.xcframework/Info.plist +64 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Adapter.h +102 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/AdapterSafe.h +58 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Advanced.h +50 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Characteristic.h +39 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Config.h +64 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Descriptor.h +30 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Exceptions.h +72 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Logging.h +73 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Peripheral.h +82 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/PeripheralSafe.h +64 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Service.h +34 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/SimpleBLE.h +8 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Types.h +49 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Utils.h +13 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/export.h +43 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/kvn/kvn_bytearray.h +304 -0
- package/apple/SimpleBLE.xcframework/ios-arm64/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Adapter.h +102 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/AdapterSafe.h +58 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Advanced.h +50 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Characteristic.h +39 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Config.h +64 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Descriptor.h +30 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Exceptions.h +72 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Logging.h +73 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Peripheral.h +82 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/PeripheralSafe.h +64 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Service.h +34 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/SimpleBLE.h +8 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Types.h +49 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Utils.h +13 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/export.h +43 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/kvn/kvn_bytearray.h +304 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Adapter.h +102 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/AdapterSafe.h +58 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Advanced.h +50 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Characteristic.h +39 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Config.h +64 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Descriptor.h +30 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Exceptions.h +72 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Logging.h +73 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Peripheral.h +82 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/PeripheralSafe.h +64 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Service.h +34 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/SimpleBLE.h +8 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Types.h +49 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/Utils.h +13 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/export.h +43 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/Headers/simpleble/kvn/kvn_bytearray.h +304 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/libsimpleble.a +0 -0
- package/package.json +3 -3
- /package/{ios → apple}/Bridge.h +0 -0
- /package/{ios → apple}/CMAKE_INSTALL_OPTIONS.md +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <stdexcept>
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include <simpleble/export.h>
|
|
7
|
+
|
|
8
|
+
#include "Types.h"
|
|
9
|
+
|
|
10
|
+
namespace SimpleBLE {
|
|
11
|
+
|
|
12
|
+
namespace Exception {
|
|
13
|
+
|
|
14
|
+
class SIMPLEBLE_EXPORT BaseException : public std::runtime_error {
|
|
15
|
+
public:
|
|
16
|
+
BaseException(const std::string& __arg) : std::runtime_error(__arg) {}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class SIMPLEBLE_EXPORT NotInitialized : public BaseException {
|
|
20
|
+
public:
|
|
21
|
+
NotInitialized();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class SIMPLEBLE_EXPORT NotConnected : public BaseException {
|
|
25
|
+
public:
|
|
26
|
+
NotConnected();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
class SIMPLEBLE_EXPORT InvalidReference : public BaseException {
|
|
30
|
+
public:
|
|
31
|
+
InvalidReference();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
class SIMPLEBLE_EXPORT ServiceNotFound : public BaseException {
|
|
35
|
+
public:
|
|
36
|
+
ServiceNotFound(BluetoothUUID uuid);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
class SIMPLEBLE_EXPORT CharacteristicNotFound : public BaseException {
|
|
40
|
+
public:
|
|
41
|
+
CharacteristicNotFound(BluetoothUUID uuid);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
class SIMPLEBLE_EXPORT DescriptorNotFound : public BaseException {
|
|
45
|
+
public:
|
|
46
|
+
DescriptorNotFound(BluetoothUUID uuid);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
class SIMPLEBLE_EXPORT OperationNotSupported : public BaseException {
|
|
50
|
+
public:
|
|
51
|
+
OperationNotSupported();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
class SIMPLEBLE_EXPORT OperationFailed : public BaseException {
|
|
55
|
+
public:
|
|
56
|
+
OperationFailed();
|
|
57
|
+
OperationFailed(const std::string& err_msg);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
class SIMPLEBLE_EXPORT WinRTException : public BaseException {
|
|
61
|
+
public:
|
|
62
|
+
WinRTException(int32_t err_code, const std::string& err_msg);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class SIMPLEBLE_EXPORT CoreBluetoothException : public BaseException {
|
|
66
|
+
public:
|
|
67
|
+
CoreBluetoothException(const std::string& err_msg);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace Exception
|
|
71
|
+
|
|
72
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <functional>
|
|
5
|
+
#include <mutex>
|
|
6
|
+
#include <string>
|
|
7
|
+
|
|
8
|
+
#include <simpleble/export.h>
|
|
9
|
+
|
|
10
|
+
namespace SimpleBLE {
|
|
11
|
+
|
|
12
|
+
namespace Logging {
|
|
13
|
+
|
|
14
|
+
enum Level : int {
|
|
15
|
+
None = 0,
|
|
16
|
+
Fatal,
|
|
17
|
+
Error,
|
|
18
|
+
Warn,
|
|
19
|
+
Info,
|
|
20
|
+
Debug,
|
|
21
|
+
Verbose,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// clang-format off
|
|
25
|
+
using Callback = std::function<void(
|
|
26
|
+
Level,
|
|
27
|
+
const std::string& module,
|
|
28
|
+
const std::string& file,
|
|
29
|
+
uint32_t line,
|
|
30
|
+
const std::string& function,
|
|
31
|
+
const std::string& message)>;
|
|
32
|
+
// clang-format on
|
|
33
|
+
|
|
34
|
+
class SIMPLEBLE_EXPORT Logger {
|
|
35
|
+
public:
|
|
36
|
+
static Logger* get();
|
|
37
|
+
|
|
38
|
+
void set_level(Level level);
|
|
39
|
+
Level get_level();
|
|
40
|
+
|
|
41
|
+
void set_callback(Callback callback);
|
|
42
|
+
bool has_callback();
|
|
43
|
+
|
|
44
|
+
void log_default_stdout();
|
|
45
|
+
void log_default_file();
|
|
46
|
+
void log_default_file(const std::string path);
|
|
47
|
+
|
|
48
|
+
// clang-format off
|
|
49
|
+
void log(
|
|
50
|
+
Level level,
|
|
51
|
+
const std::string& module,
|
|
52
|
+
const std::string& file,
|
|
53
|
+
uint32_t line,
|
|
54
|
+
const std::string& function,
|
|
55
|
+
const std::string& message);
|
|
56
|
+
// clang-format on
|
|
57
|
+
|
|
58
|
+
private:
|
|
59
|
+
Logger();
|
|
60
|
+
~Logger();
|
|
61
|
+
Logger(Logger& other) = delete; // Remove copy constructor
|
|
62
|
+
void operator=(const Logger&) = delete; // Remove copy assignment
|
|
63
|
+
|
|
64
|
+
static std::string level_to_str(Level level);
|
|
65
|
+
|
|
66
|
+
Level level_{Level::Info};
|
|
67
|
+
Callback callback_{nullptr};
|
|
68
|
+
std::recursive_mutex mutex_;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace Logging
|
|
72
|
+
|
|
73
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <functional>
|
|
5
|
+
#include <map>
|
|
6
|
+
#include <memory>
|
|
7
|
+
#include <string>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#include <simpleble/export.h>
|
|
11
|
+
|
|
12
|
+
#include <simpleble/Exceptions.h>
|
|
13
|
+
#include <simpleble/Service.h>
|
|
14
|
+
#include <simpleble/Types.h>
|
|
15
|
+
|
|
16
|
+
namespace SimpleBLE {
|
|
17
|
+
|
|
18
|
+
class PeripheralBase;
|
|
19
|
+
|
|
20
|
+
class SIMPLEBLE_EXPORT Peripheral {
|
|
21
|
+
public:
|
|
22
|
+
Peripheral() = default;
|
|
23
|
+
virtual ~Peripheral() = default;
|
|
24
|
+
|
|
25
|
+
bool initialized() const;
|
|
26
|
+
void* underlying() const;
|
|
27
|
+
|
|
28
|
+
std::string identifier();
|
|
29
|
+
BluetoothAddress address();
|
|
30
|
+
BluetoothAddressType address_type();
|
|
31
|
+
int16_t rssi();
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @brief Provides the advertised transmit power in dBm.
|
|
35
|
+
*
|
|
36
|
+
* @note If the field has not been advertised by the peripheral,
|
|
37
|
+
* the returned value will be -32768.
|
|
38
|
+
*/
|
|
39
|
+
int16_t tx_power();
|
|
40
|
+
uint16_t mtu();
|
|
41
|
+
|
|
42
|
+
void connect();
|
|
43
|
+
void disconnect();
|
|
44
|
+
bool is_connected();
|
|
45
|
+
bool is_connectable();
|
|
46
|
+
bool is_paired();
|
|
47
|
+
void unpair();
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @brief Provides a list of all services that are available on the peripheral.
|
|
51
|
+
*
|
|
52
|
+
* @note If the peripheral is not connected, it will return a list of services
|
|
53
|
+
* that were advertised by the device.
|
|
54
|
+
*/
|
|
55
|
+
std::vector<Service> services();
|
|
56
|
+
std::map<uint16_t, ByteArray> manufacturer_data();
|
|
57
|
+
|
|
58
|
+
/* Calling any of the methods below when the device is not connected will throw
|
|
59
|
+
Exception::NotConnected */
|
|
60
|
+
// clang-format off
|
|
61
|
+
ByteArray read(BluetoothUUID const& service, BluetoothUUID const& characteristic);
|
|
62
|
+
void write_request(BluetoothUUID const& service, BluetoothUUID const& characteristic, ByteArray const& data);
|
|
63
|
+
void write_command(BluetoothUUID const& service, BluetoothUUID const& characteristic, ByteArray const& data);
|
|
64
|
+
void notify(BluetoothUUID const& service, BluetoothUUID const& characteristic, std::function<void(ByteArray payload)> callback);
|
|
65
|
+
void indicate(BluetoothUUID const& service, BluetoothUUID const& characteristic, std::function<void(ByteArray payload)> callback);
|
|
66
|
+
void unsubscribe(BluetoothUUID const& service, BluetoothUUID const& characteristic);
|
|
67
|
+
|
|
68
|
+
ByteArray read(BluetoothUUID const& service, BluetoothUUID const& characteristic, BluetoothUUID const& descriptor);
|
|
69
|
+
void write(BluetoothUUID const& service, BluetoothUUID const& characteristic, BluetoothUUID const& descriptor, ByteArray const& data);
|
|
70
|
+
// clang-format on
|
|
71
|
+
|
|
72
|
+
void set_callback_on_connected(std::function<void()> on_connected);
|
|
73
|
+
void set_callback_on_disconnected(std::function<void()> on_disconnected);
|
|
74
|
+
|
|
75
|
+
protected:
|
|
76
|
+
PeripheralBase* operator->();
|
|
77
|
+
const PeripheralBase* operator->() const;
|
|
78
|
+
|
|
79
|
+
std::shared_ptr<PeripheralBase> internal_;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <optional>
|
|
5
|
+
|
|
6
|
+
#include <simpleble/export.h>
|
|
7
|
+
|
|
8
|
+
#include <simpleble/Peripheral.h>
|
|
9
|
+
#include <simpleble/Service.h>
|
|
10
|
+
|
|
11
|
+
namespace SimpleBLE {
|
|
12
|
+
|
|
13
|
+
namespace Safe {
|
|
14
|
+
|
|
15
|
+
class SIMPLEBLE_EXPORT Peripheral {
|
|
16
|
+
public:
|
|
17
|
+
Peripheral(SimpleBLE::Peripheral& peripheral);
|
|
18
|
+
Peripheral(SimpleBLE::Peripheral&& peripheral);
|
|
19
|
+
virtual ~Peripheral() = default;
|
|
20
|
+
|
|
21
|
+
std::optional<std::string> identifier() noexcept;
|
|
22
|
+
std::optional<BluetoothAddress> address() noexcept;
|
|
23
|
+
std::optional<BluetoothAddressType> address_type() noexcept;
|
|
24
|
+
std::optional<int16_t> rssi() noexcept;
|
|
25
|
+
std::optional<int16_t> tx_power() noexcept;
|
|
26
|
+
std::optional<uint16_t> mtu() noexcept;
|
|
27
|
+
|
|
28
|
+
bool connect() noexcept;
|
|
29
|
+
bool disconnect() noexcept;
|
|
30
|
+
std::optional<bool> is_connected() noexcept;
|
|
31
|
+
std::optional<bool> is_connectable() noexcept;
|
|
32
|
+
std::optional<bool> is_paired() noexcept;
|
|
33
|
+
bool unpair() noexcept;
|
|
34
|
+
|
|
35
|
+
std::optional<std::vector<Service>> services() noexcept;
|
|
36
|
+
std::optional<std::map<uint16_t, ByteArray>> manufacturer_data() noexcept;
|
|
37
|
+
|
|
38
|
+
// clang-format off
|
|
39
|
+
std::optional<ByteArray> read(BluetoothUUID const& service, BluetoothUUID const& characteristic) noexcept;
|
|
40
|
+
bool write_request(BluetoothUUID const& service, BluetoothUUID const& characteristic, ByteArray const& data) noexcept;
|
|
41
|
+
bool write_command(BluetoothUUID const& service, BluetoothUUID const& characteristic, ByteArray const& data) noexcept;
|
|
42
|
+
bool notify(BluetoothUUID const& service, BluetoothUUID const& characteristic, std::function<void(ByteArray payload)> callback) noexcept;
|
|
43
|
+
bool indicate(BluetoothUUID const& service, BluetoothUUID const& characteristic, std::function<void(ByteArray payload)> callback) noexcept;
|
|
44
|
+
bool unsubscribe(BluetoothUUID const& service, BluetoothUUID const& characteristic) noexcept;
|
|
45
|
+
|
|
46
|
+
std::optional<ByteArray> read(BluetoothUUID const& service, BluetoothUUID const& characteristic, BluetoothUUID const& descriptor) noexcept;
|
|
47
|
+
bool write(BluetoothUUID const& service, BluetoothUUID const& characteristic, BluetoothUUID const& descriptor, ByteArray const& data) noexcept;
|
|
48
|
+
// clang-format on
|
|
49
|
+
|
|
50
|
+
bool set_callback_on_connected(std::function<void()> on_connected) noexcept;
|
|
51
|
+
bool set_callback_on_disconnected(std::function<void()> on_disconnected) noexcept;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get the underlying peripheral object.
|
|
55
|
+
*/
|
|
56
|
+
operator SimpleBLE::Peripheral() const noexcept;
|
|
57
|
+
|
|
58
|
+
protected:
|
|
59
|
+
SimpleBLE::Peripheral internal_;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace Safe
|
|
63
|
+
|
|
64
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include <vector>
|
|
5
|
+
|
|
6
|
+
#include <simpleble/export.h>
|
|
7
|
+
|
|
8
|
+
#include <simpleble/Exceptions.h>
|
|
9
|
+
#include <simpleble/Types.h>
|
|
10
|
+
#include "simpleble/Characteristic.h"
|
|
11
|
+
|
|
12
|
+
namespace SimpleBLE {
|
|
13
|
+
|
|
14
|
+
class ServiceBase;
|
|
15
|
+
|
|
16
|
+
class SIMPLEBLE_EXPORT Service {
|
|
17
|
+
public:
|
|
18
|
+
Service() = default;
|
|
19
|
+
virtual ~Service() = default;
|
|
20
|
+
|
|
21
|
+
bool initialized() const;
|
|
22
|
+
|
|
23
|
+
BluetoothUUID uuid();
|
|
24
|
+
ByteArray data();
|
|
25
|
+
std::vector<Characteristic> characteristics();
|
|
26
|
+
|
|
27
|
+
protected:
|
|
28
|
+
const ServiceBase* operator->() const;
|
|
29
|
+
ServiceBase* operator->();
|
|
30
|
+
|
|
31
|
+
std::shared_ptr<ServiceBase> internal_;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
#include "kvn/kvn_bytearray.h"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @file Types.h
|
|
10
|
+
* @brief Defines types and enumerations used throughout the SimpleBLE library.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
namespace SimpleBLE {
|
|
14
|
+
|
|
15
|
+
using BluetoothAddress = std::string;
|
|
16
|
+
|
|
17
|
+
// IDEA: Extend BluetoothUUID to include a `uuid` function that
|
|
18
|
+
// returns the same string, but provides a homogeneous interface.
|
|
19
|
+
using BluetoothUUID = std::string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef ByteArray
|
|
23
|
+
* @brief Represents a byte array using kvn::bytearray from the external library.
|
|
24
|
+
*/
|
|
25
|
+
using ByteArray = kvn::bytearray;
|
|
26
|
+
|
|
27
|
+
#ifdef ANDROID
|
|
28
|
+
#pragma push_macro("ANDROID")
|
|
29
|
+
#undef ANDROID
|
|
30
|
+
#define ANDROID_WAS_DEFINED
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
enum class OperatingSystem {
|
|
34
|
+
WINDOWS,
|
|
35
|
+
MACOS,
|
|
36
|
+
IOS,
|
|
37
|
+
LINUX,
|
|
38
|
+
ANDROID,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
#ifdef ANDROID_WAS_DEFINED
|
|
42
|
+
#pragma pop_macro("ANDROID")
|
|
43
|
+
#undef ANDROID_WAS_DEFINED
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
// TODO: Add to_string functions for all enums.
|
|
47
|
+
enum BluetoothAddressType : int32_t { PUBLIC = 0, RANDOM = 1, UNSPECIFIED = 2 };
|
|
48
|
+
|
|
49
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <simpleble/export.h>
|
|
4
|
+
|
|
5
|
+
#include <simpleble/Types.h>
|
|
6
|
+
|
|
7
|
+
namespace SimpleBLE {
|
|
8
|
+
|
|
9
|
+
OperatingSystem SIMPLEBLE_EXPORT get_operating_system();
|
|
10
|
+
|
|
11
|
+
std::string SIMPLEBLE_EXPORT get_simpleble_version();
|
|
12
|
+
|
|
13
|
+
} // namespace SimpleBLE
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
#ifndef SIMPLEBLE_EXPORT_H
|
|
3
|
+
#define SIMPLEBLE_EXPORT_H
|
|
4
|
+
|
|
5
|
+
#ifdef SIMPLEBLE_STATIC_DEFINE
|
|
6
|
+
# define SIMPLEBLE_EXPORT
|
|
7
|
+
# define SIMPLEBLE_NO_EXPORT
|
|
8
|
+
#else
|
|
9
|
+
# ifndef SIMPLEBLE_EXPORT
|
|
10
|
+
# ifdef simpleble_EXPORTS
|
|
11
|
+
/* We are building this library */
|
|
12
|
+
# define SIMPLEBLE_EXPORT
|
|
13
|
+
# else
|
|
14
|
+
/* We are using this library */
|
|
15
|
+
# define SIMPLEBLE_EXPORT
|
|
16
|
+
# endif
|
|
17
|
+
# endif
|
|
18
|
+
|
|
19
|
+
# ifndef SIMPLEBLE_NO_EXPORT
|
|
20
|
+
# define SIMPLEBLE_NO_EXPORT
|
|
21
|
+
# endif
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
#ifndef SIMPLEBLE_DEPRECATED
|
|
25
|
+
# define SIMPLEBLE_DEPRECATED __attribute__ ((__deprecated__))
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#ifndef SIMPLEBLE_DEPRECATED_EXPORT
|
|
29
|
+
# define SIMPLEBLE_DEPRECATED_EXPORT SIMPLEBLE_EXPORT SIMPLEBLE_DEPRECATED
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#ifndef SIMPLEBLE_DEPRECATED_NO_EXPORT
|
|
33
|
+
# define SIMPLEBLE_DEPRECATED_NO_EXPORT SIMPLEBLE_NO_EXPORT SIMPLEBLE_DEPRECATED
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
|
|
37
|
+
#if 0 /* DEFINE_NO_DEPRECATED */
|
|
38
|
+
# ifndef SIMPLEBLE_NO_DEPRECATED
|
|
39
|
+
# define SIMPLEBLE_NO_DEPRECATED
|
|
40
|
+
# endif
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#endif /* SIMPLEBLE_EXPORT_H */
|