This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use the latest version of Californium

Hi, 

I am trying to following the instructions at: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_user_guides_java_coaps.html

but the directory paths of Californium has deviated quite a bit since this was published. Do you have some updated instructions on how to use Californium with your IoT examples?

Thanks very much. 

  • Hi,

    I have now added the updated guide as an aswer to this question.

    To answer your questions about why the IoT SDK was removed in nRFr5 SDK v17, I recommend you read this answer from one of my collegues: https://devzone.nordicsemi.com/f/nordic-q-a/63386/iot-components-removed-in-nrf5-sdk-v17-0-0/258747#258747

  • Last weekend I was also able to spend some time into that.

    The most challenging task seems to find a linux distribution with working bluetooth_6lowpan out of the box. On a Ubuntu 18.04 PC it works, for the Raspi OS it seems to disconnect after 30-40s.

    Using such "out-of-the-box" bluetooth_6lowpan kernels (newer than 4.12) requires then to compile the iot examples using BLE_6LOWPAN_LEGACY_MODE=0 in the sdk_config.h.

    After that it is easy as:

    sudo -s                   (enter su shell, execute the following commands in that shell)

    modprobe bluetooth_6lowpan

    hcitool lescan

    echo "connect 00:AA:BB:CC:DD:EE 1" > /sys/kernel/debug/bluetooth/6lowpan_control

    That's it, your device is connected and may be ping6ed. The ping6 response contains the IPv6 address of the device and the host. If you don't get a ping6 response from the device but only from the host itself, check, if the BLE_6LOWPAN_LEGACY_MODE is really set to 0.

    To use the iot dtls coap-server example, download the prebuild cf-client from Eclipse Releases - cf-client-2.4.1.jar

    With that IPv6 address from the ping6 just start the client on the same host running the bluetooth_6lowpan using:

    java -jar cf-client-2.4.1.jar --identity Client_identity --secret secretPSK 'coaps://[fe80::aa:bbff:fecc:ddee%bt0]/lights/led3' --method PUT --payload 2

    the out should be something as:

    ==[ CoAP Request ]=============================================
    MID    : 24288
    Token  : 1CDF1DDD4467DAD3
    Type   : CON
    Method : 0.03 - PUT
    Options: {"Uri-Path":["lights","led3"]}
    Payload: 1 Bytes
    ---------------------------------------------------------------
    2
    ===============================================================

    >>> DTLS([fe80:0:0:0:39:d5ff:fe9e:f2eb%bt0]:5684,ID:0E5376F5E6)
    >>> TLS_PSK_WITH_AES_256_CCM
    >>> PreSharedKey Identity [identity: Client_identity]

    Time elapsed (ms): 1352
    ==[ CoAP Response ]============================================
    MID    : 24288
    Token  : 1CDF1DDD4467DAD3
    Type   : ACK
    Status : 2.04 - CHANGED
    Options: {}
    RTT    : 1352 ms
    Payload: 0 Bytes
    ===============================================================

    and the LED 3 is switching on. That takes the 1,3 s (no 3 minutes :-) ).

    Unfortunately, it's not possible to reconnect the device's server again without disconnect the ble connection. So, if you want to play more, try out the Eclipse Releases - cf-browser-2.4.1. The browser uses javaFX, which is required to be installed ahead. Start the cf-browser similar as cf-client using:

    java --module-path /usr/share/openjfx/lib --add-modules javafx.controls,javafx.fxml -jar cf-browser-2.4.1.jar --identity Client_identity --secret secretPSK 'coaps://[fe80::39:d5ff:fe9e:f2eb%bt0]'

    (that assumes openjdk java 11 on ubuntu 18.04 using openjfx)

    The UI should be easy to use. Press DISCOVER to see the resources of the devices coap-server. Select the resource lights/led3 on the resources tree on the left. select a GET to see the state, or type a 2 and use PUT to toggle the LED.

  • This is really all kinds of awesome, thank you for your kind support and taking the initiative and extra efforts to update this guide. I will be testing this with our CoAP + Thread example. The nice thing about this is everything flows through Thread as the sensor network backbone and pretty standard to setup using OpenThread border router setup either with standalone Raspberry Pi 3B/3B+ or Ubuntu environment.

  • Everything was fine until I tried to run the secure coap client. I got the following error message saying:

    Could not load the keystore
    java.io.FileNotFoundException: ..\..\demo-certs\src\main\resources\keyStore.jks (The system cannot find the path specified)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at org.eclipse.californium.tools.Nrf5xConsoleClient.main(Nrf5xConsoleClient.java:210)
    Failed to execute request: URI scheme coaps requires a previous set connector!

    Do you know how to fix this?

  • What OS are you using?

    If you are using Linux or macOS, try to change the direction of the slashes, i.e. from \ to /.

Related