com.sun.spot.resources
Interface IResource
- All Known Subinterfaces:
- I802_15_4_MAC, I802_15_4_PHY, IAccelerometer3D, IAccelerometer3D, IADT7411, IAnalogInput, IAT91_PIO, ICompositeResource, ICompositeTransducer, IDemoBoard, IDMAMemoryManager, IDriverRegistry, IFiqInterruptDaemon, IFlashMemoryDevice, II2C, IInputPin, IInputPin, IIOPin, IIOPin, ILed, ILed, ILightSensor, ILightSensor, ILowPan, ILTC3455, INorFlashSectorFactory, IOTACommandServer, IOutputPin, IOutputPin, IPowerController, IProprietaryMAC, IProprietaryRadio, IRadioPacketDispatcher, IRadioPolicyManager, IRemotePrintManager, IResourceRegistry, IRoutingManager, IRoutingPolicyManager, IScalarInput, ISerial, IService, IServo, IServo, ISleepManager, ISpiMaster, ISpot, ISpotBlink, ISpotPins, ISpotRadioHelper, ISwitch, ISwitch, ITemperatureInput, ITemperatureInput, IToneGenerator, IToneGenerator, ITransducer, ITriColorLED, ITriColorLED, ITriColorLEDArray, ITriColorLightSensor, IUSBPowerDaemon
- All Known Implementing Classes:
- AbstractAT91_PIO, Accelerometer3D, ADJDS311TriColorLightSensor, ADT7411, AnalogInput, AODVManager, AT91_I2C, AT91_Peripherals, ATmega_I2C, AtmegaExternalBoard, BasicService, BinaryScalar, BootloaderListenerService, CompositeResource, CompositeTransducer, DMAMemoryManager, DriverRegistry, EDemoBoard, EDemoBoardBlink, EDemoController, EDemoSerial, ExternalBoard, FiqInterruptDaemon, Heartbeat, ICMPv6, InfraRed, InputPin, InvertingInputPin, InvertingOutputPin, IOPin, IP, IPRoutingTable, LightSensor, LIS3L02AQAccelerometer, LockingCompositeResource, LockingResource, LowPan, LowPanSpotRadioHelper, LowPanUncompressed, LQRPManager, MMA7455LAccelerometer, NetManagementServer, NetTimerStatics, NodeLifeAndLinkMonitor, OTACommandServer, OutputPin, PeripheralChipSelect, RadiogramProtocolManager, RadioPacketDispatcher, RadioPolicyManager, RadioProtocolManager, RadiostreamProtocolManager, RemotePrintManager, RequestTable, RequestTable, Resource, ResourceRegistryChild, ResourceRegistryMaster, RoutingPolicyManager, RoutingTable, RoutingTable, ScalarInput, Serial, SerialFlash, Servo, SimpleSPIControlledIOChip, SingleHopManager, Spot, SpotBlink, Switch, TaskManager, TCPStack, TemperatureInput, ToneGenerator, TriColorLED, TriColorLEDArray, UDP
public interface IResource
Basic interface for all resources (service, sensor, effector, etc.) so that
they can be registered in the Resources Repository.
Please refer to Resources for more details.
Note: When creating a new resource it is important not to use any non-final
static fields because all static fields are unique to each Isolate.
It is okay to use a static field that each Isolate initializes to point to
a global instance of the resource, such as one obtained by calling
Resources.lookup().
Note: When registering a callback it is important to also record the current
Isolate as that is the context that the callback expects when it is run.
Moreover in order to have the callback run in the correct Isolate it is
necessary to use a CrossIsolateThread.
Isolate iso = ...; // get the Isolate to run the callback in
if (iso != null || !iso.isExited()) { // make sure it is still alive
final Callback cb = ...; // get the callback instance
new CrossIsolateThread(iso, "Callback") {
public void run() {
cb.callbackMethod(); // execute the callback method
}
}.start();
}
- Author:
- Ron Goldman
|
Method Summary |
void |
addTag(String tag)
Add a new tag to describe this resource. |
String[] |
getTags()
Get the array of tags associated with this resource. |
String |
getTagValue(String key)
Treat each tag as being "key=value" and return the value of the first tag
with the specified key. |
boolean |
hasTag(String tag)
Check if the specified tag is associated with this resource. |
void |
removeTag(String tag)
Remove an existing tag describing this resource. |
getTags
String[] getTags()
- Get the array of tags associated with this resource.
- Returns:
- the array of tags associated with this resource.
addTag
void addTag(String tag)
- Add a new tag to describe this resource.
- Parameters:
tag - the new tag to add
removeTag
void removeTag(String tag)
- Remove an existing tag describing this resource.
- Parameters:
tag - the tag to remove
hasTag
boolean hasTag(String tag)
- Check if the specified tag is associated with this resource.
- Parameters:
tag - the tag to check
- Returns:
- true if the tag is associated with this resource, false otherwise.
getTagValue
String getTagValue(String key)
- Treat each tag as being "key=value" and return the value of the first tag
with the specified key. Return null if no tag has the specified key.
- Parameters:
key - the string to match the key
- Returns:
- the tag value matching the specified key or null if none
Copyright © 2006-2010 Oracle. All Rights Reserved.