iOS SDK

Installation

CocoaPods Install

pod 'LAFM', :git => 'https://github.com/intellicar/ace_ios_sdk.git', :tag => '0.0.170'
Xcode File -> add packages -> search for "https://github.com/intellicar/ace_ios_sdk"

Documentation


Implementation

1. Generating key pair

phonePrivateKey & phone_publickey

LAFMDevice.shared.generateKeyPair()

Response

(privateKey: xxxxxxxxxxxxxx, publicKey: xxxxxxxxxxxx)

2. SDK Initialization

Note: Add NSBluetoothAlwaysUsageDescription to Info.plist.

  • The parameter passed is in JSON format.

Example token


3. Callback Handler

  • Any operation or update from the device will be received in this callback.

  • Data is in JSON format.

Types of Message

Type of messages
Description

gps

GPS information

gsm

GSM information

can

CAN information

acc

Accelerometer information

device_io

Device I/O Information

device_info

Device Information

timestamp

Create a connection (no direct call needed)

Status

connection_status

Current Bluetooth connection status

phone_bluetooth_status

Mobile Bluetooth state code (CoreBluetooth)

Example callback response format for connection_status:

Connection Status

Connection Status
Description

scanning

Scanning for device

scanningStoped

Scanning stopped

found

Device found while scanning

notFound

Device not found after scanning

connecting

Starting connection process for the found device

failledToConnect

Unable to establish a connection

connected

Connection with device established

disConnected

Connection closed

authorized

Valid connection to the device (valid token)

unAuthorized

Invalid connection to the device (invalid token)

Example callback response format for phone_bluetooth_status:

state values reflect the CBManagerState in iOS:

CBManagerState
Description

unknown

0

resetting

1

unsupported

2

unauthorized

3

poweredOff

4

poweredOn

5


Error Codes

Error Code
Description

-1

token not found

-2

device_name not found

-3

phonePrivatKey not found

-4

scan stopped due to timeout

-5

connection time exceeded

-6

Phone Bluetooth not powered on

1

Internal Error (Public key not available)

2

Token public key not matching device public key

4

Internal Error (Encryption key not generated)

8

Validity out of range, premature or expired

16

Token signature not valid

32

Expired token received


4. Sending Commands

Example parameter format:

Action
Description

get_gps

Retrieve GPS data

get_gsm

Retrieve GSM data

get_can

Retrieve CAN data

get_acc

Retrieve accelerometer data

get_device_io

Retrieve device I/O

get_device_info

Retrieve device details

connect

Create a connection (not needed if other actions are used)

disconnect

End an existing connection

lock

Lock the vehicle

unlock

Unlock the vehicle

Last updated