Class ConnectionParams
- java.lang.Object
-
- com.google.android.things.iotcore.ConnectionParams
-
public class ConnectionParams extends Object
Stores information necessary to connect a single device to Google Cloud IoT Core: the device's client ID and some MQTT configuration settings.Specifying the device's client ID requires the full specification for the Cloud IoT Core registry in which the device is registered, which includes the device's Google Cloud project ID, the device's Cloud IoT Core registry ID, the registry's cloud region, and the device's ID within the registry. These parameters are set in the
ConnectionParams.Builder
.MQTT configuration settings are not required since ConnectionParams can use sensible defaults, but users can control these settings using
ConnectionParams.Builder.setBridgeHostname(String)
,ConnectionParams.Builder.setBridgePort(int)
, andConnectionParams.Builder.setAuthTokenLifetime(long, TimeUnit)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
ConnectionParams.Builder
Builder for ConnectionParams instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description long
getAuthTokenLifetimeMillis()
Returns the authentication token lifetime in milliseconds specified by these connection parameters.String
getBridgeHostname()
Returns the MQTT bridge hostname specified by these connection parameters.int
getBridgePort()
Returns the MQTT bridge port number specified by these connection parameters.String
getBrokerUrl()
Returns the MQTT broker URL formatted as "ssl://<hostname>:<port>".String
getClientId()
Returns the full path used to identify this device as defined in the device documentation .String
getCloudRegion()
Returns the Cloud Region specified by these connection parameters.String
getConfigurationTopic()
Returns the device configuration topic for this device formatted according to the configuration documentation.String
getDeviceId()
Returns the device ID specified by these connection parameters.String
getDeviceStateTopic()
Returns the device state topic for this device formatted according to the device state documentation.String
getProjectId()
Returns the project ID specified by these connection parameters.String
getRegistryId()
Returns the registry ID specified by these connection parameters.String
getTelemetryTopic()
Returns the telemetry topic for this device formatted according to the telemetry documentation.
-
-
-
Method Detail
-
getProjectId
public String getProjectId()
Returns the project ID specified by these connection parameters.- Returns:
- the project ID
-
getRegistryId
public String getRegistryId()
Returns the registry ID specified by these connection parameters.- Returns:
- the registry ID
-
getDeviceId
public String getDeviceId()
Returns the device ID specified by these connection parameters.- Returns:
- the device ID
-
getCloudRegion
public String getCloudRegion()
Returns the Cloud Region specified by these connection parameters.- Returns:
- the cloud region
-
getBridgeHostname
public String getBridgeHostname()
Returns the MQTT bridge hostname specified by these connection parameters.- Returns:
- the bridge hostname
-
getBridgePort
public int getBridgePort()
Returns the MQTT bridge port number specified by these connection parameters.- Returns:
- the bridge port number
-
getBrokerUrl
public String getBrokerUrl()
Returns the MQTT broker URL formatted as "ssl://<hostname>:<port>".- Returns:
- the broker URL
-
getAuthTokenLifetimeMillis
public long getAuthTokenLifetimeMillis()
Returns the authentication token lifetime in milliseconds specified by these connection parameters.- Returns:
- the authentication token lifetime in milliseconds
-
getClientId
public String getClientId()
Returns the full path used to identify this device as defined in the device documentation .- Returns:
- the Cloud IoT Core client ID specified by these connection parameters
-
getTelemetryTopic
public String getTelemetryTopic()
Returns the telemetry topic for this device formatted according to the telemetry documentation.Strings returned from this method do not end with a trailing slash.
- Returns:
- the telemetry topic specified by these connection parameters
-
getDeviceStateTopic
public String getDeviceStateTopic()
Returns the device state topic for this device formatted according to the device state documentation.Strings returned from this method do not end with a trailing slash.
- Returns:
- the device state topic specified by these connection parameters
-
getConfigurationTopic
public String getConfigurationTopic()
Returns the device configuration topic for this device formatted according to the configuration documentation.Strings returned from this method do not end with a trailing slash.
- Returns:
- the device configuration topic specified by these connection parameters
-
-