From 2e889b167b410f2498f23184f22ab5adc2539624 Mon Sep 17 00:00:00 2001 From: vzakharchenko Date: Mon, 1 Nov 2021 16:30:17 +0200 Subject: [PATCH] Change Signal Band --- README.md | 28 ++++++++++++++++------------ index.ts | 1 + package.json | 3 ++- src/Signal.ts | 22 +++++++++++++++------- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index e6f171d..9640fe2 100644 --- a/README.md +++ b/README.md @@ -57,19 +57,23 @@ result: huawei-hilink [command] Commands: - huawei-hilink sendSMS send SMS to contact or group of contacts - huawei-hilink contacts get contact list with the latest sms messages - huawei-hilink messages get all messages from InBox - huawei-hilink contactPages contact list pages - huawei-hilink sms get contact SMS list - huawei-hilink pages count of sms pages - huawei-hilink deleteSMS delete sms by smsId - huawei-hilink mobileData Enable/Disable or Reconnect Mobile Data - huawei-hilink monitoring current Monitoring status + huawei-hilink sendSMS send SMS to contact or group of contacts + huawei-hilink contacts get contact list with the latest sms messages + huawei-hilink messages get all messages from InBox + huawei-hilink contactPages contact list pages + huawei-hilink sms get contact SMS list + huawei-hilink pages count of sms pages + huawei-hilink deleteSMS delete sms by smsId + huawei-hilink mobileData Enable/Disable or Reconnect Mobile Data + huawei-hilink monitoring current Monitoring status + huawei-hilink signalInfo current device signal status + huawei-hilink changeLteBand change LTE band Options: - --help Show help [boolean] - --version Show version number [boolean] + --help Show help [boolean] + --version Show version number [boolean] + --rsapadingtype rsapadingtype, to check your run in web-console: + MUI.LoginStateController.rsapadingtype[string] [default: "1"] ``` ### Version @@ -450,7 +454,7 @@ Result: ``` - +# get Current Network # encrypt/decrypt hilink api [Login API](https://github.com/vzakharchenko/huawei-hilink/blob/fa3d36e4df622999c674f39342bb196500208d8b/src/startSession.ts#L57): diff --git a/index.ts b/index.ts index 8caacc5..ff75a11 100644 --- a/index.ts +++ b/index.ts @@ -461,6 +461,7 @@ yargs(hideBin(process.argv)) alias: 'band', describe: 'desirable LTE band number, separated by + char (example 1+3+20).If you want to use every supported bands, write \'AUTO\'.", "AUTO"', default: 'AUTO', + type:'string' }) }, async (argv: any) => { if (!argv.band){ diff --git a/package.json b/package.json index a0d9b55..302c8b8 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "messages": "node index.js messages --url=192.168.89.1 --deleteAfter=true --password=testPassword", "signalInfo": "node index.js signalInfo --url=192.168.89.1 --password=testPassword", "signalInfoLoop": "node index.js signalInfo --turn=true --url=192.168.89.1 --password=testPassword", - "changeLteBand": "node index.js changeLteBand --url=192.168.89.1 --band=\"AUTO\" --password=testPassword", + "changeLteBand": "node index.js changeLteBand --url=192.168.89.1 --band=AUTO --password=testPassword", "lint": "eslint src --ext .ts src", "build": "tsc --build", "lint:fix": "eslint --fix src --ext .ts" @@ -28,6 +28,7 @@ "axios": "^0.24.0", "crypto-js": "^4.1.1", "get-random-values": "^1.2.2", + "link": "^0.1.5", "xml2js": "^0.4.23", "yargs": "^17.2.1" }, diff --git a/src/Signal.ts b/src/Signal.ts index 7fa96c7..0dc6e07 100644 --- a/src/Signal.ts +++ b/src/Signal.ts @@ -8,21 +8,29 @@ const huawei = require('../jslib/public'); function _4GType(data:string):string { if ((data === '20880800C5') || (data === '20000800C5')) { return "AUTO"; } - let dataOut = ""; + const dataOut:string[] = []; if ((parseInt(data, 16) & 0x1) === 0x1) { - dataOut = "B1+"; + dataOut.push("B1"); } if ((parseInt(data, 16) & 0x4) === 0x4) { - dataOut += "B3+"; + dataOut.push("B3"); + } + if ((parseInt(data, 16) & 0x10) === 0x10) { + dataOut.push("B5"); } if ((parseInt(data, 16) & 0x40) === 0x40) { - dataOut += "B7+"; + dataOut.push("B7"); + } + if ((parseInt(data, 16) & 0x80) === 0x80) { + dataOut.push("B8"); } if ((parseInt(data, 16) & 0x80000) === 0x80000) { - dataOut += "B20"; + dataOut.push("B20"); + } + if ((parseInt(data, 16) & 0x8000000) === 0x8000000) { + dataOut.push("B28"); } - dataOut = dataOut.replace(/\++$/, ""); - return dataOut; + return dataOut.join('+'); } export async function getSignalInfo(sessionData: SessionData) {