summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorGiovanni Condello <nanomad@users.noreply.github.com>2023-06-07 22:28:07 +0200
committerGitHub <noreply@github.com>2023-06-07 22:28:07 +0200
commitb5aa73a3a53859899538111861e33d1fb2458422 (patch)
tree56636c2446cbfef663b5172a39abe7f45c39532b /assets
parentRemoved use of openPortLineBreak/LineBreakTransformer in unlockHuaweiShell() (#228) (diff)
downloadhack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar.gz
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar.bz2
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar.lz
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar.xz
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.tar.zst
hack-gpon.github.io-b5aa73a3a53859899538111861e33d1fb2458422.zip
Diffstat (limited to '')
-rw-r--r--assets/js/LTF7267-BHA-ploam.js28
-rw-r--r--assets/ts/LTF7267-BHA-ploam.ts29
2 files changed, 29 insertions, 28 deletions
diff --git a/assets/js/LTF7267-BHA-ploam.js b/assets/js/LTF7267-BHA-ploam.js
deleted file mode 100644
index 57cd307..0000000
--- a/assets/js/LTF7267-BHA-ploam.js
+++ /dev/null
@@ -1,28 +0,0 @@
-function hexEncode(str){
- var hex, i;
-
- var result = "";
- for (i=0; i<str.length; i++) {
- hex = str.charCodeAt(i).toString(16);
- result += hex.padStart(2, "0");
- }
-
- return result;
-}
-
-function hisensePloam(ascii_ploam) {
- var hex_ploam = hexEncode(ascii_ploam);
- var hex_padded_ploam = hex_ploam.padEnd(72, "0");
- var array =[];
- for (i = 0; i<9; i++) {
- ploam_segment = hex_padded_ploam.slice(i*8, (i+1)*8);
- new_ploam_segment = "";
- for(j = 4; j>0; j--) {
- new_ploam_segment = new_ploam_segment + ploam_segment.slice((j-1)*2, j*2);
- }
- if(new_ploam_segment !== "00000000") {
- array.push("INT CFG_ID_PON_REGISTRATION_ID"+i+" = 0x"+new_ploam_segment+";");
- }
- }
- return array.join("\n");
-} \ No newline at end of file
diff --git a/assets/ts/LTF7267-BHA-ploam.ts b/assets/ts/LTF7267-BHA-ploam.ts
new file mode 100644
index 0000000..4c3310e
--- /dev/null
+++ b/assets/ts/LTF7267-BHA-ploam.ts
@@ -0,0 +1,29 @@
+function hexEncode(str: String): String {
+
+ var result = "";
+ for (let i = 0; i < str.length; i++) {
+ const hex = str.charCodeAt(i).toString(16);
+ result += hex.padStart(2, "0");
+ }
+
+ return result;
+}
+
+function hisensePloam(ascii_ploam: String): String {
+ const hex_ploam = hexEncode(ascii_ploam);
+ const hex_padded_ploam = hex_ploam.padEnd(72, "0");
+ let array: String[] = [];
+ for (let i = 0; i < 9; i++) {
+ const ploam_segment = hex_padded_ploam.slice(i * 8, (i + 1) * 8);
+ let new_ploam_segment = "";
+ for (let j = 4; j > 0; j--) {
+ new_ploam_segment = new_ploam_segment + ploam_segment.slice((j - 1) * 2, j * 2);
+ }
+ if (new_ploam_segment !== "00000000") {
+ array.push("INT CFG_ID_PON_REGISTRATION_ID" + i + " = 0x" + new_ploam_segment + ";");
+ }
+ }
+ return array.join("\n");
+}
+
+(window as any).hisensePloam = hisensePloam; \ No newline at end of file