@capgo/capacitor-zebra-datawedge 8.2.3 → 8.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/app/capgo/zebradatawedge/DataWedgeDiagnostics.java +85 -0
- package/android/src/main/java/app/capgo/zebradatawedge/ZebraDataWedge.java +1 -1
- package/android/src/main/java/app/capgo/zebradatawedge/ZebraDataWedgePlugin.java +204 -25
- package/dist/docs.json +143 -11
- package/dist/esm/definitions.d.ts +149 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -1
- package/dist/esm/web.js +6 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +6 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +6 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/ZebraDataWedgePlugin/ZebraDataWedgePlugin.swift +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,10 +155,20 @@ console.log(result);
|
|
|
155
155
|
- `softRfidTrigger()` uses the first registered scan intent action. Register a scan action first if you need RFID reads.
|
|
156
156
|
- Web and iOS return "not available" errors for all DataWedge operations.
|
|
157
157
|
|
|
158
|
+
## Broadcast compatibility and security
|
|
159
|
+
|
|
160
|
+
DataWedge can return query results without `COMMAND_IDENTIFIER`. The plugin accepts such a result only when its payload type matches exactly one pending query that expects that payload shape. Avoid overlapping pending calls that share the same result payload shape: replies without identifiers cannot reliably distinguish their owners. For example, `getAssociatedApps()` and `getConfig()` both send `CMD_GET_CONFIG` and expect `CONFIG_RESULTS`, so one pending call to each still overlaps. If a query times out, a delayed identifier-free reply to the timed-out query can still match a later sequential call that expects the same payload shape and resolve it with stale data. Replies with unknown nonempty identifiers are not assigned to another query.
|
|
161
|
+
|
|
162
|
+
On Android 14/API 34 and later, identifier-free replies that share platform sender identity must identify the DataWedge package. A sender can withhold its identity on API 34 and later, and the plugin then accepts matching identifier-free results. Identity is also unavailable on Android API 24 to 33, where the plugin accepts matching identifier-free results for compatibility with DataWedge.
|
|
163
|
+
|
|
164
|
+
Query correlation and payload validation do not guarantee sender authenticity. Any installed app can inject a matching identifier-free query result on every Android version, including by withholding its identity on API 34 and later. Replies with matching command identifiers, scan data and notification broadcasts also lack complete sender authentication. See the [known sender-authentication limitations](https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25) for details.
|
|
165
|
+
|
|
158
166
|
## API
|
|
159
167
|
|
|
160
168
|
<docgen-index>
|
|
161
169
|
|
|
170
|
+
- [`configureDiagnostics(...)`](#configurediagnostics)
|
|
171
|
+
- [`getDiagnostics()`](#getdiagnostics)
|
|
162
172
|
- [`cloneProfile(...)`](#cloneprofile)
|
|
163
173
|
- [`createProfile(...)`](#createprofile)
|
|
164
174
|
- [`deleteProfile(...)`](#deleteprofile)
|
|
@@ -207,6 +217,34 @@ console.log(result);
|
|
|
207
217
|
<docgen-api>
|
|
208
218
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
209
219
|
|
|
220
|
+
### configureDiagnostics(...)
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
configureDiagnostics(options: DiagnosticsOptions) => Promise<void>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Configure opt-in native command metadata tracing. Never enables DataWedge or scanner input.
|
|
227
|
+
|
|
228
|
+
| Param | Type |
|
|
229
|
+
| ------------- | ----------------------------------------------------------------- |
|
|
230
|
+
| **`options`** | <code><a href="#diagnosticsoptions">DiagnosticsOptions</a></code> |
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### getDiagnostics()
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
getDiagnostics() => Promise<DataWedgeDiagnosticsSnapshot>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Return a read-only native environment and trace snapshot. Does not send any DataWedge commands.
|
|
241
|
+
Barcode values, intent bodies and arbitrary exception text are excluded. The application decides
|
|
242
|
+
which device information to include when sharing this snapshot. Android only.
|
|
243
|
+
|
|
244
|
+
**Returns:** <code>Promise<<a href="#datawedgediagnosticssnapshot">DataWedgeDiagnosticsSnapshot</a>></code>
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
210
248
|
### cloneProfile(...)
|
|
211
249
|
|
|
212
250
|
```typescript
|
|
@@ -365,6 +403,15 @@ Dispose of local listeners separately when using the low-level API.
|
|
|
365
403
|
enumerateScanners() => Promise<{ scanners: ZebraDeviceScanner[]; }>
|
|
366
404
|
```
|
|
367
405
|
|
|
406
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
407
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
408
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
409
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
410
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
411
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
412
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
413
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
414
|
+
|
|
368
415
|
**Returns:** <code>Promise<{ scanners: ZebraDeviceScanner[]; }></code>
|
|
369
416
|
|
|
370
417
|
---
|
|
@@ -375,6 +422,15 @@ enumerateScanners() => Promise<{ scanners: ZebraDeviceScanner[]; }>
|
|
|
375
422
|
getActiveProfile() => Promise<{ profileName: string; }>
|
|
376
423
|
```
|
|
377
424
|
|
|
425
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
426
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
427
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
428
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
429
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
430
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
431
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
432
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
433
|
+
|
|
378
434
|
**Returns:** <code>Promise<{ profileName: string; }></code>
|
|
379
435
|
|
|
380
436
|
---
|
|
@@ -385,6 +441,17 @@ getActiveProfile() => Promise<{ profileName: string; }>
|
|
|
385
441
|
getAssociatedApps(options: { profileName: string; }) => Promise<{ appList: DataWedgeAppConfig[]; }>
|
|
386
442
|
```
|
|
387
443
|
|
|
444
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
445
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
446
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. For example,
|
|
447
|
+
`getAssociatedApps()` and `getConfig()` both send `CMD_GET_CONFIG` and expect `CONFIG_RESULTS`, so one
|
|
448
|
+
pending call to each overlaps. When sender identity is unavailable (Android API 24 to 33, or API
|
|
449
|
+
34+ when the platform withholds it), matching identifier-free replies are accepted for
|
|
450
|
+
compatibility. If a call times out, a delayed identifier-free reply can still match a later
|
|
451
|
+
sequential call that expects the same shape and resolve it with stale data. This default may
|
|
452
|
+
change in the next Capacitor major version; see
|
|
453
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
454
|
+
|
|
388
455
|
| Param | Type |
|
|
389
456
|
| ------------- | ------------------------------------- |
|
|
390
457
|
| **`options`** | <code>{ profileName: string; }</code> |
|
|
@@ -399,6 +466,17 @@ getAssociatedApps(options: { profileName: string; }) => Promise<{ appList: DataW
|
|
|
399
466
|
getConfig(options: GetConfigOptions) => Promise<ZebraProfileConfiguration>
|
|
400
467
|
```
|
|
401
468
|
|
|
469
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
470
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
471
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. For example,
|
|
472
|
+
`getAssociatedApps()` and `getConfig()` both send `CMD_GET_CONFIG` and expect `CONFIG_RESULTS`, so one
|
|
473
|
+
pending call to each overlaps. When sender identity is unavailable (Android API 24 to 33, or API
|
|
474
|
+
34+ when the platform withholds it), matching identifier-free replies are accepted for
|
|
475
|
+
compatibility. If a call times out, a delayed identifier-free reply can still match a later
|
|
476
|
+
sequential call that expects the same shape and resolve it with stale data. This default may
|
|
477
|
+
change in the next Capacitor major version; see
|
|
478
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
479
|
+
|
|
402
480
|
| Param | Type |
|
|
403
481
|
| ------------- | ------------------------------------------------------------- |
|
|
404
482
|
| **`options`** | <code><a href="#getconfigoptions">GetConfigOptions</a></code> |
|
|
@@ -413,6 +491,15 @@ getConfig(options: GetConfigOptions) => Promise<ZebraProfileConfiguration>
|
|
|
413
491
|
getDatawedgeStatus() => Promise<DataWedgeStatusResult>
|
|
414
492
|
```
|
|
415
493
|
|
|
494
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
495
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
496
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
497
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
498
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
499
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
500
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
501
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
502
|
+
|
|
416
503
|
**Returns:** <code>Promise<<a href="#datawedgestatusresult">DataWedgeStatusResult</a>></code>
|
|
417
504
|
|
|
418
505
|
---
|
|
@@ -423,6 +510,15 @@ getDatawedgeStatus() => Promise<DataWedgeStatusResult>
|
|
|
423
510
|
getDisabledAppList() => Promise<{ appList: DataWedgeAppConfig[]; }>
|
|
424
511
|
```
|
|
425
512
|
|
|
513
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
514
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
515
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
516
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
517
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
518
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
519
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
520
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
521
|
+
|
|
426
522
|
**Returns:** <code>Promise<{ appList: DataWedgeAppConfig[]; }></code>
|
|
427
523
|
|
|
428
524
|
---
|
|
@@ -433,6 +529,15 @@ getDisabledAppList() => Promise<{ appList: DataWedgeAppConfig[]; }>
|
|
|
433
529
|
getIgnoreDisabledProfiles() => Promise<IgnoreDisabledProfilesResult>
|
|
434
530
|
```
|
|
435
531
|
|
|
532
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
533
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
534
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
535
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
536
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
537
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
538
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
539
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
540
|
+
|
|
436
541
|
**Returns:** <code>Promise<<a href="#ignoredisabledprofilesresult">IgnoreDisabledProfilesResult</a>></code>
|
|
437
542
|
|
|
438
543
|
---
|
|
@@ -443,6 +548,15 @@ getIgnoreDisabledProfiles() => Promise<IgnoreDisabledProfilesResult>
|
|
|
443
548
|
getProfilesList() => Promise<{ profiles: string[]; }>
|
|
444
549
|
```
|
|
445
550
|
|
|
551
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
552
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
553
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
554
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
555
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
556
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
557
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
558
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
559
|
+
|
|
446
560
|
**Returns:** <code>Promise<{ profiles: string[]; }></code>
|
|
447
561
|
|
|
448
562
|
---
|
|
@@ -453,6 +567,15 @@ getProfilesList() => Promise<{ profiles: string[]; }>
|
|
|
453
567
|
getScannerStatus() => Promise<{ status: ScannerStatus | string; }>
|
|
454
568
|
```
|
|
455
569
|
|
|
570
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
571
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
572
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
573
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
574
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
575
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
576
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
577
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
578
|
+
|
|
456
579
|
**Returns:** <code>Promise<{ status: string; }></code>
|
|
457
580
|
|
|
458
581
|
---
|
|
@@ -463,6 +586,15 @@ getScannerStatus() => Promise<{ status: ScannerStatus | string; }>
|
|
|
463
586
|
getVersionInfo() => Promise<ZebraDeviceVersionInfo>
|
|
464
587
|
```
|
|
465
588
|
|
|
589
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
590
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
591
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
592
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
593
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
594
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
595
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
596
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
597
|
+
|
|
466
598
|
**Returns:** <code>Promise<<a href="#zebradeviceversioninfo">ZebraDeviceVersionInfo</a>></code>
|
|
467
599
|
|
|
468
600
|
---
|
|
@@ -505,6 +637,15 @@ enableScannerInput() => Promise<void>
|
|
|
505
637
|
enumerateTriggers() => Promise<{ triggers: string[]; }>
|
|
506
638
|
```
|
|
507
639
|
|
|
640
|
+
Android only. DataWedge may omit `COMMAND_IDENTIFIER` on query replies. The plugin accepts
|
|
641
|
+
identifier-free replies only when the payload matches exactly one pending call that expects the
|
|
642
|
+
same result payload shape. Avoid overlapping pending calls that share that shape. When sender
|
|
643
|
+
identity is unavailable (Android API 24 to 33, or API 34+ when the platform withholds it),
|
|
644
|
+
matching identifier-free replies are accepted for compatibility. If a call times out, a delayed
|
|
645
|
+
identifier-free reply can still match a later sequential call that expects the same shape and
|
|
646
|
+
resolve it with stale data. This default may change in the next Capacitor major version; see
|
|
647
|
+
https://github.com/Cap-go/capacitor-zebra-datawedge/issues/25/.
|
|
648
|
+
|
|
508
649
|
**Returns:** <code>Promise<{ triggers: string[]; }></code>
|
|
509
650
|
|
|
510
651
|
---
|
|
@@ -655,6 +796,28 @@ addListener(eventName: 'notification', listenerFunc: (event: ZebraNotificationEv
|
|
|
655
796
|
|
|
656
797
|
### Interfaces
|
|
657
798
|
|
|
799
|
+
#### DiagnosticsOptions
|
|
800
|
+
|
|
801
|
+
| Prop | Type | Description |
|
|
802
|
+
| ---------------- | -------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
803
|
+
| **`enabled`** | <code>boolean</code> | Enable metadata tracing. Disabled by default; disabling does not erase previous entries. |
|
|
804
|
+
| **`maxEntries`** | <code>number</code> | Number of recent entries retained, from 1 to 1000. Initially 100; omitted values preserve the current capacity. |
|
|
805
|
+
| **`reset`** | <code>boolean</code> | Clear retained entries and reset elapsed time and dropped count. Default: false. |
|
|
806
|
+
|
|
807
|
+
#### DataWedgeDiagnosticsSnapshot
|
|
808
|
+
|
|
809
|
+
| Prop | Type | Description |
|
|
810
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
811
|
+
| **`diagnosticsVersion`** | <code>number</code> | |
|
|
812
|
+
| **`enabled`** | <code>boolean</code> | |
|
|
813
|
+
| **`maxEntries`** | <code>number</code> | |
|
|
814
|
+
| **`droppedEntries`** | <code>number</code> | |
|
|
815
|
+
| **`manufacturer`** | <code>string</code> | |
|
|
816
|
+
| **`model`** | <code>string</code> | |
|
|
817
|
+
| **`androidVersion`** | <code>string</code> | |
|
|
818
|
+
| **`dataWedgePackage`** | <code>{ status: 'installed' \| 'notFound' \| 'unavailable'; version?: string; }</code> | notFound means Android could not find the package; it is not a service-permission check. |
|
|
819
|
+
| **`commands`** | <code>{ commandIdentifier: string; outcome: 'SENT' \| 'SUCCESS' \| 'FAILURE' \| 'TIMEOUT' \| 'TRANSPORT_ERROR' \| 'CANCELLED' \| 'INVALID_RESPONSE'; elapsedMs: number; }[]</code> | |
|
|
820
|
+
|
|
658
821
|
#### CloneProfileOptions
|
|
659
822
|
|
|
660
823
|
| Prop | Type |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
package app.capgo.zebradatawedge;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.pm.PackageInfo;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.os.Build;
|
|
7
|
+
import android.os.SystemClock;
|
|
8
|
+
import com.getcapacitor.JSArray;
|
|
9
|
+
import com.getcapacitor.JSObject;
|
|
10
|
+
import java.util.ArrayDeque;
|
|
11
|
+
|
|
12
|
+
/** Opt-in metadata only: no barcode values, intent bodies, or arbitrary exception text. */
|
|
13
|
+
final class DataWedgeDiagnostics {
|
|
14
|
+
|
|
15
|
+
private final ArrayDeque<JSObject> events = new ArrayDeque<>();
|
|
16
|
+
private boolean enabled;
|
|
17
|
+
private int capacity = 100;
|
|
18
|
+
private int dropped;
|
|
19
|
+
private long startedAt;
|
|
20
|
+
|
|
21
|
+
synchronized void configure(boolean enabled, Integer capacity, boolean reset) {
|
|
22
|
+
this.enabled = enabled;
|
|
23
|
+
if (capacity != null) this.capacity = capacity;
|
|
24
|
+
if (reset) {
|
|
25
|
+
events.clear();
|
|
26
|
+
dropped = 0;
|
|
27
|
+
startedAt = SystemClock.elapsedRealtime();
|
|
28
|
+
}
|
|
29
|
+
while (events.size() > this.capacity) {
|
|
30
|
+
events.removeFirst();
|
|
31
|
+
dropped++;
|
|
32
|
+
}
|
|
33
|
+
if (enabled && startedAt == 0) startedAt = SystemClock.elapsedRealtime();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
synchronized void record(String identifier, String outcome) {
|
|
37
|
+
if (!enabled) return;
|
|
38
|
+
if (events.size() == capacity) {
|
|
39
|
+
events.removeFirst();
|
|
40
|
+
dropped++;
|
|
41
|
+
}
|
|
42
|
+
JSObject event = new JSObject();
|
|
43
|
+
event.put("commandIdentifier", identifier);
|
|
44
|
+
event.put("outcome", outcome);
|
|
45
|
+
event.put("elapsedMs", SystemClock.elapsedRealtime() - startedAt);
|
|
46
|
+
events.addLast(event);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
synchronized JSObject snapshot(Context context) {
|
|
50
|
+
JSArray commands = new JSArray();
|
|
51
|
+
for (JSObject event : events) {
|
|
52
|
+
// Copy every value so callers cannot mutate the ring through a previous snapshot.
|
|
53
|
+
JSObject copy = new JSObject();
|
|
54
|
+
copy.put("commandIdentifier", event.getString("commandIdentifier"));
|
|
55
|
+
copy.put("outcome", event.getString("outcome"));
|
|
56
|
+
copy.put("elapsedMs", event.optLong("elapsedMs"));
|
|
57
|
+
commands.put(copy);
|
|
58
|
+
}
|
|
59
|
+
JSObject result = new JSObject();
|
|
60
|
+
result.put("diagnosticsVersion", 1);
|
|
61
|
+
result.put("enabled", enabled);
|
|
62
|
+
result.put("maxEntries", capacity);
|
|
63
|
+
result.put("droppedEntries", dropped);
|
|
64
|
+
result.put("manufacturer", Build.MANUFACTURER);
|
|
65
|
+
result.put("model", Build.MODEL);
|
|
66
|
+
result.put("androidVersion", Build.VERSION.RELEASE);
|
|
67
|
+
result.put("dataWedgePackage", describePackage(context));
|
|
68
|
+
result.put("commands", commands);
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private JSObject describePackage(Context context) {
|
|
73
|
+
JSObject result = new JSObject();
|
|
74
|
+
try {
|
|
75
|
+
PackageInfo info = context.getPackageManager().getPackageInfo("com.symbol.datawedge", 0);
|
|
76
|
+
result.put("status", "installed");
|
|
77
|
+
if (info.versionName != null) result.put("version", info.versionName);
|
|
78
|
+
} catch (PackageManager.NameNotFoundException exception) {
|
|
79
|
+
result.put("status", "notFound");
|
|
80
|
+
} catch (Exception exception) {
|
|
81
|
+
result.put("status", "unavailable");
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -79,7 +79,7 @@ public final class ZebraDataWedge {
|
|
|
79
79
|
public static final String RESULT_GET_DATAWEDGE_STATUS = "com.symbol.datawedge.api.RESULT_GET_DATAWEDGE_STATUS";
|
|
80
80
|
public static final String RESULT_GET_DISABLED_APP_LIST = "com.symbol.datawedge.api.RESULT_GET_DISABLED_APP_LIST";
|
|
81
81
|
public static final String RESULT_GET_IGNORE_DISABLED_PROFILES = "com.symbol.datawedge.api.RESULT_GET_IGNORE_DISABLED_PROFILES";
|
|
82
|
-
public static final String RESULT_GET_SCANNER_STATUS = "com.symbol.datawedge.api.
|
|
82
|
+
public static final String RESULT_GET_SCANNER_STATUS = "com.symbol.datawedge.api.RESULT_SCANNER_STATUS";
|
|
83
83
|
public static final String RESULT_ENUMERATE_SCANNERS = "com.symbol.datawedge.api.RESULT_ENUMERATE_SCANNERS";
|
|
84
84
|
public static final String RESULT_ENUMERATED_SCANNER_LIST = "DWAPI_KEY_ENUMERATEDSCANNERLIST";
|
|
85
85
|
public static final String RESULT_ENUMERATE_TRIGGERS = "com.symbol.datawedge.api.RESULT_ENUMERATE_TRIGGERS";
|