@onekeyfe/hd-core 1.1.18-alpha.1 → 1.1.18
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/dist/api/BaseMethod.d.ts +4 -4
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +2 -3
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +2 -2
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +2 -2
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +1 -6
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +3 -6
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/releaseHelper.d.ts +2 -7
- package/dist/api/firmware/releaseHelper.d.ts.map +1 -1
- package/dist/api/firmware/updateBootloader.d.ts +2 -7
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +9 -16
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +21 -43
- package/dist/index.js +75 -200
- package/dist/types/api/checkAllFirmwareRelease.d.ts +1 -3
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBootloaderRelease.d.ts +2 -5
- package/dist/types/api/checkBootloaderRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareRelease.d.ts +2 -6
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceFullyUploadResource.d.ts +1 -6
- package/dist/types/api/deviceFullyUploadResource.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +3 -6
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -3
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/settings.d.ts +0 -3
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +5 -7
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/release.d.ts +1 -1
- package/dist/utils/release.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +7 -17
- package/src/api/CheckAllFirmwareRelease.ts +6 -13
- package/src/api/CheckBootloaderRelease.ts +2 -13
- package/src/api/CheckFirmwareRelease.ts +2 -9
- package/src/api/FirmwareUpdate.ts +5 -7
- package/src/api/FirmwareUpdateV2.ts +14 -26
- package/src/api/FirmwareUpdateV3.ts +18 -29
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +11 -10
- package/src/api/device/DeviceFullyUploadResource.ts +2 -8
- package/src/api/device/DeviceUpdateBootloader.ts +5 -21
- package/src/api/evm/EVMSignTypedData.ts +8 -2
- package/src/api/firmware/getBinary.ts +4 -15
- package/src/api/firmware/releaseHelper.ts +11 -22
- package/src/api/firmware/updateBootloader.ts +9 -17
- package/src/api/sui/SuiSignTransaction.ts +1 -7
- package/src/core/index.ts +1 -3
- package/src/data-manager/DataManager.ts +22 -126
- package/src/types/api/checkAllFirmwareRelease.ts +1 -3
- package/src/types/api/checkBootloaderRelease.ts +3 -7
- package/src/types/api/checkFirmwareRelease.ts +2 -10
- package/src/types/api/deviceFullyUploadResource.ts +1 -7
- package/src/types/api/deviceUpdateBootloader.ts +4 -8
- package/src/types/api/firmwareUpdate.ts +1 -4
- package/src/types/settings.ts +0 -37
- package/src/utils/deviceFeaturesUtils.ts +10 -22
- package/src/utils/release.ts +1 -2
package/dist/index.js
CHANGED
|
@@ -24930,54 +24930,7 @@ const findLatestRelease = (releases) => {
|
|
|
24930
24930
|
};
|
|
24931
24931
|
|
|
24932
24932
|
var _a$1;
|
|
24933
|
-
const FIRMWARE_FIELDS = [
|
|
24934
|
-
'firmware',
|
|
24935
|
-
'firmware-v2',
|
|
24936
|
-
'firmware-v7',
|
|
24937
|
-
'firmware-btc-v7',
|
|
24938
|
-
];
|
|
24939
|
-
const FIRMWARE_FIELD_TYPE_MAP = {
|
|
24940
|
-
firmware: hdShared.EFirmwareType.Universal,
|
|
24941
|
-
'firmware-v2': hdShared.EFirmwareType.Universal,
|
|
24942
|
-
'firmware-v7': hdShared.EFirmwareType.Universal,
|
|
24943
|
-
'firmware-btc-v7': hdShared.EFirmwareType.BitcoinOnly,
|
|
24944
|
-
};
|
|
24945
|
-
function getFirmwareTypeFromField(firmwareField) {
|
|
24946
|
-
const firmwareType = FIRMWARE_FIELD_TYPE_MAP[firmwareField];
|
|
24947
|
-
if (firmwareType === undefined) {
|
|
24948
|
-
return hdShared.EFirmwareType.Universal;
|
|
24949
|
-
}
|
|
24950
|
-
return firmwareType;
|
|
24951
|
-
}
|
|
24952
24933
|
class DataManager {
|
|
24953
|
-
static enrichFirmwareReleaseInfo(deviceData) {
|
|
24954
|
-
if (!deviceData || typeof deviceData !== 'object') {
|
|
24955
|
-
return {
|
|
24956
|
-
firmware: [],
|
|
24957
|
-
ble: [],
|
|
24958
|
-
};
|
|
24959
|
-
}
|
|
24960
|
-
const enrichedData = Object.assign({}, deviceData);
|
|
24961
|
-
FIRMWARE_FIELDS.forEach(field => {
|
|
24962
|
-
const releases = enrichedData[field];
|
|
24963
|
-
if (!releases || !Array.isArray(releases) || releases.length === 0) {
|
|
24964
|
-
return;
|
|
24965
|
-
}
|
|
24966
|
-
try {
|
|
24967
|
-
enrichedData[field] = releases.map(release => {
|
|
24968
|
-
if (!release || typeof release !== 'object' || !!release.firmwareType) {
|
|
24969
|
-
return release;
|
|
24970
|
-
}
|
|
24971
|
-
const firmwareType = getFirmwareTypeFromField(field);
|
|
24972
|
-
return Object.assign(Object.assign({}, release), { firmwareType });
|
|
24973
|
-
});
|
|
24974
|
-
}
|
|
24975
|
-
catch (error) {
|
|
24976
|
-
console.error(`Error enriching firmware field "${field}":`, error);
|
|
24977
|
-
}
|
|
24978
|
-
});
|
|
24979
|
-
return enrichedData;
|
|
24980
|
-
}
|
|
24981
24934
|
static load(settings) {
|
|
24982
24935
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24983
24936
|
this.settings = settings;
|
|
@@ -24992,12 +24945,12 @@ class DataManager {
|
|
|
24992
24945
|
timeout: 7000,
|
|
24993
24946
|
});
|
|
24994
24947
|
this.deviceMap = {
|
|
24995
|
-
[hdShared.EDeviceType.Classic]:
|
|
24996
|
-
[hdShared.EDeviceType.Classic1s]:
|
|
24997
|
-
[hdShared.EDeviceType.ClassicPure]:
|
|
24998
|
-
[hdShared.EDeviceType.Mini]:
|
|
24999
|
-
[hdShared.EDeviceType.Touch]:
|
|
25000
|
-
[hdShared.EDeviceType.Pro]:
|
|
24948
|
+
[hdShared.EDeviceType.Classic]: data.classic,
|
|
24949
|
+
[hdShared.EDeviceType.Classic1s]: data.classic1s,
|
|
24950
|
+
[hdShared.EDeviceType.ClassicPure]: data.classicpure,
|
|
24951
|
+
[hdShared.EDeviceType.Mini]: data.mini,
|
|
24952
|
+
[hdShared.EDeviceType.Touch]: data.touch,
|
|
24953
|
+
[hdShared.EDeviceType.Pro]: data.pro,
|
|
25001
24954
|
};
|
|
25002
24955
|
this.assets = {
|
|
25003
24956
|
bridge: data.bridge,
|
|
@@ -25068,12 +25021,11 @@ DataManager.messages = {
|
|
|
25068
25021
|
v1: MessagesLegacyV1JSON,
|
|
25069
25022
|
};
|
|
25070
25023
|
DataManager.lastCheckTimestamp = 0;
|
|
25071
|
-
DataManager.getFirmwareStatus = (features
|
|
25024
|
+
DataManager.getFirmwareStatus = (features) => {
|
|
25072
25025
|
var _b, _c;
|
|
25073
25026
|
const deviceType = getDeviceType(features);
|
|
25074
25027
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
25075
25028
|
return 'unknown';
|
|
25076
|
-
const deviceFirmwareType = getFirmwareType(features);
|
|
25077
25029
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
25078
25030
|
if (features.firmware_present === false) {
|
|
25079
25031
|
return 'none';
|
|
@@ -25081,19 +25033,12 @@ DataManager.getFirmwareStatus = (features, firmwareType) => {
|
|
|
25081
25033
|
if (DeviceModelToTypes.model_mini.includes(deviceType) && features.bootloader_mode) {
|
|
25082
25034
|
return 'unknown';
|
|
25083
25035
|
}
|
|
25084
|
-
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25085
|
-
features,
|
|
25086
|
-
updateType: 'firmware',
|
|
25087
|
-
firmwareType,
|
|
25088
|
-
});
|
|
25036
|
+
const firmwareUpdateField = getFirmwareUpdateField({ features, updateType: 'firmware' });
|
|
25089
25037
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25090
|
-
|
|
25091
|
-
if (targetDeviceConfigList.length > 0 && deviceFirmwareType !== firmwareType) {
|
|
25092
|
-
currentVersion = '0.0.0';
|
|
25093
|
-
}
|
|
25038
|
+
const currentVersion = deviceFirmwareVersion.join('.');
|
|
25094
25039
|
return getReleaseStatus(targetDeviceConfigList, currentVersion);
|
|
25095
25040
|
};
|
|
25096
|
-
DataManager.getSysResourcesLatestRelease = (
|
|
25041
|
+
DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
|
|
25097
25042
|
var _b, _c, _d;
|
|
25098
25043
|
const deviceType = getDeviceType(features);
|
|
25099
25044
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
@@ -25102,7 +25047,6 @@ DataManager.getSysResourcesLatestRelease = ({ features, forcedUpdateRes, firmwar
|
|
|
25102
25047
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25103
25048
|
features,
|
|
25104
25049
|
updateType: 'firmware',
|
|
25105
|
-
firmwareType,
|
|
25106
25050
|
});
|
|
25107
25051
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25108
25052
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
@@ -25111,7 +25055,7 @@ DataManager.getSysResourcesLatestRelease = ({ features, forcedUpdateRes, firmwar
|
|
|
25111
25055
|
: semver__default["default"].gt(item.version.join('.'), currentVersion) && !!item.resource);
|
|
25112
25056
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.resource;
|
|
25113
25057
|
};
|
|
25114
|
-
DataManager.getSysFullResource = (features
|
|
25058
|
+
DataManager.getSysFullResource = (features) => {
|
|
25115
25059
|
var _b, _c, _d;
|
|
25116
25060
|
const deviceType = getDeviceType(features);
|
|
25117
25061
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25121,13 +25065,12 @@ DataManager.getSysFullResource = (features, firmwareType) => {
|
|
|
25121
25065
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25122
25066
|
features,
|
|
25123
25067
|
updateType: 'firmware',
|
|
25124
|
-
firmwareType,
|
|
25125
25068
|
});
|
|
25126
25069
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25127
25070
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
|
|
25128
25071
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
|
|
25129
25072
|
};
|
|
25130
|
-
DataManager.getBootloaderResource = (features
|
|
25073
|
+
DataManager.getBootloaderResource = (features) => {
|
|
25131
25074
|
var _b, _c, _d;
|
|
25132
25075
|
const deviceType = getDeviceType(features);
|
|
25133
25076
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25137,7 +25080,6 @@ DataManager.getBootloaderResource = (features, firmwareType) => {
|
|
|
25137
25080
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25138
25081
|
features,
|
|
25139
25082
|
updateType: 'firmware',
|
|
25140
|
-
firmwareType,
|
|
25141
25083
|
});
|
|
25142
25084
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25143
25085
|
if (targetDeviceConfigList.length === 0) {
|
|
@@ -25146,7 +25088,7 @@ DataManager.getBootloaderResource = (features, firmwareType) => {
|
|
|
25146
25088
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
|
|
25147
25089
|
return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.bootloaderResource;
|
|
25148
25090
|
};
|
|
25149
|
-
DataManager.getBootloaderTargetVersion = (features
|
|
25091
|
+
DataManager.getBootloaderTargetVersion = (features) => {
|
|
25150
25092
|
var _b, _c, _d, _e;
|
|
25151
25093
|
const deviceType = getDeviceType(features);
|
|
25152
25094
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25154,13 +25096,12 @@ DataManager.getBootloaderTargetVersion = (features, firmwareType) => {
|
|
|
25154
25096
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25155
25097
|
features,
|
|
25156
25098
|
updateType: 'firmware',
|
|
25157
|
-
firmwareType,
|
|
25158
25099
|
});
|
|
25159
25100
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25160
25101
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
|
|
25161
25102
|
return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderVersion) !== null && _e !== void 0 ? _e : undefined;
|
|
25162
25103
|
};
|
|
25163
|
-
DataManager.getBootloaderRelatedFirmwareVersion = (features
|
|
25104
|
+
DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
|
|
25164
25105
|
var _b, _c, _d, _e;
|
|
25165
25106
|
const deviceType = getDeviceType(features);
|
|
25166
25107
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25170,13 +25111,12 @@ DataManager.getBootloaderRelatedFirmwareVersion = (features, firmwareType) => {
|
|
|
25170
25111
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25171
25112
|
features,
|
|
25172
25113
|
updateType: 'firmware',
|
|
25173
|
-
firmwareType,
|
|
25174
25114
|
});
|
|
25175
25115
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25176
25116
|
const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderRelatedFirmwareVersion);
|
|
25177
25117
|
return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderRelatedFirmwareVersion) !== null && _e !== void 0 ? _e : undefined;
|
|
25178
25118
|
};
|
|
25179
|
-
DataManager.getFirmwareChangelog = (features
|
|
25119
|
+
DataManager.getFirmwareChangelog = (features) => {
|
|
25180
25120
|
var _b, _c;
|
|
25181
25121
|
const deviceType = getDeviceType(features);
|
|
25182
25122
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25185,7 +25125,6 @@ DataManager.getFirmwareChangelog = (features, firmwareType) => {
|
|
|
25185
25125
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25186
25126
|
features,
|
|
25187
25127
|
updateType: 'firmware',
|
|
25188
|
-
firmwareType,
|
|
25189
25128
|
});
|
|
25190
25129
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25191
25130
|
if (features.firmware_present === false ||
|
|
@@ -25195,7 +25134,7 @@ DataManager.getFirmwareChangelog = (features, firmwareType) => {
|
|
|
25195
25134
|
const currentVersion = deviceFirmwareVersion.join('.');
|
|
25196
25135
|
return getReleaseChangelog(targetDeviceConfigList, currentVersion);
|
|
25197
25136
|
};
|
|
25198
|
-
DataManager.getFirmwareLatestRelease = (features
|
|
25137
|
+
DataManager.getFirmwareLatestRelease = (features) => {
|
|
25199
25138
|
var _b, _c;
|
|
25200
25139
|
const deviceType = getDeviceType(features);
|
|
25201
25140
|
if (deviceType === hdShared.EDeviceType.Unknown)
|
|
@@ -25203,14 +25142,13 @@ DataManager.getFirmwareLatestRelease = (features, firmwareType) => {
|
|
|
25203
25142
|
const firmwareUpdateField = getFirmwareUpdateField({
|
|
25204
25143
|
features,
|
|
25205
25144
|
updateType: 'firmware',
|
|
25206
|
-
firmwareType,
|
|
25207
25145
|
});
|
|
25208
25146
|
const targetDeviceConfigList = (_c = (_b = _a$1.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
|
|
25209
25147
|
const target = findLatestRelease(targetDeviceConfigList);
|
|
25210
25148
|
if (!target)
|
|
25211
25149
|
return target;
|
|
25212
25150
|
if (!target.resource) {
|
|
25213
|
-
const resource = _a$1.getSysResourcesLatestRelease(
|
|
25151
|
+
const resource = _a$1.getSysResourcesLatestRelease(features);
|
|
25214
25152
|
return Object.assign(Object.assign({}, target), { resource });
|
|
25215
25153
|
}
|
|
25216
25154
|
return target;
|
|
@@ -25409,35 +25347,28 @@ const supportModifyHomescreen = (features) => {
|
|
|
25409
25347
|
}
|
|
25410
25348
|
return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
|
|
25411
25349
|
};
|
|
25412
|
-
const
|
|
25413
|
-
if (firmwareType === 'bitcoinonly') {
|
|
25414
|
-
return `firmware-btc-v7`;
|
|
25415
|
-
}
|
|
25416
|
-
return `firmware-v7`;
|
|
25417
|
-
};
|
|
25418
|
-
const getFirmwareUpdateField = ({ features, updateType, targetVersion, firmwareType, }) => {
|
|
25350
|
+
const getFirmwareUpdateField = ({ features, updateType, targetVersion, }) => {
|
|
25419
25351
|
const deviceType = getDeviceType(features);
|
|
25420
25352
|
const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
|
|
25421
25353
|
if (updateType === 'ble') {
|
|
25422
25354
|
return 'ble';
|
|
25423
25355
|
}
|
|
25424
|
-
const latestFirmwareField = getLatestFirmwareField(firmwareType);
|
|
25425
25356
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
25426
|
-
return
|
|
25357
|
+
return 'firmware-v7';
|
|
25427
25358
|
}
|
|
25428
25359
|
if (deviceType === hdShared.EDeviceType.Touch) {
|
|
25429
25360
|
if (targetVersion) {
|
|
25430
25361
|
if (semver__default["default"].eq(targetVersion, '4.0.0'))
|
|
25431
25362
|
return 'firmware-v2';
|
|
25432
25363
|
if (semver__default["default"].gt(targetVersion, '4.0.0'))
|
|
25433
|
-
return
|
|
25364
|
+
return 'firmware-v7';
|
|
25434
25365
|
}
|
|
25435
25366
|
if (semver__default["default"].lt(deviceFirmwareVersion.join('.'), '3.4.0'))
|
|
25436
25367
|
return 'firmware';
|
|
25437
|
-
return
|
|
25368
|
+
return 'firmware-v7';
|
|
25438
25369
|
}
|
|
25439
25370
|
if (deviceType === hdShared.EDeviceType.Pro) {
|
|
25440
|
-
return
|
|
25371
|
+
return 'firmware-v7';
|
|
25441
25372
|
}
|
|
25442
25373
|
return 'firmware';
|
|
25443
25374
|
};
|
|
@@ -25619,20 +25550,20 @@ function isEnteredManuallyBoot(features, updateType) {
|
|
|
25619
25550
|
return isMini || isBoot183ClassicUpBle;
|
|
25620
25551
|
}
|
|
25621
25552
|
|
|
25622
|
-
function checkNeedUpdateBootForTouch(features
|
|
25553
|
+
function checkNeedUpdateBootForTouch(features) {
|
|
25623
25554
|
const deviceType = getDeviceType(features);
|
|
25624
25555
|
if (!DeviceModelToTypes.model_touch.includes(deviceType))
|
|
25625
25556
|
return false;
|
|
25626
25557
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
25627
25558
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
25628
|
-
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features
|
|
25559
|
+
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
|
|
25629
25560
|
if (!targetBootloaderVersion)
|
|
25630
25561
|
return false;
|
|
25631
25562
|
return (semver__default["default"].gte(currentVersion, '3.2.0') &&
|
|
25632
25563
|
semver__default["default"].gte(currentVersion, '4.1.0') &&
|
|
25633
25564
|
semver__default["default"].lte(bootloaderVersion, targetBootloaderVersion.join('.')));
|
|
25634
25565
|
}
|
|
25635
|
-
function checkNeedUpdateBootForClassicAndMini(
|
|
25566
|
+
function checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmware) {
|
|
25636
25567
|
const deviceType = getDeviceType(features);
|
|
25637
25568
|
if (!DeviceModelToTypes.model_mini.includes(deviceType))
|
|
25638
25569
|
return false;
|
|
@@ -25640,11 +25571,11 @@ function checkNeedUpdateBootForClassicAndMini({ features, willUpdateFirmware, fi
|
|
|
25640
25571
|
return false;
|
|
25641
25572
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
25642
25573
|
const bootloaderVersion = getDeviceBootloaderVersion(features).join('.');
|
|
25643
|
-
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features
|
|
25574
|
+
const targetBootloaderVersion = DataManager.getBootloaderTargetVersion(features);
|
|
25644
25575
|
if (targetBootloaderVersion && semver__default["default"].gte(bootloaderVersion, targetBootloaderVersion.join('.'))) {
|
|
25645
25576
|
return false;
|
|
25646
25577
|
}
|
|
25647
|
-
const bootloaderRelatedFirmwareVersion = DataManager.getBootloaderRelatedFirmwareVersion(features
|
|
25578
|
+
const bootloaderRelatedFirmwareVersion = DataManager.getBootloaderRelatedFirmwareVersion(features);
|
|
25648
25579
|
if (!bootloaderRelatedFirmwareVersion)
|
|
25649
25580
|
return false;
|
|
25650
25581
|
return shouldUpdateBootloaderForClassicAndMini({
|
|
@@ -27514,10 +27445,10 @@ class DeviceList extends events.exports {
|
|
|
27514
27445
|
}
|
|
27515
27446
|
}
|
|
27516
27447
|
|
|
27517
|
-
const getFirmwareReleaseInfo = (features
|
|
27518
|
-
const firmwareStatus = DataManager.getFirmwareStatus(features
|
|
27519
|
-
const changelog = DataManager.getFirmwareChangelog(features
|
|
27520
|
-
const release = DataManager.getFirmwareLatestRelease(features
|
|
27448
|
+
const getFirmwareReleaseInfo = (features) => {
|
|
27449
|
+
const firmwareStatus = DataManager.getFirmwareStatus(features);
|
|
27450
|
+
const changelog = DataManager.getFirmwareChangelog(features);
|
|
27451
|
+
const release = DataManager.getFirmwareLatestRelease(features);
|
|
27521
27452
|
const bootloaderMode = !!features.bootloader_mode;
|
|
27522
27453
|
return {
|
|
27523
27454
|
status: firmwareStatus,
|
|
@@ -27538,8 +27469,8 @@ const getBleFirmwareReleaseInfo = (features) => {
|
|
|
27538
27469
|
bootloaderMode,
|
|
27539
27470
|
};
|
|
27540
27471
|
};
|
|
27541
|
-
const getBootloaderReleaseInfo = (
|
|
27542
|
-
const release = DataManager.getFirmwareLatestRelease(features
|
|
27472
|
+
const getBootloaderReleaseInfo = (features, willUpdateFirmwareVersion) => {
|
|
27473
|
+
const release = DataManager.getFirmwareLatestRelease(features);
|
|
27543
27474
|
const changelog = [release === null || release === void 0 ? void 0 : release.bootloaderChangelog].filter(item => item != null &&
|
|
27544
27475
|
typeof item === 'object' &&
|
|
27545
27476
|
Object.prototype.hasOwnProperty.call(item, 'zh-CN') &&
|
|
@@ -27548,14 +27479,10 @@ const getBootloaderReleaseInfo = ({ features, willUpdateFirmwareVersion, firmwar
|
|
|
27548
27479
|
let shouldUpdate = false;
|
|
27549
27480
|
const deviceType = getDeviceType(features);
|
|
27550
27481
|
if (DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
27551
|
-
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(
|
|
27552
|
-
features,
|
|
27553
|
-
willUpdateFirmware: willUpdateFirmwareVersion,
|
|
27554
|
-
firmwareType,
|
|
27555
|
-
});
|
|
27482
|
+
shouldUpdate = !!checkNeedUpdateBootForClassicAndMini(features, willUpdateFirmwareVersion);
|
|
27556
27483
|
}
|
|
27557
27484
|
else if (DeviceModelToTypes.model_touch.includes(deviceType)) {
|
|
27558
|
-
shouldUpdate = checkNeedUpdateBootForTouch(features
|
|
27485
|
+
shouldUpdate = checkNeedUpdateBootForTouch(features);
|
|
27559
27486
|
}
|
|
27560
27487
|
return {
|
|
27561
27488
|
status: shouldUpdate ? 'outdated' : 'valid',
|
|
@@ -27599,8 +27526,7 @@ class BaseMethod {
|
|
|
27599
27526
|
checkFirmwareRelease() {
|
|
27600
27527
|
if (!this.device || !this.device.features)
|
|
27601
27528
|
return;
|
|
27602
|
-
const
|
|
27603
|
-
const releaseInfo = getFirmwareReleaseInfo(this.device.features, firmwareType);
|
|
27529
|
+
const releaseInfo = getFirmwareReleaseInfo(this.device.features);
|
|
27604
27530
|
this.postMessage(createFirmwareMessage(FIRMWARE.RELEASE_INFO, Object.assign(Object.assign({}, releaseInfo), { device: this.device.toMessageObject() })));
|
|
27605
27531
|
const bleReleaseInfo = getBleFirmwareReleaseInfo(this.device.features);
|
|
27606
27532
|
this.postMessage(createFirmwareMessage(FIRMWARE.BLE_RELEASE_INFO, Object.assign(Object.assign({}, bleReleaseInfo), { device: this.device.toMessageObject() })));
|
|
@@ -27800,12 +27726,8 @@ class CheckFirmwareRelease extends BaseMethod {
|
|
|
27800
27726
|
this.skipForceUpdateCheck = true;
|
|
27801
27727
|
}
|
|
27802
27728
|
run() {
|
|
27803
|
-
var _a;
|
|
27804
|
-
const payload = this.payload;
|
|
27805
27729
|
if (this.device.features) {
|
|
27806
|
-
const
|
|
27807
|
-
const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
27808
|
-
const releaseInfo = getFirmwareReleaseInfo(this.device.features, firmwareType);
|
|
27730
|
+
const releaseInfo = getFirmwareReleaseInfo(this.device.features);
|
|
27809
27731
|
return Promise.resolve(releaseInfo);
|
|
27810
27732
|
}
|
|
27811
27733
|
return Promise.resolve(null);
|
|
@@ -27946,20 +27868,12 @@ class CheckBootloaderRelease extends BaseMethod {
|
|
|
27946
27868
|
this.skipForceUpdateCheck = true;
|
|
27947
27869
|
}
|
|
27948
27870
|
run() {
|
|
27949
|
-
var _a;
|
|
27950
27871
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27951
27872
|
if (!this.device.features) {
|
|
27952
27873
|
return null;
|
|
27953
27874
|
}
|
|
27954
27875
|
const { features } = this.device;
|
|
27955
|
-
const
|
|
27956
|
-
const deviceFirmwareType = getFirmwareType(features);
|
|
27957
|
-
const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
27958
|
-
const releaseInfo = getBootloaderReleaseInfo({
|
|
27959
|
-
features,
|
|
27960
|
-
willUpdateFirmwareVersion: payload.willUpdateFirmwareVersion,
|
|
27961
|
-
firmwareType,
|
|
27962
|
-
});
|
|
27876
|
+
const releaseInfo = getBootloaderReleaseInfo(features, this.payload.willUpdateFirmwareVersion);
|
|
27963
27877
|
return Promise.resolve(releaseInfo);
|
|
27964
27878
|
});
|
|
27965
27879
|
}
|
|
@@ -27975,14 +27889,11 @@ class CheckAllFirmwareRelease extends BaseMethod {
|
|
|
27975
27889
|
var _a, _b;
|
|
27976
27890
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27977
27891
|
const { features } = this.device;
|
|
27978
|
-
const { checkBridgeRelease
|
|
27979
|
-
.payload;
|
|
27892
|
+
const { checkBridgeRelease } = this.payload;
|
|
27980
27893
|
if (!features) {
|
|
27981
27894
|
return Promise.resolve(null);
|
|
27982
27895
|
}
|
|
27983
|
-
const
|
|
27984
|
-
const firmwareType = firmwareTypeParams !== null && firmwareTypeParams !== void 0 ? firmwareTypeParams : deviceFirmwareType;
|
|
27985
|
-
const firmwareRelease = getFirmwareReleaseInfo(features, firmwareType);
|
|
27896
|
+
const firmwareRelease = getFirmwareReleaseInfo(features);
|
|
27986
27897
|
const currentFirmwareVersion = getDeviceFirmwareVersion(features).join('.');
|
|
27987
27898
|
const willUpdateFirmwareVersion = (_b = (_a = firmwareRelease.release) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b.join('.');
|
|
27988
27899
|
const deviceType = getDeviceType(features);
|
|
@@ -27995,11 +27906,7 @@ class CheckAllFirmwareRelease extends BaseMethod {
|
|
|
27995
27906
|
willUpdateFirmwareVersion,
|
|
27996
27907
|
});
|
|
27997
27908
|
}
|
|
27998
|
-
const bootloaderRelease = getBootloaderReleaseInfo(
|
|
27999
|
-
features,
|
|
28000
|
-
willUpdateFirmwareVersion,
|
|
28001
|
-
firmwareType,
|
|
28002
|
-
});
|
|
27909
|
+
const bootloaderRelease = getBootloaderReleaseInfo(features, willUpdateFirmwareVersion);
|
|
28003
27910
|
const bleFirmwareReleaseInfo = getBleFirmwareReleaseInfo(features);
|
|
28004
27911
|
return {
|
|
28005
27912
|
firmware: firmwareRelease,
|
|
@@ -28645,13 +28552,8 @@ class DeviceWipe extends BaseMethod {
|
|
|
28645
28552
|
}
|
|
28646
28553
|
}
|
|
28647
28554
|
|
|
28648
|
-
const getBinary = ({ features, updateType, version, isUpdateBootloader,
|
|
28649
|
-
const releaseInfo = getInfo({
|
|
28650
|
-
features,
|
|
28651
|
-
updateType,
|
|
28652
|
-
targetVersion: version === null || version === void 0 ? void 0 : version.join('.'),
|
|
28653
|
-
firmwareType,
|
|
28654
|
-
});
|
|
28555
|
+
const getBinary = ({ features, updateType, version, isUpdateBootloader, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28556
|
+
const releaseInfo = getInfo({ features, updateType, targetVersion: version === null || version === void 0 ? void 0 : version.join('.') });
|
|
28655
28557
|
if (!releaseInfo) {
|
|
28656
28558
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'no firmware found for this device');
|
|
28657
28559
|
}
|
|
@@ -28688,7 +28590,7 @@ const getSysResourceBinary = (url) => __awaiter(void 0, void 0, void 0, function
|
|
|
28688
28590
|
binary: fw,
|
|
28689
28591
|
};
|
|
28690
28592
|
});
|
|
28691
|
-
const getInfo = ({ features, updateType, targetVersion
|
|
28593
|
+
const getInfo = ({ features, updateType, targetVersion }) => {
|
|
28692
28594
|
var _a, _b;
|
|
28693
28595
|
const deviceType = getDeviceType(features);
|
|
28694
28596
|
if (deviceType === 'unknown') {
|
|
@@ -28699,7 +28601,6 @@ const getInfo = ({ features, updateType, targetVersion, firmwareType }) => {
|
|
|
28699
28601
|
features,
|
|
28700
28602
|
updateType,
|
|
28701
28603
|
targetVersion,
|
|
28702
|
-
firmwareType,
|
|
28703
28604
|
});
|
|
28704
28605
|
const releaseInfo = (_b = (_a = deviceMap === null || deviceMap === void 0 ? void 0 : deviceMap[deviceType]) === null || _a === void 0 ? void 0 : _a[firmwareUpdateField]) !== null && _b !== void 0 ? _b : [];
|
|
28705
28606
|
return findLatestRelease(releaseInfo);
|
|
@@ -29042,19 +28943,15 @@ class DeviceFullyUploadResource extends BaseMethod {
|
|
|
29042
28943
|
return isTouchMode && semver__default["default"].gte(currentVersion, '3.4.0');
|
|
29043
28944
|
}
|
|
29044
28945
|
run() {
|
|
29045
|
-
var _a;
|
|
29046
28946
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29047
28947
|
const { device } = this;
|
|
29048
28948
|
const { features } = device;
|
|
29049
|
-
const payload = this.payload;
|
|
29050
|
-
const deviceFirmwareType = getFirmwareType(features);
|
|
29051
|
-
const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
29052
28949
|
if (!(features === null || features === void 0 ? void 0 : features.bootloader_mode) && features) {
|
|
29053
28950
|
if (features) {
|
|
29054
28951
|
let { binary } = this.payload;
|
|
29055
28952
|
if (!binary) {
|
|
29056
28953
|
this.postTipMessage('CheckLatestUiResource');
|
|
29057
|
-
const resourceUrl = DataManager.getSysFullResource(features
|
|
28954
|
+
const resourceUrl = DataManager.getSysFullResource(features);
|
|
29058
28955
|
if (resourceUrl) {
|
|
29059
28956
|
this.postTipMessage('DownloadLatestUiResource');
|
|
29060
28957
|
const resource = yield getSysResourceBinary(resourceUrl);
|
|
@@ -29418,14 +29315,12 @@ class DeviceUpdateBootloader extends FirmwareUpdateBaseMethod {
|
|
|
29418
29315
|
return true;
|
|
29419
29316
|
});
|
|
29420
29317
|
}
|
|
29421
|
-
updateTouchBootloader(
|
|
29318
|
+
updateTouchBootloader(device, features) {
|
|
29422
29319
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29423
29320
|
let { binary } = this.payload;
|
|
29424
29321
|
if (!binary) {
|
|
29425
29322
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.CheckLatestUiResource);
|
|
29426
|
-
const resourceUrl = features
|
|
29427
|
-
? DataManager.getBootloaderResource(features, firmwareType)
|
|
29428
|
-
: null;
|
|
29323
|
+
const resourceUrl = features ? DataManager.getBootloaderResource(features) : null;
|
|
29429
29324
|
if (resourceUrl) {
|
|
29430
29325
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.DownloadLatestBootloaderResource);
|
|
29431
29326
|
const resource = yield getSysResourceBinary(resourceUrl);
|
|
@@ -29449,16 +29344,12 @@ class DeviceUpdateBootloader extends FirmwareUpdateBaseMethod {
|
|
|
29449
29344
|
});
|
|
29450
29345
|
}
|
|
29451
29346
|
run() {
|
|
29452
|
-
var _a;
|
|
29453
29347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29454
29348
|
const { device } = this;
|
|
29455
29349
|
const { features } = device;
|
|
29456
|
-
const payload = this.payload;
|
|
29457
29350
|
const deviceType = getDeviceType(features);
|
|
29458
|
-
const deviceFirmwareType = getFirmwareType(features);
|
|
29459
|
-
const firmwareType = (_a = payload.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
29460
29351
|
if (DeviceModelToTypes.model_touch.includes(deviceType)) {
|
|
29461
|
-
return this.updateTouchBootloader(
|
|
29352
|
+
return this.updateTouchBootloader(device, features);
|
|
29462
29353
|
}
|
|
29463
29354
|
return Promise.resolve(true);
|
|
29464
29355
|
});
|
|
@@ -29650,7 +29541,6 @@ class FirmwareUpdate extends BaseMethod {
|
|
|
29650
29541
|
features: device.features,
|
|
29651
29542
|
version: params.version,
|
|
29652
29543
|
updateType: params.updateType,
|
|
29653
|
-
firmwareType: hdShared.EFirmwareType.Universal,
|
|
29654
29544
|
});
|
|
29655
29545
|
binary = firmware.binary;
|
|
29656
29546
|
this.postTipMessage('DownloadFirmwareSuccess');
|
|
@@ -29694,7 +29584,6 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29694
29584
|
{ name: 'binary', type: 'buffer' },
|
|
29695
29585
|
{ name: 'forcedUpdateRes', type: 'boolean' },
|
|
29696
29586
|
{ name: 'platform', type: 'string', required: true },
|
|
29697
|
-
{ name: 'firmwareType', type: 'string' },
|
|
29698
29587
|
]);
|
|
29699
29588
|
if (!payload.updateType) {
|
|
29700
29589
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'updateType is required');
|
|
@@ -29705,7 +29594,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29705
29594
|
isUpdateBootloader: payload.isUpdateBootloader,
|
|
29706
29595
|
};
|
|
29707
29596
|
if ('version' in payload) {
|
|
29708
|
-
this.params = Object.assign(Object.assign({}, this.params), { version: payload.version
|
|
29597
|
+
this.params = Object.assign(Object.assign({}, this.params), { version: payload.version });
|
|
29709
29598
|
}
|
|
29710
29599
|
if ('binary' in payload) {
|
|
29711
29600
|
this.params = Object.assign(Object.assign({}, this.params), { binary: payload.binary });
|
|
@@ -29826,7 +29715,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29826
29715
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
29827
29716
|
return isTouchMode && semver__default["default"].gte(currentVersion, '3.2.0');
|
|
29828
29717
|
}
|
|
29829
|
-
checkVersionForCopyTouchResource(features
|
|
29718
|
+
checkVersionForCopyTouchResource(features) {
|
|
29830
29719
|
var _a;
|
|
29831
29720
|
if (!features)
|
|
29832
29721
|
return;
|
|
@@ -29834,7 +29723,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29834
29723
|
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
29835
29724
|
const targetVersion = (_a = this.params.version) === null || _a === void 0 ? void 0 : _a.join('.');
|
|
29836
29725
|
const { updateType } = this.params;
|
|
29837
|
-
const releaseInfo = getInfo({ features, updateType
|
|
29726
|
+
const releaseInfo = getInfo({ features, updateType });
|
|
29838
29727
|
if (!releaseInfo)
|
|
29839
29728
|
return;
|
|
29840
29729
|
const { fullResourceRange } = releaseInfo;
|
|
@@ -29850,14 +29739,12 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29850
29739
|
}
|
|
29851
29740
|
}
|
|
29852
29741
|
run() {
|
|
29853
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
29742
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
29854
29743
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29855
29744
|
const { device, params } = this;
|
|
29856
29745
|
const { features, commands } = device;
|
|
29857
29746
|
const deviceType = getDeviceType(features);
|
|
29858
|
-
|
|
29859
|
-
const firmwareType = (_a = params.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
29860
|
-
this.checkVersionForCopyTouchResource(features, firmwareType);
|
|
29747
|
+
this.checkVersionForCopyTouchResource(features);
|
|
29861
29748
|
if (!(features === null || features === void 0 ? void 0 : features.bootloader_mode) && features) {
|
|
29862
29749
|
const uuid = getDeviceUUID(features);
|
|
29863
29750
|
if (this.isEnteredManuallyBoot(features)) {
|
|
@@ -29865,11 +29752,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29865
29752
|
}
|
|
29866
29753
|
if (features && this.isSupportResourceUpdate(features, params.updateType)) {
|
|
29867
29754
|
this.postTipMessage('CheckLatestUiResource');
|
|
29868
|
-
const resourceUrl = DataManager.getSysResourcesLatestRelease(
|
|
29869
|
-
features,
|
|
29870
|
-
forcedUpdateRes: params.forcedUpdateRes,
|
|
29871
|
-
firmwareType,
|
|
29872
|
-
});
|
|
29755
|
+
const resourceUrl = DataManager.getSysResourcesLatestRelease(features, params.forcedUpdateRes);
|
|
29873
29756
|
if (resourceUrl) {
|
|
29874
29757
|
this.postTipMessage('DownloadLatestUiResource');
|
|
29875
29758
|
const resource = yield getSysResourceBinary(resourceUrl);
|
|
@@ -29879,7 +29762,7 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29879
29762
|
}
|
|
29880
29763
|
}
|
|
29881
29764
|
}
|
|
29882
|
-
(
|
|
29765
|
+
(_b = (_a = this.device) === null || _a === void 0 ? void 0 : _a.commands) === null || _b === void 0 ? void 0 : _b.checkDisposed();
|
|
29883
29766
|
try {
|
|
29884
29767
|
this.postTipMessage('AutoRebootToBootloader');
|
|
29885
29768
|
const bootRes = yield commands.typedCall('DeviceBackToBoot', 'Success');
|
|
@@ -29892,9 +29775,9 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29892
29775
|
DevicePool.clearDeviceCache(uuid);
|
|
29893
29776
|
}
|
|
29894
29777
|
delete DevicePool.devicesCache[''];
|
|
29895
|
-
yield ((
|
|
29778
|
+
yield ((_c = this.checkPromise) === null || _c === void 0 ? void 0 : _c.promise);
|
|
29896
29779
|
this.checkPromise = null;
|
|
29897
|
-
(
|
|
29780
|
+
(_e = (_d = this.device) === null || _d === void 0 ? void 0 : _d.commands) === null || _e === void 0 ? void 0 : _e.checkDisposed();
|
|
29898
29781
|
const isTouch = DeviceModelToTypes.model_touch.includes(deviceType);
|
|
29899
29782
|
yield wait(isTouch ? 3000 : 1500);
|
|
29900
29783
|
}
|
|
@@ -29921,16 +29804,15 @@ class FirmwareUpdateV2 extends BaseMethod {
|
|
|
29921
29804
|
version: params.version,
|
|
29922
29805
|
updateType: params.updateType,
|
|
29923
29806
|
isUpdateBootloader: params.isUpdateBootloader,
|
|
29924
|
-
firmwareType,
|
|
29925
29807
|
});
|
|
29926
29808
|
binary = firmware.binary;
|
|
29927
29809
|
this.postTipMessage('DownloadFirmwareSuccess');
|
|
29928
29810
|
}
|
|
29929
29811
|
}
|
|
29930
29812
|
catch (err) {
|
|
29931
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (
|
|
29813
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_f = err.message) !== null && _f !== void 0 ? _f : err);
|
|
29932
29814
|
}
|
|
29933
|
-
(
|
|
29815
|
+
(_h = (_g = this.device) === null || _g === void 0 ? void 0 : _g.commands) === null || _h === void 0 ? void 0 : _h.checkDisposed();
|
|
29934
29816
|
yield this.device.acquire();
|
|
29935
29817
|
const response = yield uploadFirmware(params.updateType, this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: binary, rebootOnSuccess: true });
|
|
29936
29818
|
if (this.connectId) {
|
|
@@ -29963,7 +29845,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
29963
29845
|
{ name: 'forcedUpdateRes', type: 'boolean' },
|
|
29964
29846
|
{ name: 'bootloaderVersion', type: 'array' },
|
|
29965
29847
|
{ name: 'bootloaderBinary', type: 'buffer' },
|
|
29966
|
-
{ name: 'firmwareType', type: 'string' },
|
|
29967
29848
|
{ name: 'platform', type: 'string' },
|
|
29968
29849
|
]);
|
|
29969
29850
|
this.params = {
|
|
@@ -29975,12 +29856,11 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
29975
29856
|
bootloaderBinary: payload.bootloaderBinary,
|
|
29976
29857
|
firmwareVersion: payload.firmwareVersion,
|
|
29977
29858
|
resourceBinary: payload.resourceBinary,
|
|
29978
|
-
firmwareType: payload.firmwareType,
|
|
29979
29859
|
platform: payload.platform,
|
|
29980
29860
|
};
|
|
29981
29861
|
}
|
|
29982
29862
|
run() {
|
|
29983
|
-
var _a
|
|
29863
|
+
var _a;
|
|
29984
29864
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29985
29865
|
const { device } = this;
|
|
29986
29866
|
const { features } = device;
|
|
@@ -29990,20 +29870,18 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
29990
29870
|
if (!features) {
|
|
29991
29871
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device features not available');
|
|
29992
29872
|
}
|
|
29993
|
-
const deviceFirmwareType = getFirmwareType(features);
|
|
29994
|
-
const firmwareType = (_a = this.params.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
29995
29873
|
let resourceBinary = null;
|
|
29996
29874
|
let fwBinaryMap = [];
|
|
29997
29875
|
let bootloaderBinary = null;
|
|
29998
29876
|
try {
|
|
29999
29877
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.StartDownloadFirmware);
|
|
30000
|
-
resourceBinary = yield this.prepareResourceBinary(
|
|
30001
|
-
fwBinaryMap = yield this.prepareFirmwareAndBleBinary(
|
|
30002
|
-
bootloaderBinary = yield this.prepareBootloaderBinary(
|
|
29878
|
+
resourceBinary = yield this.prepareResourceBinary();
|
|
29879
|
+
fwBinaryMap = yield this.prepareFirmwareAndBleBinary();
|
|
29880
|
+
bootloaderBinary = yield this.prepareBootloaderBinary();
|
|
30003
29881
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
|
|
30004
29882
|
}
|
|
30005
29883
|
catch (err) {
|
|
30006
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (
|
|
29884
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_a = err.message) !== null && _a !== void 0 ? _a : err);
|
|
30007
29885
|
}
|
|
30008
29886
|
if (!bootloaderBinary && fwBinaryMap.length === 0) {
|
|
30009
29887
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, 'No firmware to update');
|
|
@@ -30028,7 +29906,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30028
29906
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'bootloader version needs to be updated');
|
|
30029
29907
|
}
|
|
30030
29908
|
}
|
|
30031
|
-
prepareResourceBinary(
|
|
29909
|
+
prepareResourceBinary() {
|
|
30032
29910
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30033
29911
|
if (this.params.resourceBinary) {
|
|
30034
29912
|
return this.params.resourceBinary;
|
|
@@ -30036,11 +29914,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30036
29914
|
const { features } = this.device;
|
|
30037
29915
|
if (!features)
|
|
30038
29916
|
return null;
|
|
30039
|
-
const resourceUrl = DataManager.getSysResourcesLatestRelease(
|
|
30040
|
-
features,
|
|
30041
|
-
forcedUpdateRes: this.params.forcedUpdateRes,
|
|
30042
|
-
firmwareType,
|
|
30043
|
-
});
|
|
29917
|
+
const resourceUrl = DataManager.getSysResourcesLatestRelease(features, this.params.forcedUpdateRes);
|
|
30044
29918
|
if (resourceUrl) {
|
|
30045
29919
|
const resource = (yield getSysResourceBinary(resourceUrl)).binary;
|
|
30046
29920
|
return resource;
|
|
@@ -30049,7 +29923,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30049
29923
|
return null;
|
|
30050
29924
|
});
|
|
30051
29925
|
}
|
|
30052
|
-
prepareBootloaderBinary(
|
|
29926
|
+
prepareBootloaderBinary() {
|
|
30053
29927
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30054
29928
|
if (this.params.bootloaderBinary) {
|
|
30055
29929
|
return this.params.bootloaderBinary;
|
|
@@ -30058,7 +29932,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30058
29932
|
if (!features)
|
|
30059
29933
|
return null;
|
|
30060
29934
|
if (this.params.bootloaderVersion) {
|
|
30061
|
-
const bootResourceUrl = DataManager.getBootloaderResource(features
|
|
29935
|
+
const bootResourceUrl = DataManager.getBootloaderResource(features);
|
|
30062
29936
|
if (bootResourceUrl) {
|
|
30063
29937
|
const bootBinary = (yield getSysResourceBinary(bootResourceUrl)).binary;
|
|
30064
29938
|
return bootBinary;
|
|
@@ -30067,7 +29941,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30067
29941
|
return null;
|
|
30068
29942
|
});
|
|
30069
29943
|
}
|
|
30070
|
-
prepareFirmwareAndBleBinary(
|
|
29944
|
+
prepareFirmwareAndBleBinary() {
|
|
30071
29945
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30072
29946
|
const fwBinaryMap = [];
|
|
30073
29947
|
if (this.params.firmwareBinary) {
|
|
@@ -30084,7 +29958,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30084
29958
|
version: this.params.firmwareVersion,
|
|
30085
29959
|
updateType: 'firmware',
|
|
30086
29960
|
isUpdateBootloader: false,
|
|
30087
|
-
firmwareType,
|
|
30088
29961
|
})).binary;
|
|
30089
29962
|
fwBinaryMap.push({
|
|
30090
29963
|
fileName: 'firmware.bin',
|
|
@@ -30105,7 +29978,6 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
|
|
|
30105
29978
|
features,
|
|
30106
29979
|
version: this.params.bleVersion,
|
|
30107
29980
|
updateType: 'ble',
|
|
30108
|
-
firmwareType,
|
|
30109
29981
|
});
|
|
30110
29982
|
fwBinaryMap.push({
|
|
30111
29983
|
fileName: 'ble-firmware.bin',
|
|
@@ -33158,8 +33030,12 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
33158
33030
|
return false;
|
|
33159
33031
|
let biggerLimit = 1024;
|
|
33160
33032
|
const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
|
|
33033
|
+
const currentDeviceType = getDeviceType(this.device.features);
|
|
33161
33034
|
const supportBiggerDataVersion = '4.4.0';
|
|
33162
|
-
|
|
33035
|
+
const supportBiggerData = DeviceModelToTypes.model_classic1s.includes(currentDeviceType) ||
|
|
33036
|
+
(DeviceModelToTypes.model_touch.includes(currentDeviceType) &&
|
|
33037
|
+
semver__default["default"].gte(currentVersion, supportBiggerDataVersion));
|
|
33038
|
+
if (supportBiggerData) {
|
|
33163
33039
|
biggerLimit = 1536;
|
|
33164
33040
|
}
|
|
33165
33041
|
const startIndex = data.startsWith('0x') ? 2 : 0;
|
|
@@ -39461,8 +39337,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
39461
39337
|
throw hdShared.createDefectiveFirmwareError(defectiveInfo.serialNo, defectiveInfo.seVersion || 'Unknown', defectiveInfo.deviceType, method.connectId, method.deviceId);
|
|
39462
39338
|
}
|
|
39463
39339
|
}
|
|
39464
|
-
const
|
|
39465
|
-
const newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
|
|
39340
|
+
const newVersionStatus = DataManager.getFirmwareStatus(device.features);
|
|
39466
39341
|
const bleVersionStatus = DataManager.getBLEFirmwareStatus(device.features);
|
|
39467
39342
|
const currentFirmwareVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
39468
39343
|
const currentBleVersion = getDeviceBLEFirmwareVersion(device.features).join('.');
|