The EVVA Abrevva iOS SDK is a collection of tools to work with electronical EVVA access components. It allows for scanning and connecting via BLE.
- BLE Scanner for EVVA components in range
- Localize EVVA components encountered by a scan
- Disengage EVVA components encountered by a scan
- Read / Write data via BLE
Platform | Minimum Swift Version | Installation | Status |
---|---|---|---|
iOS 15.0+ | 5.7.1 / Xcode 14.1 | CocoaPods | Fully Tested |
Android | see EVVA Abrevva Android SDK |
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate EVVA Abrevva iOS SDK into your Xcode project using CocoaPods, specify the pod in your Podfile
:
pod 'AbrevvaSDK'
To start off first initialize the SDK BleManager. You can pass an init callback closure for success indication.
import AbrevvaSDK
public class Example {
private var bleManager: BleManager?
private var bleDeviceMap = [String: BleDevice]()
func initialize() {
self.bleManager = BleManager { success, message in
debugPrint("BleManager initialized /w success=\(success)")
}
}
}
Use the BleManager to scan for components in range. You can pass several callback closures to react to the different events when scanning or connecting to components.
func requestLEScan() {
let timeout = 10_000
self.bleManager?.startScan(
nil, // name filter
nil, // name prefix filter
false, // allow duplicates
{ success in
debugPrint("Scan started /w success=\(success)")
},
{ device, advertisementData, rssi in
debugPrint("Found device /w address=\(device.getAddress())")
self.bleDeviceMap[device.getAddress()] = device
},
{ address in
debugPrint("Connected to device /w address=\(address)")
},
{ address in
debugPrint("Disconnected from device /w address=\(address)")
},
timeout
)
}
With the signalize method you can localize EVVA components. On a successful signalization the component will emit a melody indicating its location.
func signalize(deviceID: String) async {
guard let device = self.bleDeviceMap[deviceID] else { return }
let success = await self.bleManager?.signalize(device)
debugPrint("Signalized /w success=\(success)")
}
For the component disengage you have to provide access credentials to the EVVA component. Those are generally acquired in the form of access media metadata from the Xesar software.
func disengage(_ deviceID: String) async {
guard let device = self.bleDeviceMap[deviceID] else { return }
let mobileId = "" // hex string
let mobileDeviceKey = "" // hex string
let mobileGroupID = "" // hex string
let mobileAccessData = "" // hex string
let isPermanentRelease = false
let timeout = 10_000
let status = await self.bleManager?.disengage(
device,
mobileID,
mobileDeviceKey,
mobileGroupID,
mobileAccessData,
isPermanentRelease,
timeout
)
debugPrint("Disengage /w status=\(status)")
}
There are several access status types upon attempting the component disengage.
public enum DisengageStatusType : String {
case ERROR
case AUTHORIZED
case AUTHORIZED_PERMANENT_ENGAGE
case AUTHORIZED_PERMANENT_DISENGAGE
case AUTHORIZED_BATTERY_LOW
case AUTHORIZED_OFFLINE
case UNAUTHORIZED
case UNAUTHORIZED_OFFLINE
case SIGNAL_LOCALIZATION
case MEDIUM_DEFECT_ONLINE
case MEDIUM_BLACKLISTED
case UNKNOWN_STATUS_CODE
case UNABLE_TO_CONNECT
case TIMEOUT
}