Comments (1)
Hi,
If the package isn't available in your environment follow the installation instructions at https://libcoap.net/doc/install.html and change runtime/south/platform/x86/Makefile with:
ifeq ($(LIBCOAP),1)
CC_SRC_C += runtime/south/platform/x86/calvinsys/cc_libcoap_client.c
CC_CFLAGS += -DCC_USE_LIBCOAP_CLIENT=1
CC_CFLAGS += -I/usr/local/include/coap2
CC_LDFLAGS += -L/usr/local/lib -lcoap-2
#CC_CFLAGS += $(shell pkg-config --cflags-only-I libcoap-1)
#CC_LDFLAGS += $(shell pkg-config --libs-only-L libcoap-1)
#CC_LIBS += $(shell pkg-config --libs-only-l libcoap-1)
endif
The Coap support in calvin-constrained has not been tested for a while and there was some errors and the library has been updated and I have updated calvin-constrained accordingly, so update the calvin-constrained repo to get the latest changes.
To test it first compile the constrained runtime with support for Coap:
make -f runtime/south/platform/x86/Makefile LIBCOAP=1 CONFIG="runtime/south/platform/x86/cc_config_x86_coap.h"
And to test it locally on the constrained runtime:
- Compile the calvin_scripts/temp_test.calvin script:
cscompiler calvin_scripts/temp_test.calvin
python Tools/json2msgpack.py calvin_scripts/temp_test.json > calvin_scripts/temp_test.msgpack
- Start the constrained runtime with the temp_test script reading from a Coap source with URI coap://127.0.0.1:55654/3303/0/5700 (change it according to your environment):
./calvin_c -a '{"indexed_public": {"node_name": {"name": "constrained"}}}' -p '{"coap": {"actors": {"sensor.Temperature": "io.temperature"}, "capabilities": {"io.temperature": "coap://127.0.0.1:55654/3303/0/5700"}}}' -s calvin_scripts/temp_test.msgpack
To run it distributed with only the Coap actor on the constrained runtime:
- Start a calvin-base runtime:
csruntime -n 127.0.0.1 --name base
- Start a calvin-constrained runtime connecting to the base runtime.
./calvin_c -a '{"indexed_public": {"node_name": {"name": "constrained"}}}' -p '{"coap": {"actors": {"sensor.Temperature": "io.temperature"}, "capabilities": {"io.temperature": "coap://127.0.0.1:55654/3303/0/5700"}}}' -u '["calvinip://127.0.0.1:5000"]'
- Deploy a calvin-script that migrates a sensor actor to the constrained runtime:
temp : sensor.Temperature(period=1)
snk : io.Print()
temp.centigrade > snk.token
rule device: node_attr_match(node_name={"name": "constrained"})
apply temp: device
Br Fredrik
from calvin-constrained.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calvin-constrained.