JMACS

org.jmacs.pd
Class Device.Proxy

java.lang.Object
  extended by org.jmacs.pd.Device.Proxy
Enclosing class:
Device

public static class Device.Proxy
extends Object

to be extended by the class ~.mydevice.MyDevice, as part of a programmable-device definition.


Constructor Summary
protected Device.Proxy(IDi.IDriver.IClient.IContext context)
          creates new instance.
protected Device.Proxy(IDi.IDriver.IClient.IContext context, String diName)
          creates new instance.
 
Method Summary
protected  Object createProxyDriver(Class driverInterface)
          for use to provide access to driver itself in the form of a dynamic proxy.
 Serializable executeCmd(Serializable cmd)
          executes cmd.
 Device.IConstants getConstants()
          returns constants.
 ProgInfo getProgInfo()
          returns program info as of the last sampling boundary.
 Status_ProgInfo getStatus_ProgInfo()
          returns device status and program info as of the last sampling boundary.
 Status_ProgInfo getStatus_ProgInfo(long[] timestamp)
          as above, but also returns timestamp.
 Device.IStatus getStatus()
          returns device status as of the last sampling boundary.
 Device.IStatus getStatus(long[] timestamp)
          as above, but also returns timestamp.
 void startProgram(IProgram prog)
          starts the specified program.
 void stopProgram()
          IProgram.terminate()s the currently running program.
 void subscribe(boolean b)
          causes the status to be obtained automatically.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Device.Proxy

protected Device.Proxy(IDi.IDriver.IClient.IContext context,
                       String diName)
creates new instance.

Parameters:
diName - See IDi.IDriver.ISampler.IContext.

Device.Proxy

protected Device.Proxy(IDi.IDriver.IClient.IContext context)
creates new instance. As above, using diName derived from classname: e.g. MyDevice results in a diName of ".myDevice".

Method Detail

executeCmd

public Serializable executeCmd(Serializable cmd)
                        throws CmdException,
                               ClientDiException
executes cmd.

Throws:
CmdException
ClientDiException

startProgram

public void startProgram(IProgram prog)
                  throws ClientDiException
starts the specified program. Any program which is already running will be IProgram.terminate()ed.

Throws:
ClientDiException

stopProgram

public void stopProgram()
                 throws ClientDiException
IProgram.terminate()s the currently running program. Does nothing if no program is running.

Throws:
ClientDiException

getStatus

public Device.IStatus getStatus()
                         throws ClientDiException
returns device status as of the last sampling boundary.

Throws:
ClientDiException

getStatus

public Device.IStatus getStatus(long[] timestamp)
                         throws ClientDiException
as above, but also returns timestamp.

Throws:
ClientDiException

getProgInfo

public ProgInfo getProgInfo()
                     throws ClientDiException
returns program info as of the last sampling boundary.

Throws:
ClientDiException

getStatus_ProgInfo

public Status_ProgInfo getStatus_ProgInfo()
                                   throws ClientDiException
returns device status and program info as of the last sampling boundary.

Throws:
ClientDiException

getStatus_ProgInfo

public Status_ProgInfo getStatus_ProgInfo(long[] timestamp)
                                   throws ClientDiException
as above, but also returns timestamp.

Throws:
ClientDiException

getConstants

public Device.IConstants getConstants()
                               throws ClientDiException
returns constants.

Throws:
ClientDiException

subscribe

public void subscribe(boolean b)
               throws ClientDiException
causes the status to be obtained automatically. Calls to getStatus() etc. will then return the cached sample, or null if this is no longer up to date (i.e. older than two sampling periods).

Throws:
ClientDiException

createProxyDriver

protected Object createProxyDriver(Class driverInterface)
for use to provide access to driver itself in the form of a dynamic proxy. The result should be cast to driverInterface, and typically assigned to a private field, to be accessed via a public getDriver() method.


JMACS

jmacs.org