Git Product home page Git Product logo

Comments (2)

barbibulle avatar barbibulle commented on June 3, 2024

Hi @yangchi, sorry for not responding earlier.
(1) The sockets API for now only includes UDP sockets, because the first use case for the framework was to enable secure CoAP transactions, and CoAP is transported over UDP. I do have a work in progress to add TCP sockets to the API (the underlying IP stack supports it), I'm hoping to have a PR for that soon.

(2) That's right. The GATT MTU is transparent to the upper layers, the UDP packets will get properly split into smaller payloads (that's one of the features of the so-called Gattlink protocol that we layer between the IP stack and GATT). We also don't enable IP fragmentation in the IP stack (to keep buffers at a minimum), so you do need to limit the UDP datagrams to something that fits in a single IP packet. The default IP MTU we configure is 1280, but that can be changed at runtime via the API.

(3) The NIP stack is very limited in what it supports. It doesn't enforce any runtime-changeable MTU. There's a fixed compile-time limit (GG_NIP_MAX_PACKET_SIZE) set currently at 0xFFFF. So as long as there's enough memory, it will allow you to send large datagrams. But large datagrams would likely be rejected by the next layer down, because the default size for the Gattlink ring buffer is, by default, set at 2 times the IP MTU (by default, that's configurable at runtime), so if you have datagrams that don't fit in the Gattlink buffer, they'll be rejected.

(4) On macOS and iOS, the default sockets are still LwIP sockets (BSD sockets are still enabled, but you need to ask for the specifically), because those are the ones that get routed to the Bluetooth layer. BSD sockets go through the host OS's native IP stack, so you can go over WiFi or LTE. Unfortunately, we can't connect the Bluetooth/gattlink network interface to the OS's native IP stack, because doing so would require to use an IP tunnel, which on iOS and Android require the app to act as a VPN, which isn't something practical for most apps. In the macOS build of the stack tool, however, there's an option to bridge packets to the tun/tap network interface, so as to communicate through the macOS native IP stack, but that's mostly for experimentation and debugging.

(5) All the C APIs are available on all platforms. On Android, we expose some of them, indirectly, via JNI and some Kotlin classes. But if you're willing to write your own JNI code, you can make calls into any of the C APIs. On iOS, there's no need for JNI, as the Apple tools create a Swift/C bridge automatically, but the concept is the same.

from golden-gate.

yangchi avatar yangchi commented on June 3, 2024

Hi @barbibulle : Thank you so much for such detailed reply! You cleared all my questions. This is so awesome.

from golden-gate.

Related Issues (16)

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.