Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
app-notes:cumulocity-agent [2017/02/10 12:09] – [Add the Cumulocity agent to the SDK] shashaapp-notes:cumulocity-agent [2017/02/10 13:17] – [Build the agent] krepel
Line 2: Line 2:
  
 ==== Download and install the toolchain on your Linux x86 PC ==== ==== Download and install the toolchain on your Linux x86 PC ====
 +To create  the dierectoy and install the toolchain you must be "root".
 <code bash> <code bash>
 #For PowerPC: #For PowerPC:
 wget ftp://share.netmodule.com/router/public/toolchain/netbox-ppc/toolchain-ppc-4.8-linaro-x86_64.tar.bz2 wget ftp://share.netmodule.com/router/public/toolchain/netbox-ppc/toolchain-ppc-4.8-linaro-x86_64.tar.bz2
 +mkdir /opt/toolchain
 tar -xvf toolchain-ppc-4.8-linaro-x86_64.tar.bz2 -C /opt/toolchain tar -xvf toolchain-ppc-4.8-linaro-x86_64.tar.bz2 -C /opt/toolchain
 export PATH=$PATH:/opt/toolchain/bin export PATH=$PATH:/opt/toolchain/bin
Line 25: Line 27:
 ./configure --target=powerpc-openwrt-linux --host=powerpc-openwrt-linux --disable-nls   --disable-debug --disable-ares --enable-shared --enable-static --disable-manual --without-ca-bundle --without-nss --without-libmetalink --without-librtmp --enable-ipv6 --without-axtls --without-cyassl ./configure --target=powerpc-openwrt-linux --host=powerpc-openwrt-linux --disable-nls   --disable-debug --disable-ares --enable-shared --enable-static --disable-manual --without-ca-bundle --without-nss --without-libmetalink --without-librtmp --enable-ipv6 --without-axtls --without-cyassl
 make make
-make install+sudo make install
 </code> </code>
 ==== Download the Cumulocity C/C++ SDK ==== ==== Download the Cumulocity C/C++ SDK ====
 +Cumulocity C++ Library is an asynchronous, event-driven networking library to ease your development for connecting to the Cumulocity cloud. The library uses Cumulocity's self invented SmartREST protocol for M2M communication which targets any device that are capable of running embedded Linux.
 +
 +[[https://bitbucket.org/m2m/cumulocity-sdk-c|More information]]
 +
 +[[https://bitbucket.org/m2m/cumulocity-sdk-c/downloads|Link to download the latest version]]
 <code bash>wget https://bitbucket.org/m2m/cumulocity-sdk-c/get/d627781f3afa.zip <code bash>wget https://bitbucket.org/m2m/cumulocity-sdk-c/get/d627781f3afa.zip
 unzip d627781f3afa.zip unzip d627781f3afa.zip
Line 44: Line 51:
 cp Makefile.template Makefile cp Makefile.template Makefile
 </code> </code>
-==== Add the Cumulocity agent to the SDK ====+==== Add the NetModule Cumulocity agent to the Cumulocity SDK ====
 Download the NetModule Cumulocity agent:{{:app-notes:netmodulecumulocityagent.tar.gz|}} Download the NetModule Cumulocity agent:{{:app-notes:netmodulecumulocityagent.tar.gz|}}
 <code bash> <code bash>
-tar xvf netmoduleCumulocityAgent.tar+tar -xvzf netmodulecumulocityagent.tar.gz
 cd netmoduleCumulocityAgent cd netmoduleCumulocityAgent
 </code> </code>
 Move the content of **src** and **include** folders to the **src** and **include** folders of the SDK. Move the content of **src** and **include** folders to the **src** and **include** folders of the SDK.
 <code bash> <code bash>
-cp src/* sdk_folder/src/ +cp src/* m2m-cumulocity-sdk-c-d627781f3afa/src/ 
-cp include/sdk_folder/include/+cp include/m2m-cumulocity-sdk-c-d627781f3afa/include/
 </code> </code>
-Edit the configfile (c8yAgent.conf) and move it to the router.+Edit the configfile (c8yAgent.conf) and add your cumulocity domain and your credentials path. Move the file to the router.
 <code bash> <code bash>
-scp c8yAgent.conf user@host:etc/c8yAgent.conf+scp c8yAgent.conf <user>@<host>:/etc/c8yAgent.conf
 </code> </code>
-==== You have to take some changes to the SDK ====+==== You have to take some changes to the cumulocity SDK ====
 We have to do this, because the toolchain don't support the function **to_string()**. We have to do this, because the toolchain don't support the function **to_string()**.
 include myString.h in the follow files: include myString.h in the follow files:
Line 79: Line 86:
   * src/srnetsocket.cc ---> #include <errno.h>   * src/srnetsocket.cc ---> #include <errno.h>
 ==== Build the agent ==== ==== Build the agent ====
-Now we can build the agent for the target device.+Now we can build the cumulocity SDK for NetModule Agent within the SDK directory.
 <code bash> <code bash>
 export STAGING_DIR=/opt/toolchain export STAGING_DIR=/opt/toolchain
Line 88: Line 95:
 make make
 </code> </code>
-Now go to the **src** folder.+Now go to the **src** folder to build NetModule Agent.
 <code bash> <code bash>
 make make
 </code> </code>
-If all this steps was successful, then we can move the files to the router. We need the **src/main** ans the **srtemplate.txt**. With **scp** we can move it to the router.+If all this steps was successful, then we can move the files to the router. We need the **src/main** and the **srtemplate.txt**. With **scp** we can move it to the router.
 <code bash> <code bash>
-scp main user@host:directory/main+scp main <user>@<host>:<directory>/main
 </code> </code>
 No we can make a SSH connection to the router and start the agent. No we can make a SSH connection to the router and start the agent.