Using Cisco DNA Spaces
MapsIndoors & CiscoDNA for Web
User Positioning in MapsIndoors for Web
Code Sample
class CiscoPositioningService {
/**
* @param {string} args.clientIp - The local IP address of the device
* @param {string} args.tenantId - The Cisco tenant id.
* @param {number} [args.pollingInterval=1000] - The interval that the position will be polled from the backend.
* @param {string} [args.region="eu"] - The Cisco app region.
*/
constructor(args = {}) {
if (!args.clientIp)
throw new TypeError('Invalid argument: "clientIp"');
if (!args.tenantId)
throw new TypeError('Invalid argument: "tenantId"');
this._pollingInterval = 1000;
this._tenantId = args.tenantId;
this._successCallbacks = new Map();
this._errorCallbacks = new Map();
this._deviceId = '';
args.region = args.region || 'eu';
this.pollingInterval = args.pollInterval;
fetch(`https://ciscodna.mapsindoors.com/${this._tenantId}/api/ciscodna/devicelookup?clientIp=${args.clientIp}®ion=${args.region}`)
.then(this._errorHandler)
.then(res => res.json())
.then(({ deviceId }) => {
this._deviceId = deviceId;
this._startPolling();
}).catch(err => {
console.error(err.message);
});
}Last updated
Was this helpful?