# AB Circle Bluetooth iOS Objective C Demo

The ABCircle Bluetooth Objective C Demo is a small sample application demonstrating the use of the ABCSmartCardIO API in Objective-C.

This application allows terminal discovery, shows some terminal information and tried to get a card UID if a card is placed on the reader.

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](https://jcp.org/en/jsr/detail?id=268). To do so, the framework implements a custom "TerminalFactory" interface written in Swift which 
is referenced by this demo application.

## Supported Readers

- CIR415
- CIR515

## OS Support

- This application supports iOS 13.0 or above.

## Prerequisites

1. A Mac computer
2. An Apple Developer Account: https://developer.apple.com/programs/register/
2. Xcode IDE - Xcode 11 or higher
2. An iOS device  - iPhone or iPad

## Getting Started

1. Open the project in Xcode 11 or higher
2. Connect the iPhone or iPad to the Mac
3. Select the iPhone or iPad as Target and press "Run" to start the sample application on the device

Note: it is also possible to run the application in a simulator also, but simulators do not have bluetooth support available.

## Application Details
  
The application demonstrates to the user a way to scan for a AB Circle bluetooth reader using the ABCSmartCardIO BT library through its exported functions in Objective-C.
It has a simple UI containing a 'Scan' button only. Further output is shown in the
output screen from Xcode. 

When pressing 'Scan' the application will start scanning for available readers. If readers are found, it will go through the list of readers and show the firmware version, serial number and it will try to do a small I/O test showing the card UID if present. 

Results are shown in the output screen from Xcode.
<br>

### Application Contents

The following files are shown in the project:
- Main.storyboard : Holds the main views used in the sample application
- ViewController.m: Main class controlling the main view and using the ABCSmartCardIO framework functionality
- info.plist: application information property list (see also the paragraph below for bluetooth access)
- Assets.sxassets: defines the icons used in this sample application
  
Notes:
- Other files are auto-generated files when the project was created and should not be modified
<br>

### Note: usage of the ABCSmartCardIO framework in Objective-C

The ABCSmartCardIO framework exposes its API through a 'ABCSmartCardIO-Swift.h' header which can be incorporated into Objective-C projects like this demo.
This header can be found as part of the AB Circle SmartCard I/O package under the Targets/ABCSmartCardIO.xcframework/ios-arm64/ABCSmartCardIO.framework/Headers folder.

Similar to Swift projects:
- From the project details, under Frameworks, select the ABCSmartCardIO.xcframework and drag it to the section 'Frameworks, Libraries and Embedded Content'
- Then in the main .m file using the ABCSmartCardIO API, add "#import \<ABCSmartCardIO/ABCSmartCardIO-Swift.h\>" in order to use the API.

### Note: 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
<br>
  
## History

v1.0.3                23 Apr 2024
* Uses AB Circle SmartCardIO framework v1.5.8
* fixed Xcode backward compatibility issue

v1.0.2                16 Apr 2024
* Uses AB Circle SmartCardIO framework v1.5.7

v1.0.1                04 Feb 2024
* Uses AB Circle SmartCardIO framework v1.5.6

v1.0.0                29 Aug 2023
* Initial release
* Uses AB Circle SmartCardIO framework v1.5.5

## Authors

* **ABC Software Team** (engineering@abcircle.com)

## License
```
Copyright (c) 2018-2024, AB Circle Ltd. All rights reserved.
```
