Skip to content

Collection of tools to work with electronic EVVA access components - for native Android development.

License

Notifications You must be signed in to change notification settings

evva-sfw/abrevva-sdk-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

EVVA Abrevva Android SDK

Package managers Package managers EVVA License Maven Central Version

The EVVA Abrevva Android SDK is a collection of tools to work with electronical EVVA access components. It allows for scanning and connecting via BLE.

Features

  • 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

Requirements

Platform Installation Status
iOS see EVVA Abrevva IOS SDK -
Android 10+ (API level 29) Gradle Fully Tested

Installation

Gradle

Gradle is a build automation tool for multi-language software development. For usage and installation instructions, visit their website. To integrate EVVA Abrevva Android SDK into your Android Studio project using Gradle, specify the dependency in your build.gradle File:

dependencies {
  implementation group: "com.evva.xesar", name: "abrevva-sdk-android", version: "1.0.18"
}

Examples

Initialize BleManager

To start off first initialize the SDK BleManager. You can pass an init callback closure for success indication.

import com.evva.xesar.abrevva.ble.BleManager
import android.util.Log

public class Example {
  private lateinit var bleManager: BleManager
  private var bleDeviceMap: MutableMap<String, BleDevice> = mutableMapOf()

  fun initialize() {
    this.bleManager = BleManager(context)
  }
}

Scan for EVVA components

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.

fun requestLeScan() {
  val timeout: Long = 10_000

  this.bleManager.startScan(
    { success ->
      Log.d("BleManager", "Scan started /w success=${success}")
    },
    { device ->
      Log.d("BleManager", "Found device /w address=${device.device.address}")
      this.bleDeviceMap[device.device.address] = device
    },
    { address ->
      Log.d("BleManager", "Connected to device /w address=${address}")

    },
    { address ->
      Log.d("BleManager", "Disconnected from device /w address=${address}")
    },
    timeout
  )
}

Localize EVVA component

With the signalize method you can localize EVVA components. On a successful signalization the component will emit a melody indicating its location.

suspend fun signalize(deviceID: String) {
  val device: BleDevice? = bleDeviceMap[deviceID]

  device?.let {
    this.bleManager.signalize(it) { success ->
      println("Signalized /w success=${it}")
    }
  }
}

Perform disengage for EVVA components

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.

suspend fun disengage(deviceID: String) {
  val device: BleDevice? = bleDeviceMap[deviceID]
  if (device == null) {
    return
  }
  val mobileID = ""           // hex string
  val mobileDeviceKey = ""    // hex string
  val mobileGroupID = ""      // hex string
  val mobileAccessData = ""   // hex string
  val isPermanentRelease = false

  bleManager.disengage(
    deviceID,
    mobileID,
    mobileDeviceKey,
    mobileGroupID,
    mobileAccessData,
    isPermanentRelease,
  ) {
    println("Disengage /w status=$it")
  }
}

There are several access status types upon attempting the component disengage.

enum class DisengageStatusType {
  // Component
  ERROR,
  AUTHORIZED,
  AUTHORIZED_PERMANENT_ENGAGE,
  AUTHORIZED_PERMANENT_DISENGAGE,
  AUTHORIZED_BATTERY_LOW,
  AUTHORIZED_OFFLINE,
  UNAUTHORIZED,
  UNAUTHORIZED_OFFLINE,
  SIGNAL_LOCALIZATION,
  MEDIUM_DEFECT_ONLINE,
  MEDIUM_BLACKLISTED,

  // Interface
  UNKNOWN_STATUS_CODE,
  UNABLE_TO_CONNECT,
  TIMEOUT,
}

About

Collection of tools to work with electronic EVVA access components - for native Android development.

Resources

License

Stars

Watchers

Forks

Packages