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

Procedure

  1. Log on to the Link IoT Edge console. In the left-side navigation pane, click Drivers.
  2. On the Drivers page, click the Custom Drivers tab. On the Custom Drivers tab, click Create Driver.
  3. On the Create Driver page, set the parameters.
    • Driver InformationCreate a driver
      Table 1. Parameters
      ParameterDescription
      Driver NameThe 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.
      LanguageThe 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 DriverSpecifies 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 FileThe 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 VersionThe unique version number of the driver. You cannot specify two identical version numbers for a driver.
      Link IoT Edge Version for the DriverThe 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 DescriptionOptional. The description of the driver version.
    • Driver ConfigurationsPublish drivers to the cloud (driver configurations)
      Table 2. Parameters of driver configurations
      ParameterDescription
      Configuration FormatThe configuration method. Valid values:
      • Key-value Configuration
      • JSON Format
      • Configuration File
      Configuration Format: Key-value ConfigurationIf 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 FormatIf 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 FileIf you select Configuration File, edit a configuration file on your computer and upload it to the Link IoT Edge console.
    • Container ConfigurationsPublish drivers to the cloud (container configurations)
      ParameterDescription
      Host ModeSpecifies 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 MappingThe 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 the fc-http-server function by accessing Port 80 on the current host. To enable the client programs on other hosts to access the fc-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 access IP address:port 8080 on the host network, and use the services provided by the fc-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 MappingThe 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 MappingThe 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 VerificationConfiguration Verification
      Table 3. Parameters
      ParameterDescription
      Driver ConfigurationsIf 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 ConfigurationsIf 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.
  4. 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

  1. On the Custom Drivers tab of the Drivers page, click Version Management in the Actions column.
    Driver version management
  2. In the Version Management panel, you can manage the driver versions. The following table describes the operations that you can perform.
    OperationDescription
    Create VersionClick 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.
    PublishClick 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.
    EditYou 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.
    DownloadClick Download to download the specified version of the driver.
    DeleteYou 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.
    ViewYou 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.
  3. 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.