@onekeyfe/hd-core 1.2.0-alpha.167 → 1.2.0-alpha.169
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/__tests__/firmware-update/firmware-update-v4-install-poll.test.ts +6 -6
- package/__tests__/pro2Wallpaper.test.ts +66 -0
- package/__tests__/protocol-v2.test.ts +309 -19
- package/dist/api/FirmwareUpdateV4.d.ts +2 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +2 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +277 -72
- package/dist/utils/pro2Wallpaper.d.ts +3 -1
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +127 -17
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +12 -2
- package/src/core/index.ts +6 -100
- package/src/device/DeviceConnector.ts +8 -3
- package/src/utils/pro2Wallpaper.ts +197 -1
|
@@ -26,6 +26,10 @@ describe('FirmwareUpdateV4 install polling', () => {
|
|
|
26
26
|
const typedCall = jest
|
|
27
27
|
.fn()
|
|
28
28
|
.mockResolvedValueOnce({ type: 'Success', message: {} })
|
|
29
|
+
.mockResolvedValueOnce({
|
|
30
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
31
|
+
message: { records: [] },
|
|
32
|
+
})
|
|
29
33
|
.mockResolvedValueOnce({
|
|
30
34
|
type: 'DeviceFirmwareUpdateStatus',
|
|
31
35
|
message: {
|
|
@@ -64,13 +68,9 @@ describe('FirmwareUpdateV4 install polling', () => {
|
|
|
64
68
|
await firmwareUpdate.waitForProtocolV2FirmwareUpdateComplete(targets);
|
|
65
69
|
|
|
66
70
|
expect(typedCall.mock.calls[0]).toEqual(['DeviceFirmwareUpdateStage', 'Success', { targets }]);
|
|
67
|
-
expect(call).toHaveBeenCalledWith(
|
|
68
|
-
'DeviceFirmwareUpdateRequest',
|
|
69
|
-
{},
|
|
70
|
-
{ returnAfterWrite: true }
|
|
71
|
-
);
|
|
71
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
72
72
|
expect(typedCall.mock.calls[1]?.[0]).toBe('DeviceFirmwareUpdateStatusGet');
|
|
73
|
-
expect(call.mock.invocationCallOrder[0]).toBeLessThan(typedCall.mock.invocationCallOrder[
|
|
73
|
+
expect(call.mock.invocationCallOrder[0]).toBeLessThan(typedCall.mock.invocationCallOrder[2]);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test('does not send Request when Stage is rejected', async () => {
|
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
import { encodePro2Wallpaper } from '../src/utils/pro2Wallpaper';
|
|
2
2
|
|
|
3
|
+
// The test decoder mirrors LZ4's bit-packed token and offset format.
|
|
4
|
+
/* eslint-disable no-bitwise */
|
|
5
|
+
|
|
6
|
+
function decodeLz4Block(data: Uint8Array, expectedLength: number) {
|
|
7
|
+
const output = new Uint8Array(expectedLength);
|
|
8
|
+
let inputOffset = 0;
|
|
9
|
+
let outputOffset = 0;
|
|
10
|
+
|
|
11
|
+
const readLength = (initialLength: number) => {
|
|
12
|
+
let length = initialLength;
|
|
13
|
+
if (length === 0x0f) {
|
|
14
|
+
let extension = 0xff;
|
|
15
|
+
while (extension === 0xff) {
|
|
16
|
+
extension = data[inputOffset];
|
|
17
|
+
inputOffset += 1;
|
|
18
|
+
length += extension;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return length;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
while (inputOffset < data.byteLength) {
|
|
25
|
+
const token = data[inputOffset];
|
|
26
|
+
inputOffset += 1;
|
|
27
|
+
const literalLength = readLength(token >> 4);
|
|
28
|
+
output.set(data.subarray(inputOffset, inputOffset + literalLength), outputOffset);
|
|
29
|
+
inputOffset += literalLength;
|
|
30
|
+
outputOffset += literalLength;
|
|
31
|
+
if (inputOffset >= data.byteLength) break;
|
|
32
|
+
|
|
33
|
+
const matchOffset = data[inputOffset] | (data[inputOffset + 1] << 8);
|
|
34
|
+
inputOffset += 2;
|
|
35
|
+
const matchLength = readLength(token & 0x0f) + 4;
|
|
36
|
+
for (let index = 0; index < matchLength; index += 1) {
|
|
37
|
+
output[outputOffset] = output[outputOffset - matchOffset];
|
|
38
|
+
outputOffset += 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
expect(outputOffset).toBe(expectedLength);
|
|
43
|
+
return output;
|
|
44
|
+
}
|
|
45
|
+
|
|
3
46
|
describe('encodePro2Wallpaper', () => {
|
|
4
47
|
test('encodes opaque pixels as aligned LVGL v9 RGB565 data', () => {
|
|
5
48
|
const result = encodePro2Wallpaper({
|
|
@@ -28,6 +71,29 @@ describe('encodePro2Wallpaper', () => {
|
|
|
28
71
|
expect(Array.from(result.data.slice(12))).toEqual([0x1f, 0x00, 0xff, 0xff, 128, 255]);
|
|
29
72
|
});
|
|
30
73
|
|
|
74
|
+
test('encodes an I8 palette and pixel indices as an LVGL LZ4 block', () => {
|
|
75
|
+
const result = encodePro2Wallpaper({
|
|
76
|
+
width: 2,
|
|
77
|
+
height: 1,
|
|
78
|
+
rgba: new Uint8Array([255, 0, 0, 255, 0, 255, 0, 255]),
|
|
79
|
+
encoding: 'i8-lz4',
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
expect(result.colorFormat).toBe('I8');
|
|
83
|
+
expect(Array.from(result.data.slice(0, 12))).toEqual([
|
|
84
|
+
0x19, 0x0a, 0x08, 0, 2, 0, 1, 0, 2, 0, 0, 0,
|
|
85
|
+
]);
|
|
86
|
+
const view = new DataView(result.data.buffer, result.data.byteOffset, result.data.byteLength);
|
|
87
|
+
expect(view.getUint32(12, true)).toBe(2);
|
|
88
|
+
expect(view.getUint32(16, true)).toBe(result.data.byteLength - 24);
|
|
89
|
+
expect(view.getUint32(20, true)).toBe(1026);
|
|
90
|
+
|
|
91
|
+
const rawData = decodeLz4Block(result.data.slice(24), 1026);
|
|
92
|
+
expect(Array.from(rawData.slice(210 * 4, 210 * 4 + 4))).toEqual([0, 0, 255, 255]);
|
|
93
|
+
expect(Array.from(rawData.slice(36 * 4, 36 * 4 + 4))).toEqual([0, 255, 0, 255]);
|
|
94
|
+
expect(Array.from(rawData.slice(-2))).toEqual([210, 36]);
|
|
95
|
+
});
|
|
96
|
+
|
|
31
97
|
test('rejects invalid dimensions and RGBA byte length', () => {
|
|
32
98
|
expect(() => encodePro2Wallpaper({ width: 0, height: 1, rgba: new Uint8Array() })).toThrow(
|
|
33
99
|
'width'
|
|
@@ -194,7 +194,13 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
194
194
|
refreshProtocolV2SettingsAfterMutation: jest.fn().mockResolvedValue({}),
|
|
195
195
|
});
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
afterEach(() => {
|
|
198
|
+
jest.restoreAllMocks();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('uses I8 with LZ4 when uploading a Pro2 wallpaper over BLE', async () => {
|
|
202
|
+
jest.spyOn(DataManager, 'getSettings').mockReturnValue('lowlevel');
|
|
203
|
+
jest.spyOn(DataManager, 'isBleConnect').mockReturnValue(true);
|
|
198
204
|
const typedCall = jest.fn().mockImplementation((request, _response, params) => {
|
|
199
205
|
if (request === 'FilesystemDirMake') return { message: { message: 'directory ready' } };
|
|
200
206
|
if (request === 'FilesystemFileWrite') {
|
|
@@ -237,7 +243,7 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
237
243
|
});
|
|
238
244
|
expect(device.refreshProtocolV2SettingsAfterMutation).toHaveBeenCalledTimes(1);
|
|
239
245
|
expect(typedCall.mock.calls.some(call => call[0] === 'SetWallpaper')).toBe(false);
|
|
240
|
-
expect(result).toMatchObject({ colorFormat: '
|
|
246
|
+
expect(result).toMatchObject({ colorFormat: 'I8', message: 'wallpaper applied' });
|
|
241
247
|
const fileWriteCallCount = typedCall.mock.calls.filter(
|
|
242
248
|
call => call[0] === 'FilesystemFileWrite'
|
|
243
249
|
).length;
|
|
@@ -275,6 +281,8 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
275
281
|
});
|
|
276
282
|
|
|
277
283
|
test('returns success when wallpaper read-back fails after apply', async () => {
|
|
284
|
+
jest.spyOn(DataManager, 'getSettings').mockReturnValue('desktop-webusb');
|
|
285
|
+
jest.spyOn(DataManager, 'isBleConnect').mockReturnValue(false);
|
|
278
286
|
const typedCall = jest.fn().mockImplementation((request, _response, params) => {
|
|
279
287
|
if (request === 'FilesystemDirMake') return { message: {} };
|
|
280
288
|
if (request === 'FilesystemFileWrite') {
|
|
@@ -300,7 +308,10 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
300
308
|
(method as any).device = device;
|
|
301
309
|
method.init();
|
|
302
310
|
|
|
303
|
-
await expect(method.run()).resolves.toMatchObject({
|
|
311
|
+
await expect(method.run()).resolves.toMatchObject({
|
|
312
|
+
colorFormat: 'RGB565',
|
|
313
|
+
message: 'wallpaper applied',
|
|
314
|
+
});
|
|
304
315
|
expect(device.refreshProtocolV2SettingsAfterMutation).toHaveBeenCalledTimes(1);
|
|
305
316
|
});
|
|
306
317
|
|
|
@@ -317,6 +328,19 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
317
328
|
expect(() => method.init()).toThrow('fileName');
|
|
318
329
|
});
|
|
319
330
|
|
|
331
|
+
test('rejects unsupported wallpaper encodings before device communication', () => {
|
|
332
|
+
const method = new DeviceUploadWallpaper({
|
|
333
|
+
id: 1,
|
|
334
|
+
payload: {
|
|
335
|
+
method: 'deviceUploadWallpaper',
|
|
336
|
+
jpegBase64: createJpegBase64(604, 1024),
|
|
337
|
+
encoding: 'gzip',
|
|
338
|
+
} as any,
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
expect(() => method.init()).toThrow('encoding');
|
|
342
|
+
});
|
|
343
|
+
|
|
320
344
|
test('rejects unsupported firmware before creating or writing files', async () => {
|
|
321
345
|
const typedCall = jest.fn();
|
|
322
346
|
const method = new DeviceUploadWallpaper({
|
|
@@ -4901,6 +4925,34 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4901
4925
|
expect(initialize).not.toHaveBeenCalled();
|
|
4902
4926
|
});
|
|
4903
4927
|
|
|
4928
|
+
test('scans and reacquires the same BLE peripheral without probing during install recovery', async () => {
|
|
4929
|
+
const method = new FirmwareUpdateV4({
|
|
4930
|
+
id: 1,
|
|
4931
|
+
payload: {
|
|
4932
|
+
method: 'firmwareUpdateV4',
|
|
4933
|
+
},
|
|
4934
|
+
});
|
|
4935
|
+
const acquire = jest.fn().mockResolvedValue({ uuid: 'ble-id', protocolType: 'V2' });
|
|
4936
|
+
const enumerate = jest.fn().mockResolvedValue({
|
|
4937
|
+
descriptors: [{ id: 'ble-id', name: 'OneKey Pro 2', protocolType: 'V2' }],
|
|
4938
|
+
});
|
|
4939
|
+
const commands = { disposed: true, mainId: '' };
|
|
4940
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
4941
|
+
(method as any).device = stubDevice({
|
|
4942
|
+
originalDescriptor: { id: 'ble-id', path: 'ble-path', protocolType: 'V2' },
|
|
4943
|
+
deviceConnector: { acquire, enumerate },
|
|
4944
|
+
commands,
|
|
4945
|
+
getCommands: () => commands,
|
|
4946
|
+
});
|
|
4947
|
+
|
|
4948
|
+
await (method as any).reconnectProtocolV2Device({ skipBleProtocolProbe: true });
|
|
4949
|
+
|
|
4950
|
+
expect(enumerate).toHaveBeenCalledTimes(1);
|
|
4951
|
+
expect(acquire).toHaveBeenCalledWith('ble-id', null, true, 'V2', undefined, undefined, true);
|
|
4952
|
+
expect(commands.disposed).toBe(false);
|
|
4953
|
+
expect(commands.mainId).toBe('ble-id');
|
|
4954
|
+
});
|
|
4955
|
+
|
|
4904
4956
|
test('selects the matching physical device from multiple Protocol V2 USB reconnect candidates', async () => {
|
|
4905
4957
|
const method = new FirmwareUpdateV4({
|
|
4906
4958
|
id: 1,
|
|
@@ -5362,11 +5414,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5362
5414
|
interaction,
|
|
5363
5415
|
},
|
|
5364
5416
|
});
|
|
5365
|
-
expect(call).toHaveBeenCalledWith(
|
|
5366
|
-
'DeviceFirmwareUpdateRequest',
|
|
5367
|
-
{},
|
|
5368
|
-
{ returnAfterWrite: true }
|
|
5369
|
-
);
|
|
5417
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
5370
5418
|
expect(typedCall.mock.invocationCallOrder[0]).toBeLessThan(call.mock.invocationCallOrder[0]);
|
|
5371
5419
|
expect((method.postMessage as jest.Mock).mock.invocationCallOrder[0]).toBeLessThan(
|
|
5372
5420
|
call.mock.invocationCallOrder[0]
|
|
@@ -5436,6 +5484,93 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5436
5484
|
expect(method.postProgressMessage).not.toHaveBeenCalled();
|
|
5437
5485
|
});
|
|
5438
5486
|
|
|
5487
|
+
test('continues to install polling when the empty request releases BLE transport', async () => {
|
|
5488
|
+
const method = new FirmwareUpdateV4({
|
|
5489
|
+
id: 1,
|
|
5490
|
+
payload: {
|
|
5491
|
+
method: 'firmwareUpdateV4',
|
|
5492
|
+
},
|
|
5493
|
+
});
|
|
5494
|
+
const typedCall = jest.fn().mockResolvedValue({ type: 'Success', message: {} });
|
|
5495
|
+
const call = jest.fn().mockRejectedValue(new Error('React Native BLE transport released'));
|
|
5496
|
+
|
|
5497
|
+
(method as any).device = stubDevice({
|
|
5498
|
+
getCommands: () => ({ typedCall, call }),
|
|
5499
|
+
createProtocolV2UiPhaseMetadata: jest.fn().mockReturnValue(undefined),
|
|
5500
|
+
toMessageObject: jest.fn().mockReturnValue({ connectId: 'pro2' }),
|
|
5501
|
+
});
|
|
5502
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
5503
|
+
method.postMessage = jest.fn();
|
|
5504
|
+
|
|
5505
|
+
await expect(
|
|
5506
|
+
(method as any).protocolV2StartFirmwareUpdate({
|
|
5507
|
+
targets: [{ target_id: 4, path: 'vol0:/application_p1.bin' }],
|
|
5508
|
+
})
|
|
5509
|
+
).resolves.toBeUndefined();
|
|
5510
|
+
|
|
5511
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
5512
|
+
expect((method as any).protocolV2InstallNeedsBleReconnect).toBe(true);
|
|
5513
|
+
});
|
|
5514
|
+
|
|
5515
|
+
test.each([
|
|
5516
|
+
{ name: 'bootloader', targetId: 3, path: 'vol0:/bootloader.bin' },
|
|
5517
|
+
{ name: 'application', targetId: 4, path: 'vol0:/application_p1.bin' },
|
|
5518
|
+
{ name: 'secure element', targetId: 7, path: 'vol0:/se01.bin' },
|
|
5519
|
+
])(
|
|
5520
|
+
'reconnects a released BLE install link before polling $name status without DeviceInfo',
|
|
5521
|
+
async ({ targetId, path }) => {
|
|
5522
|
+
const method = new FirmwareUpdateV4({
|
|
5523
|
+
id: 1,
|
|
5524
|
+
payload: {
|
|
5525
|
+
method: 'firmwareUpdateV4',
|
|
5526
|
+
},
|
|
5527
|
+
});
|
|
5528
|
+
const targets = [{ target_id: targetId, path }];
|
|
5529
|
+
const typedCall = jest
|
|
5530
|
+
.fn()
|
|
5531
|
+
.mockResolvedValueOnce({
|
|
5532
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5533
|
+
message: { records: [{ ...targets[0], status: 1, payload_version: 0 }] },
|
|
5534
|
+
})
|
|
5535
|
+
.mockResolvedValueOnce({
|
|
5536
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5537
|
+
message: { records: [{ ...targets[0], status: 2, payload_version: 0x010000 }] },
|
|
5538
|
+
});
|
|
5539
|
+
const reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5540
|
+
const verifyProtocolV2ReconnectIdentity = jest.fn();
|
|
5541
|
+
const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
|
|
5542
|
+
callback: () => void
|
|
5543
|
+
) => {
|
|
5544
|
+
callback();
|
|
5545
|
+
return 0 as any;
|
|
5546
|
+
}) as typeof setTimeout);
|
|
5547
|
+
|
|
5548
|
+
(method as any).device = stubDevice({
|
|
5549
|
+
getCommands: () => ({ typedCall }),
|
|
5550
|
+
});
|
|
5551
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
5552
|
+
(method as any).protocolV2InstallNeedsBleReconnect = true;
|
|
5553
|
+
(method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
|
|
5554
|
+
(method as any).verifyProtocolV2ReconnectIdentity = verifyProtocolV2ReconnectIdentity;
|
|
5555
|
+
method.postProgressMessage = jest.fn();
|
|
5556
|
+
|
|
5557
|
+
try {
|
|
5558
|
+
await expect(
|
|
5559
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete(targets, true)
|
|
5560
|
+
).resolves.toBeUndefined();
|
|
5561
|
+
} finally {
|
|
5562
|
+
setTimeoutSpy.mockRestore();
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5565
|
+
expect(reconnectProtocolV2Device).toHaveBeenCalledWith({ skipBleProtocolProbe: true });
|
|
5566
|
+
expect(verifyProtocolV2ReconnectIdentity).not.toHaveBeenCalled();
|
|
5567
|
+
expect(typedCall.mock.calls.map(callArgs => callArgs[0])).toEqual([
|
|
5568
|
+
'DeviceFirmwareUpdateStatusGet',
|
|
5569
|
+
'DeviceFirmwareUpdateStatusGet',
|
|
5570
|
+
]);
|
|
5571
|
+
}
|
|
5572
|
+
);
|
|
5573
|
+
|
|
5439
5574
|
test('polls only firmware status while Protocol V2 bootloader is installing', async () => {
|
|
5440
5575
|
const method = new FirmwareUpdateV4({
|
|
5441
5576
|
id: 1,
|
|
@@ -5678,6 +5813,169 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5678
5813
|
expect(typedCall).toHaveBeenCalledTimes(3);
|
|
5679
5814
|
});
|
|
5680
5815
|
|
|
5816
|
+
test('ignores a mixed stale failure snapshot until ordered current records replace it', async () => {
|
|
5817
|
+
const method = new FirmwareUpdateV4({
|
|
5818
|
+
id: 1,
|
|
5819
|
+
payload: {
|
|
5820
|
+
method: 'firmwareUpdateV4',
|
|
5821
|
+
},
|
|
5822
|
+
});
|
|
5823
|
+
const targets = [
|
|
5824
|
+
{ target_id: 3, path: 'vol0:/bootloader.bin' },
|
|
5825
|
+
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
5826
|
+
{ target_id: 7, path: 'vol0:/se01.bin' },
|
|
5827
|
+
{ target_id: 8, path: 'vol0:/se02.bin' },
|
|
5828
|
+
];
|
|
5829
|
+
const staleRecords = [
|
|
5830
|
+
{
|
|
5831
|
+
target_id: 'FW_MGMT_TARGET_BOOTLOADER',
|
|
5832
|
+
status: 'FW_MGMT_UPDATER_TASK_STATUS_PENDING',
|
|
5833
|
+
payload_version: 0,
|
|
5834
|
+
path: 'vol0:/bootloader.bin',
|
|
5835
|
+
},
|
|
5836
|
+
{
|
|
5837
|
+
target_id: 'FW_MGMT_TARGET_APPLICATION_P1',
|
|
5838
|
+
status: 'FW_MGMT_UPDATER_TASK_STATUS_FINISHED',
|
|
5839
|
+
payload_version: 0x010000,
|
|
5840
|
+
path: 'vol0:/application_p1.bin',
|
|
5841
|
+
},
|
|
5842
|
+
{
|
|
5843
|
+
target_id: 'FW_MGMT_TARGET_SE01',
|
|
5844
|
+
status: 'FW_MGMT_UPDATER_TASK_STATUS_FAILED_VERIFY',
|
|
5845
|
+
payload_version: 0,
|
|
5846
|
+
path: 'vol0:/se01.bin',
|
|
5847
|
+
},
|
|
5848
|
+
{
|
|
5849
|
+
target_id: 'FW_MGMT_TARGET_SE02',
|
|
5850
|
+
status: 'FW_MGMT_UPDATER_TASK_STATUS_FAILED_VERIFY',
|
|
5851
|
+
payload_version: 0,
|
|
5852
|
+
path: 'vol0:/se02.bin',
|
|
5853
|
+
},
|
|
5854
|
+
];
|
|
5855
|
+
const typedCall = jest
|
|
5856
|
+
.fn()
|
|
5857
|
+
.mockResolvedValueOnce({
|
|
5858
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5859
|
+
message: { records: staleRecords },
|
|
5860
|
+
})
|
|
5861
|
+
.mockResolvedValueOnce({
|
|
5862
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5863
|
+
message: {
|
|
5864
|
+
records: targets.map(target => ({ ...target, status: 0, payload_version: 0 })),
|
|
5865
|
+
},
|
|
5866
|
+
})
|
|
5867
|
+
.mockResolvedValueOnce({
|
|
5868
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5869
|
+
message: {
|
|
5870
|
+
records: [
|
|
5871
|
+
{ ...targets[0], status: 0, payload_version: 0 },
|
|
5872
|
+
{ ...targets[1], status: 1, payload_version: 0 },
|
|
5873
|
+
{ ...targets[2], status: 0, payload_version: 0 },
|
|
5874
|
+
{ ...targets[3], status: 0, payload_version: 0 },
|
|
5875
|
+
],
|
|
5876
|
+
},
|
|
5877
|
+
})
|
|
5878
|
+
.mockResolvedValueOnce({
|
|
5879
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5880
|
+
message: {
|
|
5881
|
+
records: targets.map(target => ({
|
|
5882
|
+
...target,
|
|
5883
|
+
status: 2,
|
|
5884
|
+
payload_version: 0x010000,
|
|
5885
|
+
})),
|
|
5886
|
+
},
|
|
5887
|
+
});
|
|
5888
|
+
const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
|
|
5889
|
+
callback: () => void
|
|
5890
|
+
) => {
|
|
5891
|
+
callback();
|
|
5892
|
+
return 0 as any;
|
|
5893
|
+
}) as typeof setTimeout);
|
|
5894
|
+
|
|
5895
|
+
(method as any).device = stubDevice({
|
|
5896
|
+
getCommands: () => ({ typedCall }),
|
|
5897
|
+
});
|
|
5898
|
+
(method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5899
|
+
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5900
|
+
(method as any).protocolV2InstallStatusBaseline = staleRecords;
|
|
5901
|
+
method.postProgressMessage = jest.fn();
|
|
5902
|
+
|
|
5903
|
+
try {
|
|
5904
|
+
await expect(
|
|
5905
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete(targets, true)
|
|
5906
|
+
).resolves.toBeUndefined();
|
|
5907
|
+
} finally {
|
|
5908
|
+
setTimeoutSpy.mockRestore();
|
|
5909
|
+
}
|
|
5910
|
+
|
|
5911
|
+
expect(typedCall).toHaveBeenCalledTimes(4);
|
|
5912
|
+
expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
|
|
5913
|
+
});
|
|
5914
|
+
|
|
5915
|
+
test('reports a failed target after the current records replace the stale baseline', async () => {
|
|
5916
|
+
const method = new FirmwareUpdateV4({
|
|
5917
|
+
id: 1,
|
|
5918
|
+
payload: {
|
|
5919
|
+
method: 'firmwareUpdateV4',
|
|
5920
|
+
},
|
|
5921
|
+
});
|
|
5922
|
+
const targets = [
|
|
5923
|
+
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
5924
|
+
{ target_id: 7, path: 'vol0:/se01.bin' },
|
|
5925
|
+
];
|
|
5926
|
+
const staleRecords = [
|
|
5927
|
+
{ ...targets[0], status: 2, payload_version: 0x010000 },
|
|
5928
|
+
{ ...targets[1], status: 6, payload_version: 0 },
|
|
5929
|
+
];
|
|
5930
|
+
const typedCall = jest
|
|
5931
|
+
.fn()
|
|
5932
|
+
.mockResolvedValueOnce({
|
|
5933
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5934
|
+
message: { records: staleRecords },
|
|
5935
|
+
})
|
|
5936
|
+
.mockResolvedValueOnce({
|
|
5937
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5938
|
+
message: {
|
|
5939
|
+
records: targets.map(target => ({ ...target, status: 0, payload_version: 0 })),
|
|
5940
|
+
},
|
|
5941
|
+
})
|
|
5942
|
+
.mockResolvedValueOnce({
|
|
5943
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5944
|
+
message: {
|
|
5945
|
+
records: [
|
|
5946
|
+
{ ...targets[0], status: 2, payload_version: 0x010000 },
|
|
5947
|
+
{ ...targets[1], status: 6, payload_version: 0 },
|
|
5948
|
+
],
|
|
5949
|
+
},
|
|
5950
|
+
});
|
|
5951
|
+
const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
|
|
5952
|
+
callback: () => void
|
|
5953
|
+
) => {
|
|
5954
|
+
callback();
|
|
5955
|
+
return 0 as any;
|
|
5956
|
+
}) as typeof setTimeout);
|
|
5957
|
+
|
|
5958
|
+
(method as any).device = stubDevice({
|
|
5959
|
+
getCommands: () => ({ typedCall }),
|
|
5960
|
+
});
|
|
5961
|
+
(method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5962
|
+
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5963
|
+
(method as any).protocolV2InstallStatusBaseline = staleRecords;
|
|
5964
|
+
|
|
5965
|
+
try {
|
|
5966
|
+
await expect(
|
|
5967
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete(targets, true)
|
|
5968
|
+
).rejects.toMatchObject({
|
|
5969
|
+
errorCode: HardwareErrorCode.FirmwareError,
|
|
5970
|
+
params: { firmwareUpdateCode: 'FirmwareInstallFailed' },
|
|
5971
|
+
});
|
|
5972
|
+
} finally {
|
|
5973
|
+
setTimeoutSpy.mockRestore();
|
|
5974
|
+
}
|
|
5975
|
+
|
|
5976
|
+
expect(typedCall).toHaveBeenCalledTimes(3);
|
|
5977
|
+
});
|
|
5978
|
+
|
|
5681
5979
|
test('waits five minutes before rejecting normal mode without install evidence', async () => {
|
|
5682
5980
|
const method = new FirmwareUpdateV4({
|
|
5683
5981
|
id: 1,
|
|
@@ -8726,11 +9024,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8726
9024
|
'Success',
|
|
8727
9025
|
{ targets: [{ target_id: 4, path: 'vol1:firmware.bin' }] },
|
|
8728
9026
|
]);
|
|
8729
|
-
expect(call).toHaveBeenCalledWith(
|
|
8730
|
-
'DeviceFirmwareUpdateRequest',
|
|
8731
|
-
{},
|
|
8732
|
-
{ returnAfterWrite: true }
|
|
8733
|
-
);
|
|
9027
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
8734
9028
|
expect(method.postTipMessage).not.toHaveBeenCalled();
|
|
8735
9029
|
expect(method.postProgressMessage).not.toHaveBeenCalled();
|
|
8736
9030
|
|
|
@@ -8740,7 +9034,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8740
9034
|
expect(method.postProgressMessage).not.toHaveBeenCalled();
|
|
8741
9035
|
});
|
|
8742
9036
|
|
|
8743
|
-
test('sends an empty Protocol V2 firmware install request
|
|
9037
|
+
test('sends an empty Protocol V2 firmware install request and waits for its response', async () => {
|
|
8744
9038
|
const method = new FirmwareUpdateV4({
|
|
8745
9039
|
id: 1,
|
|
8746
9040
|
payload: {
|
|
@@ -8767,11 +9061,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8767
9061
|
});
|
|
8768
9062
|
|
|
8769
9063
|
expect(typedCall.mock.calls[0][0]).toBe('DeviceFirmwareUpdateStage');
|
|
8770
|
-
expect(call).toHaveBeenCalledWith(
|
|
8771
|
-
'DeviceFirmwareUpdateRequest',
|
|
8772
|
-
{},
|
|
8773
|
-
{ returnAfterWrite: true }
|
|
8774
|
-
);
|
|
9064
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
8775
9065
|
expect(method.postTipMessage).not.toHaveBeenCalled();
|
|
8776
9066
|
});
|
|
8777
9067
|
});
|
|
@@ -17,6 +17,8 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
17
17
|
private protocolV2LatestFinalFeatures?;
|
|
18
18
|
private protocolV2LatestFinalDeviceInfo?;
|
|
19
19
|
private protocolV2InstallBaselineVersions;
|
|
20
|
+
private protocolV2InstallStatusBaseline?;
|
|
21
|
+
private protocolV2InstallNeedsBleReconnect;
|
|
20
22
|
private protocolV2LastRuntimeProbeFeatures?;
|
|
21
23
|
private protocolV2LastTransferProgress?;
|
|
22
24
|
private protocolV2LastTransferProgressAt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA0BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AA+B/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAoErC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import { type Pro2WallpaperColorFormat } from '../../utils/pro2Wallpaper';
|
|
2
|
+
import { type Pro2WallpaperColorFormat, type Pro2WallpaperEncoding } from '../../utils/pro2Wallpaper';
|
|
3
3
|
export type DeviceUploadWallpaperParams = {
|
|
4
4
|
jpegBase64: string;
|
|
5
5
|
fileName?: string;
|
|
6
6
|
chunkSize?: number;
|
|
7
|
+
encoding?: Pro2WallpaperEncoding;
|
|
7
8
|
};
|
|
8
9
|
export type DeviceUploadWallpaperResponse = {
|
|
9
10
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceUploadWallpaper.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceUploadWallpaper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"DeviceUploadWallpaper.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceUploadWallpaper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAE3B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,wBAAwB,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAmBF,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,UAAU,CAAC,2BAA2B,CAAC;IACxF,qBAAqB;IAIrB,OAAO,CAAC,OAAO,CAAC,CAA8D;IAE9E,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,IAAI,CAAM;IAElB,IAAI;YAkCU,kBAAkB;YAgBlB,eAAe;YAaf,MAAM;IAwBd,GAAG,IAAI,OAAO,CAAC,6BAA6B,CAAC;CAyBpD"}
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EACV,6BAA6B,EAG9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAWpD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAmE7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EACV,6BAA6B,EAG9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAWpD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAmE7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAoFvE,CAAC;AAiqBF,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAWpF;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAW/E;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,WAQlF;AA0PD,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAoG9D,CAAC;AAmGF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAiLF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAE1C,OAAO,CAAC,cAAc,CAAC,CAAgB;IAGvC,OAAO,CAAC,sBAAsB,CAAoC;IAElE,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IA6BhB,aAAa,CAAC,OAAO,EAAE,WAAW;IAuExC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAOV,gBAAgB;CAiC/B;AAED,eAAO,MAAM,QAAQ,YAIpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
|
|
@@ -14,7 +14,7 @@ export default class DeviceConnector {
|
|
|
14
14
|
enumerate(): Promise<DeviceDescriptorDiff | undefined>;
|
|
15
15
|
listen(): Promise<void>;
|
|
16
16
|
stop(): void;
|
|
17
|
-
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean): Promise<string | undefined>;
|
|
17
|
+
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean, skipProtocolProbe?: boolean): Promise<string | undefined>;
|
|
18
18
|
release(session: string, onclose: boolean, keepSession?: boolean): Promise<void>;
|
|
19
19
|
disconnect(session: string | undefined | null): Promise<void>;
|
|
20
20
|
promptDeviceAccess(): Promise<USBDevice | BluetoothDevice | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceConnector.d.ts","sourceRoot":"","sources":["../../src/device/DeviceConnector.ts"],"names":[],"mappings":";;AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI9F,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,eAAe,SAAK;IAEpB,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAQ;IAE1C,QAAQ,EAAE,gBAAgB,EAAE,CAAM;IAElC,SAAS,UAAS;;IAQlB,OAAO,CAAC,kBAAkB;IAYpB,SAAS;IAWT,MAAM;IAgCZ,IAAI;IAIE,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,gBAAgB,CAAC,EAAE,uBAAuB,EAC1C,YAAY,CAAC,EAAE,uBAAuB,EACtC,sBAAsB,CAAC,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"DeviceConnector.d.ts","sourceRoot":"","sources":["../../src/device/DeviceConnector.ts"],"names":[],"mappings":";;AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI9F,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,eAAe,SAAK;IAEpB,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAQ;IAE1C,QAAQ,EAAE,gBAAgB,EAAE,CAAM;IAElC,SAAS,UAAS;;IAQlB,OAAO,CAAC,kBAAkB;IAYpB,SAAS;IAWT,MAAM;IAgCZ,IAAI;IAIE,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,gBAAgB,CAAC,EAAE,uBAAuB,EAC1C,YAAY,CAAC,EAAE,uBAAuB,EACtC,sBAAsB,CAAC,EAAE,OAAO,EAChC,iBAAiB,CAAC,EAAE,OAAO;IAwDvB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO;IAShE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAWnD,kBAAkB,IAAI,OAAO,CAAC,SAAS,GAAG,eAAe,GAAG,IAAI,CAAC;IAQjE,oBAAoB;CAGrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -700,7 +700,7 @@ declare class DeviceConnector {
|
|
|
700
700
|
enumerate(): Promise<DeviceDescriptorDiff | undefined>;
|
|
701
701
|
listen(): Promise<void>;
|
|
702
702
|
stop(): void;
|
|
703
|
-
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean): Promise<string | undefined>;
|
|
703
|
+
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean, skipProtocolProbe?: boolean): Promise<string | undefined>;
|
|
704
704
|
release(session: string, onclose: boolean, keepSession?: boolean): Promise<void>;
|
|
705
705
|
disconnect(session: string | undefined | null): Promise<void>;
|
|
706
706
|
promptDeviceAccess(): Promise<USBDevice | BluetoothDevice | null>;
|
|
@@ -1113,11 +1113,13 @@ declare const switchTransport: ({ env, Transport, plugin, }: {
|
|
|
1113
1113
|
|
|
1114
1114
|
declare const PRO2_WALLPAPER_WIDTH = 604;
|
|
1115
1115
|
declare const PRO2_WALLPAPER_HEIGHT = 1024;
|
|
1116
|
-
type Pro2WallpaperColorFormat = 'RGB565' | 'RGB565A8';
|
|
1116
|
+
type Pro2WallpaperColorFormat = 'RGB565' | 'RGB565A8' | 'I8';
|
|
1117
|
+
type Pro2WallpaperEncoding = 'rgb565' | 'i8-lz4';
|
|
1117
1118
|
declare function encodePro2Wallpaper(options: {
|
|
1118
1119
|
width: number;
|
|
1119
1120
|
height: number;
|
|
1120
1121
|
rgba: Uint8Array | ArrayBuffer;
|
|
1122
|
+
encoding?: Pro2WallpaperEncoding;
|
|
1121
1123
|
}): {
|
|
1122
1124
|
data: Uint8Array;
|
|
1123
1125
|
colorFormat: Pro2WallpaperColorFormat;
|
|
@@ -1127,6 +1129,7 @@ type DeviceUploadWallpaperParams = {
|
|
|
1127
1129
|
jpegBase64: string;
|
|
1128
1130
|
fileName?: string;
|
|
1129
1131
|
chunkSize?: number;
|
|
1132
|
+
encoding?: Pro2WallpaperEncoding;
|
|
1130
1133
|
};
|
|
1131
1134
|
type DeviceUploadWallpaperResponse = {
|
|
1132
1135
|
path: string;
|