simpleble 0.0.1
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +88 -0
- data/LICENSE.txt +21 -0
- data/README.md +350 -0
- data/ext/simpleble/extconf.rb +57 -0
- data/ext/simpleble/simpleble_ruby.c +682 -0
- data/lib/simpleble/adapter.rb +10 -0
- data/lib/simpleble/characteristic.rb +36 -0
- data/lib/simpleble/descriptor.rb +8 -0
- data/lib/simpleble/exceptions.rb +25 -0
- data/lib/simpleble/peripheral.rb +64 -0
- data/lib/simpleble/service.rb +16 -0
- data/lib/simpleble/version.rb +3 -0
- data/lib/simpleble.rb +40 -0
- data/vendor/simpleble/build_simplecble/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp +920 -0
- data/vendor/simpleble/build_simplecble/CMakeFiles/4.0.3/CompilerIdCXX/apple-sdk.cpp +1 -0
- data/vendor/simpleble/build_simplecble/CMakeFiles/4.1.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +949 -0
- data/vendor/simpleble/build_simplecble/CMakeFiles/4.1.0/CompilerIdCXX/apple-sdk.cpp +1 -0
- data/vendor/simpleble/build_simplecble/export/simplecble/export.h +43 -0
- data/vendor/simpleble/build_simplecble/simpleble/export/simpleble/export.h +43 -0
- data/vendor/simpleble/dependencies/external/kvn/kvn_bytearray.h +222 -0
- data/vendor/simpleble/dependencies/external/kvn/kvn_safe_callback.hpp +66 -0
- data/vendor/simpleble/dependencies/external/kvn/logfwd.hpp +35 -0
- data/vendor/simpleble/dependencies/internal/fmt/args.h +220 -0
- data/vendor/simpleble/dependencies/internal/fmt/base.h +2962 -0
- data/vendor/simpleble/dependencies/internal/fmt/chrono.h +2338 -0
- data/vendor/simpleble/dependencies/internal/fmt/color.h +610 -0
- data/vendor/simpleble/dependencies/internal/fmt/compile.h +539 -0
- data/vendor/simpleble/dependencies/internal/fmt/core.h +5 -0
- data/vendor/simpleble/dependencies/internal/fmt/format-inl.h +1949 -0
- data/vendor/simpleble/dependencies/internal/fmt/format.h +4244 -0
- data/vendor/simpleble/dependencies/internal/fmt/os.h +427 -0
- data/vendor/simpleble/dependencies/internal/fmt/ostream.h +166 -0
- data/vendor/simpleble/dependencies/internal/fmt/printf.h +633 -0
- data/vendor/simpleble/dependencies/internal/fmt/ranges.h +850 -0
- data/vendor/simpleble/dependencies/internal/fmt/std.h +726 -0
- data/vendor/simpleble/dependencies/internal/fmt/xchar.h +373 -0
- data/vendor/simpleble/dependencies/internal/simplejni/Common.hpp +579 -0
- data/vendor/simpleble/dependencies/internal/simplejni/References.hpp +151 -0
- data/vendor/simpleble/dependencies/internal/simplejni/Registry.hpp +183 -0
- data/vendor/simpleble/dependencies/internal/simplejni/VM.hpp +88 -0
- data/vendor/simpleble/examples/simpleble/src/connect.cpp +67 -0
- data/vendor/simpleble/examples/simpleble/src/connect_safe.cpp +91 -0
- data/vendor/simpleble/examples/simpleble/src/list_adapters.cpp +22 -0
- data/vendor/simpleble/examples/simpleble/src/list_adapters_safe.cpp +33 -0
- data/vendor/simpleble/examples/simpleble/src/list_paired.cpp +27 -0
- data/vendor/simpleble/examples/simpleble/src/multiconnect.cpp +60 -0
- data/vendor/simpleble/examples/simpleble/src/notify.cpp +85 -0
- data/vendor/simpleble/examples/simpleble/src/notify_multi.cpp +101 -0
- data/vendor/simpleble/examples/simpleble/src/power_cycle.cpp +43 -0
- data/vendor/simpleble/examples/simpleble/src/read.cpp +82 -0
- data/vendor/simpleble/examples/simpleble/src/scan.cpp +62 -0
- data/vendor/simpleble/examples/simpleble/src/utils.cpp +59 -0
- data/vendor/simpleble/examples/simpleble/src/utils.hpp +27 -0
- data/vendor/simpleble/examples/simpleble/src/write.cpp +81 -0
- data/vendor/simpleble/examples/simplebluez/ble_nus/ble_nus.cpp +138 -0
- data/vendor/simpleble/examples/simplebluez/connect/connect.cpp +119 -0
- data/vendor/simpleble/examples/simplebluez/list_adapters/list_adapters.cpp +44 -0
- data/vendor/simpleble/examples/simplebluez/list_paired/list_paired.cpp +48 -0
- data/vendor/simpleble/examples/simplebluez/notify/notify.cpp +145 -0
- data/vendor/simpleble/examples/simplebluez/pair/pair.cpp +181 -0
- data/vendor/simpleble/examples/simplebluez/read/read.cpp +141 -0
- data/vendor/simpleble/examples/simplebluez/scan/scan.cpp +85 -0
- data/vendor/simpleble/examples/simplecble/c/connect.c +163 -0
- data/vendor/simpleble/examples/simplecble/c/notify.c +217 -0
- data/vendor/simpleble/examples/simplecble/c/scan.c +164 -0
- data/vendor/simpleble/examples/simpledbus/notification.cpp +24 -0
- data/vendor/simpleble/hitl/src/test_sanity.cpp +48 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Adapter.h +102 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/AdapterSafe.h +58 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Advanced.h +50 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Characteristic.h +39 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Config.h +55 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Descriptor.h +30 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Exceptions.h +72 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Logging.h +73 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Peripheral.h +82 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/PeripheralSafe.h +64 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Service.h +34 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/SimpleBLE.h +8 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Types.h +49 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/Utils.h +13 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/export.h +43 -0
- data/vendor/simpleble/install_simplecble/include/simpleble/kvn/kvn_bytearray.h +222 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/adapter.h +188 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/logging.h +37 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/peripheral.h +304 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/simpleble.h +21 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/types.h +73 -0
- data/vendor/simpleble/install_simplecble/include/simplecble/utils.h +27 -0
- data/vendor/simpleble/simpleble/include/simpleble/Adapter.h +102 -0
- data/vendor/simpleble/simpleble/include/simpleble/AdapterSafe.h +58 -0
- data/vendor/simpleble/simpleble/include/simpleble/Characteristic.h +39 -0
- data/vendor/simpleble/simpleble/include/simpleble/Config.h +55 -0
- data/vendor/simpleble/simpleble/include/simpleble/Descriptor.h +30 -0
- data/vendor/simpleble/simpleble/include/simpleble/Exceptions.h +72 -0
- data/vendor/simpleble/simpleble/include/simpleble/Logging.h +73 -0
- data/vendor/simpleble/simpleble/include/simpleble/Peripheral.h +82 -0
- data/vendor/simpleble/simpleble/include/simpleble/PeripheralSafe.h +64 -0
- data/vendor/simpleble/simpleble/include/simpleble/Service.h +34 -0
- data/vendor/simpleble/simpleble/include/simpleble/SimpleBLE.h +8 -0
- data/vendor/simpleble/simpleble/include/simpleble/Types.h +49 -0
- data/vendor/simpleble/simpleble/include/simpleble/Utils.h +13 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/adapter.h +188 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/logging.h +37 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/peripheral.h +304 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/simpleble.h +21 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/types.h +73 -0
- data/vendor/simpleble/simpleble/include/simpleble_c/utils.h +27 -0
- data/vendor/simpleble/simpleble/src/CommonUtils.h +63 -0
- data/vendor/simpleble/simpleble/src/Exceptions.cpp +31 -0
- data/vendor/simpleble/simpleble/src/Logging.cpp +136 -0
- data/vendor/simpleble/simpleble/src/LoggingInternal.h +85 -0
- data/vendor/simpleble/simpleble/src/Utils.cpp +24 -0
- data/vendor/simpleble/simpleble/src/backends/android/AdapterAndroid.cpp +101 -0
- data/vendor/simpleble/simpleble/src/backends/android/AdapterAndroid.h +70 -0
- data/vendor/simpleble/simpleble/src/backends/android/BackendAndroid.cpp +40 -0
- data/vendor/simpleble/simpleble/src/backends/android/BackendAndroid.h +20 -0
- data/vendor/simpleble/simpleble/src/backends/android/PeripheralAndroid.cpp +365 -0
- data/vendor/simpleble/simpleble/src/backends/android/PeripheralAndroid.h +90 -0
- data/vendor/simpleble/simpleble/src/backends/android/bridge/BluetoothGattCallback.cpp +432 -0
- data/vendor/simpleble/simpleble/src/backends/android/bridge/BluetoothGattCallback.h +102 -0
- data/vendor/simpleble/simpleble/src/backends/android/bridge/ScanCallback.cpp +142 -0
- data/vendor/simpleble/simpleble/src/backends/android/bridge/ScanCallback.h +55 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothAdapter.cpp +107 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothAdapter.h +55 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothDevice.cpp +68 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothDevice.h +54 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGatt.cpp +115 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGatt.h +75 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattCharacteristic.cpp +142 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattCharacteristic.h +66 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattDescriptor.cpp +67 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattDescriptor.h +46 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattService.cpp +106 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattService.h +47 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.cpp +47 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.h +37 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanRecord.cpp +69 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanRecord.h +41 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanResult.cpp +63 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanResult.h +42 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/os/ParcelUUID.cpp +32 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/os/ParcelUUID.h +30 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/util/SparseArray.cpp +54 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/android/util/SparseArray.h +37 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Iterator.cpp +36 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Iterator.h +28 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/List.cpp +29 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/List.h +27 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Set.cpp +33 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Set.h +28 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/UUID.cpp +26 -0
- data/vendor/simpleble/simpleble/src/backends/android/types/java/util/UUID.h +29 -0
- data/vendor/simpleble/simpleble/src/backends/common/AdapterBase.cpp +53 -0
- data/vendor/simpleble/simpleble/src/backends/common/AdapterBase.h +81 -0
- data/vendor/simpleble/simpleble/src/backends/common/AdapterBaseTypes.h +22 -0
- data/vendor/simpleble/simpleble/src/backends/common/BackendBase.h +20 -0
- data/vendor/simpleble/simpleble/src/backends/common/BackendUtils.h +33 -0
- data/vendor/simpleble/simpleble/src/backends/common/CharacteristicBase.cpp +28 -0
- data/vendor/simpleble/simpleble/src/backends/common/CharacteristicBase.h +38 -0
- data/vendor/simpleble/simpleble/src/backends/common/DescriptorBase.cpp +7 -0
- data/vendor/simpleble/simpleble/src/backends/common/DescriptorBase.h +19 -0
- data/vendor/simpleble/simpleble/src/backends/common/PeripheralBase.h +82 -0
- data/vendor/simpleble/simpleble/src/backends/common/ServiceBase.cpp +18 -0
- data/vendor/simpleble/simpleble/src/backends/common/ServiceBase.h +28 -0
- data/vendor/simpleble/simpleble/src/backends/linux/AdapterLinux.cpp +102 -0
- data/vendor/simpleble/simpleble/src/backends/linux/AdapterLinux.h +55 -0
- data/vendor/simpleble/simpleble/src/backends/linux/BackendBluez.cpp +87 -0
- data/vendor/simpleble/simpleble/src/backends/linux/PeripheralLinux.cpp +376 -0
- data/vendor/simpleble/simpleble/src/backends/linux/PeripheralLinux.h +90 -0
- data/vendor/simpleble/simpleble/src/backends/macos/AdapterBaseMacOS.h +29 -0
- data/vendor/simpleble/simpleble/src/backends/macos/AdapterMac.h +78 -0
- data/vendor/simpleble/simpleble/src/backends/macos/PeripheralBaseMacOS.h +49 -0
- data/vendor/simpleble/simpleble/src/backends/macos/PeripheralMac.h +81 -0
- data/vendor/simpleble/simpleble/src/backends/macos/Utils.h +9 -0
- data/vendor/simpleble/simpleble/src/backends/plain/AdapterPlain.cpp +65 -0
- data/vendor/simpleble/simpleble/src/backends/plain/AdapterPlain.h +49 -0
- data/vendor/simpleble/simpleble/src/backends/plain/BackendPlain.cpp +30 -0
- data/vendor/simpleble/simpleble/src/backends/plain/PeripheralPlain.cpp +159 -0
- data/vendor/simpleble/simpleble/src/backends/plain/PeripheralPlain.h +72 -0
- data/vendor/simpleble/simpleble/src/backends/windows/AdapterWindows.cpp +330 -0
- data/vendor/simpleble/simpleble/src/backends/windows/AdapterWindows.h +89 -0
- data/vendor/simpleble/simpleble/src/backends/windows/BackendWinRT.cpp +67 -0
- data/vendor/simpleble/simpleble/src/backends/windows/BackendWinRT.h +18 -0
- data/vendor/simpleble/simpleble/src/backends/windows/MtaManager.cpp +49 -0
- data/vendor/simpleble/simpleble/src/backends/windows/MtaManager.h +90 -0
- data/vendor/simpleble/simpleble/src/backends/windows/PeripheralWindows.cpp +487 -0
- data/vendor/simpleble/simpleble/src/backends/windows/PeripheralWindows.h +129 -0
- data/vendor/simpleble/simpleble/src/backends/windows/Utils.cpp +146 -0
- data/vendor/simpleble/simpleble/src/backends/windows/Utils.h +47 -0
- data/vendor/simpleble/simpleble/src/builders/BuildVec.h +32 -0
- data/vendor/simpleble/simpleble/src/builders/BuilderBase.h +87 -0
- data/vendor/simpleble/simpleble/src/external/TaskRunner.hpp +99 -0
- data/vendor/simpleble/simpleble/src/external/ThreadRunner.h +52 -0
- data/vendor/simpleble/simpleble/src/external/kvn_safe_callback.hpp +66 -0
- data/vendor/simpleble/simpleble/src/external/kvn_safe_map.hpp +94 -0
- data/vendor/simpleble/simpleble/src/external/kvn_threadrunner.hpp +70 -0
- data/vendor/simpleble/simpleble/src/external/logfwd.hpp +35 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Adapter.cpp +111 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Backend.cpp +83 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Backend.h +76 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Characteristic.cpp +56 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Descriptor.cpp +21 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Peripheral.cpp +113 -0
- data/vendor/simpleble/simpleble/src/frontends/base/Service.cpp +26 -0
- data/vendor/simpleble/simpleble/src/frontends/safe/AdapterSafe.cpp +158 -0
- data/vendor/simpleble/simpleble/src/frontends/safe/PeripheralSafe.cpp +219 -0
- data/vendor/simpleble/simpleble/src_c/adapter.cpp +204 -0
- data/vendor/simpleble/simpleble/src_c/logging.cpp +19 -0
- data/vendor/simpleble/simpleble/src_c/peripheral.cpp +444 -0
- data/vendor/simpleble/simpleble/src_c/simpleble.cpp +5 -0
- data/vendor/simpleble/simpleble/src_c/utils.cpp +15 -0
- data/vendor/simpleble/simpleble/test/src/main.cpp +8 -0
- data/vendor/simpleble/simpleble/test/src/test_bytearray.cpp +246 -0
- data/vendor/simpleble/simpleble/test/src/test_utils.cpp +24 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Adapter.h +46 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Agent.h +52 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Bluez.h +37 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/BluezOrg.h +22 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/BluezOrgBluez.h +26 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/BluezRoot.h +32 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Characteristic.h +46 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Descriptor.h +33 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Device.h +64 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Exceptions.h +43 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Service.h +27 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/Types.h +9 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Adapter1.h +49 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Agent1.h +100 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/AgentManager1.h +24 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Battery1.h +32 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Device1.h +62 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattCharacteristic1.h +48 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattDescriptor1.h +41 -0
- data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattService1.h +28 -0
- data/vendor/simpleble/simplebluez/src/Adapter.cpp +78 -0
- data/vendor/simpleble/simplebluez/src/Agent.cpp +72 -0
- data/vendor/simpleble/simplebluez/src/Bluez.cpp +45 -0
- data/vendor/simpleble/simplebluez/src/BluezOrg.cpp +20 -0
- data/vendor/simpleble/simplebluez/src/BluezOrgBluez.cpp +23 -0
- data/vendor/simpleble/simplebluez/src/BluezRoot.cpp +44 -0
- data/vendor/simpleble/simplebluez/src/Characteristic.cpp +64 -0
- data/vendor/simpleble/simplebluez/src/Descriptor.cpp +27 -0
- data/vendor/simpleble/simplebluez/src/Device.cpp +104 -0
- data/vendor/simpleble/simplebluez/src/Exceptions.cpp +29 -0
- data/vendor/simpleble/simplebluez/src/Logging.cpp +52 -0
- data/vendor/simpleble/simplebluez/src/Logging.h +57 -0
- data/vendor/simpleble/simplebluez/src/Service.cpp +33 -0
- data/vendor/simpleble/simplebluez/src/interfaces/Adapter1.cpp +123 -0
- data/vendor/simpleble/simplebluez/src/interfaces/Agent1.cpp +143 -0
- data/vendor/simpleble/simplebluez/src/interfaces/AgentManager1.cpp +34 -0
- data/vendor/simpleble/simplebluez/src/interfaces/Battery1.cpp +30 -0
- data/vendor/simpleble/simplebluez/src/interfaces/Device1.cpp +170 -0
- data/vendor/simpleble/simplebluez/src/interfaces/GattCharacteristic1.cpp +118 -0
- data/vendor/simpleble/simplebluez/src/interfaces/GattDescriptor1.cpp +78 -0
- data/vendor/simpleble/simplebluez/src/interfaces/GattService1.cpp +28 -0
- data/vendor/simpleble/simplebluez/test/src/helpers/PythonRunner.cpp +53 -0
- data/vendor/simpleble/simplebluez/test/src/helpers/PythonRunner.h +24 -0
- data/vendor/simpleble/simplebluez/test/src/main.cpp +16 -0
- data/vendor/simpleble/simplecble/include/simplecble/adapter.h +188 -0
- data/vendor/simpleble/simplecble/include/simplecble/logging.h +37 -0
- data/vendor/simpleble/simplecble/include/simplecble/peripheral.h +304 -0
- data/vendor/simpleble/simplecble/include/simplecble/simpleble.h +21 -0
- data/vendor/simpleble/simplecble/include/simplecble/types.h +73 -0
- data/vendor/simpleble/simplecble/include/simplecble/utils.h +27 -0
- data/vendor/simpleble/simplecble/src/adapter.cpp +204 -0
- data/vendor/simpleble/simplecble/src/logging.cpp +19 -0
- data/vendor/simpleble/simplecble/src/peripheral.cpp +444 -0
- data/vendor/simpleble/simplecble/src/simpleble.cpp +5 -0
- data/vendor/simpleble/simplecble/src/utils.cpp +15 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/advanced/Interface.h +67 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/advanced/InterfaceRegistry.h +64 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/advanced/Proxy.h +117 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Connection.h +50 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Exceptions.h +56 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Holder.h +147 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Logging.h +57 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Message.h +89 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/base/Path.h +24 -0
- data/vendor/simpleble/simpledbus/include/simpledbus/interfaces/ObjectManager.h +26 -0
- data/vendor/simpleble/simpledbus/src/advanced/Interface.cpp +155 -0
- data/vendor/simpleble/simpledbus/src/advanced/Proxy.cpp +375 -0
- data/vendor/simpleble/simpledbus/src/base/Connection.cpp +222 -0
- data/vendor/simpleble/simpledbus/src/base/Exceptions.cpp +39 -0
- data/vendor/simpleble/simpledbus/src/base/Holder.cpp +739 -0
- data/vendor/simpleble/simpledbus/src/base/Logging.cpp +52 -0
- data/vendor/simpleble/simpledbus/src/base/Message.cpp +622 -0
- data/vendor/simpleble/simpledbus/src/base/Path.cpp +129 -0
- data/vendor/simpleble/simpledbus/src/interfaces/ObjectManager.cpp +58 -0
- data/vendor/simpleble/simpledbus/test/src/helpers/PythonRunner.cpp +53 -0
- data/vendor/simpleble/simpledbus/test/src/helpers/PythonRunner.h +24 -0
- data/vendor/simpleble/simpledbus/test/src/main.cpp +16 -0
- data/vendor/simpleble/simpledbus/test/src/test_holder.cpp +184 -0
- data/vendor/simpleble/simpledbus/test/src/test_message.cpp +397 -0
- data/vendor/simpleble/simpledbus/test/src/test_path.cpp +76 -0
- data/vendor/simpleble/simpledbus/test/src/test_proxy_children.cpp +109 -0
- data/vendor/simpleble/simpledbus/test/src/test_proxy_interfaces.cpp +102 -0
- data/vendor/simpleble/simpledbus/test/src/test_proxy_lifetime.cpp +18 -0
- data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/ThreadRunner.h +89 -0
- data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/android_utils.cpp +55 -0
- data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/android_utils.h +18 -0
- data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/simpleble_android.cpp +813 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/AdapterWrapper.cpp +37 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/AdapterWrapper.h +23 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/Cache.cpp +58 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/Cache.h +34 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/PeripheralWrapper.cpp +17 -0
- data/vendor/simpleble/simplejavable/cpp/src/core/PeripheralWrapper.h +19 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/ArrayList.cpp +257 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/ArrayList.h +78 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/HashMap.cpp +96 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/HashMap.h +54 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/Integer.cpp +93 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/Integer.h +49 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/Iterator.cpp +85 -0
- data/vendor/simpleble/simplejavable/cpp/src/java/lang/Iterator.h +48 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/AdapterCallback.cpp +91 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/AdapterCallback.h +90 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Characteristic.cpp +35 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Characteristic.h +60 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/DataCallback.cpp +33 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/DataCallback.h +45 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Descriptor.cpp +30 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Descriptor.h +49 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/PeripheralCallback.cpp +41 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/PeripheralCallback.h +51 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Service.cpp +33 -0
- data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Service.h +54 -0
- data/vendor/simpleble/simplejavable/cpp/src/simplejavable.cpp +361 -0
- data/vendor/simpleble/simplepyble/src/main.cpp +55 -0
- data/vendor/simpleble/simplepyble/src/wrap_adapter.cpp +106 -0
- data/vendor/simpleble/simplepyble/src/wrap_characteristic.cpp +56 -0
- data/vendor/simpleble/simplepyble/src/wrap_config.cpp +136 -0
- data/vendor/simpleble/simplepyble/src/wrap_descriptor.cpp +21 -0
- data/vendor/simpleble/simplepyble/src/wrap_peripheral.cpp +217 -0
- data/vendor/simpleble/simplepyble/src/wrap_service.cpp +32 -0
- data/vendor/simpleble/simplepyble/src/wrap_types.cpp +21 -0
- data/vendor/simpleble/simplersble/src/bindings/Bindings.cpp +338 -0
- data/vendor/simpleble/simplersble/src/bindings/Bindings.hpp +178 -0
- metadata +430 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <string>
|
4
|
+
#include <vector>
|
5
|
+
#include "BluetoothGattDescriptor.h"
|
6
|
+
#include "simplejni/Common.hpp"
|
7
|
+
#include "simplejni/Registry.hpp"
|
8
|
+
|
9
|
+
namespace SimpleBLE {
|
10
|
+
namespace Android {
|
11
|
+
|
12
|
+
class BluetoothGattCharacteristic {
|
13
|
+
// See: https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic
|
14
|
+
public:
|
15
|
+
BluetoothGattCharacteristic();
|
16
|
+
BluetoothGattCharacteristic(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
17
|
+
virtual ~BluetoothGattCharacteristic() = default;
|
18
|
+
|
19
|
+
// bool addDescriptor(BluetoothGattDescriptor descriptor);
|
20
|
+
// BluetoothGattDescriptor getDescriptor(std::string uuid);
|
21
|
+
std::vector<BluetoothGattDescriptor> getDescriptors();
|
22
|
+
|
23
|
+
int getInstanceId();
|
24
|
+
int getPermissions();
|
25
|
+
int getProperties();
|
26
|
+
std::string getUuid();
|
27
|
+
int getWriteType();
|
28
|
+
void setWriteType(int writeType);
|
29
|
+
|
30
|
+
bool setValue(const std::vector<uint8_t>& value);
|
31
|
+
|
32
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> getObject() const { return _obj; }
|
33
|
+
|
34
|
+
static const int PROPERTY_INDICATE = 0x00000020;
|
35
|
+
static const int PROPERTY_NOTIFY = 0x00000010;
|
36
|
+
static const int PROPERTY_READ = 0x00000002;
|
37
|
+
static const int PROPERTY_WRITE = 0x00000008;
|
38
|
+
static const int PROPERTY_WRITE_NO_RESPONSE = 0x00000004;
|
39
|
+
|
40
|
+
static const int WRITE_TYPE_DEFAULT = 2;
|
41
|
+
static const int WRITE_TYPE_NO_RESPONSE = 1;
|
42
|
+
|
43
|
+
private:
|
44
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
45
|
+
|
46
|
+
// Static JNI resources managed by Registrar
|
47
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
48
|
+
static jmethodID _method_addDescriptor;
|
49
|
+
static jmethodID _method_getDescriptor;
|
50
|
+
static jmethodID _method_getDescriptors;
|
51
|
+
static jmethodID _method_getInstanceId;
|
52
|
+
static jmethodID _method_getPermissions;
|
53
|
+
static jmethodID _method_getProperties;
|
54
|
+
static jmethodID _method_getService;
|
55
|
+
static jmethodID _method_getUuid;
|
56
|
+
static jmethodID _method_getWriteType;
|
57
|
+
static jmethodID _method_setWriteType;
|
58
|
+
static jmethodID _method_setValue;
|
59
|
+
|
60
|
+
// JNI descriptor for auto-registration
|
61
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
62
|
+
static const SimpleJNI::AutoRegister<BluetoothGattCharacteristic> registrar;
|
63
|
+
};
|
64
|
+
|
65
|
+
} // namespace Android
|
66
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#include "BluetoothGattDescriptor.h"
|
2
|
+
#include "types/java/util/UUID.h"
|
3
|
+
|
4
|
+
namespace SimpleBLE {
|
5
|
+
namespace Android {
|
6
|
+
|
7
|
+
// Define static JNI resources
|
8
|
+
SimpleJNI::GlobalRef<jclass> BluetoothGattDescriptor::_cls;
|
9
|
+
jmethodID BluetoothGattDescriptor::_method_getUuid = nullptr;
|
10
|
+
jmethodID BluetoothGattDescriptor::_method_getValue = nullptr;
|
11
|
+
jmethodID BluetoothGattDescriptor::_method_setValue = nullptr;
|
12
|
+
|
13
|
+
// Define the JNI descriptor
|
14
|
+
const SimpleJNI::JNIDescriptor BluetoothGattDescriptor::descriptor{
|
15
|
+
"android/bluetooth/BluetoothGattDescriptor", // Java class name
|
16
|
+
&_cls, // Where to store the jclass
|
17
|
+
{ // Methods to preload
|
18
|
+
{"getUuid", "()Ljava/util/UUID;", &_method_getUuid},
|
19
|
+
{"getValue", "()[B", &_method_getValue},
|
20
|
+
{"setValue", "([B)Z", &_method_setValue}
|
21
|
+
}};
|
22
|
+
|
23
|
+
const SimpleJNI::AutoRegister<BluetoothGattDescriptor> BluetoothGattDescriptor::registrar{&descriptor};
|
24
|
+
|
25
|
+
const std::string BluetoothGattDescriptor::CLIENT_CHARACTERISTIC_CONFIG = "00002902-0000-1000-8000-00805f9b34fb";
|
26
|
+
const std::vector<uint8_t> BluetoothGattDescriptor::DISABLE_NOTIFICATION_VALUE = {0x00, 0x00};
|
27
|
+
const std::vector<uint8_t> BluetoothGattDescriptor::ENABLE_NOTIFICATION_VALUE = {0x01, 0x00};
|
28
|
+
const std::vector<uint8_t> BluetoothGattDescriptor::ENABLE_INDICATION_VALUE = {0x02, 0x00};
|
29
|
+
|
30
|
+
BluetoothGattDescriptor::BluetoothGattDescriptor() : _obj() {
|
31
|
+
if (!_cls.get()) {
|
32
|
+
throw std::runtime_error("BluetoothGattDescriptor JNI resources not preloaded. Ensure SimpleJNI::Registrar::preload() is called.");
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
BluetoothGattDescriptor::BluetoothGattDescriptor(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
37
|
+
|
38
|
+
std::string BluetoothGattDescriptor::getUuid() {
|
39
|
+
if (!_obj) throw std::runtime_error("BluetoothGattDescriptor is not initialized");
|
40
|
+
|
41
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> uuidObj = _obj.call_object_method(_method_getUuid);
|
42
|
+
if (!uuidObj) throw std::runtime_error("Failed to get UUID");
|
43
|
+
|
44
|
+
return UUID(uuidObj.to_global()).toString();
|
45
|
+
}
|
46
|
+
|
47
|
+
std::vector<uint8_t> BluetoothGattDescriptor::getValue() {
|
48
|
+
if (!_obj) throw std::runtime_error("BluetoothGattDescriptor is not initialized");
|
49
|
+
|
50
|
+
return _obj.call_byte_array_method(_method_getValue);
|
51
|
+
}
|
52
|
+
|
53
|
+
bool BluetoothGattDescriptor::setValue(const std::vector<uint8_t>& value) {
|
54
|
+
if (!_obj) throw std::runtime_error("BluetoothGattDescriptor is not initialized");
|
55
|
+
|
56
|
+
SimpleJNI::Env env;
|
57
|
+
jbyteArray jbyteArray_obj = env->NewByteArray(value.size());
|
58
|
+
env->SetByteArrayRegion(jbyteArray_obj, 0, value.size(), reinterpret_cast<const jbyte*>(value.data()));
|
59
|
+
|
60
|
+
bool result = _obj.call_boolean_method(_method_setValue, jbyteArray_obj);
|
61
|
+
|
62
|
+
env->DeleteLocalRef(jbyteArray_obj);
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
} // namespace Android
|
67
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <simpleble/Types.h>
|
4
|
+
#include <string>
|
5
|
+
#include "simplejni/Common.hpp"
|
6
|
+
#include "simplejni/Registry.hpp"
|
7
|
+
|
8
|
+
namespace SimpleBLE {
|
9
|
+
namespace Android {
|
10
|
+
|
11
|
+
class BluetoothGattDescriptor {
|
12
|
+
// See: https://developer.android.com/reference/android/bluetooth/BluetoothGattDescriptor
|
13
|
+
public:
|
14
|
+
BluetoothGattDescriptor();
|
15
|
+
BluetoothGattDescriptor(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
16
|
+
virtual ~BluetoothGattDescriptor() = default;
|
17
|
+
|
18
|
+
std::string getUuid();
|
19
|
+
|
20
|
+
std::vector<uint8_t> getValue();
|
21
|
+
bool setValue(const std::vector<uint8_t>& value);
|
22
|
+
|
23
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> getObject() const { return _obj; }
|
24
|
+
|
25
|
+
static const std::string CLIENT_CHARACTERISTIC_CONFIG;
|
26
|
+
static const std::vector<uint8_t> DISABLE_NOTIFICATION_VALUE;
|
27
|
+
static const std::vector<uint8_t> ENABLE_NOTIFICATION_VALUE;
|
28
|
+
static const std::vector<uint8_t> ENABLE_INDICATION_VALUE;
|
29
|
+
|
30
|
+
private:
|
31
|
+
// Underlying JNI object - Use SimpleJNI::Object with GlobalRef
|
32
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
33
|
+
|
34
|
+
// Static JNI resources managed by Registrar
|
35
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
36
|
+
static jmethodID _method_getUuid;
|
37
|
+
static jmethodID _method_getValue;
|
38
|
+
static jmethodID _method_setValue;
|
39
|
+
|
40
|
+
// JNI descriptor for auto-registration
|
41
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
42
|
+
static const SimpleJNI::AutoRegister<BluetoothGattDescriptor> registrar;
|
43
|
+
};
|
44
|
+
|
45
|
+
} // namespace Android
|
46
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,106 @@
|
|
1
|
+
//
|
2
|
+
// Created by Kevin Dewald on 5/17/24.
|
3
|
+
//
|
4
|
+
|
5
|
+
#include "BluetoothGattService.h"
|
6
|
+
#include "types/java/util/UUID.h"
|
7
|
+
#include "types/java/util/List.h"
|
8
|
+
|
9
|
+
namespace SimpleBLE {
|
10
|
+
namespace Android {
|
11
|
+
|
12
|
+
SimpleJNI::GlobalRef<jclass> BluetoothGattService::_cls;
|
13
|
+
jmethodID BluetoothGattService::_method_addCharacteristic = nullptr;
|
14
|
+
jmethodID BluetoothGattService::_method_addService = nullptr;
|
15
|
+
jmethodID BluetoothGattService::_method_getCharacteristic = nullptr;
|
16
|
+
jmethodID BluetoothGattService::_method_getCharacteristics = nullptr;
|
17
|
+
jmethodID BluetoothGattService::_method_getIncludedServices = nullptr;
|
18
|
+
jmethodID BluetoothGattService::_method_getInstanceId = nullptr;
|
19
|
+
jmethodID BluetoothGattService::_method_getType = nullptr;
|
20
|
+
jmethodID BluetoothGattService::_method_getUuid = nullptr;
|
21
|
+
|
22
|
+
// Define the JNI descriptor
|
23
|
+
const SimpleJNI::JNIDescriptor BluetoothGattService::descriptor{
|
24
|
+
"android/bluetooth/BluetoothGattService", // Java class name
|
25
|
+
&_cls, // Where to store the jclass
|
26
|
+
{ // Methods to preload
|
27
|
+
{"addCharacteristic", "(Landroid/bluetooth/BluetoothGattCharacteristic;)Z", &_method_addCharacteristic},
|
28
|
+
{"addService", "(Landroid/bluetooth/BluetoothGattService;)Z", &_method_addService},
|
29
|
+
{"getCharacteristic", "(Ljava/util/UUID;)Landroid/bluetooth/BluetoothGattCharacteristic;", &_method_getCharacteristic},
|
30
|
+
{"getCharacteristics", "()Ljava/util/List;", &_method_getCharacteristics},
|
31
|
+
{"getIncludedServices", "()Ljava/util/List;", &_method_getIncludedServices},
|
32
|
+
{"getInstanceId", "()I", &_method_getInstanceId},
|
33
|
+
{"getType", "()I", &_method_getType},
|
34
|
+
{"getUuid", "()Ljava/util/UUID;", &_method_getUuid}
|
35
|
+
}};
|
36
|
+
|
37
|
+
const SimpleJNI::AutoRegister<BluetoothGattService> BluetoothGattService::registrar{&descriptor};
|
38
|
+
|
39
|
+
BluetoothGattService::BluetoothGattService() : _obj() {
|
40
|
+
if (!_cls.get()) {
|
41
|
+
throw std::runtime_error("BluetoothGattService JNI resources not preloaded. Ensure SimpleJNI::Registrar::preload() is called.");
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
BluetoothGattService::BluetoothGattService(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
46
|
+
|
47
|
+
// bool BluetoothGattService::addCharacteristic(BluetoothGattCharacteristic characteristic) {
|
48
|
+
// return _obj.call_boolean_method(_method_addCharacteristic, characteristic.getObject());
|
49
|
+
// }
|
50
|
+
//
|
51
|
+
// bool BluetoothGattService::addService(BluetoothGattService service) {
|
52
|
+
// return _obj.call_boolean_method(_method_addService, service.getObject());
|
53
|
+
// }
|
54
|
+
//
|
55
|
+
// BluetoothGattCharacteristic BluetoothGattService::getCharacteristic(std::string uuid) {
|
56
|
+
// JNI::Env env;
|
57
|
+
// SimpleJNI::Object<SimpleJNI::LocalRef, jobject> charObj = _obj.call_object_method(_method_getCharacteristic, env->NewStringUTF(uuid.c_str()));
|
58
|
+
// return BluetoothGattCharacteristic(charObj.to_global());
|
59
|
+
// }
|
60
|
+
//
|
61
|
+
std::vector<BluetoothGattCharacteristic> BluetoothGattService::getCharacteristics() {
|
62
|
+
if (!_obj) throw std::runtime_error("BluetoothGattService is not initialized");
|
63
|
+
|
64
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> characteristics_obj = _obj.call_object_method(_method_getCharacteristics);
|
65
|
+
if (!characteristics_obj) throw std::runtime_error("Failed to get characteristics");
|
66
|
+
|
67
|
+
std::vector<BluetoothGattCharacteristic> result;
|
68
|
+
List list(characteristics_obj.to_global());
|
69
|
+
Iterator iterator = list.iterator();
|
70
|
+
while (iterator.hasNext()) {
|
71
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> characteristic = iterator.next();
|
72
|
+
|
73
|
+
if (!characteristic) continue; // TODO: Should we throw an error here?
|
74
|
+
result.push_back(BluetoothGattCharacteristic(characteristic));
|
75
|
+
}
|
76
|
+
|
77
|
+
return result;
|
78
|
+
}
|
79
|
+
//
|
80
|
+
// std::vector<BluetoothGattService> BluetoothGattService::getIncludedServices() {
|
81
|
+
// SimpleJNI::Object<SimpleJNI::LocalRef, jobject> listObj = _obj.call_object_method(_method_getIncludedServices);
|
82
|
+
// // TODO: Implement conversion from list to vector of BluetoothGattService
|
83
|
+
// return std::vector<BluetoothGattService>();
|
84
|
+
//}
|
85
|
+
|
86
|
+
int BluetoothGattService::getInstanceId() {
|
87
|
+
if (!_obj) throw std::runtime_error("BluetoothGattService is not initialized");
|
88
|
+
return _obj.call_int_method(_method_getInstanceId);
|
89
|
+
}
|
90
|
+
|
91
|
+
int BluetoothGattService::getType() {
|
92
|
+
if (!_obj) throw std::runtime_error("BluetoothGattService is not initialized");
|
93
|
+
return _obj.call_int_method(_method_getType);
|
94
|
+
}
|
95
|
+
|
96
|
+
std::string BluetoothGattService::getUuid() {
|
97
|
+
if (!_obj) throw std::runtime_error("BluetoothGattService is not initialized");
|
98
|
+
|
99
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> uuidObj = _obj.call_object_method(_method_getUuid);
|
100
|
+
if (!uuidObj) throw std::runtime_error("Failed to get UUID");
|
101
|
+
|
102
|
+
return UUID(uuidObj.to_global()).toString();
|
103
|
+
}
|
104
|
+
|
105
|
+
} // namespace Android
|
106
|
+
} // namespace SimpleBLE
|
data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattService.h
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <string>
|
4
|
+
#include <vector>
|
5
|
+
#include "BluetoothGattCharacteristic.h"
|
6
|
+
#include "simplejni/Common.hpp"
|
7
|
+
#include "simplejni/Registry.hpp"
|
8
|
+
|
9
|
+
namespace SimpleBLE {
|
10
|
+
namespace Android {
|
11
|
+
|
12
|
+
class BluetoothGattService {
|
13
|
+
public:
|
14
|
+
BluetoothGattService();
|
15
|
+
BluetoothGattService(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
16
|
+
|
17
|
+
// bool addCharacteristic(BluetoothGattCharacteristic characteristic);
|
18
|
+
// bool addService(BluetoothGattService service);
|
19
|
+
// BluetoothGattCharacteristic getCharacteristic(std::string uuid);
|
20
|
+
std::vector<BluetoothGattCharacteristic> getCharacteristics();
|
21
|
+
// std::vector<BluetoothGattService> getIncludedServices(); // TODO: This might be necessary if we don't see the
|
22
|
+
// secondary services in some other way.
|
23
|
+
int getInstanceId();
|
24
|
+
int getType();
|
25
|
+
std::string getUuid();
|
26
|
+
|
27
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> getObject() const { return _obj; }
|
28
|
+
|
29
|
+
private:
|
30
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
31
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
32
|
+
static jmethodID _method_addCharacteristic;
|
33
|
+
static jmethodID _method_addService;
|
34
|
+
static jmethodID _method_getCharacteristic;
|
35
|
+
static jmethodID _method_getCharacteristics;
|
36
|
+
static jmethodID _method_getIncludedServices;
|
37
|
+
static jmethodID _method_getInstanceId;
|
38
|
+
static jmethodID _method_getType;
|
39
|
+
static jmethodID _method_getUuid;
|
40
|
+
|
41
|
+
// JNI descriptor for auto-registration
|
42
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
43
|
+
static const SimpleJNI::AutoRegister<BluetoothGattService> registrar;
|
44
|
+
};
|
45
|
+
|
46
|
+
} // namespace Android
|
47
|
+
} // namespace SimpleBLE
|
data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.cpp
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#include "BluetoothScanner.h"
|
2
|
+
#include <CommonUtils.h>
|
3
|
+
#include <android/log.h>
|
4
|
+
#include <fmt/format.h>
|
5
|
+
|
6
|
+
namespace SimpleBLE {
|
7
|
+
namespace Android {
|
8
|
+
|
9
|
+
// Define static JNI resources
|
10
|
+
SimpleJNI::GlobalRef<jclass> BluetoothScanner::_cls;
|
11
|
+
jmethodID BluetoothScanner::_constructor = nullptr;
|
12
|
+
jmethodID BluetoothScanner::_method_startScan = nullptr;
|
13
|
+
jmethodID BluetoothScanner::_method_stopScan = nullptr;
|
14
|
+
jmethodID BluetoothScanner::_method_toString = nullptr;
|
15
|
+
|
16
|
+
// Define the JNI descriptor
|
17
|
+
const SimpleJNI::JNIDescriptor BluetoothScanner::descriptor{
|
18
|
+
"android/bluetooth/le/BluetoothLeScanner", // Java class name
|
19
|
+
&_cls, // Where to store the jclass
|
20
|
+
{ // Methods to preload
|
21
|
+
{"<init>", "()V", &_constructor},
|
22
|
+
{"startScan", "(Landroid/bluetooth/le/ScanCallback;)V", &_method_startScan},
|
23
|
+
{"stopScan", "(Landroid/bluetooth/le/ScanCallback;)V", &_method_stopScan},
|
24
|
+
{"toString", "()Ljava/lang/String;", &_method_toString}
|
25
|
+
}};
|
26
|
+
|
27
|
+
const SimpleJNI::AutoRegister<BluetoothScanner> BluetoothScanner::registrar{&descriptor};
|
28
|
+
|
29
|
+
BluetoothScanner::BluetoothScanner(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
30
|
+
|
31
|
+
void BluetoothScanner::startScan(Bridge::ScanCallback& callback) {
|
32
|
+
if (!_obj) throw std::runtime_error("BluetoothScanner is not initialized");
|
33
|
+
_obj.call_void_method(_method_startScan, callback.get());
|
34
|
+
}
|
35
|
+
|
36
|
+
void BluetoothScanner::stopScan(Bridge::ScanCallback& callback) {
|
37
|
+
if (!_obj) throw std::runtime_error("BluetoothScanner is not initialized");
|
38
|
+
_obj.call_void_method(_method_stopScan, callback.get());
|
39
|
+
}
|
40
|
+
|
41
|
+
std::string BluetoothScanner::toString() {
|
42
|
+
if (!_obj) throw std::runtime_error("BluetoothScanner is not initialized");
|
43
|
+
return _obj.call_string_method(_method_toString);
|
44
|
+
}
|
45
|
+
|
46
|
+
} // namespace Android
|
47
|
+
} // namespace SimpleBLE
|
data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.h
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "simplejni/Common.hpp"
|
4
|
+
#include "bridge/ScanCallback.h"
|
5
|
+
|
6
|
+
namespace SimpleBLE {
|
7
|
+
namespace Android {
|
8
|
+
|
9
|
+
class BluetoothScanner {
|
10
|
+
public:
|
11
|
+
BluetoothScanner(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
12
|
+
|
13
|
+
void startScan(Bridge::ScanCallback& callback);
|
14
|
+
void stopScan(Bridge::ScanCallback& callback);
|
15
|
+
|
16
|
+
std::string toString();
|
17
|
+
|
18
|
+
jobject get() const { return _obj.get(); } // TODO: Remove once nothing uses this
|
19
|
+
|
20
|
+
private:
|
21
|
+
// Underlying JNI object - Use SimpleJNI::Object with GlobalRef
|
22
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
23
|
+
|
24
|
+
// Static JNI resources managed by Registrar
|
25
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
26
|
+
static jmethodID _constructor;
|
27
|
+
static jmethodID _method_startScan;
|
28
|
+
static jmethodID _method_stopScan;
|
29
|
+
static jmethodID _method_toString;
|
30
|
+
|
31
|
+
// JNI descriptor for auto-registration
|
32
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
33
|
+
static const SimpleJNI::AutoRegister<BluetoothScanner> registrar;
|
34
|
+
};
|
35
|
+
|
36
|
+
} // namespace Android
|
37
|
+
} // namespace SimpleBLE
|
data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanRecord.cpp
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#include "ScanRecord.h"
|
2
|
+
#include "types/android/os/ParcelUUID.h"
|
3
|
+
#include "types/android/util/SparseArray.h"
|
4
|
+
#include "types/java/util/List.h"
|
5
|
+
#include "types/java/util/Iterator.h"
|
6
|
+
namespace SimpleBLE {
|
7
|
+
namespace Android {
|
8
|
+
|
9
|
+
// Define static JNI resources
|
10
|
+
SimpleJNI::GlobalRef<jclass> ScanRecord::_cls;
|
11
|
+
jmethodID ScanRecord::_method_getServiceUuids = nullptr;
|
12
|
+
jmethodID ScanRecord::_method_getManufacturerData = nullptr;
|
13
|
+
jmethodID ScanRecord::_method_toString = nullptr;
|
14
|
+
|
15
|
+
// Define the JNI descriptor
|
16
|
+
const SimpleJNI::JNIDescriptor ScanRecord::descriptor{
|
17
|
+
"android/bluetooth/le/ScanRecord", // Java class name
|
18
|
+
&_cls, // Where to store the jclass
|
19
|
+
{ // Methods to preload
|
20
|
+
{"getServiceUuids", "()Ljava/util/List;", &_method_getServiceUuids},
|
21
|
+
{"getManufacturerSpecificData", "()Landroid/util/SparseArray;", &_method_getManufacturerData},
|
22
|
+
{"toString", "()Ljava/lang/String;", &_method_toString}
|
23
|
+
}};
|
24
|
+
|
25
|
+
const SimpleJNI::AutoRegister<ScanRecord> ScanRecord::registrar{&descriptor};
|
26
|
+
|
27
|
+
ScanRecord::ScanRecord(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
28
|
+
|
29
|
+
std::vector<std::string> ScanRecord::getServiceUuids() {
|
30
|
+
if (!_obj) throw std::runtime_error("ScanRecord object is not initialized");
|
31
|
+
|
32
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> service_uuids_obj = _obj.call_object_method(_method_getServiceUuids);
|
33
|
+
if (!service_uuids_obj) return {};
|
34
|
+
|
35
|
+
std::vector<std::string> result;
|
36
|
+
List list(service_uuids_obj.to_global());
|
37
|
+
Iterator iterator = list.iterator();
|
38
|
+
while (iterator.hasNext()) {
|
39
|
+
ParcelUUID parcel_uuid = ParcelUUID(iterator.next());
|
40
|
+
result.push_back(parcel_uuid.getUuid().toString());
|
41
|
+
}
|
42
|
+
|
43
|
+
return result;
|
44
|
+
}
|
45
|
+
|
46
|
+
std::map<uint16_t, kvn::bytearray> ScanRecord::getManufacturerData() {
|
47
|
+
if (!_obj) throw std::runtime_error("ScanRecord object is not initialized");
|
48
|
+
|
49
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> manufacturer_data_obj = _obj.call_object_method(_method_getManufacturerData);
|
50
|
+
if (!manufacturer_data_obj) return {};
|
51
|
+
|
52
|
+
SparseArray<SimpleJNI::ByteArray<SimpleJNI::LocalRef>> sparse_array(manufacturer_data_obj);
|
53
|
+
|
54
|
+
std::map<uint16_t, kvn::bytearray> result;
|
55
|
+
for (int i = 0; i < sparse_array.size(); i++) {
|
56
|
+
uint16_t key = sparse_array.keyAt(i);
|
57
|
+
SimpleJNI::ByteArray<SimpleJNI::LocalRef> value = sparse_array.valueAt(i);
|
58
|
+
result[key] = value.bytes();
|
59
|
+
}
|
60
|
+
return result;
|
61
|
+
}
|
62
|
+
|
63
|
+
std::string ScanRecord::toString() {
|
64
|
+
if (!_obj) throw std::runtime_error("ScanRecord object is not initialized");
|
65
|
+
return _obj.call_string_method(_method_toString);
|
66
|
+
}
|
67
|
+
|
68
|
+
} // namespace Android
|
69
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "simplejni/Common.hpp"
|
4
|
+
#include "simplejni/Registry.hpp"
|
5
|
+
|
6
|
+
#include "types/java/util/UUID.h"
|
7
|
+
#include <map>
|
8
|
+
#include <vector>
|
9
|
+
#include "kvn/kvn_bytearray.h"
|
10
|
+
#include "types/android/os/ParcelUUID.h"
|
11
|
+
#include "types/android/util/SparseArray.h"
|
12
|
+
|
13
|
+
namespace SimpleBLE {
|
14
|
+
namespace Android {
|
15
|
+
|
16
|
+
class ScanRecord {
|
17
|
+
public:
|
18
|
+
ScanRecord(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
19
|
+
|
20
|
+
std::vector<std::string> getServiceUuids();
|
21
|
+
std::map<uint16_t, kvn::bytearray> getManufacturerData();
|
22
|
+
|
23
|
+
std::string toString();
|
24
|
+
|
25
|
+
private:
|
26
|
+
// Underlying JNI object
|
27
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
28
|
+
|
29
|
+
// Static JNI resources managed by Registrar
|
30
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
31
|
+
static jmethodID _method_getServiceUuids;
|
32
|
+
static jmethodID _method_getManufacturerData;
|
33
|
+
static jmethodID _method_toString;
|
34
|
+
|
35
|
+
// JNI descriptor for auto-registration
|
36
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
37
|
+
static const SimpleJNI::AutoRegister<ScanRecord> registrar;
|
38
|
+
};
|
39
|
+
|
40
|
+
} // namespace Android
|
41
|
+
} // namespace SimpleBLE
|
data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanResult.cpp
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#include "ScanResult.h"
|
2
|
+
|
3
|
+
namespace SimpleBLE {
|
4
|
+
namespace Android {
|
5
|
+
|
6
|
+
// Define static JNI resources
|
7
|
+
SimpleJNI::GlobalRef<jclass> ScanResult::_cls;
|
8
|
+
jmethodID ScanResult::_method_getDevice = nullptr;
|
9
|
+
jmethodID ScanResult::_method_getRssi = nullptr;
|
10
|
+
jmethodID ScanResult::_method_getTxPower = nullptr;
|
11
|
+
jmethodID ScanResult::_method_isConnectable = nullptr;
|
12
|
+
jmethodID ScanResult::_method_getScanRecord = nullptr;
|
13
|
+
jmethodID ScanResult::_method_toString = nullptr;
|
14
|
+
|
15
|
+
// Define the JNI descriptor
|
16
|
+
const SimpleJNI::JNIDescriptor ScanResult::descriptor{
|
17
|
+
"android/bluetooth/le/ScanResult", // Java class name
|
18
|
+
&_cls, // Where to store the jclass
|
19
|
+
{ // Methods to preload
|
20
|
+
{"getDevice", "()Landroid/bluetooth/BluetoothDevice;", &_method_getDevice},
|
21
|
+
{"getRssi", "()I", &_method_getRssi},
|
22
|
+
{"getTxPower", "()I", &_method_getTxPower},
|
23
|
+
{"isConnectable", "()Z", &_method_isConnectable},
|
24
|
+
{"getScanRecord", "()Landroid/bluetooth/le/ScanRecord;", &_method_getScanRecord},
|
25
|
+
{"toString", "()Ljava/lang/String;", &_method_toString}
|
26
|
+
}};
|
27
|
+
|
28
|
+
const SimpleJNI::AutoRegister<ScanResult> ScanResult::registrar{&descriptor};
|
29
|
+
|
30
|
+
ScanResult::ScanResult(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
31
|
+
|
32
|
+
BluetoothDevice ScanResult::getDevice() {
|
33
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
34
|
+
return BluetoothDevice(_obj.call_object_method(_method_getDevice));
|
35
|
+
}
|
36
|
+
|
37
|
+
int16_t ScanResult::getRssi() {
|
38
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
39
|
+
return _obj.call_int_method(_method_getRssi);
|
40
|
+
}
|
41
|
+
|
42
|
+
int16_t ScanResult::getTxPower() {
|
43
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
44
|
+
return _obj.call_int_method(_method_getTxPower);
|
45
|
+
}
|
46
|
+
|
47
|
+
bool ScanResult::isConnectable() {
|
48
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
49
|
+
return _obj.call_boolean_method(_method_isConnectable);
|
50
|
+
}
|
51
|
+
|
52
|
+
ScanRecord ScanResult::getScanRecord() {
|
53
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
54
|
+
return ScanRecord(_obj.call_object_method(_method_getScanRecord));
|
55
|
+
}
|
56
|
+
|
57
|
+
std::string ScanResult::toString() {
|
58
|
+
if (!_obj) throw std::runtime_error("ScanResult object is not initialized");
|
59
|
+
return _obj.call_string_method(_method_toString);
|
60
|
+
}
|
61
|
+
|
62
|
+
} // namespace Android
|
63
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "simplejni/Common.hpp"
|
4
|
+
#include "simplejni/Registry.hpp"
|
5
|
+
|
6
|
+
#include "types/android/bluetooth/BluetoothDevice.h"
|
7
|
+
#include "types/android/bluetooth/le/ScanRecord.h"
|
8
|
+
|
9
|
+
namespace SimpleBLE {
|
10
|
+
namespace Android {
|
11
|
+
|
12
|
+
class ScanResult {
|
13
|
+
public:
|
14
|
+
ScanResult(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj);
|
15
|
+
|
16
|
+
BluetoothDevice getDevice();
|
17
|
+
int16_t getRssi();
|
18
|
+
int16_t getTxPower();
|
19
|
+
bool isConnectable();
|
20
|
+
ScanRecord getScanRecord();
|
21
|
+
std::string toString();
|
22
|
+
|
23
|
+
private:
|
24
|
+
// Underlying JNI object
|
25
|
+
SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> _obj;
|
26
|
+
|
27
|
+
// Static JNI resources managed by Registrar
|
28
|
+
static SimpleJNI::GlobalRef<jclass> _cls;
|
29
|
+
static jmethodID _method_getDevice;
|
30
|
+
static jmethodID _method_getRssi;
|
31
|
+
static jmethodID _method_getTxPower;
|
32
|
+
static jmethodID _method_isConnectable;
|
33
|
+
static jmethodID _method_getScanRecord;
|
34
|
+
static jmethodID _method_toString;
|
35
|
+
|
36
|
+
// JNI descriptor for auto-registration
|
37
|
+
static const SimpleJNI::JNIDescriptor descriptor;
|
38
|
+
static const SimpleJNI::AutoRegister<ScanResult> registrar;
|
39
|
+
};
|
40
|
+
|
41
|
+
} // namespace Android
|
42
|
+
} // namespace SimpleBLE
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#include "ParcelUUID.h"
|
2
|
+
|
3
|
+
namespace SimpleBLE {
|
4
|
+
namespace Android {
|
5
|
+
|
6
|
+
// Static members definition
|
7
|
+
SimpleJNI::GlobalRef<jclass> ParcelUUID::_cls;
|
8
|
+
jmethodID ParcelUUID::_method_getUuid = nullptr;
|
9
|
+
|
10
|
+
// JNI Descriptor for ParcelUUID
|
11
|
+
const SimpleJNI::JNIDescriptor ParcelUUID::descriptor{
|
12
|
+
"android/os/ParcelUuid", // Java class name
|
13
|
+
&_cls, // Pointer to store the jclass
|
14
|
+
{ // Methods to preload
|
15
|
+
{"getUuid", "()Ljava/util/UUID;", &_method_getUuid}
|
16
|
+
}};
|
17
|
+
|
18
|
+
// Auto-register the class with SimpleJNI
|
19
|
+
const SimpleJNI::AutoRegister<ParcelUUID> ParcelUUID::registrar{&descriptor};
|
20
|
+
|
21
|
+
ParcelUUID::ParcelUUID() : _obj() {}
|
22
|
+
|
23
|
+
ParcelUUID::ParcelUUID(SimpleJNI::Object<SimpleJNI::GlobalRef, jobject> obj) : _obj(obj) {}
|
24
|
+
|
25
|
+
UUID ParcelUUID::getUuid() {
|
26
|
+
if (!_obj) throw std::runtime_error("ParcelUUID is not initialized");
|
27
|
+
SimpleJNI::Object<SimpleJNI::LocalRef, jobject> java_uuid_obj = _obj.call_object_method(_method_getUuid);
|
28
|
+
return UUID(java_uuid_obj);
|
29
|
+
}
|
30
|
+
|
31
|
+
} // namespace Android
|
32
|
+
} // namespace SimpleBLE
|