How to use the azure-iothub.Device function in azure-iothub

To help you get started, we’ve selected a few azure-iothub 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 TheThingsNetwork / workshops / integrations / azure / index.js View on Github external
return new Promise((resolve, reject) => {
      const device = new iothub.Device(null);
      device.deviceId = devEUI;
      this.registry.create(device, (err, deviceInfo) => {
        if (!err) {
          resolve(deviceInfo);
        } else {
          // The device probably exists
          this.registry.get(device.deviceId, (err, deviceInfo) => {
            if (err) {
              reject(err);
            } else {
              resolve(deviceInfo);
            }
          });
        }
      });
    }).then(deviceInfo => {
github TheThingsNetwork / integration-azure / index.js View on Github external
return new Promise((resolve, reject) => {
      const device = new iothub.Device(null)
      device.deviceId = deviceId
      this.registry.create(device, (err, deviceInfo) => {
        if (err) {
          // The device probably exists
          this.registry.get(device.deviceId, (err, deviceInfo) => {
            if (err) {
              reject(err)
            } else {
              resolve(deviceInfo)
            }
          })
        } else {
          resolve(deviceInfo)
        }
      })
    }).then(deviceInfo => {