Class BluetoothNode
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.domains.wireless.demo.PersonalAreaNetwork.BluetoothNode
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class BluetoothNode extends TypedAtomicActor
bluetooth- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Philip Baldwin
- Pt.AcceptedRating:
- Red (pjb2e)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description WirelessIOPort
input
Port that receives update message for the spanning tree.StringParameter
messageChannelName
Name of the channel for messaging between sensors.WirelessIOPort
output
Port that transmits the update message for the spanning tree.StringParameter
outputChannelName
Name of the output channel.Parameter
range
The transmission range of the sensor.WirelessIOPort
signal
Port that receives a signal from the envader or pursuer.StringParameter
signalChannelName
Name of the channel for sensors to detect envader or pursuer.-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description BluetoothNode(CompositeEntity container, java.lang.String name)
Construct an actor with the specified container and name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double[]
_getLocation()
Return the location of this sensor.void
declareDelayDependency()
Override the base class to declare that the output does not depend on the input or signal ports in a firing.void
fire()
When it receives token from the signal port, which is used to receive signal from the pursuer or the evader.void
initialize()
Initialize the private varialbles of the sensor node.-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
input
public WirelessIOPort input
Port that receives update message for the spanning tree.
-
signal
public WirelessIOPort signal
Port that receives a signal from the envader or pursuer.
-
messageChannelName
public StringParameter messageChannelName
Name of the channel for messaging between sensors. This is a string that defaults to "messageChannel".
-
signalChannelName
public StringParameter signalChannelName
Name of the channel for sensors to detect envader or pursuer. This is a string that defaults to "signalChannel".
-
output
public WirelessIOPort output
Port that transmits the update message for the spanning tree. This has type {location={double}, time=double, depth =int}, a record token.
-
outputChannelName
public StringParameter outputChannelName
Name of the output channel. This is a string that defaults to "OutputChannel".
-
range
public Parameter range
The transmission range of the sensor. The icon for this sensor node includes a circle with this as its radius. This is a double and default to 50.0.
-
-
Constructor Detail
-
BluetoothNode
public BluetoothNode(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
Construct an actor with the specified container and name.- Parameters:
container
- The container.name
- The name.- Throws:
IllegalActionException
- If the entity cannot be contained by the proposed container.NameDuplicationException
- If the container already has an actor with this name.
-
-
Method Detail
-
declareDelayDependency
public void declareDelayDependency() throws IllegalActionException
Override the base class to declare that the output does not depend on the input or signal ports in a firing.- Overrides:
declareDelayDependency
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If the causality interface cannot be computed.- See Also:
AtomicActor.getCausalityInterface()
,AtomicActor._declareDelayDependency(IOPort, IOPort, double)
-
fire
public void fire() throws IllegalActionException
When it receives token from the signal port, which is used to receive signal from the pursuer or the evader. it tells what the signal is from by checking the signal header. If it is from the evader, it set itself to be the root node and broadcast a message for updating the tree. Otherwise, it output a message to the pursuer to tell it the location of its parent node, and the pursuer will move closer to the evader using this information. When it receives token from the input port, which is used to receive message from other sensors, it check whether the rootnode has been changed or whether there is a shorter path. If so, it performs update and broadcast a message. Otherwise, simply consumes the messge.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
initialize
public void initialize() throws IllegalActionException
Initialize the private varialbles of the sensor node.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- If thrown by the base class.
-
_getLocation
protected double[] _getLocation() throws IllegalActionException
Return the location of this sensor. In this base class, this is determined by looking for an attribute with name "_location" and class Location. Normally, a visual editor such as Vergil will create this icon, so the location will be determined by the visual editor. Derived classes can override this method to specify the location in some other way.- Returns:
- An array identifying the location.
- Throws:
IllegalActionException
- If the location attribute does not exist or cannot be evaluated.
-
-