AB Circle Bluetooth iOS Demo
The AB Circle Bluetooth iOS Demo Application is a Swift application demonstrating the use of the “ABCSmartCardIO” framework.
The “ABCSmartCardIO” framework is a Swift framework used for iOS applications to communicate with ABC Bluetooth Smart Card Readers through a derived version of the Java Smart Card I/O API as defined by JSR 268. To do so, the framework implements a custom “TerminalFactory” interface written in Swift which is referenced by this demo application.
Supported Readers
- CIR415
OS Support
- This demo application supports iOS 13.0 or above.
Prerequisites
- A Mac computer
- An Apple Developer Account: https://developer.apple.com/programs/register/
- Xcode IDE - Xcode 11 or higher
- An iOS device - iPhone or iPad
Getting Started
- Open the project in Xcode 11 or higher
- Connect the iPhone or iPad to the Mac
- Select the iPhone or iPad as Target and press “Run” to start the demo on the device
Note: it is also possible to run the demo in a simulator also, but simulators do not have bluetooth support available.
Demo Details
Main Screen
The Demo application consists of a main view holding controls to:
- Select a Card Terminal
- Connect to a Card on the Terminal
- Send APDU or Escape Commands to the connected Terminal
Notes:
- Details and results are shown in a logger text view.
- Options can be added in an option screen:
- A custom encryption key in case a custom key is set in the bluetooth reader used.
- Filters on terminal name and RSSI value
- Press the ‘Disconnect’ button to disconnect (and unpair) a selected terminal completely.
- Press the ‘Battery’ button to get the battery level of the selected terminal.
- Press the ‘Version’ button to get the firmware version of the selected terminal.
Usage
- Start the application, the main screen will open (with no terminals selected)
- Turn on a CIR415 Buetooth reader and press the Refresh button on the main screen
- If the CIR415 has been found, the selected terminal field will show its name
- Press the selected terminal field to open a terminal selection view in order to select another terminal if needed
- Choose the connection method (exclusive or direct) and the connection protocol (T=0, T=1 or both)
- Place a card on the CIR415 reader and press Connect to connect to the card using above-mentioned settings
- Press “Send” to send the default APDU or tap the APDU field to enter another APDU first
- Alternatively, press “Send” to send the default escape command or tap the Escape Command field to enter another command first
Notes:
- Apdu / Escape command fields will only enabled after connecting to a terminal / card.
- For testing card detection, disconnect from a terminal and press “Wait Card Change” to wait for a card change and tap / remove a card from the CIR415 reader.
- When the CIR415 is using a custom encryption key, press the pencil icon in the top bar to open a Custom Key input window and input the custom key there.
Demo Contents
The following files are shown in the demo project:
- Main.storyboard : Holds the main views used in the demo
- ViewController.Swift: Main class controlling the main view and using the ABCSmartCardIO framework functionality
- OptionsController.Swift: Class controlling the Custom Key input view, and terminal name / RSSI filters
- TextInputViewController.Swift: Class controlling the APDU / Escape command input view
- NoCaretUITextField.Swift: Custom read only UITextField control (used for APDU / Escape Command input fields)
- NoCaretUITextView.Swift: Custom read only UITextView control (used for the log view)
- HexEditUITextView.Swift: Custom UITextView control enabling hexadecimal input (used for APDU / Escape Command input)
- ToolbarUIPickerView.Swift: Custom UIPickerView with toolbar (used for terminal selection)
- Helper.Swift: Class holding some helper functions
- info.plist: application information property list (see also the paragraph below for bluetooth access)
- Assets.sxassets: defines the icons used in this demo
Notes:
- For details on above classes, see also the documentation in the Documentation folder.
- Other files are auto-generated files when the project was created and should not be modified
Bluetooth Access Rights for applications
In order for applications to use bluetooth, access needs to be enabled by adding a usage description key to the info.plist file. On apps linked on or after iOS 13, include the “NSBluetoothAlwaysUsageDescription” key. In iOS 12 and earlier, include “NSBluetoothPeripheralUsageDescription” to access Bluetooth peripheral data.
See also: https://developer.apple.com/documentation/corebluetooth
History
v1.3.0 12 April 2021
- Uses AB Circle SmartCardIO framework v1.3.0
- Added Battery button to get the battery level of a selected terminal
- Added Version button to get the firmware version of a selected terminal
v1.2.1 25 March 2021
- Uses AB Circle SmartCardIO framework v1.2.1
v1.1.0 18 February 2021
- Uses AB Circle SmartCardIO framework v1.2.0
- Added terminal name and RSSI filters in the Options screen
- Added disconnect button for disconnecting a terminal
v1.0.0 21 December 2020
- Initial release
Authors
- ABC Software Team (engineering@abcircle.com)
License
Copyright (c) 2018-2021, AB Circle Ltd. All rights reserved.