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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9bd34e1b0249adfe3d9c9c7f141ed5cbcf0dfc0987df702ab49814e39cf24774
|
4
|
+
data.tar.gz: 4aa7a01d521cc366064404fd3bd92473fbcd8a79dab37acd4c15d36d4a5595c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f014485de22039bf659024aa4d60bbd846e9a9312be3fc0b333b0d3fa0972e778dff347918ee5a18223bc8aa5e1f0f09d9f75ccda08b824869c4042723592d27
|
7
|
+
data.tar.gz: bd7c4a1b5b1100e693cc65b9ecb03ef695eede4d663f43fc0721d2d5a318cb9c2fafaee8a99b79b24217d224404fe91f9fd8deedd592c80ab9a24446151d4db1
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- **MAJOR API EXPANSION**: Complete GATT operations support
|
12
|
+
- Full service, characteristic, and descriptor enumeration with capabilities
|
13
|
+
- Characteristic read/write operations (both request and command modes)
|
14
|
+
- Descriptor read/write operations
|
15
|
+
- Manufacturer data and advertisement parsing
|
16
|
+
- Paired peripherals access via `adapter.paired_peripherals`
|
17
|
+
- Extended peripheral information: TX power, MTU, enhanced addressing
|
18
|
+
|
19
|
+
- **Ruby-friendly API enhancements**:
|
20
|
+
- Helper methods: `peripheral.name`, `to_s`, `has_data?`, formatted output methods
|
21
|
+
- Convenient service/characteristic lookup by UUID
|
22
|
+
- Enhanced error handling with CharacteristicError exception class
|
23
|
+
- UUID parsing from strings and symbols
|
24
|
+
|
25
|
+
- **Cross-platform stability**:
|
26
|
+
- Fixed Unix library linking (both libsimplecble.a and libsimpleble.a required)
|
27
|
+
- Resolved C++ symbol resolution issues on Linux and macOS
|
28
|
+
- All platforms (Windows, macOS, Linux) now building and working in CI
|
29
|
+
- Full Ruby version matrix support (2.7-3.3) across all platforms
|
30
|
+
|
31
|
+
### Changed
|
32
|
+
- Updated README with accurate API documentation reflecting current comprehensive functionality
|
33
|
+
- Enhanced CI workflow to test all Ruby versions across all platforms
|
34
|
+
- Improved error handling and memory management throughout C extension
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
- Unix platforms: Fixed "undefined symbol" errors by linking both SimpleBLE C and C++ libraries
|
38
|
+
- Cross-platform compilation issues resolved for all supported operating systems
|
39
|
+
- Proper C string memory management for all SimpleBLE API calls
|
40
|
+
|
41
|
+
## [0.1.0] - 2025-01-25
|
42
|
+
|
43
|
+
### Added
|
44
|
+
|
45
|
+
- Initial release of ruby-simpleble gem
|
46
|
+
- Ruby C extension bindings for SimpleBLE C++ library
|
47
|
+
- Cross-platform Bluetooth Low Energy (BLE) support
|
48
|
+
- macOS: CoreBluetooth framework integration
|
49
|
+
- Linux: DBus/BlueZ backend support (ready for testing)
|
50
|
+
- Windows: WinRT Bluetooth APIs (ready for testing)
|
51
|
+
- Bluetooth adapter discovery and management
|
52
|
+
- BLE device scanning with timeout control
|
53
|
+
- Real-time device discovery with proper device enumeration
|
54
|
+
- Memory-safe Ruby object lifecycle management
|
55
|
+
- Comprehensive exception hierarchy for error handling
|
56
|
+
- Module-level convenience methods: `SimpleBLE.bluetooth_enabled?`, `SimpleBLE.adapters`, `SimpleBLE.scan`
|
57
|
+
- Object-oriented API with Adapter, Peripheral, Service, Characteristic, and Descriptor classes
|
58
|
+
- Cross-platform build system with automatic dependency detection
|
59
|
+
- Comprehensive RSpec test suite with integration test support
|
60
|
+
- Performance benchmarking tools
|
61
|
+
- Docker-based multi-platform testing
|
62
|
+
- Complete API documentation with usage examples
|
63
|
+
|
64
|
+
### Technical Implementation
|
65
|
+
|
66
|
+
- C++ wrapper bridge for SimpleBLE C++ library integration
|
67
|
+
- Platform-specific compilation flags and framework linking
|
68
|
+
- Vendor SimpleBLE library compilation with CMake integration
|
69
|
+
- Thread-safe operations with proper resource cleanup
|
70
|
+
- Opaque handle management for BLE resources
|
71
|
+
- Cross-platform CI/CD pipeline with GitHub Actions
|
72
|
+
- Quality assurance with Qlty integration
|
73
|
+
|
74
|
+
### Supported Operations
|
75
|
+
|
76
|
+
- Bluetooth adapter enumeration and identification
|
77
|
+
- BLE device scanning (working, tested with real devices)
|
78
|
+
- Device information access (identifier, address, RSSI)
|
79
|
+
- Scan result management and filtering
|
80
|
+
- Connection status monitoring
|
81
|
+
|
82
|
+
### Development Tools
|
83
|
+
|
84
|
+
- Cross-platform build configuration (`extconf.rb`)
|
85
|
+
- Comprehensive test suite with smart integration test skipping
|
86
|
+
- Performance benchmarking with memory leak detection
|
87
|
+
- Docker-based testing for multiple Ruby versions
|
88
|
+
- GitHub Actions CI/CD with cross-platform matrix testing
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Twilight Coders, LLC
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,350 @@
|
|
1
|
+
[](https://badge.fury.io/rb/simpleble)
|
2
|
+
[](https://github.com/twilightcoders/ruby-simpleble/actions/workflows/ci.yml)
|
3
|
+
[](https://qlty.sh/gh/TwilightCoders/projects/ruby-simpleble)
|
4
|
+
[](https://qlty.sh/gh/TwilightCoders/projects/ruby-simpleble/metrics/code?)
|
5
|
+
[](https://github.com/twilightcoders/blob/ruby-simpleble/LICENSE.md)
|
6
|
+
|
7
|
+
# SimpleBLE Ruby
|
8
|
+
|
9
|
+
A Ruby gem providing enterprise-grade, cross-platform Bluetooth Low Energy (BLE) functionality through Ruby bindings for the [SimpleBLE](https://github.com/OpenBluetoothToolbox/SimpleBLE) C++ library. Delivers production-ready BLE scanning, device connection, and GATT operations.
|
10
|
+
|
11
|
+
## 🚀 Quick Start
|
12
|
+
|
13
|
+
```bash
|
14
|
+
gem install simpleble
|
15
|
+
```
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'simpleble'
|
19
|
+
|
20
|
+
# Check if Bluetooth is available
|
21
|
+
SimpleBLE.bluetooth_enabled? # => true
|
22
|
+
|
23
|
+
# Get available Bluetooth adapters
|
24
|
+
adapters = SimpleBLE.adapters
|
25
|
+
adapter = adapters.first
|
26
|
+
puts adapter.identifier # => "Default Adapter [uuid]"
|
27
|
+
|
28
|
+
# Quick scan for BLE devices (5 second timeout)
|
29
|
+
devices = SimpleBLE.scan(5000)
|
30
|
+
puts "Found #{devices.length} BLE devices!"
|
31
|
+
|
32
|
+
# Advanced scanning with adapter control
|
33
|
+
adapter.scan_for(3000) # Scan for 3 seconds
|
34
|
+
peripherals = adapter.scan_results
|
35
|
+
peripherals.each do |device|
|
36
|
+
puts "Device: #{device.identifier} (#{device.address})"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## ✨ Features
|
41
|
+
|
42
|
+
### 🌐 **Cross-Platform Support**
|
43
|
+
- **macOS** - CoreBluetooth framework integration
|
44
|
+
- **Linux** - DBus/BlueZ backend support
|
45
|
+
- **Windows** - WinRT Bluetooth APIs *(ready for testing)*
|
46
|
+
|
47
|
+
### 🔍 **BLE Operations**
|
48
|
+
- ✅ Adapter discovery & identifiers
|
49
|
+
- ✅ Bluetooth enabled check
|
50
|
+
- ✅ Device scanning (blocking scan_for + continuous start/stop)
|
51
|
+
- ✅ Peripheral information (identifier, address, RSSI, TX power, MTU, address_type)
|
52
|
+
- ✅ Connection lifecycle (connect, disconnect, paired?, unpair)
|
53
|
+
- ✅ Paired peripherals access
|
54
|
+
- ✅ GATT service & characteristic enumeration with capabilities
|
55
|
+
- ✅ Characteristic read/write operations (request & command modes)
|
56
|
+
- ✅ Descriptor read/write operations
|
57
|
+
- ✅ Manufacturer data & advertisement parsing
|
58
|
+
- 🚧 Notifications/Indications *(callback support planned)*
|
59
|
+
|
60
|
+
### 🏗️ **Current State**
|
61
|
+
- ✅ Core C extension foundation & memory management for adapters/peripherals
|
62
|
+
- ✅ Exception hierarchy & native error mapping (scan/connection/characteristic errors)
|
63
|
+
- ✅ Cross-platform build scripts (macOS/Linux/Windows all working)
|
64
|
+
- ✅ Comprehensive adapter & peripheral API implemented
|
65
|
+
- ✅ GATT operations layer with service/characteristic/descriptor access
|
66
|
+
- ✅ Ruby-friendly API with helper methods and convenience features
|
67
|
+
- 🚧 Expanded test coverage (integration tests gated by hardware)
|
68
|
+
- 🚧 Notification/indication callback support
|
69
|
+
|
70
|
+
## 🛠️ Installation
|
71
|
+
|
72
|
+
### Prerequisites
|
73
|
+
|
74
|
+
**macOS:**
|
75
|
+
- Xcode command line tools: `xcode-select --install`
|
76
|
+
|
77
|
+
**Linux:**
|
78
|
+
```bash
|
79
|
+
# Ubuntu/Debian
|
80
|
+
sudo apt-get install build-essential libdbus-1-dev cmake
|
81
|
+
|
82
|
+
# Red Hat/CentOS
|
83
|
+
sudo yum install gcc-c++ dbus-devel cmake
|
84
|
+
```
|
85
|
+
|
86
|
+
**Windows:**
|
87
|
+
- Visual Studio Build Tools
|
88
|
+
- Windows SDK
|
89
|
+
- CMake
|
90
|
+
|
91
|
+
### Install the Gem
|
92
|
+
|
93
|
+
```bash
|
94
|
+
gem install simpleble
|
95
|
+
```
|
96
|
+
|
97
|
+
Or add to your Gemfile:
|
98
|
+
```ruby
|
99
|
+
gem 'simpleble'
|
100
|
+
```
|
101
|
+
|
102
|
+
## 📖 API Documentation
|
103
|
+
|
104
|
+
### Module-Level Methods
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
# Check Bluetooth availability
|
108
|
+
SimpleBLE.bluetooth_enabled? # => true/false
|
109
|
+
|
110
|
+
# Get all adapters (convenience method)
|
111
|
+
SimpleBLE.adapters # => [Adapter, ...]
|
112
|
+
|
113
|
+
# Quick scan with first available adapter
|
114
|
+
SimpleBLE.scan(timeout_ms) # => [Peripheral, ...]
|
115
|
+
```
|
116
|
+
|
117
|
+
### Adapter Management
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
# Get all available Bluetooth adapters
|
121
|
+
adapters = SimpleBLE::Adapter.get_adapters
|
122
|
+
adapter = adapters.first
|
123
|
+
|
124
|
+
# Adapter information
|
125
|
+
adapter.identifier # => "Default Adapter [uuid]"
|
126
|
+
adapter.address # => "XX:XX:XX:XX:XX:XX" (or UUID on macOS)
|
127
|
+
|
128
|
+
# Scanning operations
|
129
|
+
adapter.scan_start # Start continuous scan
|
130
|
+
adapter.scan_stop # Stop scanning
|
131
|
+
adapter.scan_for(timeout_ms) # Scan for specific duration
|
132
|
+
adapter.scan_active? # => true/false
|
133
|
+
adapter.scan_results # => [Peripheral, ...]
|
134
|
+
adapter.paired_peripherals # => [Peripheral, ...] - Previously paired devices
|
135
|
+
```
|
136
|
+
|
137
|
+
### Peripheral Operations
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
devices = SimpleBLE.scan(5000)
|
141
|
+
device = devices.first
|
142
|
+
|
143
|
+
# Basic information
|
144
|
+
device.identifier # Device name or identifier
|
145
|
+
device.address # MAC address or UUID
|
146
|
+
device.rssi # Signal strength in dBm
|
147
|
+
device.tx_power # Advertised TX power in dBm
|
148
|
+
device.mtu # Maximum transmission unit
|
149
|
+
device.address_type # Address type (public/random/unspecified)
|
150
|
+
|
151
|
+
# Connection management
|
152
|
+
device.connectable? # Whether device accepts connections
|
153
|
+
device.connected? # Current connection status
|
154
|
+
device.paired? # Whether device is paired
|
155
|
+
device.connect # Establish connection
|
156
|
+
device.disconnect # Close connection
|
157
|
+
device.unpair # Remove pairing
|
158
|
+
|
159
|
+
# GATT operations (requires connection)
|
160
|
+
services = device.services # => [{"uuid" => "...", "characteristics" => [...]}]
|
161
|
+
data = device.read_characteristic(service_uuid, char_uuid)
|
162
|
+
device.write_characteristic_request(service_uuid, char_uuid, data)
|
163
|
+
device.write_characteristic_command(service_uuid, char_uuid, data)
|
164
|
+
|
165
|
+
# Descriptor operations
|
166
|
+
desc_data = device.read_descriptor(service_uuid, char_uuid, desc_uuid)
|
167
|
+
device.write_descriptor(service_uuid, char_uuid, desc_uuid, data)
|
168
|
+
|
169
|
+
# Advertisement data
|
170
|
+
mfg_data = device.manufacturer_data # => [{"manufacturer_id" => 123, "data" => "..."}]
|
171
|
+
|
172
|
+
# Helper methods
|
173
|
+
device.name # Friendly name (identifier or address)
|
174
|
+
device.to_s # "Name (address)"
|
175
|
+
device.has_data? # Check if device has valid data
|
176
|
+
device.rssi_s # "-67 dBm"
|
177
|
+
device.address_type_s # "Public" / "Random" / "Unspecified"
|
178
|
+
```
|
179
|
+
|
180
|
+
## 🧪 Interactive Testing
|
181
|
+
|
182
|
+
Launch an interactive Ruby session with SimpleBLE loaded:
|
183
|
+
|
184
|
+
```bash
|
185
|
+
ruby -rsimpleble -e "
|
186
|
+
adapters = SimpleBLE.adapters
|
187
|
+
adapter = adapters.first
|
188
|
+
puts 'Try: SimpleBLE.scan(3000)'
|
189
|
+
require 'irb'; IRB.start
|
190
|
+
"
|
191
|
+
```
|
192
|
+
|
193
|
+
## 🔧 Development
|
194
|
+
|
195
|
+
### Building from Source
|
196
|
+
|
197
|
+
```bash
|
198
|
+
# Clone repository with submodules
|
199
|
+
git clone --recurse-submodules https://github.com/twilightcoders/ruby-simpleble.git
|
200
|
+
cd ruby-simpleble
|
201
|
+
|
202
|
+
# Or if you already cloned without submodules:
|
203
|
+
git submodule update --init --recursive
|
204
|
+
|
205
|
+
# Install dependencies
|
206
|
+
bundle install
|
207
|
+
|
208
|
+
# Compile the C extension
|
209
|
+
rake compile
|
210
|
+
|
211
|
+
# Run tests
|
212
|
+
rake test
|
213
|
+
```
|
214
|
+
|
215
|
+
### Updating SimpleBLE Vendor Library
|
216
|
+
|
217
|
+
```bash
|
218
|
+
# Update to latest SimpleBLE upstream
|
219
|
+
git submodule update --remote vendor/simpleble
|
220
|
+
|
221
|
+
# Verify the update
|
222
|
+
git submodule status
|
223
|
+
```
|
224
|
+
|
225
|
+
### Running Tests
|
226
|
+
|
227
|
+
```bash
|
228
|
+
# Run all tests
|
229
|
+
bundle exec rspec
|
230
|
+
|
231
|
+
# Run with coverage
|
232
|
+
bundle exec rspec --format documentation
|
233
|
+
|
234
|
+
# Test specific functionality
|
235
|
+
bundle exec rspec spec/simpleble_spec.rb
|
236
|
+
```
|
237
|
+
|
238
|
+
## 🏗️ Architecture
|
239
|
+
|
240
|
+
SimpleBLE Ruby uses a layered architecture:
|
241
|
+
|
242
|
+
```
|
243
|
+
Ruby Application
|
244
|
+
↓
|
245
|
+
SimpleBLE Ruby Wrapper (lib/simpleble.rb)
|
246
|
+
↓
|
247
|
+
C Extension Layer (ext/simpleble/)
|
248
|
+
↓
|
249
|
+
SimpleBLE C++ Library (vendor/simpleble/)
|
250
|
+
↓
|
251
|
+
Platform BLE APIs (CoreBluetooth/BlueZ/WinRT)
|
252
|
+
```
|
253
|
+
|
254
|
+
### Key Components
|
255
|
+
|
256
|
+
- **Ruby API Layer**: Clean, idiomatic Ruby interface
|
257
|
+
- **C Extension**: Memory-safe Ruby ↔ C++ bridge
|
258
|
+
- **C++ Wrapper**: Type-safe interface to SimpleBLE library
|
259
|
+
- **SimpleBLE Library**: Cross-platform BLE abstraction
|
260
|
+
- **Platform Backends**: OS-specific BLE implementations
|
261
|
+
|
262
|
+
### 🚦 Status Summary
|
263
|
+
|
264
|
+
| Area | Implemented | Notes |
|
265
|
+
|------|-------------|-------|
|
266
|
+
| Adapter enumeration | ✅ | identifier, address |
|
267
|
+
| Scanning (start/stop/for) | ✅ | Timed & continuous |
|
268
|
+
| Scan results retrieval | ✅ | Returns Peripheral objects |
|
269
|
+
| Peripheral basic info | ✅ | identifier, address, RSSI, TX power, MTU, address_type |
|
270
|
+
| Connection lifecycle | ✅ | connect, disconnect, paired?, unpair |
|
271
|
+
| Paired peripherals | ✅ | Access to previously paired devices |
|
272
|
+
| Services/Characteristics | ✅ | Full enumeration with capabilities |
|
273
|
+
| Characteristic I/O | ✅ | Read/write with request & command modes |
|
274
|
+
| Descriptor I/O | ✅ | Read/write operations |
|
275
|
+
| Manufacturer data | ✅ | Advertisement parsing |
|
276
|
+
| Windows support | ✅ | All platforms working |
|
277
|
+
| Test coverage | 🚧 | Expanding beyond placeholders |
|
278
|
+
| Documentation accuracy | ✅ | Reflects current API |
|
279
|
+
|
280
|
+
### Roadmap
|
281
|
+
- [ ] Notification/indication callbacks with GC-safe storage
|
282
|
+
- [ ] Hardware-gated integration test suite expansion
|
283
|
+
- [ ] Performance optimizations and memory usage analysis
|
284
|
+
- [ ] Precompiled native gem variants (later)
|
285
|
+
|
286
|
+
## 📊 Compatibility
|
287
|
+
|
288
|
+
| Platform | Status | Backend | Notes |
|
289
|
+
|----------|---------|---------|-------|
|
290
|
+
| **macOS** | ✅ Working | CoreBluetooth | Full support, production tested |
|
291
|
+
| **Linux** | ✅ Working | BlueZ/DBus | CI passing, production ready |
|
292
|
+
| **Windows** | ✅ Working | WinRT | CI passing, production ready |
|
293
|
+
|
294
|
+
## ⚡ CI Performance & Caching
|
295
|
+
|
296
|
+
Building the SimpleBLE core for every Ruby version slows the matrix. Two knobs:
|
297
|
+
|
298
|
+
1. `SIMPLEBLE_PREBUILT_LIB` – point to a prebuilt static library (and headers) so only the Ruby bridge compiles.
|
299
|
+
2. `SIMPLEBLE_REUSE_OBJECTS=1` – skip `make clean` and reuse previously cached `.o` files.
|
300
|
+
|
301
|
+
### Prebuilt Flow
|
302
|
+
Create a warmup job that builds once, packages `tmp_flat/*.o` (or a consolidated `libsimpleble_core.a` you produce via `ar`), uploads as an artifact, then matrix jobs download and set:
|
303
|
+
```
|
304
|
+
env:
|
305
|
+
SIMPLEBLE_PREBUILT_LIB: path/to/libsimpleble_core.a
|
306
|
+
```
|
307
|
+
`extconf.rb` detects this and links only the Ruby layer.
|
308
|
+
|
309
|
+
### Object Reuse Flow
|
310
|
+
Use `actions/cache` keyed on OS + hash of `vendor/simpleble/**`:
|
311
|
+
```
|
312
|
+
- uses: actions/cache@v4
|
313
|
+
with:
|
314
|
+
path: ext/simpleble/tmp_flat
|
315
|
+
key: simpleble-obj-${{ runner.os }}-${{ hashFiles('vendor/simpleble/**') }}
|
316
|
+
```
|
317
|
+
Then set `SIMPLEBLE_REUSE_OBJECTS: 1` so the compile task skips cleaning.
|
318
|
+
|
319
|
+
### Variables Summary
|
320
|
+
| Var | Purpose |
|
321
|
+
|-----|---------|
|
322
|
+
| `SIMPLEBLE_PREBUILT_LIB` | Path to prebuilt SimpleBLE static lib to link instead of compiling sources |
|
323
|
+
| `SIMPLEBLE_REUSE_OBJECTS` | If `1`, do not run `make clean`; rely on cached object files |
|
324
|
+
|
325
|
+
Regenerate caches whenever the SimpleBLE submodule changes.
|
326
|
+
|
327
|
+
## 🤝 Contributing
|
328
|
+
|
329
|
+
1. Fork the repository
|
330
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
331
|
+
3. Run tests: `bundle exec rspec`
|
332
|
+
4. Commit your changes (`git commit -am 'Add amazing feature'`)
|
333
|
+
5. Push to the branch (`git push origin feature/amazing-feature`)
|
334
|
+
6. Open a Pull Request
|
335
|
+
|
336
|
+
## 📄 License
|
337
|
+
|
338
|
+
This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details.
|
339
|
+
|
340
|
+
## 🙏 Acknowledgments
|
341
|
+
|
342
|
+
- [SimpleBLE Library](https://github.com/OpenBluetoothToolbox/SimpleBLE) - The excellent cross-platform BLE library this gem wraps
|
343
|
+
- [OpenBluetoothToolbox](https://github.com/OpenBluetoothToolbox) - For creating and maintaining SimpleBLE
|
344
|
+
|
345
|
+
## 🔗 Links
|
346
|
+
|
347
|
+
- [Homepage](https://github.com/twilightcoders/ruby-simpleble)
|
348
|
+
- [Documentation](https://github.com/twilightcoders/ruby-simpleble)
|
349
|
+
- [Issue Tracker](https://github.com/twilightcoders/ruby-simpleble/issues)
|
350
|
+
- [SimpleBLE Library](https://github.com/OpenBluetoothToolbox/SimpleBLE)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
# Simple, direct approach
|
4
|
+
if RUBY_PLATFORM =~ /mingw|mswin|cygwin/
|
5
|
+
# Windows - use dynamic linking to avoid static library issues
|
6
|
+
vendor_path = File.expand_path('../../vendor/simpleble', __dir__)
|
7
|
+
|
8
|
+
# Build SimpleBLE first
|
9
|
+
Dir.chdir(vendor_path) do
|
10
|
+
system('utils\\build_lib.bat') || abort("Failed to build SimpleBLE")
|
11
|
+
end
|
12
|
+
|
13
|
+
# Add include paths
|
14
|
+
inc_path = File.join(vendor_path, 'build_simpleble', 'install', 'include')
|
15
|
+
$INCFLAGS << " -I#{inc_path} -I#{inc_path}/simpleble_c"
|
16
|
+
|
17
|
+
# Use dynamic linking - let Windows find DLLs at runtime
|
18
|
+
lib_path = File.join(vendor_path, 'build_simpleble', 'install', 'lib')
|
19
|
+
$LDFLAGS << " -L#{lib_path} -lsimpleble-c"
|
20
|
+
|
21
|
+
# System libraries
|
22
|
+
$LDFLAGS << " -lole32 -loleaut32 -lws2_32 -liphlpapi -lbcrypt -lruntimeobject"
|
23
|
+
else
|
24
|
+
# Unix - use standard static linking
|
25
|
+
vendor_path = File.expand_path('../../vendor/simpleble', __dir__)
|
26
|
+
|
27
|
+
Dir.chdir(vendor_path) do
|
28
|
+
system('./utils/build_lib.sh simplecble') || abort('Failed to build SimpleBLE')
|
29
|
+
end
|
30
|
+
|
31
|
+
inc_path = File.join(vendor_path, 'install_simplecble', 'include')
|
32
|
+
$INCFLAGS << " -I#{inc_path} -I#{inc_path}/simplecble"
|
33
|
+
|
34
|
+
# Create simpleble_c symlink to simplecble for header compatibility
|
35
|
+
simpleble_c_path = File.join(inc_path, 'simpleble_c')
|
36
|
+
simplecble_path = File.join(inc_path, 'simplecble')
|
37
|
+
unless File.exist?(simpleble_c_path)
|
38
|
+
if File.directory?(simplecble_path)
|
39
|
+
File.symlink('simplecble', simpleble_c_path)
|
40
|
+
puts "Created symlink: simpleble_c -> simplecble"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
lib_path = File.join(vendor_path, 'install_simplecble', 'lib')
|
45
|
+
$LDFLAGS << " #{lib_path}/libsimplecble.a #{lib_path}/libsimpleble.a"
|
46
|
+
|
47
|
+
# SimpleBLE is C++, so we need to link C++ standard library and runtime
|
48
|
+
$LIBS << " -lstdc++ -lm"
|
49
|
+
|
50
|
+
if RUBY_PLATFORM =~ /darwin/
|
51
|
+
$LDFLAGS << " -framework Foundation -framework CoreBluetooth -framework IOBluetooth"
|
52
|
+
else
|
53
|
+
$LIBS << " -ldbus-1 -lpthread"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
create_makefile('simpleble/simpleble')
|