#!/bin/sh
set -e
alias log="echo '
[step_a.sh]'"


RN_NAME="CINwithLabel"


log creates container
curl -X POST \
  -H 'X-M2M-Origin:Cmysensor'            \
  -H 'X-M2M-RI:123'                      \
  -H 'X-M2M-RVI:3'                       \
  -H'Content-Type:application/json;ty=2' \
  -H 'Accept:application/json'           \
  -d '{"m2m:ae": {"rn":"'$RN_NAME'", "api": "NMysensor", "rr": true, "srv": ["3"]}}' \
  http://127.0.0.1:8080/cse-in

log emit notification
curl -X POST \
  -H 'X-M2M-Origin:Cmysensor' \
  -H 'X-M2M-RI:123' \
  -H 'X-M2M-RVI:3' \
  -H 'Content-Type:application/json;ty=4' \
  -H 'Accept:application/json' \
  -d '{"m2m:cin": {"rn":"CINwithLabel", "lbl": ["tag:temperature"], "cnf": "text/plain:0", "con": "{\"unit\": \"celsius\",\"value\": \"22\"}"}}' \
  http://127.0.0.1:8080/cse-in/MySensor/Container
