plugins/polling-updater.js
function PollingTagUpdater(platform, options) {
    EventEmitter.call(this);
    this.tagsByUUID = {};
    this.options = Object.assign({}, options);
    if (! this.options.wsdl_url) {
        let apiBaseURI;
        if (platform) apiBaseURI = platform.apiBaseURI;
        if (options && options.apiBaseURI) apiBaseURI = options.apiBaseURI;
        if (! apiBaseURI) apiBaseURI = API_BASE_URI;
        this.options.wsdl_url = apiBaseURI + WSDL_URL_PATH;
    }

    /**
     * @name discoveryMode
     * @type {boolean}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */
    Object.defineProperty(this, "discoveryMode", {
        enumerable: true,
        get: function() { return this.options.discoveryMode },
        set: function(v) { this.options.discoveryMode = v }
    });

    let h = this.stopUpdateLoop.bind(this);
    /**
     * @name platform
     * @type {WirelessTagPlatform}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */
    Object.defineProperty(this, "platform", {
        enumerable: true,
        get: function() { return this._platform },
        set: function(p) {
            if (this._platform && this._platform !== p) {
                this._platform.removeListener('disconnect', h);
                if (this.options.log === this._platform.log) {
                    this.options.log = undefined;
                }
            }
            this._platform = p;
            if (p) {
                if (! this.options.log) this.options.log = p.log;
                p.on('disconnect', h);
            }
        }
    });
    this.platform = platform;

    /** @member {WirelessTagPlatform~factory} */
    this.factory = this.options.factory;
}
function PollingTagUpdater(platform, options) {
    EventEmitter.call(this);
    this.tagsByUUID = {};
    this.options = Object.assign({}, options);
    if (! this.options.wsdl_url) {
        let apiBaseURI;
        if (platform) apiBaseURI = platform.apiBaseURI;
        if (options && options.apiBaseURI) apiBaseURI = options.apiBaseURI;
        if (! apiBaseURI) apiBaseURI = API_BASE_URI;
        this.options.wsdl_url = apiBaseURI + WSDL_URL_PATH;
    }

    /**
     * @name discoveryMode
     * @type {boolean}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */
    Object.defineProperty(this, "discoveryMode", {
        enumerable: true,
        get: function() { return this.options.discoveryMode },
        set: function(v) { this.options.discoveryMode = v }
    });

    let h = this.stopUpdateLoop.bind(this);
    /**
     * @name platform
     * @type {WirelessTagPlatform}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */
    Object.defineProperty(this, "platform", {
        enumerable: true,
        get: function() { return this._platform },
        set: function(p) {
            if (this._platform && this._platform !== p) {
                this._platform.removeListener('disconnect', h);
                if (this.options.log === this._platform.log) {
                    this.options.log = undefined;
                }
            }
            this._platform = p;
            if (p) {
                if (! this.options.log) this.options.log = p.log;
                p.on('disconnect', h);
            }
        }
    });
    this.platform = platform;

    /** @member {WirelessTagPlatform~factory} */
    this.factory = this.options.factory;
}
function PollingTagUpdater ( platform , options ) { EventEmitter . call ( this ) ; this . tagsByUUID = { } ; this . options = Object . assign ( { } , options ) ; if ( ! this . options . wsdl_url ) { let apiBaseURI ; if ( platform ) apiBaseURI = platform . apiBaseURI ; if ( options && options . apiBaseURI ) apiBaseURI = options . apiBaseURI ; if ( ! apiBaseURI ) apiBaseURI = API_BASE_URI ; this . options . wsdl_url = apiBaseURI + WSDL_URL_PATH ; } /**
     * @name discoveryMode
     * @type {boolean}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */ Object . defineProperty ( this , "discoveryMode" , { enumerable : true , get : function ( ) { return this . options . discoveryMode } , set : function ( v ) { this . options . discoveryMode = v } } ) ; let h = this . stopUpdateLoop . bind ( this ) ; /**
     * @name platform
     * @type {WirelessTagPlatform}
     * @memberof module:plugins/polling-updater~PollingTagUpdater#
     */ Object . defineProperty ( this , "platform" , { enumerable : true , get : function ( ) { return this . _platform } , set : function ( p ) { if ( this . _platform && this . _platform !== p ) { this . _platform . removeListener ( 'disconnect' , h ) ; if ( this . options . log === this . _platform . log ) { this . options . log = undefined ; } } this . _platform = p ; if ( p ) { if ( ! this . options . log ) this . options . log = p . log ; p . on ( 'disconnect' , h ) ; } } } ) ; this . platform = platform ; /** @member {WirelessTagPlatform~factory} */ this . factory = this . options . factory ; }
Creates the updater instance.

@param {WirelessTagPlatform} [platform] - Platform object through
which tags to be updated were (or are going to be)
found (or created in discovery mode). In normal mode,
this is only used to possibly override configuration
options, specifically the base URI for the cloud API
endpoints. For discovery mode to work, either this or
`options.factory` must be provided.
@param {object} [options] - overriding configuration options
@param {string} [options.wsdl_url] - the full path for obtaining
the WSDL for the SOAP service to be polled (default:
[WSDL_URL_PATH]{@link module:plugins/polling-updater~WSDL_URL_PATH})
@param {string} [options.apiBaseURI] - the base URI to use for API
endpoints (default: [API_BASE_URI]{@link
module:plugins/polling-updater~API_BASE_URI})
@param {boolean} [options.discoveryMode] - whether to run in
discovery mode or not. Defaults to `false`.
@param {WirelessTagPlatform~factory} [options.factory] - the tag
and tag manager object factory to use in discovery
mode. Either this, or the `platform` parameter must
be provided for discovery mode to work.

@constructor
Creates the updater instance .