Difference between revisions of "IoTGateway/IoTSuite"
Daniel.hung (talk | contribs) (Created page with "Basically, we refer to [https://github.com/Azure/azure-iot-sdks/blob/master/doc/iotcertification/iot_certification_linux_c/iot_certification_linux_c.md How to certify IoT devi...") |
Daniel.hung (talk | contribs) |
||
Line 1: | Line 1: | ||
− | Basically, we refer to [https://github.com/Azure/azure-iot-sdks/blob/master/doc/iotcertification/iot_certification_linux_c/iot_certification_linux_c.md How to certify IoT devices running Linux with Azure IoT SDK] for IoTSuite test. Here we assume you have done Step 1 already. | + | Basically, we refer to [https://github.com/Azure/azure-iot-sdks/blob/master/doc/iotcertification/iot_certification_linux_c/iot_certification_linux_c.md How to certify IoT devices running Linux with Azure IoT SDK] for IoTSuite test. Here, we assume you have done Step 1 already. |
==Device Explorer== | ==Device Explorer== | ||
Line 25: | Line 25: | ||
===Java=== | ===Java=== | ||
− | '''If you do not try to pass IoTSuite test for Java, you can skip this step.''' | + | '''''If you do not try to pass IoTSuite test for Java, you can skip this step.''''' |
1. Get new meta-java layer from master branch. | 1. Get new meta-java layer from master branch. | ||
Line 59: | Line 59: | ||
$ bitbake fsl-image-qt5 | $ bitbake fsl-image-qt5 | ||
− | ==Run | + | ==Build Samples on Yocto== |
+ | Here, we need to refer to [https://github.com/Azure/azure-iot-sdks/blob/master/doc/get_started/yocto-intel-edison-c.md Run a simple C sample on Intel Edison]. | ||
+ | ===Azure IoT SDK=== | ||
+ | Get the IoTSuite source code. | ||
+ | $ cd ~ | ||
+ | $ git clone https://github.com/Azure/azure-iot-sdks.git -b 2016-01-15 | ||
+ | $ cd azure-iot-sdks/c | ||
+ | $ git clone https://github.com/Azure/azure-c-shared-utility.git | ||
+ | ===Apache Qpid Proton (AMQP)=== | ||
+ | 1. Install Apache Qpid Proton (AMQP) to integrate with the device hub and Event Hubs. | ||
+ | $ ~/azure-iot-sdks/c/build_all/linux/build_proton.sh --install /usr | ||
+ | 2. The above command will fail in some point but we need the part before failure. | ||
+ | |||
+ | 3. Go to file: ''/qpid-proton/proton-c/bindings/CMakeLists.txt'' and edit this file removing "python" from "BINDINGS". | ||
+ | $ vi ~/qpid-proton/proton-c/bindings/CMakeLists.txt | ||
+ | 4. Edit the Build Proton script using following command: | ||
+ | $ vi ~/azure-iot-sdks/c/build_all/linux/build_proton.sh | ||
+ | 5. Remove or comment "sync_proton" line in build_proton.sh, otherwise it will sync again the overwrite your change. | ||
+ | #sync_proton | ||
+ | 6. Run Step 1 again. | ||
+ | ===Paho=== | ||
+ | 1. Create folders | ||
+ | $ mkdir -p /usr/local/bin /usr/local/lib /usr/local/include | ||
+ | 2. Install Paho package | ||
+ | $ ~/azure-iot-sdks/c/build_all/linux/build_paho.sh | ||
+ | ===Build Samples=== | ||
+ | 1. Apply patch to read connection string via '''/home/root/connectionString.conf''' | ||
+ | $ cd ~/azure-iot-sdks | ||
+ | $ patch -p1 < adv_read_connection_string.patch | ||
+ | 2. Build the SDK | ||
+ | $ cd ~/azure-iot-sdks/c/build_all/linux | ||
+ | $ ./build.sh | ||
+ | ==Run Samples on Yocto== | ||
+ | After you build samples successfully, you can find the binary in ~/cmake folder. | ||
+ | |||
+ | Remember to add connection string in /home/root/connectionString.conf. The connection string can be obtained via Device Explorer. | ||
+ | $ vi /home/root/connectionString.conf | ||
+ | HostName=RISCIoTSuite.azure-devices.net;DeviceId=RSB-4410-A1;SharedAccessKey=LOhOGMcBSTx4KEtwA9j5jhtv6w9QQDF63Nf5AuZwhOI= | ||
+ | ===AMQP=== | ||
+ | $ ~/cmake/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp | ||
+ | ===HTTP=== | ||
+ | $ ~/cmake/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http |
Revision as of 08:47, 5 February 2016
Basically, we refer to How to certify IoT devices running Linux with Azure IoT SDK for IoTSuite test. Here, we assume you have done Step 1 already.
Contents
Device Explorer
Follow the Step 2-1, you can download the DeviceExplorer on Windows.
Note: The Device Explorer utility only runs on Windows. On other platforms use the iothub explorer tool.
Our IoT Hub Connection String for Device Explorer:
HostName=RISCIoTSuite.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=h2zpoAztFD4JGUpV/Z0Laue1+3RigDUreb5abaM9qDQ=
Setup Yocto Environment
In Step 3-1, we know we need the following packages, and it requires cmake version 3.0 or higher & gcc version 4.9 or higher.
sudo apt-get install -y curl libcurl4-openssl-dev uuid-dev uuid g++ make cmake git unzip openjdk-7-jre
To install these packages on Yocto, we choose fsl-yocto-3.14.28_1.0.0 (Yocto BSP 1.7) as our base image, because the default gcc version is 4.9.1.
cmake
Because the cmake version in Yocto BSP 1.7 is 2.8.12.2, we have to add a latest one.
1. Get new poky source code from master branch.
git clone git://git.yoctoproject.org/poky
2. Copy the cmake folder to Yocto BSP.
poky/meta/recipes-devtools/cmake
Java
If you do not try to pass IoTSuite test for Java, you can skip this step.
1. Get new meta-java layer from master branch.
git clone git://git.yoctoproject.org/meta-java
2. libstdc++ static is needed on your host to compile icedtea7-native. [1]
3. Modify conf/bblayers.conf (Add meta-java after meta-advantech)
BBLAYERS += " ${BSPDIR}/sources/meta-java "
4. Modify conf/local.conf
# [JDK] # Possible provider: cacao-initial-native and jamvm-initial-native PREFERRED_PROVIDER_virtual/java-initial-native = "cacao-initial-native" # Possible provider: cacao-native and jamvm-native PREFERRED_PROVIDER_virtual/java-native = "jamvm-native" # Optional since there is only one provider for now PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
5. Modify meta-advantech/recipes-fsl/images/fsl-image-adv.inc
IMAGE_INSTALL += "openjdk-7-jre"
6. If you cannot fetch rhino correctly, do this.
$ vim sources/meta-java/recipes-core/rhino/rhino_1.7r4.bb SRC_URI = "\ https://github.com/mozilla/rhino/archive/Rhino1_7R4_RELEASE.zip S = "${WORKDIR}/rhino-Rhino1_7R4_RELEASE" SRC_URI[md5sum] = "1f893577269631703d31e4de9d5dc1f4" SRC_URI[sha256sum] = "860965fc611764745b3a4fc5bd4baac07356a9fedd2ce6642e7bb0bd7ef58d07"
Others
For other packages, we can modify meta-advantech/recipes-fsl/images/fsl-image-adv.inc
IMAGE_INSTALL += " curl curl-dev openssl openssl-dev ossp-uuid ossp-uuid-dev cmake git unzip " IMAGE_INSTALL += " packagegroup-sdk-target ca-certificates-native python-html libssp libssp-dev "
Finally, you can build a new Yotco image for IoTSuite development environment!
$ bitbake fsl-image-qt5
Build Samples on Yocto
Here, we need to refer to Run a simple C sample on Intel Edison.
Azure IoT SDK
Get the IoTSuite source code.
$ cd ~ $ git clone https://github.com/Azure/azure-iot-sdks.git -b 2016-01-15 $ cd azure-iot-sdks/c $ git clone https://github.com/Azure/azure-c-shared-utility.git
Apache Qpid Proton (AMQP)
1. Install Apache Qpid Proton (AMQP) to integrate with the device hub and Event Hubs.
$ ~/azure-iot-sdks/c/build_all/linux/build_proton.sh --install /usr
2. The above command will fail in some point but we need the part before failure.
3. Go to file: /qpid-proton/proton-c/bindings/CMakeLists.txt and edit this file removing "python" from "BINDINGS".
$ vi ~/qpid-proton/proton-c/bindings/CMakeLists.txt
4. Edit the Build Proton script using following command:
$ vi ~/azure-iot-sdks/c/build_all/linux/build_proton.sh
5. Remove or comment "sync_proton" line in build_proton.sh, otherwise it will sync again the overwrite your change.
#sync_proton
6. Run Step 1 again.
Paho
1. Create folders
$ mkdir -p /usr/local/bin /usr/local/lib /usr/local/include
2. Install Paho package
$ ~/azure-iot-sdks/c/build_all/linux/build_paho.sh
Build Samples
1. Apply patch to read connection string via /home/root/connectionString.conf
$ cd ~/azure-iot-sdks $ patch -p1 < adv_read_connection_string.patch
2. Build the SDK
$ cd ~/azure-iot-sdks/c/build_all/linux $ ./build.sh
Run Samples on Yocto
After you build samples successfully, you can find the binary in ~/cmake folder.
Remember to add connection string in /home/root/connectionString.conf. The connection string can be obtained via Device Explorer.
$ vi /home/root/connectionString.conf HostName=RISCIoTSuite.azure-devices.net;DeviceId=RSB-4410-A1;SharedAccessKey=LOhOGMcBSTx4KEtwA9j5jhtv6w9QQDF63Nf5AuZwhOI=
AMQP
$ ~/cmake/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp
HTTP
$ ~/cmake/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http