-
Notifications
You must be signed in to change notification settings - Fork 8
Support TCP connections #17
Comments
Where and how did you get stuck? I personally would start by directly calling the |
This is their library: https://github.com/spark/firmware/blob/develop/wiring/src/spark_wiring_tcpclient.cpp I wanted to port it to Rust (as directly as possible for now, without making it idiomatic). That code looks pretty straightforward, the tricky part (for me) is the network / wifi stuff: https://github.com/spark/firmware/blob/develop/wiring/src/spark_wiring_wifi.cpp I can't find the place anymore, but somehow I found a rabbit hole that led to calls to the WICED library, which is pretty big. Maybe bindings to that could be generated with bindgen? |
You could try to directly bind to their C++ firmware library for the TCPClient stuff. Bindgen supports C++ libraries but I haven't used it like that before so I can't provide further advice on that. |
Ok, initial attempt with current bindgen: $ cd particle-firmware
$ bindgen --use-core --ctypes-prefix ::ctypes \
firmware/wiring/inc/spark_wiring_tcpclient.h -- \
-I firmware/system/inc/ \
-I firmware/hal/inc/ \
-I firmware/services/inc/ \
-I firmware/hal/shared/ \
-x c++ -std c++14
thread 'main' panicked at 'TranslationUnit::parse failed',
/checkout/src/libcore/option.rs:794
note: Run with `RUST_BACKTRACE=1` for a backtrace. Any idea? |
No idea. The error message is not particularly helpful. The documentation says that you will likely need to whitelist some std stuff to make this work but doesn't suggest what should be whitelisted (everything's whitelisted by default). You'll probably have more luck asking around on IRC or looking for a project that creates C++ bindings to see how it does it. |
I started porting the TCPClient, but kind of got stuck in the complexity of the issue.
Is this the correct direction / approach?
The text was updated successfully, but these errors were encountered: