RIOT-OS / applications

Some useful RIOT applications
GNU Lesser General Public License v2.1
41 stars 36 forks source link

I2ot client #17

Closed backenklee closed 6 years ago

backenklee commented 8 years ago

Demonstrates how to send sensor values via CoAP to an i2ot gateway (see https://github.com/i2ot/i2ot ). It also runs a CoAP server, so you can fetch the sensor value independently of a gateway. It performs CoAP resource discovery (i.e. send a GET request to /.well-known/core to ff0X::fd) to find an i2ot gateway.

OlegHahm commented 8 years ago

Can you uncrustify your code with RIOT's configuration, please?

backenklee commented 8 years ago

I forgot, sorry! All fixed now.

jnohlgard commented 8 years ago

Can this CoAP library be reused? Should it go into pkg or similar? Is it based on any other CoAP implementation (microcoap, libcoap, erbium etc.)?

jnohlgard commented 8 years ago

btw, comments should be in C-style (/* comment */) and the Doxygen opening tags should be on the form /** blah */ or /**< blah */

miri64 commented 8 years ago

Is there an update on this application?

backenklee commented 8 years ago

There will be soonish, I'm working on it. The CoAP library is based on microcoap, and can be reused. microcoap is not being maintained any more, but I'm trying to work something out with the original authors. If you think it makes sense to remove/close this PR and create a new one when things are clearer, please let me know.

miri64 commented 8 years ago

If you think it makes sense to remove/close this PR and create a new one when things are clearer, please let me know.

Nonono, just was asking because I saw that this PR was open ;-)

miri64 commented 8 years ago

(and not being touched for long)

bsmelo commented 8 years ago

Which RIOT release (or maybe an specific repo you have) I need to link this PR to so I'm able to run this app?

I made a first try with the current RIOT master, and got the following errors:

[  1:16PM ]  [ bruno@lain:~/coap-apps/RIOT-OS_applications/i2ot-client(i2ot-client✗) ]
 $ make all
Building application "i2ot-client" for "native" with MCU "native".

/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c: In function ‘coap_start_server’:
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:228:23: error: ‘CREATE_STACKTEST’ undeclared (first use in this function)
                       CREATE_STACKTEST, coap_server_thread, port_str, "UDP server") <= KERNEL_PID_UNDEF) {
                       ^
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:228:23: note: each undeclared identifier is reported only once for each function it appears in
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c: In function ‘i2ot_server_thread’:
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:280:5: error: implicit declaration of function ‘genrand_init’ [-Werror=implicit-function-declaration]
     genrand_init(initval);
     ^
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:286:9: error: implicit declaration of function ‘genrand_uint32’ [-Werror=implicit-function-declaration]
         mid_rand = (uint16_t)genrand_uint32();
         ^
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c: In function ‘i2ot_client_start’:
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:341:23: error: ‘CREATE_STACKTEST’ undeclared (first use in this function)
                       CREATE_STACKTEST, i2ot_server_thread, NULL, "UDP server") <= KERNEL_PID_UNDEF) {
                       ^
cc1: all warnings being treated as errors
make[1]: *** [/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/bin/native/i2ot-client/i2ot-client.o] Error 1
make: *** [all] Error 2

I'd really appreciate if someone could provide me some guidance on the easiest way to get this app running (linking to a specific old version of RIOT, changing something on the code, ... anything would do).

hexluthor commented 8 years ago

@bsmelo try replacing CREATE_STACKTEST with THREAD_CREATE_STACKTEST. This was changed in RIOT core a while back but I guess the apps weren't updated.

bsmelo commented 8 years ago

Thanks, @hexluthor. :-)

The CREATE_STACKTEST error is gone, but I'm still getting the following ones:

[  5:05PM ]  [ bruno@lain:~/coap-apps/RIOT-OS_applications/i2ot-client(i2ot-client✗) ]
 $ make clean; make all;
Building application "i2ot-client" for "native" with MCU "native".

/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c: In function ‘i2ot_server_thread’:
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:280:5: error: implicit declaration of function ‘genrand_init’ [-Werror=implicit-function-declaration]
     genrand_init(initval);
     ^
/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/i2ot-client.c:286:9: error: implicit declaration of function ‘genrand_uint32’ [-Werror=implicit-function-declaration]
         mid_rand = (uint16_t)genrand_uint32();
         ^
cc1: all warnings being treated as errors
make[1]: *** [/home/bruno/coap-apps/RIOT-OS_applications/i2ot-client/bin/native/i2ot-client/i2ot-client.o] Error 1
make: *** [all] Error 2

Any suggestions? Also, I feel I'm going to have a lot of these "RIOT changed, app wasn't updated"™ kind of issue... Is there any way I can try to find those by myself, without the need to know RIOT's codebase history? Some kind of grep or searching on GitHub, idk...

kaspar030 commented 8 years ago

error: implicit declaration of function ‘genrand_init’ error: implicit declaration of function ‘genrand_uint32’

Uff, the applications seem to be quite outdated. That API has changed, too. You can replace the functions with "random_init()" and "random_uint32()".

bsmelo commented 8 years ago

Ok, I was able to compile it! Thanks, both of you.

So, regarding my last question, is there any [relatively easy/straightforward] way to discover these kinds of API changes by myself?

Ps.: For any readers out there, additionally to the two changes suggested here, the following line on the Makefile needs to be changed as well:

-USEMODULE += gnrc_netif_default
+USEMODULE += gnrc_netdev_default
hexluthor commented 8 years ago

@bsmelo for names that have changed, I'll typically do a git log -p on the RIOT master branch. Then search for it by name using the slash key. The first match is usually where the rename occurred.

miri64 commented 8 years ago

@backenklee can you maybe update your PR? It would be sad that this application would get lost.

@kaspar030 could Murdock include this Repo?

kaspar030 commented 8 years ago

@kaspar030 could Murdock include this Repo?

Sure, though not without some changes. Would have to either run another Murdock instance, or extend Murdock so it understands building for multiple projects (with different build scripts).

backenklee commented 8 years ago

hey everyone, thanks for taking the time to look at this! i fixed everything like you described and it builds without problems now.

OlegHahm commented 7 years ago

@miri64, @kaspar030, @emmanuelsearch, @haukepetersen, does anybody feel responsible for this PR from the maintainer side?

miri64 commented 6 years ago

Is it still safe to assume this PR works?

backenklee commented 6 years ago

I don't think so, sorry :-( I also won't be able to put time into this (nor i2ot or anything), so I suggest we just close it