Android SDK
Installation
Step 1: Add JitPack to your project build.gradle
build.gradleallprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
} Note: As of the 7.X.X Gradle build tools,
allprojectsis deprecated. In that case, follow Step 3 below.
- Step 2 - Add the dependency in your app build.gradle
dependencies {
...
implementation 'com.github.intellicar:lafm_android_sdk:0.0.112'
}Replace
0.0.112with the latest version number shown below:
- Step 3 - (Optional)
As of the 7.X.X Gradle build tools, Android projects no longer generate allprojects blocks in their project build.gradle file. Instead, you get a dependencyResolutionManagement block in your settings.gradle.
Documentation
Implementation
Required Dependency
1. Flash Initialization
2. Generating key pair
phonePrivateKey & phonePublicKey
3. Token Initialization
tokenwill be the response from the getlaftoken API.scanTimeoutis optional.setTokenwill:Set the
TOKEN.Connect to the device.
Example TOKEN
4. Callback Handler
Example
Any operation or update from the device will be received through these callbacks.
Data is in JSON format.
The general structure for data received is:
Types of MsgType
MsgTypegps
GPS information
gsm
GSM information
can
CAN information
acc
Accelerometer information
device_io
Device I/O information
device_info
Device Information
mosfet_control_cmd
Mosfet control commands
cmd_error
If any key missing in the command
Status
connection_status
Current Bluetooth connection status
Example callback response format for connection_status
Possible connection_status values
connection_status valuesScanning
Scanning for device
Found
Device found during scanning
NotFound
Device not found after scanning
Connecting
Starting the connection process for the found device
FailedToConnect
Unable to establish a connection
Connected
Connection with device established successfully
DisConnecting
In the process of disconnecting the device
DisConnected
Connection closed
Authorized
Valid connection to the device (valid token)
UnAuthorized
Invalid connection to the device (invalid token)
5. Sending Commands
Types of action
actionget_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
disconnect
End an existing connection
kle_lock
Lock the vehicle
kle_unlock
Unlock the vehicle
mosfet_cmd
Send Mosfet control command
start_charging
Start charging command
output_1_enable
Enable output 1
output_2_disable
Disable output 2
io_control
Send IO control command
get_sys_info
Retrieve the system info
Example callback response format for a command (e.g.,
acc)
6. Mosfet Control
Response of the command
Possible status values
status valuesCMD_INPROGRESS
Command is currently in progress
CMD_RECEIVED
Command received by the device
CMD_SUCCESS
Command executed successfully
CMD_FAILED
Command failed
7. Scan and StopScan
Last updated