Home
Android application associated to the EVAL
Contents
1. 22 Document revision history 24 DoclD025379 Rev 1 3 25 List of figures AN4375 List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 4 25 Typical application block 1 Welcome SCreen or Rea nek hee a han aie ee Page SMe RR 6 Firmware selection and upload lt 7 Thread logical view rn 8 Hoot file lisi uie etre hae wedi a e 10 New project creation 11 Import source code 11 Sequence chart of a full firmware 23 d DoclD025379 Rev 1 4375 Reference documents RX95HF datasheet ISO IEC 18092 4 M24SRXX datasheets RX95HFDemo FWU application source code RX95HFDemo FWU application generated javadoc Android reference web site Datasheet available on www st com under RX95HF Datasheets available on www st com under M24SH series STSW RX95HF001 from www st com available with source code package http developer android com reference packages html Glossary APK Android app
2. life augmented AN4375 Application note Android application associated to the EVAL RX95HF board Firmware upgrade use case example Introduction This application note describes how the Android application associated to the EVAL RX95HF board is structured This application note intends to explain how to integrate the Firmware upgrade function from a cellular phone to the EVAL RX95HF board in order to help the developer to speed up the development and software maturation steps of his own Android application The Android application associated to the EVAL RX95HF board is a simple use case demonstration of a half duplex Near field communication NFC between an NFC enabled cellular phone and the dual memory interface receiver ST RX95HF When a phone is tapped on the EVAL RX95HF board a Near field communication is detected If the EVAL RX95HF board is configured in tag emulator mode the application is automatically launched The user can then upload the new firmware on the board and request the EVAL RX95HF to switch to this new firmware if the binary update is successful In case of an NFC communication loss during the upload the application has the capability to resume the upload from the latest chunk successfully sent to the evaluation board Figure 1 Typical application block diagram Android phone EVAL RX95HF board MS33303V1 Table 1 Applicable tools and software Type Part numbers Andr
3. Importing Android application source code The application has been developed under Eclipse IDE In order to parse code rebuild the application and integrate new functions the developer has to import the whole source code project Prerequisites are as follows e Eclipse IDE has been installed e Android SDK amp ADT Android Development Tool plug in has been installed The way to install ADT bundle and Android SDK components is explained on the official Android developer web site To go further retrieve the source code package available on the ST web site add the logical link of the application and unzip the package under a temporary folder After decompressing the application project zip package open the installed Eclipse IDE and create a new project File New Project to display the New Project panel see Figure 6 d DoclD025379 Rev 1 4375 Software architecture Figure 6 New project creation panel New Project arim Select a wizard lt gt Create one or more Android projects from existing code Wizards type filter text g Java Project 3 Java Project from Existing Ant Buildfile H Plug in Project amp General amp Android 8 Android Application Project B Android Project from Existing Code 8 Android Sample Project J Android Test Project cs amp Java Plug in Development Developers can select An
4. called at the application level to store the UID tag A parsing function can be introduced here to verify that the tag involved in the NFC field is the expected one DoclD025379 Rev 1 13 25 Software architecture AN4375 2 4 2 4 1 14 25 APK embedded relay methods e private void copyFile InputStream in OutputStream out throws IOException e private void copyFirmwares e private void installbinaryfromapk throws NameNotFoundException File management activity class The FileManagement FileManagement java file class extends the activity class Then the same methods overridden in the NFCappsActivity Menu class must also be overridden This class handles user input events user interface updates and the Firmware upload process The FileManagement object uses the StartLoadFromFileTask object to handle the upload process by itself Class members Status members In order to know which state the activity reaches the latest status of the upload request is stored using the following attributes e public static boolean statusErrorWrite false e public static boolean statusErrorWrite continue false User interface members As the activity gets its own android graphical surface view the class needs to have some specific user interface members in order to update the graphical widget state and to manage the user action linked to it Button buttonWriteFromFile This button is used to handle events coming from the u
5. the previous one if it has been interrupted The sequence of commands to send must follow the command set defined in the tag emulator firmware see EVAL RX95HF board firmware user manual from www st com Following the status of each command sent this member returns a specific NFCCommandSiatus error to let the caller layer decide if a resume is necessary or not The command sequence is detailed in Section 3 DoclD025379 Rev 1 19 25 Digital protocol description AN4375 3 3 1 3 1 1 20 25 Digital protocol description This section describes the simple digital protocol used by the NFCCommandlso 14443A object to ensure the firmware or binary file upload task The digital protocol is based on the 7816 standard part 4 Organization security and commands for interchange reused in 14443 4 document APDU Overview As described in ISO IEC 7816 4 an application protocol data unit APDU contains either a command message or a response message sent from the interface device i e a phone to the card EVAL RX95HF or conversely In a command response pair the command message and the response message can contain data thus inducing four cases Table 2 Command and response data Case Command data Expected response data 1 No data No data 2 No data Data 3 Data No data 4 Data Data The command APDU consists of e mandatory header of 4 bytes CLA INS P1 P2 e a conditional body of a variable l
6. the buffer size to send Then the dolnBackground method is called e protected Void StartLoadFromFileTask dolnBackground Void params It starts the upload process by calling APDUsendUpdateBinaryNew from NFCCommandlso14443A class with the right parameters resume status current handled NFC tag and computed CRC file e protected void StartLoadFromFileTask onPostExecute final Void unused This method is called when the upload process is stopped i e the upload is successful or interrupted The goal of this method is to check the upload result type NFCCommandStatus defined in NFCCommandlso144434 and to update the user interface of the FileManagement activity accordingly NFCCommandlso14443A class NFCCommandlso14443A NFCCommandlso14443A java file class defines the object which controls the digital protocol communication with the RX95HF through the Android NFC stack As the set of commands to send see next section is light this object has only one method to perform the NFC Firmware upload DoclD025379 Rev 1 17 25 Software architecture AN4375 2 5 1 18 25 Class members public enum NFCCommandStatus CMD_OK CMD_SELECTAPPLIERR CMD_UPDATESIZEINFERR CMD_UPLOADBUFFEREXCEPTIONERR CMD_SENDCHUNCKERR CMD_CLOSEFILEMSGERR CMD_CRCMSGINGERR CMD_LAUNCHACTIONERR CMD_TAGUNREACHABLEERR CMD_STATUSUNKNOWN The error enumeration is used by the caller to update an object status or a graphic user interface and to not
7. the detailed connectivity NFC API description from http developer android com guide topics connectivity nfc index html User interface attributes e Button binwww e private ImageView imgScan e private int drawablelmagelD e private Timer rolllmage These fields give the java object the capabilities to manage graphical interfaces NFCappsActivity Menu controls GUI events such as pressing a button to start a new browsing activity or requesting the graphic user interface system to perform a graphical animation to simulate the NFC field activation File System management attributes e private dataApplicationDir string e public FirmwareApplicationDirPath static string e private FirmwareApplicationDir file File system attributes are declared and used to extract firmware from the APK Android package to the appData folder The Android application appData folder comes from the Android application structure defined by google The first time the application is installed the user can immediately start a Firmware upload to his EVAL RX95HF board NFCappsActivity Menu java methods Activity methods e public void onCreate saved nstanceState bundle The inheritance from the activity class implies to declare and implement the on Create method This method is defined in the activity class as NFCappsActivity Menu java extends the activity class the developer must redefine this method It is called at the activity creation by the Andro
8. upgrade application 3 2 1 Class and Instruction code d 0x00 structure and coding of command and response according to 7816 4 No SM or no SM indication class In this case the instructions used are defined by the following codes 4 Select File OxD6 Update binary OxA2 unless otherwise specified by the application context structure and coding of command and response according to 7816 4 No SM or no SM indication associated to channel 2 format This class is associated to the following proprietary instruction codes 0x41 Send a buffer size update command 0 42 Send a CRC update command OxFF Send a start request DoclD025379 Rev 1 21 25 Digital protocol description AN4375 3 2 2 Detailed commands Table 6 Select the application frame CLA INS P1 P2 LC Field Data Data Data Data 0x00 0 4 0 04 0 00 0x10 OxFO 0x02 0x46 0x57 0x55 Ox5F 0x58 0x58 Ox4F Ox5F 0x76 0x30 0x00 0x00 0x00 0x00 Table 7 Buffer size update CLA INS P1 P2 LC Field Data Data Data Data 0 2 0 41 0 80 0 00 0 02 OxXX OxXX Table 8 Update by chunk CLA INS P1 P2 LC Field Data Data Data Data 0x00 0 06 OxX1 OxX1 0 3 data 0 data 1 data 3 Table 9 Update remaining data CLA INS P1 P2 LC Field Data Data Data Data 0x00 0 06 OxX1 OxX1 0 3 data 0 data 1 data 3
9. 95HF digital protocol APDU description 21 3 2 1 Class and Instruction code 21 3 2 2 Detailed commands 22 4 Revision history 24 2 25 DoclD025379 Rev 1 Ly 4375 List of tables List of tables Table 1 Table 2 Table 3 Table 4 Table 5 Table 6 Table 7 Table 8 Table 9 Table 10 Table 11 Table 12 Table 13 d Applicable products siss ios sra exo Reg id Parte 1 Command and response data 20 Header and body 20 APDU command sent by the 20 APDU response 21 Select the application 22 Buffer size 22 Update by ch nk ou c ee gna C ra e bali hee ws S KR RR UN 22 Update remaining data liliis 22 Close a eu e a 22 D 22 8
10. TED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS B AERONAUTIC APPLICATIONS C AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS AND OR D AEROSPACE APPLICATIONS OR ENVIRONMENTS WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE THE PURCHASER SHALL USE PRODUCTS AT PURCHASER S SOLE RISK EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS PRODUCTS FORMALLY ESCC QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2013 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Ital
11. Table 10 Close file CLA INS P1 P2 LC Field Data Table 11 Send CRC CLA INS P1 P2 LC Field Data Data Data Data Table 12 Send start request CLA INS P1 P2 LC Field Data Data OxA2 OxFE 0x80 0x00 0x02 0x70 0x69 22 25 DoclD025379 Rev 1 Ly 4375 Digital protocol description Figure 8 Sequence chart of a full firmware upload NFCCommandStatus Android pxas5 H NFC Stack RX95 HF APDUsendUpdateBinaryNew ACK 0x90 0x00 APDU Update Size Framg ACK 0x90 0x00 e APDU update binary chunk ACK 0x90 0x00 1 z x 01 n APDU update binary chunk Hp ACK 0x90 0x00 x n last complete chunk APDU update last residual chun ACK 0x90 0x00 APBU request to clo ACK 0x90 0x00 APDU send CRG amp ACK 0x90 0x00 e restart request i 0x90 0x00 MS33311V1 q DoclD025379 Rev 1 23 25 Revision history AN4375 4 24 25 Revision history Table 13 Document revision history Date 05 Dec 2013 Revision 1 Initial release Changes DoclD025379 Rev 1 4375 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifi
12. ads involved during the application life DoclD025379 Rev 1 7 25 Overview AN4375 Figure 4 Thread logical view User request to launch the application Welcome screen Exit Exit application FW select screen NFC Event RX95HF Demo board detected NFC Event RX95HF Demo board detected Upload done or interrupted Launch Firmware upload resume MS33307V1 8 25 025379 Rev 1 4375 Software architecture 2 2 1 d Software architecture Overview Like all other Android applications the firmware upgrade application associated to the EVAL RX95HF board follows the android application architecture defined by Google AndroidManifest xml Every application must have an AndroidManifest xml file with precisely that name in its root directory The manifest presents essential information about the application to the Android system information the system must have before it can run any of the application s code AndroidManifest xml declares both NFCappsActivity Menu and FileManagement activities NFC filtered intents are defined to be caught when NFCappsActivity Menu activity is in the active state The assets folder stores the RX95HF firmware binary example available from www st com under the root part number STSW RX95HFO001 The Firmware is copied if not yet available in the android application s appData folder to ensure the user gets a Firmware to uploa
13. cations or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING ACTIVE IMPLAN
14. d when he starts the application for the first time The gen folder stores the auto generated files during the application building steps such as the resource ID file R java The javadoc folder stores the documentation extracted from the source code index html file under javadoc folder is the documentation root which provides a way to browse through the documentation and the java object structures The Res directory has subdirectories containing all the resources such as the image resources the layout resources the string resource file and so on These resources define the default design and content for the Android application They provide the xml layouts of NFCappsActivity Menu and FileManagement screens with associated widget ID to be manipulated by the java objects The src folder contains the java activity files and the NFCCommandlso14443A java object DoclD025379 Rev 1 9 25 Software architecture AN4375 2 2 10 25 Figure 5 Root file list T QU work com nfc n95hfdem gt 4 1 Search com nfc nxX95hfdemo FWI Organize v Include in library Share with v Burn New folder Name Date modified Type Size 1 settings 4 assets bin J gen 0 javadoc jo res src _ classpath 1 1 KB 3 KB 1 KB 1 KB 1 KB project AndroidManifest xml 22 javadoc xml int xml _ project properties 13 items Computer
15. droid Project from Existing Code then click on Next to reach the Import Projects panel see Figure 7 Figure 7 Import source code panel e 200 Import Projects Root Directory C Users STMicroelectronics workspace Browse Projects Project to Import New Project Name Select All lil com nfc n Shfdemo FWU com nfc nQ Shfdemo FWU el Refresh 7 Copy projects into workspace Working sets Add project to working sets Once the root directory of the temporary project location has been chosen and the Copy projects into workspace option has been checked the user can click on Finish The project is then ready to be built and executed on the target phone d DoclD025379 Rev 1 11 25 Software architecture AN4375 2 3 2 3 1 2 3 2 12 25 Main activity class A Main activity class is implemented in NFCappsActivity_Menu java The NFCappsActivity_Menu class extends the Android Activity object and must implement at least OnCreate and onPause methods inheritance concept Class members NFC and Android relay attributes e private NfcAdapter mAdapter e private Pendingintent mPendingIntent e private ntentFilter mFilters e private String mTechLists These attributes are used to retrieve the Android native NFC handler from the NFC stack provided by the Android system To get more details on the way to manage NFC components on an Android system refer to
16. ength Table 3 Header and body Header Body CLA INS P1 P2 Lc field Data field Le field APDU command content details The APDU command sent by the phone is defined as in Table 4 Table 4 APDU command sent by the phone Code Name Length Description CLA Class 1 Class of instruction INS Instruction 1 Instruction code P1 parameter 1 1 Instruction parameter 1 P2 parameter 2 1 Instruction parameter 2 d DoclD025379 Rev 1 4375 Digital protocol description Table 4 APDU command sent by the phone Code Name Length Description Le field Length variable 1 or 3 Number of bytes present in the data field of the command _ String of bytes sent in the data field of Data field Data variable Lc the command Maximum number of bytes expected in Le field Length variable 1 0r3 the data field of the response to the command 3 1 2 APDU response content details The APDU response content sent by the EVAL RX95HF is defined as in Table 5 Table 5 APDU response content Code Name Length Description Data field Data varable it String of bytes received in the data field of the response SW1 Status byte 1 1 Command processing status Sw2 Status byte 2 1 Command processing qualifier 3 2 EVAL RX95HF digital protocol APDU description In order to build a specific firmware upload digital protocol two classes of instructions are used in the EVAL RX95HF firmware
17. id system Once the super OnCreate is done super OnCreate is a way to call an onCreate method defined in the activity class the DoclD025379 Rev 1 Ly 4375 Software architecture d OnCreate call proceeds to initialize the NFCappsActivity Menu java attributes as described above This method checks the availability of the NFC interface with the following request pm hasSystemFeature PackageManager FEATURE_NFC If the NFC feature is not available the activity configures a button widget to let the user browse to a specific internet web page Clicking on it the user requests the Android system to start a browser activity with the URL during the button configuration For demonstration purposes the URL is set to www st com memories In case the NFC feature is available the activity ensures the initialization steps In case the APK embedded firmware is not installed yet the activity requests to extract the firmware from the appData folder by calling the installbinaryfromapk method The OnCreate method initializes the Android provided NFC adapter mAdapter to get an NFC handler which ensures the command and data exchange with the NFC Android stack The configuration of the intent category is implemented during the activity creation The activity is then able to manage such a kind of intent mPendinglntent If the activity has already a pending intent and if it corresponds to the expected intent category configured during the ac
18. ify the user of the upload progress public static int lastChunk Dsent Updated when ACK is received from RX public static int lastBuffOffsetSent Updated when ACK is received from RX public static int bufferSize Size in bytes of the buffer to send public static byte bufferData Raw data to send public static int chunkSize The chunk size to send to the EVAL RX95HF must be initialized according to the capabilities of the EVAL RX95HF MLe field public static int nbChunk Number of chunks to send BuffSize chunkSize 025379 Rev 1 4375 Software architecture d NFCCommandlso14443A method members public NFCCommandlso 1 4443A NFCCommanalso14443A object oriented programming concept initializes the object attributes and more specifically the chunk size public void init byte abufferData This init method must be called with a new buffer as parameter every time a new firmware is selected public static byte APDUsendSelectAppli Tag myTag This function member requests to send an APDU send select application The myTag argument is extracted from the intent triggered on the dual interface EEPROM device detection by the NFC Android stack public NFCCommandStatus APDUsendUpdateBinaryNew boolean resume Tag myTag long CRC This function member is called to execute the firmware upload process Depending on the last upload status the command starts a new firmware upload or resumes
19. is method initializes the buttons to start and resume the upload When the button is pressed the expected action is launched by dispatching the request to the StartLoadFromFile Task object public void onltemSelected AdapterView lt gt parent View v int position long id This method is called when the user selects the file from the listview he wants to upload If on call filelD is stored filelD is used to retrieve the full path of the binary file to upload when the request is delegated to the StartLoadFromFileTask object public void onNothingSelected AdapterView lt gt parent The empty method but must be overridden public boolean Verify RX95 UID String rx95 UID answer NFC Helper verifies the tag detected in the field This method can be easily improved to parse the full UID tag provided by the NFC Android stack StartLoadFromFileTask This internal class which extends AsyncTask details can be found on http developer android com reference android os AsyncTask html is used to start the pure upload activity d DoclD025379 Rev 1 4375 Software architecture 2 5 d e protected void StartLoadFromFileTask onPreExecute This method is called before launching the process dedicated to the AsyncTask object and on a button press Upload FW and Resume This method retrieves the filelD of the firmware to upload rebuilds the Firmware path initializes the NFCCommandlso14443A uploaderHandler with the buffer and
20. lication package file APK is the file format used to distribute and install application software Package stores the android application binaries resources and data GUI Graphic user interface Javadoc Javadoc is a facility provided by Java to auto generate documents from java source code As Java is an Android code language this tool is used to automatically document the code easiness to browse source code with standard internet browser NFC Near field communication d DoclD025379 Rev 1 5 25 Overview AN4375 6 25 Overview The goal of the application note is to help developers to implement their own NFC Android application solution it is not intended to explain how to create build debug or install Android applications on Android phones Please browse through Android courses on the web such as those available at http developer android com index html The source code of the Eclipse project and the associated generated javadoc package are available on ST web site under STSW HX95HF003 The application is built around two simple screens showing the two Android activities which compose the application The first one is the welcome screen It is displayed when the application is launched over a user request by selecting the RX95HF demo s application widget provided from the Android application panel At this stage the application waits for the Android system NFC intent which is triggered when the EVAL RX95HF board is
21. oid application package source code STSW RX95HF003 Android application binary STSW RX95HF002 EVAL RX95HF board firmware STSW RX95HF001 EVAL RX95HF board EVAL RX95HF December 2013 DoclD025379 Rev 1 1 25 www st com Contents AN4375 Contents Reference documents 0 0000 cece tee eee teens 5 Glossa PIC TU 5 1 OVEWIEW keene thee oe 6 2 Software architecture 9 2 1 OVENWICOW is oe aus dc SLT Beka deed weds ee ew d eS 9 2 2 Importing Android application source code 10 2 3 Main activity class 12 2 3 1 Class members 12 2 3 2 NFCappsActivity Menu java methods 12 2 4 File management activity class 14 2 4 1 Class membels tnr deme be eed yard 14 2 4 2 File management method members 16 2 5 NFCCommandlso14443A 5 17 2 5 1 Glass members xu ec dee a aa 18 3 Digital protocol description 20 3 1 APDU OVervieW aaa 20 3 1 1 APDU command content details 20 3 1 2 APDU response content details 21 3 2 EVAL RX
22. ser interface system and to launch a write action If buttonWriteFromFile is pressed the Filemanagement object requests the StartLoadFromFile Task object to begin the upload process Button buttonContinueWriteFromFile This button is used to handle the user request to start the resume process Then the Filemanagement object delegates this task to the StartLoadFromFile Task This button is only activated if there is something to resume i e a previous upload had been interrupted e private TextView selection The selection member is used to manage the firmware upload selection This widget is populated using the Filemanagement s File List member listed below NFC linked member As the Filemanagement activity requests NFC data exchange using the StartLoadFromFileTask the corresponding object class needs to store the NFC relay information d DoclD025379 Rev 1 4375 Software architecture d The definition of the following members is the same as the one used in the main activity class e private NfcAdapter mAdapter e private Pendingintent mPendinglntent e private ntentFilter mFilters e private String mTechLists e public NFCCommandlso14443A uploaderHandler null The NFCCommandlso14443A class attribute is declared here This object performs NFC communications and sends binary chunks of the file to upload e StartLoadFromFile Task Extend the AsyncTask which handles the digital communication pro
23. tapped Figure 2 Welcome screen RX95HF DEMO DATA TRANSFER USE CASE 2 Place your phone close to a RX95HF antenna DoclD025379 Rev 1 9 4375 Overview d The second screen is displayed once the expected NFC Android system event is triggered on the EVAL RX95HF board detection which must be in tag emulator mode This screen opens from the application Welcome screen or from the Android system idle state Once the application has been installed it is registered to be automatically launched at the evaluation board detection The screen displayed offers the capability to select the binary file and to start or resume the Firmware upload process Figure 3 Firmware selection and upload screen S 7 RX95HF DEMO DATA TRANSFER USE CASE Upload new firmware binary in the rx95hf s demo board and restart board Select Firmware rx95hf bin v UPLOAD FW copy new FW on phone s MMC folder download fwrx95hf Two activities compose the application NFCappsActivity Menu and FileManagement 1 NFCappsActivity Menu handles the Welcome screen the field widget animation and the Android NFC interface initialization 2 FileManagement activity triggered on NFC event controls the upload process The FileManagement activity implements a light NFC capable object dedicated to the digital protocol communication with the Android native NFC stack Here is a logical view of the thre
24. tivity creation step NFCappsActivity Menu creates a new intent to broadcast to the FileManagement activity and starts the FileManagement activity Intent intentScan new Intent this FileManagement class startActivity intentScan protected void onNewlntent Intent intent The user has to override this method to specify the activity behavior on receiving an intent In case of an ACTION TECH DISCOVERED category received intent while the activity is in an active state the activity verifies the tag validity detected from the NFC and sends a first Select Application request checkUID must also be updated in the source code provided DecodeTagUID Helper ConvertHexByteArrayToString tagFromlIntent getld byte selectAppliAnswer NFCCommandlso14443A APDUsendSelectAppli dataDevice getCurrentTag If both commands succeed the activity creates a new intent and sends it to the FileManagement activity Intent intentScan new Intent this FileManagement class startActivity intentScan protected void onResume The activity method called on activity restart declares the current activity as a grabber for all incoming Android system events of mPendinglntent category as initialized in the OnCreate method protected void onPause The activity method called on activity pause unregisters the current activity as a manager of mPendingIntent intent category NFC relay methods public boolean DecodeTagUID String TagUID This method is
25. tocol to control the Firmware upload In order to keep the user interface active and to avoid an application freeze feeling an AsyncTask object is used This Android object is detailed on http developer android com reference android os AsyncTask html All exchange requests to the EVAL RX95HF board are done by delegating the upload activity to this object e private long CRC 0 The CRC member is used to store the CRC of the file currently uploaded Once the upload is done the CRC is sent to the EVAL RX95HF board The EVAL RX95HF embedded firmware can then verify that it received the complete firmware binary before starting it File List managed member The firmware files to be uploaded can be stored in two different folders An APK embedded firmware delivered with the application is copied during the application installation in the Android application s appData folder The ability to copy the user specific firmware using a PC and a USB connection on MMC has also been implemented The user can plug the Android phone to a PC using a simple USB cable and then copy his own firmware in the Download fwrx95hf directory on the Android phone mounted mass storage seen from the PC file explorer The full list of files that could be uploaded is then displayed using a listview widget The user can select the file he wants to upload by expanding the listview object The following members are used to implement this File List management e private b
26. y Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com Ly DoclD025379 Rev 1 25 25
27. yte bufferFile null e private boolean FileError false e private EditText textProcessStatus e public static File firmwarelist null e public static int noFWinAppDataDir 0 e public static File firmwareSDlist null e String listFWFileName null e public static File firmwareRepo null e public static File firmwareSDRepo null e public static int currentFw2Uploadld e private string fwextMembDir fwrx95hf DoclD025379 Rev 1 15 25 Software architecture AN4375 2 4 2 16 25 File management method members Activity methods protected void onCreate Bundle savedinstanceState Called during an activity creation this method instantiates the NFCCommandlso14443A command handler object to perform a digital communication with the EVAL RX95HF board It retrieves the current NFC Android stack handler to manage Android native messages intents This method also initializes the GUI widget belonging to the Activity s view such as the firmware file list and notification widgets The method terminates by calling the initListener method which configures the Upload FW and Resume buttons protected void onResume This method is called when the activity is resumed and is registered as an NFC intent receiver protected void onPause This method is called when the activity is paused and is not registered as an NFC intent receiver FileManagement specific methods private void initListener Th
Download Pdf Manuals
Related Search
Related Contents
DUR364L installationsanleitungen installation data sheet fiche d'installation Instruction Manual • Manuel d`instructions • Aufbauanleitung Stamina Products , Inc Fitness Equipment 55-5516 User's Manual Sony CDX-M800 - Service Manual. www.s LockerLock Schließgehäuse LockerLock lock 設備管理業務における品質向上活動 QualArc LIB-SS-LM6-46 Use and Care Manual Copyright © All rights reserved.
Failed to retrieve file