public class IoTizeDevice
extends java.lang.Object
Connect to IoTize device and execute commands
You can setup different communication protocol @see ComProtocol
Modifier and Type | Class and Description |
---|---|
class |
IoTizeDevice.Meta |
Modifier and Type | Field and Description |
---|---|
IoTizeDeviceServices |
service |
Modifier and Type | Method and Description |
---|---|
void |
addAuthStateListener(DeviceAuth.AuthStateListener listener) |
IoTizeDevice |
addConnectionStateChangeListener(ComProtocol.OnConnectionStatusChangeListener onConnectionStatusChangeListener,
boolean noDuplicate)
Add a listener on the connection state
|
<any> |
commands(Call<?>... calls) |
void |
configure(TapConfigurator<IoTizeDevice> configurator) |
void |
connect() |
void |
connectAsync() |
void |
disconnect() |
void |
disconnectAsync() |
void |
enableEncryption(boolean enabled)
Enable or disable frame encryption
If a session key already exists, it will be used.
|
static IoTizeDevice |
fromClient(IoTizeClient client)
Create a new device instance from a Client
|
static IoTizeDevice |
fromProtocol(ComProtocol protocol)
Create a new device instance from a communication protocol
|
java.lang.String |
getAppName() |
java.lang.String |
getAppPath() |
DeviceAuth.AuthState |
getAuthState() |
IoTizeClient |
getClient() |
java.util.Collection<ComProtocol> |
getComProtocols() |
java.lang.String |
getConfigVersion() |
ConnectionState |
getConnectionStatus() |
ComProtocol |
getCurrentProtocol() |
java.lang.String |
getIoTizeFirmwareVersion() |
<T> T |
getMeta(Call<T> call) |
<T> T |
getMeta(java.lang.String metaId) |
java.lang.String |
getSerialNumber() |
java.lang.String |
getTag() |
BundleManager |
getTargetBundles() |
VariableManager |
getTargetVariables() |
boolean |
isConfigured() |
boolean |
isConnected() |
boolean |
isEncryptionEnabled() |
boolean |
isUnwantedDisconnection() |
LoginAuthTask |
login(java.lang.String username,
java.lang.String password) |
LogoutAuthTask |
logout() |
<ServiceType> |
service(java.lang.Class<ServiceType> clazz) |
void |
setAuthState(DeviceAuth.AuthState authState)
Change
com.iotize.android.device.api.device.auth.DeviceAuth.AuthState
It will notify listeners |
<T> T |
setMeta(Call<T> call) |
<T> void |
setMeta(java.lang.String metaId,
T body)
Set meta data
|
IoTizeDevice |
setService(IoTizeDeviceServices service) |
IoTizeDevice |
setServiceFactory(ServiceFactory serviceFactory) |
void |
setSessionKey(byte[] sessionKey) |
void |
setTag(java.lang.String tag) |
java.lang.String |
toString() |
void |
useComProtocol(HostProtocol protocol) |
@NonNull public IoTizeDeviceServices service
public <T> void setMeta(java.lang.String metaId, T body)
T
- value typemetaId
- identifierbody
- valuepublic <T> T getMeta(java.lang.String metaId)
public <T> T getMeta(Call<T> call) throws java.lang.Exception
java.lang.Exception
public static IoTizeDevice fromProtocol(ComProtocol protocol)
protocol
- the communication protocol to usepublic static IoTizeDevice fromClient(IoTizeClient client)
client
- the client to use@NonNull public IoTizeDevice setService(@NonNull IoTizeDeviceServices service)
public IoTizeDevice setServiceFactory(ServiceFactory serviceFactory)
public <ServiceType> ServiceType service(java.lang.Class<ServiceType> clazz) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void disconnect() throws java.lang.Exception
java.lang.Exception
public void connect() throws java.lang.Exception
java.lang.Exception
public void addAuthStateListener(DeviceAuth.AuthStateListener listener)
public void setTag(java.lang.String tag)
@NonNull public IoTizeClient getClient()
public java.lang.String getTag()
public java.lang.String getAppName()
public java.lang.String getSerialNumber()
public java.lang.String getAppPath()
public java.lang.String getIoTizeFirmwareVersion()
public java.lang.String getConfigVersion()
public <T> T setMeta(Call<T> call) throws java.lang.Exception
java.lang.Exception
public ComProtocol getCurrentProtocol()
@NonNull public java.util.Collection<ComProtocol> getComProtocols()
public void useComProtocol(HostProtocol protocol)
public ConnectionState getConnectionStatus()
@NonNull public LoginAuthTask login(java.lang.String username, java.lang.String password)
@NonNull public LogoutAuthTask logout()
@NonNull public VariableManager getTargetVariables()
@NonNull public BundleManager getTargetBundles()
public void configure(@NonNull TapConfigurator<IoTizeDevice> configurator)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isConnected()
public void connectAsync()
public void disconnectAsync()
public boolean isEncryptionEnabled()
public void enableEncryption(boolean enabled) throws java.lang.Exception
If a session key already exists, it will be used.
To make sure to start a new session, you can first force session key to null with setSessionKey(byte[])
enabled
- true to enablejava.lang.Exception
- if encryption cannot enable or disable@NonNull public DeviceAuth.AuthState getAuthState()
public void setAuthState(@NonNull DeviceAuth.AuthState authState)
com.iotize.android.device.api.device.auth.DeviceAuth.AuthState
It will notify listenersauthState
- the new auth state@NonNull public IoTizeDevice addConnectionStateChangeListener(ComProtocol.OnConnectionStatusChangeListener onConnectionStatusChangeListener, boolean noDuplicate)
onConnectionStatusChangeListener
- the listenernoDuplicate
- true if we only add the listener ONCE at max. (You should implement equals method in the listener)public void setSessionKey(@Nullable byte[] sessionKey)
public <any> commands(Call<?>... calls) throws java.lang.Exception
java.lang.Exception
public boolean isUnwantedDisconnection()
public boolean isConfigured()