@onekeyfe/hd-core 1.2.0-alpha.2 → 1.2.0-alpha.4
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__/preInitialize.test.ts +33 -0
- package/__tests__/protocol-v2.test.ts +1577 -624
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +20 -2
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +4 -4
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +4 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/index.d.ts +5 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +1 -1
- package/dist/api/protocol-v2/{DeviceGetDeviceInfo.d.ts → DeviceInfoGet.d.ts} +10 -10
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/{FilesystemFixPermission.d.ts → FilesystemPermissionFix.d.ts} +2 -2
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +6 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +24 -19
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -5
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +5 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
- package/dist/index.d.ts +85 -58
- package/dist/index.js +1672 -1640
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +12 -14
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +10 -9
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +2 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +4 -4
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +6 -11
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +12 -17
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts +1 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +29 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FileRead.ts +14 -1
- package/src/api/FileWrite.ts +14 -1
- package/src/api/FirmwareUpdateV4.ts +933 -197
- package/src/api/GetOnekeyFeatures.ts +1 -1
- package/src/api/GetPassphraseState.ts +7 -4
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
- package/src/api/device/DeviceRebootToBootloader.ts +4 -4
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +11 -4
- package/src/api/index.ts +5 -10
- package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +3 -3
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +3 -5
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +2 -2
- package/src/api/protocol-v2/{DeviceGetDeviceInfo.ts → DeviceInfoGet.ts} +52 -22
- package/src/api/protocol-v2/DeviceReboot.ts +2 -2
- package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +2 -2
- package/src/api/protocol-v2/{GetProtoVersion.ts → ProtocolInfoRequest.ts} +2 -2
- package/src/api/protocol-v2/helpers.ts +48 -57
- package/src/api/ton/TonSignData.ts +1 -5
- package/src/constants/index.ts +10 -1
- package/src/core/index.ts +19 -3
- package/src/data/messages/messages-protocol-v2.json +1224 -1804
- package/src/data-manager/DataManager.ts +7 -0
- package/src/device/Device.ts +34 -12
- package/src/device/DevicePool.ts +6 -6
- package/src/deviceProfile/buildDeviceFeatures.ts +61 -63
- package/src/deviceProfile/buildDeviceProfile.ts +78 -60
- package/src/inject.ts +10 -16
- package/src/protocols/protocol-v2/features.ts +26 -62
- package/src/protocols/protocol-v2/firmware.ts +11 -36
- package/src/types/api/firmwareUpdate.ts +10 -20
- package/src/types/api/getDeviceInfo.ts +2 -0
- package/src/types/api/getPassphraseState.ts +4 -4
- package/src/types/api/index.ts +10 -20
- package/src/types/api/protocolV2.ts +21 -42
- package/src/types/device.ts +1 -0
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +44 -30
- package/src/utils/deviceFeaturesUtils.ts +52 -11
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -16
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { isNaN } from 'lodash';
|
|
3
3
|
import { EDeviceType, type EFirmwareType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Enum_Capability,
|
|
6
|
+
type DeviceSessionGet,
|
|
7
|
+
type GetPassphraseState,
|
|
8
|
+
} from '@onekeyfe/hd-transport';
|
|
5
9
|
|
|
6
10
|
import { toHardened } from '../api/helpers/pathUtils';
|
|
7
11
|
import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
|
|
@@ -17,9 +21,7 @@ import { existCapability } from './capabilitieUtils';
|
|
|
17
21
|
import type { Device } from '../device/Device';
|
|
18
22
|
import type { Features, IDeviceType, SupportFeatureType } from '../types';
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
// 不再需要手动扩展字段。
|
|
22
|
-
type GetPassphraseStateMessage = GetPassphraseState;
|
|
24
|
+
type DeviceSessionGetMessage = DeviceSessionGet;
|
|
23
25
|
|
|
24
26
|
export const getSupportProtocolV1MessageSchema = (
|
|
25
27
|
features: Features | undefined
|
|
@@ -93,12 +95,17 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
93
95
|
expectPassphraseState?: string;
|
|
94
96
|
onlyMainPin?: boolean;
|
|
95
97
|
allowCreateAttachPin?: boolean;
|
|
98
|
+
initSession?: boolean;
|
|
96
99
|
}
|
|
97
100
|
) => {
|
|
98
101
|
const { features } = device;
|
|
99
102
|
const locked = features?.unlocked === false;
|
|
100
103
|
const deviceType = device.getCurrentDeviceType();
|
|
101
104
|
|
|
105
|
+
if (options?.initSession) {
|
|
106
|
+
device.clearInternalState();
|
|
107
|
+
}
|
|
108
|
+
|
|
102
109
|
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(device, {
|
|
103
110
|
...options,
|
|
104
111
|
});
|
|
@@ -128,14 +135,17 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
128
135
|
passphraseState,
|
|
129
136
|
deviceId,
|
|
130
137
|
newSession,
|
|
131
|
-
device.features?.sessionId
|
|
138
|
+
options?.initSession ? null : device.features?.sessionId
|
|
132
139
|
);
|
|
133
140
|
|
|
134
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
passphraseState,
|
|
143
|
+
newSession,
|
|
144
|
+
unlockedAttachPin: unlockedAttachPin ?? device.features?.unlockedAttachPin,
|
|
145
|
+
};
|
|
135
146
|
};
|
|
136
147
|
|
|
137
148
|
// 仅适用于 Protocol V1 的 Pro:Pro2 走独立版本线,不能套用 4.15.0 门槛
|
|
138
|
-
// (Pro2 在 getPassphraseState 中通过 isProtocolV2 直接判定支持)。
|
|
139
149
|
const supportProSeriesAttachPinPassphrase = (deviceType: IDeviceType, firmwareVersion: string) =>
|
|
140
150
|
deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.15.0');
|
|
141
151
|
|
|
@@ -145,6 +155,7 @@ export const getPassphraseState = async (
|
|
|
145
155
|
expectPassphraseState?: string;
|
|
146
156
|
onlyMainPin?: boolean;
|
|
147
157
|
allowCreateAttachPin?: boolean;
|
|
158
|
+
initSession?: boolean;
|
|
148
159
|
}
|
|
149
160
|
): Promise<{
|
|
150
161
|
passphraseState: string | undefined;
|
|
@@ -160,19 +171,42 @@ export const getPassphraseState = async (
|
|
|
160
171
|
const firmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
161
172
|
const deviceType = device.getCurrentDeviceType();
|
|
162
173
|
|
|
174
|
+
if (device.isProtocolV2()) {
|
|
175
|
+
const payload: DeviceSessionGetMessage = {};
|
|
176
|
+
const cachedSessionId =
|
|
177
|
+
typeof device.getInternalState === 'function' ? device.getInternalState() : undefined;
|
|
178
|
+
if (cachedSessionId) {
|
|
179
|
+
payload.session_id = cachedSessionId;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const { message, type } = await commands.typedCall(
|
|
183
|
+
'DeviceSessionGet',
|
|
184
|
+
'DeviceSession',
|
|
185
|
+
payload
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
// @ts-expect-error
|
|
189
|
+
if (type === 'CallMethodError') {
|
|
190
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
passphraseState: message.btc_test_address,
|
|
195
|
+
newSession: message.session_id,
|
|
196
|
+
unlockedAttachPin: features.unlockedAttachPin ?? undefined,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
163
200
|
const supportAttachPinCapability = existCapability(
|
|
164
201
|
features,
|
|
165
202
|
Enum_Capability.Capability_AttachToPin
|
|
166
203
|
);
|
|
167
|
-
// Pro2 (Protocol V2) 协议自带 GetPassphraseState(10028),固件从首个版本即支持,
|
|
168
|
-
// 不依赖 Pro 系列的 4.15.0 版本线;V2 也没有 GetAddress Testnet 探测这条 legacy 回退路径。
|
|
169
204
|
const supportGetPassphraseState =
|
|
170
|
-
device.isProtocolV2() ||
|
|
171
205
|
supportAttachPinCapability ||
|
|
172
206
|
supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
173
207
|
|
|
174
208
|
if (supportGetPassphraseState) {
|
|
175
|
-
const payload:
|
|
209
|
+
const payload: GetPassphraseState = options?.onlyMainPin
|
|
176
210
|
? { _only_main_pin: true }
|
|
177
211
|
: { passphrase_state: options?.expectPassphraseState };
|
|
178
212
|
if (options?.allowCreateAttachPin) {
|
|
@@ -276,6 +310,9 @@ export const getFirmwareUpdateField = ({
|
|
|
276
310
|
if (deviceType === EDeviceType.Pro) {
|
|
277
311
|
return latestFirmwareField;
|
|
278
312
|
}
|
|
313
|
+
if (deviceType === EDeviceType.Pro2) {
|
|
314
|
+
return 'firmware-v1';
|
|
315
|
+
}
|
|
279
316
|
return 'firmware';
|
|
280
317
|
};
|
|
281
318
|
/**
|
|
@@ -319,6 +356,10 @@ export const getFirmwareUpdateFieldArray = (
|
|
|
319
356
|
return ['firmware-v8'];
|
|
320
357
|
}
|
|
321
358
|
|
|
359
|
+
if (deviceType === 'pro2') {
|
|
360
|
+
return ['firmware-v1'];
|
|
361
|
+
}
|
|
362
|
+
|
|
322
363
|
return ['firmware'];
|
|
323
364
|
};
|
|
324
365
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import type { DeviceRebootParams } from './helpers';
|
|
3
|
-
export default class DevReboot extends BaseMethod<DeviceRebootParams> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("packages/hd-transport/dist").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=DevReboot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DevReboot.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DevReboot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAU,CAAC,kBAAkB,CAAC;IACnE,IAAI;IAWE,GAAG;CAMV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceGetDeviceInfo.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceGetDeviceInfo.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IACrC,KAAK,CAAC,EAAE,wBAAwB,CAAC;CAClC,CAAC;AAmDF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC;IAC1D,OAAO,EAAE,0BAA0B,CAAC;IACpC,KAAK,EAAE,wBAAwB,CAAC;CACjC,CAAC;IACA,IAAI;IAmBE,GAAG;CAgBV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceGetOnboardingStatus.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/DeviceGetOnboardingStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,UAAU;IAC/D,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import type { FactoryDeviceInfoSettingsParams } from './helpers';
|
|
3
|
-
export default class FactoryDeviceInfoSettings extends BaseMethod<FactoryDeviceInfoSettingsParams> {
|
|
4
|
-
init(): void;
|
|
5
|
-
run(): Promise<import("packages/hd-transport/dist").Success>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=FactoryDeviceInfoSettings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryDeviceInfoSettings.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FactoryDeviceInfoSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,UAAU,CAAC,+BAA+B,CAAC;IAChG,IAAI;IAeE,GAAG;CAQV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FactoryGetDeviceInfo.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FactoryGetDeviceInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU;IAC1D,IAAI;IAQE,GAAG;CAQV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilesystemFixPermission.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/FilesystemFixPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU;IAC7D,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetProtoVersion.d.ts","sourceRoot":"","sources":["../../../src/api/protocol-v2/GetProtoVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU;IACrD,IAAI;IAQE,GAAG;CAIV"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
import { normalizeRebootType } from './helpers';
|
|
3
|
-
|
|
4
|
-
import type { DeviceRebootParams } from './helpers';
|
|
5
|
-
|
|
6
|
-
export default class DevReboot extends BaseMethod<DeviceRebootParams> {
|
|
7
|
-
init() {
|
|
8
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
9
|
-
this.requireProtocolV2 = true;
|
|
10
|
-
this.skipForceUpdateCheck = true;
|
|
11
|
-
this.useDevicePassphraseState = false;
|
|
12
|
-
this.params = {
|
|
13
|
-
rebootType: this.payload.rebootType,
|
|
14
|
-
reboot_type: this.payload.reboot_type,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async run() {
|
|
19
|
-
const res = await this.device.commands.typedCall('DevReboot', 'Success', {
|
|
20
|
-
reboot_type: normalizeRebootType(this.params.reboot_type ?? this.params.rebootType),
|
|
21
|
-
});
|
|
22
|
-
return Promise.resolve(res.message);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
|
|
3
|
-
export default class DeviceGetOnboardingStatus extends BaseMethod {
|
|
4
|
-
init() {
|
|
5
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
6
|
-
this.requireProtocolV2 = true;
|
|
7
|
-
this.skipForceUpdateCheck = true;
|
|
8
|
-
this.useDevicePassphraseState = false;
|
|
9
|
-
this.params = undefined;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async run() {
|
|
13
|
-
const res = await this.device.commands.typedCall('GetOnboardingStatus', 'OnboardingStatus', {});
|
|
14
|
-
return Promise.resolve(res.message);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BaseMethod } from '../BaseMethod';
|
|
2
|
-
|
|
3
|
-
import type { FactoryDeviceInfoSettingsParams } from './helpers';
|
|
4
|
-
|
|
5
|
-
export default class FactoryDeviceInfoSettings extends BaseMethod<FactoryDeviceInfoSettingsParams> {
|
|
6
|
-
init() {
|
|
7
|
-
// Protocol V2 (Pro2) 专属方法,core 调度层统一做非 V2 设备守卫
|
|
8
|
-
this.requireProtocolV2 = true;
|
|
9
|
-
this.skipForceUpdateCheck = true;
|
|
10
|
-
this.useDevicePassphraseState = false;
|
|
11
|
-
this.params = {
|
|
12
|
-
serial_no: this.payload.serial_no,
|
|
13
|
-
serialNo: this.payload.serialNo,
|
|
14
|
-
cpu_info: this.payload.cpu_info,
|
|
15
|
-
cpuInfo: this.payload.cpuInfo,
|
|
16
|
-
pre_firmware: this.payload.pre_firmware,
|
|
17
|
-
preFirmware: this.payload.preFirmware,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async run() {
|
|
22
|
-
const res = await this.device.commands.typedCall('FactoryDeviceInfoSettings', 'Success', {
|
|
23
|
-
serial_no: this.params.serial_no ?? this.params.serialNo,
|
|
24
|
-
cpu_info: this.params.cpu_info ?? this.params.cpuInfo,
|
|
25
|
-
pre_firmware: this.params.pre_firmware ?? this.params.preFirmware,
|
|
26
|
-
});
|
|
27
|
-
return Promise.resolve(res.message);
|
|
28
|
-
}
|
|
29
|
-
}
|