QNdefNfcSmartPosterRecord

Since: 1.2

#include <QtNfcSubset/QNdefNfcSmartPosterRecord>

The QNdefNfcSmartPosterRecord class provides an NFC RTD-SmartPoster.

RTD-SmartPoster encapsulates a Smart Poster.


Overview

Inheritance

QtMobilitySubset::QNdefRecord
QtMobilitySubset::QNdefNfcSmartPosterRecord

Public Types Index

enum ActionValue

Unset -1, Do 0, Save 1, Open 2

enum TypeNameFormat

Empty 0x00, NfcRtd 0x01, Mime 0x02, Uri 0x03, ExternalRtd 0x04, Unknown 0x05

Public Functions Index

ActionValueaction () const
voidaddIcon (const QByteArray &type, const QByteArray &data)
booladdTitle (const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding)
boolhasAction () const
boolhasIcon (const QByteArray &mimetype) const
boolhasSize () const
boolhasTypeInfo () const
QByteArrayicon (const QByteArray &mimetype) const
QByteArrayicon (int index) const
quint32iconCount () const
QByteArrayiconType (const QByteArray &mimetype) const
QByteArrayiconType (int index) const
Q_DECLARE_NDEF_RECORD (QNdefNfcSmartPosterRecord, QNdefRecord::NfcRtd,"Sp", QByteArray(0, char(0))) bool hasTitle(const QString &locale) const
boolsetAction (ActionValue act)
boolsetSize (quint32 size)
boolsetTypeInfo (const QByteArray &type)
boolsetUri (const QUrl &url)
quint32size () const
QStringtitle (const QString &locale) const
QNdefNfcTextRecord::EncodingtitleEncoding (const QString &locale) const
QStringtitleLocale (const QString &locale) const
QByteArraytypeInfo () const
QUrluri () const
QByteArrayid () const Inherited
boolisEmpty () const Inherited
boolisRecordType () const Inherited
booloperator!= (const QNdefRecord &other) const Inherited
QNdefRecord &operator= (const QNdefRecord &other)Inherited
booloperator== (const QNdefRecord &other) const Inherited
QByteArraypayload () const Inherited
QNdefRecord ()Inherited
QNdefRecord (const QNdefRecord &other)Inherited
voidsetId (const QByteArray &id)Inherited
voidsetPayload (const QByteArray &payload)Inherited
voidsetType (const QByteArray &type)Inherited
voidsetTypeNameFormat (TypeNameFormat typeNameFormat)Inherited
QByteArraytype () const Inherited
TypeNameFormattypeNameFormat () const Inherited

Protected Functions Index

Only has inherited protected functions

QNdefRecord (const QNdefRecord &other, TypeNameFormat typeNameFormat, const QByteArray &type, bool ignoreType=false)Inherited
QNdefRecord (TypeNameFormat typeNameFormat, const QByteArray &type)Inherited

Public Types

ActionValue

This enum describes the course of action that a device should take with the content.

Unset -1

The action is not defined.

Do 0

Do the action (send the SMS, launch the browser, make the telephone call).

Save 1

Save for later (store the SMS in INBOX, put the URI in a bookmark, save the telephone number in contacts).

Open 2

Open for editing (open an SMS in the SMS editor, open the URI in a URI editor, open the telephone number for editing).

TypeNameFormat Inherited

This enum describes the type name format of an NDEF record.

Empty 0x00

An empty NDEF record, the record does not contain a payload.

NfcRtd 0x01

The NDEF record type is defined by an NFC RTD Specification.

Mime 0x02

The NDEF record type follows the construct described in RFC 2046.

Uri 0x03

The NDEF record type follows the construct described in RFC 3986.

ExternalRtd 0x04

The NDEF record type follows the construct for external type names described the NFC RTD Specification.

Unknown 0x05

The type of the record is unknown and should be treated similar to content with MIME type 'application/octet-stream' without further context.

Public Functions

ActionValue action ()

Return:

Returns the action from the action record if available. Otherwise ActionValue::Unset is returned.

void addIcon (

Adds a new icon record with type type and data data.

Parameters
type

The MIME type that encodes the icon's image type

data

The image data encoded in the format corresponding to its type

bool addTitle (

Adds a new title record containing the title text using locale locale and encoded in encoding.

The method inserts the record and returns true if the smart poster does not already contain a title encoded in locale, otherwise the title is not added and false is returned.
Parameters
text

The text of the title

locale

The locale of the title

encoding

The encoding of the title

Return:

Returns true if the smart poster does not already contain a title encoded in locale, otherwise false

bool hasAction ()

Return:

Returns true if the smart poster record contains an action record, otherwise false.

bool hasIcon (

Return:

Returns true if the smart poster record contains an icon record with mimetype mimetype. If mimetype is empty then true is returned if at least one icon is present regardless of mimetype, otherwise false is returned.

Parameters
mimetype

The MIME type that encodes the icon's image type

bool hasSize ()

Return:

Returns true if the smart poster record contains a size record, otherwise false.

bool hasTypeInfo ()

Return:

Returns true if the smart poster record contains a type record, otherwise false.

QByteArray icon (

Return:

Returns the icon data from the first icon record matching mimetype if available. Otherwise an empty byte array is returned.

Parameters
mimetype

The MIME type that encodes the icon's image type

QByteArray icon (
  • intindex)

Return:

Returns the icon data from the icon record at position index if available. Otherwise an empty byte array is returned.

Parameters
index

The index position of the icon record

quint32 iconCount ()

Return:

Returns the total number of icon records contained in the smart poster record.

QByteArray iconType (

Return:

Returns the icon type from the first icon record matching mimetype if available. Otherwise an empty byte array is returned.

Parameters
mimetype

The MIME type that encodes the icon's image type

QByteArray iconType (
  • intindex)

Return:

Returns the icon type from the icon record at position index if available. Otherwise an empty byte array is returned.

Parameters
index

The index position of the icon record

Q_DECLARE_NDEF_RECORD (

bool setAction (

Sets the action record to act and returns true if the smart poster does not already contain an action record.

Otherwise, the action record is not changed and false is returned.
Parameters
act

The ActionValue type

Return:

Returns true if the smart poster record does not already contain an action record, otherwise false

bool setSize (
  • quint32size)

Sets the size record to size if the smart poster does not already contain a size record.

Parameters
size

The size of the size record

Return:

Returns true if the smart poster does not already contain a size record, otherwise false.

bool setTypeInfo (

Sets the type record to type if the smart poster does not already contain a type record.

Parameters
type

The type of the type record

Return:

Returns true if the smart poster does not already contain a type record, otherwise false.

bool setUri (

Sets the URI record to url and returns true if the smart poster does not already contain a URI record.

Otherwise, the URI is not changed and false is returned.
Parameters
url

The URI of the URI record

Return:

Returns true if the smart poster does not already contain a URI record, otherwise false

quint32 size ()

Return:

Returns the size from the size record if available. Otherwise returns 0.

QString title (

Return:

Returns the title from the title record encoded in locale if available. If locale is empty then the title from the first available record is returned regardless of locale. In all other cases an empty string is returned.

Parameters
locale

The locale to match with the title record

QNdefNfcTextRecord::Encoding titleEncoding (

Return:

Returns the encoding from the title record encoded in locale if available. If locale is empty then the encoding from the first available record is returned regardless of locale. In all other cases QNdefNfcTextRecord::Utf8 is returned.

Parameters
locale

The locale to match with the title record

QString titleLocale (

Return:

Returns the locale from the title record encoded in locale if available. If locale is empty then the locale from the first available record is returned regardless of locale. In all other cases an empty string is returned.

Parameters
locale

The locale to match with the title record

QByteArray typeInfo ()

Return:

Returns the type from the type record if available. Otherwise returns an empty byte array.

QUrl uri ()

Return:

Returns the URI from the URI record if available. Otherwise an empty URI is returned.

QByteArray id ()Inherited

Returns the id of the NDEF record.

bool isEmpty ()Inherited

Return:

Returns true if the NDEF record contains an empty payload; otherwise return false.

This is equivalent to calling {payload().isEmpty()}.

bool isRecordType (
  • typename T)
Inherited

Returns true if the NDEF record is of the specified record type; otherwise returns false.

bool operator!= (Inherited

Returns true if this NDEF record does not equal other; otherwise return false.

QNdefRecord & operator= (Inherited

Assigns this NDEF record to other.

bool operator== (Inherited

Returns true if other and this NDEF record are the same.

QByteArray payload ()Inherited

Returns the payload of the NDEF record.

QNdefRecord ()Inherited

Constructs a new empty NDEF record.

QNdefRecord (Inherited

Constructs a new NDEF record that is a copy of other.

void setId (Inherited

Sets the id of the NDEF record to id.

void setPayload (Inherited

Sets the payload of the NDEF record to payload.

void setType (Inherited

Sets the type of the NDEF record to type.

void setTypeNameFormat (Inherited

Sets the type name format of the NDEF record to typeNameFormat.

QByteArray type ()Inherited

Returns the type of the NDEF record.

TypeNameFormat typeNameFormat ()Inherited

Returns the type name format of the NDEF record.

Protected Functions

(Only has inherited protected functions)

QNdefRecord (Inherited

QNdefRecord (Inherited

Last modified: 2015-07-24



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

comments powered by Disqus