Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: update sdk versions and plugin methods and signatures #82

Merged
merged 23 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f85b6b5
chore: AbrevvaSDK Ios version bump; naming
mhochsto Feb 13, 2025
441ae84
feat: added swiftlint
mhochsto Feb 13, 2025
d210348
chore: formating
mhochsto Feb 13, 2025
eff2bc7
feat: updated web & ios to work with AbrevvaSDK 3.0.3
mhochsto Feb 13, 2025
ddbd371
chore: more linting
mhochsto Feb 13, 2025
29aa2bd
fix: removed unused timeout (ios disengage)
mhochsto Feb 13, 2025
d85f8dd
feat: update android plugin to work with sdk 3.0.1
mhochsto Feb 13, 2025
a3ae7d6
fix: typo
mhochsto Feb 13, 2025
80db3d0
feat: version bumps
mhochsto Feb 13, 2025
8ad7d87
chore: react native version bump
mhochsto Feb 13, 2025
91ebf37
feat: readme ; added DisengageStatusType mapping
mhochsto Feb 13, 2025
25d8bf3
fix: yarn typecheck
mhochsto Feb 13, 2025
f249f9e
chore: fix swiftlint and swiftformat config
0x7061 Feb 14, 2025
ee8a192
chore: fix typos and mute intellij warning
0x7061 Feb 14, 2025
aad4c75
chore: update readme
0x7061 Feb 14, 2025
4ca4d20
chore: further update readme
0x7061 Feb 14, 2025
a903929
fix: web tests
mhochsto Feb 14, 2025
355ff8a
fix: functions under test got removed, which makes these tests obsolete
mhochsto Feb 14, 2025
5e964e1
fix: android: removed obsolete test cases ; temporarily disabled star…
mhochsto Feb 14, 2025
e052316
chore: add code formatting in readme
0x7061 Feb 14, 2025
9c95cd3
fix: annotation removal may disable test without commenting code ; d…
mhochsto Feb 14, 2025
98113f2
Merge branch 'feature/update-AbrevvaSDK' of github.com:evva-sfw/abrev…
0x7061 Feb 14, 2025
d9c888f
Merge branch 'feature/update-AbrevvaSDK' of github.com:evva-sfw/abrev…
0x7061 Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 102 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,75 @@ Perform a gradle sync.

### Initialize and scan for EVVA components

To start off first import `AbrevvaBle` from this module

```typescript
import { AbrevvaBle } from '@evva/abrevva-react-native';

async function scanForBleDevices(androidNeverForLocation: Boolean = true, timeout: Number) {
await AbrevvaBle.initialize(androidNeverForLocation);

AbrevvaBle.requestLEScan(
(data: ScanResult) => {
console.log(`Found device: ${data.name}`);
},
(address: string) => {
console.log(`Connected to device: ${address}`);
},
(address: string) => {
console.log(`Disconnected to device: ${address}`);
},
10_000
);
class ExampleClass {
private devices: BleDevice[];

async startScan(event: any) {
this.devices = [];

await AbrevvaBle.initialize();
await AbrevvaBle.startScan(
(device: BleDevice) => {
this.devices.push(device);
}, (success: boolean) => {
console.log(`Scan started, success: ${success}`);
}, (success: boolean) => {
console.log(`Scan stopped, success: ${success}`);
}
);
}
}
```

### Read EVVA component advertisement

Get the EVVA advertisement data from a scanned EVVA component.

```typescript
const ad = device.advertisementData;
console.log(ad?.rssi);
console.log(ad?.isConnectable);

const md = ad?.manufacturerData;
console.log(md?.batteryStatus);
console.log(md?.isOnline);
console.log(md?.officeModeEnabled);
console.log(md?.officeModeActive);
// ...
```

There are several properties that can be accessed from the advertisement.

```typescript
export interface BleDeviceAdvertisementData {
rssi?: number;
isConnectable?: boolean;
manufacturerData?: BleDeviceManufacturerData;
}

export interface BleDeviceManufacturerData {
companyIdentifier?: string;
version?: number;
componentType?: "handle" | "escutcheon" | "cylinder" | "wallreader" | "emzy" | "iobox" | "unknown";
mainFirmwareVersionMajor?: number;
mainFirmwareVersionMinor?: number;
mainFirmwareVersionPatch?: number;
componentHAL?: string;
batteryStatus?: "battery-full" | "battery-empty";
mainConstructionMode?: boolean;
subConstructionMode?: boolean;
isOnline?: boolean;
officeModeEnabled?: boolean;
twoFactorRequired?: boolean;
officeModeActive?: boolean;
identifier?: string;
subFirmwareVersionMajor?: number;
subFirmwareVersionMinor?: number;
subFirmwareVersionPatch?: number;
subComponentIdentifier?: string;
}
```

Expand All @@ -80,7 +129,7 @@ async function scanForBleDevices(androidNeverForLocation: Boolean = true, timeou
With the signalize method you can localize EVVA components. On a successful signalization the component will emit a melody indicating its location.

```typescript
const success = await AbrevvaBle.signalize('deviceId');
const success = (await AbrevvaBle.signalize('deviceId')).value;
```

### Perform disengage on EVVA components
Expand All @@ -89,11 +138,41 @@ For the component disengage you have to provide access credentials to the EVVA c

```typescript
const status = await AbrevvaBle.disengage(
'deviceId',
'mobileId',
'mobileDeviceKey',
'mobileGroupId',
'mobileAccessData',
device.deviceId,
'mobileId', // sha256-hashed hex-encoded version of `xsMobileId` found in blob data.
'mobileDeviceKey', // mobile device key string from `xsMOBDK` found in blob data.
'mobileGroupId', // mobile group id string from `xsMOBGID` found in blob data.
'mobileAccessData', // access data string from `mediumDataFrame` found in blob data.
false,
);
```

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

```typescript
export enum DisengageStatusType {
/// Component
Authorized = "AUTHORIZED",
AuthorizedPermanentEngage = "AUTHORIZED_PERMANENT_ENGAGE",
AuthorizedPermanentDisengage = "AUTHORIZED_PERMANENT_DISENGAGE",
AuthorizedBatteryLow = "AUTHORIZED_BATTERY_LOW",
AuthorizedOffline = "AUTHORIZED_OFFLINE",
Unauthorized = "UNAUTHORIZED",
UnauthorizedOffline = "UNAUTHORIZED_OFFLINE",
SignalLocalization = "SIGNAL_LOCALIZATION",
MediumDefectOnline = "MEDIUM_DEFECT_ONLINE",
MediumBlacklisted = "MEDIUM_BLACKLISTED",
Error = "ERROR",

/// Interface
UnableToConnect = "UNABLE_TO_CONNECT",
UnableToSetNotifications = "UNABLE_TO_SET_NOTIFICATIONS",
UnableToReadChallenge = "UNABLE_TO_READ_CHALLENGE",
UnableToWriteMDF = "UNABLE_TO_WRITE_MDF",
AccessCipherError = "ACCESS_CIPHER_ERROR",
BleAdapterDisabled = "BLE_ADAPTER_DISABLED",
UnknownDevice = "UNKNOWN_DEVICE",
UnknownStatusCode = "UNKNOWN_STATUS_CODE",
Timeout = "TIMEOUT",
}
```
2 changes: 1 addition & 1 deletion abrevva-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|

s.dependency "CocoaMQTT"
s.dependency "CryptoSwift"
s.dependency "AbrevvaSDK", '1.0.31'
s.dependency "AbrevvaSDK", '3.0.4'

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ repositories {
def kotlin_version = getExtOrDefault("kotlinVersion")

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

implementation "com.facebook.react:react-native:0.20.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand All @@ -107,4 +107,4 @@ dependencies {

androidTestImplementation("androidx.test.ext:junit:1.2.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
}
}
Loading
Loading