saleae / logic2-automation

Logic2 Automation API
https://saleae.github.io/logic2-automation/
Apache License 2.0
19 stars 8 forks source link

[Feature Request] C++ Wrapper Library #38

Open markovejnovic opened 10 months ago

markovejnovic commented 10 months ago

Hi! I need a C++ library and have started implementing one. I've forked the repo and am currently working on the library there.

This is only tested with the demo device (as that's what I have access to at the moment). All code is Apache licensed.

Documentation is pretty sporadic at the moment, but you can get started by doing:

git clone https://github.com/markovejnovic/logic2-automation.git
cd logic2-automation/cpp
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug .. # Highly recommend debug mode for now...
make

You do need a system install of grpcpp, absl_synchronization and protobuf as well as protoc, but those should be the only dependencies at the moment.

Opening this as an issue so we can have a discussion what your needs and design ideas are. I am mostly aiming at making this conceptually compatible with the Python API with the difference of those context managers becoming RAII objects. I was aiming at mimicking the Python API for the sake of developer familiarity and didn't see too many reasons to deviate. Let me know if you have any better ideas regarding the API :)

I should disclose that this particular piece of code is necessary for my day job, but in order to give this wrapper as big of a chance at being an open source library as possible, I decided to be forwards with this from my own personal resources (hence why this is only tested from the demo device ;)

I'll avoid opening a PR until the C++ API is more feature-complete.