Package dbus :: Module server :: Class Server
[hide private]
[frames] | no frames]

Class Server

source code

            object --+    
                     |    
_dbus_bindings._Server --+
                         |
                        Server

An opaque object representing a server that listens for connections from other applications.

This class is not useful to instantiate directly: you must subclass it and either extend the method connection_added, or append to the list on_connection_added.




Since: 0.83

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_on_new_connection(self, conn) source code
 
connection_added(self, conn)
Respond to the creation of a new Connection.
source code
 
connection_removed(self, conn)
Respond to the disconnection of a Connection.
source code

Inherited from _dbus_bindings._Server: disconnect, get_address, get_id, get_is_connected

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
__new__(cls, address, connection_class=<class 'dbus.connection.Connection'>, mainloop=None, auth_mechanisms=None)
Construct a new Server.
source code
Instance Variables [hide private]
  on_connection_added
A list of callbacks to invoke when a connection is added.
  on_connection_removed
A list of callbacks to invoke when a connection becomes disconnected.
Properties [hide private]
  address
get_address() -> str
  id
get_id() -> str
  is_connected
get_is_connected() -> bool

Inherited from object: __class__

Method Details [hide private]

__new__(cls, address, connection_class=<class 'dbus.connection.Connection'>, mainloop=None, auth_mechanisms=None)
Static Method

source code 
Construct a new Server.
Parameters:
  • address (str) - Listen on this address.
  • connection_class (type) - When new connections come in, instantiate this subclass of dbus.connection.Connection to represent them. The default is Connection.
  • mainloop (dbus.mainloop.NativeMainLoop or None) - The main loop with which to associate the new connections.
  • auth_mechanisms (sequence of str) - Authentication mechanisms to allow. The default is to allow any authentication mechanism supported by libdbus.
Returns:
a new object with type S, a subtype of T

Overrides: _dbus_bindings._Server.__new__

__init__(self, *args, **kwargs)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

connection_added(self, conn)

source code 

Respond to the creation of a new Connection.

This base-class implementation just invokes the callbacks in the on_connection_added attribute.

Parameters:
  • conn (dbus.connection.Connection) - A D-Bus connection which has just been added.

    The type of this parameter is whatever was passed to the Server constructor as the connection_class.

connection_removed(self, conn)

source code 

Respond to the disconnection of a Connection.

This base-class implementation just invokes the callbacks in the on_connection_removed attribute.

Parameters:
  • conn (dbus.connection.Connection) - A D-Bus connection which has just become disconnected.

    The type of this parameter is whatever was passed to the Server constructor as the connection_class.


Instance Variable Details [hide private]

on_connection_added

A list of callbacks to invoke when a connection is added. They receive two arguments: this Server and the new Connection.

on_connection_removed

A list of callbacks to invoke when a connection becomes disconnected. They receive two arguments: this Server and the removed Connection.

Property Details [hide private]

address

get_address() -> str

Returns the address of the server.

Get Method:
_dbus_bindings._Server.get_address() - Returns the address of the server.

id

get_id() -> str

Returns the unique ID of the server.

Get Method:
_dbus_bindings._Server.get_id() - Returns the unique ID of the server.

is_connected

get_is_connected() -> bool

Return true if this Server is still listening for new connections.

Get Method:
_dbus_bindings._Server.get_is_connected() - Return true if this Server is still listening for new connections.