UNPKG

axis-discovery-ssdp

Version:

A Node.js SSDP (UPnP) client library written in TypeScript capable of searching for Axis Communication cameras.

26 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapFromRootDescription = void 0; const __1 = require(".."); /** * Maps a root description to a device. */ function mapFromRootDescription(rootDescription) { if (rootDescription.macAddress === undefined) { return null; } return new __1.Device(rootDescription.remoteAddress, parsePortFromPresentationUrl(rootDescription.presentationUrl), rootDescription.macAddress, rootDescription.friendlyName, rootDescription.modelName, rootDescription.modelDescription, rootDescription.modelNumber, rootDescription.presentationUrl); } exports.mapFromRootDescription = mapFromRootDescription; const portFromPresentationUrlRegExp = /:(\d+)\/?$/i; function parsePortFromPresentationUrl(presentationUrl) { if (presentationUrl === undefined) { return undefined; } const portMatch = portFromPresentationUrlRegExp.exec(presentationUrl); if (portMatch == null) { return undefined; } return Number(portMatch[1]); } //# sourceMappingURL=Mappings.js.map