Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0be6f55
Rework TM system and add extension mechanism
JKRhb Apr 11, 2021
bd4d939
Move TD/TM definitions to its own module
JKRhb Apr 17, 2021
fd97b3b
Refactor affordance names
JKRhb Apr 17, 2021
c5bb29c
Remove obsolete code
JKRhb Apr 17, 2021
82a7e0d
Add copyright and license information
JKRhb Apr 18, 2021
b2c1d35
Refactor get statements
JKRhb Apr 18, 2021
cef2e06
Add missing imports
JKRhb Apr 18, 2021
bb81183
Fix type hint for CStruct children
JKRhb Apr 18, 2021
f090e89
Fix signature of _generate_field method
JKRhb Apr 18, 2021
a370e84
Clean up call of parser script
JKRhb Apr 18, 2021
130f7a0
Echo an info message when calling the script
JKRhb Apr 18, 2021
5e553b0
Make placeholders and bindings optional
JKRhb Apr 18, 2021
90fde21
Fix variable name
JKRhb Apr 18, 2021
08148c6
Change name of main function
JKRhb Apr 18, 2021
cfd8865
Skip the WoT TD context in the generation script
JKRhb Apr 18, 2021
0ea3653
Add assertions for security definitions
JKRhb Apr 18, 2021
d807da1
Change info text for no defined security
JKRhb Apr 18, 2021
317fa3b
Make both bindings and meta data optional
JKRhb Apr 18, 2021
80f089a
Rework data structures for generator script
JKRhb Apr 22, 2021
4349f4e
Fix key of "no security" scheme
JKRhb Apr 24, 2021
d372908
Fix assertion of version field
JKRhb Apr 24, 2021
c611c3d
Reformat code
JKRhb Apr 24, 2021
e2c5bce
fixup! Rework data structures for generator script
JKRhb Apr 25, 2021
8987179
sys/net/coap: add WoT TD content format
JKRhb Jun 16, 2021
e9d0842
sys/net/wot: use WoT content format for TD
JKRhb Jun 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,257 changes: 129 additions & 1,128 deletions dist/tools/wot/generate_coap.py

Large diffs are not rendered by default.

386 changes: 386 additions & 0 deletions dist/tools/wot/webofthings.py

Large diffs are not rendered by default.

1,183 changes: 1,183 additions & 0 deletions dist/tools/wot/wot_structs.py

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions makefiles/vars.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,7 @@ export AFL_FLAGS # Additional command-line flags passed to afl durin
# LOG_LEVEL # Logging level as integer (NONE: 0, ERROR: 1, WARNING: 2, INFO: 3, DEBUG: 4, default: 3)
# KCONFIG_ADD_CONFIG # List of .config files to be merged used by Boards and CPUs. See kconfig.mk

export WOT_THING_MODEL
export WOT_INSTANCE_INFO
export WOT_THING_MODELS
export WOT_META_DATA
export WOT_BINDINGS_PATH
export WOT_PLACEHOLDERS_PATH
1 change: 1 addition & 0 deletions sys/include/net/coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ extern "C" {
#define COAP_FORMAT_SENSML_EXI (115)
#define COAP_FORMAT_SENML_XML (310)
#define COAP_FORMAT_SENSML_XML (311)
#define COAP_FORMAT_WOT_TD (432)
/** @} */

/**
Expand Down
2 changes: 1 addition & 1 deletion sys/net/wot/coap/coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static ssize_t _wot_td_coap_handler(coap_pkt_t *pdu, uint8_t *buf, size_t len, v
coap_block2_init(pdu, &_wot_td_coap_slicer);

gcoap_resp_init(pdu, _wot_td_coap_buf, len, COAP_CODE_CONTENT);
coap_opt_add_format(pdu, COAP_FORMAT_JSON);
coap_opt_add_format(pdu, COAP_FORMAT_WOT_TD);
coap_opt_add_block2(pdu, &_wot_td_coap_slicer, 1);
_wot_td_coap_plen = coap_opt_finish(pdu, COAP_OPT_FINISH_PAYLOAD);

Expand Down
7 changes: 4 additions & 3 deletions sys/net/wot/coap_config/Makefile.gensrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
WOT_JSON_FILES = $(APPDIR)/$(WOT_INSTANCE_INFO) $(APPDIR)/$(WOT_THING_MODEL)
WOT_JSON_FILES = $(APPDIR)/$(WOT_META_DATA) $(APPDIR)/$(WOT_BINDINGS_PATH) $(APPDIR)/$(WOT_PLACEHOLDERS_PATH) $(addprefix $(APPDIR)/,$(WOT_THING_MODELS))

$(GENOBJC): $(SRC)

$(SRC): $(GENSRC)

$(GENSRC): $(WOT_JSON_FILES)
mkdir -p $(BINDIR)/$(MODULE) && cd $(BINDIR)/$(MODULE) && \
$(WOT_TD_GEN) --appdir $(APPDIR) --board $(BOARD) --used_modules $(USEMODULE) --thing_model $(WOT_THING_MODEL) --thing_instance_info $(WOT_INSTANCE_INFO) --output_path $(WOT_TD_CONFIG)
@echo "[INFO] Generating WoT CoAP Config under $(WOT_TD_CONFIG)"
@mkdir -p $(BINDIR)/$(MODULE) && cd $(BINDIR)/$(MODULE) && \
$(WOT_TD_GEN) --appdir $(APPDIR) --thing_models $(WOT_THING_MODELS) --meta_data_path $(WOT_META_DATA) --bindings_path $(WOT_BINDINGS_PATH) --placeholders_path $(WOT_PLACEHOLDERS_PATH) --output_path $(WOT_TD_CONFIG)
6 changes: 4 additions & 2 deletions tests/wot_coap_generation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ USEMODULE += wot_coap
USEMODULE += wot_coap_config
USEMODULE += xtimer

WOT_THING_MODEL = config/wot_td/thing_model.json
WOT_INSTANCE_INFO = config/wot_td/instance.json
WOT_THING_MODELS += config/wot_td/thing_model.json
WOT_META_DATA := config/wot_td/meta_data.json
WOT_BINDINGS_PATH := config/wot_td/bindings.json
WOT_PLACEHOLDERS_PATH := config/wot_td/placeholders.json

ifeq ($(BOARD),esp32-wroom-32)
# ESP wifi configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{
"@context": ["https://www.w3.org/2019/wot/td/v1", { "@language": "en" }],
"id": "urn:dev:ops:32473-WoTLamp-1234",
"title": "Lamp Thing",
"titles": {
"en": "Lamp Thing",
"de": "Lampen-Ding"
},
"description": "Lamp Thing Description",
"descriptions": {
"en": "Lamp Thing Description",
"de": "Lampen-Ding-Beschreibung"
},
"properties": {
"status": {
"forms": [
Expand All @@ -19,6 +7,14 @@
"href": "/led/status"
}
]
},
"rememberState": {
"forms": [
{
"riot_os:handler_function": "_led_status_handler",
"href": "{{BASE_TOPIC}}/{{FRIENDLY_NAME}}/set/remember_state"
}
]
}
},
"actions": {
Expand Down
14 changes: 14 additions & 0 deletions tests/wot_coap_generation/config/wot_td/meta_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@context": ["https://www.w3.org/2019/wot/td/v1", { "@language": "en" }],
"id": "urn:dev:ops:32473-WoTLamp-1234",
"title": "Lamp Thing",
"titles": {
"en": "Lamp Thing",
"de": "Lampen-Ding"
},
"description": "Lamp Thing Description",
"descriptions": {
"en": "Lamp Thing Description",
"de": "Lampen-Ding-Beschreibung"
}
}
7 changes: 7 additions & 0 deletions tests/wot_coap_generation/config/wot_td/placeholders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"FRIENDLY_NAME": "smartlight",
"BASE_TOPIC": "zigbee2mqtt",
"MQTT_BROKER_ADDRESS": "localhost",
"MQTT_BROKER_SCHEME": "mqtt",
"IEEE_ADDRESS": "008041aefd7e"
}