sidnet.core.misc
Class Node

java.lang.Object
  extended by sidnet.core.misc.Node
All Implemented Interfaces:
NodeAPI, NodeHardwareInterface

public class Node
extends java.lang.Object
implements NodeAPI, NodeHardwareInterface


Field Summary
 NodesList neighboursList
          list of neighbours.
 long packetReceivedCount
           
 long packetSentCount
           
 
Constructor Summary
Node(int id, EnergyManagement energyManagement, PanelContext hostingPanelContext, LocationContext fieldContext, ColorProfile colorCode, SimManager simControl)
          Creates a new instance of Node
 
Method Summary
 void addQuery(Query query)
          Adds a query to the query list.
 void addSensor(Sensor sensor)
           
 void appendTerminalText(java.lang.String s)
          Appends the supplied string to the console associated with the Terminal of the calling node
 void enableRelocation(Field field)
           
 CallbackInterface getAppCallback()
           
 double getEffectiveCoverage_ft()
           
 EnergyManagement getEnergyManagement()
           
 GPS getGPS()
           
 int getID()
          Gets the unique ID that has been associated with the node.
 NetAddress getIP()
          Get the IP address of the node
 Location2D getLocation2D()
          Get the geographical location of the sensor node in real metric units, not in screen coordinates
 LocationContext getLocationContext()
          Returns the LocationContext in which the getLocation2D returns the measurements
 NCS_Location2D getNCS_Location2D()
          Returns the location of this node as an NCS (Normalized Coordinate System)
 NodeGUIimpl getNodeGUI()
          Gets the handle over the NodeGUIimpl which contains functions related to GUI
 java.util.List<Query> getQueryList()
          Returns the list of queries that have been posted by the client through this node.
 Sensor getSensor(int sensorIndex)
           
 SimControl getSimControl()
          Return the SimControl handle
 byte getType()
          Get the TYPE of a node
 boolean isFaulty()
           
 void malfunctioned()
           
 double readAnalogSensorData(int sensorIndex)
          Reads sensor data
 void setAppCallback(CallbackInterface appCallback)
           
 void setGPS(GPS gps)
           
 void setIP(NetAddress ip)
           
 void setLocation2D(Location2D fieldLocation)
           
 void setQueryList(java.util.LinkedList<Query> terminalQueryList)
          Not member of NodeAPI
 void setType(byte type)
          Set the TYPE of a node
 void updateLocation2D(Location2D fieldLocation)
          Should be called at runtime if node placement changes programmatically Will not work if the node relocation is not enabled (aka, the nodeGUI.field is null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packetReceivedCount

public long packetReceivedCount

packetSentCount

public long packetSentCount

neighboursList

public NodesList neighboursList
list of neighbours.

Constructor Detail

Node

public Node(int id,
            EnergyManagement energyManagement,
            PanelContext hostingPanelContext,
            LocationContext fieldContext,
            ColorProfile colorCode,
            SimManager simControl)
Creates a new instance of Node

Method Detail

getQueryList

public java.util.List<Query> getQueryList()
Description copied from interface: NodeAPI
Returns the list of queries that have been posted by the client through this node. It is update by the Terminal

Specified by:
getQueryList in interface NodeAPI

addQuery

public void addQuery(Query query)
Description copied from interface: NodeAPI
Adds a query to the query list. This is used to set the query without automatically

Specified by:
addQuery in interface NodeAPI

setQueryList

public void setQueryList(java.util.LinkedList<Query> terminalQueryList)
Not member of NodeAPI


getID

public int getID()
Description copied from interface: NodeAPI
Gets the unique ID that has been associated with the node. It is the integer representation of the IP address

Specified by:
getID in interface NodeAPI

getIP

public NetAddress getIP()
Get the IP address of the node

Specified by:
getIP in interface NodeAPI
Specified by:
getIP in interface NodeHardwareInterface
Returns:
NetAddress IP address represented as a NetAddress

setType

public void setType(byte type)
Set the TYPE of a node

Specified by:
setType in interface NodeAPI
Parameters:
short - type The type, as a short, numerical value, to identify a node's type in a heterogeneous network

getType

public byte getType()
Get the TYPE of a node

Specified by:
getType in interface NodeAPI
Returns:
short type The type, as a short, numerical value, to identify a node's type in a heterogeneous network

enableRelocation

public void enableRelocation(Field field)

getSimControl

public SimControl getSimControl()
Description copied from interface: NodeAPI
Return the SimControl handle

Specified by:
getSimControl in interface NodeAPI

getLocation2D

public Location2D getLocation2D()
Description copied from interface: NodeAPI
Get the geographical location of the sensor node in real metric units, not in screen coordinates

Specified by:
getLocation2D in interface NodeAPI

getNCS_Location2D

public NCS_Location2D getNCS_Location2D()
Description copied from interface: NodeAPI
Returns the location of this node as an NCS (Normalized Coordinate System)

Specified by:
getNCS_Location2D in interface NodeAPI

getLocationContext

public LocationContext getLocationContext()
Description copied from interface: NodeAPI
Returns the LocationContext in which the getLocation2D returns the measurements

Specified by:
getLocationContext in interface NodeAPI

malfunctioned

public void malfunctioned()

isFaulty

public boolean isFaulty()

readAnalogSensorData

public double readAnalogSensorData(int sensorIndex)
Description copied from interface: NodeAPI
Reads sensor data

Specified by:
readAnalogSensorData in interface NodeAPI
Parameters:
sensorIndex - indexes through the registered sensors, in case a node has more than one sensing capabilities. Otherwise, set to 0

appendTerminalText

public void appendTerminalText(java.lang.String s)
Description copied from interface: NodeAPI
Appends the supplied string to the console associated with the Terminal of the calling node

Specified by:
appendTerminalText in interface NodeAPI

getNodeGUI

public NodeGUIimpl getNodeGUI()
Description copied from interface: NodeAPI
Gets the handle over the NodeGUIimpl which contains functions related to GUI

Specified by:
getNodeGUI in interface NodeAPI

setIP

public void setIP(NetAddress ip)
Specified by:
setIP in interface NodeHardwareInterface

getEnergyManagement

public EnergyManagement getEnergyManagement()
Specified by:
getEnergyManagement in interface NodeAPI
Specified by:
getEnergyManagement in interface NodeHardwareInterface

setGPS

public void setGPS(GPS gps)
Specified by:
setGPS in interface NodeHardwareInterface

getGPS

public GPS getGPS()
Specified by:
getGPS in interface NodeHardwareInterface

addSensor

public void addSensor(Sensor sensor)
Specified by:
addSensor in interface NodeHardwareInterface

getSensor

public Sensor getSensor(int sensorIndex)
Specified by:
getSensor in interface NodeHardwareInterface

setAppCallback

public void setAppCallback(CallbackInterface appCallback)
Specified by:
setAppCallback in interface NodeAPI

getAppCallback

public CallbackInterface getAppCallback()
Specified by:
getAppCallback in interface NodeAPI

updateLocation2D

public void updateLocation2D(Location2D fieldLocation)
Should be called at runtime if node placement changes programmatically Will not work if the node relocation is not enabled (aka, the nodeGUI.field is null


setLocation2D

public void setLocation2D(Location2D fieldLocation)

getEffectiveCoverage_ft

public double getEffectiveCoverage_ft()