iobroker.e3oncan 0.10.8 → 0.10.10
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/README.md +11 -0
- package/io-package.json +27 -27
- package/lib/canUds.js +16 -3
- package/lib/codecs.js +55 -7
- package/lib/codecs.test.js +74 -53
- package/lib/didsE3.json +1410 -156
- package/lib/enums.js +1 -1
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -118,6 +118,7 @@ CAN-address=98: data points with odd IDs
|
|
|
118
118
|
* In addition to open3e real time collecting of data via listening is supported.
|
|
119
119
|
* Writing of data is much simpler. Just change the data in corresponding state and press Save button.
|
|
120
120
|
* Exchanging data via MQTT is not neccessary. However it's of course available via configuration of data states.
|
|
121
|
+
* Encoding of 64 bit integers (for writing of data) is limited to values < 2^52 (4.503.599.627.370.496). Decoding (for reading of data) is working correctly in full 64 bit range.
|
|
121
122
|
|
|
122
123
|
## May open3e be used in parallel?
|
|
123
124
|
Yes, that is possible under certain conditions:
|
|
@@ -134,6 +135,16 @@ If you enjoyed this project — or just feeling generous, consider buying me a b
|
|
|
134
135
|
Placeholder for the next version (at the beginning of the line):
|
|
135
136
|
### **WORK IN PROGRESS**
|
|
136
137
|
-->
|
|
138
|
+
### 0.10.10 (2025-08-07)
|
|
139
|
+
* (MyHomeMyData) Fix for issue #142 (WriteByDid not working in case of specific UDS control frame)
|
|
140
|
+
* (MyHomeMyData) Update of list of data points for E3 devices to version 20250729
|
|
141
|
+
* (MyHomeMyData) Added codec for 64-bit integers. Remark: Encoding (for writing of data) is limited to values < 2^52 (4.503.599.627.370.496).
|
|
142
|
+
|
|
143
|
+
### 0.10.9 (2025-05-22)
|
|
144
|
+
* (MyHomeMyData) Update of list of data points for E3 devices to version 20250422
|
|
145
|
+
* (MyHomeMyData) Fixed version number of enum info
|
|
146
|
+
* (MyHomeMyData) Fix for issue #125 (findings of repository checker)
|
|
147
|
+
|
|
137
148
|
### 0.10.8 (2025-03-07)
|
|
138
149
|
* (MyHomeMyData) Bugfix for issue #117
|
|
139
150
|
* (MyHomeMyData) Updated data point 381, refer to discussion https://github.com/open3e/open3e/discussions/212
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "e3oncan",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.10",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.10.10": {
|
|
7
|
+
"en": "Fix for issue #142 (WriteByDid not working in case of specific UDS control frame)\nUpdate of list of data points for E3 devices to version 20250729\nAdded codec for 64-bit integers. Remark: Encoding (for writing of data) is limited to values < 2^52 (4.503.599.627.370.496).",
|
|
8
|
+
"de": "Fix für Issue #142 (WriteByDid funktioniert nicht bei bestimmten UDS-Frames)\nAktualisierung der Liste der Datenpunkte für E3 Geräte auf Version 20250729\nCodec für 64-Bit-Integer hinzugefügt. Anmerkung: Die Enkodierung (zum Schreiben von Daten) ist auf Werte < 2^52 (4.503.599.627.370.496) beschränkt.",
|
|
9
|
+
"ru": "Исправление проблемы #142 (WriteByDid не работает в случае конкретной системы управления UDS)\nОбновление списка точек данных для устройств E3 до версии 20250729\nДобавлен кодек для 64-битных целых чисел. Замечание: Кодирование (для записи данных) ограничено значениями < 2^52 (4.503.599.627.370.496).",
|
|
10
|
+
"pt": "Corrigir para o problema #142 (WriteByNão funcionou no caso de um quadro de controle UDS específico)\nActualização da lista de pontos de dados para os dispositivos E3 na versão 20250729\nAdicionado codec para números inteiros de 64 bits. Observação: A codificação (para escrita de dados) é limitada a valores < 2^52 (4.503.599.627.370.496).",
|
|
11
|
+
"nl": "Fix voor probleem #142 (WriteByHeb niet gewerkt in het geval van specifieke UDS control frame)\nUpdate van de lijst van gegevenspunten voor E3-apparaten naar versie 20250729\nToegevoegd codec voor 64-bit gehele getallen. Opmerking: Codering (voor het schrijven van gegevens) is beperkt tot waarden < 2^52 (4503,599.627.370,496).",
|
|
12
|
+
"fr": "Correction pour le numéro #142 (WriteByNe fonctionne pas dans le cas d'un cadre de contrôle UDS spécifique)\nMise à jour de la liste des points de données pour les appareils E3 vers la version 20250729\nAjout du codec pour les entiers 64 bits. Remarque: Le codage (pour l'écriture des données) est limité à des valeurs < 2^52 (4.503.599.627.370.496).",
|
|
13
|
+
"it": "Risolvere per numero #142 (WriteByDid non funziona in caso di specifiche strutture di controllo UDS)\nAggiornamento dell'elenco dei punti di dati per i dispositivi E3 alla versione 20250729\nAggiunto codec per i interi a 64 bit. Nota: La codifica (per la scrittura dei dati) è limitata ai valori < 2^52 (4.503.599.627.370.496).",
|
|
14
|
+
"es": "Fijación para el número #142 (WriteByDid no funciona en caso de marco de control UDS específico)\nActualización de la lista de puntos de datos para dispositivos E3 a la versión 20250729\nSe agregó codec para enteros de 64 bits. Observación: La codificación (para la escritura de los datos) se limita a los valores . 2^52 (4.503.599.627.370.496).",
|
|
15
|
+
"pl": "Fix for issue # 142 (WriteByDid not working in case of specific UDS control frame)\nAktualizacja wykazu punktów danych dla urządzeń E3 do wersji 20250729\nDodano kodek dla 64- bitowych liczb całkowitych. Uwaga: Kodowanie (do zapisu danych) jest ograniczone do wartości < 2 ^ 52 (4.503.599.627.370.496).",
|
|
16
|
+
"uk": "Виправлення проблеми #142 (WriteByDid не працює в разі конкретної рамки керування UDS)\nОновлення списку точок даних для пристроїв E3 до версії 20250729\nДодано кодеку для 64-бітних цілих чисел. Примітка: Конкодування (для написання даних) обмежується значеннями < 2^52 (4.503.599.627.370.496).",
|
|
17
|
+
"zh-cn": "修复第142期( WriteBy 在特定UDS 控制框架情况下没有工作)\nE3设备数据点列表更新至20250729版本\n为64位整数添加编码器. 注:编码(用于写入数据)仅限于 < 2^52(4.503.599.627.370.496)的值."
|
|
18
|
+
},
|
|
19
|
+
"0.10.9": {
|
|
20
|
+
"en": "Update of list of data points for E3 devices to version 20250422\nFixed version number of enum info\nFix for issue #125 (findings of repository checker)",
|
|
21
|
+
"de": "Aktualisierung der Liste der Datenpunkte für E3 Geräte auf Version 20250422\nVersionsnummer der enum info korrigiert\nFix für Issue #125 (Ergebnisse des Repository-Checkers)",
|
|
22
|
+
"ru": "Обновление списка точек данных для устройств E3 до версии 20250422\nФиксированный номер версии enum info\nИсправление для выпуска #125 (находки проверки хранилища)",
|
|
23
|
+
"pt": "Atualização da lista de pontos de dados para dispositivos E3 para a versão 20250422\nNúmero de versão fixa de enum info\nCorrigir para o número #125 (conjuntos de verificador de repositório)",
|
|
24
|
+
"nl": "Update van de lijst van gegevenspunten voor E3-apparaten naar versie 20250422\nFixed version number of enum info\nFix voor uitgave #125 (bevindingen van repository checker)",
|
|
25
|
+
"fr": "Mise à jour de la liste des points de données pour les appareils E3 vers la version 20250422\nNuméro de version fixe d'enum info\nCorrection pour le numéro #125 (recherches du vérificateur du dépôt)",
|
|
26
|
+
"it": "Aggiornamento dell'elenco dei punti di dati per i dispositivi E3 alla versione 20250422\nNumero di versione fisso di enum info\nRisolvere per numero #125 (finanze di repository checker)",
|
|
27
|
+
"es": "Actualización de la lista de puntos de datos para dispositivos E3 a la versión 20250422\nNúmero de versión fija de enum info\nFijación para el número #125 (definiciones de repositorio)",
|
|
28
|
+
"pl": "Aktualizacja wykazu punktów danych dla urządzeń E3 do wersji 20250422\nPoprawiony numer wersji enum info\nFix for issue # 125 (wyniki weryfikacji repozytorium)",
|
|
29
|
+
"uk": "Оновлення списку точок даних для пристроїв E3 до версії 20250422\nФіксована версія номеру енму\nВиправлення для випуску #125 (фінінги репозиторійного чекера)",
|
|
30
|
+
"zh-cn": "E3设备数据点列表更新至20250422版本\nEnum信息的固定版本编号\n修复第125期(查找仓库检查器)"
|
|
31
|
+
},
|
|
6
32
|
"0.10.8": {
|
|
7
33
|
"en": "Bugfix for issue #117\nUpdated data point 381, refer to discussion https://github.com/open3e/open3e/discussions/212\nUpdate of list of data points for E3 devices to version 20250307",
|
|
8
34
|
"de": "Bugfix für Issue #117\nDatenpunkt 381 aktualisiert, siehe Diskussion https://github.com/open3e/open3e/discussions/212\nAktualisierung der Liste der Datenpunkte für E3 Geräte auf Version 20250307",
|
|
@@ -67,32 +93,6 @@
|
|
|
67
93
|
"pl": "Aktualizacja wykazu punktów danych dla urządzeń E3 do wersji 20250114",
|
|
68
94
|
"uk": "Оновлення списку точок даних для пристроїв E3 до версії 20250114",
|
|
69
95
|
"zh-cn": "E3设备数据点列表更新至20250114版本"
|
|
70
|
-
},
|
|
71
|
-
"0.10.3": {
|
|
72
|
-
"en": "Update of list of data points for E3 devices to version 20241125",
|
|
73
|
-
"de": "Aktualisierung der Liste der Datenpunkte für E3 Geräte auf Version 20241125",
|
|
74
|
-
"ru": "Обновление списка точек данных для устройств E3 к версии 20241125",
|
|
75
|
-
"pt": "Atualização da lista de pontos de dados para dispositivos E3 para a versão 20241125",
|
|
76
|
-
"nl": "Update van de lijst van gegevenspunten voor E3-apparaten naar versie 20241125",
|
|
77
|
-
"fr": "Mise à jour de la liste des points de données pour les appareils E3 vers la version 20241125",
|
|
78
|
-
"it": "Aggiornamento dell'elenco dei punti di dati per i dispositivi E3 alla versione 20241125",
|
|
79
|
-
"es": "Actualización de la lista de puntos de datos para dispositivos E3 a la versión 20241125",
|
|
80
|
-
"pl": "Aktualizacja listy punktów danych dla urządzeń E3 do wersji 20241125",
|
|
81
|
-
"uk": "Оновлення списку точок даних для пристроїв E3 до версії 20241125",
|
|
82
|
-
"zh-cn": "E3设备数据点列表更新为20241125版本"
|
|
83
|
-
},
|
|
84
|
-
"0.10.2": {
|
|
85
|
-
"en": "Update of list of data points for E3 devices to version 20241115\nFixes for issue #81 (added missing size attributes)",
|
|
86
|
-
"de": "Aktualisierung der Liste der Datenpunkte für E3 Geräte auf Version 20241115\nFixes für Issue #81 (fehlende Größenattribute ergänzt)",
|
|
87
|
-
"ru": "Обновление списка точек данных для устройств E3 к версии 20241115\nИсправления для выпуска #81",
|
|
88
|
-
"pt": "Atualização da lista de pontos de dados para dispositivos E3 para a versão 20241115\nCorrige o problema #81 (acrescido de atributos de tamanho ausente)",
|
|
89
|
-
"nl": "Update van de lijst van gegevenspunten voor E3-apparaten naar versie 20241115\nFixes voor probleem #81 (toegevoegd ontbrekende grootte attributen)",
|
|
90
|
-
"fr": "Mise à jour de la liste des points de données pour les appareils E3 vers la version 20241115\nCorrections pour l'émission #81 (attributs de taille manquants ajoutés)",
|
|
91
|
-
"it": "Aggiornamento dell'elenco dei punti di dati per i dispositivi E3 alla versione 20241115\nFissi per numero #81 (attributi di dimensione mancante aggiunti)",
|
|
92
|
-
"es": "Actualización de la lista de puntos de datos para dispositivos E3 a la versión 20241115\nArreglos para el número #81 (atributos de tamaño perdido agregado)",
|
|
93
|
-
"pl": "Aktualizacja wykazu punktów danych dla urządzeń E3 do wersji 20241115\nFixes for issue # 81 (added brakujący rozmiar atrybutów)",
|
|
94
|
-
"uk": "Оновлення списку точок даних для пристроїв E3 до версії 20241115\nВиправлення для випуску #81 (відсутні атрибути розмірів відсутні)",
|
|
95
|
-
"zh-cn": "E3设备数据点列表更新至20241115版本\n解决第81期( 添加缺失大小属性)"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
package/lib/canUds.js
CHANGED
|
@@ -89,7 +89,8 @@ class uds {
|
|
|
89
89
|
'did' : 0,
|
|
90
90
|
'state' : 0,
|
|
91
91
|
'D0' : 0x21,
|
|
92
|
-
'txPos' : 0
|
|
92
|
+
'txPos' : 0,
|
|
93
|
+
'cntFCrx' : -1 // Counter till next 'Frame Control frame': 0 ==> FCf expected as next frame
|
|
93
94
|
};
|
|
94
95
|
this.canIDhex = '0x'+Number(this.config.canID).toString(16);
|
|
95
96
|
this.SID77addrOffset = 0x02;
|
|
@@ -827,11 +828,12 @@ class uds {
|
|
|
827
828
|
await this.setDidDone(ctx, 100);
|
|
828
829
|
break;
|
|
829
830
|
}
|
|
830
|
-
if ( (candata.length == 8) && (candata[0] ==
|
|
831
|
+
if ( (candata.length == 8) && (candata[0] == this.writeProt.FCrx) ) {
|
|
831
832
|
// Multi-frame communication confirmed
|
|
832
833
|
// Send data in slices of 7 bytes
|
|
833
834
|
let ST = candata[2]; // Separation Time (ms)
|
|
834
835
|
if ((ST<20) || (ST>127)) ST=50; // Accept ST 20 .. 127 ms. Default to 50 ms.
|
|
836
|
+
this.data.cntFCrx = candata[1] - 1; // Initialize counter till next FCf (-1 => infinite)
|
|
835
837
|
while (this.data.txPos < this.data.len) {
|
|
836
838
|
// More data to send
|
|
837
839
|
await this.sleep(ctx, ST);
|
|
@@ -840,8 +842,19 @@ class uds {
|
|
|
840
842
|
this.data.txPos += 7;
|
|
841
843
|
this.data.D0 += 1;
|
|
842
844
|
if (this.data.D0 > 0x2f) this.data.D0 = 0x20;
|
|
845
|
+
if (this.data.cntFCrx == 0) {
|
|
846
|
+
// FCf expected as next frame => interrupt sending of data frames and wait for FCf
|
|
847
|
+
// Has no effect, if all data was already sent
|
|
848
|
+
break;
|
|
849
|
+
} else {
|
|
850
|
+
// continue sending data frames
|
|
851
|
+
this.data.cntFCrx -= 1;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
if (this.data.txPos >= this.data.len) {
|
|
855
|
+
// All data was sent
|
|
856
|
+
await this.setComState(3); // waitForFFSFwbd (wait for confirmation)
|
|
843
857
|
}
|
|
844
|
-
await this.setComState(3); // waitForFFSFwbd (wait for confirmation)
|
|
845
858
|
break;
|
|
846
859
|
}
|
|
847
860
|
if (await this.getWorkerOpMode() != 'service77') {
|
package/lib/codecs.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
const enums = require('./enums');
|
|
2
2
|
|
|
3
|
-
const C2POW08
|
|
4
|
-
const C2POW15
|
|
5
|
-
const C2POW16
|
|
6
|
-
const C2POW24
|
|
7
|
-
const C2POW31
|
|
8
|
-
const C2POW32
|
|
3
|
+
const C2POW08 = 0x100;
|
|
4
|
+
const C2POW15 = 0x08000;
|
|
5
|
+
const C2POW16 = 0x10000;
|
|
6
|
+
const C2POW24 = 0x1000000;
|
|
7
|
+
const C2POW31 = 0x080000000;
|
|
8
|
+
const C2POW32 = 0x100000000;
|
|
9
|
+
const C2POW40 = 0x10000000000;
|
|
10
|
+
const C2POW48 = 0x1000000000000;
|
|
11
|
+
const C2POW52n = BigInt(0x10000000000000);
|
|
12
|
+
const C2POW56n = BigInt(0x100000000000000);
|
|
13
|
+
const C2POW63n = BigInt(0x08000000000000000);
|
|
14
|
+
const C2POW64n = BigInt(0x10000000000000000);
|
|
9
15
|
|
|
10
16
|
function arr2Hex(arr) {
|
|
11
17
|
// Convert byte array to hex string
|
|
@@ -19,6 +25,11 @@ function toHex(d, len) {
|
|
|
19
25
|
return (('00000000'+(Number(d).toString(16))).slice(-len));
|
|
20
26
|
}
|
|
21
27
|
|
|
28
|
+
function toHex64(d, len) {
|
|
29
|
+
// Convert int64 to hex string of length len
|
|
30
|
+
return (('0000000000000000'+(d.toString(16))).slice(-len));
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
function toByteArray(hs) {
|
|
23
34
|
// Convert hex string, e.g. '21A8' to byte array: [33,168]
|
|
24
35
|
const ba = [];
|
|
@@ -56,6 +67,18 @@ function sint32toVal(j) {
|
|
|
56
67
|
return v;
|
|
57
68
|
}
|
|
58
69
|
|
|
70
|
+
function uint64toVal(j,) {
|
|
71
|
+
return Number(C2POW56n*BigInt(j[7])+BigInt(C2POW48)*BigInt(j[6])+BigInt(C2POW40)*BigInt(j[5])+BigInt(C2POW32)*BigInt(j[4])+
|
|
72
|
+
BigInt(C2POW24)*BigInt(j[3])+BigInt(C2POW16)*BigInt(j[2])+BigInt(C2POW08)*BigInt(j[1])+BigInt(j[0]));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function sint64toVal(j) {
|
|
76
|
+
let v = C2POW56n*BigInt(j[7])+BigInt(C2POW48)*BigInt(j[6])+BigInt(C2POW40)*BigInt(j[5])+BigInt(C2POW32)*BigInt(j[4])+
|
|
77
|
+
BigInt(C2POW24)*BigInt(j[3])+BigInt(C2POW16)*BigInt(j[2])+BigInt(C2POW08)*BigInt(j[1])+BigInt(j[0]);
|
|
78
|
+
if (v >= C2POW63n) { v -= C2POW64n; }
|
|
79
|
+
return Number(v);
|
|
80
|
+
}
|
|
81
|
+
|
|
59
82
|
function int2val(j, signed = false) {
|
|
60
83
|
// Convert byte array to int08, int16, int32. Signed or unsigned.
|
|
61
84
|
switch (j.length) {
|
|
@@ -65,6 +88,8 @@ function int2val(j, signed = false) {
|
|
|
65
88
|
return (signed ? sint16toVal(j) : uint16toVal(j) );
|
|
66
89
|
case 4 :
|
|
67
90
|
return (signed ? sint32toVal(j) : uint32toVal(j) );
|
|
91
|
+
case 8 :
|
|
92
|
+
return (signed ? sint64toVal(j) : uint64toVal(j) );
|
|
68
93
|
default:
|
|
69
94
|
return null;
|
|
70
95
|
}
|
|
@@ -78,6 +103,18 @@ function val2byteArr(v, byte_width, scale = 1, signed = false) {
|
|
|
78
103
|
return string_bin.reverse();
|
|
79
104
|
}
|
|
80
105
|
|
|
106
|
+
function val2byteArr64(v, byte_width, scale = 1, signed = false) {
|
|
107
|
+
// Convert int64 to byte array. Signed or unsigned.
|
|
108
|
+
// Due to internal limitations of Javascript this only works correctly for values < 2^52 (4.503.599.627.370.496)
|
|
109
|
+
let val = BigInt(Math.round(v * scale));
|
|
110
|
+
if ( (val >= C2POW52n) || (val <= -C2POW52n) ) {
|
|
111
|
+
throw new Error('O3EInt64.encode(): Value out of range. For encoding only values in range -2**52 < value < 2**52 (4.503.599.627.370.496) are allowed!');
|
|
112
|
+
}
|
|
113
|
+
if ( (signed) && (val < 0) ) { val += C2POW64n; }
|
|
114
|
+
const string_bin = toByteArray(toHex64(val, byte_width*2));
|
|
115
|
+
return string_bin.reverse();
|
|
116
|
+
}
|
|
117
|
+
|
|
81
118
|
function RawEncode(data, len) {
|
|
82
119
|
const string_bin = toByteArray(data);
|
|
83
120
|
if (string_bin.length !== len) {
|
|
@@ -115,7 +152,11 @@ class O3EInt {
|
|
|
115
152
|
this.signed = _args.signed;
|
|
116
153
|
}
|
|
117
154
|
encode(data) {
|
|
118
|
-
|
|
155
|
+
if (this.byte_width == 8) {
|
|
156
|
+
return val2byteArr64(data, this.byte_width, this.scale, this.signed);
|
|
157
|
+
} else {
|
|
158
|
+
return val2byteArr(data, this.byte_width, this.scale, this.signed);
|
|
159
|
+
}
|
|
119
160
|
}
|
|
120
161
|
|
|
121
162
|
decode(data) {
|
|
@@ -148,6 +189,12 @@ class O3EInt32 extends O3EInt {
|
|
|
148
189
|
}
|
|
149
190
|
}
|
|
150
191
|
|
|
192
|
+
class O3EInt64 extends O3EInt {
|
|
193
|
+
constructor(string_len, idStr, _args) {
|
|
194
|
+
super(string_len, idStr, 8, _args);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
151
198
|
class O3EByteVal {
|
|
152
199
|
constructor(string_len, idStr, _args) {
|
|
153
200
|
this.string_len = string_len;
|
|
@@ -617,6 +664,7 @@ const O3Ecodecs = {
|
|
|
617
664
|
'O3EInt8':O3EInt8,
|
|
618
665
|
'O3EInt16':O3EInt16,
|
|
619
666
|
'O3EInt32':O3EInt32,
|
|
667
|
+
'O3EInt64':O3EInt64,
|
|
620
668
|
'O3EByteVal':O3EByteVal,
|
|
621
669
|
'O3EFloat32':O3EFloat32,
|
|
622
670
|
'O3EBool':O3EBool,
|
package/lib/codecs.test.js
CHANGED
|
@@ -44,12 +44,12 @@ describe('codecs.js => O3EUtf8()', () => {
|
|
|
44
44
|
const raw1 = E3.toByteArray(raw_hex1);
|
|
45
45
|
const txt1 = 'Heizkörper';
|
|
46
46
|
it(`Decode ${JSON.stringify(txt1)}`, () => {
|
|
47
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw1.length,'test1Utf08', {
|
|
47
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw1.length,'test1Utf08', {});
|
|
48
48
|
const result = f.decode(raw1);
|
|
49
49
|
expect(JSON.stringify(result)).to.equal(JSON.stringify(txt1));
|
|
50
50
|
});
|
|
51
51
|
it(`Encode ${JSON.stringify(raw1)}`, () => {
|
|
52
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw1.length,'test2Utf08', {
|
|
52
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw1.length,'test2Utf08', {});
|
|
53
53
|
const result = f.encode(txt1);
|
|
54
54
|
expect(JSON.stringify(raw1)).to.equal(JSON.stringify(result));
|
|
55
55
|
});
|
|
@@ -57,12 +57,12 @@ describe('codecs.js => O3EUtf8()', () => {
|
|
|
57
57
|
const raw2 = E3.toByteArray(raw_hex2);
|
|
58
58
|
const txt2 = 'Fußbodenheizung';
|
|
59
59
|
it(`Decode ${JSON.stringify(txt2)}`, () => {
|
|
60
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw2.length,'test3Utf08', {
|
|
60
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw2.length,'test3Utf08', {});
|
|
61
61
|
const result = f.decode(raw2);
|
|
62
62
|
expect(JSON.stringify(result)).to.equal(JSON.stringify(txt2));
|
|
63
63
|
});
|
|
64
64
|
it(`Encode ${JSON.stringify(raw2)}`, () => {
|
|
65
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw2.length,'test4Utf08', {
|
|
65
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw2.length,'test4Utf08', {});
|
|
66
66
|
const result = f.encode(txt2);
|
|
67
67
|
expect(JSON.stringify(raw2)).to.equal(JSON.stringify(result));
|
|
68
68
|
});
|
|
@@ -70,12 +70,12 @@ describe('codecs.js => O3EUtf8()', () => {
|
|
|
70
70
|
const raw3 = E3.toByteArray(raw_hex3);
|
|
71
71
|
const txt3 = '';
|
|
72
72
|
it(`Decode ${JSON.stringify(txt3)}`, () => {
|
|
73
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw3.length,'test5Utf08', {
|
|
73
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw3.length,'test5Utf08', {});
|
|
74
74
|
const result = f.decode(raw3);
|
|
75
75
|
expect(JSON.stringify(result)).to.equal(JSON.stringify(txt3));
|
|
76
76
|
});
|
|
77
77
|
it(`Encode ${JSON.stringify(raw3)}`, () => {
|
|
78
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw3.length,'test5Utf08', {
|
|
78
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw3.length,'test5Utf08', {});
|
|
79
79
|
const result = f.encode(txt3);
|
|
80
80
|
expect(JSON.stringify(raw3)).to.equal(JSON.stringify(result));
|
|
81
81
|
});
|
|
@@ -83,12 +83,12 @@ describe('codecs.js => O3EUtf8()', () => {
|
|
|
83
83
|
const raw4 = E3.toByteArray(raw_hex4);
|
|
84
84
|
const txt4 = 'Fuß';
|
|
85
85
|
it(`Decode ${JSON.stringify(txt4)}`, () => {
|
|
86
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw4.length,'test6Utf08', {
|
|
86
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw4.length,'test6Utf08', {});
|
|
87
87
|
const result = f.decode(raw4);
|
|
88
88
|
expect(JSON.stringify(result)).to.equal(JSON.stringify(txt4));
|
|
89
89
|
});
|
|
90
90
|
it(`Encode ${JSON.stringify(raw4)}`, () => {
|
|
91
|
-
const f = new E3.O3Ecodecs.O3EUtf8(raw4.length,'test6Utf08', {
|
|
91
|
+
const f = new E3.O3Ecodecs.O3EUtf8(raw4.length,'test6Utf08', {});
|
|
92
92
|
const result = f.encode(txt4);
|
|
93
93
|
expect(JSON.stringify(raw4)).to.equal(JSON.stringify(result));
|
|
94
94
|
});
|
|
@@ -174,71 +174,92 @@ describe('codecs.js => val2byteArr()', () => {
|
|
|
174
174
|
|
|
175
175
|
// Float32 DECODER:
|
|
176
176
|
describe('codecs.js => O3EFloat32().decode()', () => {
|
|
177
|
-
codecDecode('Float +0.0 ' , 0.0, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test1', {scale: 1.0
|
|
178
|
-
codecDecode('Float +100.5' , 100.5, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test2', {scale: 1.0
|
|
179
|
-
codecDecode('Float -100.5' , -100.5, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test3', {scale: 1.0
|
|
180
|
-
codecDecode('Float +4.242E8' , +4.242e8, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test4', {scale: 1.0
|
|
181
|
-
codecDecode('Float -4.242E8' , -4.242e8, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test5', {scale: 1.0
|
|
182
|
-
codecDecode('Float +425647872' , +425647872, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test6', {scale: 1.0
|
|
183
|
-
codecDecode('Float -425647872' , -425647872, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test7', {scale: 1.0
|
|
184
|
-
codecDecode('Float +7851817360303081791424561152', +7851817360303081791424561152, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test8', {scale: 1.0
|
|
185
|
-
codecDecode('Float -7851817360303081791424561152', -7851817360303081791424561152, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test9', {scale: 1.0
|
|
186
|
-
codecDecode('Float +0.005' , +0.004999999888241291, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test9', {scale: 1.0
|
|
187
|
-
codecDecode('Float -0.005' , -0.004999999888241291, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test10', {scale: 1.0
|
|
177
|
+
codecDecode('Float +0.0 ' , 0.0, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test1', {scale: 1.0}, [0x00, 0x00, 0x00, 0x00].reverse());
|
|
178
|
+
codecDecode('Float +100.5' , 100.5, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test2', {scale: 1.0}, [0x42, 0xc9, 0x00, 0x00].reverse());
|
|
179
|
+
codecDecode('Float -100.5' , -100.5, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test3', {scale: 1.0}, [0xc2, 0xc9, 0x00, 0x00].reverse());
|
|
180
|
+
codecDecode('Float +4.242E8' , +4.242e8, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test4', {scale: 1.0}, [0x4d, 0xca, 0x46, 0x3a].reverse());
|
|
181
|
+
codecDecode('Float -4.242E8' , -4.242e8, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test5', {scale: 1.0}, [0xcd, 0xca, 0x46, 0x3a].reverse());
|
|
182
|
+
codecDecode('Float +425647872' , +425647872, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test6', {scale: 1.0}, [0x4d, 0xca, 0xf6, 0xf8].reverse());
|
|
183
|
+
codecDecode('Float -425647872' , -425647872, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test7', {scale: 1.0}, [0xcd, 0xca, 0xf6, 0xf8].reverse());
|
|
184
|
+
codecDecode('Float +7851817360303081791424561152', +7851817360303081791424561152, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test8', {scale: 1.0}, [0x6d, 0xca, 0xf6, 0xf8].reverse());
|
|
185
|
+
codecDecode('Float -7851817360303081791424561152', -7851817360303081791424561152, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test9', {scale: 1.0}, [0xed, 0xca, 0xf6, 0xf8].reverse());
|
|
186
|
+
codecDecode('Float +0.005' , +0.004999999888241291, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test9', {scale: 1.0}, [0x3b, 0xa3, 0xd7, 0x0a].reverse());
|
|
187
|
+
codecDecode('Float -0.005' , -0.004999999888241291, E3.O3Ecodecs.O3EFloat32, 4, 'Float32Test10', {scale: 1.0}, [0xbb, 0xa3, 0xd7, 0x0a].reverse());
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
// Integer DECODER:
|
|
191
191
|
describe('codecs.js => O3EInt8().decode()', () => {
|
|
192
|
-
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt8, 1, 'test1', {scale:10.0,signed:true
|
|
193
|
-
codecDecode('Positive Number, scale=10, signed=true ', (2**7-1)/10, E3.O3Ecodecs.O3EInt8, 1, 'test2', {scale:10.0,signed:true
|
|
194
|
-
codecDecode('Negative Number, scale=10, signed=true ', -(2**7)/10, E3.O3Ecodecs.O3EInt8, 1, 'test3', {scale:10.0,signed:true
|
|
195
|
-
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt8, 1, 'test4', {scale:1.0, signed:true
|
|
196
|
-
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt8, 1, 'test5', {scale:10.0,signed:false
|
|
192
|
+
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt8, 1, 'test1', {scale:10.0,signed:true}, [0x32]);
|
|
193
|
+
codecDecode('Positive Number, scale=10, signed=true ', (2**7-1)/10, E3.O3Ecodecs.O3EInt8, 1, 'test2', {scale:10.0,signed:true}, [0x7f]);
|
|
194
|
+
codecDecode('Negative Number, scale=10, signed=true ', -(2**7)/10, E3.O3Ecodecs.O3EInt8, 1, 'test3', {scale:10.0,signed:true}, [0x80]);
|
|
195
|
+
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt8, 1, 'test4', {scale:1.0, signed:true}, [0xfb]);
|
|
196
|
+
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt8, 1, 'test5', {scale:10.0,signed:false}, [0xfb]);
|
|
197
197
|
});
|
|
198
198
|
|
|
199
199
|
describe('codecs.js => O3EInt16().decode()', () => {
|
|
200
|
-
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt16, 2, 'test1', {scale:10.0,signed:true
|
|
201
|
-
codecDecode('Positive Number, scale=10, signed=true ', (2**15-1)/10, E3.O3Ecodecs.O3EInt16, 2, 'test2', {scale:10.0,signed:true
|
|
202
|
-
codecDecode('Negative Number, scale=10, signed=true ', -(2**15)/10, E3.O3Ecodecs.O3EInt16, 2, 'test3', {scale:10.0,signed:true
|
|
203
|
-
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt16, 2, 'test4', {scale:1.0, signed:true
|
|
204
|
-
codecDecode('Positive Number, scale=10, signed=false', (2**16-1)/10, E3.O3Ecodecs.O3EInt16, 2, 'test5', {scale:10.0,signed:false
|
|
205
|
-
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt16, 2, 'test6', {scale:10.0,signed:false
|
|
200
|
+
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt16, 2, 'test1', {scale:10.0,signed:true}, [0x32,0x00]);
|
|
201
|
+
codecDecode('Positive Number, scale=10, signed=true ', (2**15-1)/10, E3.O3Ecodecs.O3EInt16, 2, 'test2', {scale:10.0,signed:true}, [0xff,0x7f]);
|
|
202
|
+
codecDecode('Negative Number, scale=10, signed=true ', -(2**15)/10, E3.O3Ecodecs.O3EInt16, 2, 'test3', {scale:10.0,signed:true}, [0x00,0x80]);
|
|
203
|
+
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt16, 2, 'test4', {scale:1.0, signed:true}, [0xfb,0xff]);
|
|
204
|
+
codecDecode('Positive Number, scale=10, signed=false', (2**16-1)/10, E3.O3Ecodecs.O3EInt16, 2, 'test5', {scale:10.0,signed:false}, [0xff,0xff]);
|
|
205
|
+
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt16, 2, 'test6', {scale:10.0,signed:false}, [0xfb,0x00]);
|
|
206
206
|
});
|
|
207
207
|
|
|
208
208
|
describe('codecs.js => O3EInt32().decode()', () => {
|
|
209
|
-
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt32, 4, 'test1', {scale:10.0,signed:true
|
|
210
|
-
codecDecode('Positive Number, scale=10, signed=true ', (2**31-1)/10, E3.O3Ecodecs.O3EInt32, 4, 'test2', {scale:10.0,signed:true
|
|
211
|
-
codecDecode('Negative Number, scale=10, signed=true ', -(2**31)/10, E3.O3Ecodecs.O3EInt32, 4, 'test3', {scale:10.0,signed:true
|
|
212
|
-
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt32, 4, 'test4', {scale:1.0, signed:true
|
|
213
|
-
codecDecode('Positive Number, scale=10, signed=false', (2**32-1)/10, E3.O3Ecodecs.O3EInt32, 4, 'test5', {scale:10.0,signed:false
|
|
214
|
-
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt32, 4, 'test6', {scale:10.0,signed:false
|
|
209
|
+
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt32, 4, 'test1', {scale:10.0,signed:true}, [0x32,0x00,0x00,0x00]);
|
|
210
|
+
codecDecode('Positive Number, scale=10, signed=true ', (2**31-1)/10, E3.O3Ecodecs.O3EInt32, 4, 'test2', {scale:10.0,signed:true}, [0xff,0xff,0xff,0x7f]);
|
|
211
|
+
codecDecode('Negative Number, scale=10, signed=true ', -(2**31)/10, E3.O3Ecodecs.O3EInt32, 4, 'test3', {scale:10.0,signed:true}, [0x00,0x00,0x00,0x80]);
|
|
212
|
+
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt32, 4, 'test4', {scale:1.0, signed:true}, [0xfb,0xff,0xff,0xff]);
|
|
213
|
+
codecDecode('Positive Number, scale=10, signed=false', (2**32-1)/10, E3.O3Ecodecs.O3EInt32, 4, 'test5', {scale:10.0,signed:false}, [0xff,0xff,0xff,0xff]);
|
|
214
|
+
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt32, 4, 'test6', {scale:10.0,signed:false}, [0xfb,0x00,0x00,0x00]);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
describe('codecs.js => O3EInt64().decode()', () => {
|
|
218
|
+
codecDecode('Positive Number, scale=10, signed=true ', 5, E3.O3Ecodecs.O3EInt64, 8, 'test1', {scale:10.0,signed:true}, [0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00]);
|
|
219
|
+
codecDecode('Positive Number, scale=10, signed=true ', (2**63-1)/10, E3.O3Ecodecs.O3EInt64, 8, 'test2a', {scale:10.0,signed:true}, [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f]);
|
|
220
|
+
codecDecode('Positive Number, scale=10, signed=true ', (2**52-1)/10, E3.O3Ecodecs.O3EInt64, 8, 'test2b', {scale:10.0,signed:true}, [0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00]);
|
|
221
|
+
codecDecode('Negative Number, scale=10, signed=true ', -(2**63)/10, E3.O3Ecodecs.O3EInt64, 8, 'test3a', {scale:10.0,signed:true}, [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]);
|
|
222
|
+
codecDecode('Negative Number, scale=10, signed=true ', -(2**52-1)/10, E3.O3Ecodecs.O3EInt64, 8, 'test3b', {scale:10.0,signed:true}, [0x01,0x00,0x00,0x00,0x00,0x00,0xf0,0xff]);
|
|
223
|
+
codecDecode('Negative Number, scale= 1, signed=true ', -5, E3.O3Ecodecs.O3EInt64, 8, 'test4', {scale:1.0, signed:true}, [0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff]);
|
|
224
|
+
codecDecode('Positive Number, scale=10, signed=false', (2**64-1)/10, E3.O3Ecodecs.O3EInt64, 8, 'test5a', {scale:10.0,signed:false}, [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff]);
|
|
225
|
+
codecDecode('Positive Number, scale=10, signed=false', (2**52-1)/10, E3.O3Ecodecs.O3EInt64, 8, 'test5b', {scale:10.0,signed:false}, [0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00]);
|
|
226
|
+
codecDecode('Positive Number, scale=10, signed=false', 25.1, E3.O3Ecodecs.O3EInt64, 8, 'test6', {scale:10.0,signed:false}, [0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0x00]);
|
|
215
227
|
});
|
|
216
228
|
|
|
217
229
|
// Integer ENCODER:
|
|
218
230
|
describe('codecs.js => O3EInt8().encode()', () => {
|
|
219
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0x32], E3.O3Ecodecs.O3EInt8, 1, 'test1', {scale:10.0,signed:true
|
|
220
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0x7f], E3.O3Ecodecs.O3EInt8, 1, 'test2', {scale:10.0,signed:true
|
|
221
|
-
codecEncode('Negative Number, scale=10, signed=true ', [0x80], E3.O3Ecodecs.O3EInt8, 1, 'test3', {scale:10.0,signed:true
|
|
222
|
-
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb], E3.O3Ecodecs.O3EInt8, 1, 'test4', {scale:1.0, signed:true
|
|
223
|
-
codecEncode('Positive Number, scale=10, signed=false', [0xfb], E3.O3Ecodecs.O3EInt8, 1, 'test5', {scale:10.0,signed:false
|
|
231
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0x32], E3.O3Ecodecs.O3EInt8, 1, 'test1', {scale:10.0,signed:true}, 5);
|
|
232
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0x7f], E3.O3Ecodecs.O3EInt8, 1, 'test2', {scale:10.0,signed:true}, (2**7-1)/10);
|
|
233
|
+
codecEncode('Negative Number, scale=10, signed=true ', [0x80], E3.O3Ecodecs.O3EInt8, 1, 'test3', {scale:10.0,signed:true}, -(2**7)/10);
|
|
234
|
+
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb], E3.O3Ecodecs.O3EInt8, 1, 'test4', {scale:1.0, signed:true}, -5);
|
|
235
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xfb], E3.O3Ecodecs.O3EInt8, 1, 'test5', {scale:10.0,signed:false}, 25.1);
|
|
224
236
|
});
|
|
225
237
|
|
|
226
238
|
describe('codecs.js => O3EInt16().encode()', () => {
|
|
227
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0x32,0x00], E3.O3Ecodecs.O3EInt16, 2, 'test1', {scale:10.0,signed:true
|
|
228
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0xff,0x7f], E3.O3Ecodecs.O3EInt16, 2, 'test2', {scale:10.0,signed:true
|
|
229
|
-
codecEncode('Negative Number, scale=10, signed=true ', [0x00,0x80], E3.O3Ecodecs.O3EInt16, 2, 'test3', {scale:10.0,signed:true
|
|
230
|
-
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb,0xff], E3.O3Ecodecs.O3EInt16, 2, 'test4', {scale:1.0, signed:true
|
|
231
|
-
codecEncode('Positive Number, scale=10, signed=false', [0xff,0xff], E3.O3Ecodecs.O3EInt16, 2, 'test5', {scale:10.0,signed:false
|
|
232
|
-
codecEncode('Positive Number, scale=10, signed=false', [0xfb,0x00], E3.O3Ecodecs.O3EInt16, 2, 'test6', {scale:10.0,signed:false
|
|
239
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0x32,0x00], E3.O3Ecodecs.O3EInt16, 2, 'test1', {scale:10.0,signed:true}, 5);
|
|
240
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0xff,0x7f], E3.O3Ecodecs.O3EInt16, 2, 'test2', {scale:10.0,signed:true}, (2**15-1)/10);
|
|
241
|
+
codecEncode('Negative Number, scale=10, signed=true ', [0x00,0x80], E3.O3Ecodecs.O3EInt16, 2, 'test3', {scale:10.0,signed:true}, -(2**15)/10);
|
|
242
|
+
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb,0xff], E3.O3Ecodecs.O3EInt16, 2, 'test4', {scale:1.0, signed:true}, -5);
|
|
243
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xff,0xff], E3.O3Ecodecs.O3EInt16, 2, 'test5', {scale:10.0,signed:false}, (2**16-1)/10);
|
|
244
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xfb,0x00], E3.O3Ecodecs.O3EInt16, 2, 'test6', {scale:10.0,signed:false}, 25.1);
|
|
233
245
|
});
|
|
234
246
|
|
|
235
247
|
describe('codecs.js => O3EInt32().encode()', () => {
|
|
236
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0x32,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt32, 4, 'test1', {scale:10.0,signed:true
|
|
237
|
-
codecEncode('Positive Number, scale=10, signed=true ', [0xff,0xff,0xff,0x7f], E3.O3Ecodecs.O3EInt32, 4, 'test2', {scale:10.0,signed:true
|
|
238
|
-
codecEncode('Negative Number, scale=10, signed=true ', [0x00,0x00,0x00,0x80], E3.O3Ecodecs.O3EInt32, 4, 'test3', {scale:10.0,signed:true
|
|
239
|
-
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb,0xff,0xff,0xff], E3.O3Ecodecs.O3EInt32, 4, 'test4', {scale:1.0, signed:true
|
|
240
|
-
codecEncode('Positive Number, scale=10, signed=false', [0xff,0xff,0xff,0xff], E3.O3Ecodecs.O3EInt32, 4, 'test5', {scale:10.0,signed:false
|
|
241
|
-
codecEncode('Positive Number, scale=10, signed=false', [0xfb,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt32, 4, 'test6', {scale:10.0,signed:false
|
|
248
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0x32,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt32, 4, 'test1', {scale:10.0,signed:true}, 5);
|
|
249
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0xff,0xff,0xff,0x7f], E3.O3Ecodecs.O3EInt32, 4, 'test2', {scale:10.0,signed:true}, (2**31-1)/10);
|
|
250
|
+
codecEncode('Negative Number, scale=10, signed=true ', [0x00,0x00,0x00,0x80], E3.O3Ecodecs.O3EInt32, 4, 'test3', {scale:10.0,signed:true}, -(2**31)/10);
|
|
251
|
+
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb,0xff,0xff,0xff], E3.O3Ecodecs.O3EInt32, 4, 'test4', {scale:1.0, signed:true}, -5);
|
|
252
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xff,0xff,0xff,0xff], E3.O3Ecodecs.O3EInt32, 4, 'test5', {scale:10.0,signed:false}, (2**32-1)/10);
|
|
253
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xfb,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt32, 4, 'test6', {scale:10.0,signed:false}, 25.1);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
describe('codecs.js => O3EInt64().encode()', () => {
|
|
257
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt64, 8, 'test1', {scale:10.0,signed:true}, 5);
|
|
258
|
+
codecEncode('Positive Number, scale=10, signed=true ', [0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00], E3.O3Ecodecs.O3EInt64, 8, 'test2', {scale:10.0,signed:true}, (2**52-1)/10);
|
|
259
|
+
codecEncode('Negative Number, scale=10, signed=true ', [0x01,0x00,0x00,0x00,0x00,0x00,0xf0,0xff], E3.O3Ecodecs.O3EInt64, 8, 'test3', {scale:10.0,signed:true}, -(2**52-1)/10);
|
|
260
|
+
codecEncode('Negative Number, scale= 1, signed=true ', [0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff], E3.O3Ecodecs.O3EInt64, 8, 'test4', {scale:1.0, signed:true}, -5);
|
|
261
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00], E3.O3Ecodecs.O3EInt64, 8, 'test5', {scale:10.0,signed:false}, (2**52-1)/10);
|
|
262
|
+
codecEncode('Positive Number, scale=10, signed=false', [0xfb,0x00,0x00,0x00,0x00,0x00,0x00,0x00], E3.O3Ecodecs.O3EInt64, 8, 'test6', {scale:10.0,signed:false}, 25.1);
|
|
242
263
|
});
|
|
243
264
|
|
|
244
265
|
// Complex data structures
|