You can publish cloud-hosted drivers or built-in drivers. Built-in drivers are deployed on gateways. If you want to host drivers on the cloud, you can upload driver files to the Drivers page of the IoT Platform console. This topic describes how to publish cloud-hosted drivers.
- Log on to the IoT Platform console. In the left-side navigation pane, choose .
- On the Drivers page, click the Custom Drivers tab. On this tab, click Create Driver.
- On the Create Driver page, specify the parameters as prompted.
- Driver Information
Table 1. Parameters Parameter Description Driver Name The name of the custom driver. The name must be 1 to 20 characters in length, and can contain letters, digits, and underscores (_). The name must start with a letter. Communication Protocol The communications protocol that is used to develop the driver. The valid values are Modbus, OPCUA, and Custom. Language The programming language that is used to develop the driver. The valid values are Node.js 8, Python 3.5, C, and Java 8.
If you select C, then you must also select the CPU Architecture of the driver.
Built-in Driver Specifies whether to use the built-in driver.
- If you select Yes, a local built-in driver is used. You do not need to upload a driver file. For more information, see Publish built-in drivers.
- If you select No, you must upload a driver file and deploy the driver to the cloud.
If you want to publish drivers to the cloud, you must select No.
Driver File The driver file. If you select No for Built-in Driver, click Upload File to upload your driver file.Note You can upload only a .zip driver file, and the size of the driver file cannot exceed 50 MB. Driver Version The version number of the driver. You cannot specify two identical version numbers for a driver. Link IoT Edge Version for the Driver The Link IoT Edge version that supports the driver. The driver can run only in the gateways for Link IoT Edge of the specified version or later. Version Description Optional. The description of the driver version.
- Driver Configurations
Table 2. Parameters Parameter Description Configuration Format The configuration method. Valid values:
- Key-value Configuration
- JSON Format
- Configuration File
Configuration Format (Key-value Configuration) If you select Key-value Configuration, click Add Configuration on the Driver Configurations page. Then, specify the Configuration Name, Value, and Description parameters.
You can add a maximum of 100 key-value pairs.
Configuration Format (JSON Format) If you select JSON Format, enter the JSON-formatted data to configure the driver. The data size cannot exceed 1 KB. Link IoT Edge automatically verifies the format. If the format is invalid, modify the data as prompted. Configuration Format (Configuration File) If you select Configuration File, edit a local configuration file and upload it to the console.
- Container Configurations
Table 3. Parameters Parameter Description Host Mode Specifies whether to isolate the container network from the host network. The valid values are described as follows:
- Yes: This value indicates that the container network is the same as the host network.
- No: This value indicates that the container network is isolated from the host network. If you select this option, you must configure the Network Port Mapping settings.
Network Port Mapping The mappings between host network ports and container network ports. This parameter is available only when Host Mode is set to No. The network where the function runs is isolated from the host network. You can map the listening port of the function in the container to a host network port. This allows client programs on various hosts to access the services that are provided by the function. You can specify a maximum of 10 entries.
For example, the
fc-http-serverfunction runs in a host container, and provides services by using socket port 80. The client programs on other hosts cannot access the
fc-http-serverfunction by accessing port 80 on the current host. To enable the client programs on other hosts to access the
fc-http-serverfunction, you must map the network port (port 80) in the container where the function runs to a host network port, such as port 8080. Then, the client programs on other hosts can access the
IP address:port 8080in the host network, and use the services provided by the
Specifies whether to enable the privilege mode. Root users of containers can access host services only as general users. If you want to change the system time or run the mount command in containers, you must be granted the required root permissions. In this scenario, you must enable the privilege mode for the containers.Note If you enable the privilege mode, applications and programs in the containers are granted the host root permissions, and all the host devices are mapped to the containers. Therefore, you do not need to configure the Device Mapping settings.
Device Mapping The device mappings. This parameter is available only when you select No for Privilege Mode. The network where the device management system resides is isolated from the host network. To enable a function to access a host device such as a serial interface, you must map the device to the container where the function runs. You can specify a maximum of 10 entries. Volume Mapping The volume mappings. The network where the file system resides is isolated from the host network. To enable a function to access a host file, you must map the file to the container where the function runs. You can specify a maximum of 10 entries.
- Configuration Verification
Table 4. Parameters Parameter Description Driver Configurations If you select the check box, you must complete driver configurations before you can deploy the edge instance. The driver configurations are specified after the driver is assigned to an edge instance and sub-devices are assigned to the driver. Device Configurations If you select the check box, you must complete device configurations before you can deploy the edge instance. The device configurations are specified after the driver is assigned to an edge instance and sub-devices are assigned to the driver.
- Driver Information
- Click Confirm. You can find the driver that has been created on the Custom Drivers tab.
What to do next
- On the Custom Drivers tab of the Drivers page, click Version Management in the Actions column.
- On the Version Management page, manage the driver versions. The following table lists the available actions.
Action Description Create Version Click Create Version to create a new version of the driver. For more information, see Configure driver parameters in this topic. Publish Click Publish to publish the specified version. In the Publish Driver dialog box, confirm the driver information, and click Publish.Note After the version of the driver is published, you cannot delete the version of the driver. You can only view the version details or download the version of the driver. Edit Click Edit to edit the driver configurations. For more information about driver configurations, see Configure driver parameters in this topic. You can edit the driver configurations only when the driver version is in the Unpublished state. Download Click Download to download the specified version of the driver. Delete Click Delete to delete the specified version of the driver. You can delete a driver version only when the driver version is in the Unpublished state. View Click View to view the driver version details or modify the configurations of the driver version. For more information, see Configure driver parameters in this topic. You can view the driver version details only when the driver version is in the Published state.
- Assign the driver that has been published to the cloud to an edge instance, and assign sub-devices to the driver. Then, you can deploy the driver and its sub-devices to the edge services by deploying the edge instance. For more information, see Debug drivers.