Network API

Network is the most basic configuration for the gateway to communicate with a device.

As of the gateway V1.1, only the IPv4 configuration is supported. IPv6 will be supported in the future versions.

IP

message IPConfig {
  bool useDHCP; 
  string IPAddr;
  string gateway;
  string subnetMask;
  int32 port; 

  connect.ConnectionMode connectionMode;

  string serverAddr; 
  int32 serverPort;
  int32 SSLServerPort;

  bool useDNS;
  string DNSServer;
  string serverURL;

  int32 MTUSize;
  EthernetBaseband baseband;
}
useDHCP
If true, try to acquire an IP address from DHCP servers. If it is true, IPAddr, gateway, and subnetMask parameters will be automatically set by DHCP.
port
Used only when connectionMode is SERVER_TO_DEVICE. The default is 51211.
connectionMode
SERVER_TO_DEVICE(default) or DEVICE_TO_SERVER. The serverAddr, serverPort, SSLServerPort, useDNS, DNSServer, and serverURL are used only if the connectionMode is DEVICE_TO_SERVER.
serverAddr
The IP address of the device gateway. Please refer to the gateway configuration.
serverPort
The port of the device gateway. The default is 51212.
SSLServerPort
The SSL port of the device gateway. The default is 51213.
useDNS
If it is true, the device will try to acquire the IP address of the gateway from the DNS server. Check if the device supports DNS with CapabilityInfo.DNSSupported.
DNSServer
The IP address of a DNS server.
serverURL
The URL of the device gateway.
enum EthernetBaseband {
  BASEBAND_10BASE_T = 0;
  BASEBAND_100BASE_T = 1;
}

GetIPConfig

Get the IP configuration of a device.

Request
Parameter Type Description
deviceID uint32 The ID of the device
Response
Parameter Type Description
config IPConfig The IP configuration read from the device

SetIPConfig

Set the IP configuration of a device.

Request
Parameter Type Description
deviceID uint32 The ID of the device
config IPConfig The IP configuration to be written to the device

SetIPConfigMulti

Set the IP configurations of multiple devices.

This function should be used only if IPConfig.useDHCP is true for all the devices. Otherwise, you have to use SetIPConfig per device.

Request
Parameter Type Description
deviceIDs uint32[] The ID of the devices
config IPConfig The IP configuration to be written to the devices

WLAN

Check Capability.WLANSupported before using these APIs.

message WLANConfig {
  bool enabled;
  WLANOperationMode opMode;
  WLANAuthType authType;
  WLANEncryptionType encType;

  string ESSID;
  string authKey;
}
enum WLANOperationMode {
  WLAN_OPMODE_MANAGED = 0;
  WLAN_OPMODE_ADHOC = 1;
}

enum WLANAuthType {
  WLAN_AUTH_OPEN = 0;
  WLAN_AUTH_SHARED = 1;
  WLAN_AUTH_WPA_PSK = 2;
  WLAN_AUTH_WPA2_PSK = 3;
}

enum WLANEncryptionType {
  WLAN_ENC_NONE = 0;
  BS2_WLAN_ENC_WEP = 1;
  BS2_WLAN_ENC_TKIP_AES = 2;
  BS2_WLAN_ENC_AES = 3;
  BS2_WLAN_ENC_TKIP = 4;
}

GetWLANConfig

Get the WLAN configuration of a device.

Request
Parameter Type Description
deviceID uint32 The ID of the device
Response
Parameter Type Description
config WLANConfig The WLAN configuration read from the device

SetWLANConfig

Set the WLAN configuration of a device.

Due to a FW issue, only WLANConfig.enabled will be written. To change the other parameters, you have to use the device UI directly.

Request
Parameter Type Description
deviceID uint32 The ID of the device
config WLANConfig The WLAN configuration to be written to the device

SetWLANConfigMulti

Set the WLAN configurations of multiple devices.

Request
Parameter Type Description
deviceIDs uint32[] The IDs of the devices
config WLANConfig The WLAN configuration to be written to the devices