com.sentilla.platform.cmote
Class RemotePropertyDriver

java.lang.Object
  extended by com.sentilla.system.DriverAdapter
      extended by com.sentilla.net.RemotePropertyDriver
          extended by com.sentilla.platform.cmote.RemotePropertyDriver
All Implemented Interfaces:
Driver

public class RemotePropertyDriver
extends RemotePropertyDriver

An implementation of RemotePropertyDriver that supports open and create.

To access remote properties, use this driver to obtain a RandomAccessFile. You specify a target Addressable and a string key to obtain the RandomAccessFile. Most read and write operations are supported.

Each read and write initiates a network action with a resource-constrained target mote. Ensure that the sum of the read/write length and the number of bytes in the property key does not exceed 32 bytes. For example:

   byte[] buff = new byte[27];
   openProperty("mykey").write(buff); // OK
 

Be careful to ensure that the remote target is not simultaneously modifying the property.

remove is not supported at this time.


Field Summary
 
Fields inherited from class com.sentilla.system.DriverAdapter
m_nextDriver
 
Constructor Summary
RemotePropertyDriver()
           
 
Method Summary
 RandomAccessFile createProperty(Addressable target, String key, int maxlength)
          Creates (and opens) remote property.
 String getDriverName(int n)
          Returns the valid name(s) for each driver.
 RandomAccessFile openProperty(Addressable target, String key)
          Opens a remote property if it exists.
 void removeProperty(Addressable target, String key)
          Removes a specific remote property (not currently supported).
 void resetProperties(Addressable target)
          Removes all user keys and restores all system keys to default values.
 
Methods inherited from class com.sentilla.net.RemotePropertyDriver
create, open, register, remove, reset
 
Methods inherited from class com.sentilla.system.DriverAdapter
getNextDriver, setNextDriver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotePropertyDriver

public RemotePropertyDriver()
Method Detail

openProperty

public RandomAccessFile openProperty(Addressable target,
                                     String key)
Opens a remote property if it exists.

Specified by:
openProperty in class RemotePropertyDriver
Parameters:
target - from whom property is to be opened.
key - the key to access
Returns:
RandomAccessFile on success
Throws:
IORuntimeException - if open fails.

createProperty

public RandomAccessFile createProperty(Addressable target,
                                       String key,
                                       int maxlength)
Creates (and opens) remote property.

Specified by:
createProperty in class RemotePropertyDriver
Parameters:
target - at which property is to be created.
key - the key to access
maxlength - number of bytes to reserve for this property
Returns:
RandomAccessFile on success
Throws:
IORuntimeException - if create fails.

removeProperty

public void removeProperty(Addressable target,
                           String key)
Removes a specific remote property (not currently supported).

Specified by:
removeProperty in class RemotePropertyDriver
Parameters:
target - from whom property should be deleted
key - the key to access
Throws:
IORuntimeException - if remove fails.

resetProperties

public void resetProperties(Addressable target)
Removes all user keys and restores all system keys to default values.

Specified by:
resetProperties in class RemotePropertyDriver
Parameters:
target - from whom property should be deleted
Throws:
IORuntimeException - if remove fails.

getDriverName

public String getDriverName(int n)
Description copied from class: DriverAdapter
Returns the valid name(s) for each driver. If a driver has N-names, then getDriverName returns a string for n=0 to n=N-1, and returns null for all other values of n.

A driver may return multiple names because it provides the default implementation for a specific name, such as associating "flash" by default to the external flash, or "extflash" if an application specifically asserts it requires the external flash resources. Some drivers may return only a single valid name, such as "intflash" for the internal flash.

Specified by:
getDriverName in interface Driver
Specified by:
getDriverName in class DriverAdapter


Copyright © 2007 Sentilla Corporation. All Rights Reserved.