org.indi.server
Class ExternalDevice

java.lang.Object
  extended by org.indi.server.BasicDevice
      extended by org.indi.server.ExternalDevice
All Implemented Interfaces:
java.lang.Runnable, org.indi.reactor.QueueHandler<java.lang.Object>, org.indi.reactor.TimerCallback, Device, ObserverCallback

public class ExternalDevice
extends BasicDevice
implements org.indi.reactor.QueueHandler<java.lang.Object>, java.lang.Runnable

A class to allow indidrivers written in C to interact with this indiserver writing in Java. The class acts as a proxy class communicating with the indidriver that runs in a diffrent process via the stdin stdout streams.

Author:
Dirk Hünniger

Field Summary
 
Fields inherited from class org.indi.server.BasicDevice
name, observers, server
 
Constructor Summary
ExternalDevice(IndiServer server, java.lang.String command)
          class constuctor
 
Method Summary
 java.util.Queue<java.lang.Object> getQueue()
           
static void main(java.lang.String[] args)
          Runs an indiserver hosting an external device.
 void onGetProperties(org.indi.clientmessages.GetProperties o)
          called by the server when a new GetProperties (request to send all defXXX messages) is received from the a client.
 void onNew(org.indi.objects.BlobVector vector)
          called by the server when a new BLOB is received from the a client.
 void onNew(org.indi.objects.NumberVector vector)
          called by the server when a new NumberVector (request to set the state of a number) is received from the a client.
 void onNew(org.indi.objects.SwitchVector vector)
          called by the server when a new SwitchVector (request to set the state of a switch) is received from the a client.
 void onNew(org.indi.objects.TextVector vector)
          called by the server when a new TestVector (request to set the state of a text) is received from the a client.
 void onRead(java.lang.Object input)
          called by the reactor when a new item is available in the queue.
 void run()
          run asynchronously.
 void sendVector(org.indi.objects.Vector vector)
          Send a vector to external driver
 
Methods inherited from class org.indi.server.BasicDevice
def, def, del, del, getName, msg, onObserved, onTimer, sendToClients, set, set, subscribe, timer, unsubscribe, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalDevice

public ExternalDevice(IndiServer server,
                      java.lang.String command)
class constuctor

Parameters:
server - the server to host the driver
command - the command to start the external driver
Method Detail

run

public void run()
run asynchronously. Entrypoint of the parsing thread.

Specified by:
run in interface java.lang.Runnable

onNew

public void onNew(org.indi.objects.SwitchVector vector)
Description copied from class: BasicDevice
called by the server when a new SwitchVector (request to set the state of a switch) is received from the a client.

Specified by:
onNew in interface Device
Overrides:
onNew in class BasicDevice
Parameters:
vector - the vector received from the client

onNew

public void onNew(org.indi.objects.NumberVector vector)
Description copied from class: BasicDevice
called by the server when a new NumberVector (request to set the state of a number) is received from the a client.

Specified by:
onNew in interface Device
Overrides:
onNew in class BasicDevice
Parameters:
vector - the vector received from the client

onNew

public void onNew(org.indi.objects.BlobVector vector)
Description copied from class: BasicDevice
called by the server when a new BLOB is received from the a client.

Specified by:
onNew in interface Device
Overrides:
onNew in class BasicDevice
Parameters:
vector - the vector received from the client

onNew

public void onNew(org.indi.objects.TextVector vector)
Description copied from class: BasicDevice
called by the server when a new TestVector (request to set the state of a text) is received from the a client.

Specified by:
onNew in interface Device
Overrides:
onNew in class BasicDevice
Parameters:
vector - the vector received from the client

sendVector

public void sendVector(org.indi.objects.Vector vector)
Send a vector to external driver

Parameters:
vector - the vector to be sent

onGetProperties

public void onGetProperties(org.indi.clientmessages.GetProperties o)
Description copied from class: BasicDevice
called by the server when a new GetProperties (request to send all defXXX messages) is received from the a client.

Specified by:
onGetProperties in interface Device
Overrides:
onGetProperties in class BasicDevice
Parameters:
o - the GetProperties message received from the client

getQueue

public java.util.Queue<java.lang.Object> getQueue()
Specified by:
getQueue in interface org.indi.reactor.QueueHandler<java.lang.Object>
Returns:
the queue connecting the parsing thread to the device

onRead

public void onRead(java.lang.Object input)
called by the reactor when a new item is available in the queue. (it has been put into the queue by the parsing thread)

Specified by:
onRead in interface org.indi.reactor.QueueHandler<java.lang.Object>
Parameters:
input - the item just received from the queue

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Runs an indiserver hosting an external device.

Parameters:
args - Command line arguments (ignored)
Throws:
java.io.IOException


Copyright © 2008. All Rights Reserved.