|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.indi.server.BasicDevice
public class BasicDevice
Basic implementation of the device interface. Each device driver usually inherits from this class.
| Field Summary | |
|---|---|
protected java.lang.String |
name
the name of this driver |
protected java.util.Set<Observer> |
observers
A set registered observers, obsering changes of this device |
protected IndiServer |
server
the indiserver instance that this driver interacting with |
| Constructor Summary | |
|---|---|
BasicDevice(IndiServer server)
class constructor |
|
| Method Summary | |
|---|---|
void |
def(org.indi.objects.Vector vector)
Send a def vector message to all interested clients. |
void |
def(org.indi.objects.Vector vector,
java.lang.String message)
Shortcut to send a def vector message to all interested clients |
void |
del(org.indi.objects.Vector vector)
Send a del vector message to all interested clients. |
void |
del(org.indi.objects.Vector vector,
java.lang.String message)
Shortcut to send a del vector message to all interested clients |
java.lang.String |
getName()
|
void |
msg(java.lang.String message)
Shortcut to send a message to all interested clients |
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 |
onObserved(org.indi.objects.Vector vector)
called by the indiserver when a property for which an for with a observer was install via the subscibe method has changed |
void |
onTimer()
called by the reactor when the a timer registered with this callback expires |
void |
sendToClients(org.indi.objects.Object object,
org.indi.objects.TransferType type,
java.lang.String message)
Send to the given object to all interested clients |
void |
set(org.indi.objects.Vector vector)
Send a set vector message to all interested clients. |
void |
set(org.indi.objects.Vector vector,
java.lang.String message)
Shortcut to send a set vector message to all interested clients |
Observer |
subscribe(java.lang.String device,
java.lang.String name,
ObserverState state)
Register a new observer callback with the server. |
void |
timer(long timeout)
register a timer such the onTimer will be called after the given timeout |
void |
unsubscribe(Observer o)
remove the given observer. |
void |
unsubscribe(java.lang.String device,
java.lang.String name)
cancel the callback(s) for state or value changes for the property defined by the name of the device and the name of the property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected IndiServer server
protected java.lang.String name
protected java.util.Set<Observer> observers
| Constructor Detail |
|---|
public BasicDevice(IndiServer server)
server - the indiserver to interact with| Method Detail |
|---|
public void onNew(org.indi.objects.SwitchVector vector)
onNew in interface Devicevector - the vector received from the clientpublic void onNew(org.indi.objects.NumberVector vector)
onNew in interface Devicevector - the vector received from the clientpublic void onNew(org.indi.objects.BlobVector vector)
onNew in interface Devicevector - the vector received from the clientpublic void onNew(org.indi.objects.TextVector vector)
onNew in interface Devicevector - the vector received from the clientpublic void onGetProperties(org.indi.clientmessages.GetProperties o)
onGetProperties in interface Deviceo - the GetProperties message received from the clientpublic void onTimer()
onTimer in interface org.indi.reactor.TimerCallback
public Observer subscribe(java.lang.String device,
java.lang.String name,
ObserverState state)
device - The name of the device to observename - The name of the property to observestate - The observerstate object destribing to listen for state or
value changes or both.
public void unsubscribe(Observer o)
o - The obsever object to describing the subscibtrion to be
canceled
public void unsubscribe(java.lang.String device,
java.lang.String name)
device - The name of the devicename - The name of the property
public void def(org.indi.objects.Vector vector,
java.lang.String message)
vector - The vector to be sendmessage - The message string to be sent with the vector
public void set(org.indi.objects.Vector vector,
java.lang.String message)
vector - The vector to be sendmessage - The message string to be sent with the vector
public void del(org.indi.objects.Vector vector,
java.lang.String message)
vector - The vector to be sendmessage - The message string to be sent with the vectorpublic void msg(java.lang.String message)
message - The message string to be sentpublic void timer(long timeout)
timeout - the time to wait before calling onTimer in millisecondspublic void def(org.indi.objects.Vector vector)
vector - the vector to be send.public void set(org.indi.objects.Vector vector)
vector - the vector to be send.public void del(org.indi.objects.Vector vector)
vector - the vector to be send.
public void sendToClients(org.indi.objects.Object object,
org.indi.objects.TransferType type,
java.lang.String message)
object - the object to be sendtype - the way the object shall to be sendmessage - the to be send with the objectpublic java.lang.String getName()
getName in interface Devicepublic void onObserved(org.indi.objects.Vector vector)
onObserved in interface ObserverCallbackvector - the vector that changed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||