Skip to content

WUhailing/Metawear-CppAPI

 
 

Repository files navigation

MetaWear C++ API

This project is a C++ implementation of the MetaWear protocol. If compiled as a shared library, it can be used with any language that supports calling C functions from a shared library, such as C# and Python. The library only constructs the bytes for communicating with the MetaWear platform, it does not contain any Bluetooth LE code. Users will need to fill in the appropriate Bluetooth LE functions for their target device.

Build

Building the project has been tested on Linux using GCC 4.8.3 and make, and on Windows with Visual Studio Community 2015.

GCC and Make

Linux users can build the project by invoking make. The default action is to build the shared library for your platform.

> make

Upon a successful compile, the library will be placed in the newly created dist directory.

> tree dist
dist/
└── release
    └── lib
        └── x64
            ├── libmetawear.so -> libmetawear.so.0
            ├── libmetawear.so.0 -> libmetawear.so.0.2.2
            └── libmetawear.so.0.2.2

Testing

Unit tests for the library are written in Python (min v3.4.1) and can be invoked by calling the test target.

> make test
python3 -m unittest discover -s test
...................................................................................
----------------------------------------------------------------------
Ran 83 tests in 0.018s

OK

Visual Studio

A VIsual Studio solution building the C# wrapper is available as a separate project, link here. The C++ source code is built as Windows Runtime Component with the following changes to the project properties:

  1. Disable the Precompiled Headers compile option
  2. Disable Generate Windows Metadata linker option
  3. Add METAWEAR_DLL_EXPORTS to the preprocessor list

About

C++ implementation of the MetaWear protocol

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 53.0%
  • Python 35.4%
  • C 10.5%
  • Makefile 1.1%