public class Device
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
Device(java.lang.String id,
java.lang.String owner,
java.lang.String modelId,
java.lang.String name) |
Device(java.lang.String id,
java.lang.String owner,
java.lang.String modelId,
java.lang.String name,
java.lang.String description) |
Device(java.lang.String id,
java.lang.String modelId,
java.lang.String name,
java.lang.String description,
java.lang.String owner,
java.lang.String firmwareVersion,
java.lang.String externalId,
boolean isPublic,
java.lang.String accountType) |
| Modifier and Type | Method and Description |
|---|---|
rx.Observable<java.lang.Void> |
deleteStateMetadata(java.lang.String key) |
boolean |
equals(java.lang.Object o) |
AggregatedDataHelper |
getAggregatedDataHelper()
Returns device specific
AggregatedDataHelper object. |
java.util.Date |
getCreated() |
java.lang.String |
getDescription() |
rx.Observable<DeviceModel> |
getDeviceModel()
Returns
DeviceModel that defines readings, commands and configurations for
specific device depending on device firmware version. |
java.lang.String |
getExternalId() |
java.lang.String |
getFirmwareVersion() |
java.lang.String |
getId() |
java.lang.String |
getIntegrationType() |
java.lang.String |
getModelId()
Returns ID of
DeviceModel that defines readings, commands and configurations |
java.lang.String |
getName() |
java.lang.String |
getOwner() |
RawDataHelper |
getRawDataHelper()
Returns device specific
AggregatedDataHelper object. |
rx.Observable<StateReadings> |
getReadings()
Returns all latest readings saved in the device state.
|
rx.Observable<StateReadings> |
getReadings(java.lang.String path,
java.lang.String meaning)
Returns latest readings saved in device state optionally filtered with path and meaning
|
java.lang.String |
getSecret() |
rx.Observable<State> |
getState()
Returns whole state with all latest readings, configurations, commands and metadata for device.
|
rx.Observable<StateCommands> |
getStateCommands()
Returns all latest commands saved in device state.
|
rx.Observable<StateCommands> |
getStateCommands(java.lang.String path,
java.lang.String name)
Returns latest commands saved in device state optionally filtered with path and meaning
|
rx.Observable<StateConfigurations> |
getStateConfigurations()
Returns all latest configurations saved in device state.
|
rx.Observable<StateConfigurations> |
getStateConfigurations(java.lang.String path,
java.lang.String name)
Returns latest configurations saved in device state optionally filtered with path and meaning
|
rx.Observable<StateMetadata> |
getStateMetadata(java.lang.String key)
Returns metadata saved in device state.
|
rx.Observable<ValueSchema> |
getValueSchema(java.lang.String meaning,
java.lang.String path)
Returns
ValueSchema for specified meaning and path from received Reading object. |
int |
hashCode() |
boolean |
isShared() |
void |
recycle()
Clears device's helper objects
|
rx.Observable<java.lang.Void> |
saveStateMetadata(java.lang.String key,
java.lang.Object object)
Saves object with corresponding key into device metadata.
|
rx.Observable<java.lang.Void> |
sendCommand(Command command)
Sends a command to the this device.
|
rx.Observable<java.lang.Void> |
sendConfiguration(Configuration configuration)
Sends a configuration to device.
|
void |
setDescription(java.lang.String description) |
void |
setName(java.lang.String name) |
rx.Observable<Reading> |
subscribeToCloudReadings()
Subscribes an app to a device channel.
|
java.lang.String |
toString() |
TransmitterDevice |
toTransmitterDevice()
Used only for Wunderbar devices.
|
void |
unSubscribeToCloudReadings()
Unsubscribes an app from a device channel, stopping and cleaning up the connection.
|
public Device(java.lang.String id,
java.lang.String owner,
java.lang.String modelId,
java.lang.String name)
public Device(java.lang.String id,
java.lang.String owner,
java.lang.String modelId,
java.lang.String name,
java.lang.String description)
public Device(java.lang.String id,
java.lang.String modelId,
java.lang.String name,
java.lang.String description,
java.lang.String owner,
java.lang.String firmwareVersion,
java.lang.String externalId,
boolean isPublic,
java.lang.String accountType)
public java.lang.String getName()
public java.lang.String getDescription()
public java.lang.String getId()
public java.util.Date getCreated()
public java.lang.String getFirmwareVersion()
public java.lang.String getSecret()
public java.lang.String getExternalId()
public boolean isShared()
public java.lang.String getOwner()
public java.lang.String getIntegrationType()
public void setName(java.lang.String name)
public void setDescription(java.lang.String description)
public rx.Observable<Reading> subscribeToCloudReadings()
Readingpublic void unSubscribeToCloudReadings()
public rx.Observable<State> getState()
Statepublic rx.Observable<StateReadings> getReadings()
getReadings(String, String)StateReadingspublic rx.Observable<StateReadings> getReadings(java.lang.String path, java.lang.String meaning)
path - see DeviceReading.path in DeviceModel for more detailsmeaning - see DeviceReading.meaning in DeviceModel for more detailsStateReadingsjava.lang.NullPointerException - if meaning is NULLpublic rx.Observable<java.lang.Void> sendConfiguration(Configuration configuration)
getStateConfigurations()configuration - - check possible configuration in DeviceModelObservablejava.lang.NullPointerException - if configuration is NULLpublic rx.Observable<StateConfigurations> getStateConfigurations()
getStateConfigurations(String, String)StateConfigurationspublic rx.Observable<StateConfigurations> getStateConfigurations(java.lang.String path, java.lang.String name)
path - see DeviceConfiguration.path in DeviceModel for more detailsname - see DeviceConfiguration.name in DeviceModel for more detailsStateConfigurationspublic rx.Observable<java.lang.Void> sendCommand(Command command)
getStateCommands()command - - check possible commands in DeviceModelObservablejava.lang.NullPointerException - if command is NULLpublic rx.Observable<StateCommands> getStateCommands()
getStateCommands(String, String)StateCommandspublic rx.Observable<StateCommands> getStateCommands(java.lang.String path, java.lang.String name)
path - see DeviceCommand.path in DeviceModel for more detailsname - see DeviceCommand.name in DeviceModel for more detailsStateCommandspublic rx.Observable<StateMetadata> getStateMetadata(java.lang.String key)
key - if null whole metadata is returned, otherwise object with specified key is returned (if one exists)StateMetadatapublic rx.Observable<java.lang.Void> deleteStateMetadata(java.lang.String key)
key - if null nothing is deleted, otherwise object with specified key is deleted (if one exists)public rx.Observable<java.lang.Void> saveStateMetadata(java.lang.String key,
java.lang.Object object)
key - separated with dots '.' to create nicer dictionary structure for easier navigation.object - object to save under specified keyObservablepublic AggregatedDataHelper getAggregatedDataHelper()
AggregatedDataHelper object. Use to get device history data.public RawDataHelper getRawDataHelper()
AggregatedDataHelper object. Use to get device history data.public java.lang.String getModelId()
DeviceModel that defines readings, commands and configurationspublic rx.Observable<DeviceModel> getDeviceModel()
DeviceModel that defines readings, commands and configurations for
specific device depending on device firmware version.
Use if RelayrJavaSdk.getDeviceModelsCache() is initialized.DeviceModelpublic rx.Observable<ValueSchema> getValueSchema(java.lang.String meaning, java.lang.String path)
ValueSchema for specified meaning and path from received Reading object.
ValueSchema defines received data and a way to parse it.path - defined by DeviceReading.getPath() in DeviceModelmeaning - defined by DeviceReading.getMeaning() in DeviceModelValueSchemapublic TransmitterDevice toTransmitterDevice()
TransmitterDevicepublic void recycle()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object