public class ConnectOptions
extends java.lang.Object
Constructor and Description |
---|
ConnectOptions() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
buildMqttClientId()
Build the specific client ID needed to connect to GCP IoT Core MQTT broker.
|
java.lang.String |
buildServerAddress() |
java.lang.String |
buildTopic(java.lang.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.
|
java.lang.String |
getServerHost()
Gets the serverHost.
|
int |
getServerPort()
Gets the serverPort.
|
javax.net.ssl.SSLContext |
getSslContext()
Gets the sslContext.
|
ConnectOptions |
setCloudRegion(java.lang.String cloudRegion)
Sets the cloudRegion.
|
ConnectOptions |
setDeviceId(java.lang.String deviceId)
Sets the deviceId.
|
ConnectOptions |
setJWTSessionPeriod(long period) |
ConnectOptions |
setJWTSigner(com.microej.signature.Signer signer)
Set the signer that will be used to generate the JWT.
|
ConnectOptions |
setProjectId(java.lang.String projectId)
Sets the projectId.
|
ConnectOptions |
setRegistryId(java.lang.String registryId)
Sets the registryId.
|
ConnectOptions |
setServerHost(java.lang.String serverHost)
Sets the serverHost.
|
ConnectOptions |
setServerPort(int serverPort)
Sets the serverPort.
|
ConnectOptions |
setSslContext(javax.net.ssl.SSLContext sslContext)
Sets the sslContext.
|
public java.lang.String getServerHost()
public ConnectOptions setServerHost(java.lang.String serverHost)
serverHost
- the serverHost to set.public int getServerPort()
public ConnectOptions setServerPort(int serverPort)
serverPort
- the serverPort to set.public ConnectOptions setProjectId(java.lang.String projectId)
projectId
- the projectId to set.public ConnectOptions setCloudRegion(java.lang.String cloudRegion)
cloudRegion
- the cloudRegion to set.public ConnectOptions setRegistryId(java.lang.String registryId)
registryId
- the registryId to set.public ConnectOptions setDeviceId(java.lang.String deviceId)
deviceId
- the deviceId to set.public javax.net.ssl.SSLContext getSslContext()
public ConnectOptions setSslContext(javax.net.ssl.SSLContext sslContext)
sslContext
- the sslContext to set.public ConnectOptions setJWTSessionPeriod(long period)
period
- expressed in secondspublic ConnectOptions setJWTSigner(com.microej.signature.Signer signer)
signer
- a Signer from the signature APIpublic char[] getJWT() throws org.json.me.JSONException, com.microej.signature.SignatureException, java.lang.IllegalArgumentException
org.json.me.JSONException
- when building the JSON part JWT is failingcom.microej.signature.SignatureException
- when the signature has failedjava.lang.IllegalArgumentException
- when fields are not correctpublic java.lang.String buildServerAddress()
public java.lang.String buildMqttClientId()
public java.lang.String buildTopic(java.lang.String subTopic)
subTopic
- the topic suffix you want to use