@zimo-elektronik/zcan 1.0.50 → 1.0.52
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/.prettierrc.json +3 -1
- package/__tests__/accessoriesGroup.test.ts +26 -26
- package/__tests__/connection.test.ts +52 -52
- package/__tests__/dataGroup.test.ts +82 -92
- package/__tests__/infoGroup.test.ts +18 -18
- package/__tests__/lanDataGroup.test.ts +54 -66
- package/__tests__/lanInfoGroup.test.ts +34 -34
- package/__tests__/lanLocoStateGroup.test.ts +17 -17
- package/__tests__/systemControlGroup.test.ts +36 -36
- package/__tests__/trackCfgGroup.test.ts +38 -38
- package/__tests__/vehicleGroup.test.ts +109 -110
- package/dist/common/models.d.ts +1 -12
- package/dist/info/infoGroup.d.ts +4 -7
- package/dist/info/infoGroup.js +27 -30
- package/dist/info/infoGroup.js.map +1 -1
- package/dist/info/infoMsg.d.ts +11 -0
- package/dist/info/infoMsg.js +30 -0
- package/dist/info/infoMsg.js.map +1 -1
- package/package.json +1 -1
- package/src/common/models.ts +11 -11
- package/src/info/infoGroup.ts +50 -38
- package/src/info/infoMsg.ts +42 -0
package/.prettierrc.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {createMX10, initConnection} from './util';
|
|
2
2
|
import {afterAll, beforeAll, describe, expect, it} from '@jest/globals';
|
|
3
|
-
import {AccessoryMode
|
|
3
|
+
import {AccessoryMode} from '../src';
|
|
4
4
|
|
|
5
5
|
describe('Accessories group tests - 0x01', () => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const mx10 = createMX10(true);
|
|
7
|
+
const nid = 0x300a; // nid:10
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
await initConnection(mx10);
|
|
11
|
+
});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
afterAll(() => {
|
|
14
|
+
mx10.closeSocket();
|
|
15
|
+
});
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
it('0x01 - Accessory Mode test', () => {
|
|
18
|
+
mx10.accessoryCommand.accessoryModeByNid(nid);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const test = mx10.accessoryCommand.onAccessoryMode.subscribe((data) => {
|
|
21
|
+
expect(data.nid).toBe(nid);
|
|
22
|
+
expect(data.mode).toBeDefined();
|
|
23
|
+
expect(data.mode).toBe(AccessoryMode.PAIRED);
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
test.unsubscribe();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
it('0x02 - Accessory Port test', async () => {
|
|
30
|
+
mx10.accessoryCommand.accessoryPortByNid(nid);
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const test = mx10.accessoryCommand.onAccessoryPort.subscribe((data) => {
|
|
33
|
+
expect(data.nid).toBe(nid);
|
|
34
|
+
expect(data.port).toBeDefined();
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
test.unsubscribe();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
39
|
});
|
|
@@ -3,56 +3,56 @@ import {afterAll, beforeAll, it, jest, describe, expect} from "@jest/globals";
|
|
|
3
3
|
import {createMX10, initConnection} from "./util";
|
|
4
4
|
|
|
5
5
|
describe('High level tests', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
6
|
+
const mx10 = createMX10(true);
|
|
7
|
+
const debug = global.console.debug;
|
|
8
|
+
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
mx10.closeSocket()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
beforeAll(() => {
|
|
14
|
+
global.console.debug = jest.fn();
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
afterAll(() => {
|
|
18
|
+
global.console.debug = debug;
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it("Correct url test", async () => {
|
|
22
|
+
expect(mx10.connected).toBe(false);
|
|
23
|
+
|
|
24
|
+
return initConnection(mx10).then(() => {
|
|
25
|
+
expect(mx10.connected).toBe(true);
|
|
26
|
+
|
|
27
|
+
mx10.closeSocket();
|
|
28
|
+
expect(mx10.connected).toBe(false);
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("Incorrect url test", async () => {
|
|
33
|
+
expect(mx10.connected).toBe(false);
|
|
34
|
+
const res = mx10.initSocket(createSocket, "192.168.2.145");
|
|
35
|
+
await expect(res).rejects.toThrow('mx10.connection.timeout')
|
|
36
|
+
|
|
37
|
+
expect(mx10.connected).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("Error logger test", (done) => {
|
|
41
|
+
mx10.logError.subscribe((error: string) => {
|
|
42
|
+
expect(error).toBe('mx10.connection.not_connected')
|
|
43
|
+
done();
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
mx10.network.ping();
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it("Incorrect data format", () => {
|
|
50
|
+
expect(() => {
|
|
51
|
+
mx10.sendData(0x00, 0x00, [
|
|
52
|
+
{length: 1, value: 1,},
|
|
53
|
+
{length: 4, value: 1234,},
|
|
54
|
+
{length: 8, value: 0,}
|
|
55
|
+
])
|
|
56
|
+
}).toThrow(/ELEMENT LENGTH NOT DEFINED.*/)
|
|
57
|
+
})
|
|
58
58
|
});
|
|
@@ -1,98 +1,88 @@
|
|
|
1
1
|
import {createMX10, initConnection} from './util';
|
|
2
2
|
import {afterAll, beforeAll, describe, expect, it} from '@jest/globals';
|
|
3
3
|
import {firstValueFrom} from 'rxjs';
|
|
4
|
-
import {
|
|
4
|
+
import {FxConfigType, ImageType, NameType} from '../src';
|
|
5
5
|
|
|
6
6
|
describe('Data group tests - 0x07', () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
{name: 'dodo1'},
|
|
89
|
-
])('0x21 - Data name extended test', async ({name}) => {
|
|
90
|
-
mx10.data.dataNameExtended(3, 0, name);
|
|
91
|
-
|
|
92
|
-
const data = await firstValueFrom(mx10.data.onDataNameExtended);
|
|
93
|
-
expect(data.nid).toBe(3);
|
|
94
|
-
expect(data.type).toBe(NameType.VEHICLE);
|
|
95
|
-
expect(data.value1).toBe(undefined);
|
|
96
|
-
expect(data.name).toBe(name);
|
|
97
|
-
});
|
|
7
|
+
const mx10 = createMX10(true);
|
|
8
|
+
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
await initConnection(mx10);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
afterAll(() => {
|
|
14
|
+
mx10.closeSocket();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('0x00 - Group count test', async () => {
|
|
18
|
+
const msg = await mx10.data.groupCount();
|
|
19
|
+
expect(msg).toBeDefined();
|
|
20
|
+
expect(msg?.group()).toBe(0x0000);
|
|
21
|
+
expect(msg?.count()).toBeDefined();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('0x01 - List item by index test', async () => {
|
|
25
|
+
const msg = await mx10.data.listItemsByIndex(0x0000, 3);
|
|
26
|
+
|
|
27
|
+
expect(msg).toBeDefined();
|
|
28
|
+
expect(msg?.index()).toBe(3);
|
|
29
|
+
expect(msg?.itemNid()).toBe(4);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('0x02 - List item by nid test', async () => {
|
|
33
|
+
mx10.data.listItemsByNID(3);
|
|
34
|
+
|
|
35
|
+
const data = await firstValueFrom(mx10.data.onListItemsByNID);
|
|
36
|
+
expect(data.nid).toBe(65535);
|
|
37
|
+
expect(data.index).toBe(65535);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('0x1f - Remove locomotive with nid', async () => {
|
|
41
|
+
mx10.data.removeLocomotive(3);
|
|
42
|
+
|
|
43
|
+
const data = await firstValueFrom(mx10.data.onRemoveLocomotive);
|
|
44
|
+
expect(data.nid).toBe(3);
|
|
45
|
+
expect(data.state).toBeDefined();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('0x12 - Image config test', async () => {
|
|
49
|
+
const promise = firstValueFrom(mx10.data.onItemImageConfig).then((data) => {
|
|
50
|
+
expect(data.itemNid()).toBe(3);
|
|
51
|
+
expect(data.imageType()).toBe(ImageType.VEHICLE);
|
|
52
|
+
expect(data.imageId()).toBe(6055);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
mx10.data.itemImageConfig(3, ImageType.VEHICLE, 6055);
|
|
56
|
+
|
|
57
|
+
return promise;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test.each<{icon: number; fx: number}>([
|
|
61
|
+
{icon: 755, fx: 1},
|
|
62
|
+
{icon: 756, fx: 1},
|
|
63
|
+
{icon: 700, fx: 1},
|
|
64
|
+
])('0x15 - Function image change test', async ({icon, fx}) => {
|
|
65
|
+
const promise = firstValueFrom(mx10.data.onItemFxConfig).then((data) => {
|
|
66
|
+
expect(data.nid).toBe(3);
|
|
67
|
+
expect(data.function).toBe(fx);
|
|
68
|
+
expect(data.item).toBe(FxConfigType.ICON);
|
|
69
|
+
expect(data.data).toBe(icon);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
mx10.data.itemFxConfig(3, fx, FxConfigType.ICON, icon);
|
|
73
|
+
|
|
74
|
+
return promise;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test.each<{name: string}>([
|
|
78
|
+
{name: '---'},
|
|
79
|
+
{name: 'teßt Öf a näme'},
|
|
80
|
+
{name: 'dodo1'},
|
|
81
|
+
])('0x21 - Data name extended test', async ({name}) => {
|
|
82
|
+
const msg = await mx10.data.setName(3, 0, name);
|
|
83
|
+
expect(msg).toBeDefined();
|
|
84
|
+
expect(msg?.itemNid()).toBe(3);
|
|
85
|
+
expect(msg?.type()).toBe(NameType.VEHICLE);
|
|
86
|
+
expect(msg?.name()).toBe(name);
|
|
87
|
+
});
|
|
98
88
|
});
|
|
@@ -2,29 +2,29 @@ import {createMX10, initConnection} from "./util";
|
|
|
2
2
|
import {afterAll, beforeAll, expect, it} from "@jest/globals";
|
|
3
3
|
|
|
4
4
|
describe('Info group tests - 0x08', () => {
|
|
5
|
-
|
|
5
|
+
const mx10 = createMX10();
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
beforeAll(async () => {
|
|
8
|
+
await initConnection(mx10)
|
|
9
|
+
})
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
afterAll(() => {
|
|
12
|
+
mx10.closeSocket();
|
|
13
|
+
})
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
it("0x05 - Bidi info - train speed", (done) => {
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const sub = mx10.info.onBidiInfoChange.subscribe((msg) => {
|
|
18
|
+
if (msg.type() === 0x0100) {
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
expect(msg.nid()).toBe(3);
|
|
21
|
+
expect(msg.info()).toBeDefined();
|
|
22
|
+
expect(msg.info()).toBeGreaterThanOrEqual(0);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
done();
|
|
25
|
+
sub.unsubscribe();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
29
|
|
|
30
30
|
});
|
|
@@ -1,82 +1,70 @@
|
|
|
1
1
|
import {createMX10, initConnection} from './util';
|
|
2
2
|
import {afterAll, beforeAll, describe, it, expect} from '@jest/globals';
|
|
3
3
|
import {firstValueFrom} from 'rxjs';
|
|
4
|
-
import {
|
|
5
|
-
DataValueExtendedData,
|
|
6
|
-
LocoGuiMXExtended,
|
|
7
|
-
LocoSpeedTabExtended,
|
|
8
|
-
OperatingMode,
|
|
9
|
-
Train,
|
|
10
|
-
} from '../src';
|
|
4
|
+
import {DataValueExtendedData, LocoSpeedTabExtended, OperatingMode} from '../src';
|
|
11
5
|
|
|
12
6
|
describe('LAN Data group tests - 0x17', () => {
|
|
13
|
-
|
|
7
|
+
const mx10 = createMX10();
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
await initConnection(mx10);
|
|
11
|
+
});
|
|
18
12
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
afterAll(() => {
|
|
14
|
+
mx10.closeSocket();
|
|
15
|
+
});
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
// it('0x27 - Loco GUI eXtended', async () => {
|
|
18
|
+
// const msg = await mx10.lanData.getLocoGuiExtended(211);
|
|
19
|
+
// expect(msg).toBeDefined();
|
|
20
|
+
// expect(msg?.locoNid()).toBe(211);
|
|
21
|
+
// // expect(msg.name()).toMatch('import loco');
|
|
22
|
+
// expect(msg?.era()).toBeDefined();
|
|
23
|
+
// expect(msg?.functions()).toBeDefined();
|
|
24
|
+
// });
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
26
|
+
it('0x28 - Loco GUI eXtended', async () => {
|
|
27
|
+
const msg = await mx10.lanData.getLocoGuiExtended(211);
|
|
28
|
+
expect(msg).toBeDefined();
|
|
29
|
+
expect(msg?.locoNid()).toBe(211);
|
|
30
|
+
expect(msg?.functions()).toBeDefined();
|
|
31
|
+
});
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
it('0x19 - Loco Speed Tab eXtended', async () => {
|
|
34
|
+
mx10.lanData.locoSpeedTapExtended(42);
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const locoSpeedTab: LocoSpeedTabExtended = await firstValueFrom(
|
|
37
|
+
mx10.lanData.onLocoSpeedTabExtended,
|
|
38
|
+
);
|
|
39
|
+
expect(locoSpeedTab).toBeDefined();
|
|
40
|
+
expect(locoSpeedTab.nid).toBe(42);
|
|
41
|
+
expect(locoSpeedTab.dbat6).toBe(1);
|
|
42
|
+
if (locoSpeedTab.dbat6 === 5) {
|
|
43
|
+
expect(locoSpeedTab.speedTab).toBeDefined();
|
|
44
|
+
expect(locoSpeedTab.speedTab).toHaveLength(4);
|
|
45
|
+
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// mx10.sendData(0x02, 0x01, [{value: 56, length: 2}]);
|
|
48
|
+
// expect(train.era).toBeDefined();
|
|
49
|
+
// expect(train.functions).toBeDefined();
|
|
50
|
+
});
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
);
|
|
51
|
-
expect(locoSpeedTab).toBeDefined();
|
|
52
|
-
expect(locoSpeedTab.nid).toBe(42);
|
|
53
|
-
expect(locoSpeedTab.dbat6).toBe(1);
|
|
54
|
-
if (locoSpeedTab.dbat6 === 5) {
|
|
55
|
-
expect(locoSpeedTab.speedTab).toBeDefined();
|
|
56
|
-
expect(locoSpeedTab.speedTab).toHaveLength(4);
|
|
57
|
-
}
|
|
52
|
+
it('0x8 - Data Value eXtended', async () => {
|
|
53
|
+
mx10.lanData.dataValueExtended(211);
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
55
|
+
const data: DataValueExtendedData = await firstValueFrom(
|
|
56
|
+
mx10.lanData.onDataValueExtended,
|
|
57
|
+
);
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
expect(data.operatingMode).toBe(OperatingMode.DCC);
|
|
76
|
-
expect(data.speedStep).toBeDefined();
|
|
77
|
-
expect(data.forward).toBeDefined();
|
|
78
|
-
expect(data.emergencyStop).toBeDefined();
|
|
79
|
-
expect(data.functionsStates).toBeDefined();
|
|
80
|
-
expect(data.flags.deleted).toBe(false);
|
|
81
|
-
});
|
|
59
|
+
expect(data).toBeDefined();
|
|
60
|
+
expect(data.nid).toBe(211);
|
|
61
|
+
expect(data.functionCount).toBeDefined();
|
|
62
|
+
expect(data.operatingMode).toBeDefined();
|
|
63
|
+
expect(data.operatingMode).toBe(OperatingMode.DCC);
|
|
64
|
+
expect(data.speedStep).toBeDefined();
|
|
65
|
+
expect(data.forward).toBeDefined();
|
|
66
|
+
expect(data.emergencyStop).toBeDefined();
|
|
67
|
+
expect(data.functionsStates).toBeDefined();
|
|
68
|
+
expect(data.flags.deleted).toBe(false);
|
|
69
|
+
});
|
|
82
70
|
});
|
|
@@ -3,39 +3,39 @@ import {afterAll, beforeAll, it, describe, expect} from "@jest/globals";
|
|
|
3
3
|
import {TrackMode} from "../src";
|
|
4
4
|
|
|
5
5
|
describe('LAN Info group tests - 0x18', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
6
|
+
const mx10 = createMX10();
|
|
7
|
+
|
|
8
|
+
beforeAll(async () => {
|
|
9
|
+
await initConnection(mx10)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
afterAll(() => {
|
|
13
|
+
mx10.closeSocket();
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it("0x00 - module power info", (done) => {
|
|
17
|
+
const sub = mx10.lanInfo.onModulePowerInfo.subscribe((data) => {
|
|
18
|
+
if (data.deviceNID === mx10.mx10NID) {
|
|
19
|
+
|
|
20
|
+
expect(data.port1Status).toBeDefined();
|
|
21
|
+
expect(data.port1Status).toBe(TrackMode.NORMAL);
|
|
22
|
+
expect(data.port1Voltage).toBeDefined();
|
|
23
|
+
expect(data.port1Amperage).toBeDefined();
|
|
24
|
+
|
|
25
|
+
expect(data.port2Status).toBeDefined();
|
|
26
|
+
expect(data.port2Status).toBe(TrackMode.NORMAL);
|
|
27
|
+
expect(data.port2Voltage).toBeDefined();
|
|
28
|
+
expect(data.port2Amperage).toBeDefined();
|
|
29
|
+
|
|
30
|
+
expect(data.amperage32V).toBeDefined();
|
|
31
|
+
expect(data.amperage12V).toBeDefined();
|
|
32
|
+
expect(data.voltageTotal).toBeDefined();
|
|
33
|
+
expect(data.temperature).toBeDefined();
|
|
34
|
+
|
|
35
|
+
sub.unsubscribe();
|
|
36
|
+
done();
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
40
|
|
|
41
41
|
});
|