NfcShareDataContent

Since: BlackBerry 10.0.0

#include <bb/system/NfcShareDataContent>

To link against this class, add the following line to your .pro file: LIBS += -lbbsystem

Defines a request to share data over NFC.

Clients specify the data they want to share by creating an instance of NfcShareDataContent, populating it with data, and passing the object to NfcShareManager::setShareContent(const NfcShareDataContent &).

A request must contain a valid combination of MIME type, data and URI fields. Rules that must be followed are:
  • If the data field is not empty, the MIME type of the data must be specified. The URI field will be ignored.

  • If the data field is empty, a valid URI must be provided.

  • The MIME type may be empty only if the data field is empty and a valid URI is provided. This can be used to share a link to a URL or remote file.

The following illustrates some of the most common data content specifications: 1. URL:
  • data: URL as plain text

  • MIME type: "text/URI-list"

  • URI: empty

-or-
  • data: empty

  • MIME type: empty

  • URI: URL using the correct URI scheme 2. Phone number - A phone number is represented as a URI with a scheme of "tel:", and so appears as follows:

  • data: telephone number URI as a string, with a scheme of "tel:" followed by the number

  • MIME type: "text/URI-list"

  • URI: empty

-or-
  • data: empty

  • MIME type: empty

  • URI: URL with a URI scheme of "tel:" 3. Text:

  • data: text in UTF-8 format

  • MIME type: "text/plain"

  • URI: empty 4. User-defined payload:

  • data: user-specific data encoded as an array of bytes

  • MIME type: user-specific MIME type that can be recognized by the receiving application on the target device

  • URI: empty 5. AppWorld - AppWorld content is referenced as a URI with a scheme of "appworld://". Use the URL and phone number specifications above as a guide.


Overview

Public Functions Index

NfcShareDataContent ()
NfcShareDataContent (const NfcShareDataContent &other)
~NfcShareDataContent ()
QByteArraydata () const
QStringmimeType () const
NfcShareDataContent &operator= (const NfcShareDataContent &other)
voidsetData (const QByteArray &data)
voidsetMimeType (const QString &mimeType)
voidsetUri (const QUrl &uri)
QUrluri () const

Public Functions

NfcShareDataContent ()

Creates a new NfcShareDataContent object.

Since:

BlackBerry 10.0.0

NfcShareDataContent (

Creates a copy of an existing NfcShareDataContent object.

Parameters
other

The source NfcShareDataContent object to copy.

Since:

BlackBerry 10.0.0

~NfcShareDataContent ()

Destructor.

Since:

BlackBerry 10.0.0

QByteArray data ()

Returns the binary data to be shared.

Valid values depend on the MIME type specified by setMimeType(). If omitted, the MIME type and URI must be sufficient for the sharing operation to proceed.

Required: NO.

Return:

Returns the binary data to be shared or an empty array if no data is to be shared.

Since:

BlackBerry 10.0.0

QString mimeType ()

Returns the MIME type of the data to be shared.

The MIME type must be a valid Internet media type, such as "image/png".

Required: YES.

Return:

Returns the MIME type of the data.

Since:

BlackBerry 10.0.0

NfcShareDataContent & operator= (

Copies the data of an existing NfcShareDataContent object to this object.

Parameters
other

The source NfcShareDataContent object to copy.

Return:

The NfcShareDataContent instance.

Since:

BlackBerry 10.0.0

void setData (

Sets the binary data sent to be shared.

Valid values depend on the MIME type specified by setMimeType(). If omitted, the MIME type and URI must be sufficient for the sharing operation to proceed.

Required: NO.

Parameters
data

The binary data to be shared or an empty array if no data is to be shared.

Since:

BlackBerry 10.0.0

void setMimeType (

Sets the MIME type of the data sent to be shared.

The MIME type must be a valid Internet media type, such as "image/png".

Required: YES.

Parameters
mimeType

The MIME type of the data.

Since:

BlackBerry 10.0.0

void setUri (

Sets the uniform resource identifier (URI) of the data to be shared.

If omitted, the MIME type and data must be sufficient for the sharing operation to proceed.

Required: NO.

Parameters
uri

The uniform resource identifier (URI) to be shared or an empty URI if no URI is required.

Since:

BlackBerry 10.0.0

QUrl uri ()

Returns the uniform resource identifier (URI) of the data to be shared.

If omitted, the MIME type and data must be sufficient for the sharing operation to proceed.

Required: NO.

Return:

Returns the uniform resource identifier (URI) to be shared or an empty URI if the no URI is required.

Since:

BlackBerry 10.0.0

Last modified: 2014-09-30



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus