How to use the azure-iot-provisioning-device.ProvisioningDeviceConstants.defaultPollingInterval function in azure-iot-provisioning-device

To help you get started, we’ve selected a few azure-iot-provisioning-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / provisioning / transport / mqtt / src / mqtt.ts View on Github external
constructor(mqttBase?: MqttBase) {
    super();
    this._mqttBase = mqttBase || new MqttBase();
    this._config.pollingInterval = ProvisioningDeviceConstants.defaultPollingInterval;

    const responseHandler = (topic: string, payload: any) => {
      let payloadString: string = payload.toString('ascii');
      debug('message received on ' + topic);
      debug('request payload is: ' + payloadString);

      /* Codes_SRS_NODE_PROVISIONING_MQTT_18_010: [ When waiting for responses, `registrationRequest` shall watch for messages with a topic named $dps/registrations/res//?$rid=.] */
      /* Codes_SRS_NODE_PROVISIONING_MQTT_18_024: [ When waiting for responses, `queryOperationStatus` shall watch for messages with a topic named $dps/registrations/res//?$rid=.] */
      let match = topic.match(/^\$dps\/registrations\/res\/(.*)\/\?(.*)$/);

      if (!!match && match.length === 3) {
        let queryParameters = queryString.parse(match[2]);
        if (queryParameters.$rid) {
          let rid: string = queryParameters.$rid as string;
          if (this._operations[rid]) {
            let status: number = Number(match[1]);
github Azure / azure-iot-sdk-node / provisioning / transport / amqp / src / amqp.ts View on Github external
constructor(amqpBase?: Base) {
    super();
    this._amqpBase = amqpBase || new Base(true);
    this._config.pollingInterval = ProvisioningDeviceConstants.defaultPollingInterval;

    const amqpErrorListener = (err) => this._amqpStateMachine.handle('amqpError', err);

    const responseHandler = (msg) => {
      debug('got message with correlation_id: ' + msg.correlation_id);
      /*Codes_SRS_NODE_PROVISIONING_AMQP_16_007: [The `registrationRequest` method shall call its callback with a `RegistrationResult` object parsed from the body of the response message which `correlation_id` matches the `correlation_id` of the request message sent on the sender link.]*/
      /*Codes_SRS_NODE_PROVISIONING_AMQP_16_017: [The `queryOperationStatus` method shall call its callback with a `RegistrationResult` object parsed from the body of the response message which `correlation_id` matches the `correlation_id` of the request message sent on the sender link.]*/
      const registrationResult = JSON.parse(msg.body.content);
      if (this._operations[msg.correlation_id]) {
        debug('Got the registration/operationStatus message we were looking for.');
        const requestCallback = this._operations[msg.correlation_id];
        delete this._operations[msg.correlation_id];
        let retryAfterInMilliseconds: number;
        /*Codes_SRS_NODE_PROVISIONING_AMQP_06_010: [If the amqp response to a request contains the application property`retry-after`, it will be interpreted as the number of seconds that should elapse before the next attempted operation.  Otherwise default.] */
        if (msg.application_properties && msg.application_properties[MessagePropertyNames.retryAfter]) {
          retryAfterInMilliseconds = Number(msg.application_properties[MessagePropertyNames.retryAfter]) * 1000;
github Azure / azure-iot-sdk-node / provisioning / transport / http / src / http.ts View on Github external
constructor(httpBase?: Base) {
    super();
    this._httpBase = httpBase || new Base();
    this._config.pollingInterval = ProvisioningDeviceConstants.defaultPollingInterval;
    this._config.timeoutInterval = ProvisioningDeviceConstants.defaultTimeoutInterval;
  }