|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.freedesktop.dbus.AbstractConnection
public abstract class AbstractConnection
Handles a connection to DBus.
Nested Class Summary | |
---|---|
protected class |
AbstractConnection._thread
|
protected class |
AbstractConnection._workerthread
|
protected class |
AbstractConnection.FallbackContainer
|
Field Summary | |
---|---|
protected boolean |
_run
|
protected String |
addr
|
protected boolean |
connected
|
static boolean |
EXCEPTION_DEBUG
|
protected Map<String,org.freedesktop.dbus.ExportedObject> |
exportedObjects
|
protected AbstractConnection.FallbackContainer |
fallbackcontainer
|
protected Map<org.freedesktop.dbus.SignalTuple,Vector<DBusSigHandler<? extends DBusSignal>>> |
handledSignals
|
protected Map<DBusInterface,org.freedesktop.dbus.RemoteObject> |
importedObjects
|
protected Map<MethodCall,DBusAsyncReply<? extends Object>> |
pendingCallbackReplys
|
protected Map<MethodCall,CallbackHandler<? extends Object>> |
pendingCallbacks
|
protected org.freedesktop.dbus.EfficientMap |
pendingCalls
|
protected LinkedList<Runnable> |
runnables
|
protected org.freedesktop.dbus.AbstractConnection._sender |
sender
|
protected AbstractConnection._thread |
thread
|
protected static int |
TIMEOUT
Timeout in us on checking the BUS for incoming messages and sending outgoing messages |
protected Transport |
transport
|
protected boolean |
weakreferences
|
protected LinkedList<AbstractConnection._workerthread> |
workers
|
Constructor Summary | |
---|---|
protected |
AbstractConnection(String address)
|
Method Summary | ||
---|---|---|
void |
addFallback(String objectprefix,
DBusInterface object)
Export an object as a fallback object. |
|
|
addSigHandler(Class<T> type,
DBusInterface object,
DBusSigHandler<T> handler)
Add a Signal Handler. |
|
|
addSigHandler(Class<T> type,
DBusSigHandler<T> handler)
Add a Signal Handler. |
|
protected abstract
|
addSigHandler(DBusMatchRule rule,
DBusSigHandler<T> handler)
|
|
protected
|
addSigHandlerWithoutMatch(Class<? extends DBusSignal> signal,
DBusSigHandler<T> handler)
|
|
DBusAsyncReply |
callMethodAsync(DBusInterface object,
String m,
Object... parameters)
Call a method asynchronously and get a handle with which to get the reply. |
|
|
callWithCallback(DBusInterface object,
String m,
CallbackHandler<A> callback,
Object... parameters)
Call a method asynchronously and set a callback. |
|
void |
changeThreadCount(byte newcount)
Change the number of worker threads to receive method calls and handle signals. |
|
void |
disconnect()
Disconnect from the Bus. |
|
void |
exportObject(String objectpath,
DBusInterface object)
Export an object so that its methods can be called on DBus. |
|
void |
finalize()
|
|
BusAddress |
getAddress()
Returns the address this connection is connected to. |
|
static DBusCallInfo |
getCallInfo()
Returns a structure with information on the current method call. |
|
DBusExecutionException |
getError()
Return any DBus error which has been received. |
|
protected void |
listen()
|
|
void |
removeFallback(String objectprefix)
Remove a fallback |
|
|
removeSigHandler(Class<T> type,
DBusInterface object,
DBusSigHandler<T> handler)
Remove a Signal Handler. |
|
|
removeSigHandler(Class<T> type,
DBusSigHandler<T> handler)
Remove a Signal Handler. |
|
protected abstract
|
removeSigHandler(DBusMatchRule rule,
DBusSigHandler<T> handler)
|
|
protected void |
sendMessage(Message m)
|
|
void |
sendSignal(DBusSignal signal)
Send a signal. |
|
void |
setWeakReferences(boolean weakreferences)
If set to true the bus will not hold a strong reference to exported objects. |
|
void |
unExportObject(String objectpath)
Stop Exporting an object |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int TIMEOUT
protected Map<String,org.freedesktop.dbus.ExportedObject> exportedObjects
protected Map<DBusInterface,org.freedesktop.dbus.RemoteObject> importedObjects
protected Map<org.freedesktop.dbus.SignalTuple,Vector<DBusSigHandler<? extends DBusSignal>>> handledSignals
protected org.freedesktop.dbus.EfficientMap pendingCalls
protected Map<MethodCall,CallbackHandler<? extends Object>> pendingCallbacks
protected Map<MethodCall,DBusAsyncReply<? extends Object>> pendingCallbackReplys
protected LinkedList<Runnable> runnables
protected LinkedList<AbstractConnection._workerthread> workers
protected AbstractConnection.FallbackContainer fallbackcontainer
protected boolean _run
protected AbstractConnection._thread thread
protected org.freedesktop.dbus.AbstractConnection._sender sender
protected Transport transport
protected String addr
protected boolean weakreferences
public static final boolean EXCEPTION_DEBUG
protected boolean connected
Constructor Detail |
---|
protected AbstractConnection(String address) throws DBusException
DBusException
Method Detail |
---|
protected void listen()
public void changeThreadCount(byte newcount)
newcount
- The new number of worker Threads to use.public static DBusCallInfo getCallInfo()
public void setWeakReferences(boolean weakreferences)
public void exportObject(String objectpath, DBusInterface object) throws DBusException
objectpath
- The path to the object we are exposing. MUST be in slash-notation, like "/org/freedesktop/Local",
and SHOULD end with a capitalised term. Only one object may be exposed on each path at any one time, but an object
may be exposed on several paths at once.object
- The object to export.
DBusException
- If the objectpath is already exporting an object.
or if objectpath is incorrectly formatted,public void addFallback(String objectprefix, DBusInterface object) throws DBusException
objectprefix
- The path below which the fallback handles calls.
MUST be in slash-notation, like "/org/freedesktop/Local",object
- The object to export.
DBusException
- If the objectpath is incorrectly formatted,public void removeFallback(String objectprefix)
objectprefix
- The prefix to remove the fallback for.public void unExportObject(String objectpath)
objectpath
- The objectpath to stop exporting.public void sendSignal(DBusSignal signal)
signal
- The signal to send.public <T extends DBusSignal> void removeSigHandler(Class<T> type, DBusSigHandler<T> handler) throws DBusException
type
- The signal to watch for.
DBusException
- If listening for the signal on the bus failed.
ClassCastException
- If type is not a sub-type of DBusSignal.public <T extends DBusSignal> void removeSigHandler(Class<T> type, DBusInterface object, DBusSigHandler<T> handler) throws DBusException
type
- The signal to watch for.object
- The object emitting the signal.
DBusException
- If listening for the signal on the bus failed.
ClassCastException
- If type is not a sub-type of DBusSignal.protected abstract <T extends DBusSignal> void removeSigHandler(DBusMatchRule rule, DBusSigHandler<T> handler) throws DBusException
DBusException
public <T extends DBusSignal> void addSigHandler(Class<T> type, DBusSigHandler<T> handler) throws DBusException
type
- The signal to watch for.handler
- The handler to call when a signal is received.
DBusException
- If listening for the signal on the bus failed.
ClassCastException
- If type is not a sub-type of DBusSignal.public <T extends DBusSignal> void addSigHandler(Class<T> type, DBusInterface object, DBusSigHandler<T> handler) throws DBusException
type
- The signal to watch for.object
- The object from which the signal will be emittedhandler
- The handler to call when a signal is received.
DBusException
- If listening for the signal on the bus failed.
ClassCastException
- If type is not a sub-type of DBusSignal.protected abstract <T extends DBusSignal> void addSigHandler(DBusMatchRule rule, DBusSigHandler<T> handler) throws DBusException
DBusException
protected <T extends DBusSignal> void addSigHandlerWithoutMatch(Class<? extends DBusSignal> signal, DBusSigHandler<T> handler) throws DBusException
DBusException
public void disconnect()
public void finalize()
finalize
in class Object
public DBusExecutionException getError()
public <A> void callWithCallback(DBusInterface object, String m, CallbackHandler<A> callback, Object... parameters)
object
- The remote object on which to call the method.m
- The name of the method on the interface to call.callback
- The callback handler.parameters
- The parameters to call the method with.public DBusAsyncReply callMethodAsync(DBusInterface object, String m, Object... parameters)
object
- The remote object on which to call the method.m
- The name of the method on the interface to call.parameters
- The parameters to call the method with.
protected void sendMessage(Message m)
public BusAddress getAddress() throws ParseException
ParseException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |