|
virtual | ~BaseChannelFileTransferType () |
|
QVariantMap | immutableProperties () const |
|
Direction | direction () const |
|
QString | contentType () const |
|
QString | filename () const |
|
qulonglong | size () const |
|
uint | contentHashType () const |
|
QString | contentHash () const |
|
QString | description () const |
|
QDateTime | date () const |
|
virtual Tp::SupportedSocketMap | availableSocketTypes () const |
|
uint | state () const |
|
void | setState (uint state, uint reason) |
|
qulonglong | transferredBytes () const |
|
void | setTransferredBytes (qulonglong count) |
|
qulonglong | initialOffset () const |
|
QString | uri () const |
|
QString | fileCollection () const |
|
void | setFileCollection (const QString &fileCollection) |
|
bool | remoteAcceptFile (QIODevice *output, qulonglong offset) |
|
bool | remoteProvideFile (QIODevice *input, qulonglong deviceOffset=0) |
|
| AbstractChannelInterface (const QString &interfaceName) |
|
virtual | ~AbstractChannelInterface () |
|
| AbstractDBusServiceInterface (const QString &interfaceName) |
|
virtual | ~AbstractDBusServiceInterface () |
|
QString | interfaceName () const |
|
DBusObject * | dbusObject () const |
|
bool | isRegistered () const |
|
bool | notifyPropertyChanged (const QString &propertyName, const QVariant &propertyValue) |
|
virtual | ~Object () |
|
| QObject (QObject *parent) |
|
virtual | ~QObject () |
|
virtual bool | event (QEvent *e) |
|
virtual bool | eventFilter (QObject *watched, QEvent *event) |
|
virtual const QMetaObject * | metaObject () const |
|
QString | objectName () const |
|
void | setObjectName (const QString &name) |
|
bool | isWidgetType () const |
|
bool | signalsBlocked () const |
|
bool | blockSignals (bool block) |
|
QThread * | thread () const |
|
void | moveToThread (QThread *targetThread) |
|
int | startTimer (int interval) |
|
void | killTimer (int id) |
|
T | findChild (const QString &name) const |
|
QList< T > | findChildren (const QString &name) const |
|
QList< T > | findChildren (const QRegExp ®Exp) const |
|
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
|
const QObjectList & | children () const |
|
void | setParent (QObject *parent) |
|
void | installEventFilter (QObject *filterObj) |
|
void | removeEventFilter (QObject *obj) |
|
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
|
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *receiver, const char *method) |
|
void | dumpObjectTree () |
|
void | dumpObjectInfo () |
|
bool | setProperty (const char *name, const QVariant &value) |
|
QVariant | property (const char *name) const |
|
QList< QByteArray > | dynamicPropertyNames () const |
|
void | destroyed (QObject *obj) |
|
QObject * | parent () const |
|
bool | inherits (const char *className) const |
|
void | deleteLater () |
|
| QObject (QObject *parent, const char *name) |
|
void | insertChild (QObject *object) |
|
void | removeChild (QObject *object) |
|
bool | isA (const char *className) const |
|
const char * | className () const |
|
const char * | name () const |
|
const char * | name (const char *defaultName) const |
|
void | setName (const char *name) |
|
| RefCounted () |
|
virtual | ~RefCounted () |
|
|
static BaseChannelFileTransferTypePtr | create (const QVariantMap &request) |
|
template<typename BaseChannelFileTransferTypeSubclass > |
static SharedPtr< BaseChannelFileTransferTypeSubclass > | create (const QVariantMap &request) |
|
QString | tr (const char *sourceText, const char *disambiguation, int n) |
|
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
|
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
|
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
|
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
|
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
|
Base class of Channel.Type.FileTransfer channel type.
Default implementation currently support only IPv4 and IPv6 sockets with localhost access control.
Usage:
- Add FileTransfer to the list of the protocol requestable channel classes.
- Add FileTransfer to the list of the connection requestable channel classes.
- Setup ContactCapabilities interface and ensure that FileTransfer requestable channel class presence matches to actual local (!) and remote contacts capabilities.
- Implement initial FileTransfer channel support in createChannel callback.
- The channel of interest are those with channelType TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER.
- Create BaseChannel and plug BaseChannelFileTransferType interface.
- If transferInterface->direction() is Outgoing, notify the remote side.
- Implement incoming file request handler:
- Properly setup the request details, take care on TargetHandle and InitiatorHandle.
- Call BaseConnection::createChannel() with the details. Do not suppress handler!
- Use remoteProvideFile() to pass the input device and its offset.
- transferredBytes property will be updated automatically on bytes written to the client socket.
- Implement "remote side accepted transfer" handler:
- Use remoteAcceptFile() to pass the requested initial offset and output device.
- Update transferredBytes property on bytes written to the remote side.
Incoming transfer process:
- Connection manager creates not requested channel with ChannelType = TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER and other properties, such as Filename, Size and ContentType.
- The channel initial state is Pending.
- At any time:
- Client calls AcceptFile method to configure the socket and request an initial offset. The implementation calls createSocket(), which should trigger (now or later) a call to setClientSocket() to setup the client socket. socketAddress() method used to return the socket address. This changes the state to Accepted.
- The connection manager calls remoteProvideFile() method to pass the input device and it's offset. The device offset is a number of bytes, already skipped by the device. The interface would skip remaining initialOffset - deviceOffset bytes.
- Client connects to the socket and triggers setClientSocket() call.
- The channel state is Open now.
- If the device is already ready to read, or emit readyRead() signal, the interface reads data from the device and write it to the clientSocket.
- Client socket emit bytesWritten() signal, the interface updates transferredBytes count.
- If transferredBytes == size, then the channel state changes to Completed. Otherwise the interface waits for further data from the device socket.
Outgoing transfer process:
- Client requests a channel with ChannelType = TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER and other properties, such as Filename, Size and ContentType.
- Connection manager creates the requested channel with initial state Pending.
- Connection manager asks remote contact to accept the transfer.
- At any time:
- Remote contact accept file, connection manager calls remoteAcceptFile() method to pass the output device and an initial offset. This changes the state to Accepted.
- Client calls ProvideFile method to configure a socket. The implementation calls createSocket(), which should trigger (now or later) a call to setClientSocket() to setup the client socket. socketAddress() method used to return the socket address.
- Client connects to the socket and triggers setClientSocket() call.
- The channel state is Open now.
- Client writes data to the socket.
- The clientSocket emits readyRead() signal, the interface reads the data from the clientSocket and write it to the io device.
- Connection manager calls updates transferredBytes property on actual data write.
- If transferredBytes == size, then the channel state changes to Completed. Otherwise the interface waits for further data from the client socket.
Subclassing: