You can publish drivers to the cloud or deploy drivers to gateways. To publish drivers to the cloud and take advantage of managed driver services, you can upload driver packages on the Drivers page in the Link IoT Edge console. This topic describes how to publish drivers to the cloud.
Prerequisites
- A driver is developed. For more information, see Perform driver encoding.
- The driver is compressed into a package. For more information, see Notes for creating a driver package.
Procedure
- Log on to the Link IoT Edge console. In the left-side navigation pane, click Drivers.
- On the Drivers page, click the Custom Drivers tab. On the Custom Drivers tab, click Create Driver.
- On the Create Driver page, set the parameters.
- 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 communication protocol that is used to develop the driver. Valid values: Modbus, OPCUA, and Custom. Language The programming language that is used to develop the driver. Valid values: Node.js 8, Python 3.5, C, and Java 8. If you set the Language parameter to C, you must set the CPU Architecture parameter.
Built-in Driver Specifies whether to use a built-in driver. Valid values: - Yes: A built-in driver is used. You do not need to upload a driver package. For more information, see Publish built-in drivers.
- No: You must upload a driver package and publish the driver to the cloud.
If you need to publish drivers to the cloud, you must set the Built-in Driver parameter to No.
Driver File The driver package. If you set the Built-in Driver parameter to No, click Upload File to upload your driver package. Note You can upload only a .zip driver package, and the size of the driver package cannot exceed 50 MB.Driver Version The unique 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 of driver configurations 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. Then, set the Configuration Name, Value, and Description parameters to configure the driver. You can add a maximum of 100 key-value pairs.
Configuration Format: JSON Format If you select JSON Format, enter 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 JSON-formatted data as prompted. Configuration Format: Configuration File If you select Configuration File, edit a configuration file on your computer and upload it to the Link IoT Edge console. - Container Configurations
Parameter Description Host Mode Specifies whether to isolate the container network from the host network. Valid values: - Yes: The container network is the same as the host network.
- No: The container network is isolated from the host network. If you select this option, you must set the Network Port Mapping parameter.
Network Port Mapping The mappings between host network ports and container network ports. This parameter is available only when you set the Host Mode parameter 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-server
function runs in a host container, and provides services by using Port 80. The client programs on other hosts cannot access thefc-http-server
function by accessing Port 80 on the current host. To enable the client programs on other hosts to access thefc-http-server
function, you must map 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 accessIP address:port 8080
on the host network, and use the services provided by thefc-http-server
function.Privilege Mode Specifies whether to enable the privilege mode. Root users of containers can access host services only as regular users. If you need 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 set the Device Mapping parameter.Device Mapping The device mappings. This parameter is available only when you set the Privilege Mode parameter to No. 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 port, 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 3. Parameters Parameter Description Driver Configurations If you select Driver Configurations, 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 Device Configurations, 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
- After you set the parameters and upload the driver package, click Confirm. You can view the created driver 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.
- In the Version Management panel, you can manage the driver versions. The following table describes the operations that you can perform.
Operation Description Create Version Click Create Version to create a version of the driver. For more information about the configurations and parameters, see Step 3 in the Procedure section of this topic. Publish Click Publish to publish the specified version. In the Publish Driver dialog box, verify 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 You can modify the driver configurations only when the driver version is in the Unpublished state. Click Edit to modify the driver configurations. For more information about the parameters, see Step 3 in the Procedure section of this topic. Download Click Download to download the specified version of the driver. Delete You can delete a driver version only when the driver version is in the Unpublished state. Click Delete to delete the specified version of the driver. View You can view the driver version details only when the driver version is in the Published state. Click View to view the driver version details or modify the configurations of the driver version. For more information about the parameters, see Step 3 in the Procedure section of this topic. - After you publish the driver to the cloud, assign the driver to an edge instance and assign sub-devices to the driver. Then, you can deploy the driver and its sub-devices to the edge by deploying the edge instance. For more information, see Debug drivers.