Skip to content

Commit

Permalink
bump simpleble version to v0.3.0 (#435)
Browse files Browse the repository at this point in the history
* bump simpleble version to v0.3.0

Signed-off-by: Andrey Parfenov <[email protected]>

* update simpleble

Signed-off-by: Andrey Parfenov <[email protected]>

* update simpleble to latest main

Signed-off-by: Andrey Parfenov <[email protected]>

* update simplebluez

Signed-off-by: Andrey Parfenov <[email protected]>
  • Loading branch information
Andrey1994 authored May 16, 2022
1 parent ecb7fb4 commit 1cf8c56
Show file tree
Hide file tree
Showing 126 changed files with 2,927 additions and 618 deletions.
2 changes: 1 addition & 1 deletion src/board_controller/brainalive/brainalive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ int BrainAlive::config_board (std::string config)
command[2] = 0x00;
command[3] = 0x00;
command[4] = 0x0d;
if (simpleble_peripheral_write_request (brainalive_peripheral, write_characteristics.first,
if (simpleble_peripheral_write_command (brainalive_peripheral, write_characteristics.first,
write_characteristics.second, command, sizeof (command)) != SIMPLEBLE_SUCCESS)
{
safe_logger (spdlog::level::err, "failed to send command {} to device", config.c_str ());
Expand Down
4 changes: 2 additions & 2 deletions src/board_controller/muse/muse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int Muse::prepare_session ()
}
if (params.timeout < 1)
{
params.timeout = 5;
params.timeout = 6;
}
safe_logger (spdlog::level::info, "Use timeout for discovery: {}", params.timeout);
if (!init_dll_loader ())
Expand Down Expand Up @@ -501,7 +501,7 @@ int Muse::config_board (std::string config)
command[i + 1] = uint8_t (config[i]);
}
command[len + 1] = 10;
if (simpleble_peripheral_write_request (muse_peripheral, control_characteristics.first,
if (simpleble_peripheral_write_command (muse_peripheral, control_characteristics.first,
control_characteristics.second, command, len + 2) != SIMPLEBLE_SUCCESS)
{
safe_logger (spdlog::level::err, "failed to send command {} to device", config.c_str ());
Expand Down
47 changes: 31 additions & 16 deletions third_party/SimpleBLE/.github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,54 @@ jobs:
max-parallel: 4
matrix:
os: [windows-2019]
# For windows-2022, the generator is for "Visual Studio 17 2022"

steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Compile Lib for Windows x86 - Windows SDK 10.0.19041.0
run: |
mkdir %GITHUB_WORKSPACE%\build32_19041
cd %GITHUB_WORKSPACE%\build32_19041
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 ..
cmake --build . --config Release --parallel 4
shell: cmd
- name: Compile Lib for Windows x64 - Windows SDK 10.0.19041.0
run: |
mkdir %GITHUB_WORKSPACE%\build64_19041
cd %GITHUB_WORKSPACE%\build64_19041
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.19401.0 ..
cmake --build . --config Release --parallel 4
shell: cmd
- name: Compile Lib for Windows x86
run: |
mkdir %GITHUB_WORKSPACE%\build32
cd %GITHUB_WORKSPACE%\build32
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 ..
cmake --build . --config Release -j 2 --parallel 2
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.22000.0 ..
cmake --build . --config Release --parallel 4
shell: cmd
- name: Compile Lib for Windows x64
run: |
mkdir %GITHUB_WORKSPACE%\build64
cd %GITHUB_WORKSPACE%\build64
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 ..
cmake --build . --config Release -j 2 --parallel 2
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.22000.0 ..
cmake --build . --config Release --parallel 4
shell: cmd
- name: Compile Examples for Windows x86
run: |
mkdir %GITHUB_WORKSPACE%\build32examples
cd %GITHUB_WORKSPACE%\build32examples
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 ../examples
cmake --build . --config Release -j 2 --parallel 2
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.22000.0 ../examples
cmake --build . --config Release --parallel 4
shell: cmd
- name: Compile Examples for Windows x64
run: |
mkdir %GITHUB_WORKSPACE%\build64examples
cd %GITHUB_WORKSPACE%\build64examples
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.19041.0 ../examples
cmake --build . --config Release -j 2 --parallel 2
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.22000.0 ../examples
cmake --build . --config Release --parallel 4
shell: cmd

# ------------------------------------------------------------
Expand All @@ -71,25 +86,25 @@ jobs:
mkdir $GITHUB_WORKSPACE/build_arm64
cd $GITHUB_WORKSPACE/build_arm64
cmake -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ..
make -j2
cmake --build . --config Release --parallel 4
- name: Compile Examples for MacOS arm64
run: |
mkdir $GITHUB_WORKSPACE/build_examples_arm64
cd $GITHUB_WORKSPACE/build_examples_arm64
cmake -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ../examples
make -j2
cmake --build . --config Release --parallel 4
- name: Compile Lib for MacOS x86
run: |
mkdir $GITHUB_WORKSPACE/build_x86
cd $GITHUB_WORKSPACE/build_x86
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ..
make -j2
cmake --build . --config Release --parallel 4
- name: Compile Examples for MacOS x86
run: |
mkdir $GITHUB_WORKSPACE/build_examples_x86
cd $GITHUB_WORKSPACE/build_examples_x86
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ../examples
make -j2
cmake --build . --config Release --parallel 4
# ------------------------------------------------------------

Expand Down Expand Up @@ -120,22 +135,22 @@ jobs:
mkdir $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ..
make -j2
cmake --build . --config Release --parallel 4
- name: Compile Examples for Ubuntu
run: |
mkdir $GITHUB_WORKSPACE/build_examples
cd $GITHUB_WORKSPACE/build_examples
cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release ../examples
make -j2
cmake --build . --config Release --parallel 4
- name: Compile ASAN for Ubuntu
run: |
mkdir $GITHUB_WORKSPACE/build_asan
cd $GITHUB_WORKSPACE/build_asan
cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release -DSIMPLEBLE_SANITIZE=Address ..
make -j2
cmake --build . --config Release --parallel 4
- name: Compile TSAN for Ubuntu
run: |
mkdir $GITHUB_WORKSPACE/build_tsan
cd $GITHUB_WORKSPACE/build_tsan
cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/installed -DCMAKE_BUILD_TYPE=Release -DSIMPLEBLE_SANITIZE=Thread ..
make -j2
cmake --build . --config Release --parallel 4
2 changes: 2 additions & 0 deletions third_party/SimpleBLE/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.vscode
*.binlog
.DS_Store
docs/_build
7 changes: 7 additions & 0 deletions third_party/SimpleBLE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(
EXTERNAL_INCLUDE_DIRS
${SIMPLEBLUEZ_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}/src/external
${CMAKE_CURRENT_SOURCE_DIR}/src/linux
)
set(
Expand All @@ -95,6 +96,7 @@ elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")

set(
EXTERNAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/external
${CMAKE_CURRENT_SOURCE_DIR}/src/windows
)
set(
Expand All @@ -116,6 +118,7 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
)
set(
EXTERNAL_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/external
${CMAKE_CURRENT_SOURCE_DIR}/src/macos
)
set(
Expand Down Expand Up @@ -204,6 +207,10 @@ elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
endforeach()

elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set_property (TARGET simpleble-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
set_property (TARGET simpleble APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
set_property (TARGET simpleble-c-static APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
set_property (TARGET ${SIMPLEBLE-C} APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")
endif()

# Export the variables needed by the parent project
Expand Down
21 changes: 21 additions & 0 deletions third_party/SimpleBLE/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Kevin Dewald

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
67 changes: 67 additions & 0 deletions third_party/SimpleBLE/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
SimpleBLE
==========

The ultimate fully-fledged cross-platform library for Bluetooth Low Energy (BLE).

|Latest Documentation Status|

Overview
--------

SimpleBLE is a C++ fully cross-platform BLE library designed for simplicity
and ease of use. All specific operating system quirks are handled to provide
a consistent behavior across all platforms. Each major version of the library
will have a stable API that will be fully forwards compatible.

If you want to use SimpleBLE and need help. **Please do not hesitate to reach out!**

* Visit our `ReadTheDocs`_ page.
* Join our `Discord`_ server.
* Contact me: ``kevin at dewald dot me``

Are you using SimpleBLE on your own project? Reach out and I'll add a link to it below!

Supported platforms
-------------------
=========== ============= =================================== =====
Windows Linux MacOS iOS
=========== ============= =================================== =====
Windows 10+ Ubuntu 20.04+ 10.15+ (except 12.0, 12.1 and 12.2) 15.0+
=========== ============= =================================== =====

Vendorization
-------------
If you are interested in using SimpleBLE as a dependency in your project,
there is currently first-class support for vendorization of all 3rd-party
dependencies. Currently, the following libraries are included as part of
SimpleBLE:

* `fmtlib`_
* `SimpleBluez`_
* `SimpleDBus`_

Please visit our **Security** page for more information on how to vendorize
3rd-party libraries for SimpleBLE.

License
-------

All components within this project that have not been bundled from
external creators, are licensed under the terms of the `MIT Licence`_.

.. Links
.. _MIT Licence: LICENCE.md

.. _fmtlib: https://github.com/fmtlib/fmt

.. _Discord: https://discord.gg/N9HqNEcvP3

.. _ReadTheDocs: https://simpleble.readthedocs.io/en/latest/

.. _SimpleBluez: https://github.com/OpenBluetoothToolbox/SimpleBluez

.. _SimpleDBus: https://github.com/OpenBluetoothToolbox/SimpleDBus

.. |Latest Documentation Status| image:: https://readthedocs.org/projects/simpleble/badge?version=latest
:target: http://simpleble.readthedocs.org/en/latest
53 changes: 53 additions & 0 deletions third_party/SimpleBLE/docs/architecture.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Architecture
============

Layers and their responsibilities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- External layer

- ``SimpleBLE::Adapter`` and ``SimpleBLE::Peripheral`` classes.
- These objects hold a shared pointer to ``SimpleBLE::AdapterBase``
and ``SimpleBLE::PeripheralBase`` respectively.

- C-style wrapper layer

- This layer is a C-style wrapper around the safe C++, designed to
allow integration of SimpleBLE into other languages that have
support for C bindings.

- Safe layer

- ``SimpleBLE::AdapterSafe`` and ``SimpleBLE::PeripheralSafe``
classes.
- These objects wrap all ``SimpleBLE::Adapter`` and
``SimpleBLE::Peripheral`` objects and provide an interface that
does not throw exceptions. Instead, it will return an
``std::optional<T>`` object if the function returns a value, or a
boolean indicating whether the function succeeded if the original
function did not return a value. The usage is functionally
equivalent to their respective counterparts in the external layer.

- API layer (OS-dependent)

- ``SimpleBLE::AdapterBase`` and ``SimpleBLE::PeripheralBase``
classes.
- These classes specify the API of the library on top of which the
external layer is actually wrapping.
- Each OS target has to implement the full public API specified in
the external layer, using private methods and properties for the
specific requirements of each environment.
- Two convenience classes, ``SimpleBLE::AdapterBuilder`` and
``SimpleBLE::PeripheralBuilder`` are provided for the case of
allowing access to private methods during the build process.

Coding & Naming Conventions
~~~~~~~~~~~~~~~~~~~~~~~~~~~

- This project follows the coding style guidelines specified in the
``.clang-format`` file. They are roughly derived from Google's coding
standard with a few differences, outlined here:

- Class function names are expressed in ``snake_case``.
- Class protected and private property names must end with an underscore (``_``).
- Class protected and private method names must start with an underscore (``_``).
Loading

0 comments on commit 1cf8c56

Please sign in to comment.