abrevva 1.1.1
abrevva: ^1.1.1 copied to clipboard
The EVVA Flutter Module is a collection of tools to work with electronical EVVA access components. It allows for scanning and connecting via BLE.
Abrevva Flutter Plugin
The EVVA Flutter Plugin 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 #
- Flutter >=3.3.0
- Java 17+ (Android)
- Android SDK (Android)
- Android 10+ (API level 29) (Android)
- Xcode 15.4 (iOS)
- iOS 15.0+ (iOS)
Installation #
flutter pub add abrevva
iOS #
Execute pod install
inside of your projects ios/ folder.
Android #
Perform a gradle sync.
Examples #
Initialize and scan for EVVA components #
To start off first import the abrevva
Package
import 'package:abrevva/abrevva.dart';
async function scanForBleDevices(androidNeverForLocation: Boolean = true, timeout: Number) {
await AbrevvaBle.initialize(androidNeverForLocation);
AbrevvaBle.startScan(
(scanResult: ScanResult) => {
print("Discovered Device: ${scanResult.bleDevice.deviceId}");
},
(success: bool) => {
print("onScanStart status=${success}");
},
(success: bool) => {
print("onScanStop status=${success}");
},
null, // macFilter
false, // allowDuplicates
10_000 // timeout
);
}
Read EVVA component advertisement #
Get the EVVA advertisement data from a scanned EVVA component.
final ad = device.advertisementData;
print(ad?.rssi);
print(ad?.isConnectable);
final md = ad?.manufacturerData;
print(md.batteryStatus);
print(md.isOnline);
print(md.officeModeEnabled);
print(md.officeModeActive);
// ...
There are several properties that can be accessed from the advertisement.
class BleDeviceAdvertisementData {
int? rssi;
bool? isConnectable;
BleDeviceManufacturerData? manufacturerData;
Map<String, dynamic>? rawData;
}
class BleDeviceManufacturerData {
int? companyIdentifier;
int? version;
ComponentType? componentType;
int? mainFirmwareVersionMajor;
int? mainFirmwareVersionMinor;
int? mainFirmwareVersionPatch;
int? componentHAL;
BatteryStatus? batteryStatus;
bool? mainConstructionMode;
bool? subConstructionMode;
bool? isOnline;
bool? officeModeEnabled;
bool? twoFactorRequired;
bool? officeModeActive;
String? identifier;
int? subFirmwareVersionMajor;
int? subFirmwareVersionMinor;
int? subFirmwareVersionPatch;
String? subComponentIdentifier;
}
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.
final success = await AbrevvaBle.signalize('deviceId');
Perform disengage on 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.
final status = await AbrevvaBle.disengage(
'deviceId',
'mobileId',
'mobileDeviceKey',
'mobileGroupId',
'mobileAccessData',
false,
);
There are several access status types upon attempting the component disengage.
enum DisengageStatusType {
/// Component
authorized,
authorizedPermanentDisengage,
authorizedPermanentEngage,
authorizedBatteryLow,
authorizedOffline,
unauthorized,
unauthorizedOffline,
signalLocalization,
mediumDefectOnline,
mediumBlacklisted,
error,
/// Interface
unableToConnect,
unableToSetNotifications,
unableToReadChallenge,
unableToWriteMDF,
accessCipherError,
bleAdapterDisabled,
unknownDevice,
unknownStatusCode,
timeout,
}
Coding Identification Media #
Use the CodingStation to write or update access data onto an EVVA identification medium.
class ExampleClass {
final _abrevvaCodingStation = AbrevvaCodingStation();
String url = "";
String clientId = "";
String username = "";
String password = "";
void writeMedium() async {
try {
await _abrevvaCodingStation.register(url, clientId, username, password);
await _abrevvaCodingStation.connect();
await _abrevvaCodingStation.write();
await _abrevvaCodingStation.disconnect();
} catch (e) {
debugPrint("Error $e");
}
}
}