mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #4819 from Lotterleben/microcoap_example_copper_fix
microcoap_server: make app fully work with Copper
This commit is contained in:
commit
0e3a9c693e
@ -42,15 +42,18 @@ RIOT native hardware initialization complete.
|
|||||||
|
|
||||||
main(): This is RIOT! (Version: 2015.12-devel-632-g8f451-booze-add_conn_coap_example)
|
main(): This is RIOT! (Version: 2015.12-devel-632-g8f451-booze-add_conn_coap_example)
|
||||||
RIOT microcoap example application
|
RIOT microcoap example application
|
||||||
|
Waiting for address autoconfiguration...
|
||||||
Configured network interfaces:
|
Configured network interfaces:
|
||||||
Iface 5 HWaddr: fa:bf:2b:01:9e:a3
|
Iface 5 HWaddr: 96:3c:18:1e:26:f7
|
||||||
MTU:1280 HL:64
|
|
||||||
|
MTU:1500 HL:64 RTR RTR_ADV
|
||||||
Source address length: 6
|
Source address length: 6
|
||||||
Link type: wired
|
Link type: wired
|
||||||
inet6 addr: ff02::1/128 scope: local [multicast]
|
inet6 addr: ff02::1/128 scope: local [multicast]
|
||||||
inet6 addr: fe80::f8bf:2bff:fe01:9ea3/64 scope: local
|
inet6 addr: fe80::e42a:1aff:feca:10ec/64 scope: local
|
||||||
inet6 addr: ff02::1:ff01:9ea3/128 scope: local [multicast]
|
inet6 addr: ff02::1:ffca:10ec/128 scope: local [multicast]
|
||||||
inet6 addr: ff02::2/128 scope: local [multicast]
|
inet6 addr: ff02::2/128 scope: local [multicast]
|
||||||
|
inet6 addr: 2001:db8:1:0:e42a:1aff:feca:10ec/64 scope: global
|
||||||
|
|
||||||
Waiting for incoming UDP packet...
|
Waiting for incoming UDP packet...
|
||||||
```
|
```
|
||||||
@ -80,22 +83,28 @@ getting it to work with RIOT requires a little setup.
|
|||||||
Make sure you've installed
|
Make sure you've installed
|
||||||
|
|
||||||
- The [Firefox Copper plugin](https://addons.mozilla.org/en-US/firefox/addon/copper-270430/)
|
- The [Firefox Copper plugin](https://addons.mozilla.org/en-US/firefox/addon/copper-270430/)
|
||||||
- The Router Advertisement Daemon (radvd)
|
- The Router Advertisement Daemon (radvd)
|
||||||
|
|
||||||
|
And build the application again using `make`.
|
||||||
|
|
||||||
Enter the following into your `/etc/radvd.conf` (if it doesn't exist yet, create one):
|
Enter the following into your `/etc/radvd.conf` (if it doesn't exist yet, create one):
|
||||||
|
|
||||||
```
|
```
|
||||||
interface tap0
|
interface tap0
|
||||||
{
|
{
|
||||||
AdvSendAdvert on;
|
AdvSendAdvert on;
|
||||||
MinRtrAdvInterval 3;
|
|
||||||
MaxRtrAdvInterval 10;
|
MinRtrAdvInterval 3;
|
||||||
prefix fc00::/64
|
MaxRtrAdvInterval 10;
|
||||||
{
|
|
||||||
AdvOnLink on;
|
AdvDefaultPreference low;
|
||||||
AdvAutonomous on;
|
|
||||||
AdvRouterAddr off;
|
prefix 2001:db8:1:0::/64
|
||||||
};
|
{
|
||||||
|
AdvOnLink on;
|
||||||
|
AdvAutonomous on;
|
||||||
|
AdvRouterAddr off;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -104,13 +113,31 @@ interface tap0
|
|||||||
and run
|
and run
|
||||||
|
|
||||||
```
|
```
|
||||||
/bin/systemctl start radvd.service
|
sudo radvd
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can enter
|
Then, run the RIOT binary as usual:
|
||||||
|
|
||||||
```
|
```
|
||||||
coap://[fc00::1]/riot/board
|
make term
|
||||||
```
|
```
|
||||||
|
|
||||||
into your Firefox address bar.
|
Note that the output listing all configured interfaces contains a globally scoped
|
||||||
|
address, which you can now use to reach the RIOT instance via Copper. To do so, enter this:
|
||||||
|
|
||||||
|
```
|
||||||
|
coap://[2001:db8:1:0:e42a:1aff:feca:10ec]/riot/board
|
||||||
|
```
|
||||||
|
|
||||||
|
into your Firefox address bar, where you should replace `2001:db8:1:0:e42a:1aff:feca:10ec`
|
||||||
|
with your RIOT instance's address marked as "scope: **global**".
|
||||||
|
If you click the big green `GET` button, the word `native` should appear in the
|
||||||
|
**Payload** text box at the center of the GUI.
|
||||||
|
|
||||||
|
**If this doesn't work,** try manually adding a Global address to the tap0 interface:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo service radvd start
|
||||||
|
sudo ip address add 2001:db8:1::a/64 dev tap0
|
||||||
|
make term
|
||||||
|
```
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
#include "xtimer.h"
|
||||||
|
|
||||||
#define MAIN_QUEUE_SIZE (8)
|
#define MAIN_QUEUE_SIZE (8)
|
||||||
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
static msg_t _main_msg_queue[MAIN_QUEUE_SIZE];
|
||||||
@ -35,6 +36,9 @@ int main(void)
|
|||||||
/* microcoap_server uses conn which uses gnrc which needs a msg queue */
|
/* microcoap_server uses conn which uses gnrc which needs a msg queue */
|
||||||
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE);
|
||||||
|
|
||||||
|
puts("Waiting for address autoconfiguration...");
|
||||||
|
xtimer_sleep(3);
|
||||||
|
|
||||||
/* print network addresses */
|
/* print network addresses */
|
||||||
puts("Configured network interfaces:");
|
puts("Configured network interfaces:");
|
||||||
_netif_config(0, NULL);
|
_netif_config(0, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user