FAQ about connecting devices using a generic protocol

Updated at:
Copy as MD

This topic describes how to troubleshoot issues that occur when you connect devices using a generic protocol.

Background information

If your devices are connected to your own cloud servers for remote management and data collection, it may not be practical to modify the device firmware to connect to Alibaba Cloud IoT Platform. In this case, you can use the IoT as Bridge SDK to use the features of IoT Platform and add your devices to an IoT Platform-based solution.

For more information about the IoT as Bridge SDK, see What is the cloud-to-cloud integration (formerly IoT as Bridge) SDK. For instructions, see Basic usage.

How do I connect to IoT Platform?

During application initialization, you can create a BridgeBootstrap class object to connect to IoT Platform.
  • Successful connection:

    When you create a BridgeBootstrap object, the SDK automatically connects to the platform. The connection is successful if no exception is thrown.

  • Failed connection:

    The connection fails if a BootException is thrown. You can listen for this exception to detect a connection failure. If an exception occurs, destroy the BridgeBootstrap object. Then, create a new BridgeBootstrap object every 10 seconds to try to reconnect to IoT Platform.

How do I manually disconnect from IoT Platform?

While the application is running, you can call Http2MessageClientFactory.getClient().disconnect() to manually disconnect.

Do I need to monitor for unexpected disconnections from IoT Platform?

You do not need to monitor for unexpected disconnections if your enterprise server is connected to IoT Platform using the SDK. If a disconnection occurs due to issues such as a network failure, the SDK automatically tries to reconnect.

How do I generate device certificates in a batch?

You can call the BatchRegisterDevice API using the SDK that is provided by IoT Platform to generate device certificates in a batch. For more information, see Download cloud SDKs and BatchRegisterDevice.

How do I get sub-device certificates?

  • In the IoT as Bridge SDK demo, device information is stored in DeviceIdentity. The getDeviceIdentity() method of the DeviceConfigManager class retrieves the device certificate based on the specified device ID.

  • In a production environment, re-implement DeviceConfigManager. In the init() method of ConfigFactory, pass your implementation of DeviceConfigManager. Then, use the getDeviceIdentity() method to retrieve device certificates from your database.

How do I associate sub-device certificates with devices?

Follow these steps:

  1. Generate sub-device certificates in a batch and write them to a database.
  2. When a sub-device goes online, check if a certificate is already associated with it.
    • If a certificate is associated, use that certificate to connect to IoT Platform.
    • If no certificate is associated, retrieve an unused certificate from the database and associate it with the device. Then, use the new certificate to connect the sub-device to IoT Platform.

In the IoT as Bridge SDK demo, device certificates are stored in a configuration file. For more information, see Basic usage. This method is not recommended for production environments that have many devices.

Obtain sub-device certificates

How do I bring a device online?

When a device connects to your server, you must call the IoT as Bridge SDK API doOnline() to notify the IoT Platform that the device is online.

How do I take a device offline?

When your server detects that a device has disconnected, you can call the doOffline() API of the IoT as Bridge SDK. This notifies IoT Platform that the device is offline.