public final class Node extends ServiceInstance implements INode, NodeListener
agentService| Modifier | Constructor and Description |
|---|---|
protected |
Node(java.lang.String nodeName,
java.lang.String nodeID,
IotIgniteManager instance,
java.lang.String uniqueID,
NodeListener nodeListener) |
| Modifier and Type | Method and Description |
|---|---|
Thing |
createThing(android.hardware.Sensor androidSensor,
ThingListener listener)
Create
Thing object which is an Android Sensor. |
Thing |
createThing(java.lang.String thingID,
ThingType thingType,
ThingCategory thingCategory,
boolean isActuator,
ThingListener listener,
java.lang.String uniqueID)
|
boolean |
equals(java.lang.Object obj) |
android.content.Context |
getContext()
Get
Context of Node. |
java.util.List<Thing> |
getEveryThing()
Get list of registered
Things in IotIgnite. |
static java.lang.String |
getNodeAsJSONString(Node mNode) |
java.lang.String |
getNodeID()
Get id of
Node. |
NodeListener |
getNodeListener()
Return node's listener object.
|
java.lang.String |
getNodeName()
Get human readable
Node name. |
static Node |
getNodeObjectFromJsonString(java.lang.String nodeObjectString) |
java.lang.String |
getPackageName()
Package name of
Node object. |
Thing |
getThingByID(java.lang.String thingID)
|
java.util.List<Thing> |
getThingByName(java.lang.String name)
Get list of registered
Things with same name in IotIgnite. |
java.lang.String |
getUniqueID()
Get unique id of
Node. |
int |
hashCode() |
boolean |
isConnected()
Get connection status of
Node. |
boolean |
isRegistered()
Check a
Thing object registered on IotIgnite or not. |
void |
onNodeUnregistered(java.lang.String nodeID)
If
Node is unregistered, callback method notifies the application. |
boolean |
register()
Register
Node to IotIgnite. |
protected void |
setConnected(boolean state) |
void |
setConnected(boolean connected,
java.lang.String description)
Set connection status of
Node. |
void |
setContext(android.content.Context context)
Set
Context of Node. |
void |
setNodeID(java.lang.String nodeID)
Set an id to
Node. |
void |
setNodeListener(NodeListener listener)
Sets
NodeListener for callbacks. |
void |
setNodeName(java.lang.String nodeName)
Set human readable name to
Node. |
void |
setUniqueID(java.lang.String uniqueID)
Set an uniqueID to
Node. |
boolean |
unregister()
Unregister
Node from IotIgnite. |
protected Node(@NonNull
java.lang.String nodeName,
@NonNull
java.lang.String nodeID,
IotIgniteManager instance,
java.lang.String uniqueID,
NodeListener nodeListener)
protected void setConnected(boolean state)
public java.lang.String getNodeName()
INodeNode name.getNodeName in interface INodeNode.public void setNodeName(java.lang.String nodeName)
INodeNode.setNodeName in interface INodenodeName - : Name of Node.public java.lang.String getNodeID()
INodeNode.public void setNodeID(java.lang.String nodeID)
INodeNode. ID must be UNIQUE.public boolean isConnected()
INodeNode.isConnected in interface INodeNode.public void setConnected(boolean connected,
java.lang.String description)
INodeNode.setConnected in interface INodeconnected - : Status of connection.description - : Description about connection state.public java.lang.String getPackageName()
INodeNode object.getPackageName in interface INodeStringpublic java.lang.String getUniqueID()
INodeNode.getUniqueID in interface INodeNode.public void setUniqueID(java.lang.String uniqueID)
INodeNode. ID must be UNIQUE.setUniqueID in interface INodeuniqueID - unique of the Nodepublic android.content.Context getContext()
INodeContext of Node.getContext in interface INodepublic void setContext(android.content.Context context)
INodeContext of Node.setContext in interface INodecontext - Context of the Applicationpublic boolean register()
INodepublic boolean unregister()
INodeNode from IotIgnite. Application can only unregister its own Nodes.
Nodes registered by different application are not accessable.unregister in interface INodetrue or false success state.IotIgniteManager,
Thingpublic Thing createThing(java.lang.String thingID, ThingType thingType, ThingCategory thingCategory, boolean isActuator, ThingListener listener, java.lang.String uniqueID)
INodeThing object and assigns to Node. To create Thing object the application must be
authorized in IotIgnite platform. After that it can create Node and Node assigned Thing
objects. thingID must follow the rules which are defined with the Regex below:
^[a-zA-Z0-9]+([ ]?[a-zA-Z0-9-.:@]+)*$createThing in interface INodethingID - Set Thing's ID. Every node must has unique thingId.thingType - thingType type of the ThingthingCategory - Could be ThingCategory.BUILTIN or ThingCategory.EXTERNALisActuator - Actuator state of Thing objectlistener - ThingListener object.uniqueID - uniqueID of ThingThing : The created Thing object.ThingManager,
Thing,
ThingType,
ThingListener,
ThingCategorypublic Thing createThing(android.hardware.Sensor androidSensor, ThingListener listener)
INodeThing object which is an Android Sensor. It wraps Android Sensor to Thing object.
Creating Thing objects from builtin Android Sensor has fewer parameters than generic Thing
object. It only needs Android Sensor and ThingListener. Other parameters such as thingID,
thingType, vendor has already provided in Sensor.
Sensors can not act as an actuator so by default this parameter is false. Application cannot change it.
createThing in interface INodeandroidSensor - Sensor of the Androidlistener - ThingListener object.Thing : Thing object.ThingManager,
Thing,
Sensor,
ThingListenerpublic java.util.List<Thing> getEveryThing()
INodeThings in IotIgnite. If no such a Thing is registered, Node returns
empty list.getEveryThing in interface INodeList<Thing>: List of Thing's registered on IotIgnite.public Thing getThingByID(java.lang.String thingID)
INodeThing object by thingID in registered Node. If no such Thing is registered thingID returns
null object.getThingByID in interface INodethingID - : Unique thingID of object.Thing : Returns null if no such a thing in that id.public java.util.List<Thing> getThingByName(java.lang.String name)
INodeThings with same name in IotIgnite. If no such Thing is
registered, Node returns empty list.getThingByName in interface INodename - Name of the ThingList<Thing>: List of Things with same thingNames registered on
IotIgnite.public boolean isRegistered()
INodeThing object registered on IotIgnite or not.isRegistered in interface INodetrue or false : Thing registration state on IotIgnite.public void setNodeListener(NodeListener listener)
INodeNodeListener for callbacks.setNodeListener in interface INodelistener - : NodeListener object.NodeListenerpublic NodeListener getNodeListener()
INodegetNodeListener in interface INodeNodeListenerpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static java.lang.String getNodeAsJSONString(Node mNode)
mNode - public static Node getNodeObjectFromJsonString(java.lang.String nodeObjectString)
nodeObjectString - public void onNodeUnregistered(java.lang.String nodeID)
NodeListenerNode is unregistered, callback method notifies the application.onNodeUnregistered in interface NodeListenernodeID - : id of Node's assigned node.Node}