public final class Thing extends ServiceInstance implements IThing, ThingListener
Things are configurable and virtual object to
communicate with ArCloudIotIgniteManager,
Node,
ThingManageragentService| Modifier | Constructor and Description |
|---|---|
protected |
Thing(android.content.Context context,
android.hardware.Sensor androidSensor,
ThingListener listener,
ThingManager mThingManager)
Thing constructor for android sensors.
|
protected |
Thing(android.content.Context context,
java.lang.String thingID,
ThingType thingType,
ThingCategory thingCategory,
boolean isActuator,
ThingListener listener,
ThingManager mThingManager,
java.lang.String uniqueID)
General thing constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
android.hardware.Sensor |
getAndroidBuiltInSensor()
Get the wrapped
Sensor. |
boolean |
getIsActuator()
Gets
Thing's state which actuator or not. |
java.lang.String |
getNodeID()
Return NodeId thing belongs to
|
ThingCategory |
getThingCategory()
Get category of
Thing . |
ThingConfiguration |
getThingConfiguration()
Gets
Thing's configuration. |
android.content.Context |
getThingContext() |
ThingData |
getThingData()
Last data of
Thing object. |
java.lang.String |
getThingID()
Get
Thing's specified ID |
ThingListener |
getThingListener()
Return thing's listener object.
|
java.lang.String |
getThingName()
Get
Thing's human readable name. |
ThingType |
getThingType()
Get specified type of
ThingType . |
java.lang.String |
getUniqueID()
Get
Thing's unique ID |
int |
hashCode() |
boolean |
isConnected()
Get last connection info of
Thing. |
boolean |
isRegistered()
Checks
Thing object is registered or not. |
void |
onActionReceived(java.lang.String nodeID,
java.lang.String thingID,
ThingActionData thingData)
If
Thing set as an actuator, action callback going to be handled here. |
void |
onConfigurationReceived(Thing newThing)
Return new configured
Thing object. |
void |
onThingUnregistered(java.lang.String nodeID,
java.lang.String thingID)
If
Thing is unregistered, callback method notifies the application. |
boolean |
register()
|
boolean |
sendData(ThingData data)
Send
ThingData to cloud. |
protected void |
setAndroidSensor(android.hardware.Sensor androidSensor) |
void |
setConnected(boolean connected,
java.lang.String description)
Set connection state of
Thing. |
void |
setIsActuator(boolean isActuator)
Sets
Thing object can/can't receive action message. |
void |
setThingCategory(ThingCategory thingCategory)
|
void |
setThingConfiguration(ThingConfiguration config)
Sets
ThingConfiguration of your Thing. |
void |
setThingContext(android.content.Context context)
Sets
Context of Thing. |
void |
setThingData(ThingData thingData)
Set or update
Thing |
void |
setThingID(java.lang.String thingID)
Set
Thing's ID. |
void |
setThingListener(ThingListener listener)
Sets
ThingListener for actuator and ThingConfiguration callbacks. |
protected void |
setThingManager(ThingManager manager) |
void |
setThingName(java.lang.String thingName)
Set human readable name to specified
Thing. |
void |
setThingType(ThingType thingType)
|
void |
setUniqueID(java.lang.String uniqueID)
Set
Thing's uniqueID. |
java.lang.String |
toString() |
boolean |
unregister()
|
protected Thing(@NonNull
android.content.Context context,
@NonNull
java.lang.String thingID,
@NonNull
ThingType thingType,
@NonNull
ThingCategory thingCategory,
boolean isActuator,
ThingListener listener,
ThingManager mThingManager,
java.lang.String uniqueID)
context - : Context of your application.thingID - : Id of your thing.thingType - : Type of your thing.thingCategory - : Category of your thing.isActuator - : Is this thing gonna be used as an actuator or not.listener - : Thing listener for actuator and configuration callbacks.uniqueID - : Unique id of your thing.protected Thing(@NonNull
android.content.Context context,
@NonNull
android.hardware.Sensor androidSensor,
ThingListener listener,
ThingManager mThingManager)
context - :Context of your application.androidSensor - : Android sensor object.listener - : Thing listener for actuator and configuration callbacks.protected void setAndroidSensor(android.hardware.Sensor androidSensor)
protected void setThingManager(ThingManager manager)
public java.lang.String getThingID()
IThingThing's specified IDgetThingID in interface IThingpublic void setThingID(java.lang.String thingID)
IThingThing's ID. Every node must has unique things.setThingID in interface IThingthingID - thingID of Thingpublic java.lang.String getThingName()
IThingThing's human readable name.getThingName in interface IThingpublic void setThingName(java.lang.String thingName)
IThingThing.setThingName in interface IThingthingName - name of the thingpublic ThingData getThingData()
IThingThing object.getThingData in interface IThingpublic void setThingData(ThingData thingData)
IThingThingsetThingData in interface IThingthingData - : Specified ThingData of thing.data of the thingpublic android.hardware.Sensor getAndroidBuiltInSensor()
IThingSensor. If you're not using built-in Sensor you can
ignore this function. NOTE: If you are not using Android Sensor this function returns NULL.getAndroidBuiltInSensor in interface IThingSensor object.ThingDatapublic ThingType getThingType()
IThingThingType .getThingType in interface IThingThingType object. You can use getThingType() to use String data of ThingType object.Sensorpublic void setThingType(ThingType thingType)
IThingsetThingType in interface IThingthingType - type of the ThingThingTypepublic ThingCategory getThingCategory()
IThinggetThingCategory in interface IThingThingCategory object.ThingCategorypublic void setThingCategory(ThingCategory thingCategory)
IThingsetThingCategory in interface IThingThingCategorypublic ThingConfiguration getThingConfiguration()
IThingThing's configuration.getThingConfiguration in interface IThingThingConfiguration : ThingConfiguration object.ThingConfigurationpublic void setThingConfiguration(ThingConfiguration config)
IThingThingConfiguration of your Thing.setThingConfiguration in interface IThingconfig - : ThingConfiguration object which going to be set.ThingConfigurationpublic android.content.Context getThingContext()
getThingContext in interface IThingContext of Thing object.public void setThingContext(android.content.Context context)
IThingContext of Thing.setThingContext in interface IThingcontext - Context of the Applicationpublic boolean getIsActuator()
IThingThing's state which actuator or not.getIsActuator in interface IThingtrue | false : Actuator state of Thing object.public void setIsActuator(boolean isActuator)
IThingThing object can/can't receive action message. If its true it can use Thing object as
actuator.setIsActuator in interface IThingpublic ThingListener getThingListener()
IThinggetThingListener in interface IThingThingListenerpublic void setThingListener(ThingListener listener)
IThingThingListener for actuator and ThingConfiguration callbacks.setThingListener in interface IThinglistener - : ThingListener object.ThingListenerpublic java.lang.String getUniqueID()
IThingThing's unique IDgetUniqueID in interface IThingThingpublic void setUniqueID(java.lang.String uniqueID)
IThingThing's uniqueID. Every node must has unique Id.setUniqueID in interface IThinguniqueID - uniqueID of Thingpublic java.lang.String getNodeID()
IThingpublic boolean register()
IThingpublic boolean unregister()
IThingunregister in interface IThingtrue | false : Unregistration state of Thing.public boolean isRegistered()
IThingThing object is registered or not.isRegistered in interface IThingtrue | false : registration state of Thing.public boolean sendData(ThingData data)
IThingThingData to cloud.public boolean isConnected()
IThingThing.isConnected in interface IThingtrue or falsepublic void setConnected(boolean connected,
java.lang.String description)
IThingThing.setConnected in interface IThingconnected - : connection state.description - : connection state change description.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic void onConfigurationReceived(Thing newThing)
ThingListenerThing object. When Thing object got a new configuration. It
internally changes the config. This listener is only for notifying the application about
the changed objects.onConfigurationReceived in interface ThingListenerThingConfiguration,
Thingpublic void onActionReceived(java.lang.String nodeID,
java.lang.String thingID,
ThingActionData thingData)
ThingListenerThing set as an actuator, action callback going to be handled here.onActionReceived in interface ThingListenernodeID - : id of Thing's assigned node.thingID - : id of action.thingData - : actuator ThingActionData data.ThingActionData,
Thingpublic void onThingUnregistered(java.lang.String nodeID,
java.lang.String thingID)
ThingListenerThing is unregistered, callback method notifies the application.onThingUnregistered in interface ThingListenernodeID - : id of Thing's assigned node.thingID - : id of action.Thingpublic java.lang.String toString()
toString in class java.lang.Object