Latest 0.4.5
Homepage https://github.com/amv-networks/amv-access-sdk-ios
License Apache-2.0
Platforms ios 10.0
Authors

License
CocoaPods

What is this repository for?

This repository contains the Xcode 10 project for AMVKit.
The kit has functionality for downloading, storing and using a Device Certificate.
The same is done for Access Certificates with the additional functionality to delete them.

Furthermore, the kit enables easy bluetooth broadcasting and connection with access certificates.
Lastly, it has 2 easy to use methods for vehicle doors – lock and unlock.

Installation

CocoaPods

Make sure you are running the latest version of CocoaPods by running:

gem install cocoapods

# (or if the above fails)
sudo gem install cocoapods

Update your local specs repo by running:

pod repo update

Note: This step is optional, if you updated the specs repo recently.

Add the following lines to your Podfile:

pod 'AMVKit'

Run pod install and you’re all set!

Usage

Main Methods

After the AMVKit has been imported in an app source file, all the functionality is accessible through it’s singleton.

static var AMVKit.shared

To start using AMVKit, it has to be initialised.
The accessSdkOptions contains the URL, credentials and optional identity to access the amv-access-api backend.
The handler-block is invoked when the Device Certificate has been loaded from the local database, or when not present, downloaded from the server.
This also initialises High Mobility’s frameworks, or when any step is unsuccessful, returns an error.

func initialise(accessSdkOptions newAccessSdkOptions, handler done: @escaping (Result<DeviceCertificate>) -> Void) throws

After the kit has been initialised, Access Certificates can be loaded from the local database, or new ones downloaded from the server (overrides the local database on successful download).
Downloading new certificates also registers them with High Mobility’s frameworks.

func getAccessCertificates() -> [AmvAccessCertificate]?
func refreshAccessCertificates(_ done: @escaping (Result<[AmvAccessCertificate]>) -> Void) throws

To connect to a vehicle, an Access Certificate has to be chosen and then passed to the method.
This starts bluetooth broadcasting with the vehicle serial in the advertisment data.
After a suitable vehicle has been found, the connection is established, authenticated and the initial state is queried.
The method’s handler-block is invoked each time the device receives new data from the vehicle, or once for a disconnect.

func connect(to accessCertificate: AmvAccessCertificate, handler: @escaping (Result<VehicleUpdate>) -> Void) throws

Additional Methods

Deleting an Access Certificate first tries to delete it from the server.
If successful, it’s deleted from the local database as well and the done-block is invoked with the deleted certificate for reference.

func deleteAccessCertificate(_ accessCertificate: AmvAccessCertificate, done: @escaping (Result<AmvAccessCertificate>) -> Void) throws

Disconnect from a connected vehicle.
In addition, this stops the bluetooth broadcasting (if active) – can be used before a connection to a vehicle is established.

func disconnect()

Reset the local database by removing all saved access certificates, the device certificate and the keys.

func resetDatabase()

Commands

Before sending commands to the vehicle, you have to wait unitl any previous query is finished.

Requests the current vehicle state.

func sendCommand(.requestVehicleState) throws

Lock the doors

func sendCommand(.lockDoors) throws

Unlock the doors

func sendCommand(.unlockDoors) throws

Misc

All async methods return the result as an enum value.

enum Result<T> {
    case error(Error)
    case success(T)
}

Tests

Implemented tests for the AMVKit:

  • Access Certificates downloading and parsing
  • Device Certificates downloading and parsing
  • Key pair generation

To run them, open the Xcode project, choose AMVKit as the target Scheme and Test.

license

The project is licensed under the Apache License. See LICENSE for details.

Latest podspec

{
    "name": "AMVKit",
    "version": "0.4.5",
    "summary": "AMV Access SDK for iOS",
    "description": "The pod has functionality for downloading, storing and using a Device Certificate.nThe same is done for Access Certificates with the additional functionality to delete them.nnFurthermore, the kit enables easy bluetooth broadcasting and connection with access certificates.nLastly, it has 2 easy to use methods for vehicle doors u2013 lock and unlock.",
    "homepage": "https://github.com/amv-networks/amv-access-sdk-ios",
    "license": {
        "type": "Apache-2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Thomas Jetzinger": "[email protected]"
    },
    "source": {
        "git": "https://github.com/amv-networks/amv-access-sdk-ios.git",
        "tag": "0.4.5"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "AMVKit/**/*",
    "exclude_files": "**/*/Info.plist",
    "vendored_frameworks": "Frameworks/*",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This