QNdefMessage Class

The QNdefMessage class provides an NFC NDEF message. 更多...

头: #include <QNdefMessage>
qmake: QT += nfc
Since: Qt 5.2
继承: QList

该类在 Qt 5.2 引入。

公共函数

QNdefMessage (const QList<QNdefRecord> & records )
QNdefMessage (const QNdefMessage & message )
QNdefMessage (const QNdefRecord & record )
QNdefMessage ()
QByteArray toByteArray () const
bool operator== (const QNdefMessage & other ) const

静态公共成员

QNdefMessage fromByteArray (const QByteArray & message )

详细描述

A QNdefMessage is a collection of 0 or more QNdefRecords. QNdefMessage inherits from QList < QNdefRecord > and therefore the standard QList functions can be used to manipulate the NDEF records in the message.

NDEF messages can be parsed from a byte array conforming to the NFC Data Exchange Format technical specification by using the fromByteArray () static function. Conversely QNdefMessages can be converted into a byte array with the toByteArray () 函数。

成员函数文档编制

QNdefMessage:: QNdefMessage (const QList < QNdefRecord > & records )

Constructs a new NDEF message that contains all of the records in records .

QNdefMessage:: QNdefMessage (const QNdefMessage & message )

Constructs a new NDEF message that is a copy of message .

QNdefMessage:: QNdefMessage (const QNdefRecord & record )

Constructs a new NDEF message containing a single record record .

QNdefMessage:: QNdefMessage ()

Constructs a new empty NDEF message.

[static] QNdefMessage QNdefMessage:: fromByteArray (const QByteArray & message )

Returns an NDEF message parsed from the contents of message .

The message parameter is interpreted as the raw message format defined in the NFC Data Exchange Format technical specification.

If a parse error occurs an empty NDEF message is returned.

QByteArray QNdefMessage:: toByteArray () const

Returns the NDEF message as a byte array.

The return value of this function conforms to the format defined in the NFC Data Exchange Format technical specification.

bool QNdefMessage:: operator== (const QNdefMessage & other ) const

Returns true if this NDEF message is equivalent to other ;否则返回 false。

An empty message (i.e. isEmpty () returns true) is equivalent to a NDEF message containing a single record of type QNdefRecord::Empty .