-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
1.2.0, 1.2.1, 1.2.2, 1.2.x
-
None
-
Qt Mobility 1.2.2
When checking for bits / flags set in an integer, the possible values should be defined as 0x1, 0x2, 0x4, 0x8, etc. This allows testing the individual possibilities.
However, the enum QNearFieldTarget::AccessMethod defines the possible target access methods as:
enum AccessMethod {
NdefAccess,
TagTypeSpecificAccess,
LlcpAccess
};
-> NdefAccess is 0x0, TagTypeSpecificAccess 0x1, LlcpAccess 0x2.
This makes it impossible for a target to have both NDEF and tag type specific access, which should be the case for all tags on Symbian where tag specific access is possible in addition to NDEF access. Furthermore, there should be an enum value for NoAccess, e.g., for unsupported / future target types.
The proposed solution would be to define the flags as follows:
enum AccessMethod {
NoAccess = 0x0,
NdefAccess = 0x1,
TagTypeSpecificAccess = 0x2,
LlcpAccess = 0x4
};
—
The current definition also results in another problem that becomes apparent when updating from Qt Mobility 1.2.1 to 1.2.2:
v1.2.1 had a bug that it never set the TagTypeSpecific access flag, even if tag specific access was possible. Therefore, the accessMethods was 0x0 when touching a tag, which automatically "resulted" in NdefAccess (defined as 0x0 as no specific value is set). An application could rely on:
if (accessMethods.testFlag(QNearFieldTarget::NdefAccess) {
// Read or write NDEF messages
}
In v1.2.2, this issue seems to be fixed and Qt Mobility properly sets the TagTypeSpecificAccess flag. The way the enum is defined now, this means that the same testFlag(QNearFieldTarget::NdefAccess) call returns false - even if NDEF access is of course still possible.
Therefore, all NFC apps that check for NdefAccess break when the phone is upgraded to Qt Mobility 1.2.2.
The temporary app-side workaround is to ignore the NdefAccess-flag-test returning false and still attempting to read an NdefMessage.
if (accessMethods.testFlag(QNearFieldTarget::NdefAccess) ||
accessMethods.testFlag(QNearFieldTarget::TagTypeSpecificAccess)) {
// Read or write NDEF message workaround
// -> also reads NDEF messages from the target if QtM doesn't report NdefAccess would be possible, but only has tag type specific access allowed
}