×
Namespaces

Variants
Actions
(Difference between revisions)

Deactivate NVC connection to NFC Tag type 4 before closing to avoid app crash (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Subedit)
Line 1: Line 1:
 
[[Category:Near Field Communication (NFC)]][[Category:Qt Mobility]][[Category:Code Snippet]][[Category:Symbian]][[Category:Known Issue]]
 
[[Category:Near Field Communication (NFC)]][[Category:Qt Mobility]][[Category:Code Snippet]][[Category:Symbian]][[Category:Known Issue]]
{{Abstract| This article shows you how to get rid of application crashing when application using NFC with Tag Type 4.}}
+
{{Abstract|This article provides a workaround to avoid application crashes when closing the connection to an NFC Tag Type 4 on Symbian Belle.}}
  
 
{{ArticleMetaData <!-- v1.1 -->
 
{{ArticleMetaData <!-- v1.1 -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|devices=  Nokia C7
+
|devices=  Nokia C7 (firmware FW 022.013  and FW022.014)
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
Line 27: Line 27:
  
 
== Introduction ==
 
== Introduction ==
When a NFC application is run  on Symbian Anna/Belle that communicate with  NFC tag type 4 then we see a problem. The problem is that our application closed. Our application get a panic when the tag is removed.
+
When an NFC tag is lost/separated from the device a handler should be called to close the connection. Due to a bug in the NFC implementation on Symbian Belle, we need to first deactivate the connection before closing it, or the application will panic.
This happen because of a bug in NFC implementation. The bug has been identified and is fixed in platform release that will be available in the coming release after Belle.
+
 
 +
The bug is fixed in the mainline and should appear in firmware after the Belle is released.
  
 
== How to produce the bug ==
 
== How to produce the bug ==
-Use the following code when a tag is removed away from the C7 (for example)
+
# Implement your code to handle the tag lost event as below. Note that this is the ''correct'' way to handle the event:
This does not work  and give panic  though  the API should be used like this way.
+
#: <code cpp>
<code cpp>
+
 
void CNfcHandler::TagLost()  
 
void CNfcHandler::TagLost()  
 
{  
 
{  
iTag->CloseConnection(*iIso14443Connection);  
+
  iTag->CloseConnection(*iIso14443Connection);  
delete iIso14443Connection;  
+
  delete iIso14443Connection;  
iIso14443Connection = 0;  
+
  iIso14443Connection = 0;  
 
}
 
}
 
</code>
 
</code>
 +
# Run the application
 +
# Touch an NFC tag type 4 to the device (for example, a Nokia C7) and then remove it
  
-Run the application
+
The NFC app is closed due to a panic (Symbian unexpected exception).
  
-Bring an NFC tag type 4 and remove it (Our NFC app is closed because of panic)
+
== Workaround ==
  
== Work Around ==
+
The following code can be used to workaround this crash on Symbian Belle:
 
+
Because of the bug it does not work as it should be. We can try the following code if we develop application for platform up to Belle.
+
Following code works.
+
  
 
<code cpp>
 
<code cpp>
 
void CNfcHandler::TagLost()  
 
void CNfcHandler::TagLost()  
 
{  
 
{  
if(iIso14443Connection->IsActivated())  
+
  if(iIso14443Connection->IsActivated()) {  
{  
+
    iIso14443Connection->Deactivate();  
iIso14443Connection->Deactivate();  
+
  }  
}  
+
  iTag->CloseConnection(*iIso14443Connection);  
iTag->CloseConnection(*iIso14443Connection);  
+
  delete iIso14443Connection;  
delete iIso14443Connection;  
+
  iIso14443Connection = 0;  
iIso14443Connection = 0;  
+
 
}
 
}
 
</code>
 
</code>
  
 
== Device SW used to test==
 
== Device SW used to test==
Use C7 with FW 022.013  and FW022.014
+
Use C7 with FW 022.013  and FW022.014

Revision as of 01:28, 13 February 2012

This article provides a workaround to avoid application crashes when closing the connection to an NFC Tag Type 4 on Symbian Belle.

Article Metadata
Tested with
Devices(s): Nokia C7 (firmware FW 022.013 and FW022.014)
Compatibility
Platform(s):
Symbian
Article
Created: mahbub_s60 (06 Feb 2012)
Last edited: hamishwillee (13 Feb 2012)

Contents

Introduction

When an NFC tag is lost/separated from the device a handler should be called to close the connection. Due to a bug in the NFC implementation on Symbian Belle, we need to first deactivate the connection before closing it, or the application will panic.

The bug is fixed in the mainline and should appear in firmware after the Belle is released.

How to produce the bug

  1. Implement your code to handle the tag lost event as below. Note that this is the correct way to handle the event:
    void CNfcHandler::TagLost() 
    {
    iTag->CloseConnection(*iIso14443Connection);
    delete iIso14443Connection;
    iIso14443Connection = 0;
    }
  2. Run the application
  3. Touch an NFC tag type 4 to the device (for example, a Nokia C7) and then remove it

The NFC app is closed due to a panic (Symbian unexpected exception).

Workaround

The following code can be used to workaround this crash on Symbian Belle:

void CNfcHandler::TagLost() 
{
if(iIso14443Connection->IsActivated()) {
iIso14443Connection->Deactivate();
}
iTag->CloseConnection(*iIso14443Connection);
delete iIso14443Connection;
iIso14443Connection = 0;
}

Device SW used to test

Use C7 with FW 022.013 and FW022.014

142 page views in the last 30 days.
×