Generating the Device Manager Connection Configuration File in Linux

The connection configuration file specifies the information to enable an application to connect to Device Cloud.

To enable you to create configuration files in the same directory as the device manager and to enable read and write permission for the device manager to access directories for file transfer, you can copy the agent application and example files to a local directory.

You need the following:

  • your user name, password, and URL for Device Cloud

  • if you connect through a proxy server, proxy configuration information

  • the application and thing definition for the device manager defined in Device Cloud (see Setting Up the Device Cloud Definitions in Linux)

  1. In your browser's address bar, type the URL you were given when you received your Device Cloud account, and then on the Sign In page, type your user name and password in the boxes.
  2. On the LaunchPad, click Development Tools, and then on the Management Portal, click Developer.
  3. On the Developer page, take note of the URL shown in the Endpoints section.

    In the following example, the endpoint is api.devicecloud.windriver.com. Do not include the /api portion of the URL.

    Device Cloud - Management Portal Endpoints Section
  4. On the Developer page on the Management Portal, click Applications, and on the Applications page, click the Copy icon on the right side in the hdc_device_manager_app row to copy the application token to the clipboard.
    Device Cloud - Copy the Application Token Icon
  5. In a terminal window, copy the source code for applications and examples from the Python installation directory to a local directory and run the program to generate the configuration file.
    
    $ cp -R /usr/local/share/device_cloud yourLocalDir/device_cloud 
    $ cd yourLocalDir/device_cloud 
    $ ./generate_config.py
    
  6. Specify the mandatory configuration information.

    For endPoint, specify the endpoint you noted on the Developer page.

    For appToken, paste the token value you copied from the Applications page.

    Use the file name iot-connect.cfg, which is the default connection configuration file for the device manager.

    Generating config. Please enter connection information for the config file.
    
    Name of config file to write (eg. appname-connect.cfg) (Required)
    # iot-connect.cfg
    Cloud host address (Required)
    # endPoint
    Cloud port (eg. 1883/8883/443) (Required)
    # 8883
    Cloud token (Required)
    # appToken
  7. (Optional) Specify proxy information.
    Route all traffic through a proxy (default false) (Optional)
    # true
    
    Proxy type (eg. SOCKS4/SOCKS5/HTTP)
    # HTTP
    
    Proxy host address
    # 192.168.24.23
    
    Proxy port
    # 3128
    
    Proxy username (Optional)
    # iot
    
    Proxy password (Optional)
    # iot

The output shows the generated configuration in JSON format.

Configuration:
{
  "cloud": {
    "host": "api.devicecloud.windriver.com", 
    "port": 8883, 
    "token": "SBAeksRIOdIsGXYB"
  }, 
  "proxy": {
    "host": "192.168.24.23", 
    "password": "iot", 
    "port": 3128, 
    "type": "HTTP", 
    "username": "iot"
  }, 
  "qos_level": 1, 
  "validate_cloud_cert": true
}

Press enter to finish...

The iot-connect.cfg file is created in the yourLocalDir/device_cloud directory and contains the configuration information required to connect the device manager to Device Cloud.