MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9
   Home · All Classes · All Namespaces · Modules · Functions · Files

#include <TelepathyQt4/Connection>

Inherits Tp::AbstractInterface.

List of all members.

Public Slots

Signals

Public Member Functions

Static Public Member Functions

Protected Member Functions


Detailed Description

Proxy class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Connection."


Constructor & Destructor Documentation

Tp::Client::ConnectionInterface::ConnectionInterface ( const QString busName,
const QString objectPath,
QObject parent = 0  
)

Creates a ConnectionInterface associated with the given object on the session bus.

Parameters:
busName  Name of the service the object is on.
objectPath  Path to the object on the service.
parent  Passed to the parent class constructor.
Tp::Client::ConnectionInterface::ConnectionInterface ( const QDBusConnection connection,
const QString busName,
const QString objectPath,
QObject parent = 0  
)

Creates a ConnectionInterface associated with the given object on the given bus.

Parameters:
connection  The bus via which the object can be reached.
busName  Name of the service the object is on.
objectPath  Path to the object on the service.
parent  Passed to the parent class constructor.
Tp::Client::ConnectionInterface::ConnectionInterface ( Tp::DBusProxy proxy  ) 

Creates a ConnectionInterface associated with the same object as the given proxy.

Parameters:
proxy  The proxy to use. It will also be the QObject::parent() for this object.

Member Function Documentation

static QLatin1String Tp::Client::ConnectionInterface::staticInterfaceName (  )  [inline, static]

Returns the name of the interface "org.freedesktop.Telepathy.Connection", which this class represents.

Returns:
The D-Bus interface name.
Tp::PendingVariant* Tp::Client::ConnectionInterface::requestPropertyInterfaces (  )  const [inline]

Asynchronous getter for the remote object property Interfaces of type QStringList.

The set of optional interfaces supported by this connection. Before the connection status changes to CONNECTED, this property may change at any time, but it is guaranteed that interfaces will only be added, not removed. After the connection status changes to CONNECTED, this property cannot change further.

There is no explicit change notification; reasonable behaviour for a client would be to retrieve the interfaces list once initially, and once more when it becomes CONNECTED.

In some connection managers, certain capabilities of a connection are known to be implemented for all connections (e.g. support for SimplePresence), and some interfaces (like SimplePresence) can even be used before connecting. Other capabilities may or may not exist, depending on server functionality; by the time the connection goes CONNECTED, the connection manager is expected to have evaluated the server's functionality and enabled any extra interfaces for the remainder of the Connection's lifetime.

Returns:
A pending variant which will emit finished when the property has been retrieved.
Tp::PendingVariant* Tp::Client::ConnectionInterface::requestPropertySelfHandle (  )  const [inline]

Asynchronous getter for the remote object property SelfHandle of type uint.

The handle which represents the user on this connection, which will remain valid for the lifetime of this connection, or until a change in the user's identifier is signalled by the SelfHandleChanged signal. If the connection is not yet in the CONNECTED state, the value of this property MAY be zero.

Returns:
A pending variant which will emit finished when the property has been retrieved.
Tp::PendingVariant* Tp::Client::ConnectionInterface::requestPropertyStatus (  )  const [inline]

Asynchronous getter for the remote object property Status of type uint.

The current status of the connection. Change notification is via the StatusChanged() signal.

If retrieval of property succeeds and yields the value Disconnected, this indicates that the connection has not yet been established. If connection has been attempted and failed, the Connection object SHOULD be removed from the bus entirely, meaning that retrieval of this property SHOULD fail.

Returns:
A pending variant which will emit finished when the property has been retrieved.
Tp::PendingVariant* Tp::Client::ConnectionInterface::requestPropertyHasImmortalHandles (  )  const [inline]

Asynchronous getter for the remote object property HasImmortalHandles of type bool.

True if handles last for the whole lifetime of the Connection. This SHOULD be the case in all connection managers, but clients MUST interoperate with older connection managers (which reference-count handles).

Returns:
A pending variant which will emit finished when the property has been retrieved.
Tp::PendingVariantMap* Tp::Client::ConnectionInterface::requestAllProperties (  )  const [inline]

Request all of the DBus properties on the interface.

Returns:
A pending variant map which will emit finished when the properties have been retrieved.
QDBusPendingReply Tp::Client::ConnectionInterface::Connect ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method Connect on the remote object.

Request that the connection be established. This will be done asynchronously and errors will be returned by emitting StatusChanged() signals.

Calling this method on a Connection that is already connecting or connected is allowed, and has no effect.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
QDBusPendingReply Tp::Client::ConnectionInterface::Disconnect ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method Disconnect on the remote object.

Request that the connection be closed. This closes the connection if it's not already in DISCONNECTED state, and destroys the connection object.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
QDBusPendingReply<QStringList> Tp::Client::ConnectionInterface::GetInterfaces ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method GetInterfaces on the remote object.

Returns the set of optional interfaces supported by this connection. See Interfaces for more details.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
Returns:

The value of the Interfaces property

QDBusPendingReply<QString> Tp::Client::ConnectionInterface::GetProtocol ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method GetProtocol on the remote object.

Get the protocol this connection is using.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
Returns:

A string identifier for the protocol

QDBusPendingReply<uint> Tp::Client::ConnectionInterface::GetSelfHandle ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method GetSelfHandle on the remote object.

Returns the value of the SelfHandle property. Change notification is via the SelfHandleChanged signal.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
Returns:

The value of the SelfHandle property

QDBusPendingReply<uint> Tp::Client::ConnectionInterface::GetStatus ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method GetStatus on the remote object.

Get the current status as defined in the StatusChanged signal.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
Returns:

The value of the Status property

QDBusPendingReply Tp::Client::ConnectionInterface::HoldHandles ( uint  handleType,
const Tp::UIntList handles,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method HoldHandles on the remote object.

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, this method does nothing and returns successfully, unless the given handle type or any of the given handles is invalid.

In older connection managers, this method notifies the connection manger that your client is holding a copy of handles which may not be in use in any existing channel or list, and were not obtained by using the RequestHandles() method. For example, a handle observed in an emitted signal, or displayed somewhere in the UI that is not associated with a channel. The connection manager must not deallocate a handle where any clients have used this method to indicate it is in use until the ReleaseHandles() method is called, or the clients disappear from the bus.

Note that HoldHandles is idempotent - calling it multiple times is equivalent to calling it once. If a handle is "referenced" by several components which share a D-Bus unique name, the client should perform reference counting internally, and only call ReleaseHandles when none of the cooperating components need the handle any longer.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
handleType  The type of handle to be held
handles  A array of integer handles to hold
timeout  The timeout in milliseconds.
QDBusPendingReply<QStringList> Tp::Client::ConnectionInterface::InspectHandles ( uint  handleType,
const Tp::UIntList handles,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method InspectHandles on the remote object.

Return a string representation for a number of handles of a given type.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
handleType  The type of handle to be inspected
handles  An array of integer handles of this type
timeout  The timeout in milliseconds.
Returns:

An array of identifiers corresponding to the given handles, in the same order.

QDBusPendingReply<Tp::ChannelInfoList> Tp::Client::ConnectionInterface::ListChannels ( int  timeout = -1  )  [inline, slot]

Begins a call to the D-Bus method ListChannels on the remote object.

List all the channels which currently exist on this connection.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
timeout  The timeout in milliseconds.
Returns:

An array of structs representing channels.

QDBusPendingReply Tp::Client::ConnectionInterface::ReleaseHandles ( uint  handleType,
const Tp::UIntList handles,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method ReleaseHandles on the remote object.

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, this method does nothing and returns successfully, unless the given handle type or any of the given handles is invalid. In older connection managers, this method explicitly notifies the connection manager that your client is no longer holding any references to the given handles, and that they may be deallocated if they are not held by any other clients or referenced by any existing channels. See HoldHandles for notes.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
handleType  An integer handle type (as defined in RequestHandle)
handles  An array of integer handles being held by the client
timeout  The timeout in milliseconds.
QDBusPendingReply<QDBusObjectPath> Tp::Client::ConnectionInterface::RequestChannel ( const QString type,
uint  handleType,
uint  handle,
bool  suppressHandler,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method RequestChannel on the remote object.

Request a channel satisfying the specified type and communicating with the contact, room, list etc. indicated by the given handle_type and handle. The handle_type and handle may both be zero to request the creation of a new, empty channel, which may or may not be possible, depending on the protocol and channel type.

On success, the returned channel will always be of the requested type (i.e. implement the requested channel-type interface).

If a new, empty channel is requested, on success the returned channel will always be an "anonymous" channel for which the type and handle are both zero.

If a channel to a contact, room etc. is requested, on success, the returned channel may either be a new or existing channel to the requested entity (i.e. its ChannelInterface::TargetHandleType and ChannelInterface::TargetHandle properties are the requested handle type and handle), or a newly created "anonymous" channel associated with the requested handle in some implementation-specific way.

For example, for a contact handle, the returned channel might be "anonymous", but implement the groups interface and have the requested contact already present among the members.

If the request cannot be satisfied, an error is raised and no channel is created.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
type  A D-Bus interface name representing base channel type
handleType  An integer representing the handle type, or Handle_Type_None if no handle is specified
handle  A nonzero integer handle representing a contact, room, list etc. according to handle_type, or zero if the handle_type is Handle_Type_None
suppressHandler  Clients SHOULD always set this to true. The historical meaning was that clients that did not intend to take responsibility for displaying the channel to the user could set this to FALSE, in which case the channel dispatcher would launch an appropriate channel handler. However, clients whose functionality relies on having a working channel dispatcher should obtain that functionality by calling methods on the channel dispatcher, so that they will get an appropriate error if the channel dispatcher is missing or not working. The channel dispatcher itself should set this to true too, so that it will ignore the NewChannel signal that results from the creation of the channel. It can then dispatch the channel returned from this method to an appropriate handler. So, there is no sensible use-case for setting this to false, and setting it to false can result in unhandled channels (in the case where clients assume that a channel dispatcher is present, but it isn't).
timeout  The timeout in milliseconds.
Returns:

The D-Bus object path for the channel created or retrieved

QDBusPendingReply<Tp::UIntList> Tp::Client::ConnectionInterface::RequestHandles ( uint  handleType,
const QStringList identifiers,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method RequestHandles on the remote object.

Request several handles from the connection manager which represent a number of contacts, rooms or server-stored lists on the service.

If HasImmortalHandles is true, which SHOULD always be the case in this version of telepathy-spec, the handles remain valid until the connection disconnects.

The implementation of this method in older connection managers must record that these handles are in use by the client who invokes this method, and must not deallocate the handles until the client disconnects from the bus or calls the ReleaseHandles() method. Where the identifier refers to an entity that already has a handle in this connection manager, this handle should be returned instead. The handle number 0 must not be returned by the connection manager.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
handleType  The type of handle required
identifiers  An array of identifiers of entities to request handles for
timeout  The timeout in milliseconds.
Returns:

An array of integer handle numbers in the same order as the given identifiers.

QDBusPendingReply Tp::Client::ConnectionInterface::AddClientInterest ( const QStringList tokens,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method AddClientInterest on the remote object.

Register a client's interest in notifications related to one or more interfaces.

Groups of notifications are identified by a token which is either a D-Bus interface name, or a string that starts with a D-Bus interface name. The meaning of each token is given by that D-Bus interface, which MUST define it in its documentation.

Initially, all interests are in entire interface, but allowing other strings allows subscription to part of an interface; for instance, an interest in ...MailNotification/count could track the number of messages without caring about their detailed content.

For each token with which this method interacts, the Connection tracks an "interest count" (like a reference count) for each unique bus name that has called this method. When a client calls this method, for each token, the interest count for its unique bus name is incremented; when RemoveClientInterest() is called, all interest counts for that unique bus name are decremented. If the unique bus name leaves the bus (for instance, if the client crashes or exits), all interest counts for that unique bus name are set to zero.

The Connection can then use these reference counts to avoid subscribing to protocol-level notifications unless at least one client has a non-zero interest count for the relevant token.

This method exists to reduce memory and network overhead when there is no active subscription.

One situation where this is useful is ConnectionInterfaceLocationInterface : on XMPP, location updates are received over PEP. If the Connection advertises the geoloc+notify capability, it will be sent location updates for all contacts. To avoid consuming resources for this, the connection should avoid advertising that capability until a client has expressed an interest in contacts' locations.

Another example of a protocol that benefits from this method is the Google XMPP Mail Notification extension, which can be used to implement ConnectionInterfaceMailNotificationInterface . In this protocol, the CM receives a notification that something has changed, but to get more information, the CM must request this information. Knowing that nobody is currently interested in this information, the CM can avoid generating useless network traffic. Similarly, the CM may free the list of unread messages to reduce memory overhead.

If this method is called for an interface that might require protocol-level subscription, but the connection cannot set up that subscription yet (for instance because the Status is not Connected yet), the Connection MUST remember the client's interest, and attempt to subscribe to the appropriate protocol feature when this becomes possible.

Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.

The only reason it could fail is if it's unimplemented, in which case the only thing the client can usefully do is to proceed as if it had succeeded.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
tokens 

Interfaces or parts of interfaces in which to register an interest, represented by either a DBus_Interface, or a string prefixed with a DBus_Interface.

If the Connection does not support one of these tokens, this is not considered to be an error; the unsupported token is simply ignored.

timeout  The timeout in milliseconds.
QDBusPendingReply Tp::Client::ConnectionInterface::RemoveClientInterest ( const QStringList tokens,
int  timeout = -1  
) [inline, slot]

Begins a call to the D-Bus method RemoveClientInterest on the remote object.

Release an interest registered using AddClientInterest() . See that method's documentation for details.

Clients MAY ignore any errors raised by this method; it is intended to be called with the reply ignored.

The only reasons it could fail are if it's unimplemented, or if the client's reference-counting is wrong and it has tried to remove a client interest that it did not add. In both cases, there's nothing the client could do about it.

Note that timeout is ignored as of now. It will be used once http://bugreports.qt.nokia.com/browse/QTBUG-11775 is fixed.

Parameters:
tokens 

Interfaces or parts of interfaces that were previously passed to AddClientInterest() .

timeout  The timeout in milliseconds.
void Tp::Client::ConnectionInterface::SelfHandleChanged ( uint  selfHandle  )  [signal]

Represents the signal SelfHandleChanged on the remote object.

Emitted whenever the SelfHandle property changes. If the connection is not yet in the CONNECTED state, this signal is not guaranteed to be emitted.

Parameters:
selfHandle  The new value of the SelfHandle property.
void Tp::Client::ConnectionInterface::NewChannel ( const QDBusObjectPath objectPath,
const QString channelType,
uint  handleType,
uint  handle,
bool  suppressHandler  
) [signal]

Represents the signal NewChannel on the remote object.

Emitted when a new Channel object is created, either through user request or incoming information from the service.

Parameters:
objectPath  A D-Bus object path for the channel object on this service
channelType  A D-Bus interface name representing the channel type
handleType  An integer representing the type of handle this channel communicates with, or Handle_Type_None if no handle is specified
handle  A handle indicating the specific contact, room or list this channel communicates with, or zero if no handle is specified
suppressHandler 

If true, the channel was requested by a client that intends to present it to the user itself (i.e. it passed suppress_handler=TRUE to the RequestChannel() method), so no other handler should be launched. Clients MAY assume that channels where this is true were created by a user request.

If false, either the channel was created due to incoming information from the service, or the channel was requested by a local client that does not intend to handle the channel itself (this usage is deprecated).

Clients MUST NOT assume that only incoming channels will have this flag set to false.

void Tp::Client::ConnectionInterface::ConnectionError ( const QString error,
const QVariantMap &  details  
) [signal]

Represents the signal ConnectionError on the remote object.

Emitted when an error occurs that renders this connection unusable.

Whenever this signal is emitted, it MUST immediately be followed by a StatusChanged() signal with status Connection_Status_Disconnected and an appropriate reason code.

Connection managers SHOULD emit this signal on disconnection, but need not do so. Clients MUST support connection managers that emit StatusChanged(Disconnected, ...) without first emitting ConnectionError.

This signal provides additional information about the reason for disconnection. The reason for connection is always straightforward - it was requested - so it does not need further explanation. However, on errors, it can be useful to provide additional information.

The Connection_Status_Reason is not given here, since it will be signalled in StatusChanged() . A reasonable client implementation would be to store the information given by this signal until StatusChanged is received, at which point the information given by this signal can be used to supplement the StatusChanged signal.

Parameters:
error  The name of a D-Bus error describing the error that occurred, which may correspond to a Connection_Status_Reason, or may be a more specific Telepathy error (such as org.freedesktop.Telepathy.Error.ConnectionRefused for Connection_Status_Reason_Network_Error) or a protocol-specific or connection-manager-specific error in a suitable namespace. For instance, a SIP connection manager could signal "402 Payment Required" as an error in a connection-manager-specific namespace, or a link-local XMPP implementation that used Avahi could provide the error given to it by the avahi-daemon.
details 

Additional information about the error, which may include the following well-known keys:

debug-message (s)
Debugging information on the change, corresponding to the message part of a D-Bus error message, which SHOULD NOT be displayed to users under normal circumstances
server-message (s)
A human-readable message from the server explaining what happened. This may be in the user's native language, or in the server operator's native language, or even in Lojban.
user-requested (b), expected-hostname (s), certificate-hostname (s)
The same details defined in TLS_Certificate_Rejection.
void Tp::Client::ConnectionInterface::StatusChanged ( uint  status,
uint  reason  
) [signal]

Represents the signal StatusChanged on the remote object.

Emitted when the status of the connection changes. All states and reasons have numerical values, as defined in ConnectionStatus and ConnectionStatusReason.

Parameters:
status  An integer indicating the new status, as defined by ConnectionStatus
reason  An integer indicating the reason for the status change, as defined by ConnectionStatusReason
void Tp::Client::ConnectionInterface::invalidate ( Tp::DBusProxy proxy,
const QString error,
const QString message  
) [protected, virtual]

Reimplemented from Tp::AbstractInterface.


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5