public class ConnectOptions extends Object
Constructor and Description |
---|
ConnectOptions() |
Modifier and Type | Method and Description |
---|---|
String |
buildMqttClientId()
Build the specific client ID needed to connect to GCP IoT Core MQTT broker.
|
String |
buildServerAddress() |
String |
buildTopic(String subTopic)
Build a topic prefixed with the device set into this builder.
|
char[] |
getJWT()
Build a JSON Web Token suitable for Google Cloud IoT Core communication.
|
String |
getServerHost()
Gets the serverHost.
|
int |
getServerPort()
Gets the serverPort.
|
SSLContext |
getSslContext()
Gets the sslContext.
|
ConnectOptions |
setCloudRegion(String cloudRegion)
Sets the cloudRegion.
|
ConnectOptions |
setDeviceId(String deviceId)
Sets the deviceId.
|
ConnectOptions |
setJWTSessionPeriod(long period) |
ConnectOptions |
setJWTSigner(Signer signer)
Set the signer that will be used to generate the JWT.
|
ConnectOptions |
setProjectId(String projectId)
Sets the projectId.
|
ConnectOptions |
setRegistryId(String registryId)
Sets the registryId.
|
ConnectOptions |
setServerHost(String serverHost)
Sets the serverHost.
|
ConnectOptions |
setServerPort(int serverPort)
Sets the serverPort.
|
ConnectOptions |
setSslContext(SSLContext sslContext)
Sets the sslContext.
|
public String buildMqttClientId()
public String buildServerAddress()
public String buildTopic(String subTopic)
subTopic
- the topic suffix you want to usepublic char[] getJWT() throws JSONException, SignatureException, IllegalArgumentException
JSONException
- when building the JSON part JWT is failingSignatureException
- when the signature has failedIllegalArgumentException
- when fields are not correctpublic String getServerHost()
public int getServerPort()
public SSLContext getSslContext()
public ConnectOptions setCloudRegion(String cloudRegion)
cloudRegion
- the cloudRegion to set.public ConnectOptions setDeviceId(String deviceId)
deviceId
- the deviceId to set.public ConnectOptions setJWTSessionPeriod(long period)
period
- expressed in secondspublic ConnectOptions setJWTSigner(Signer signer)
signer
- a Signer from the signature APIpublic ConnectOptions setProjectId(String projectId)
projectId
- the projectId to set.public ConnectOptions setRegistryId(String registryId)
registryId
- the registryId to set.public ConnectOptions setServerHost(String serverHost)
serverHost
- the serverHost to set.public ConnectOptions setServerPort(int serverPort)
serverPort
- the serverPort to set.public ConnectOptions setSslContext(SSLContext sslContext)
sslContext
- the sslContext to set.