Build the Sample Application
Build the sample telemetry application as a user mode (RTP) or kernel mode (DKM) application.
- Create a DKM or RTP application project based on your VSB project.
-
Add the example telemetry code to your project.
-
Add vsbDir/3pp/HDC_DEVICE_CLOUD_LIB/device_cloud_lib_repo/share/apps/telemetry/telemetry.c.
-
Remove the default C application file from your project.
-
If you do so directly in the file system (outside of Workbench), be sure to refresh your project so that the file changes are registered.
-
-
Please note the key elements of the source code that are
required for all Device Cloud C applications.
-
They must include iot.h.
-
The iot_initilize() call gets the agent library handle to use for future agent API calls. The "telemetry-app" string is the application ID, which the agent library will combine with the device ID to create the unique thing key for the application at runtime.
iot_lib = iot_initialize( "telemetry-app", NULL, 0 );
-
The iot_connect() call connects the application with the Device Cloud.
status = iot_connect( iot_lib, 0u );
For more information, see the Device Cloud Device Programmer's Guide: Application Initialization.
-
-
For an RTP application, you must configure your build for
linkage with the required libraries.
- In the Project Explorer, select your project name and then select Properties from the context menu.
- In the Properties dialog, select Build Properties > Tools.
- From the Build tool drop-down list, select Linker.
- Select the Libraries tab.
- Click Add, select Add fully qualified library file, enter the following library options: -liot -losal -lnet -larchive -lHASH -lOPENSSL -lmosquitto -ljson -lzlib -lcurl -lunix.
- Click OK.
- Click Apply and OK.
Note:Remember that when you develop your own Device Cloud RTP applications, you must link with the required libraries (-liot -losal -lnet -larchive -lHASH -lOPENSSL -lmosquitto -ljson -lzlib -lcurl -lunix).
- Build your project.