Skip to content

Instantly share code, notes, and snippets.

@rafcio2k
Last active March 2, 2017 08:21
Show Gist options
  • Save rafcio2k/e5b95221f2f4a0daddbfd23a3d315068 to your computer and use it in GitHub Desktop.
Save rafcio2k/e5b95221f2f4a0daddbfd23a3d315068 to your computer and use it in GitHub Desktop.
Create AwaLWM2M client in Vagrant environment and connect it to deviceserver.creatordev.io
#!bin/sh
# This script prepare AwaLWM2M tools and start AWALWM2M client, which connects to CreatorDev Device Server.
# PREREQUISITES:
# Go to https://docs.creatordev.io/ci40/guides/creating-applications/#method-2-creatordev-vm and install virtualbox, virtualbox extension pack and vagrant. Then:
# $ mkdir creatordev-sdk
# $ cd creatordev-sdk
# $ vagrant init CreatorDev/creatordev-vm
# $ vagrant up
# Download Device Server Certificate from https://console.creatordev.io/#/identities and put it in ./creatordev-sdk/myworkspace/deviceserver_cert
# $ vagrant ssh
sudo apt-get update
sudo apt-get -y install build-essential gcc git mercurial python cmake python-nose python-lxml # AwaLWM2M dependencies described on https://github.com/FlowM2M/AwaLWM2M/blob/master/doc/starters_guide.md
sudo apt-get -y install libgnutls*
cd ~/myworkspace
git clone https://github.com/FlowM2M/AwaLWM2M.git
cd AwaLWM2M
mkdir build
cd build
cmake .. -DWITH_GNUTLS=1
make
./daemon/src/client/awa_clientd -b coaps://deviceserver.creatordev.io:15684 -e VagrantClient -i 12345 -c ~/myworkspace/deviceserver_cert -l ~/myworkspace/awa_clientd.log -d
ps -ef | grep awa | grep -v grep
sleep 5
./tools/awa-client-define -o 3303 -j TemperatureSensor -m -y single -r 5700 -n SensorValue -t float -u single -q mandatory -k rw
./tools/awa-client-set -c /3303/0
./tools/awa-client-set /3303/0/5700=23.4
./tools/awa-client-get /3303/0/5700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment