Code Monkey home page Code Monkey logo

mbed-edge-examples's Introduction

Edge Protocol Translator Examples

This repository contains the Protocol Translator examples for the Edge.

pt-example

Pt-example is a basic example of the C-API and pt-client usage.

mqttpt-example

mqttpt-example is an example of a protocol translator that connects to endpoints using MQTT. It can be used without real MQTT hardware using provided Mosquitto MQTT simulator scripts. The endpoints may publish for example temperature and humidity values to Device Management.

NOTE! This requires Eclipse's Mosquitto - see installation info: https://mosquitto.org/download/

blept-example

The blept-example is a protocol translator reference implementation for use with Bluetooth Low Energy (BLE) devices that implement a Bluetooth Low Energy Generic Attributes (GATT) server. It connects to BLE devices and translates their GATT services and characteristics into Open Mobile Alliance (OMA) Lightweight Machine to Machine (LwM2M) Objects and Resources.

simple-js-examples

The simple-js-examples are different from the rest of the examples. Instead of using the provided pt-client library these examples use Edge Core protocol translator and management API directly.

These are examples on how a protocol translator or management API application can be created using Javascript. See the simple-js-examples/README.md for instructions.

c-api-stress-tester

This example tests the robustness and thread safeness of Protocol API C-API interface

Build and run the examples

  1. Directly on Ubuntu 22.04 or 20.04 or
  2. Using Docker.

Using Ubuntu 22.04 or 20.04:

  1. Dependencies

    Following dependencies are needed in the build system.

    • librt
    • libstdc++
    • OPTIONAL for mqttpt-example: libmosquitto

    Install these (using sudo typically):

    sudo apt-get update
    sudo apt-get install build-essential cmake git libc6-dev \
       libmosquitto-dev mosquitto-clients libglib2.0-dev \
       doxygen
    

    NOTE! Mosquitto might not be available directly in your distribution (for example Ubuntu 22.04), see https://mosquitto.org/download/ for more installation information.

  2. Preparing all the sources

    Please run the following to clone and update all the git modules.

    git submodule update --init --recursive
    
  3. Building

    Makefile has options to build any of the pt-examples separately, or all at the same.

    To make all examples without debug information and with default trace level, run

    make build-all-examples
    

    It will build the examples to build/bin directory.

    To make all examples with debug information and debug trace level, run

    make build-all-examples-debug
    

    It will build the examples to build-debug/bin directory.

    To make all examples with ThreadSanitizer and debug trace level, run

    make build-all-examples-sanitize
    

    It will build the examples to build-sanitize/bin directory.

    Running make all will generate build, build-debug and build-sanitize directories.

    Please note following: mqttpt-example will not be built if the libmosquitto is not installed.

    For more examples, see the rules in the Makefile.

  4. Running the examples

    Each of the examples has a README.md file that documents how to run the example.

Using Docker

Before building the docker image, fetch the dependencies:

git submodule update --init --recursive

pt-example

Build:

docker build -t pt-example:latest -f ./Dockerfile.pt-example .

Run:

docker run -v /tmp:/tmp pt-example:latest

simple-js-examples/simple-pt-example

Build:

docker build -t simple-pt-example:latest -f ./Dockerfile.simple-pt-example .

Run in interactive mode:

docker run -v /tmp:/tmp -it simple-pt-example:latest

mbed-edge-examples's People

Contributors

esajaa avatar jannekiiskila avatar jjaakola-arm avatar teetak01 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbed-edge-examples's Issues

How to write Thread/6LowPAN example?

Hi, Does anyone know how to write an example to connect Thread/6LoWPAN endpoint devices to the Edge (i.e. Raspberry Pi?) through nanostack?

Edited: Change from Zigbee to Thread/6LoWPAN

Can't subscribe humidity sensor value

I am trying to evaluate the mqtt example. By following the example docs, I can see the gateway, and MY_DEVICE from the portal. I can also setup the API key and subscribe the temperature value(3303/0/5700) and got notification for the updated temperature value through either the portal or webhook when I run "$ ./mqtt_ep.sh -d MY_DEVICE -t 20.1 -h 67.5". However, I didn't receive any notification for the humidity sensor value which is (3304/0/5700) . In addition, when I issue a get request for the value of 3304/0/5700, I can get the updated value. So it's just subscription doesn't work. By inspecting the code, seems not much difference about the configuration of the two sensors.

Could anybody do a test and validation? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.