Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #25 from RobbieDubya/master

Added editable APDU.
  • Loading branch information...
commit e2a6c85f0fcc479abae42189e24353a0f52ee670 2 parents 97d0bf2 + f3af554
@timwindsor timwindsor authored
Showing with 719 additions and 850 deletions.
  1. BIN  NFC/NfcTransactionHandler/bin/img/Thumbs.db
  2. BIN  NFC/NfcTransactionHandler/bin/img/ce_led_err.png
  3. BIN  NFC/NfcTransactionHandler/bin/img/ce_led_off.png
  4. BIN  NFC/NfcTransactionHandler/bin/img/ce_led_on.png
  5. BIN  NFC/NfcTransactionHandler/bin/img/ce_off_clicked.png
  6. BIN  NFC/NfcTransactionHandler/bin/img/ce_off_focused.png
  7. BIN  NFC/NfcTransactionHandler/bin/img/ce_off_unfocused.png
  8. BIN  NFC/NfcTransactionHandler/bin/img/ce_on_clicked.png
  9. BIN  NFC/NfcTransactionHandler/bin/img/ce_on_focused.png
  10. BIN  NFC/NfcTransactionHandler/bin/img/ce_on_unfocused.png
  11. BIN  NFC/NfcTransactionHandler/bin/img/clear_clicked.png
  12. BIN  NFC/NfcTransactionHandler/bin/img/clear_focused.png
  13. BIN  NFC/NfcTransactionHandler/bin/img/clear_unfocused.png
  14. BIN  NFC/NfcTransactionHandler/bin/img/close_clicked.png
  15. BIN  NFC/NfcTransactionHandler/bin/img/close_focused.png
  16. BIN  NFC/NfcTransactionHandler/bin/img/close_unfocused.png
  17. BIN  NFC/NfcTransactionHandler/bin/img/icon.png
  18. BIN  NFC/NfcTransactionHandler/bin/img/icon2.png
  19. BIN  NFC/NfcTransactionHandler/bin/img/led_err.png
  20. BIN  NFC/NfcTransactionHandler/bin/img/led_off.png
  21. BIN  NFC/NfcTransactionHandler/bin/img/led_on.png
  22. BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_err.png
  23. BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_off.png
  24. BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_on.png
  25. BIN  NFC/NfcTransactionHandler/bin/img/photothumb.db
  26. BIN  NFC/NfcTransactionHandler/bin/img/select_clicked.png
  27. BIN  NFC/NfcTransactionHandler/bin/img/select_disabled.png
  28. BIN  NFC/NfcTransactionHandler/bin/img/select_disabled_focused.png
  29. BIN  NFC/NfcTransactionHandler/bin/img/select_focused.png
  30. BIN  NFC/NfcTransactionHandler/bin/img/select_unfocused.png
  31. BIN  NFC/NfcTransactionHandler/bin/img/settings_clicked.png
  32. BIN  NFC/NfcTransactionHandler/bin/img/settings_focused.png
  33. BIN  NFC/NfcTransactionHandler/bin/img/settings_unfocused.png
  34. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Constants.class
  35. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/NfcTransHandlerApp.class
  36. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Settings.class
  37. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Utilities.class
  38. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/ClearCommand.class
  39. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/CloseCommand.class
  40. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/Iso7816Command.class
  41. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/KillCommand.class
  42. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/SettingsCommand.class
  43. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/ToggleCeCommand.class
  44. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/CardEmulation.class
  45. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/MyNfcStatusListener.class
  46. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/NfcService.class
  47. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/GraphicalButton.class
  48. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/LabelFieldColoured.class
  49. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcSettingsScreen$1.class
  50. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcSettingsScreen.class
  51. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$1.class
  52. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$2.class
  53. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$3.class
  54. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$4.class
  55. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$5.class
  56. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$6.class
  57. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen.class
  58. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/TextDetailsProvider.class
  59. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/TimedLabelField.class
  60. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MsbConfig.class
  61. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MsbState.class
  62. BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MultiStateButtonField.class
  63. BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler-1.debug
  64. BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler-2.debug
  65. BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.cod
  66. +0 −2  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.csl
  67. +0 −5 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.cso
  68. BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.debug
  69. +0 −24 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.jad
  70. BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.jar
  71. +0 −12 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.rapc
  72. +0 −31 NFC/NfcTransactionHandler/deliverables/Standard/NfcTransactionHandler.alx
  73. +0 −31 NFC/NfcTransactionHandler/deliverables/Standard/NfcTransactionHandler2.alx
  74. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-1.cod
  75. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-1.debug
  76. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-2.cod
  77. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-2.debug
  78. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.cod
  79. +0 −2  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.csl
  80. +0 −5 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.cso
  81. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.debug
  82. +0 −24 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.jad
  83. BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.jar
  84. +0 −12 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.rapc
  85. +55 −59 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/Constants.java
  86. +167 −154 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/Settings.java
  87. +79 −79 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/commands/Iso7816Command.java
  88. +205 −205 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/nfc/CardEmulation.java
  89. +213 −205 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/ui/NfcSettingsScreen.java
View
BIN  NFC/NfcTransactionHandler/bin/img/Thumbs.db
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_led_err.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_led_off.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_led_on.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_off_clicked.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_off_focused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_off_unfocused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_on_clicked.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_on_focused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/ce_on_unfocused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/clear_clicked.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/clear_focused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/clear_unfocused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/close_clicked.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/close_focused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/close_unfocused.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/icon.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/icon2.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/led_err.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/led_off.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/led_on.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_err.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_off.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/nfc_led_on.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/photothumb.db
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/img/select_clicked.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/select_disabled.png
Deleted file not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/select_disabled_focused.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/select_focused.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/select_unfocused.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/settings_clicked.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/settings_focused.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/img/settings_unfocused.png
Diff not rendered
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Constants.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/NfcTransHandlerApp.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Settings.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/Utilities.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/ClearCommand.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/CloseCommand.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/Iso7816Command.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/KillCommand.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/SettingsCommand.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/commands/ToggleCeCommand.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/CardEmulation.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/MyNfcStatusListener.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/nfc/NfcService.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/GraphicalButton.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/LabelFieldColoured.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcSettingsScreen$1.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcSettingsScreen.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$1.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$2.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$3.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$4.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$5.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen$6.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/NfcTransScreen.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/TextDetailsProvider.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/TimedLabelField.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MsbConfig.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MsbState.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/bin/nfc/sample/nfctransaction/ui/buttons/MultiStateButtonField.class
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler-1.debug
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler-2.debug
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.cod
Binary file not shown
View
2  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.csl
@@ -1,2 +0,0 @@
-52525400=RIM Runtime API
-4e464352=NFCRoutingAPI
View
5 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.cso
@@ -1,5 +0,0 @@
-33000000=RIMAPPSA2
-52424200=RIM Blackberry Apps API
-52434900=RIM Crypto API - Internal
-52435200=RIM Crypto API - RIM
-4e464352=NFCRoutingAPI
View
BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.debug
Binary file not shown
View
24 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.jad
@@ -1,24 +0,0 @@
-MIDlet-Name: NfcTransactionHandler
-MIDlet-Version: 1.0.0
-MIDlet-Vendor: Martin Woolley
-MIDlet-Jar-URL: NfcTransactionHandler.jar
-MIDlet-Jar-Size: 216320
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.1
-MIDlet-1: ,img/icon2.png,
-RIM-MIDlet-Flags-1: 0
-MIDlet-2: nfc_handler,,auto
-RIM-MIDlet-Flags-2: 3
-Manifest-Version: 1.0
-RIM-COD-URL: NfcTransactionHandler.cod
-RIM-COD-Size: 54700
-RIM-COD-Creation-Time: 1330081854
-RIM-COD-Module-Name: NfcTransactionHandler
-RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_satsa,net_rim_nfc
-RIM-COD-SHA1: 4c 05 1e 9f ae 57 e5 60 13 12 8d fb 23 0d 46 cc 98 ce 6c 54
-RIM-COD-URL-1: NfcTransactionHandler-1.cod
-RIM-COD-Size-1: 63924
-RIM-COD-SHA1-1: b4 63 e0 08 11 6b 0e 1e e7 94 04 d6 d6 02 bc d2 91 9c bc ca
-RIM-COD-URL-2: NfcTransactionHandler-2.cod
-RIM-COD-Size-2: 20568
-RIM-COD-SHA1-2: f4 e5 36 69 6b bd 85 8c d5 69 f7 b1 e6 e1 70 80 3b c8 6a 87
View
BIN  NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.jar
Binary file not shown
View
12 NFC/NfcTransactionHandler/deliverables/Standard/7.0.0/NfcTransactionHandler.rapc
@@ -1,12 +0,0 @@
-MIDlet-Name: NfcTransactionHandler
-MIDlet-Version: 1.0.0
-MIDlet-Vendor: Martin Woolley
-MIDlet-Jar-URL: NfcTransactionHandler.jar
-MIDlet-Jar-Size: 0
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.1
-MIDlet-1: ,img/icon2.png,
-RIM-MIDlet-Flags-1: 0
-MIDlet-2: nfc_handler,,auto
-RIM-MIDlet-Flags-2: 3
-
View
31 NFC/NfcTransactionHandler/deliverables/Standard/NfcTransactionHandler.alx
@@ -1,31 +0,0 @@
-<loader version="1.0">
- <application id="NfcTransactionHandler">
- <name >
-
- </name>
- <description >
-
- </description>
- <version >
- 1.0.0
- </version>
- <vendor >
- Martin Woolley
- </vendor>
- <copyright >
- Copyright (c) 2012 Martin Woolley
- </copyright>
- <fileset Java="1.54" _blackberryVersion="[7.0.0)">
- <directory >
- 7.0.0
- </directory>
- <files >
- NfcTransactionHandler.cod
-
- </files>
-
- </fileset>
-
- </application>
-
-</loader>
View
31 NFC/NfcTransactionHandler/deliverables/Standard/NfcTransactionHandler2.alx
@@ -1,31 +0,0 @@
-<loader version="1.0">
- <application id="NfcTransactionHandler2">
- <name >
-
- </name>
- <description >
-
- </description>
- <version >
- 1.0.0
- </version>
- <vendor >
- BlackBerry Developer
- </vendor>
- <copyright >
- Copyright (c) 2011 BlackBerry Developer
- </copyright>
- <fileset Java="1.54" _blackberryVersion="[7.0.0)">
- <directory >
- 7.0.0
- </directory>
- <files >
- NfcTransactionHandler2.cod
-
- </files>
-
- </fileset>
-
- </application>
-
-</loader>
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-1.cod
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-1.debug
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-2.cod
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler-2.debug
Binary file not shown
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.cod
Binary file not shown
View
2  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.csl
@@ -1,2 +0,0 @@
-52525400=RIM Runtime API
-4e464352=NFCRoutingAPI
View
5 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.cso
@@ -1,5 +0,0 @@
-33000000=RIMAPPSA2
-52424200=RIM Blackberry Apps API
-52434900=RIM Crypto API - Internal
-52435200=RIM Crypto API - RIM
-4e464352=NFCRoutingAPI
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.debug
Binary file not shown
View
24 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.jad
@@ -1,24 +0,0 @@
-MIDlet-Name: NfcTransactionHandler
-MIDlet-Version: 1.0.0
-MIDlet-Vendor: Martin Woolley
-MIDlet-Jar-URL: NfcTransactionHandler.jar
-MIDlet-Jar-Size: 216320
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.1
-MIDlet-1: ,img/icon2.png,
-RIM-MIDlet-Flags-1: 0
-MIDlet-2: nfc_handler,,auto
-RIM-MIDlet-Flags-2: 3
-Manifest-Version: 1.0
-RIM-COD-URL: NfcTransactionHandler.cod
-RIM-COD-Size: 54700
-RIM-COD-Creation-Time: 1330081854
-RIM-COD-Module-Name: NfcTransactionHandler
-RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_satsa,net_rim_nfc
-RIM-COD-SHA1: 4c 05 1e 9f ae 57 e5 60 13 12 8d fb 23 0d 46 cc 98 ce 6c 54
-RIM-COD-URL-1: NfcTransactionHandler-1.cod
-RIM-COD-Size-1: 63924
-RIM-COD-SHA1-1: b4 63 e0 08 11 6b 0e 1e e7 94 04 d6 d6 02 bc d2 91 9c bc ca
-RIM-COD-URL-2: NfcTransactionHandler-2.cod
-RIM-COD-Size-2: 20568
-RIM-COD-SHA1-2: f4 e5 36 69 6b bd 85 8c d5 69 f7 b1 e6 e1 70 80 3b c8 6a 87
View
BIN  NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.jar
Binary file not shown
View
12 NFC/NfcTransactionHandler/deliverables/Web/7.0.0/NfcTransactionHandler.rapc
@@ -1,12 +0,0 @@
-MIDlet-Name: NfcTransactionHandler
-MIDlet-Version: 1.0.0
-MIDlet-Vendor: Martin Woolley
-MIDlet-Jar-URL: NfcTransactionHandler.jar
-MIDlet-Jar-Size: 0
-MicroEdition-Profile: MIDP-2.0
-MicroEdition-Configuration: CLDC-1.1
-MIDlet-1: ,img/icon2.png,
-RIM-MIDlet-Flags-1: 0
-MIDlet-2: nfc_handler,,auto
-RIM-MIDlet-Flags-2: 3
-
View
114 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/Constants.java 100644 → 100755
@@ -1,59 +1,55 @@
-package nfc.sample.nfctransaction;
-/*
-* Copyright (c) 2012 Research In Motion Limited.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-import net.rim.device.api.ui.Color;
-
-public class Constants {
- public static String VERSION = "1.2.0";
-
- public static final int SE_SIM=0;
- public static final int SE_EMB=1;
- public static String [] SE_NAMES = {"SIM","EMBEDDED"};
-
- // SIM 1
-// public static final byte[][] MY_AIDS = { { 0x4E, 0x46, 0x43, 0x54, 0x65, 0x73, 0x74, 0x65, 0x72, 0x20, 0x31, 0x2E, 0x30 } };
-// public static final String CONNECTION_STRING = "apdu:0;target=4E.46.43.54.65.73.74.65.72.20.31.2E.30";
- // SIM 2
- public static final byte[][] MY_AIDS = { { 0x6E, 0x66, 0x63, 0x74, 0x65, 0x73, 0x74, 0x30, 0x31 } };
- public static final String CONNECTION_STRING = "apdu:0;target=6E.66.63.74.65.73.74.30.31";
-
- public static long UI_IS_RUNNING = 0xcb4b95cab37dbc72L;
-
- public static final int BACKGROUND_COLOUR = Color.BLACK;
-
- // navigation
- public static final int INDEX_CE = 0;
- public static final int INDEX_CLEAR = 1;
- public static final int INDEX_CLOSE = 2;
- public static final int INDEX_STATUS = 3;
- public static final int INDEX_KILL = 4;
-
- // LEDs
- public static final int LED_OFF = 0;
- public static final int LED_ON = 1;
- public static final int LED_ERR = 2;
-
- // buttons
- public static final int BTN_DEFAULT = 0;
- public static final int BTN_CE_ON = 0;
- public static final int BTN_CE_OFF = 1;
- public static final int BTN_SELECT_OFF = 1;
- public static final int BTN_SELECT_ON = 0;
-
- public static final String AID_SPACE = "--.--.--.--.--.--.--.--.--";
-
- public static final String READY = "Ready";
-}
+package nfc.sample.nfctransaction;
+/*
+* Copyright (c) 2012 Research In Motion Limited.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import net.rim.device.api.ui.Color;
+
+public class Constants {
+ public static String VERSION = "1.2.1";
+
+ public static final int SE_SIM=0;
+ public static final int SE_EMB=1;
+ public static String [] SE_NAMES = {"SIM","EMBEDDED"};
+
+ public static final byte[] DEFAULT_AID = { 0x6E, 0x66, 0x63, 0x74, 0x65, 0x73, 0x74, 0x30, 0x31 };
+ public static final byte[] DEFAULT_APDU = { (byte)0x80, 1, 0, 0};
+
+ public static long UI_IS_RUNNING = 0xcb4b95cab37dbc72L;
+
+ public static final int BACKGROUND_COLOUR = Color.BLACK;
+
+ // navigation
+ public static final int INDEX_CE = 0;
+ public static final int INDEX_CLEAR = 1;
+ public static final int INDEX_CLOSE = 2;
+ public static final int INDEX_STATUS = 3;
+ public static final int INDEX_KILL = 4;
+
+ // LEDs
+ public static final int LED_OFF = 0;
+ public static final int LED_ON = 1;
+ public static final int LED_ERR = 2;
+
+ // buttons
+ public static final int BTN_DEFAULT = 0;
+ public static final int BTN_CE_ON = 0;
+ public static final int BTN_CE_OFF = 1;
+ public static final int BTN_SELECT_OFF = 1;
+ public static final int BTN_SELECT_ON = 0;
+
+ public static final String AID_SPACE = "--.--.--.--.--.--.--.--.--";
+
+ public static final String READY = "Ready";
+}
View
321 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/Settings.java
@@ -1,154 +1,167 @@
-package nfc.sample.nfctransaction;
-/*
- * Copyright (c) 2012 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- * A singleton which holds application settings
- *
- */
-
-import net.rim.device.api.system.PersistentObject;
-import net.rim.device.api.system.PersistentStore;
-import net.rim.device.api.util.ByteArrayUtilities;
-import net.rim.device.api.util.Persistable;
-
-public class Settings implements Persistable {
-
- private static final long SETTINGS_ID = 0x8a75c361cc97f9d8L;
-
- private static Settings _settings;
-
- private int _secure_element; // 0=SIM, 1=eSE
- private boolean _ISO14443A;
- private boolean _ISO14443B;
- private boolean _ISO14443B_PRIME;
- private String _registered_aid="";
-
- private byte [][] _registered_aid_arrays = { { 0x6E, 0x66, 0x63, 0x74, 0x65, 0x73, 0x74, 0x30, 0x31 } };;
-
- private Settings() {
- }
-
- public static synchronized Settings getInstance() {
- if (_settings == null) {
- _settings = new Settings();
- loadSettings();
- }
- return _settings;
- }
-
- public String toString() {
- return
- "SE="+Constants.SE_NAMES[_secure_element]+
- ",ISO14443A="+_ISO14443A+
- ",ISO14443B="+_ISO14443B+
- ",ISO14443B_PRIME="+_ISO14443B_PRIME+
- ",AID="+_registered_aid;
-
- }
-
- private static void loadSettings() {
- synchronized(PersistentStore.getSynchObject()) {
- PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
- Object obj = po.getContents();
- if (obj != null) {
- _settings = (Settings) obj;
- } else {
- _settings.setISO14443A(false);
- _settings.setISO14443B(true);
- _settings.setISO14443B_PRIME(false);
- _settings.setSecure_element(Constants.SE_SIM);
- _settings.setRegistered_aid(ByteArrayUtilities.byteArrayToHex(Constants.MY_AIDS[0]));
- }
- _settings.setRegistered_aid_arrays(_settings.getRegistered_aid());
- }
- }
-
- public void saveSettings() {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " Saving settings");
- synchronized(PersistentStore.getSynchObject()) {
- PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
- po.setContents(_settings);
- po.commit();
- Utilities.log("XXXX " + Thread.currentThread().getName() + " Saved settings:" + _settings.toString());
- }
- }
-
- public int getSecure_element() {
- return _secure_element;
- }
-
- public void setSecure_element(int secure_element) {
- _secure_element = secure_element;
- }
-
- public void setSeSIM() {
- _secure_element = Constants.SE_SIM;
- }
-
- public void setSeEmbedded() {
- _secure_element = Constants.SE_EMB;
- }
-
- public boolean isSimSeSelected() {
- return (_secure_element == Constants.SE_SIM);
- }
-
- public boolean isEmbeddedSeSelected() {
- return (_secure_element == Constants.SE_EMB);
- }
-
- public boolean isISO14443A() {
- return _ISO14443A;
- }
-
- public void setISO14443A(boolean iSO14443A) {
- _ISO14443A = iSO14443A;
- }
-
- public boolean isISO14443B() {
- return _ISO14443B;
- }
-
- public void setISO14443B(boolean iSO14443B) {
- _ISO14443B = iSO14443B;
- }
-
- public boolean isISO14443B_PRIME() {
- return _ISO14443B_PRIME;
- }
-
- public void setISO14443B_PRIME(boolean iSO14443B_PRIME) {
- _ISO14443B_PRIME = iSO14443B_PRIME;
- }
-
- public String getRegistered_aid() {
- return _registered_aid;
- }
-
- public byte [][] getRegistered_aid_arrays() {
- return _registered_aid_arrays;
- }
-
- public void setRegistered_aid(String registered_aid) {
- _registered_aid = registered_aid;
- setRegistered_aid_arrays(registered_aid);
- }
-
- public void setRegistered_aid_arrays(String registered_aid) {
- _registered_aid_arrays[0] = ByteArrayUtilities.hexToByteArray(registered_aid);
- }
-
-}
+package nfc.sample.nfctransaction;
+/*
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ * A singleton which holds application settings
+ *
+ */
+
+import net.rim.device.api.system.PersistentObject;
+import net.rim.device.api.system.PersistentStore;
+import net.rim.device.api.util.ByteArrayUtilities;
+import net.rim.device.api.util.Persistable;
+
+public class Settings implements Persistable {
+
+ private static final long SETTINGS_ID = 0x8a75c361cc97f9d8L;
+
+ private static Settings _settings;
+
+ private int _secure_element; // 0=SIM, 1=eSE
+ private boolean _ISO14443A;
+ private boolean _ISO14443B;
+ private boolean _ISO14443B_PRIME;
+ private String _registered_aid="";
+ private String _apdu;
+
+ private Settings() {
+ }
+
+ public static synchronized Settings getInstance() {
+ if (_settings == null) {
+ _settings = new Settings();
+ loadSettings();
+ }
+ return _settings;
+ }
+
+ public String toString() {
+ return
+ "SE="+Constants.SE_NAMES[_secure_element]+
+ ",ISO14443A="+_ISO14443A+
+ ",ISO14443B="+_ISO14443B+
+ ",ISO14443B_PRIME="+_ISO14443B_PRIME+
+ ",AID="+_registered_aid;
+
+ }
+
+ private static void loadSettings() {
+ synchronized(PersistentStore.getSynchObject()) {
+ PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
+ Object obj = po.getContents();
+ if (obj != null) {
+ _settings = (Settings) obj;
+ } else {
+ _settings.setISO14443A(false);
+ _settings.setISO14443B(true);
+ _settings.setISO14443B_PRIME(false);
+ _settings.setSecure_element(Constants.SE_SIM);
+ _settings.setRegisteredAID(Constants.DEFAULT_AID);
+ _settings.setAPDU(Constants.DEFAULT_APDU);
+ }
+ }
+ }
+
+ public void saveSettings() {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " Saving settings");
+ synchronized(PersistentStore.getSynchObject()) {
+ PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
+ po.setContents(_settings);
+ po.commit();
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " Saved settings:" + _settings.toString());
+ }
+ }
+
+ public int getSecure_element() {
+ return _secure_element;
+ }
+
+ public void setSecure_element(int secure_element) {
+ _secure_element = secure_element;
+ }
+
+ public void setSeSIM() {
+ _secure_element = Constants.SE_SIM;
+ }
+
+ public void setSeEmbedded() {
+ _secure_element = Constants.SE_EMB;
+ }
+
+ public boolean isSimSeSelected() {
+ return (_secure_element == Constants.SE_SIM);
+ }
+
+ public boolean isEmbeddedSeSelected() {
+ return (_secure_element == Constants.SE_EMB);
+ }
+
+ public boolean isISO14443A() {
+ return _ISO14443A;
+ }
+
+ public void setISO14443A(boolean iSO14443A) {
+ _ISO14443A = iSO14443A;
+ }
+
+ public boolean isISO14443B() {
+ return _ISO14443B;
+ }
+
+ public void setISO14443B(boolean iSO14443B) {
+ _ISO14443B = iSO14443B;
+ }
+
+ public boolean isISO14443B_PRIME() {
+ return _ISO14443B_PRIME;
+ }
+
+ public void setISO14443B_PRIME(boolean iSO14443B_PRIME) {
+ _ISO14443B_PRIME = iSO14443B_PRIME;
+ }
+
+ public String getRegisteredAIDAsString() {
+ return _registered_aid;
+ }
+
+ public byte [] getRegisteredAID() {
+ return ByteArrayUtilities.hexToByteArray(_registered_aid);
+ }
+
+ public void setRegisteredAID(String registered_aid) {
+ _registered_aid = registered_aid;
+ }
+
+ public void setRegisteredAID(byte [] registered_aid) {
+ _registered_aid = ByteArrayUtilities.byteArrayToHex(registered_aid);
+ }
+
+ public byte [] getAPDU() {
+ return ByteArrayUtilities.hexToByteArray(_apdu);
+ }
+
+ public String getAPDUAsString() {
+ return _apdu;
+ }
+
+ public void setAPDU(String apdu) {
+ _apdu = apdu;
+ }
+
+ public void setAPDU(byte [] apdu) {
+ _apdu = ByteArrayUtilities.byteArrayToHex(apdu);
+ }
+}
View
158 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/commands/Iso7816Command.java 100644 → 100755
@@ -1,79 +1,79 @@
-package nfc.sample.nfctransaction.commands;
-
-/*
- * Copyright (c) 2012 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import javax.microedition.apdu.APDUConnection;
-import javax.microedition.io.Connector;
-
-import net.rim.device.api.command.AlwaysExecutableCommand;
-import net.rim.device.api.command.ReadOnlyCommandMetadata;
-import net.rim.device.api.util.ByteArrayUtilities;
-import nfc.sample.nfctransaction.Constants;
-import nfc.sample.nfctransaction.Settings;
-import nfc.sample.nfctransaction.Utilities;
-import nfc.sample.nfctransaction.ui.NfcTransScreen;
-import nfc.sample.nfctransaction.ui.buttons.MultiStateButtonField;
-
-/**
- * This command sends a ISO7816-4 SELECT APDU using the JSR177 API followed by a proprietary APDU. For this to work, the target
- * SecureElement must contain an applet with the AID used here. So developers who just run this code to see what happens are
- * likely to see an error from this command. This is to be expected however.
- *
- * Authors: John Murray and Martin Woolley
- *
- */
-
-public class Iso7816Command extends AlwaysExecutableCommand {
-
- public void execute(ReadOnlyCommandMetadata metadata, Object context) {
- MultiStateButtonField btn = (MultiStateButtonField) context;
- if(btn.getMsbState() == Constants.BTN_SELECT_OFF) {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command exiting because button is in OFF state");
- return;
- }
- Settings settings = Settings.getInstance();
- NfcTransScreen screen = NfcTransScreen.getInstance();
- Utilities.log("XXXX " + Thread.currentThread().getName() + " selecting applet");
- APDUConnection apduConn = null;
- // this is an example and completely proprietary APDU included solely to demonstrate the basic use of JSR-177
- // Decode:
- // 0x80 : CLASS = proprietary
- // 0x01 : INS = invented command! Interpretation will require the selected applet to understand this command
- // 0x00 : P1 = null
- // 0x00 : P1 = null
- byte[] command = { (byte) 0x80, (byte) 0x01, (byte) 0x00, (byte) 0x00 };
- try {
- // Open an APDUConnection to our applet. This results in an ISO 7816-4 SELECT command being sent by the JSR-177 API
- String connection_string = Utilities.makeApduConnectionString(settings.getRegistered_aid());
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: opening APDUConnection to " + connection_string);
- apduConn = (APDUConnection) Connector.open(connection_string);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: APDUConnection opened");
- screen.setUserMessage("Selected AID OK");
- // Send the APDU and wait for a response - expect an error here unless your applet supports the command that was sent
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: sending APDU");
- byte[] ret = apduConn.exchangeAPDU(command);
- String resp_string = ByteArrayUtilities.byteArrayToHex(ret);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: response=" + resp_string);
- screen.setUserMessage("APDU response=" + resp_string);
- // Close the logical channel connection
- apduConn.close();
- } catch(Exception e) {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command failed:" + e.getClass().getName() + ":" + e.getMessage());
- screen.setUserMessage("Error. Select failed: check log");
- }
- }
-
-}
+package nfc.sample.nfctransaction.commands;
+
+/*
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import javax.microedition.apdu.APDUConnection;
+import javax.microedition.io.Connector;
+
+import net.rim.device.api.command.AlwaysExecutableCommand;
+import net.rim.device.api.command.ReadOnlyCommandMetadata;
+import net.rim.device.api.util.ByteArrayUtilities;
+import nfc.sample.nfctransaction.Constants;
+import nfc.sample.nfctransaction.Settings;
+import nfc.sample.nfctransaction.Utilities;
+import nfc.sample.nfctransaction.ui.NfcTransScreen;
+import nfc.sample.nfctransaction.ui.buttons.MultiStateButtonField;
+
+/**
+ * This command sends a ISO7816-4 SELECT APDU using the JSR177 API followed by a proprietary APDU. For this to work, the target
+ * SecureElement must contain an applet with the AID used here. So developers who just run this code to see what happens are
+ * likely to see an error from this command. This is to be expected however.
+ *
+ * Authors: John Murray and Martin Woolley
+ *
+ */
+
+public class Iso7816Command extends AlwaysExecutableCommand {
+
+ public void execute(ReadOnlyCommandMetadata metadata, Object context) {
+ MultiStateButtonField btn = (MultiStateButtonField) context;
+ if(btn.getMsbState() == Constants.BTN_SELECT_OFF) {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command exiting because button is in OFF state");
+ return;
+ }
+ Settings settings = Settings.getInstance();
+ NfcTransScreen screen = NfcTransScreen.getInstance();
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " selecting applet");
+ APDUConnection apduConn = null;
+ // this is an example and completely proprietary APDU included solely to demonstrate the basic use of JSR-177
+ // Decode:
+ // 0x80 : CLASS = proprietary
+ // 0x01 : INS = invented command! Interpretation will require the selected applet to understand this command
+ // 0x00 : P1 = null
+ // 0x00 : P1 = null
+ byte[] command = settings.getAPDU();
+ try {
+ // Open an APDUConnection to our applet. This results in an ISO 7816-4 SELECT command being sent by the JSR-177 API
+ String connection_string = Utilities.makeApduConnectionString(settings.getRegisteredAIDAsString());
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: opening APDUConnection to " + connection_string);
+ apduConn = (APDUConnection) Connector.open(connection_string);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: APDUConnection opened");
+ screen.setUserMessage("Selected AID OK");
+ // Send the APDU and wait for a response - expect an error here unless your applet supports the command that was sent
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: sending APDU");
+ byte[] ret = apduConn.exchangeAPDU(command);
+ String resp_string = ByteArrayUtilities.byteArrayToHex(ret);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command: response=" + resp_string);
+ screen.setUserMessage("APDU response=" + resp_string);
+ // Close the logical channel connection
+ apduConn.close();
+ } catch(Exception e) {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ISO 7816-4 command failed:" + e.getClass().getName() + ":" + e.getMessage());
+ screen.setUserMessage("Error. Select failed: check log");
+ }
+ }
+
+}
View
410 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/nfc/CardEmulation.java 100644 → 100755
@@ -1,205 +1,205 @@
-package nfc.sample.nfctransaction.nfc;
-/*
-* Copyright (c) 2012 Research In Motion Limited.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-import net.rim.device.api.io.nfc.NFCException;
-import net.rim.device.api.io.nfc.emulation.TechnologyType;
-import net.rim.device.api.io.nfc.se.SecureElement;
-import net.rim.device.api.io.nfc.se.SecureElementManager;
-import net.rim.device.api.io.nfc.se.TransactionListener;
-import net.rim.device.api.system.ApplicationDescriptor;
-import net.rim.device.api.system.ApplicationManager;
-import nfc.sample.nfctransaction.Settings;
-import nfc.sample.nfctransaction.Utilities;
-import nfc.sample.nfctransaction.ui.TextDetailsProvider;
-
-// This class contains various Card Emulation related methods
-
-public class CardEmulation implements TextDetailsProvider {
-
- private static CardEmulation ce;
-
- private static TransactionListener _tl;
-
- private SecureElementManager sem = SecureElementManager.getInstance();
- private SecureElement se = null;
-
- private int tech_type=TechnologyType.ISO14443B;
-
- private boolean se_obtained = false;
-
- private int current_se=-1;
- private int current_tt=-1;
-
- public static synchronized CardEmulation getInstance() {
- if (ce == null) {
- ce = new CardEmulation();
- }
- return ce;
- }
-
- public void initCe(int se_choice) throws NFCException {
- se = sem.getSecureElement(se_choice);
- if (se == null) {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " SecureElement(SIM) is null");
- se_obtained = false;
- } else {
- se_obtained = true;
- current_se = se_choice;
- }
- }
-
- public static void registerTransactionListener(TransactionListener tl) {
-
- int pid = ApplicationManager.getApplicationManager().getProcessId(ApplicationDescriptor.currentApplicationDescriptor());
- Settings settings = Settings.getInstance();
-
- SecureElementManager sem = SecureElementManager.getInstance();
- if(sem == null) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElementManager instance is null - exiting");
- System.exit(0);
- }
-
- SecureElement[] sec_elements = null;
- try {
- sec_elements = sem.getSecureElements();
- } catch(NFCException e2) {
- e2.printStackTrace();
- }
- if(sec_elements == null) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElement[] is null - exiting");
- System.exit(0);
- }
-
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " device has " + sec_elements.length + " SEs");
-
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " getting SecureElement instance");
- SecureElement se = null;
- try {
- if(settings.isSimSeSelected()) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " Obtaining SecureElement in SIM");
- se = sem.getSecureElement(SecureElement.SIM);
- } else {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " Obtaining embedded SecureElement");
- se = sem.getSecureElement(SecureElement.EMBEDDED);
- }
- } catch(NFCException e1) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " exception when getting SE: " + e1.getClass().getName() + ":" + e1.getMessage());
- }
-
- if(se == null) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElement is null - exiting");
- System.exit(0);
- }
-
- // register our app as a transaction listener
- try {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " adding transaction listener for AID:"+settings.getRegistered_aid());
- se.addTransactionListener(tl, settings.getRegistered_aid_arrays());
- _tl = tl;
- } catch(NFCException e) {
- if(!e.getMessage().startsWith("TransactionListener has already been added")) {
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " exception when adding transaction listener: " + e.getClass().getName() + ":" + e.getMessage());
- System.exit(0);
- }
- }
- }
-
- public void removeTransactionListener() {
- if (se != null && _tl != null) {
- try {
- int pid = ApplicationManager.getApplicationManager().getProcessId(ApplicationDescriptor.currentApplicationDescriptor());
- Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " removing transaction listener");
- se.removeTransactionListener(_tl);
- } catch(NFCException e) {
- Utilities.log("XXXX " + ":" + Thread.currentThread().getName() + " exception when removing transaction listener: " + e.getClass().getName() + ":" + e.getMessage());
- }
- }
- }
-
- public boolean isCeEnabled(int battery_mode) throws NFCException {
- int types = getTechnologyTypes(battery_mode);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " " + Utilities.getTechnologyTypesNames(types));
- boolean ce_enabled = (types & TechnologyType.ISO14443B) == TechnologyType.ISO14443B;
- Utilities.log("XXXX " + Thread.currentThread().getName() + " ce_enabled=" + ce_enabled);
- return ce_enabled;
- }
-
- public int getTechnologyTypes(int battery_mode) throws NFCException {
- if (!se_obtained) {
- return TechnologyType.NONE;
- }
- return se.getTechnologyTypes(battery_mode);
- }
-
- public int getTechnologyTypes() throws NFCException {
- return getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
- }
-
- public String getTextDetails() {
- return Utilities.getCeStatusSummary();
- }
-
- public boolean isSe_obtained() {
- return se_obtained;
- }
-
- public void setSe_obtained(boolean se_obtained) {
- this.se_obtained = se_obtained;
- }
-
- public boolean setRoutingOn(int technology_types) throws NFCException {
- if (se_obtained) {
- se.setTechnologyTypes(SecureElement.BATTERY_ON_MODE, technology_types);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " NFC routing established OK");
- int types = se.getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " " + Utilities.getTechnologyTypesNames(types));
- current_tt = technology_types;
- return true;
- } else {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " No SE selected");
- return false;
- }
- }
-
- public boolean setRoutingOff() throws NFCException {
- if (se_obtained) {
- se.setTechnologyTypes(SecureElement.BATTERY_ON_MODE, TechnologyType.NONE);
- return false;
- } else {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " No SE selected");
- return true;
- }
- }
-
- public int getCurrentSecureElement() {
- if (current_se != -1) {
- return current_se;
- } else {
- // default is to use the SIM SE
- return SecureElement.SIM;
- }
- }
-
- public int getCurrentTechnologyTypes() {
- if (current_tt != -1) {
- return current_tt;
- } else {
- // default is to use the ISO14443B
- return TechnologyType.ISO14443B;
- }
- }
-
-}
+package nfc.sample.nfctransaction.nfc;
+/*
+* Copyright (c) 2012 Research In Motion Limited.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+import net.rim.device.api.io.nfc.NFCException;
+import net.rim.device.api.io.nfc.emulation.TechnologyType;
+import net.rim.device.api.io.nfc.se.SecureElement;
+import net.rim.device.api.io.nfc.se.SecureElementManager;
+import net.rim.device.api.io.nfc.se.TransactionListener;
+import net.rim.device.api.system.ApplicationDescriptor;
+import net.rim.device.api.system.ApplicationManager;
+import nfc.sample.nfctransaction.Settings;
+import nfc.sample.nfctransaction.Utilities;
+import nfc.sample.nfctransaction.ui.TextDetailsProvider;
+
+// This class contains various Card Emulation related methods
+
+public class CardEmulation implements TextDetailsProvider {
+
+ private static CardEmulation ce;
+
+ private static TransactionListener _tl;
+
+ private SecureElementManager sem = SecureElementManager.getInstance();
+ private SecureElement se = null;
+
+ private int tech_type=TechnologyType.ISO14443B;
+
+ private boolean se_obtained = false;
+
+ private int current_se=-1;
+ private int current_tt=-1;
+
+ public static synchronized CardEmulation getInstance() {
+ if (ce == null) {
+ ce = new CardEmulation();
+ }
+ return ce;
+ }
+
+ public void initCe(int se_choice) throws NFCException {
+ se = sem.getSecureElement(se_choice);
+ if (se == null) {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " SecureElement(SIM) is null");
+ se_obtained = false;
+ } else {
+ se_obtained = true;
+ current_se = se_choice;
+ }
+ }
+
+ public static void registerTransactionListener(TransactionListener tl) {
+
+ int pid = ApplicationManager.getApplicationManager().getProcessId(ApplicationDescriptor.currentApplicationDescriptor());
+ Settings settings = Settings.getInstance();
+
+ SecureElementManager sem = SecureElementManager.getInstance();
+ if(sem == null) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElementManager instance is null - exiting");
+ System.exit(0);
+ }
+
+ SecureElement[] sec_elements = null;
+ try {
+ sec_elements = sem.getSecureElements();
+ } catch(NFCException e2) {
+ e2.printStackTrace();
+ }
+ if(sec_elements == null) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElement[] is null - exiting");
+ System.exit(0);
+ }
+
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " device has " + sec_elements.length + " SEs");
+
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " getting SecureElement instance");
+ SecureElement se = null;
+ try {
+ if(settings.isSimSeSelected()) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " Obtaining SecureElement in SIM");
+ se = sem.getSecureElement(SecureElement.SIM);
+ } else {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " Obtaining embedded SecureElement");
+ se = sem.getSecureElement(SecureElement.EMBEDDED);
+ }
+ } catch(NFCException e1) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " exception when getting SE: " + e1.getClass().getName() + ":" + e1.getMessage());
+ }
+
+ if(se == null) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " SecureElement is null - exiting");
+ System.exit(0);
+ }
+
+ // register our app as a transaction listener
+ try {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " adding transaction listener for AID:"+settings.getRegisteredAIDAsString());
+ se.addTransactionListener(tl, new byte[][] { settings.getRegisteredAID() });
+ _tl = tl;
+ } catch(NFCException e) {
+ if(!e.getMessage().startsWith("TransactionListener has already been added")) {
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " exception when adding transaction listener: " + e.getClass().getName() + ":" + e.getMessage());
+ System.exit(0);
+ }
+ }
+ }
+
+ public void removeTransactionListener() {
+ if (se != null && _tl != null) {
+ try {
+ int pid = ApplicationManager.getApplicationManager().getProcessId(ApplicationDescriptor.currentApplicationDescriptor());
+ Utilities.log("XXXX " + pid + ":" + Thread.currentThread().getName() + " removing transaction listener");
+ se.removeTransactionListener(_tl);
+ } catch(NFCException e) {
+ Utilities.log("XXXX " + ":" + Thread.currentThread().getName() + " exception when removing transaction listener: " + e.getClass().getName() + ":" + e.getMessage());
+ }
+ }
+ }
+
+ public boolean isCeEnabled(int battery_mode) throws NFCException {
+ int types = getTechnologyTypes(battery_mode);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " " + Utilities.getTechnologyTypesNames(types));
+ boolean ce_enabled = (types & TechnologyType.ISO14443B) == TechnologyType.ISO14443B;
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " ce_enabled=" + ce_enabled);
+ return ce_enabled;
+ }
+
+ public int getTechnologyTypes(int battery_mode) throws NFCException {
+ if (!se_obtained) {
+ return TechnologyType.NONE;
+ }
+ return se.getTechnologyTypes(battery_mode);
+ }
+
+ public int getTechnologyTypes() throws NFCException {
+ return getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
+ }
+
+ public String getTextDetails() {
+ return Utilities.getCeStatusSummary();
+ }
+
+ public boolean isSe_obtained() {
+ return se_obtained;
+ }
+
+ public void setSe_obtained(boolean se_obtained) {
+ this.se_obtained = se_obtained;
+ }
+
+ public boolean setRoutingOn(int technology_types) throws NFCException {
+ if (se_obtained) {
+ se.setTechnologyTypes(SecureElement.BATTERY_ON_MODE, technology_types);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " NFC routing established OK");
+ int types = se.getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " " + Utilities.getTechnologyTypesNames(types));
+ current_tt = technology_types;
+ return true;
+ } else {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " No SE selected");
+ return false;
+ }
+ }
+
+ public boolean setRoutingOff() throws NFCException {
+ if (se_obtained) {
+ se.setTechnologyTypes(SecureElement.BATTERY_ON_MODE, TechnologyType.NONE);
+ return false;
+ } else {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " No SE selected");
+ return true;
+ }
+ }
+
+ public int getCurrentSecureElement() {
+ if (current_se != -1) {
+ return current_se;
+ } else {
+ // default is to use the SIM SE
+ return SecureElement.SIM;
+ }
+ }
+
+ public int getCurrentTechnologyTypes() {
+ if (current_tt != -1) {
+ return current_tt;
+ } else {
+ // default is to use the ISO14443B
+ return TechnologyType.ISO14443B;
+ }
+ }
+
+}
View
418 NFC/NfcTransactionHandler/src/nfc/sample/nfctransaction/ui/NfcSettingsScreen.java
@@ -1,205 +1,213 @@
-package nfc.sample.nfctransaction.ui;
-
-/*
- * Copyright (c) 2012 Research In Motion Limited.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.io.IOException;
-
-import net.rim.device.api.io.nfc.NFCException;
-import net.rim.device.api.io.nfc.NFCManager;
-import net.rim.device.api.io.nfc.emulation.TechnologyType;
-import net.rim.device.api.io.nfc.se.SecureElement;
-import net.rim.device.api.ui.Color;
-import net.rim.device.api.ui.Field;
-import net.rim.device.api.ui.FieldChangeListener;
-import net.rim.device.api.ui.component.ButtonField;
-import net.rim.device.api.ui.component.CheckboxField;
-import net.rim.device.api.ui.component.EditField;
-import net.rim.device.api.ui.component.RadioButtonField;
-import net.rim.device.api.ui.component.RadioButtonGroup;
-import net.rim.device.api.ui.component.RichTextField;
-import net.rim.device.api.ui.component.SeparatorField;
-import net.rim.device.api.ui.container.MainScreen;
-import net.rim.device.api.util.ByteArrayUtilities;
-import nfc.sample.nfctransaction.Constants;
-import nfc.sample.nfctransaction.NfcTransHandlerApp;
-import nfc.sample.nfctransaction.Settings;
-import nfc.sample.nfctransaction.Utilities;
-import nfc.sample.nfctransaction.nfc.CardEmulation;
-import nfc.sample.nfctransaction.nfc.NfcService;
-
-public class NfcSettingsScreen extends MainScreen {
-
- private Settings settings = Settings.getInstance();
-
- private CardEmulation ce = CardEmulation.getInstance();
- private NfcService nfc = NfcService.getInstance();
-
- private LabelFieldColoured lbl_se_choices = new LabelFieldColoured("Secure Element", Color.GREEN, Field.FIELD_LEFT);
- private RadioButtonGroup se_choices = new RadioButtonGroup();
- private RadioButtonField se_sim = new RadioButtonField("SIM", se_choices, true);
- private RadioButtonField se_embedded = new RadioButtonField("EMBEDDED", se_choices, false);
-
- private LabelFieldColoured lbl_pr_choices = new LabelFieldColoured("Protocols", Color.GREEN, Field.FIELD_LEFT);
- private CheckboxField cbx_iso1443a = new CheckboxField("ISO14443A", false);
- private CheckboxField cbx_iso1443b = new CheckboxField("ISO14443B", true);
- private CheckboxField cbx_iso1443b_prime = new CheckboxField("ISO14443B PRIME", false);
-
- private LabelFieldColoured lbl_aid = new LabelFieldColoured("AID", Color.GREEN, Field.FIELD_LEFT);
- private EditField edt_aid = new EditField("","");
-
- private ButtonField btn_save_settings = new ButtonField("Apply", ButtonField.CONSUME_CLICK);
- private SeparatorField separator = new SeparatorField();
- private LabelFieldColoured lbl_nfc_service_details = new LabelFieldColoured("NFC Service Details", Color.GREEN,
- Field.FIELD_LEFT);
- private RichTextField rtf_nfc_service_details = new RichTextField();
-
- private FieldChangeListener listener = new FieldChangeListener() {
-
- public void fieldChanged(Field field, int context) {
- if(field == btn_save_settings) {
- save();
- }
- }
- };
-
- private int current_se;
- private int current_tt;
- private boolean aid_changed=false;
-
- public NfcSettingsScreen() {
- setTitle("NFCTransactionHandler V" + Constants.VERSION + "-Settings");
- add(lbl_se_choices);
- add(se_sim);
- add(se_embedded);
- add(lbl_pr_choices);
- add(cbx_iso1443a);
- add(cbx_iso1443b);
- add(cbx_iso1443b_prime);
- add(lbl_aid);
- edt_aid.setText(settings.getRegistered_aid());
- add(edt_aid);
- add(btn_save_settings);
- btn_save_settings.setChangeListener(listener);
- add(separator);
- add(lbl_nfc_service_details);
- String nfc_details = "";
- try {
- nfc_details = Utilities.getNfcStatusDescription(NFCManager.getInstance().getEnabledNFCServices());
- } catch(NFCException e) {
- nfc_details = e.getClass().getName() + ":" + e.getMessage();
- }
- rtf_nfc_service_details.setText(nfc_details);
- add(rtf_nfc_service_details);
- syncUiWithNfcSettings();
- }
-
- private void syncUiWithNfcSettings() {
- current_se = ce.getCurrentSecureElement();
- current_tt = ce.getCurrentTechnologyTypes();
- if(current_se == SecureElement.SIM) {
- se_sim.setSelected(true);
- se_embedded.setSelected(false);
- } else {
- se_sim.setSelected(false);
- se_embedded.setSelected(true);
- }
- try {
- int tech_types = ce.getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
- if((tech_types & TechnologyType.ISO14443A) == TechnologyType.ISO14443A) {
- cbx_iso1443a.setChecked(true);
- } else {
- cbx_iso1443a.setChecked(false);
- }
- if((tech_types & TechnologyType.ISO14443B) == TechnologyType.ISO14443B) {
- cbx_iso1443b.setChecked(true);
- } else {
- cbx_iso1443b.setChecked(false);
- }
- if((tech_types & TechnologyType.ISO14443B_PRIME) == TechnologyType.ISO14443B_PRIME) {
- cbx_iso1443b_prime.setChecked(true);
- } else {
- cbx_iso1443b_prime.setChecked(false);
- }
- } catch(NFCException e) {
- }
- }
-
- public void save() {
- applySettings();
- settings.saveSettings();
- try {
- super.save();
- } catch(IOException e) {
- }
- }
-
- private void applySettings() {
- try {
- if((current_se == SecureElement.SIM) && (se_choices.getSelectedIndex() == 1)) {
- ce.initCe(SecureElement.EMBEDDED);
- settings.setSeEmbedded();
- } else {
- if((current_se == SecureElement.EMBEDDED) && (se_choices.getSelectedIndex() == 0)) {
- ce.initCe(SecureElement.SIM);
- settings.setSeSIM();
- }
- }
- } catch(NFCException e) {
- Utilities.popupAlert("Error: could not change SE selection");
- return;
- }
- int tech_types = TechnologyType.NONE;
- if(cbx_iso1443a.getChecked() == true) {
- tech_types = tech_types | TechnologyType.ISO14443A;
- }
- if(cbx_iso1443b.getChecked() == true) {
- tech_types = tech_types | TechnologyType.ISO14443B;
- }
- if(cbx_iso1443b_prime.getChecked() == true) {
- tech_types = tech_types | TechnologyType.ISO14443B_PRIME;
- }
- settings.setISO14443A(cbx_iso1443a.getChecked());
- settings.setISO14443B(cbx_iso1443b.getChecked());
- settings.setISO14443B_PRIME(cbx_iso1443b_prime.getChecked());
- if (!settings.getRegistered_aid().equals(edt_aid.getText())) {
- settings.setRegistered_aid(edt_aid.getText());
- CardEmulation ce = CardEmulation.getInstance();
- ce.removeTransactionListener();
- CardEmulation.registerTransactionListener(NfcTransHandlerApp.getTransactionListener());
- }
-
- Utilities.log("XXXX " + Thread.currentThread().getName() + " Selected tech types="
- + Utilities.getTechnologyTypesNames(tech_types));
-
- if(current_tt != tech_types) {
- try {
- ce.setRoutingOn(tech_types);
- } catch(NFCException e) {
- Utilities.popupAlert("Error: could not change CE technology types");
- return;
- } catch(Exception e) {
- Utilities.log("XXXX " + Thread.currentThread().getName() + " " + e.getClass().getName() + ":" + e.getMessage());
- Utilities.popupAlert(e.getClass().getName() + ": could not change CE technology types");
- return;
- }
- }
- Utilities.log("XXXX " + Thread.currentThread().getName() + " applySettings 11");
- setDirty(false);
- Utilities.log("XXXX " + Thread.currentThread().getName() + " applySettings 12");
- Utilities.popupMessage("New settings applied");
-
- }
-}
+package nfc.sample.nfctransaction.ui;
+
+/*
+ * Copyright (c) 2012 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.io.IOException;
+
+import net.rim.device.api.io.nfc.NFCException;
+import net.rim.device.api.io.nfc.NFCManager;
+import net.rim.device.api.io.nfc.emulation.TechnologyType;
+import net.rim.device.api.io.nfc.se.SecureElement;
+import net.rim.device.api.ui.Color;
+import net.rim.device.api.ui.Field;
+import net.rim.device.api.ui.FieldChangeListener;
+import net.rim.device.api.ui.component.ButtonField;
+import net.rim.device.api.ui.component.CheckboxField;
+import net.rim.device.api.ui.component.EditField;
+import net.rim.device.api.ui.component.RadioButtonField;
+import net.rim.device.api.ui.component.RadioButtonGroup;
+import net.rim.device.api.ui.component.RichTextField;
+import net.rim.device.api.ui.component.SeparatorField;
+import net.rim.device.api.ui.container.MainScreen;
+import net.rim.device.api.util.ByteArrayUtilities;
+import nfc.sample.nfctransaction.Constants;
+import nfc.sample.nfctransaction.NfcTransHandlerApp;
+import nfc.sample.nfctransaction.Settings;
+import nfc.sample.nfctransaction.Utilities;
+import nfc.sample.nfctransaction.nfc.CardEmulation;
+import nfc.sample.nfctransaction.nfc.NfcService;
+
+public class NfcSettingsScreen extends MainScreen {
+
+ private Settings settings = Settings.getInstance();
+
+ private CardEmulation ce = CardEmulation.getInstance();
+ private NfcService nfc = NfcService.getInstance();
+
+ private LabelFieldColoured lbl_se_choices = new LabelFieldColoured("Secure Element", Color.GREEN, Field.FIELD_LEFT);
+ private RadioButtonGroup se_choices = new RadioButtonGroup();
+ private RadioButtonField se_sim = new RadioButtonField("SIM", se_choices, true);
+ private RadioButtonField se_embedded = new RadioButtonField("EMBEDDED", se_choices, false);
+
+ private LabelFieldColoured lbl_pr_choices = new LabelFieldColoured("Protocols", Color.GREEN, Field.FIELD_LEFT);
+ private CheckboxField cbx_iso1443a = new CheckboxField("ISO14443A", false);
+ private CheckboxField cbx_iso1443b = new CheckboxField("ISO14443B", true);
+ private CheckboxField cbx_iso1443b_prime = new CheckboxField("ISO14443B PRIME", false);
+
+ private LabelFieldColoured lbl_aid = new LabelFieldColoured("AID", Color.GREEN, Field.FIELD_LEFT);
+ private EditField edt_aid = new EditField("","");
+
+ private LabelFieldColoured lbl_apdu = new LabelFieldColoured("APDU", Color.GREEN, Field.FIELD_LEFT);
+ private EditField edt_apdu = new EditField("","");
+
+ private ButtonField btn_save_settings = new ButtonField("Apply", ButtonField.CONSUME_CLICK);
+ private SeparatorField separator = new SeparatorField();
+ private LabelFieldColoured lbl_nfc_service_details = new LabelFieldColoured("NFC Service Details", Color.GREEN,
+ Field.FIELD_LEFT);
+ private RichTextField rtf_nfc_service_details = new RichTextField();
+
+ private FieldChangeListener listener = new FieldChangeListener() {
+
+ public void fieldChanged(Field field, int context) {
+ if(field == btn_save_settings) {
+ save();
+ }
+ }
+ };
+
+ private int current_se;
+ private int current_tt;
+ private boolean aid_changed=false;
+
+ public NfcSettingsScreen() {
+ setTitle("NFCTransactionHandler V" + Constants.VERSION + "-Settings");
+ add(lbl_se_choices);
+ add(se_sim);
+ add(se_embedded);
+ add(lbl_pr_choices);
+ add(cbx_iso1443a);
+ add(cbx_iso1443b);
+ add(cbx_iso1443b_prime);
+ add(lbl_aid);
+ edt_aid.setText(settings.getRegisteredAIDAsString());
+ add(edt_aid);
+ add(lbl_apdu);
+ edt_apdu.setText(settings.getAPDUAsString());
+ add(edt_apdu);
+ add(btn_save_settings);
+ btn_save_settings.setChangeListener(listener);
+ add(separator);
+ add(lbl_nfc_service_details);
+ String nfc_details = "";
+ try {
+ nfc_details = Utilities.getNfcStatusDescription(NFCManager.getInstance().getEnabledNFCServices());
+ } catch(NFCException e) {
+ nfc_details = e.getClass().getName() + ":" + e.getMessage();
+ }
+ rtf_nfc_service_details.setText(nfc_details);
+ add(rtf_nfc_service_details);
+ syncUiWithNfcSettings();
+ }
+
+ private void syncUiWithNfcSettings() {
+ current_se = ce.getCurrentSecureElement();
+ current_tt = ce.getCurrentTechnologyTypes();
+ if(current_se == SecureElement.SIM) {
+ se_sim.setSelected(true);
+ se_embedded.setSelected(false);
+ } else {
+ se_sim.setSelected(false);
+ se_embedded.setSelected(true);
+ }
+ try {
+ int tech_types = ce.getTechnologyTypes(SecureElement.BATTERY_ON_MODE);
+ if((tech_types & TechnologyType.ISO14443A) == TechnologyType.ISO14443A) {
+ cbx_iso1443a.setChecked(true);
+ } else {
+ cbx_iso1443a.setChecked(false);
+ }
+ if((tech_types & TechnologyType.ISO14443B) == TechnologyType.ISO14443B) {
+ cbx_iso1443b.setChecked(true);
+ } else {
+ cbx_iso1443b.setChecked(false);
+ }
+ if((tech_types & TechnologyType.ISO14443B_PRIME) == TechnologyType.ISO14443B_PRIME) {
+ cbx_iso1443b_prime.setChecked(true);
+ } else {
+ cbx_iso1443b_prime.setChecked(false);
+ }
+ } catch(NFCException e) {
+ }
+ }
+
+ public void save() {
+ applySettings();
+ settings.saveSettings();
+ try {
+ super.save();
+ } catch(IOException e) {
+ }
+ }
+
+ private void applySettings() {
+ try {
+ if((current_se == SecureElement.SIM) && (se_choices.getSelectedIndex() == 1)) {
+ ce.initCe(SecureElement.EMBEDDED);
+ settings.setSeEmbedded();
+ } else {
+ if((current_se == SecureElement.EMBEDDED) && (se_choices.getSelectedIndex() == 0)) {
+ ce.initCe(SecureElement.SIM);
+ settings.setSeSIM();
+ }
+ }
+ } catch(NFCException e) {
+ Utilities.popupAlert("Error: could not change SE selection");
+ return;
+ }
+ int tech_types = TechnologyType.NONE;
+ if(cbx_iso1443a.getChecked() == true) {
+ tech_types = tech_types | TechnologyType.ISO14443A;
+ }
+ if(cbx_iso1443b.getChecked() == true) {
+ tech_types = tech_types | TechnologyType.ISO14443B;
+ }
+ if(cbx_iso1443b_prime.getChecked() == true) {
+ tech_types = tech_types | TechnologyType.ISO14443B_PRIME;
+ }
+ settings.setISO14443A(cbx_iso1443a.getChecked());
+ settings.setISO14443B(cbx_iso1443b.getChecked());
+ settings.setISO14443B_PRIME(cbx_iso1443b_prime.getChecked());
+ if (!settings.getRegisteredAIDAsString().equals(edt_aid.getText())) {
+ settings.setRegisteredAID(edt_aid.getText());
+ CardEmulation ce = CardEmulation.getInstance();
+ ce.removeTransactionListener();
+ CardEmulation.registerTransactionListener(NfcTransHandlerApp.getTransactionListener());
+ }
+
+ settings.setAPDU(edt_apdu.getText());
+
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " Selected tech types="
+ + Utilities.getTechnologyTypesNames(tech_types));
+
+ if(current_tt != tech_types) {
+ try {
+ ce.setRoutingOn(tech_types);
+ } catch(NFCException e) {
+ Utilities.popupAlert("Error: could not change CE technology types");
+ return;
+ } catch(Exception e) {
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " " + e.getClass().getName() + ":" + e.getMessage());
+ Utilities.popupAlert(e.getClass().getName() + ": could not change CE technology types");
+ return;
+ }
+ }
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " applySettings 11");
+ setDirty(false);
+ Utilities.log("XXXX " + Thread.currentThread().getName() + " applySettings 12");
+ Utilities.popupMessage("New settings applied");
+
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.