| Home · All Classes · All Namespaces · Modules · Functions · Files

Public Slots | Signals | Public Member Functions | List of all members
Tp::Service::ChannelTypeFileTransferAdaptor Class Reference
Channel service implementation

`#include <TelepathyQt/_gen/svc-channel.h>`

Inherits Tp::AbstractAdaptor.

## Public Slots

QDBusVariant | AcceptFile (uint addressType, uint accessControl, const QDBusVariant &accessControlParam, qulonglong offset, const QDBusMessage &dbusMessage)
QDBusVariant | ProvideFile (uint addressType, uint accessControl, const QDBusVariant &accessControlParam, const QDBusMessage &dbusMessage)

## Signals

void | FileTransferStateChanged (uint state, uint reason)
void | TransferredBytesChanged (qulonglong count)
void | InitialOffsetDefined (qulonglong initialOffset)
void | URIDefined (const QString &URI)

## Public Member Functions

uint | State () const
QString | ContentType () const
QString | Filename () const
qulonglong | Size () const
uint | ContentHashType () const
QString | ContentHash () const
QString | Description () const
qlonglong | Date () const
Tp::SupportedSocketMap | AvailableSocketTypes () const
qulonglong | TransferredBytes () const
qulonglong | InitialOffset () const
QString | URI () const
void | SetURI (const QString &newValue)
QString | FileCollection () const
Public Member Functions inherited from Tp::AbstractAdaptor
| AbstractAdaptor (const QDBusConnection &connection, QObject *adaptee, QObject *parent)
| ~AbstractAdaptor ()
QDBusConnection | dbusConnection () const
QObject * | adaptee () const

## Detailed Description

Adaptor class providing a 1:1 mapping of the D-Bus interface "org.freedesktop.Telepathy.Channel.Type.FileTransfer".

## Member Function Documentation

uint Tp::Service::ChannelTypeFileTransferAdaptor::State | ( |  | ) | const

Return the value of the exported D-Bus object property `State` of type `uint`.

Adaptees should export this property as a Qt property named 'state' with type uint.

The state of the file transfer as described by the File_Transfer_State enum.

Returns
  The value of exported property `State`.

QString Tp::Service::ChannelTypeFileTransferAdaptor::ContentType | ( |  | ) | const

Return the value of the exported D-Bus object property `ContentType` of type `QString`.

Adaptees should export this property as a Qt property named 'contentType' with type QString.

The file's MIME type. This cannot change once the channel has been created.

This property is mandatory when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. Protocols which do not have a content-type property with file transfers should set this value to application/octet-stream.

Returns
  The value of exported property `ContentType`.

QString Tp::Service::ChannelTypeFileTransferAdaptor::Filename | ( |  | ) | const

Return the value of the exported D-Bus object property `Filename` of type `QString`.

Adaptees should export this property as a Qt property named 'filename' with type QString.

The name of the file on the sender's side. This is therefore given as a suggested filename for the receiver. This cannot change once the channel has been created.

This property should be the basename of the file being sent. For example, if the sender sends the file /home/user/monkey.pdf then this property should be set to monkey.pdf.

This property is mandatory when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. This property cannot be empty and MUST be set to a sensible value.

Returns
  The value of exported property `Filename`.

qulonglong Tp::Service::ChannelTypeFileTransferAdaptor::Size | ( |  | ) | const

Return the value of the exported D-Bus object property `Size` of type `qulonglong`.

Adaptees should export this property as a Qt property named 'size' with type qulonglong.

The size of the file. If this property is set, then the file transfer is guaranteed to be this size. This cannot change once the channel has been created.

When you are creating a channel with this property, its value MUST be accurate and in bytes. However, when receiving a file, this property still MUST be in bytes but might not be entirely accurate to the byte.

This property is mandatory when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. If this information isn't provided in the protocol, connection managers MUST set it to UINT64_MAX.

Returns
  The value of exported property `Size`.

uint Tp::Service::ChannelTypeFileTransferAdaptor::ContentHashType | ( |  | ) | const

Return the value of the exported D-Bus object property `ContentHashType` of type `uint`.

Adaptees should export this property as a Qt property named 'contentHashType' with type uint.

The type of the ContentHash property.

This property is optional when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. However, if you wish to include the ContentHash property you MUST also include this property. If you omit this property from a ConnectionInterfaceRequestsInterface::CreateChannel() method call then its value will be assumed to be File_Hash_Type_None.

For each supported hash type, implementations SHOULD include an entry in ConnectionInterfaceRequestsInterface::RequestableChannelClasses with this property fixed to that hash type. If the protocol supports offering a file without a content hash, implementations SHOULD list this property in Allowed in a requestable channel class, mapping hash types they don't understand to None.

Returns
  The value of exported property `ContentHashType`.

QString Tp::Service::ChannelTypeFileTransferAdaptor::ContentHash | ( |  | ) | const

Return the value of the exported D-Bus object property `ContentHash` of type `QString`.

Adaptees should export this property as a Qt property named 'contentHash' with type QString.

Hash of the contents of the file transfer, of type described in the value of the ContentHashType property.

This property is optional when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. Its value MUST correspond to the appropriate type of the ContentHashType property. If the ContentHashType property is not set, or set to File_Hash_Type_None, then this property will not even be looked at.

Returns
  The value of exported property `ContentHash`.

QString Tp::Service::ChannelTypeFileTransferAdaptor::Description | ( |  | ) | const

Return the value of the exported D-Bus object property `Description` of type `QString`.

Adaptees should export this property as a Qt property named 'description' with type QString.

Description of the file transfer. This cannot change once the channel has been created.

This property is optional when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method. If this property was not provided by the remote party, connection managers MUST set it to the empty string.

Returns
  The value of exported property `Description`.

qlonglong Tp::Service::ChannelTypeFileTransferAdaptor::Date | ( |  | ) | const

Return the value of the exported D-Bus object property `Date` of type `qlonglong`.

Adaptees should export this property as a Qt property named 'date' with type qlonglong.

The last modification time of the file being transferred. This cannot change once the channel has been created

This property is optional when requesting the channel with the ConnectionInterfaceRequestsInterface::CreateChannel() method.

Returns
  The value of exported property `Date`.

Tp::SupportedSocketMap Tp::Service::ChannelTypeFileTransferAdaptor::AvailableSocketTypes | ( |  | ) | const

Return the value of the exported D-Bus object property `AvailableSocketTypes` of type `Tp::SupportedSocketMap`.

Adaptees should export this property as a Qt property named 'availableSocketTypes' with type Tp::SupportedSocketMap.

A mapping from address types (members of Socket_Address_Type) to arrays of access-control type (members of Socket_Access_Control) that the connection manager supports for sockets with that address type. For simplicity, if a CM supports offering a particular type of file transfer, it is assumed to support accepting it. Connection Managers MUST support at least Socket_Address_Type_IPv4.

A typical value for a host without IPv6 support:

      {
        Socket_Address_Type_IPv4:
          [Socket_Access_Control_Localhost, Socket_Access_Control_Port,
           Socket_Access_Control_Netmask],
        Socket_Address_Type_Unix:
          [Socket_Access_Control_Localhost, Socket_Access_Control_Credentials]
      }

Returns
  The value of exported property `AvailableSocketTypes`.

qulonglong Tp::Service::ChannelTypeFileTransferAdaptor::TransferredBytes | ( |  | ) | const

Return the value of the exported D-Bus object property `TransferredBytes` of type `qulonglong`.

Adaptees should export this property as a Qt property named 'transferredBytes' with type qulonglong.

The number of bytes that have been transferred at the time of requesting the property. This will be updated as the file transfer continues.

Returns
  The value of exported property `TransferredBytes`.

qulonglong Tp::Service::ChannelTypeFileTransferAdaptor::InitialOffset | ( |  | ) | const

Return the value of the exported D-Bus object property `InitialOffset` of type `qulonglong`.

Adaptees should export this property as a Qt property named 'initialOffset' with type qulonglong.

The offset in bytes from where the file should be sent. This MUST be respected by both the receiver and the sender after the state becomes Open, but before any data is sent or received. Until the InitialOffsetDefined() signal is emitted, this property is undefined.

Before setting the State property to Open, the connection manager MUST set the InitialOffset property, possibly to 0.

This property MUST NOT change after the state of the transfer has changed to Open.

Returns
  The value of exported property `InitialOffset`.

QString Tp::Service::ChannelTypeFileTransferAdaptor::URI | ( |  | ) | const

Return the value of the exported D-Bus object property `URI` of type `QString`.

Adaptees should export this property as a Qt property named 'uri' with type QString.

For outgoing file transfers, this requestable property allows the channel requester to inform observers (and the handler, if it is not the requester itself) of the URI of the file being transferred. Note that the connection manager SHOULD NOT read this file directly; the handler streams the file into the CM through the socket negotiated using ProvideFile() .

On outgoing file transfers, this property MUST NOT change after the channel is requested.

For incoming file transfers, this property MAY be set by the channel handler before calling AcceptFile() to inform observers where the incoming file will be saved. If set by an approver, the handler MUST save the file to that location. Setting this property once AcceptFile() has been called MUST fail. Once this property has been set URIDefined() is emitted.

If set, this URI SHOULD generally point to a file on the local system, as defined by RFC 1738 §3.10; that is, it should be of the form `file:///path/to/file` or `file://localhost/path/to/file`. For outgoing files, this URI MAY use a different scheme, such as `http:`, if a remote resource is being transferred to a contact.

Returns
  The value of exported property `URI`.

void Tp::Service::ChannelTypeFileTransferAdaptor::SetURI | ( | const QString & | newValue | ) |

Set the value of the exported D-Bus object property `URI` of type `QString`.

Adaptees should export this property as a writable Qt property named 'uri' with type QString.

For outgoing file transfers, this requestable property allows the channel requester to inform observers (and the handler, if it is not the requester itself) of the URI of the file being transferred. Note that the connection manager SHOULD NOT read this file directly; the handler streams the file into the CM through the socket negotiated using ProvideFile() .

On outgoing file transfers, this property MUST NOT change after the channel is requested.

For incoming file transfers, this property MAY be set by the channel handler before calling AcceptFile() to inform observers where the incoming file will be saved. If set by an approver, the handler MUST save the file to that location. Setting this property once AcceptFile() has been called MUST fail. Once this property has been set URIDefined() is emitted.

If set, this URI SHOULD generally point to a file on the local system, as defined by RFC 1738 §3.10; that is, it should be of the form `file:///path/to/file` or `file://localhost/path/to/file`. For outgoing files, this URI MAY use a different scheme, such as `http:`, if a remote resource is being transferred to a contact.

QString Tp::Service::ChannelTypeFileTransferAdaptor::FileCollection | ( |  | ) | const

Return the value of the exported D-Bus object property `FileCollection` of type `QString`.

Adaptees should export this property as a Qt property named 'fileCollection' with type QString.

The collection of files to which this channel belongs, or the empty string if this channel does not belong to a collection of files.

A channel's FileCollection property can never change.

At least on GTalk and apparently also on iChat the user can send a set of files to a contact and that contact can then pick and choose which files to actually receive.

The CM should emit all new FT channels belonging to one collection at the same time. UIs supporting this feature can then bundle all these channels together in some way, and show a nice UI. UIs not supporting it will treat them as separate transfers, which is not great but a reasonable fallback.

No mechanism is currently defined to indicate whether the UI should expect any more files in the same collection. UIs SHOULD assume that more file transfers may be added to a collection. It is possible that a "no more channels in this collection" indication will be added in a future version of this specification.

Returns
  The value of exported property `FileCollection`.

QDBusVariant Tp::Service::ChannelTypeFileTransferAdaptor::AcceptFile | ( | uint | addressType,
|  | uint | accessControl,
|  | const QDBusVariant & | accessControlParam,
|  | qulonglong | offset,
|  | const QDBusMessage & | dbusMessage
| ) |  |

slot

Begins a call to the exported D-Bus method `AcceptFile` on this object.

Adaptees should export this method as a Qt slot with the following signature: void acceptFile(uint addressType, uint accessControl, const QDBusVariant& accessControlParam, qulonglong offset, const Tp::Service::ChannelTypeFileTransferAdaptor::AcceptFileContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Accept a file transfer that's in the Pending state. The file transfer's state becomes Accepted after this method is called. At this point the client can connect to the socket. CM MUST emit InitialOffsetDefined and change the state to Open before writing to the socket. Then InitialOffset should be respected in case its value differs from the offset that was specified as an argument to AcceptFile.

Parameters

  addressType

      The type of address the connection manager should listen on.

  accessControl

      The type of access control the connection manager should apply to
      the socket.

  accessControlParam

      A parameter for the access control type, to be interpreted as
      specified in the documentation for the Socket_Access_Control enum.

  offset

      The desired offset in bytes where the file transfer should start.
      The offset is taken from the beginning of the file. Specifying an
      offset of zero will start the transfer from the beginning of the
      file. The offset that is actually given in the InitialOffset
      property can differ from this argument where the requested offset
      is not supported. (For example, some protocols do not support
      offsets at all so the InitialOffset property will always be 0.)

Returns

      The address on which the connection manager will listen for
      connections for this file transfer.

QDBusVariant Tp::Service::ChannelTypeFileTransferAdaptor::ProvideFile | ( | uint | addressType,
|  | uint | accessControl,
|  | const QDBusVariant & | accessControlParam,
|  | const QDBusMessage & | dbusMessage
| ) |  |

slot

Begins a call to the exported D-Bus method `ProvideFile` on this object.

Adaptees should export this method as a Qt slot with the following signature: void provideFile(uint addressType, uint accessControl, const QDBusVariant& accessControlParam, const Tp::Service::ChannelTypeFileTransferAdaptor::ProvideFileContextPtr &context);

Implementations should call MethodInvocationContext::setFinished (or setFinishedWithError accordingly) on the received context object once the method has finished processing.

Provide the file for an outgoing file transfer which has been offered. Opens a socket that the client can use to provide a file to the connection manager. The channel MUST have been requested, and will change state to Open when this method is called if its state was Accepted.

Parameters

  addressType

      The type of address the connection manager should listen on.

  accessControl

      The type of access control the connection manager should apply to
      the socket.

  accessControlParam

      A parameter for the access control type, to be interpreted as
      specified in the documentation for the Socket_Access_Control enum.

Returns

      The address on which the connection manager will listen for
      connections for this file transfer.

void Tp::Service::ChannelTypeFileTransferAdaptor::FileTransferStateChanged | ( | uint | state,
|  | uint | reason
| ) |  |

signal

Represents the exported D-Bus signal `FileTransferStateChanged` on this object.

Adaptees should export this signal as a Qt signal with the following signature: void fileTransferStateChanged(uint state, uint reason);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters

  state

      The new state of the file transfer; see the File_Transfer_State
      enumeration.

  reason

      The reason for the state change; see the
      File_Transfer_State_Change_Reason enumeration. The value will
      always be File_Transfer_State_Change_Reason_None, except when
      changing state to cancelled.

void Tp::Service::ChannelTypeFileTransferAdaptor::TransferredBytesChanged | ( | qulonglong | count | ) |

signal

Represents the exported D-Bus signal `TransferredBytesChanged` on this object.

Adaptees should export this signal as a Qt signal with the following signature: void transferredBytesChanged(qulonglong count);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters

  count

      The number of already transferred bytes.

void Tp::Service::ChannelTypeFileTransferAdaptor::InitialOffsetDefined | ( | qulonglong | initialOffset | ) |

signal

Represents the exported D-Bus signal `InitialOffsetDefined` on this object.

Adaptees should export this signal as a Qt signal with the following signature: void initialOffsetDefined(qulonglong initialOffset);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters

  initialOffset

      The value of the InitialOffset property.

void Tp::Service::ChannelTypeFileTransferAdaptor::URIDefined | ( | const QString & | URI | ) |

signal

Represents the exported D-Bus signal `URIDefined` on this object.

Adaptees should export this signal as a Qt signal with the following signature: void uriDefined(const QString& URI);

The adaptee signal will be automatically relayed as a D-Bus signal once emitted.

Parameters

  URI

      The value of the URI property.