diff --git a/apps/awa-lwm2m/Makefile.awa-lwm2m b/apps/awa-lwm2m/Makefile.awa-lwm2m new file mode 100644 index 00000000000..03836ef54e9 --- /dev/null +++ b/apps/awa-lwm2m/Makefile.awa-lwm2m @@ -0,0 +1,25 @@ +AWA_URL?=https://github.com/FlowM2M/AwaLWM2M.git +AWA_VERSION?=0.2.5 +AWA_DIR:=$(dir $(filter %/Makefile.awa-lwm2m,$(MAKEFILE_LIST)))AwaLWM2M + +CFLAGS += -I"$(AWA_DIR)"/api/include + +CLEAN += "$(AWA_DIR)" + +ifneq ($(MAKECMDGOALS),clean) +-include $(AWA_DIR)/.git-cloned +$(AWA_DIR)/.git-cloned: + git clone "$(AWA_URL)" -b "$(AWA_VERSION)" "$(AWA_DIR)" + touch $@ +endif + +define AWAMODULE +-include $(1)/$(2)/Makefile.$(2) +awa-lwm2m_src += $$($(2)_src) +APPDS += $(1)/$(2) +endef + +AWACORE=client common erbium +AWALIB=b64 hmac xml +$(foreach c,$(AWACORE),$(eval $(call AWAMODULE,$(AWA_DIR)/core/src,$(c)))) +$(foreach c,$(AWALIB),$(eval $(call AWAMODULE,$(AWA_DIR)/lib,$(c)))) diff --git a/examples/awa-lwm2m/.vscode/extensions.json b/examples/awa-lwm2m/.vscode/extensions.json new file mode 100644 index 00000000000..a0feefe71d9 --- /dev/null +++ b/examples/awa-lwm2m/.vscode/extensions.json @@ -0,0 +1,7 @@ +// See http://go.microsoft.com/fwlink/?LinkId=827846 +{ + "recommendations": [ + "ms-vscode.cpptools", + "EditorConfig.EditorConfig" + ] +} \ No newline at end of file diff --git a/examples/awa-lwm2m/.vscode/launch.json b/examples/awa-lwm2m/.vscode/launch.json new file mode 100644 index 00000000000..4af35aeaed8 --- /dev/null +++ b/examples/awa-lwm2m/.vscode/launch.json @@ -0,0 +1,20 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "lldb-mi", + "request": "launch", + "name": "Launch Program (SSH)", + "target": "./awa-lwm2m.minimal-net", + "cwd": "${workspaceRoot}", + "ssh": { + "forwardX11": false, + "host": "127.0.0.1", + "cwd": "/build/examples/awa-lwm2m", + "user": "root", + "password": "", + "port": 1022 + } + } + ] +} diff --git a/examples/awa-lwm2m/Dockerfile b/examples/awa-lwm2m/Dockerfile new file mode 100644 index 00000000000..b5e65802401 --- /dev/null +++ b/examples/awa-lwm2m/Dockerfile @@ -0,0 +1,11 @@ +FROM creatordev/docker-nat64-client + +RUN curl -sL http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add /dev/stdin +ADD docker/lldb.list /etc/apt/sources.list.d/ +RUN apt-get update && \ + apt-get install -yq openssh-server gdbserver pwgen lldb-4.0 && \ + ln -s /usr/bin/lldb-mi-4.0 /usr/bin/lldb-mi +ADD docker/run.sh / +RUN chmod +x /run.sh + +CMD ["/run.sh","bash"] \ No newline at end of file diff --git a/examples/awa-lwm2m/Makefile b/examples/awa-lwm2m/Makefile new file mode 100644 index 00000000000..cf46534ef9f --- /dev/null +++ b/examples/awa-lwm2m/Makefile @@ -0,0 +1,60 @@ +CONTIKI_PROJECT=awa-lwm2m +CONTIKI=../.. +TARGET?=mikro-e +VERSION?=0.2.5 + +ifeq ($(TARGET),micro-e) +PROJECT_CONF_H:=project-conf.h +all: $(CONTIKI_PROJECT).hex +else +PROJECT_CONF_H:=project-conf-$(TARGET).h +endif + +ifeq ($(TARGET),minimal-net) +ifndef TAP_PREFIX +$(error Please define TAP_PREFIX. See HARD_CODED_ADDRESS at https://github.com/contiki-os/contiki/blob/master/platform/minimal-net/contiki-conf.h) +endif +UIP_CONF_RPL=0 +CFLAGS += -DUIP_CONF_ND6_DEF_MAXDADNS=0 +CFLAGS += '-DHARD_CODED_ADDRESS="$(TAP_PREFIX)"' +CFLAGS += -DDTLS_MAX_BUF=1000 +#CFLAGS += -DVERBOSE_DEBUG=1 -DDEBUG=1 +endif + +CFLAGS += '-DPROJECT_CONF_H="$(PROJECT_CONF_H)"' '-DVERSION="$(VERSION)"' +CFLAGS += -Wall -Wno-pointer-sign +CFLAGS += -DLWM2M_CLIENT -g -DDTLS_PEERS_NOHASH=1 +CFLAGS += -DUIP_CONF_BUFFER_SIZE=4096 + +ifeq ($(PSK_IDENTITY)x,x) +$(error Please define PSK_IDENTITY) +endif +ifeq ($(PSK_SECRET_KEY)x,x) +$(error Please define PSK_SECRET_KEY) +endif +PSK_BINARY_KEY:=$(shell echo $(PSK_SECRET_KEY) | sed -e 's.\([0-9A-F][0-9A-F]\).0x\1 .g' -e 's. 0x.,0x.g') + +$(CONTIKI_PROJECT).co: CFLAGS += '-DIDENTITY="$(PSK_IDENTITY)"' '-DSECRET_KEY="$(PSK_SECRET_KEY)"' '-DBINARY_KEY=$(PSK_BINARY_KEY)' + +APPS += awa-lwm2m +APPS += tinydtls/aes tinydtls/sha2 tinydtls/ecc tinydtls + +CONTIKI_WITH_IPV6 = 1 +CONTIKI_WITH_RPL = 0 +RESOLV_CONF_SUPPORTS_MDNS = 0 +UIP_CONF_TCP = 1 +TINYDTLS = 1 +USE_SERIAL_PADS = 0 + +CFLAGS += -I $(CONTIKI)/platform/$(TARGET) +CFLAGS += -fno-short-double +LDFLAGS += -Wl,--defsym,_min_heap_size=64000 + +SMALL=0 + +all: $(CONTIKI_PROJECT) + +$(CONTIKI_PROJECT).hex: $(CONTIKI_PROJECT) + xc32-bin2hex $(CONTIKI_PROJECT).$(TARGET) + +include $(CONTIKI)/Makefile.include diff --git a/examples/awa-lwm2m/README.md b/examples/awa-lwm2m/README.md new file mode 100644 index 00000000000..81ed242916a --- /dev/null +++ b/examples/awa-lwm2m/README.md @@ -0,0 +1,92 @@ +# AwaBootstrap + +This app is an LWM2M client using Contiki with TinyDTLS. + +By default it will build for a Mikro-Electronica Clicker board. To +build that, you'll need to ensure your build host has the relevant +tools installed. This is usually built from an ubuntu host. + +## Running under Docker + +The app can also be built to run on a linux host, and can be built +and run under Docker. The only requirement for this is to have +docker v1.12 (or better) and docker-compose v1.9.0 (or better) installed. +The included [`docker-compose.yml`](docker-compose.yml) has +NAT64 (tayga) and DNS64 (totd) pre-configured. See +[github.com/CreatorDev/docker-nat64](https://github.com/CreatorDev/docker-nat64) +for more details on this setup. + +Edit [`docker-compose.yml`](docker-compose.yml) to set your `PSK_IDENTITY` +and `PSK_SECRET_KEY`. Then: + + $ docker-compose up -d + $ docker exec -ti awabootstrap_contiki_1 bash + +Inside container, first try pinging an IPv4 host by name. You'll get +back an IPv6 address and the pings should work. + + # ping6 deviceserver.creatordev.io + +Then build it: + + # cd /build + # make + # ./awa-lwm2m.minimal-net + +## Debugging + +You can also debug this from your development workstation using vscode. The [`launch.json`](.vscode/launch.json) +file in this repo contains most of what you need, but you'll need to fill in the +following for your system: + +| launch.json entry | description | +|---|---| +| `configurations.ssh.host` | a hostname or IP address for your docker host | +| `configurations.ssh.password` | the root password for the container - see below| + +The root password is set to a random password on first boot. You can see this +from the docker host by checking the docker logs - run the following on your +docker host: + + $ docker logs awalwm2m_contiki_1 | grep PASS + +Also, make sure you've installed the ["recommended"](https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions) +vscode extensions. + +Once that's all in place, you should be able to run this executable just by hitting +`F5` inside vscode. See also the [other default keyboard shortcuts](https://code.visualstudio.com/docs/customization/keybindings#_debug). + +## IPv6 and Contiki for the uninitiated + +- RPL is the IPv6 meshing protocol. It can be disabled in Contiki with + + CFLAGS += -DUIP_CONF_IPV6_RPL=0 + +- Contiki uses [RFC4862](https://tools.ietf.org/search/rfc4862), + "IPv6 Stateless Address Autoconfiguration" + +- To discover all IP addresses + + ping6 [ -Ieth0 ] ff02::1 + +## Debug (**_More!_**) + +- Uncomment the following line from [`Makefile`](Makefile): + + #CFLAGS += -DVERBOSE_DEBUG=1 -DDEBUG=1 + +- To get debug from TinyDTLS, edit the end of [`Makefile.tinydtls`](tinydtls/tinydtls/Makefile.tinydtls) + as follows: + + # This activates debugging support + #CFLAGS += -DNDEBUG + tinydtls_src += dtls_debug.c + +- To get some more debug from the Contiki IP stack, you might want to set DEBUG + in the following source files: + + //#define DEBUG DEBUG_NONE + #define DEBUG DEBUG_FULL + + - [core/net/ipv6/uip-ds6.c](https://github.com/CreatorDev/contiki/blob/b0390e3/core/net/ipv6/uip-ds6.c#L53) + - [core/net/ipv6/uip-ds6-route.c](https://github.com/CreatorDev/contiki/blob/b0390e3/core/net/ipv6/uip-ds6-route.c#L76) diff --git a/examples/awa-lwm2m/awa-lwm2m.c b/examples/awa-lwm2m/awa-lwm2m.c new file mode 100644 index 00000000000..f6fcb71a484 --- /dev/null +++ b/examples/awa-lwm2m/awa-lwm2m.c @@ -0,0 +1,284 @@ +#include +#include +#include +#include "contiki.h" +#include "contiki-net.h" +#include "awa/static.h" + +#ifdef CONTIKI_TARGET_MINIMAL_NET +#include +#endif + +// minimal-net didn't seem to include this by default +#ifdef PROJECT_CONF_H +#include PROJECT_CONF_H +#endif /* PROJECT_CONF_H */ + +#define FREQ_OBJID 27000 +#define FREQ_VALUE 5700 +#define FREQ_UNITS 5701 +#define FREQ_MEASURED_MIN 5601 +#define FREQ_MEASURED_MAX 5602 +#define FREQ_RANGE_MIN 5603 +#define FREQ_RANGE_MAX 5604 +#define FREQ_RESET 5605 +#define FREQ_CALIBRATION 5821 +#define FREQ_APP_TYPE 5750 + +#define FREQ_INSTANCES 1 + +typedef struct +{ + AwaFloat value; + AwaFloat units; + AwaFloat measured_max; + AwaFloat measured_min; + AwaFloat range_max; + AwaFloat range_min; + char calibration[64]; + char app_type[64]; + +} FrequencyObject; + +static FrequencyObject freq_obj[FREQ_INSTANCES]; + + +AwaResult handler(AwaStaticClient * client, AwaOperation operation, AwaObjectID objectID, + AwaObjectInstanceID objectInstanceID, AwaResourceID resourceID, AwaResourceInstanceID resourceInstanceID, + void ** dataPointer, size_t * dataSize, bool * changed) +{ + AwaResult result = AwaResult_InternalError; + printf("handler called. operation = %d \n", operation); + if ((objectID == FREQ_OBJID) && (objectInstanceID >= 0) && (objectInstanceID < FREQ_INSTANCES)) + { + switch (operation) + { + case AwaOperation_CreateObjectInstance: + case AwaOperation_CreateResource: + { + result = AwaResult_SuccessCreated; + break; + } + case AwaOperation_Read: + case AwaOperation_Write: + { + printf("operation = %d \n", operation); + + result = AwaResult_SuccessContent; + break; + } + case AwaOperation_Execute: + { + switch (resourceID) + { + case FREQ_RESET: + printf("RESET CALLED!!!\n"); + freq_obj[objectInstanceID].measured_max = 0.0; + freq_obj[objectInstanceID].measured_min = 0.0; + AwaStaticClient_ResourceChanged(client, FREQ_OBJID, 0, FREQ_MEASURED_MAX); + + break; + default: + break; + } + result = AwaResult_Success; + break; + } + default: + break; + } + } + return result; +} + +static void DefineFrequencyObject(AwaStaticClient * awaClient) +{ + int instance; + + AwaStaticClient_DefineObject(awaClient, FREQ_OBJID, "Frequency", 0, FREQ_INSTANCES); + + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_VALUE, "Sensor Value", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_VALUE, &freq_obj[0].value, sizeof(freq_obj[0].value), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_UNITS, "Sensor Units", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_UNITS, &freq_obj[0].units, sizeof(freq_obj[0].units), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_MEASURED_MAX, "Max Measured Value", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_MEASURED_MAX, &freq_obj[0].measured_max, sizeof(freq_obj[0].measured_max), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_MEASURED_MIN, "Min Measured Value", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_MEASURED_MIN, &freq_obj[0].measured_min, sizeof(freq_obj[0].measured_min), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_RANGE_MAX, "Max Range Value", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_RANGE_MAX, &freq_obj[0].range_max, sizeof(freq_obj[0].range_max), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_RANGE_MIN, "Min Range Value", AwaResourceType_Float, 0, 1, AwaResourceOperations_ReadOnly); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_RANGE_MIN, &freq_obj[0].range_min, sizeof(freq_obj[0].range_min), sizeof(freq_obj[0])); + + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_RESET, "Reset Measured Values", AwaResourceType_None, 0, 1, AwaResourceOperations_Execute); + AwaStaticClient_SetResourceOperationHandler(awaClient, FREQ_OBJID, FREQ_RESET, handler); + + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_CALIBRATION, "Calibration", AwaResourceType_String, 0, 1, AwaResourceOperations_ReadWrite); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_CALIBRATION, &freq_obj[0].calibration, sizeof(freq_obj[0].calibration), sizeof(freq_obj[0])); + AwaStaticClient_DefineResource(awaClient, FREQ_OBJID, FREQ_APP_TYPE, "Application Type", AwaResourceType_String, 0, 1, AwaResourceOperations_ReadWrite); + AwaStaticClient_SetResourceStorageWithPointer(awaClient, FREQ_OBJID, FREQ_APP_TYPE, &freq_obj[0].app_type, sizeof(freq_obj[0].app_type), sizeof(freq_obj[0])); + + for (instance=0; instance freq_obj[0].measured_max) ? y : freq_obj[0].measured_max; + freq_obj[0].measured_min = (y < freq_obj[0].measured_min) ? y : freq_obj[0].measured_min; + + AwaStaticClient_ResourceChanged(awaClient, FREQ_OBJID, 0, FREQ_VALUE); + printf("value: %f type: %s\n", freq_obj[0].value, freq_obj[0].app_type); +} + +static void printNameservers(void) +{ + int ns; + for (ns=0 ;; ns++) + { + uip_ipaddr_t *r = uip_nameserver_get(ns); + if (!r) + { + break; + } + printf("******* DNS Resolver: %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x *********\n", + ntohs(r->u16[0]), + ntohs(r->u16[1]), + ntohs(r->u16[2]), + ntohs(r->u16[3]), + ntohs(r->u16[4]), + ntohs(r->u16[5]), + ntohs(r->u16[6]), + ntohs(r->u16[7])); + } +} + + +PROCESS(lwm2m_client, "Awa LWM2M Example Client"); +AUTOSTART_PROCESSES(&lwm2m_client); + +#ifndef IDENTITY +#error Please set the IDENTITY +#endif + +#ifndef SECRET_KEY +#error Please set the SECRET_KEY +#endif + +#ifndef BINARY_KEY +#error Please set the BINARY_KEY +#endif + +static const unsigned char binaryKey[] = {BINARY_KEY}; + +PROCESS_THREAD(lwm2m_client, ev, data) +{ + PROCESS_BEGIN(); + + static AwaStaticClient * awaClient; + + printf("\n"); + printf("uIP buffer: %u\n", UIP_BUFSIZE); + printf("LL header: %u\n", UIP_LLH_LEN); + printf("IP+UDP header: %u\n", UIP_IPUDPH_LEN); + + //printf("%04XIP+UDP header: %u\n", UIP_IPUDPH_LEN); + + awaClient = AwaStaticClient_New(); + + srand(time(NULL)); + int port = 6000 + (rand() % 32768); + + // AwaStaticClient_SetLogLevel(AwaLogLevel_Debug); + AwaStaticClient_SetLogLevel(AwaLogLevel_Verbose); + + AwaStaticClient_SetEndPointName(awaClient, "AwaStaticClient1"); + AwaStaticClient_SetPSK(awaClient, IDENTITY, binaryKey, sizeof(binaryKey)); + AwaStaticClient_SetCoAPListenAddressPort(awaClient, "::", port); + AwaStaticClient_SetBootstrapServerURI(awaClient, "coaps://deviceserver.flowcloud.systems:15684"); + AwaStaticClient_Init(awaClient); + + uip_ipaddr_t ipaddr; + uip_ip6addr(&ipaddr, BOOTSTRAP_IPv6_ADDR1, BOOTSTRAP_IPv6_ADDR2, BOOTSTRAP_IPv6_ADDR3, + BOOTSTRAP_IPv6_ADDR4, BOOTSTRAP_IPv6_ADDR5, BOOTSTRAP_IPv6_ADDR6, BOOTSTRAP_IPv6_ADDR7, + BOOTSTRAP_IPv6_ADDR8); +#ifdef CONTIKI_TARGET_MIKRO_E + uip_ds6_defrt_add(&ipaddr, 0); +#endif + + uip_nameserver_update(&ipaddr, UIP_NAMESERVER_INFINITE_LIFETIME); + +#ifdef CONTIKI_TARGET_MINIMAL_NET +#warning hardcoded tomfoolery here + uip_ip6addr(&ipaddr, 0xfdfd, 0, 0, 0, 0, 0, 0, 1); + uip_ds6_defrt_add(&ipaddr, 0); + + { + char *ipaddradd = "ip address add fdfd::1/64 dev tap0"; + int ret = system(ipaddradd); + (void) ret; + printf("%s\n", ipaddradd); + } + + printNameservers(); +#endif + + DefineFrequencyObject(awaClient); + + static struct etimer et; + + while (1) + { + static int waitTime; + + printf("Running the loop\n"); + waitTime = AwaStaticClient_Process(awaClient); + + UpdateResources(awaClient); + + etimer_set(&et, (2 * waitTime * CLOCK_SECOND) / 1000); + PROCESS_YIELD(); + waitTime = 0; + } + + AwaStaticClient_Free(&awaClient); + + PROCESS_END(); +} diff --git a/examples/awa-lwm2m/docker-compose.yml b/examples/awa-lwm2m/docker-compose.yml new file mode 100644 index 00000000000..c28c98cfd41 --- /dev/null +++ b/examples/awa-lwm2m/docker-compose.yml @@ -0,0 +1,55 @@ +version: '2.1' + +networks: + + gwnet: + ipam: + driver: default + config: + - subnet: 172.30.0.0/16 + ip_range: 172.30.0.0/24 + + clients: + enable_ipv6: true + internal: true + ipam: + driver: default + config: + - subnet: fd30:252e:b4f5::/64 + ip_range: fd30:252e:b4f5:0:1::/80 + - subnet: 172.29.0.0/24 + ip_range: 172.29.0.0/24 + gateway: 172.29.0.1 + +services: + + nat64: + image: creatordev/docker-nat64 + privileged: true + stdin_open: true + networks: + gwnet: + ipv4_address: 172.30.0.2 + clients: + ipv4_address: 172.29.0.2 + + contiki: + build: + context: . + privileged: true + stdin_open: true + environment: + TARGET: minimal-net + PSK_IDENTITY: "" + PSK_SECRET_KEY: "" + networks: + clients: {} + gwnet: {} + working_dir: /build/examples/awa-lwm2m + volumes: + - "../../:/build" + depends_on: + - nat64 + ports: + - '3000:3000' + - '1022:22' diff --git a/examples/awa-lwm2m/docker/lldb.list b/examples/awa-lwm2m/docker/lldb.list new file mode 100644 index 00000000000..d5f02581b9a --- /dev/null +++ b/examples/awa-lwm2m/docker/lldb.list @@ -0,0 +1,2 @@ +deb http://apt.llvm.org/wily/ llvm-toolchain-wily-4.0 main +deb-src http://apt.llvm.org/wily/ llvm-toolchain-wily-4.0 main \ No newline at end of file diff --git a/examples/awa-lwm2m/docker/run.sh b/examples/awa-lwm2m/docker/run.sh new file mode 100644 index 00000000000..53fe9aaf9ea --- /dev/null +++ b/examples/awa-lwm2m/docker/run.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +ip route del default +ip route add default via 172.30.0.1 dev eth0 +ip -6 route del default +ip -6 route add default via $IPV6_GATEWAY dev eth1 + +# run sshd +sed -i 's,^PermitRootLogin.*$,PermitRootLogin yes,g' /etc/ssh/sshd_config +mkdir /var/run/sshd +/usr/sbin/sshd +if [ ! -f /.pwgen ]; then + PASS=$(pwgen 10 1) + echo PASS $PASS + echo -e "$PASS\n$PASS" | passwd + touch /.pwgen +fi + +exec "$@" \ No newline at end of file diff --git a/examples/awa-lwm2m/objectDefinitiion27000.xml b/examples/awa-lwm2m/objectDefinitiion27000.xml new file mode 100644 index 00000000000..6e1f80ca90c --- /dev/null +++ b/examples/awa-lwm2m/objectDefinitiion27000.xml @@ -0,0 +1,87 @@ +27000 +Frequency +application/vnd.oma.lwm2m.x:27000 +Frequency object +Frequency +true +n + 5700 + value + Float + false + true + Read + value + + + 5701 + units + Float + false + false + Read + units + + + 5601 + measured min + Float + false + false + Read + measuredmin + + + 5602 + measured max + Float + false + false + Read + measuredmax + + + 5603 + range min + Float + false + false + Read + rangemin + + + 5604 + range max + Float + false + false + Read + rangemax + + + 5605 + reset + NotSet + false + false + Execute + reset + + + 5821 + calibration + String + false + false + ReadWrite + calibration + + + 5750 + type + String + false + false + ReadWrite + type + \ No newline at end of file diff --git a/examples/awa-lwm2m/project-conf-minimal-net.h b/examples/awa-lwm2m/project-conf-minimal-net.h new file mode 100644 index 00000000000..faa8c496da9 --- /dev/null +++ b/examples/awa-lwm2m/project-conf-minimal-net.h @@ -0,0 +1,84 @@ +/** + * @file + * LightWeightM2M Project Config. + * + * @author Imagination Technologies + * + * @copyright Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group + * companies and/or licensors. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PROJECT_LWM2M_CONF_H__ +#define __PROJECT_LWM2M_CONF_H__ + +// defined by platform/minimal-net/contiki-conf.h +//#define UIP_CONF_TCP 0 /* Disabling TCP on CoAP nodes. */ + +/* Increase rpl-border-router IP-buffer when using more than 64. */ +#define REST_MAX_CHUNK_SIZE 512 + +/* Estimate your header size, especially when using Proxy-Uri. */ +/* + #define COAP_MAX_HEADER_SIZE 70 + */ + +/* Multiplies with chunk size, be aware of memory constraints. */ +#undef COAP_MAX_OPEN_TRANSACTIONS +#define COAP_MAX_OPEN_TRANSACTIONS 4 + +/* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ +/* + #define COAP_MAX_OBSERVERS 2 + */ + +/* Filtering .well-known/core per query can be disabled to save space. */ +#define COAP_LINK_FORMAT_FILTERING 0 +#define COAP_PROXY_OPTION_PROCESSING 0 + +/* Enable client-side support for COAP observe */ +#define COAP_OBSERVE_CLIENT 1 + +#define UIP_CONF_BUFFER_SIZE 4096 + +/* IP address of device */ +// this is not used by minimal-net, only on platform/mikro-e +//#define GLOBAL_IPv6_ADDR + +// this is used as the DNS resolver IP +#define BOOTSTRAP_IPv6_ADDR1 0xfd30 +#define BOOTSTRAP_IPv6_ADDR2 0x252e +#define BOOTSTRAP_IPv6_ADDR3 0xb4f5 +#define BOOTSTRAP_IPv6_ADDR4 0x0 +#define BOOTSTRAP_IPv6_ADDR5 0x1 +#define BOOTSTRAP_IPv6_ADDR6 0x0 +#define BOOTSTRAP_IPv6_ADDR7 0x0 +#define BOOTSTRAP_IPv6_ADDR8 0x1 + +//fd30:252e:b4f5:0:1::1 + +#endif /* __PROJECT_LWM2M_CONF_H__ */ diff --git a/examples/awa-lwm2m/project-conf.h b/examples/awa-lwm2m/project-conf.h new file mode 100644 index 00000000000..626d76b22f3 --- /dev/null +++ b/examples/awa-lwm2m/project-conf.h @@ -0,0 +1,121 @@ +/** + * @file + * LightWeightM2M Project Config. + * + * @author Imagination Technologies + * + * @copyright Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group + * companies and/or licensors. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions + * and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY + * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PROJECT_LWM2M_CONF_H__ +#define __PROJECT_LWM2M_CONF_H__ + +/* Custom channel and PAN ID configuration for your project. */ +/* + #define RF_CHANNEL 26 + #define IEEE802154_CONF_PANID 0xABCD + */ + +/* IP buffer size must match all other hops, in particular the border router. */ +/* + #define UIP_CONF_BUFFER_SIZE 256 + */ + +/* Disabling RDC and CSMA for demo purposes. Core updates often + require more memory. */ +/* For projects, optimize memory and enable RDC and CSMA again. */ +/* Depending upon __USE_CC2520__ or __USE_CA8210__, + this is defined as nullrdc_driver or nullrdc_noframer_driver , + so commenting out from here. + #define NETSTACK_CONF_RDC nullrdc_driver +*/ +/* Disabling TCP on CoAP nodes. */ +#define UIP_CONF_TCP 0 + +/* + #define NETSTACK_CONF_MAC nullmac_driver +*/ + +/* Increase rpl-border-router IP-buffer when using more than 64. */ +#define REST_MAX_CHUNK_SIZE 512 + +/* Estimate your header size, especially when using Proxy-Uri. */ +/* + #define COAP_MAX_HEADER_SIZE 70 + */ + +/* Multiplies with chunk size, be aware of memory constraints. */ +#undef COAP_MAX_OPEN_TRANSACTIONS +#define COAP_MAX_OPEN_TRANSACTIONS 4 + +/* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ +/* + #define COAP_MAX_OBSERVERS 2 + */ + +/* Filtering .well-known/core per query can be disabled to save space. */ +#define COAP_LINK_FORMAT_FILTERING 0 +#define COAP_PROXY_OPTION_PROCESSING 0 + +/* Enable client-side support for COAP observe */ +#define COAP_OBSERVE_CLIENT 1 + +#define UIP_CONF_TCP 0 + +#define UIP_CONF_BUFFER_SIZE 4096 + +/* IP address of device */ +#define GLOBAL_IPv6_ADDR +#define GLOBAL_IPv6_ADDR1 0xfd77 +#define GLOBAL_IPv6_ADDR2 0x9c74 +#define GLOBAL_IPv6_ADDR3 0xddee +#define GLOBAL_IPv6_ADDR4 0xc0e7 +#define GLOBAL_IPv6_ADDR5 0x0 +#define GLOBAL_IPv6_ADDR6 0x0 +#define GLOBAL_IPv6_ADDR7 0x0 +#define GLOBAL_IPv6_ADDR8 0x0 + +#define BOOTSTRAP_IPv6_ADDR1 GLOBAL_IPv6_ADDR1 +#define BOOTSTRAP_IPv6_ADDR2 GLOBAL_IPv6_ADDR2 +#define BOOTSTRAP_IPv6_ADDR3 GLOBAL_IPv6_ADDR3 +#define BOOTSTRAP_IPv6_ADDR4 GLOBAL_IPv6_ADDR4 +#define BOOTSTRAP_IPv6_ADDR5 0x0 +#define BOOTSTRAP_IPv6_ADDR6 0x0 +#define BOOTSTRAP_IPv6_ADDR7 0x0 +#define BOOTSTRAP_IPv6_ADDR8 0x1 + +#define BOOTSTRAP_IPv6_ADDR "fd77:9c74:ddee:c0e7::1" + +/* Enable button press simulation */ +/* + #define BUTTON_PRESS_SIMULATION + #define BUTTON_PRESS_PERIOD 5 + */ + +#endif /* __PROJECT_LWM2M_CONF_H__ */