The NDEFPusher class provides means to push NDEF messages between devices. More...
Inherits QObject.
Public Types |
|
enum | RequestStatus { REQUEST_OK, REQUEST_FAILED, REQUEST_PEER_LOST, REQUEST_PEER_REJECTED, REQUEST_PEER_LIMITS_EXCEEDED } |
Push request status. More... |
|
Signals |
|
void | pushServiceAvailable (void) |
void | pushServiceUnavailable (void) |
void | pushComplete (unsigned int id, enum NDEFPusher::RequestStatus status) |
void | pushProgress (unsigned int id, quint64 total, quint64 done) |
Public Member Functions |
|
Q_INVOKABLE | NDEFPusher (QObject *parent=0) |
virtual | ~NDEFPusher (void) |
Q_INVOKABLE bool | requestPushService (void) |
Q_INVOKABLE bool | isPushServiceAvailable (void) const |
Q_INVOKABLE bool | push (const QtMobility::QNdefMessage &message, unsigned int &id) |
Q_INVOKABLE bool | cancelPush (unsigned int id) |
NDEF messages can be pushed from device to device in various ways, including tag emulation and LLCP-based protocols such as SNEP (Simple NDEF Exchange Protocol). This class provides a mechanism for an application to push messages to other devices without having to bother with protocol-specific details.
An application should first create a NDEFPusher object and then request push service by requestPushService(). Once the service is available, the application can place NDEF messages into an outgoing queue using the push() method. Each message placed in the outgoing queue will be assigned an ID that can be used to cancel the push, and it is also used when NDEFPusher notifies the application of push transmission completion.
Q_INVOKABLE NDEFPusher::NDEFPusher | ( | QObject * | parent = 0 |
) |
Constructs a new NDEF pusher with parent.
virtual NDEFPusher::~NDEFPusher | ( | void | ) | [virtual] |
Destroys the NDEF pusher.
Q_INVOKABLE bool NDEFPusher::cancelPush | ( | unsigned int | id | ) |
Remove a message from the outgoing queue. Note that this can be done only if the message transfer has not yet started. The message in the queue is identified by id.
Returns true if the message was removed.
Q_INVOKABLE bool NDEFPusher::isPushServiceAvailable | ( | void | ) | const |
Check whether the push service is currently available.
Q_INVOKABLE bool NDEFPusher::push | ( | const QtMobility::QNdefMessage & | message, | |
unsigned int & | id | |||
) |
Place an NDEF message to the outgoing queue. Push service must be available for the call to succeed. Message delivery will be attempted when a peer device that can receive the message is detected.
Returns true if the message is succesfully placed in the queue, false otherwise. If true is returned, id will contain a push ID that is used to identify the message.
Once message transfer starts, pushProgress() signals will be emitted, informing the application of transfer progress. When message transfer is completed, succesfully or not, pushComplete() signal will be emitted.
void NDEFPusher::pushComplete | ( | unsigned int | id, | |
enum NDEFPusher::RequestStatus | status | |||
) | [signal] |
Emitted when a push request completes.
void NDEFPusher::pushProgress | ( | unsigned int | id, | |
quint64 | total, | |||
quint64 | done | |||
) | [signal] |
Emitted when some data is transferred for a push request.
void NDEFPusher::pushServiceAvailable | ( | void | ) | [signal] |
Emitted when push service becomes available.
void NDEFPusher::pushServiceUnavailable | ( | void | ) | [signal] |
Emitted when push service becomes unavailable.
Q_INVOKABLE bool NDEFPusher::requestPushService | ( | void | ) |
Request push service. When the request is completed, one of the signals pushServiceAvailable() and pushServiceUnavailable() will be emitted.
Also, if the push service becomes spontaneously available or unavailable the signals will be emitted.
Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
MeeGo 1.2 Harmattan API
|