@packtrack/layout 1.2.0 → 1.3.0
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/.built/index.d.ts +20 -20
- package/.built/index.js +20 -20
- package/.built/source/device/channel.d.ts +2 -2
- package/.built/source/device/channel.js +4 -8
- package/.built/source/device/index.d.ts +10 -0
- package/.built/source/device/index.js +8 -0
- package/.built/source/district.d.ts +3 -7
- package/.built/source/district.js +4 -70
- package/.built/source/layout.d.ts +9 -6
- package/.built/source/layout.js +85 -86
- package/.built/source/monitor.d.ts +8 -0
- package/.built/source/monitor.js +8 -0
- package/.built/source/position.d.ts +3 -1
- package/.built/source/position.js +17 -5
- package/.built/source/positioner/index.d.ts +2 -0
- package/.built/source/positioner/index.js +2 -0
- package/.built/source/positioner/point.d.ts +12 -0
- package/.built/source/positioner/point.js +17 -0
- package/.built/source/positioner/responder-type.d.ts +4 -0
- package/.built/source/positioner/responder-type.js +6 -0
- package/.built/source/power-district/activator.d.ts +7 -0
- package/.built/source/power-district/activator.js +8 -0
- package/.built/source/power-district/index.d.ts +13 -0
- package/.built/source/power-district/index.js +14 -0
- package/.built/source/power-district/monitor.d.ts +7 -0
- package/.built/source/power-district/monitor.js +8 -0
- package/.built/source/power-district/reverser.d.ts +7 -0
- package/.built/source/power-district/reverser.js +8 -0
- package/.built/source/route.d.ts +0 -1
- package/.built/source/route.js +1 -8
- package/.built/source/router.d.ts +0 -4
- package/.built/source/router.js +1 -28
- package/.built/source/section.d.ts +1 -10
- package/.built/source/section.js +8 -57
- package/.built/source/span.d.ts +12 -0
- package/.built/source/span.js +77 -0
- package/.built/source/throttle.d.ts +8 -0
- package/.built/source/throttle.js +8 -0
- package/.built/source/tile.js +2 -7
- package/.built/source/track.d.ts +1 -2
- package/.built/source/track.js +3 -10
- package/index.ts +23 -0
- package/package.json +4 -4
- package/source/device/channel.ts +4 -4
- package/source/device/index.ts +2 -19
- package/source/district.ts +1 -80
- package/source/layout.ts +1 -63
- package/source/monitor.ts +1 -10
- package/source/positioner/point.ts +2 -11
- package/source/positioner/responder-type.ts +1 -5
- package/source/power-district/index.ts +0 -5
- package/source/route.ts +2 -6
- package/source/router.ts +2 -31
- package/source/section.ts +10 -65
- package/source/throttle.ts +1 -10
- package/source/track.ts +3 -7
- package/tsconfig.json +7 -8
- package/source/index.ts +0 -23
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Positioner } from "./index";
|
|
2
|
+
import { Channel } from "../device/channel";
|
|
3
|
+
import { Track } from "../track";
|
|
4
|
+
import { ResponderType } from "./responder-type";
|
|
5
|
+
export declare class PointPositioner extends Positioner {
|
|
6
|
+
track: Track;
|
|
7
|
+
offset: number;
|
|
8
|
+
channel: Channel;
|
|
9
|
+
responder: ResponderType;
|
|
10
|
+
constructor(track: Track, offset: number, channel: Channel, responder: ResponderType);
|
|
11
|
+
get position(): import("../position").SectionPosition;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Positioner } from "./index";
|
|
2
|
+
export class PointPositioner extends Positioner {
|
|
3
|
+
track;
|
|
4
|
+
offset;
|
|
5
|
+
channel;
|
|
6
|
+
responder;
|
|
7
|
+
constructor(track, offset, channel, responder) {
|
|
8
|
+
super();
|
|
9
|
+
this.track = track;
|
|
10
|
+
this.offset = offset;
|
|
11
|
+
this.channel = channel;
|
|
12
|
+
this.responder = responder;
|
|
13
|
+
}
|
|
14
|
+
get position() {
|
|
15
|
+
return this.track.head.advance(this.offset);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PowerDistrictActivator } from "./activator";
|
|
2
|
+
import { District } from "../district";
|
|
3
|
+
import { PowerDistrictMonitor } from "./monitor";
|
|
4
|
+
import { PowerDistrictReverser } from "./reverser";
|
|
5
|
+
export declare class PowerDistrict {
|
|
6
|
+
name: string;
|
|
7
|
+
district: District;
|
|
8
|
+
activator?: PowerDistrictActivator;
|
|
9
|
+
reverser?: PowerDistrictReverser;
|
|
10
|
+
monitor?: PowerDistrictMonitor;
|
|
11
|
+
constructor(name: string, district: District);
|
|
12
|
+
get domainName(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class PowerDistrict {
|
|
2
|
+
name;
|
|
3
|
+
district;
|
|
4
|
+
activator;
|
|
5
|
+
reverser;
|
|
6
|
+
monitor;
|
|
7
|
+
constructor(name, district) {
|
|
8
|
+
this.name = name;
|
|
9
|
+
this.district = district;
|
|
10
|
+
}
|
|
11
|
+
get domainName() {
|
|
12
|
+
return `${this.name}.${this.district.domainName}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/.built/source/route.d.ts
CHANGED
package/.built/source/route.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Route = void 0;
|
|
4
|
-
class Route {
|
|
1
|
+
export class Route {
|
|
5
2
|
name;
|
|
6
3
|
router;
|
|
7
4
|
in;
|
|
@@ -10,8 +7,4 @@ class Route {
|
|
|
10
7
|
this.name = name;
|
|
11
8
|
this.router = router;
|
|
12
9
|
}
|
|
13
|
-
dump() {
|
|
14
|
-
console.log(`Route ${this.name}: ${this.in.domainName} → ${this.out.domainName}`);
|
|
15
|
-
}
|
|
16
10
|
}
|
|
17
|
-
exports.Route = Route;
|
package/.built/source/router.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Router = void 0;
|
|
4
|
-
class Router {
|
|
1
|
+
export class Router {
|
|
5
2
|
name;
|
|
6
3
|
district;
|
|
7
4
|
activeRoute;
|
|
@@ -13,28 +10,4 @@ class Router {
|
|
|
13
10
|
get domainName() {
|
|
14
11
|
return `${this.name}.${this.district.domainName}`;
|
|
15
12
|
}
|
|
16
|
-
dump() {
|
|
17
|
-
console.group(`Router ${this.domainName}`);
|
|
18
|
-
for (let route of this.routes) {
|
|
19
|
-
route.dump();
|
|
20
|
-
}
|
|
21
|
-
console.groupEnd();
|
|
22
|
-
}
|
|
23
|
-
toDotReference() {
|
|
24
|
-
return `router_${this.name.replace(/-/g, '_')}_${this.district.toDotReference()}`;
|
|
25
|
-
}
|
|
26
|
-
toDotDefinition() {
|
|
27
|
-
return `
|
|
28
|
-
${this.toDotReference()} [ label = ${JSON.stringify(this.name)}, shape = diamond ]
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
31
|
-
toDotConnection() {
|
|
32
|
-
return `
|
|
33
|
-
${this.routes.map(route => `
|
|
34
|
-
${route.in.toDotReference()} -> ${this.toDotReference()} [ headlabel = ${JSON.stringify(route.name)} ]
|
|
35
|
-
${this.toDotReference()} -> ${route.out.toDotReference()} [ taillabel = ${JSON.stringify(route.name)} ]
|
|
36
|
-
`).join('')}
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
13
|
}
|
|
40
|
-
exports.Router = Router;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { District } from "./district";
|
|
2
2
|
import { SectionPosition } from "./position";
|
|
3
|
-
import { PowerDistrict } from "./power-district";
|
|
3
|
+
import { PowerDistrict } from "./power-district/index";
|
|
4
4
|
import { Router } from "./router";
|
|
5
5
|
import { Tile } from "./tile";
|
|
6
6
|
import { Track } from "./track";
|
|
@@ -22,19 +22,10 @@ export declare class Section {
|
|
|
22
22
|
};
|
|
23
23
|
tiles: Tile[];
|
|
24
24
|
};
|
|
25
|
-
dump(): void;
|
|
26
25
|
get length(): number;
|
|
27
26
|
get tileLength(): number;
|
|
28
27
|
trail(offset: number, reversed: boolean, length: number): {
|
|
29
28
|
sections: Section[];
|
|
30
29
|
tip: SectionPosition;
|
|
31
30
|
};
|
|
32
|
-
toDotReference(): string;
|
|
33
|
-
toDotDefinition(): string;
|
|
34
|
-
toDotConnection(): string;
|
|
35
|
-
toSVG(): string;
|
|
36
|
-
findSVGPositions(): {
|
|
37
|
-
x: number;
|
|
38
|
-
y: number;
|
|
39
|
-
}[];
|
|
40
31
|
}
|
package/.built/source/section.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const position_1 = require("./position");
|
|
5
|
-
const router_1 = require("./router");
|
|
6
|
-
class Section {
|
|
1
|
+
import { SectionPosition } from "./position";
|
|
2
|
+
import { Router } from "./router";
|
|
3
|
+
export class Section {
|
|
7
4
|
name;
|
|
8
5
|
district;
|
|
9
6
|
powerDistrict;
|
|
@@ -27,7 +24,7 @@ class Section {
|
|
|
27
24
|
if (this.in instanceof Section) {
|
|
28
25
|
return this.in;
|
|
29
26
|
}
|
|
30
|
-
if (this.in instanceof
|
|
27
|
+
if (this.in instanceof Router) {
|
|
31
28
|
const activeRoute = this.in.activeRoute;
|
|
32
29
|
if (!activeRoute) {
|
|
33
30
|
throw new Error(`Router '${this.in.domainName}' has no active route`);
|
|
@@ -48,7 +45,7 @@ class Section {
|
|
|
48
45
|
if (this.out instanceof Section) {
|
|
49
46
|
return this.out;
|
|
50
47
|
}
|
|
51
|
-
if (this.out instanceof
|
|
48
|
+
if (this.out instanceof Router) {
|
|
52
49
|
const activeRoute = this.out.activeRoute;
|
|
53
50
|
if (!activeRoute) {
|
|
54
51
|
throw new Error(`Router '${this.out.domainName}' has no active route`);
|
|
@@ -113,17 +110,6 @@ class Section {
|
|
|
113
110
|
tiles
|
|
114
111
|
};
|
|
115
112
|
}
|
|
116
|
-
dump() {
|
|
117
|
-
console.group(`Section ${this.domainName}`);
|
|
118
|
-
console.log('in', this.in?.name ?? 'buffer');
|
|
119
|
-
console.log('out', this.out?.name ?? 'buffer');
|
|
120
|
-
console.group(`tracks`);
|
|
121
|
-
for (let track of this.tracks) {
|
|
122
|
-
track.dump();
|
|
123
|
-
}
|
|
124
|
-
console.groupEnd();
|
|
125
|
-
console.groupEnd();
|
|
126
|
-
}
|
|
127
113
|
get length() {
|
|
128
114
|
return this.tracks.reduce((accumulator, track) => accumulator + track.length, 0);
|
|
129
115
|
}
|
|
@@ -153,13 +139,13 @@ class Section {
|
|
|
153
139
|
if (!next) {
|
|
154
140
|
return {
|
|
155
141
|
sections,
|
|
156
|
-
tip: new
|
|
142
|
+
tip: new SectionPosition(tip, tip.length, false)
|
|
157
143
|
};
|
|
158
144
|
}
|
|
159
145
|
if (next instanceof Section) {
|
|
160
146
|
tip = next;
|
|
161
147
|
}
|
|
162
|
-
if (next instanceof
|
|
148
|
+
if (next instanceof Router) {
|
|
163
149
|
if (!next.activeRoute) {
|
|
164
150
|
throw new Error(`Router '${next.domainName}' has no active route (routes: ${next.routes.map(route => `'${route.name}'`).join(', ')})`);
|
|
165
151
|
}
|
|
@@ -176,42 +162,7 @@ class Section {
|
|
|
176
162
|
}
|
|
177
163
|
return {
|
|
178
164
|
sections,
|
|
179
|
-
tip: new
|
|
165
|
+
tip: new SectionPosition(tip, reversed ? -length : tip.length + length, false)
|
|
180
166
|
};
|
|
181
167
|
}
|
|
182
|
-
toDotReference() {
|
|
183
|
-
return `section_${this.name.replace(/-/g, '_')}_${this.district.toDotReference()}`;
|
|
184
|
-
}
|
|
185
|
-
toDotDefinition() {
|
|
186
|
-
return `
|
|
187
|
-
${this.toDotReference()} [ label = ${JSON.stringify(`${this.name}\n${this.length}`)}, shape = box ]
|
|
188
|
-
`;
|
|
189
|
-
}
|
|
190
|
-
toDotConnection() {
|
|
191
|
-
return `
|
|
192
|
-
${this.out instanceof Section ? `${this.toDotReference()} -> ${this.out.toDotReference()}` : ''}
|
|
193
|
-
`;
|
|
194
|
-
}
|
|
195
|
-
toSVG() {
|
|
196
|
-
return `
|
|
197
|
-
<g id=${JSON.stringify(this.domainName).split('.').join('_')}>
|
|
198
|
-
<style>
|
|
199
|
-
|
|
200
|
-
g#${this.domainName.split('.').join('_')} path {
|
|
201
|
-
stroke: hsl(${(this.length / this.tileLength)}deg, 100%, 50%);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
</style>
|
|
205
|
-
|
|
206
|
-
${this.tiles.map(tile => tile.toSVG()).join('')}
|
|
207
|
-
</g>
|
|
208
|
-
`;
|
|
209
|
-
}
|
|
210
|
-
findSVGPositions() {
|
|
211
|
-
return this.tiles.map(tile => ({
|
|
212
|
-
x: tile.x,
|
|
213
|
-
y: tile.y
|
|
214
|
-
}));
|
|
215
|
-
}
|
|
216
168
|
}
|
|
217
|
-
exports.Section = Section;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SectionPosition } from "./position";
|
|
2
|
+
import { Section } from "./section";
|
|
3
|
+
export declare class Span {
|
|
4
|
+
head: SectionPosition;
|
|
5
|
+
inside: Section[];
|
|
6
|
+
tail: SectionPosition;
|
|
7
|
+
constructor(head: SectionPosition, inside: Section[], tail: SectionPosition);
|
|
8
|
+
contains(position: SectionPosition): boolean;
|
|
9
|
+
overlap(peer: Span): boolean;
|
|
10
|
+
get length(): number;
|
|
11
|
+
static trail(start: SectionPosition, end: SectionPosition): Span;
|
|
12
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export class Span {
|
|
2
|
+
head;
|
|
3
|
+
inside;
|
|
4
|
+
tail;
|
|
5
|
+
constructor(head, inside, tail) {
|
|
6
|
+
this.head = head;
|
|
7
|
+
this.inside = inside;
|
|
8
|
+
this.tail = tail;
|
|
9
|
+
}
|
|
10
|
+
// TODO verify reverse
|
|
11
|
+
contains(position) {
|
|
12
|
+
if (this.inside.includes(position.section)) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (position.section == this.head.section) {
|
|
16
|
+
if (this.head.reversed) {
|
|
17
|
+
if (this.head.absolutePosition > position.absolutePosition) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (this.head.offset < position.absolutePosition) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (position.section == this.tail.section) {
|
|
28
|
+
if (this.tail.reversed) {
|
|
29
|
+
if (this.tail.absolutePosition < position.absolutePosition) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (this.tail.offset > position.absolutePosition) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
overlap(peer) {
|
|
42
|
+
return this.contains(peer.head) || this.contains(peer.tail);
|
|
43
|
+
}
|
|
44
|
+
get length() {
|
|
45
|
+
let length = 0;
|
|
46
|
+
if (this.head.reversed) {
|
|
47
|
+
length += this.head.section.length - this.head.offset;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
length += this.head.offset;
|
|
51
|
+
}
|
|
52
|
+
for (let section of this.inside) {
|
|
53
|
+
length += section.length;
|
|
54
|
+
}
|
|
55
|
+
if (this.tail.reversed) {
|
|
56
|
+
length += this.tail.section.length - this.tail.offset;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
length += this.tail.offset;
|
|
60
|
+
}
|
|
61
|
+
return length;
|
|
62
|
+
}
|
|
63
|
+
// TODO verify reverse
|
|
64
|
+
// TODO add efficient algo
|
|
65
|
+
static trail(start, end) {
|
|
66
|
+
let head = start;
|
|
67
|
+
const sections = [];
|
|
68
|
+
const increment = 1;
|
|
69
|
+
while (head.section != end.section) {
|
|
70
|
+
head = head.advance(increment);
|
|
71
|
+
if (head.section != start.section && head.section != end.section && !sections.includes(head.section)) {
|
|
72
|
+
sections.push(head.section);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return new Span(start, sections, end);
|
|
76
|
+
}
|
|
77
|
+
}
|
package/.built/source/tile.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Tile = exports.TilePattern = void 0;
|
|
4
|
-
class TilePattern {
|
|
1
|
+
export class TilePattern {
|
|
5
2
|
length;
|
|
6
3
|
path;
|
|
7
4
|
// TODO: replace simple paths with rounded versions
|
|
@@ -53,8 +50,7 @@ class TilePattern {
|
|
|
53
50
|
this.path = path;
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
class Tile {
|
|
53
|
+
export class Tile {
|
|
58
54
|
section;
|
|
59
55
|
x;
|
|
60
56
|
y;
|
|
@@ -75,4 +71,3 @@ class Tile {
|
|
|
75
71
|
`;
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
|
-
exports.Tile = Tile;
|
package/.built/source/track.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Positioner } from "
|
|
1
|
+
import { Positioner } from "./positioner/index";
|
|
2
2
|
import { Section } from "./section";
|
|
3
3
|
import { SectionPosition } from "./position";
|
|
4
4
|
export declare class Track {
|
|
@@ -8,5 +8,4 @@ export declare class Track {
|
|
|
8
8
|
positioners: Positioner[];
|
|
9
9
|
constructor(section: Section, length: number, path: string);
|
|
10
10
|
get head(): SectionPosition;
|
|
11
|
-
dump(): void;
|
|
12
11
|
}
|
package/.built/source/track.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Track = void 0;
|
|
4
|
-
const position_1 = require("./position");
|
|
5
|
-
class Track {
|
|
1
|
+
import { SectionPosition } from "./position";
|
|
2
|
+
export class Track {
|
|
6
3
|
section;
|
|
7
4
|
length;
|
|
8
5
|
path;
|
|
@@ -17,13 +14,9 @@ class Track {
|
|
|
17
14
|
let offset = 0;
|
|
18
15
|
for (let track of this.section.tracks) {
|
|
19
16
|
if (track == this) {
|
|
20
|
-
return new
|
|
17
|
+
return new SectionPosition(this.section, offset, false);
|
|
21
18
|
}
|
|
22
19
|
offset += track.length;
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
dump() {
|
|
26
|
-
console.log(this.length);
|
|
27
|
-
}
|
|
28
22
|
}
|
|
29
|
-
exports.Track = Track;
|
package/index.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from './source/district';
|
|
2
|
+
export * from './source/layout';
|
|
3
|
+
export * from './source/position';
|
|
4
|
+
export * from './source/route';
|
|
5
|
+
export * from './source/router';
|
|
6
|
+
export * from './source/section';
|
|
7
|
+
export * from './source/span';
|
|
8
|
+
export * from './source/tile';
|
|
9
|
+
export * from './source/track';
|
|
10
|
+
export * from './source/monitor';
|
|
11
|
+
export * from './source/throttle';
|
|
12
|
+
|
|
13
|
+
export * from './source/power-district/index';
|
|
14
|
+
export * from './source/power-district/activator';
|
|
15
|
+
export * from './source/power-district/monitor';
|
|
16
|
+
export * from './source/power-district/reverser';
|
|
17
|
+
|
|
18
|
+
export * from './source/positioner/index';
|
|
19
|
+
export * from './source/positioner/point';
|
|
20
|
+
export * from './source/positioner/responder-type';
|
|
21
|
+
|
|
22
|
+
export * from './source/device/index';
|
|
23
|
+
export * from './source/device/channel';
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@packtrack/layout",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"main": ".built/index.js",
|
|
5
|
-
"typings": ".built/index.d.ts",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"main": ".built/source/index.js",
|
|
5
|
+
"typings": ".built/source/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"preversion": "
|
|
9
|
+
"preversion": "npm run build"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"typescript": "^5.3.3"
|
package/source/device/channel.ts
CHANGED
package/source/device/index.ts
CHANGED
|
@@ -4,25 +4,8 @@ export class Device {
|
|
|
4
4
|
channels: Channel[] = [];
|
|
5
5
|
|
|
6
6
|
lastDiscovery: { date: Date, address: string };
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
constructor(
|
|
9
9
|
public identifier: string
|
|
10
10
|
) {}
|
|
11
|
-
|
|
12
|
-
dump() {
|
|
13
|
-
console.group(`Device ${this.identifier}`);
|
|
14
|
-
|
|
15
|
-
if (this.lastDiscovery) {
|
|
16
|
-
console.log(`last discovery: ${this.lastDiscovery.date.toISOString()} ${this.lastDiscovery.address}`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.group('channels');
|
|
20
|
-
|
|
21
|
-
for (let channel of this.channels) {
|
|
22
|
-
channel.dump();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
console.groupEnd();
|
|
26
|
-
console.groupEnd();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
11
|
+
}
|