GithubHelp home page GithubHelp logo

dutylin / azure_iot_hub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from h7ga40/azure_iot_hub

0.0 1.0 0.0 6.49 MB

Azure IoT Hub with TOPPERS/ASP3 for GR-SAKURA

Home Page: https://dev.toppers.jp/trac_user/contrib/wiki/azure_iot_hub

Makefile 0.22% C 91.59% PLSQL 0.01% Assembly 0.15% C++ 1.10% Pascal 0.03% Ruby 6.55% Objective-C 0.28% Shell 0.01% Perl 0.05%

azure_iot_hub's Introduction

Azure IoT Hub with TOPPERS/ASP3

RTOSのTOPPERS/ASP3を使ったAzure IoT Hub へ接続するAzure IoT Hub Device C SDKを使ったサンプルです。 ターゲットデバイスは、GR-SAKURAで、Ethernet上のHTTPかMQTTで通信します。 MQTTは、mbedTLSを使用した場合に接続できます。

GR-PEACHでも動作確認できています。ベースのソフトにTOPPERS/ASP3版ECNLを使用します。注意点として、「get_time」という関数が「c-utility/adapters/agenttime_mbed.c」に定義されていますが、ベースのソフトにも定義されているので、Azure IoT SDK側の「get_time」関数を「azure_get_time」などにリネームして競合を避ける必要があります。

サンプルを動作させるには、この手順この手順を参照にAzure側にデバイスを追加し、そのデバイスの接続文字列を取得し、ソースコード「app_iothub_client/src/client.c」の以下の個所を書き換える必要があります。

static const char* connectionString = "[device connection string]";

開発環境

ビルドはGCC+Makefileで行います。RX向けGCCはこちらから入手できます。 IDEとしてe² studio V7.4.0を使用しました。 Rubyの実行環境が必要なので、​こちらからダウンロードして、コマンドプロントから実行できるよう、環境変数でパスを通してください。 e² studioのプロジェクトファイルも含まれているので、展開したフォルダをワークスペースとして開き、プロジェクトのインポートをこのフォルダに対して行うことで、取り込むことができます。 開発手順はここにあります。

フォルダ構成

パス 内容 ライセンス
app_iothub_client サンプルプログラム TOPPERS License
asp3_dcre RTOS TOPPERS/ASP3 TOPPERS License
asp3_dcre/tinet TCPプロトコルスタック TINET 1.7 TOPPERS License
asp3_dcre/mbed ​mbed HAL APIの利用と実装 Apache 2.0 License
asp3_dcre/syssvc/tlsf メモリアロケータ tlsf BSD License
azure_iothub Azure IoT Hub Device C SDK (tag 2019-04-11) MIT License
azure_iothub/deps/parson jsonパーサー parson MIT License
azure_iothub/c-utility/adapters TOPPERS向けの実装を追加 TOPPERS License
curl-7.57.0 HTTPクライアントcURL Curl License
musl-1.1.18 標準Cライブラリmusl MIT License
ntshell/fatfs FATファイルシステム FatFs FatFs License
ntshell/ntshell 仮想ターミナル NT-Shell MIT License etc.
ntshell/src Socket API、標準入出力、ファイルディスクリプタ TOPPERS License
wolfssl-3.15.7 SSL/TLS ライブラリ wolfSSL 現在未使用 GPL/商用
mbedtls-2.16.1 SSL/TLS ライブラリ mdebTLS Apache 2.0 License
zlib-1.2.11 圧縮・伸張ライブラリ zlib zlib License

ライセンスは参考のため載せておきました。正確なライセンスは各ソフトウェアのサイトを確認してください。

確認 プロトコル ソフトスタック
✔️ HTTP iothubtransporthttp.c→httpapi_compact.c→tlsio_wolfssl.c→socketio_berkeley.c
✖️ HTTP iothubtransporthttp.c→httpapi_compact.c→tlsio_mbedtls.c→socketio_berkeley.c
✔️ HTTP iothubtransporthttp.c→httpapi_curl.c→Curl+WolfSSL
✖️ HTTP iothubtransporthttp.c→httpapi_curl.c→Curl+mbedSSL
✖️ MQTT iothubtransportmqtt.c→wsio.c→umqtt→tlsio_wolfssl.c→socketio_berkeley.c
✔️ MQTT iothubtransportmqtt.c→wsio.c→umqtt→tlsio_mbedtls.c→socketio_berkeley.c
✖️ MQTT over WebSocket iothubtransportmqtt_websockets.c→wsio.c→umqtt→tlsio_wolfssl.c→socketio_berkeley.c
✔️ MQTT over WebSocket iothubtransportmqtt_websockets.c→wsio.c→umqtt→tlsio_mbedtls.c→socketio_berkeley.c
AMQP
AMQP over WebSocket

デフォルトでは、「MQTT/mbedTLS」が有効になっています。

wolfSSLに変更するには

app_iothub_client\Debug\Makefile(60)

$(SRCDIR)/../mbedtls-2.16.1/Debug/libmbedtls.a \

$(SRCDIR)/../wolfssl-3.15.7/Debug/libwolfssl.a \

に変更。

「azure_iothub」プロジェクトのコンパイルオプションに、「USE_WOLFSSL=1」を指定

azure_iothub/c-utility/adapters/platform_toppers.c(55)

return tlsio_mbedtls_get_interface_description();

return tlsio_wolfssl_get_interface_description();

に変更。

curl-7.57.0/lib/curl_config.h(930)

/* #undef USE_CYASSL */

#define USE_CYASSL 1

に変更。

curl-7.57.0/lib/curl_config.h(954)

#define USE_MBEDTLS 1

/* #undef USE_MBEDTLS */

に変更。

TOPPERS License

TOPPERS Licenseは、BSDライクなライセンスです。詳しくは、下記のサイトを見てください。

https://www.toppers.jp/license.html

azure_iot_hub's People

Contributors

h7ga40 avatar

Watchers

James Cloos avatar

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.