-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg: add yacoap, Yet another CoAP library #5830
Conversation
YaCoAP is a fork of microcoap , but with extended features - provides server AND client functionality - supports separate ACK and response messages - refined (simpler) API, not microcoap compatible - no dependencies to transport or network layer - simply handles (create, parse) CoAP packets Further this PR ships with sample code in: - tests/pkg_yacoap - and examples/yacoap_posix
And can you tell us about the memory requirements of this implementation? |
Right, similar to the existing microcoap package, it does not actually send or receive data, it only handles parsing or creation of CoAP packets given as byte buffers. However, besides adding client functionality it also changes the API, so its like microcoap 2.0 - that's why I changed the name and leaf microcoap as is, to not break any existing code or projects using microcoap. Memory requirements are little higher compared to microcoap, as it provides client handlers. But I haven't done any solid comparison, yet. I was thinking about adding flags to disable code parts, for instance if only server or client functionality is used. But don't know if this is necessary with all the LTO optimization already in place?! |
great one! I can take a peek at the example applications later. Should be interesting how you added the client part and how it is "invoked" by the user. |
@@ -0,0 +1,22 @@ | |||
# examples/yacoap_client_server | |||
|
|||
This examples shows basic usage of YaCoAP in RIOT. It shows CoAP client and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/examples/example/
@smlng do you intent to keep yacoap independent from RIOT? Otherwise we could get rid of those patch files by integrating the changes directly into your fork. |
Yes I'd like to keep it separate, so one can used with non-RIOT-OS projects. The patches delete examples and tests for real Unix/Linux-OS. However, is it possible to specify a remote branch (not master) instead of commit to pull from? |
Thanks for the explanation. I didn't realize that basically the whole package is your contribution. Nice one, indeed. 😄 |
Mh… before I open an issue: Given the fact that we now have a plethora of CoAP libs to choose from, what do you think about a |
@miri64 Actually I'm waiting for gcoap #5598, which points in that direction. Though its implementation is currently toward gnrc, it should be easily adaptable to conn or future sock API, or not?! But in the meantime I need something that provides CoAP client functionality, which microcoap doesn't and libcoap is - well ... to be honest I never tried it with RIOT, though on Linux I use it a lot for testing. |
the commit that is pointed to by your desired branch should be enough, or did I misunderstand something? |
@cgundogan yeah, did not thought about that carefully - should work. So we could use that, provided I keep the branch in place, but why not?! That way we get rid of those patches, would you like that better? |
I thought the whole idea behind gcoap is that it uses GNRC directly... I guess you misunderstood what I meant:
I'm all for trying different approaches ;-). But something like |
Nice, competition. ;) |
@miri64 ah yes my fault, I didn't get what you meant in the first place. Regarding gcoap: I thought there was some discussion on getting it separated from gnrc (later on)? So it would be possible to used it with conn or sock, too? |
Yes, we have discussed separating gcoap from gnrc in that PR. I have been using GNRC because it provides a stable and useful API for my purposes. However, my server reimplementation on nanocoap isolates the interface with the stack. I just added a note on the code to show where/how this happens now. @smlng, I am happy to work with you to see how gcoap can be useful for yacoap. Of course, I'm happy to work with everyone to get a good-fitting CoAP in RIOT, including observe, block, and confirmable messaging. :-) |
@smlng, now that I have added client functionality to gcoap, I reviewed how to support use of yacoap within gcoap. I definitely think this is possible, but I'm not sure when is the best time to do it. gcoap uses nanocoap, so I compared how nanocoap works vs. yacoap. They are quite similar, which makes sense since both have evolved from microcoap. The main differences I see are in the structs -- coap_pkt_t vs. coap_packet_t. Also, yacoap includes a coap_resource_t that nanocoap lacks, but may include at some time in the future. As @miri64 suggested, I can imagine a common interface. There could be opaque pointer types to hide the struct differences, and some common functions that use those pointers. Maybe some/most of these common functions could be inlined in a header to adapt to implementation specifics. I'm not sure it makes sense for me to work on this common interface at the moment though. I sense that @kaspar030 's work still is evolving, especially on the client side. You two may want to work through some of those differences in the context of your posix implementations (yacoap.c), kind of like what has happened with sock and conn. Now that I see an outline for a common interface, I plan to adapt gcoap so there are no roadblocks to it. Then maybe we can revisit farther on down the road. |
gcoap uses nanocoap, so I compared how nanocoap works vs. yacoap. They
are quite similar, which makes sense since both have evolved from microcoap.
Well, nanocoap has been written from scratch. It might look similar to
microcoap as that was the only library that I had used before.
|
Hi, I don't see in any of those CoAP implementation an OBSERVE capability? Why? |
Hi @biboc, the implementations discussed here are mostly WIP and/or aim for simplicity, implementing the bare standard first. However, libcoap (which is a pkg in RIOT) does support OBSERVE I think? So have a look there for now. I plan to implement observe in the future and I think @kb2ma will do this for gcoap as well. Observe is clearly very useful in a typical sensor scenario, so we need that (and many things more) in RIOT 👍 |
I don't see in any of those CoAP implementation an OBSERVE capability? Why?
I plan on adding OBSERVE to nanocoap.
I didn't yet because it increases the complexity a lot. A CoAP server is
completely stateless, a client too if it just resends a request until it
gets an answer. As soon as OBSERVE comes into play, there's a state
somewhere.
|
Yes, I plan to add Observe to gcoap. This capability is high on my list On 09/29/2016 12:43 PM, Sebastian Meiling wrote:
|
Great guys! Yes it increases the difficulty! |
# Specify the mandatory networking modules for IPv6 and UDP | ||
USEMODULE += gnrc_ipv6_default | ||
USEMODULE += gnrc_udp | ||
USEMODULE += gnrc_conn_udp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please port to sock (see #6005).
Postponed because of Feature Freeze. |
Any plans to continue on this? |
Mhm, I switched to gcoap for most of my projects. Though this improves on microcoap, it does not provide more features than gcoap. I'll close this as memo, but would rather work on improving gcoap than bring this into RIOT. |
YaCoAP is a fork of microcoap , but with extended features
Further this PR ships with sample code in: