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.
Files changed (341) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +88 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +350 -0
  5. data/ext/simpleble/extconf.rb +57 -0
  6. data/ext/simpleble/simpleble_ruby.c +682 -0
  7. data/lib/simpleble/adapter.rb +10 -0
  8. data/lib/simpleble/characteristic.rb +36 -0
  9. data/lib/simpleble/descriptor.rb +8 -0
  10. data/lib/simpleble/exceptions.rb +25 -0
  11. data/lib/simpleble/peripheral.rb +64 -0
  12. data/lib/simpleble/service.rb +16 -0
  13. data/lib/simpleble/version.rb +3 -0
  14. data/lib/simpleble.rb +40 -0
  15. data/vendor/simpleble/build_simplecble/CMakeFiles/4.0.3/CompilerIdCXX/CMakeCXXCompilerId.cpp +920 -0
  16. data/vendor/simpleble/build_simplecble/CMakeFiles/4.0.3/CompilerIdCXX/apple-sdk.cpp +1 -0
  17. data/vendor/simpleble/build_simplecble/CMakeFiles/4.1.0/CompilerIdCXX/CMakeCXXCompilerId.cpp +949 -0
  18. data/vendor/simpleble/build_simplecble/CMakeFiles/4.1.0/CompilerIdCXX/apple-sdk.cpp +1 -0
  19. data/vendor/simpleble/build_simplecble/export/simplecble/export.h +43 -0
  20. data/vendor/simpleble/build_simplecble/simpleble/export/simpleble/export.h +43 -0
  21. data/vendor/simpleble/dependencies/external/kvn/kvn_bytearray.h +222 -0
  22. data/vendor/simpleble/dependencies/external/kvn/kvn_safe_callback.hpp +66 -0
  23. data/vendor/simpleble/dependencies/external/kvn/logfwd.hpp +35 -0
  24. data/vendor/simpleble/dependencies/internal/fmt/args.h +220 -0
  25. data/vendor/simpleble/dependencies/internal/fmt/base.h +2962 -0
  26. data/vendor/simpleble/dependencies/internal/fmt/chrono.h +2338 -0
  27. data/vendor/simpleble/dependencies/internal/fmt/color.h +610 -0
  28. data/vendor/simpleble/dependencies/internal/fmt/compile.h +539 -0
  29. data/vendor/simpleble/dependencies/internal/fmt/core.h +5 -0
  30. data/vendor/simpleble/dependencies/internal/fmt/format-inl.h +1949 -0
  31. data/vendor/simpleble/dependencies/internal/fmt/format.h +4244 -0
  32. data/vendor/simpleble/dependencies/internal/fmt/os.h +427 -0
  33. data/vendor/simpleble/dependencies/internal/fmt/ostream.h +166 -0
  34. data/vendor/simpleble/dependencies/internal/fmt/printf.h +633 -0
  35. data/vendor/simpleble/dependencies/internal/fmt/ranges.h +850 -0
  36. data/vendor/simpleble/dependencies/internal/fmt/std.h +726 -0
  37. data/vendor/simpleble/dependencies/internal/fmt/xchar.h +373 -0
  38. data/vendor/simpleble/dependencies/internal/simplejni/Common.hpp +579 -0
  39. data/vendor/simpleble/dependencies/internal/simplejni/References.hpp +151 -0
  40. data/vendor/simpleble/dependencies/internal/simplejni/Registry.hpp +183 -0
  41. data/vendor/simpleble/dependencies/internal/simplejni/VM.hpp +88 -0
  42. data/vendor/simpleble/examples/simpleble/src/connect.cpp +67 -0
  43. data/vendor/simpleble/examples/simpleble/src/connect_safe.cpp +91 -0
  44. data/vendor/simpleble/examples/simpleble/src/list_adapters.cpp +22 -0
  45. data/vendor/simpleble/examples/simpleble/src/list_adapters_safe.cpp +33 -0
  46. data/vendor/simpleble/examples/simpleble/src/list_paired.cpp +27 -0
  47. data/vendor/simpleble/examples/simpleble/src/multiconnect.cpp +60 -0
  48. data/vendor/simpleble/examples/simpleble/src/notify.cpp +85 -0
  49. data/vendor/simpleble/examples/simpleble/src/notify_multi.cpp +101 -0
  50. data/vendor/simpleble/examples/simpleble/src/power_cycle.cpp +43 -0
  51. data/vendor/simpleble/examples/simpleble/src/read.cpp +82 -0
  52. data/vendor/simpleble/examples/simpleble/src/scan.cpp +62 -0
  53. data/vendor/simpleble/examples/simpleble/src/utils.cpp +59 -0
  54. data/vendor/simpleble/examples/simpleble/src/utils.hpp +27 -0
  55. data/vendor/simpleble/examples/simpleble/src/write.cpp +81 -0
  56. data/vendor/simpleble/examples/simplebluez/ble_nus/ble_nus.cpp +138 -0
  57. data/vendor/simpleble/examples/simplebluez/connect/connect.cpp +119 -0
  58. data/vendor/simpleble/examples/simplebluez/list_adapters/list_adapters.cpp +44 -0
  59. data/vendor/simpleble/examples/simplebluez/list_paired/list_paired.cpp +48 -0
  60. data/vendor/simpleble/examples/simplebluez/notify/notify.cpp +145 -0
  61. data/vendor/simpleble/examples/simplebluez/pair/pair.cpp +181 -0
  62. data/vendor/simpleble/examples/simplebluez/read/read.cpp +141 -0
  63. data/vendor/simpleble/examples/simplebluez/scan/scan.cpp +85 -0
  64. data/vendor/simpleble/examples/simplecble/c/connect.c +163 -0
  65. data/vendor/simpleble/examples/simplecble/c/notify.c +217 -0
  66. data/vendor/simpleble/examples/simplecble/c/scan.c +164 -0
  67. data/vendor/simpleble/examples/simpledbus/notification.cpp +24 -0
  68. data/vendor/simpleble/hitl/src/test_sanity.cpp +48 -0
  69. data/vendor/simpleble/install_simplecble/include/simpleble/Adapter.h +102 -0
  70. data/vendor/simpleble/install_simplecble/include/simpleble/AdapterSafe.h +58 -0
  71. data/vendor/simpleble/install_simplecble/include/simpleble/Advanced.h +50 -0
  72. data/vendor/simpleble/install_simplecble/include/simpleble/Characteristic.h +39 -0
  73. data/vendor/simpleble/install_simplecble/include/simpleble/Config.h +55 -0
  74. data/vendor/simpleble/install_simplecble/include/simpleble/Descriptor.h +30 -0
  75. data/vendor/simpleble/install_simplecble/include/simpleble/Exceptions.h +72 -0
  76. data/vendor/simpleble/install_simplecble/include/simpleble/Logging.h +73 -0
  77. data/vendor/simpleble/install_simplecble/include/simpleble/Peripheral.h +82 -0
  78. data/vendor/simpleble/install_simplecble/include/simpleble/PeripheralSafe.h +64 -0
  79. data/vendor/simpleble/install_simplecble/include/simpleble/Service.h +34 -0
  80. data/vendor/simpleble/install_simplecble/include/simpleble/SimpleBLE.h +8 -0
  81. data/vendor/simpleble/install_simplecble/include/simpleble/Types.h +49 -0
  82. data/vendor/simpleble/install_simplecble/include/simpleble/Utils.h +13 -0
  83. data/vendor/simpleble/install_simplecble/include/simpleble/export.h +43 -0
  84. data/vendor/simpleble/install_simplecble/include/simpleble/kvn/kvn_bytearray.h +222 -0
  85. data/vendor/simpleble/install_simplecble/include/simplecble/adapter.h +188 -0
  86. data/vendor/simpleble/install_simplecble/include/simplecble/logging.h +37 -0
  87. data/vendor/simpleble/install_simplecble/include/simplecble/peripheral.h +304 -0
  88. data/vendor/simpleble/install_simplecble/include/simplecble/simpleble.h +21 -0
  89. data/vendor/simpleble/install_simplecble/include/simplecble/types.h +73 -0
  90. data/vendor/simpleble/install_simplecble/include/simplecble/utils.h +27 -0
  91. data/vendor/simpleble/simpleble/include/simpleble/Adapter.h +102 -0
  92. data/vendor/simpleble/simpleble/include/simpleble/AdapterSafe.h +58 -0
  93. data/vendor/simpleble/simpleble/include/simpleble/Characteristic.h +39 -0
  94. data/vendor/simpleble/simpleble/include/simpleble/Config.h +55 -0
  95. data/vendor/simpleble/simpleble/include/simpleble/Descriptor.h +30 -0
  96. data/vendor/simpleble/simpleble/include/simpleble/Exceptions.h +72 -0
  97. data/vendor/simpleble/simpleble/include/simpleble/Logging.h +73 -0
  98. data/vendor/simpleble/simpleble/include/simpleble/Peripheral.h +82 -0
  99. data/vendor/simpleble/simpleble/include/simpleble/PeripheralSafe.h +64 -0
  100. data/vendor/simpleble/simpleble/include/simpleble/Service.h +34 -0
  101. data/vendor/simpleble/simpleble/include/simpleble/SimpleBLE.h +8 -0
  102. data/vendor/simpleble/simpleble/include/simpleble/Types.h +49 -0
  103. data/vendor/simpleble/simpleble/include/simpleble/Utils.h +13 -0
  104. data/vendor/simpleble/simpleble/include/simpleble_c/adapter.h +188 -0
  105. data/vendor/simpleble/simpleble/include/simpleble_c/logging.h +37 -0
  106. data/vendor/simpleble/simpleble/include/simpleble_c/peripheral.h +304 -0
  107. data/vendor/simpleble/simpleble/include/simpleble_c/simpleble.h +21 -0
  108. data/vendor/simpleble/simpleble/include/simpleble_c/types.h +73 -0
  109. data/vendor/simpleble/simpleble/include/simpleble_c/utils.h +27 -0
  110. data/vendor/simpleble/simpleble/src/CommonUtils.h +63 -0
  111. data/vendor/simpleble/simpleble/src/Exceptions.cpp +31 -0
  112. data/vendor/simpleble/simpleble/src/Logging.cpp +136 -0
  113. data/vendor/simpleble/simpleble/src/LoggingInternal.h +85 -0
  114. data/vendor/simpleble/simpleble/src/Utils.cpp +24 -0
  115. data/vendor/simpleble/simpleble/src/backends/android/AdapterAndroid.cpp +101 -0
  116. data/vendor/simpleble/simpleble/src/backends/android/AdapterAndroid.h +70 -0
  117. data/vendor/simpleble/simpleble/src/backends/android/BackendAndroid.cpp +40 -0
  118. data/vendor/simpleble/simpleble/src/backends/android/BackendAndroid.h +20 -0
  119. data/vendor/simpleble/simpleble/src/backends/android/PeripheralAndroid.cpp +365 -0
  120. data/vendor/simpleble/simpleble/src/backends/android/PeripheralAndroid.h +90 -0
  121. data/vendor/simpleble/simpleble/src/backends/android/bridge/BluetoothGattCallback.cpp +432 -0
  122. data/vendor/simpleble/simpleble/src/backends/android/bridge/BluetoothGattCallback.h +102 -0
  123. data/vendor/simpleble/simpleble/src/backends/android/bridge/ScanCallback.cpp +142 -0
  124. data/vendor/simpleble/simpleble/src/backends/android/bridge/ScanCallback.h +55 -0
  125. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothAdapter.cpp +107 -0
  126. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothAdapter.h +55 -0
  127. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothDevice.cpp +68 -0
  128. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothDevice.h +54 -0
  129. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGatt.cpp +115 -0
  130. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGatt.h +75 -0
  131. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattCharacteristic.cpp +142 -0
  132. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattCharacteristic.h +66 -0
  133. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattDescriptor.cpp +67 -0
  134. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattDescriptor.h +46 -0
  135. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattService.cpp +106 -0
  136. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/BluetoothGattService.h +47 -0
  137. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.cpp +47 -0
  138. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/BluetoothScanner.h +37 -0
  139. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanRecord.cpp +69 -0
  140. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanRecord.h +41 -0
  141. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanResult.cpp +63 -0
  142. data/vendor/simpleble/simpleble/src/backends/android/types/android/bluetooth/le/ScanResult.h +42 -0
  143. data/vendor/simpleble/simpleble/src/backends/android/types/android/os/ParcelUUID.cpp +32 -0
  144. data/vendor/simpleble/simpleble/src/backends/android/types/android/os/ParcelUUID.h +30 -0
  145. data/vendor/simpleble/simpleble/src/backends/android/types/android/util/SparseArray.cpp +54 -0
  146. data/vendor/simpleble/simpleble/src/backends/android/types/android/util/SparseArray.h +37 -0
  147. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Iterator.cpp +36 -0
  148. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Iterator.h +28 -0
  149. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/List.cpp +29 -0
  150. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/List.h +27 -0
  151. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Set.cpp +33 -0
  152. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/Set.h +28 -0
  153. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/UUID.cpp +26 -0
  154. data/vendor/simpleble/simpleble/src/backends/android/types/java/util/UUID.h +29 -0
  155. data/vendor/simpleble/simpleble/src/backends/common/AdapterBase.cpp +53 -0
  156. data/vendor/simpleble/simpleble/src/backends/common/AdapterBase.h +81 -0
  157. data/vendor/simpleble/simpleble/src/backends/common/AdapterBaseTypes.h +22 -0
  158. data/vendor/simpleble/simpleble/src/backends/common/BackendBase.h +20 -0
  159. data/vendor/simpleble/simpleble/src/backends/common/BackendUtils.h +33 -0
  160. data/vendor/simpleble/simpleble/src/backends/common/CharacteristicBase.cpp +28 -0
  161. data/vendor/simpleble/simpleble/src/backends/common/CharacteristicBase.h +38 -0
  162. data/vendor/simpleble/simpleble/src/backends/common/DescriptorBase.cpp +7 -0
  163. data/vendor/simpleble/simpleble/src/backends/common/DescriptorBase.h +19 -0
  164. data/vendor/simpleble/simpleble/src/backends/common/PeripheralBase.h +82 -0
  165. data/vendor/simpleble/simpleble/src/backends/common/ServiceBase.cpp +18 -0
  166. data/vendor/simpleble/simpleble/src/backends/common/ServiceBase.h +28 -0
  167. data/vendor/simpleble/simpleble/src/backends/linux/AdapterLinux.cpp +102 -0
  168. data/vendor/simpleble/simpleble/src/backends/linux/AdapterLinux.h +55 -0
  169. data/vendor/simpleble/simpleble/src/backends/linux/BackendBluez.cpp +87 -0
  170. data/vendor/simpleble/simpleble/src/backends/linux/PeripheralLinux.cpp +376 -0
  171. data/vendor/simpleble/simpleble/src/backends/linux/PeripheralLinux.h +90 -0
  172. data/vendor/simpleble/simpleble/src/backends/macos/AdapterBaseMacOS.h +29 -0
  173. data/vendor/simpleble/simpleble/src/backends/macos/AdapterMac.h +78 -0
  174. data/vendor/simpleble/simpleble/src/backends/macos/PeripheralBaseMacOS.h +49 -0
  175. data/vendor/simpleble/simpleble/src/backends/macos/PeripheralMac.h +81 -0
  176. data/vendor/simpleble/simpleble/src/backends/macos/Utils.h +9 -0
  177. data/vendor/simpleble/simpleble/src/backends/plain/AdapterPlain.cpp +65 -0
  178. data/vendor/simpleble/simpleble/src/backends/plain/AdapterPlain.h +49 -0
  179. data/vendor/simpleble/simpleble/src/backends/plain/BackendPlain.cpp +30 -0
  180. data/vendor/simpleble/simpleble/src/backends/plain/PeripheralPlain.cpp +159 -0
  181. data/vendor/simpleble/simpleble/src/backends/plain/PeripheralPlain.h +72 -0
  182. data/vendor/simpleble/simpleble/src/backends/windows/AdapterWindows.cpp +330 -0
  183. data/vendor/simpleble/simpleble/src/backends/windows/AdapterWindows.h +89 -0
  184. data/vendor/simpleble/simpleble/src/backends/windows/BackendWinRT.cpp +67 -0
  185. data/vendor/simpleble/simpleble/src/backends/windows/BackendWinRT.h +18 -0
  186. data/vendor/simpleble/simpleble/src/backends/windows/MtaManager.cpp +49 -0
  187. data/vendor/simpleble/simpleble/src/backends/windows/MtaManager.h +90 -0
  188. data/vendor/simpleble/simpleble/src/backends/windows/PeripheralWindows.cpp +487 -0
  189. data/vendor/simpleble/simpleble/src/backends/windows/PeripheralWindows.h +129 -0
  190. data/vendor/simpleble/simpleble/src/backends/windows/Utils.cpp +146 -0
  191. data/vendor/simpleble/simpleble/src/backends/windows/Utils.h +47 -0
  192. data/vendor/simpleble/simpleble/src/builders/BuildVec.h +32 -0
  193. data/vendor/simpleble/simpleble/src/builders/BuilderBase.h +87 -0
  194. data/vendor/simpleble/simpleble/src/external/TaskRunner.hpp +99 -0
  195. data/vendor/simpleble/simpleble/src/external/ThreadRunner.h +52 -0
  196. data/vendor/simpleble/simpleble/src/external/kvn_safe_callback.hpp +66 -0
  197. data/vendor/simpleble/simpleble/src/external/kvn_safe_map.hpp +94 -0
  198. data/vendor/simpleble/simpleble/src/external/kvn_threadrunner.hpp +70 -0
  199. data/vendor/simpleble/simpleble/src/external/logfwd.hpp +35 -0
  200. data/vendor/simpleble/simpleble/src/frontends/base/Adapter.cpp +111 -0
  201. data/vendor/simpleble/simpleble/src/frontends/base/Backend.cpp +83 -0
  202. data/vendor/simpleble/simpleble/src/frontends/base/Backend.h +76 -0
  203. data/vendor/simpleble/simpleble/src/frontends/base/Characteristic.cpp +56 -0
  204. data/vendor/simpleble/simpleble/src/frontends/base/Descriptor.cpp +21 -0
  205. data/vendor/simpleble/simpleble/src/frontends/base/Peripheral.cpp +113 -0
  206. data/vendor/simpleble/simpleble/src/frontends/base/Service.cpp +26 -0
  207. data/vendor/simpleble/simpleble/src/frontends/safe/AdapterSafe.cpp +158 -0
  208. data/vendor/simpleble/simpleble/src/frontends/safe/PeripheralSafe.cpp +219 -0
  209. data/vendor/simpleble/simpleble/src_c/adapter.cpp +204 -0
  210. data/vendor/simpleble/simpleble/src_c/logging.cpp +19 -0
  211. data/vendor/simpleble/simpleble/src_c/peripheral.cpp +444 -0
  212. data/vendor/simpleble/simpleble/src_c/simpleble.cpp +5 -0
  213. data/vendor/simpleble/simpleble/src_c/utils.cpp +15 -0
  214. data/vendor/simpleble/simpleble/test/src/main.cpp +8 -0
  215. data/vendor/simpleble/simpleble/test/src/test_bytearray.cpp +246 -0
  216. data/vendor/simpleble/simpleble/test/src/test_utils.cpp +24 -0
  217. data/vendor/simpleble/simplebluez/include/simplebluez/Adapter.h +46 -0
  218. data/vendor/simpleble/simplebluez/include/simplebluez/Agent.h +52 -0
  219. data/vendor/simpleble/simplebluez/include/simplebluez/Bluez.h +37 -0
  220. data/vendor/simpleble/simplebluez/include/simplebluez/BluezOrg.h +22 -0
  221. data/vendor/simpleble/simplebluez/include/simplebluez/BluezOrgBluez.h +26 -0
  222. data/vendor/simpleble/simplebluez/include/simplebluez/BluezRoot.h +32 -0
  223. data/vendor/simpleble/simplebluez/include/simplebluez/Characteristic.h +46 -0
  224. data/vendor/simpleble/simplebluez/include/simplebluez/Descriptor.h +33 -0
  225. data/vendor/simpleble/simplebluez/include/simplebluez/Device.h +64 -0
  226. data/vendor/simpleble/simplebluez/include/simplebluez/Exceptions.h +43 -0
  227. data/vendor/simpleble/simplebluez/include/simplebluez/Service.h +27 -0
  228. data/vendor/simpleble/simplebluez/include/simplebluez/Types.h +9 -0
  229. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Adapter1.h +49 -0
  230. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Agent1.h +100 -0
  231. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/AgentManager1.h +24 -0
  232. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Battery1.h +32 -0
  233. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/Device1.h +62 -0
  234. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattCharacteristic1.h +48 -0
  235. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattDescriptor1.h +41 -0
  236. data/vendor/simpleble/simplebluez/include/simplebluez/interfaces/GattService1.h +28 -0
  237. data/vendor/simpleble/simplebluez/src/Adapter.cpp +78 -0
  238. data/vendor/simpleble/simplebluez/src/Agent.cpp +72 -0
  239. data/vendor/simpleble/simplebluez/src/Bluez.cpp +45 -0
  240. data/vendor/simpleble/simplebluez/src/BluezOrg.cpp +20 -0
  241. data/vendor/simpleble/simplebluez/src/BluezOrgBluez.cpp +23 -0
  242. data/vendor/simpleble/simplebluez/src/BluezRoot.cpp +44 -0
  243. data/vendor/simpleble/simplebluez/src/Characteristic.cpp +64 -0
  244. data/vendor/simpleble/simplebluez/src/Descriptor.cpp +27 -0
  245. data/vendor/simpleble/simplebluez/src/Device.cpp +104 -0
  246. data/vendor/simpleble/simplebluez/src/Exceptions.cpp +29 -0
  247. data/vendor/simpleble/simplebluez/src/Logging.cpp +52 -0
  248. data/vendor/simpleble/simplebluez/src/Logging.h +57 -0
  249. data/vendor/simpleble/simplebluez/src/Service.cpp +33 -0
  250. data/vendor/simpleble/simplebluez/src/interfaces/Adapter1.cpp +123 -0
  251. data/vendor/simpleble/simplebluez/src/interfaces/Agent1.cpp +143 -0
  252. data/vendor/simpleble/simplebluez/src/interfaces/AgentManager1.cpp +34 -0
  253. data/vendor/simpleble/simplebluez/src/interfaces/Battery1.cpp +30 -0
  254. data/vendor/simpleble/simplebluez/src/interfaces/Device1.cpp +170 -0
  255. data/vendor/simpleble/simplebluez/src/interfaces/GattCharacteristic1.cpp +118 -0
  256. data/vendor/simpleble/simplebluez/src/interfaces/GattDescriptor1.cpp +78 -0
  257. data/vendor/simpleble/simplebluez/src/interfaces/GattService1.cpp +28 -0
  258. data/vendor/simpleble/simplebluez/test/src/helpers/PythonRunner.cpp +53 -0
  259. data/vendor/simpleble/simplebluez/test/src/helpers/PythonRunner.h +24 -0
  260. data/vendor/simpleble/simplebluez/test/src/main.cpp +16 -0
  261. data/vendor/simpleble/simplecble/include/simplecble/adapter.h +188 -0
  262. data/vendor/simpleble/simplecble/include/simplecble/logging.h +37 -0
  263. data/vendor/simpleble/simplecble/include/simplecble/peripheral.h +304 -0
  264. data/vendor/simpleble/simplecble/include/simplecble/simpleble.h +21 -0
  265. data/vendor/simpleble/simplecble/include/simplecble/types.h +73 -0
  266. data/vendor/simpleble/simplecble/include/simplecble/utils.h +27 -0
  267. data/vendor/simpleble/simplecble/src/adapter.cpp +204 -0
  268. data/vendor/simpleble/simplecble/src/logging.cpp +19 -0
  269. data/vendor/simpleble/simplecble/src/peripheral.cpp +444 -0
  270. data/vendor/simpleble/simplecble/src/simpleble.cpp +5 -0
  271. data/vendor/simpleble/simplecble/src/utils.cpp +15 -0
  272. data/vendor/simpleble/simpledbus/include/simpledbus/advanced/Interface.h +67 -0
  273. data/vendor/simpleble/simpledbus/include/simpledbus/advanced/InterfaceRegistry.h +64 -0
  274. data/vendor/simpleble/simpledbus/include/simpledbus/advanced/Proxy.h +117 -0
  275. data/vendor/simpleble/simpledbus/include/simpledbus/base/Connection.h +50 -0
  276. data/vendor/simpleble/simpledbus/include/simpledbus/base/Exceptions.h +56 -0
  277. data/vendor/simpleble/simpledbus/include/simpledbus/base/Holder.h +147 -0
  278. data/vendor/simpleble/simpledbus/include/simpledbus/base/Logging.h +57 -0
  279. data/vendor/simpleble/simpledbus/include/simpledbus/base/Message.h +89 -0
  280. data/vendor/simpleble/simpledbus/include/simpledbus/base/Path.h +24 -0
  281. data/vendor/simpleble/simpledbus/include/simpledbus/interfaces/ObjectManager.h +26 -0
  282. data/vendor/simpleble/simpledbus/src/advanced/Interface.cpp +155 -0
  283. data/vendor/simpleble/simpledbus/src/advanced/Proxy.cpp +375 -0
  284. data/vendor/simpleble/simpledbus/src/base/Connection.cpp +222 -0
  285. data/vendor/simpleble/simpledbus/src/base/Exceptions.cpp +39 -0
  286. data/vendor/simpleble/simpledbus/src/base/Holder.cpp +739 -0
  287. data/vendor/simpleble/simpledbus/src/base/Logging.cpp +52 -0
  288. data/vendor/simpleble/simpledbus/src/base/Message.cpp +622 -0
  289. data/vendor/simpleble/simpledbus/src/base/Path.cpp +129 -0
  290. data/vendor/simpleble/simpledbus/src/interfaces/ObjectManager.cpp +58 -0
  291. data/vendor/simpleble/simpledbus/test/src/helpers/PythonRunner.cpp +53 -0
  292. data/vendor/simpleble/simpledbus/test/src/helpers/PythonRunner.h +24 -0
  293. data/vendor/simpleble/simpledbus/test/src/main.cpp +16 -0
  294. data/vendor/simpleble/simpledbus/test/src/test_holder.cpp +184 -0
  295. data/vendor/simpleble/simpledbus/test/src/test_message.cpp +397 -0
  296. data/vendor/simpleble/simpledbus/test/src/test_path.cpp +76 -0
  297. data/vendor/simpleble/simpledbus/test/src/test_proxy_children.cpp +109 -0
  298. data/vendor/simpleble/simpledbus/test/src/test_proxy_interfaces.cpp +102 -0
  299. data/vendor/simpleble/simpledbus/test/src/test_proxy_lifetime.cpp +18 -0
  300. data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/ThreadRunner.h +89 -0
  301. data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/android_utils.cpp +55 -0
  302. data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/android_utils.h +18 -0
  303. data/vendor/simpleble/simpledroidble/simpledroidble/src/main/cpp/simpleble_android.cpp +813 -0
  304. data/vendor/simpleble/simplejavable/cpp/src/core/AdapterWrapper.cpp +37 -0
  305. data/vendor/simpleble/simplejavable/cpp/src/core/AdapterWrapper.h +23 -0
  306. data/vendor/simpleble/simplejavable/cpp/src/core/Cache.cpp +58 -0
  307. data/vendor/simpleble/simplejavable/cpp/src/core/Cache.h +34 -0
  308. data/vendor/simpleble/simplejavable/cpp/src/core/PeripheralWrapper.cpp +17 -0
  309. data/vendor/simpleble/simplejavable/cpp/src/core/PeripheralWrapper.h +19 -0
  310. data/vendor/simpleble/simplejavable/cpp/src/java/lang/ArrayList.cpp +257 -0
  311. data/vendor/simpleble/simplejavable/cpp/src/java/lang/ArrayList.h +78 -0
  312. data/vendor/simpleble/simplejavable/cpp/src/java/lang/HashMap.cpp +96 -0
  313. data/vendor/simpleble/simplejavable/cpp/src/java/lang/HashMap.h +54 -0
  314. data/vendor/simpleble/simplejavable/cpp/src/java/lang/Integer.cpp +93 -0
  315. data/vendor/simpleble/simplejavable/cpp/src/java/lang/Integer.h +49 -0
  316. data/vendor/simpleble/simplejavable/cpp/src/java/lang/Iterator.cpp +85 -0
  317. data/vendor/simpleble/simplejavable/cpp/src/java/lang/Iterator.h +48 -0
  318. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/AdapterCallback.cpp +91 -0
  319. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/AdapterCallback.h +90 -0
  320. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Characteristic.cpp +35 -0
  321. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Characteristic.h +60 -0
  322. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/DataCallback.cpp +33 -0
  323. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/DataCallback.h +45 -0
  324. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Descriptor.cpp +30 -0
  325. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Descriptor.h +49 -0
  326. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/PeripheralCallback.cpp +41 -0
  327. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/PeripheralCallback.h +51 -0
  328. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Service.cpp +33 -0
  329. data/vendor/simpleble/simplejavable/cpp/src/org/simplejavable/Service.h +54 -0
  330. data/vendor/simpleble/simplejavable/cpp/src/simplejavable.cpp +361 -0
  331. data/vendor/simpleble/simplepyble/src/main.cpp +55 -0
  332. data/vendor/simpleble/simplepyble/src/wrap_adapter.cpp +106 -0
  333. data/vendor/simpleble/simplepyble/src/wrap_characteristic.cpp +56 -0
  334. data/vendor/simpleble/simplepyble/src/wrap_config.cpp +136 -0
  335. data/vendor/simpleble/simplepyble/src/wrap_descriptor.cpp +21 -0
  336. data/vendor/simpleble/simplepyble/src/wrap_peripheral.cpp +217 -0
  337. data/vendor/simpleble/simplepyble/src/wrap_service.cpp +32 -0
  338. data/vendor/simpleble/simplepyble/src/wrap_types.cpp +21 -0
  339. data/vendor/simpleble/simplersble/src/bindings/Bindings.cpp +338 -0
  340. data/vendor/simpleble/simplersble/src/bindings/Bindings.hpp +178 -0
  341. metadata +430 -0
@@ -0,0 +1,16 @@
1
+
2
+ #include <gtest/gtest.h>
3
+ #include "helpers/PythonRunner.h"
4
+
5
+ int main(int argc, char** argv) {
6
+ PythonRunner runner("test_fixture.py");
7
+
8
+ runner.init();
9
+
10
+ ::testing::InitGoogleTest(&argc, argv);
11
+ auto test_result = RUN_ALL_TESTS();
12
+
13
+ runner.uninit();
14
+
15
+ return test_result;
16
+ }
@@ -0,0 +1,188 @@
1
+ #pragma once
2
+
3
+ #include <stdbool.h>
4
+ #include <stddef.h>
5
+ #include <stdint.h>
6
+
7
+ #include <simpleble/export.h>
8
+
9
+ #include <simpleble_c/types.h>
10
+
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ /**
16
+ * @brief
17
+ *
18
+ * @return bool
19
+ */
20
+ SIMPLEBLE_EXPORT bool simpleble_adapter_is_bluetooth_enabled(void);
21
+
22
+ /**
23
+ * @brief
24
+ *
25
+ * @return size_t
26
+ */
27
+ SIMPLEBLE_EXPORT size_t simpleble_adapter_get_count(void);
28
+
29
+ /**
30
+ * @brief
31
+ *
32
+ * @note The user is responsible for freeing the returned adapter object
33
+ * by calling `simpleble_adapter_release_handle`.
34
+ *
35
+ * @param index
36
+ * @return simpleble_adapter_t
37
+ */
38
+ SIMPLEBLE_EXPORT simpleble_adapter_t simpleble_adapter_get_handle(size_t index);
39
+
40
+ /**
41
+ * @brief Releases all memory and resources consumed by the specific
42
+ * instance of simpleble_adapter_t.
43
+ *
44
+ * @param handle
45
+ */
46
+ SIMPLEBLE_EXPORT void simpleble_adapter_release_handle(simpleble_adapter_t handle);
47
+
48
+ /**
49
+ * @brief Returns the identifier of a given adapter.
50
+ *
51
+ * @note The user is responsible for freeing the returned value.
52
+ *
53
+ * @param handle
54
+ * @return char*
55
+ */
56
+ SIMPLEBLE_EXPORT char* simpleble_adapter_identifier(simpleble_adapter_t handle);
57
+
58
+ /**
59
+ * @brief Returns the MAC address of a given adapter.
60
+ *
61
+ * @note The user is responsible for freeing the returned value.
62
+ *
63
+ * @param handle
64
+ * @return char*
65
+ */
66
+ SIMPLEBLE_EXPORT char* simpleble_adapter_address(simpleble_adapter_t handle);
67
+
68
+ /**
69
+ * @brief
70
+ *
71
+ * @param handle
72
+ * @return simpleble_err_t
73
+ */
74
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_scan_start(simpleble_adapter_t handle);
75
+
76
+ /**
77
+ * @brief
78
+ *
79
+ * @param handle
80
+ * @return simpleble_err_t
81
+ */
82
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_scan_stop(simpleble_adapter_t handle);
83
+
84
+ /**
85
+ * @brief
86
+ *
87
+ * @param handle
88
+ * @param active
89
+ * @return simpleble_err_t
90
+ */
91
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_scan_is_active(simpleble_adapter_t handle, bool* active);
92
+
93
+ /**
94
+ * @brief
95
+ *
96
+ * @param handle
97
+ * @param timeout_ms
98
+ * @return simpleble_err_t
99
+ */
100
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_scan_for(simpleble_adapter_t handle, int timeout_ms);
101
+
102
+ /**
103
+ * @brief
104
+ *
105
+ * @param handle
106
+ * @return size_t
107
+ */
108
+ SIMPLEBLE_EXPORT size_t simpleble_adapter_scan_get_results_count(simpleble_adapter_t handle);
109
+
110
+ /**
111
+ * @brief
112
+ *
113
+ * @note The user is responsible for freeing the returned peripheral object
114
+ * by calling `simpleble_peripheral_release_handle`.
115
+ *
116
+ * @param handle
117
+ * @param index
118
+ * @return simpleble_peripheral_t
119
+ */
120
+ SIMPLEBLE_EXPORT simpleble_peripheral_t simpleble_adapter_scan_get_results_handle(simpleble_adapter_t handle,
121
+ size_t index);
122
+
123
+ /**
124
+ * @brief
125
+ *
126
+ * @param handle
127
+ * @return size_t
128
+ */
129
+ SIMPLEBLE_EXPORT size_t simpleble_adapter_get_paired_peripherals_count(simpleble_adapter_t handle);
130
+
131
+ /**
132
+ * @brief
133
+ *
134
+ * @note The user is responsible for freeing the returned peripheral object
135
+ * by calling `simpleble_peripheral_release_handle`.
136
+ *
137
+ * @param handle
138
+ * @param index
139
+ * @return simpleble_peripheral_t
140
+ */
141
+ SIMPLEBLE_EXPORT simpleble_peripheral_t simpleble_adapter_get_paired_peripherals_handle(simpleble_adapter_t handle,
142
+ size_t index);
143
+
144
+ /**
145
+ * @brief
146
+ *
147
+ * @param handle
148
+ * @param callback
149
+ * @return simpleble_err_t
150
+ */
151
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_set_callback_on_scan_start(
152
+ simpleble_adapter_t handle, void (*callback)(simpleble_adapter_t adapter, void* userdata), void* userdata);
153
+
154
+ /**
155
+ * @brief
156
+ *
157
+ * @param handle
158
+ * @param callback
159
+ * @return simpleble_err_t
160
+ */
161
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_set_callback_on_scan_stop(
162
+ simpleble_adapter_t handle, void (*callback)(simpleble_adapter_t adapter, void* userdata), void* userdata);
163
+
164
+ /**
165
+ * @brief
166
+ *
167
+ * @param handle
168
+ * @param callback
169
+ * @return simpleble_err_t
170
+ */
171
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_set_callback_on_scan_updated(
172
+ simpleble_adapter_t handle,
173
+ void (*callback)(simpleble_adapter_t adapter, simpleble_peripheral_t peripheral, void* userdata), void* userdata);
174
+
175
+ /**
176
+ * @brief
177
+ *
178
+ * @param handle
179
+ * @param callback
180
+ * @return simpleble_err_t
181
+ */
182
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_adapter_set_callback_on_scan_found(
183
+ simpleble_adapter_t handle,
184
+ void (*callback)(simpleble_adapter_t adapter, simpleble_peripheral_t peripheral, void* userdata), void* userdata);
185
+
186
+ #ifdef __cplusplus
187
+ }
188
+ #endif
@@ -0,0 +1,37 @@
1
+ #pragma once
2
+
3
+ #include <stdint.h>
4
+
5
+ #include <simpleble/export.h>
6
+
7
+ typedef enum {
8
+ SIMPLEBLE_LOG_LEVEL_NONE = 0,
9
+ SIMPLEBLE_LOG_LEVEL_FATAL,
10
+ SIMPLEBLE_LOG_LEVEL_ERROR,
11
+ SIMPLEBLE_LOG_LEVEL_WARN,
12
+ SIMPLEBLE_LOG_LEVEL_INFO,
13
+ SIMPLEBLE_LOG_LEVEL_DEBUG,
14
+ SIMPLEBLE_LOG_LEVEL_VERBOSE
15
+ } simpleble_log_level_t;
16
+
17
+ // clang-format off
18
+ typedef void (*simpleble_log_callback_t)(
19
+ simpleble_log_level_t level,
20
+ const char* module,
21
+ const char* file,
22
+ uint32_t line,
23
+ const char* function,
24
+ const char* message
25
+ );
26
+ // clang-format on
27
+
28
+ #ifdef __cplusplus
29
+ extern "C" {
30
+ #endif
31
+
32
+ SIMPLEBLE_EXPORT void simpleble_logging_set_level(simpleble_log_level_t level);
33
+ SIMPLEBLE_EXPORT void simpleble_logging_set_callback(simpleble_log_callback_t callback);
34
+
35
+ #ifdef __cplusplus
36
+ }
37
+ #endif
@@ -0,0 +1,304 @@
1
+ #pragma once
2
+
3
+ #include <stdbool.h>
4
+ #include <stddef.h>
5
+ #include <stdint.h>
6
+
7
+ #include <simpleble/export.h>
8
+
9
+ #include <simpleble_c/types.h>
10
+
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ /**
16
+ * @brief Releases all memory and resources consumed by the specific
17
+ * instance of simpleble_peripheral_t.
18
+ *
19
+ * @param handle
20
+ */
21
+ SIMPLEBLE_EXPORT void simpleble_peripheral_release_handle(simpleble_peripheral_t handle);
22
+
23
+ /**
24
+ * @brief
25
+ *
26
+ * @param handle
27
+ * @return char*
28
+ */
29
+ SIMPLEBLE_EXPORT char* simpleble_peripheral_identifier(simpleble_peripheral_t handle);
30
+
31
+ /**
32
+ * @brief
33
+ *
34
+ * @param handle
35
+ * @return char*
36
+ */
37
+ SIMPLEBLE_EXPORT char* simpleble_peripheral_address(simpleble_peripheral_t handle);
38
+
39
+ /**
40
+ * @brief
41
+ *
42
+ * @param handle
43
+ * @return simpleble_address_type_t
44
+ */
45
+ SIMPLEBLE_EXPORT simpleble_address_type_t simpleble_peripheral_address_type(simpleble_peripheral_t handle);
46
+
47
+ /**
48
+ * @brief
49
+ *
50
+ * @param handle
51
+ * @return int16_t
52
+ */
53
+ SIMPLEBLE_EXPORT int16_t simpleble_peripheral_rssi(simpleble_peripheral_t handle);
54
+
55
+ /**
56
+ * @brief
57
+ *
58
+ * @param handle
59
+ * @return int16_t
60
+ */
61
+ SIMPLEBLE_EXPORT int16_t simpleble_peripheral_tx_power(simpleble_peripheral_t handle);
62
+
63
+ /**
64
+ * @brief
65
+ *
66
+ * @param handle
67
+ * @return uint16_t
68
+ */
69
+ SIMPLEBLE_EXPORT uint16_t simpleble_peripheral_mtu(simpleble_peripheral_t handle);
70
+
71
+ /**
72
+ * @brief
73
+ *
74
+ * @param handle
75
+ * @return simpleble_err_t
76
+ */
77
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_connect(simpleble_peripheral_t handle);
78
+
79
+ /**
80
+ * @brief
81
+ *
82
+ * @param handle
83
+ * @return simpleble_err_t
84
+ */
85
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_disconnect(simpleble_peripheral_t handle);
86
+
87
+ /**
88
+ * @brief
89
+ *
90
+ * @param handle
91
+ * @param connected
92
+ * @return simpleble_err_t
93
+ */
94
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_is_connected(simpleble_peripheral_t handle, bool* connected);
95
+
96
+ /**
97
+ * @brief
98
+ *
99
+ * @param handle
100
+ * @param connectable
101
+ * @return simpleble_err_t
102
+ */
103
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_is_connectable(simpleble_peripheral_t handle, bool* connectable);
104
+
105
+ /**
106
+ * @brief
107
+ *
108
+ * @param handle
109
+ * @param paired
110
+ * @return simpleble_err_t
111
+ */
112
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_is_paired(simpleble_peripheral_t handle, bool* paired);
113
+
114
+ /**
115
+ * @brief
116
+ *
117
+ * @param handle
118
+ * @return simpleble_err_t
119
+ */
120
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_unpair(simpleble_peripheral_t handle);
121
+
122
+ /**
123
+ * @brief
124
+ *
125
+ * @param handle
126
+ * @return size_t
127
+ */
128
+ SIMPLEBLE_EXPORT size_t simpleble_peripheral_services_count(simpleble_peripheral_t handle);
129
+
130
+ /**
131
+ * @brief
132
+ *
133
+ * @param handle
134
+ * @param index
135
+ * @param services
136
+ * @return simpleble_err_t
137
+ */
138
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_services_get(simpleble_peripheral_t handle, size_t index,
139
+ simpleble_service_t* services);
140
+
141
+ /**
142
+ * @brief
143
+ *
144
+ * @param handle
145
+ * @return size_t
146
+ */
147
+ SIMPLEBLE_EXPORT size_t simpleble_peripheral_manufacturer_data_count(simpleble_peripheral_t handle);
148
+
149
+ /**
150
+ * @brief
151
+ *
152
+ * @param handle
153
+ * @param index
154
+ * @param manufacturer_data
155
+ * @return simpleble_err_t
156
+ */
157
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_manufacturer_data_get(
158
+ simpleble_peripheral_t handle, size_t index, simpleble_manufacturer_data_t* manufacturer_data);
159
+
160
+ /**
161
+ * @brief
162
+ *
163
+ * @note The user is responsible for freeing the pointer returned in data.
164
+ *
165
+ * @param handle
166
+ * @param service
167
+ * @param characteristic
168
+ * @param data
169
+ * @param data_length
170
+ * @return simpleble_err_t
171
+ */
172
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_read(simpleble_peripheral_t handle, simpleble_uuid_t service,
173
+ simpleble_uuid_t characteristic, uint8_t** data,
174
+ size_t* data_length);
175
+
176
+ /**
177
+ * @brief
178
+ *
179
+ * @param handle
180
+ * @param service
181
+ * @param characteristic
182
+ * @param data
183
+ * @param data_length
184
+ * @return simpleble_err_t
185
+ */
186
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_write_request(simpleble_peripheral_t handle,
187
+ simpleble_uuid_t service,
188
+ simpleble_uuid_t characteristic,
189
+ const uint8_t* data, size_t data_length);
190
+
191
+ /**
192
+ * @brief
193
+ *
194
+ * @param handle
195
+ * @param service
196
+ * @param characteristic
197
+ * @param data
198
+ * @param data_length
199
+ * @return simpleble_err_t
200
+ */
201
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_write_command(simpleble_peripheral_t handle,
202
+ simpleble_uuid_t service,
203
+ simpleble_uuid_t characteristic,
204
+ const uint8_t* data, size_t data_length);
205
+
206
+ /**
207
+ * @brief
208
+ *
209
+ * @param handle
210
+ * @param service
211
+ * @param characteristic
212
+ * @param callback
213
+ * @return simpleble_err_t
214
+ */
215
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_notify(
216
+ simpleble_peripheral_t handle, simpleble_uuid_t service, simpleble_uuid_t characteristic,
217
+ void (*callback)(simpleble_peripheral_t handle, simpleble_uuid_t service, simpleble_uuid_t characteristic,
218
+ const uint8_t* data, size_t data_length, void* userdata),
219
+ void* userdata);
220
+
221
+ /**
222
+ * @brief
223
+ *
224
+ * @param handle
225
+ * @param service
226
+ * @param characteristic
227
+ * @param callback
228
+ * @return simpleble_err_t
229
+ */
230
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_indicate(
231
+ simpleble_peripheral_t handle, simpleble_uuid_t service, simpleble_uuid_t characteristic,
232
+ void (*callback)(simpleble_peripheral_t handle, simpleble_uuid_t service, simpleble_uuid_t characteristic,
233
+ const uint8_t* data, size_t data_length, void* userdata),
234
+ void* userdata);
235
+
236
+ /**
237
+ * @brief
238
+ *
239
+ * @param handle
240
+ * @param service
241
+ * @param characteristic
242
+ * @return simpleble_err_t
243
+ */
244
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_unsubscribe(simpleble_peripheral_t handle,
245
+ simpleble_uuid_t service,
246
+ simpleble_uuid_t characteristic);
247
+
248
+ /**
249
+ * @brief
250
+ *
251
+ * @param handle
252
+ * @param service
253
+ * @param characteristic
254
+ * @param descriptor
255
+ * @param data
256
+ * @param data_length
257
+ * @return simpleble_err_t
258
+ */
259
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_read_descriptor(simpleble_peripheral_t handle,
260
+ simpleble_uuid_t service,
261
+ simpleble_uuid_t characteristic,
262
+ simpleble_uuid_t descriptor, uint8_t** data,
263
+ size_t* data_length);
264
+
265
+ /**
266
+ * @brief
267
+ *
268
+ * @param handle
269
+ * @param service
270
+ * @param characteristic
271
+ * @param descriptor
272
+ * @param data
273
+ * @param data_length
274
+ * @return simpleble_err_t
275
+ */
276
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_write_descriptor(simpleble_peripheral_t handle,
277
+ simpleble_uuid_t service,
278
+ simpleble_uuid_t characteristic,
279
+ simpleble_uuid_t descriptor, const uint8_t* data,
280
+ size_t data_length);
281
+
282
+ /**
283
+ * @brief
284
+ *
285
+ * @param handle
286
+ * @param callback
287
+ * @return simpleble_err_t
288
+ */
289
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_set_callback_on_connected(
290
+ simpleble_peripheral_t handle, void (*callback)(simpleble_peripheral_t peripheral, void* userdata), void* userdata);
291
+
292
+ /**
293
+ * @brief
294
+ *
295
+ * @param handle
296
+ * @param callback
297
+ * @return simpleble_err_t
298
+ */
299
+ SIMPLEBLE_EXPORT simpleble_err_t simpleble_peripheral_set_callback_on_disconnected(
300
+ simpleble_peripheral_t handle, void (*callback)(simpleble_peripheral_t peripheral, void* userdata), void* userdata);
301
+
302
+ #ifdef __cplusplus
303
+ }
304
+ #endif
@@ -0,0 +1,21 @@
1
+ #pragma once
2
+
3
+ #include <simpleble/export.h>
4
+ #include <simpleble_c/adapter.h>
5
+ #include <simpleble_c/peripheral.h>
6
+
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+
11
+ /**
12
+ * @brief Wrapper around free() to allow memory to be cleared
13
+ * within the library.
14
+ *
15
+ * @param handle
16
+ */
17
+ SIMPLEBLE_EXPORT void simpleble_free(void* handle);
18
+
19
+ #ifdef __cplusplus
20
+ }
21
+ #endif
@@ -0,0 +1,73 @@
1
+ #pragma once
2
+
3
+ #include <stdbool.h>
4
+ #include <stddef.h>
5
+ #include <stdint.h>
6
+
7
+ #define SIMPLEBLE_UUID_STR_LEN 37 // 36 characters + null terminator
8
+ #define SIMPLEBLE_CHARACTERISTIC_MAX_COUNT 16
9
+ #define SIMPLEBLE_DESCRIPTOR_MAX_COUNT 16
10
+
11
+ // TODO: Add proper error codes.
12
+ typedef enum {
13
+ SIMPLEBLE_SUCCESS = 0,
14
+ SIMPLEBLE_FAILURE = 1,
15
+ } simpleble_err_t;
16
+
17
+ typedef struct {
18
+ char value[SIMPLEBLE_UUID_STR_LEN];
19
+ } simpleble_uuid_t;
20
+
21
+ typedef struct {
22
+ simpleble_uuid_t uuid;
23
+ } simpleble_descriptor_t;
24
+
25
+ typedef struct {
26
+ simpleble_uuid_t uuid;
27
+ bool can_read;
28
+ bool can_write_request;
29
+ bool can_write_command;
30
+ bool can_notify;
31
+ bool can_indicate;
32
+ size_t descriptor_count;
33
+ simpleble_descriptor_t descriptors[SIMPLEBLE_DESCRIPTOR_MAX_COUNT];
34
+ } simpleble_characteristic_t;
35
+
36
+ typedef struct {
37
+ simpleble_uuid_t uuid;
38
+ size_t data_length;
39
+ uint8_t data[27];
40
+ // Note: The maximum length of a BLE advertisement is 31 bytes.
41
+ // The first byte will be the length of the field,
42
+ // the second byte will be the type of the field,
43
+ // the next two bytes will be the service UUID,
44
+ // and the remaining 27 bytes are the manufacturer data.
45
+ size_t characteristic_count;
46
+ simpleble_characteristic_t characteristics[SIMPLEBLE_CHARACTERISTIC_MAX_COUNT];
47
+ } simpleble_service_t;
48
+
49
+ typedef struct {
50
+ uint16_t manufacturer_id;
51
+ size_t data_length;
52
+ uint8_t data[27];
53
+ // Note: The maximum length of a BLE advertisement is 31 bytes.
54
+ // The first byte will be the length of the field,
55
+ // the second byte will be the type of the field (0xFF for manufacturer data),
56
+ // the next two bytes will be the manufacturer ID,
57
+ // and the remaining 27 bytes are the manufacturer data.
58
+ } simpleble_manufacturer_data_t;
59
+
60
+ typedef void* simpleble_adapter_t;
61
+ typedef void* simpleble_peripheral_t;
62
+
63
+ typedef enum {
64
+ SIMPLEBLE_OS_WINDOWS = 0,
65
+ SIMPLEBLE_OS_MACOS = 1,
66
+ SIMPLEBLE_OS_LINUX = 2,
67
+ } simpleble_os_t;
68
+
69
+ typedef enum {
70
+ SIMPLEBLE_ADDRESS_TYPE_PUBLIC = 0,
71
+ SIMPLEBLE_ADDRESS_TYPE_RANDOM = 1,
72
+ SIMPLEBLE_ADDRESS_TYPE_UNSPECIFIED = 2,
73
+ } simpleble_address_type_t;
@@ -0,0 +1,27 @@
1
+ #pragma once
2
+
3
+ #include <simpleble/export.h>
4
+
5
+ #include <simpleble_c/types.h>
6
+
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+
11
+ /**
12
+ * Returns the operating system on which SimpleBLE library is currently running.
13
+ *
14
+ * @return A simpleble_os_t value representing the current operating system.
15
+ */
16
+ SIMPLEBLE_EXPORT simpleble_os_t simpleble_get_operating_system(void);
17
+
18
+ /**
19
+ * Returns a string representing the version of the SimpleBLE library.
20
+ *
21
+ * @return A const char pointer to the version string.
22
+ */
23
+ SIMPLEBLE_EXPORT const char* simpleble_get_version(void);
24
+
25
+ #ifdef __cplusplus
26
+ }
27
+ #endif