Sample Applications
Sample applications provide code that you can use as a starting point when you develop your application.
If you want to change a sample application, you should create your own thing definition and application in Device Cloud. Clone the thing definition for the sample you want to change, create a new application, and select the thing definition you created for automatic registration. For more information, see the following:
- Device Cloud Management Portal User's Guide: Cloning a Thing Definition
- Device Cloud Management Portal User's Guide: Creating an Application
C Applications
The corresponding applications and thing definitions for the sample applications may exist when your organization is created. If not, run the setup-cloud-deps.py script located in the share/admin-tools directory after you download the source code from the GitHub repository.
The following C code samples are available on Ubuntu and VxWorks 7:
- iot-app-simple-actions
-
Registers three methods.
Thing definition: hdc_simple_actions_clib_def
Application name: hdc_simple_actions_clib_app
- iot-app-simple-location
-
Registers location telemetry and a method to start and stop transmitting location telemetry data.
Thing definition: hdc_simple_location_clib_def
Application name: hdc_simple_location_clib_app
- iot-app-simple-telemetry
-
Registers 13 telemetry metrics and a method to start and stop transmitting telemetry data.
Thing definition: hdc_simple_telemetry_clib_def
Application name: hdc_simple_telemetry_clib_app
Source code is available in the share/apps directory after you download the source code from the GitHub repository.
After you build the source on Ubuntu, the binaries are available in the buildDir/bin directory.
After you run make install on Ubuntu, the binaries are available in the /usr/local/bin directory.
Python Applications
Sample applications for Python are located as follows:
-
in the demo directory after you download the source code from the GitHub repository
-
in the /usr/local/share/device_cloud/demo directory on Linux and the pythonInstallDir\share\device_cloud\demo directory on Windows after you install the agent from the Python PyPI repository
The corresponding applications and thing definitions for the sample applications may exist when your organization is created. If not, run the setup-cloud-deps.py script located as follows:
-
in the share/admin-tools directory after you download the source code from the GitHub repository
-
in the /usr/local/share/device_cloud/share/admin-tools directory on Linux and the pythonInstallDir\share\device_cloud\share\admin-tools directory on Windows after you install the agent from the Python PyPI repository
- iot-simple-actions.py
-
Registers four methods.
Thing definition: hdc_simple_actions_def
Application name: hdc_simple_actions_app
- iot-simple-location
-
Generates and transmits random sample location data and registers a method to start and stop transmitting data.
Thing definition: hdc_simple_location_def
Application name: hdc_simple_location_app
- iot-simple-telemetry
-
Generates and transmits two sample properties with random values, sends when data transmission starts and stops, and registers a method to start and stop transmitting data.
Thing definition: hdc_simple_telemetry_def
Application name: hdc_simple_telemetry_app
For an example of how to run applications in Linux as a service, see the share/readme.md file.