Code Monkey home page Code Monkey logo

Comments (4)

rgrover avatar rgrover commented on August 18, 2024

Hi Myles,

Which part of C++ is a showstopper for you?
If you study the demos, you'll find that there's hardly any C++ being used apart from instantiating a BLEDevice or a few BLE services; or perhaps classes which abstract the hardware. You're free to write the rest of your application in C if you prefer.

Is it the BLE API which you'd like to see written in C? Or is it the larger mbed API which you'd have in C? Please continue this discussion; your feedback could help us re-orient ourselves. thanks.

from ble.

myleswatson avatar myleswatson commented on August 18, 2024

Hi Rohit,

Thanks for the quick response.

I'm interested in using and extending the BLE API. Our project is written in C, and I'm worried that the necessary wrappers will add too much overhead in terms of size/execution time. C seems a lot easier to include in C++ than C++ is in C.

I'm working with an nRF51822, and I'd like to get to the point where the entire project is open source. It seems like it would be a much simpler road if BLE_API were in C. I'm open to suggestions, though.

Thanks,
Myles

from ble.

rgrover avatar rgrover commented on August 18, 2024

The C++ wrappers making up the BLE_API are very lightweight. Using them will not cause any performance or code bloat. C++ has come a long way in being efficient. Using C++ brings the benefit of much better compile-time checking and introduces near-zero run-time overhead.

Does your toolchain support C++?

If you really need everything to be C-only, you'll have to de-contruct every class BLE_API into a module and pass around extra pointers to structs. There are not too many classes in BLE_API, and this deconstruction can be achieved within a small amount of effort.

The Nordic SDK is in C. BLE_API only adds the benefit of being cross-platform. If you are not going to aim for portability, then you can also consider using the Nordic SDK directly.

from ble.

myleswatson avatar myleswatson commented on August 18, 2024

I agree. I didn't mean to imply that the C++ code in BLE_API were poorly written. My toolchain supports C++, but the project definition doesn't. I didn't want to use the Nordic API directly, because I wanted to support an open-source API. I was mostly surprised that C++ was chosen to wrap a C API. Presumably future APIs that you are targeting may be written in C++.

Thanks for your work. I agree that deconstructing the classes wouldn't be too much work. That may be the way forward for me.

from ble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.