1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const __1 = require("./..");
|
4 |
|
5 |
|
6 |
|
7 | function mapFromRootDescription(rootDescription) {
|
8 | if (rootDescription.macAddress === undefined) {
|
9 | return null;
|
10 | }
|
11 | return new __1.Device(rootDescription.remoteAddress, parsePortFromPresentationUrl(rootDescription.presentationUrl), rootDescription.macAddress, rootDescription.friendlyName, rootDescription.modelName, rootDescription.modelDescription, rootDescription.modelNumber, rootDescription.presentationUrl);
|
12 | }
|
13 | exports.mapFromRootDescription = mapFromRootDescription;
|
14 | const portFromPresentationUrlRegExp = /:(\d+)\/?$/i;
|
15 | function parsePortFromPresentationUrl(presentationUrl) {
|
16 | if (presentationUrl === undefined) {
|
17 | return undefined;
|
18 | }
|
19 | const portMatch = portFromPresentationUrlRegExp.exec(presentationUrl);
|
20 | if (portMatch == null) {
|
21 | return undefined;
|
22 | }
|
23 | return Number(portMatch[1]);
|
24 | }
|
25 |
|
\ | No newline at end of file |