@webex/plugin-device-manager 3.9.0-webinar5k.1 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device-manager.js +32 -1
- package/dist/device-manager.js.map +1 -1
- package/package.json +13 -13
- package/src/device-manager.js +35 -0
- package/test/unit/spec/index.js +214 -3
package/dist/device-manager.js
CHANGED
|
@@ -25,6 +25,9 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
25
25
|
_boundSpace: null,
|
|
26
26
|
initialize: function initialize() {
|
|
27
27
|
var _this = this;
|
|
28
|
+
// Initialize the paired method property
|
|
29
|
+
this._pairedMethod = 'Manual';
|
|
30
|
+
|
|
28
31
|
// Lyra mercury events listener
|
|
29
32
|
this.webex.internal.mercury.on('event:lyra.space_updated', function (_ref) {
|
|
30
33
|
var data = _ref.data;
|
|
@@ -524,7 +527,35 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
524
527
|
}
|
|
525
528
|
return _promise.default.resolve();
|
|
526
529
|
},
|
|
527
|
-
|
|
530
|
+
/**
|
|
531
|
+
* gets the currently paired device info if paired
|
|
532
|
+
* @returns {device}
|
|
533
|
+
*/
|
|
534
|
+
getPairedDevice: function getPairedDevice() {
|
|
535
|
+
var _this$_pairedDevice, _this$_pairedDevice2, _this$_pairedDevice2$;
|
|
536
|
+
if (!this._pairedDevice) {
|
|
537
|
+
this.logger.info('DeviceManager#getPairedDevice: Currently no device is paired');
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
var pairedDeviceId = ((_this$_pairedDevice = this._pairedDevice) === null || _this$_pairedDevice === void 0 ? void 0 : _this$_pairedDevice.id) || ((_this$_pairedDevice2 = this._pairedDevice) === null || _this$_pairedDevice2 === void 0 ? void 0 : (_this$_pairedDevice2$ = _this$_pairedDevice2.identity) === null || _this$_pairedDevice2$ === void 0 ? void 0 : _this$_pairedDevice2$.id);
|
|
541
|
+
return _collection.default.get(pairedDeviceId);
|
|
542
|
+
},
|
|
543
|
+
/**
|
|
544
|
+
* Gets the currently set paired method
|
|
545
|
+
* @returns {string} - The paired method (defaults to "Manual")
|
|
546
|
+
*/
|
|
547
|
+
getPairedMethod: function getPairedMethod() {
|
|
548
|
+
return this._pairedMethod || 'Manual';
|
|
549
|
+
},
|
|
550
|
+
/**
|
|
551
|
+
* Sets the paired method
|
|
552
|
+
* @param {string} pairedMethod - The paired method to set
|
|
553
|
+
* @returns {void}
|
|
554
|
+
*/
|
|
555
|
+
setPairedMethod: function setPairedMethod(pairedMethod) {
|
|
556
|
+
this._pairedMethod = pairedMethod;
|
|
557
|
+
},
|
|
558
|
+
version: "3.10.0"
|
|
528
559
|
});
|
|
529
560
|
var _default = exports.default = DeviceManager;
|
|
530
561
|
//# sourceMappingURL=device-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","require","_webexCore","_uuid","_interopRequireDefault","_constants","_collection","DeviceManager","WebexPlugin","extend","namespace","_devicePendingPinChallenge","_pairedDevice","_boundSpace","initialize","_this","webex","internal","mercury","on","_ref","data","_receiveDeviceUpdates","getAll","DeviceCollection","refresh","_this2","reset","request","api","resource","then","res","body","_promise","default","reject","_updateDeviceMetadata","items","devices","forEach","device","deviceInfo","machineType","LYRA_SPACE","lyra","space","get","catch","err","logger","error","set","search","options","_this3","searchQuery","Error","people","searchId","uuid","v4","searchType","searchEntity","includePeople","includeRooms","queryString","upsert","_this4","deviceId","id","identity","existingDevice","resolve","method","concat","auxDevice","_decryptDeviceName","token","_this5","getAdvertisedEndpoint","advertiser","result","displayName","remove","_this6","requestPin","_this7","arguments","length","undefined","url","dev","occupants","pinChallenge","info","join","passType","verificationInitiation","pair","_this8","pin","unpair","_this9","leave","bindSpace","_this10","kmsResourceObjectUrl","bindConversation","unbindSpace","_this11","unbindConversation","getAudioState","putAudioState","audioState","mute","unmute","increaseVolume","decreaseVolume","setVolume","level","_this12","deviceArray","cloneDeep","all","map","index","services","waitForCatalog","deviceClass","UC_CLOUD","updatedDevice","_this13","inDevice","metadata","encryptedUserAssignedName","encryptionKeyUrl","encryption","decryptText","decryptedDeviceName","userAssignedName","_this14","spaceUrl","substring","lastIndexOf","self","verified","productName","DEFAULT_PRODUCT_NAME","pairedDeviceId","version","_default","exports"],"sources":["device-manager.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport {cloneDeep} from 'lodash';\nimport '@webex/internal-plugin-lyra';\nimport '@webex/internal-plugin-search';\nimport {WebexPlugin} from '@webex/webex-core';\nimport uuid from 'uuid';\n\nimport {LYRA_SPACE, UC_CLOUD, DEFAULT_PRODUCT_NAME} from './constants';\nimport DeviceCollection from './collection';\n\nconst DeviceManager = WebexPlugin.extend({\n namespace: 'DeviceManager',\n _devicePendingPinChallenge: null,\n _pairedDevice: null,\n _boundSpace: null,\n\n initialize() {\n // Lyra mercury events listener\n this.webex.internal.mercury.on('event:lyra.space_updated', ({data}) => {\n this._receiveDeviceUpdates(data);\n });\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n getAll() {\n return DeviceCollection.getAll();\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n refresh() {\n DeviceCollection.reset();\n\n return this.webex\n .request({\n api: 'wdm',\n resource: 'devices/auxiliary',\n })\n .then((res) => {\n if (!res.body) {\n return Promise.reject();\n }\n\n return this._updateDeviceMetadata(res.body.items).then((devices) => {\n /* eslint-disable consistent-return */\n devices.forEach((device) => {\n if (device.deviceInfo && device.deviceInfo.machineType === LYRA_SPACE) {\n return this.webex.internal.lyra.space.get(device.deviceInfo).catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to receive device info', err);\n });\n }\n });\n /* eslint-enable consistent-return */\n res.body.items.forEach((device) => {\n DeviceCollection.set(device);\n });\n\n return this.getAll();\n });\n })\n .catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);\n });\n },\n\n /**\n * Search for a device by name\n * @param {Object} options\n * @param {string} options.searchQuery\n * @returns {Promise<Device>}\n */\n search(options) {\n if (!options || !options.searchQuery) {\n this.logger.error('DeviceManager#search: options.searchQuery is required');\n\n return Promise.reject(new Error('DeviceManager#search: options.searchQuery is required'));\n }\n\n return this.webex.internal.search\n .people({\n searchId: uuid.v4(),\n searchType: 'DEVICE_SEARCH',\n searchEntity: 'device',\n includePeople: false,\n includeRooms: true,\n queryString: options.searchQuery,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#search: failed to search a device', err);\n\n throw err;\n });\n },\n\n /**\n * Caches the device info and also registers to Redis for subsequent fetches\n * @param {Object} device\n * @param {string} device.id\n * @returns {deviceInfo}\n */\n upsert(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#upsert: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#upsert: device.id is required'));\n }\n this._pairedDevice = this._devicePendingPinChallenge;\n this._devicePendingPinChallenge = null;\n // check if the device is already existing, if so then merge else add\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n }\n\n // new device requested, add to wdm for subsequent retreivals\n return (\n this.webex\n .request({\n api: 'wdm',\n method: 'PUT',\n resource: `devices/auxiliary/Room/${deviceId}`,\n })\n .then((res) => {\n const auxDevice = res.body;\n\n return this._decryptDeviceName(auxDevice);\n })\n // eslint-disable-next-line no-shadow\n .then((device) => {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#upsert: failed to add/update a device', err);\n\n return Promise.reject(err);\n })\n );\n },\n\n /**\n * Retreives device info of a particular device\n * @param {string} token\n * @returns {Promise<deviceInfo>}\n */\n get(token) {\n if (!token) {\n this.logger.error('DeviceManager#get: token is required');\n\n return Promise.reject(new Error('DeviceManager#get: token is required'));\n }\n let deviceInfo;\n\n return this.webex.internal.lyra\n .getAdvertisedEndpoint(token)\n .then((res) => {\n deviceInfo = res;\n\n return this.webex.internal.lyra.space.get({id: res.advertiser.id});\n })\n .then((result) => {\n // the deviceInfo doesn't have proper displayName, hence update\n // displayName on deviceInfo for search to work\n if (result && result.identity && result.identity.displayName) {\n deviceInfo.advertiser.displayName = result.identity.displayName;\n }\n\n return deviceInfo;\n })\n .catch((err) => {\n this.logger.error('DeviceManager#get: failed to get device info', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Unregisters the device from Redis, will not fetch in subsequent loads,\n * similar to space.deleteBinding()\n * @param {string} deviceId\n * @returns {Promise<deviceInfo>}\n */\n remove(deviceId) {\n if (!deviceId) {\n this.logger.error('DeviceManager#remove: deviceId is required');\n\n return Promise.reject(new Error('DeviceManager#remove: deviceId is required'));\n }\n\n return this.webex\n .request({\n method: 'delete',\n api: 'wdm',\n resource: `devices/auxiliary/${deviceId}`,\n })\n .catch((error) => {\n this.logger.error('DeviceManager#remove: failed to remove the device', error);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Requests to display PIN on the device\n * @param {object} device\n * @param {object} options\n * @param {object} options.data\n * @returns {Promise<deviceInfo>}\n */\n requestPin(device, options = {}) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#requestPin: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#requestPin: device.id is required'));\n }\n const space = {id: deviceId, url: `/spaces/${deviceId}`};\n\n return this.webex.internal.lyra.space\n .get(space)\n .then((dev) => {\n // check if the space is pinChallenge capable\n if (dev && dev.occupants && dev.occupants.pinChallenge) {\n this.logger.info('DeviceManager#requestPin: space is PIN challenge capable');\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'MANUAL',\n verificationInitiation: 'PIN',\n data: options.data,\n })\n .then(() => {\n this._devicePendingPinChallenge = dev;\n\n // return the actual device so that it can be upserted on successful\n // PIN exchange\n return dev;\n });\n }\n // pairs with the space if it's not PIN challenge capable\n this.logger.info(\n 'DeviceManager#requestPin: space is not PIN challenge capable, probably already occupied, will still return device info'\n );\n\n return this.webex.internal.lyra.space.get(space).then(() => Promise.resolve(dev));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#requestPin: device failed PIN challenge request', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * pairs the device with the user (manual pairing), also adds it to\n * user's recents list for subsequent fetches.\n * similar to space.join()\n * @param {object} options\n * @param {number} options.pin\n * @returns {Promise<deviceInfo>}\n */\n pair(options = {}) {\n if (!options.pin) {\n this.logger.error('DeviceManager#pair: options.pin is required');\n\n return Promise.reject(new Error('DeviceManager#pair: options.pin is required'));\n }\n if (this._devicePendingPinChallenge) {\n const space = {\n id: this._devicePendingPinChallenge.identity.id,\n url: `/spaces/${this._devicePendingPinChallenge.identity.id}`,\n };\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'PIN_ANSWER',\n data: options.pin,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#pair: incorrect PIN, unable to pair ', err);\n\n return Promise.reject(err);\n })\n .then(() => this.upsert(this._devicePendingPinChallenge));\n }\n this.logger.error('DeviceManager#pair: no device to pair');\n\n return Promise.reject(new Error('DeviceManager#pair: no device to pair'));\n },\n\n /**\n * unpairs the device with the user (manual/ultrasonic pairing), but still\n * keeps in the recents list/does not remove from Redis\n * options.removeAllDevices will remove all associated devices to user\n * similar to space.leave()\n * @param {object} options\n * @param {boolean} options.removeAllDevices\n * @returns {Promise<deviceInfo>}\n */\n unpair(options = {}) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unpair: no device to unpair');\n\n return Promise.reject(new Error('DeviceManager#unpair: no device to unpair'));\n }\n const space = {url: `/spaces/${this._pairedDevice.identity.id}`};\n\n return this.webex.internal.lyra.space.leave(space, options).catch((err) => {\n this.logger.error('DeviceManager#unpair: failed to remove device from Lyra', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * binds the space to the paired device (if supported)\n * similar to space.bindConversation()\n * @param {object} options\n * @param {boolean} options.url, conversation url\n * @param {boolean} options.kmsResourceObjectUrl of the convo\n * @returns {Promise<deviceInfo>}\n */\n bindSpace(options = {}) {\n if (!options.url) {\n this.logger.error('DeviceManager#pair: options.url is required');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: options.url is required'));\n }\n if (!options.kmsResourceObjectUrl) {\n this.logger.error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required');\n\n return Promise.reject(\n new Error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required')\n );\n }\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#bindSpace: No device paired currently');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: No device paired currently'));\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n this._boundSpace = {\n kmsResourceObjectUrl: options.kmsResourceObjectUrl,\n url: options.url,\n };\n\n return this.webex.internal.lyra.space.bindConversation(space, this._boundSpace).catch((err) => {\n this.logger.error('DeviceManager#bindSpace: failed to bind device to Space');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * unbinds the space to the paired device (if supported)\n * similar to space.unbindConversation()\n * @returns {Promise<deviceInfo>}\n */\n unbindSpace() {\n if (!this._pairedDevice || !this._boundSpace) {\n this.logger.error('DeviceManager#unbindSpace: No space currently bound to the device');\n\n return Promise.reject(\n new Error('DeviceManager#unbindSpace: No space currently bound to the device')\n );\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n return this.webex.internal.lyra.space\n .unbindConversation(space, this._boundSpace)\n .then((res) => {\n this._boundSpace = null;\n\n return Promise.resolve(res);\n })\n .catch((err) => {\n this.logger.error('DeviceManager#unbindSpace: failed to unbind Space to device');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Gets the audio state of the paired device\n * similar to device.getAudioState()\n * @returns {Promise<audioState>}\n */\n getAudioState() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#getAudioState: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#getAudioState: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);\n },\n\n /**\n * Updates audio state of the paired device, should be called every 10 minutes\n * or when mic or volume state is changed\n * similar to device.putAudioState()\n * @param {object} space\n * @param {object} audioState\n * @returns {Promise<audioState>}\n */\n putAudioState(space, audioState = {}) {\n return this.webex.internal.lyra.device.putAudioState(space, audioState);\n },\n\n /**\n * Mutes paired device\n * similar to device.mute()\n * @returns {Promise<audioState>}\n */\n mute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#mute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#mute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.mute(this._pairedDevice);\n },\n\n /**\n * Unmutes paired device\n * similar to device.unmute()\n * @returns {Promise<audioState>}\n */\n unmute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unmute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#unmute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.unmute(this._pairedDevice);\n },\n\n /**\n * Increases paired device's volume\n * similar to device.increaseVolume()\n * @returns {Promise<audioState>}\n */\n increaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#increaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#increaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);\n },\n\n /**\n * Decreases paired device's volume\n * similar to device.decreaseVolume()\n * @returns {Promise<audioState>}\n */\n decreaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#decreaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#decreaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);\n },\n\n /**\n * Sets paired device's volume but should use increase and decrease api instead\n * similar to device.setVolume()\n * @param {number} level\n * @returns {Promise<audioState>}\n */\n setVolume(level = 0) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#setVolume: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#setVolume: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {Array} deviceArray\n * @returns {device}\n */\n _updateDeviceMetadata(deviceArray = []) {\n if (!deviceArray.length) {\n return Promise.resolve(deviceArray);\n }\n const devices = cloneDeep(deviceArray);\n\n return Promise.all(\n devices.map((device, index) =>\n this.webex.internal.services\n .waitForCatalog('postauth')\n .then(() => {\n if (device.deviceClass === UC_CLOUD) {\n device.id = `${this.webex.internal.services.get('wdm')}/${device.id}`;\n }\n\n return this._decryptDeviceName(device);\n })\n .then((updatedDevice) => {\n devices[index] = updatedDevice;\n\n return Promise.resolve();\n })\n )\n ).then(() => Promise.resolve(devices));\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {object} inDevice\n * @returns {device}\n */\n _decryptDeviceName(inDevice = {}) {\n const device = cloneDeep(inDevice);\n\n if (\n device.metadata &&\n device.metadata.encryptedUserAssignedName &&\n device.metadata.encryptionKeyUrl\n ) {\n return this.webex.internal.encryption\n .decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName)\n .then((decryptedDeviceName) => {\n // set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed\n device.metadata.encryptedUserAssignedName = undefined;\n device.metadata.userAssignedName = decryptedDeviceName;\n\n return Promise.resolve(device);\n })\n .catch((err) => {\n // unset encryptedUserAssignedName if failed to decrypt\n device.metadata.encryptedUserAssignedName = undefined;\n this.logger.error(\n 'DeviceCollection#_decryptDeviceName: failed to decrypt device name',\n err\n );\n });\n }\n\n return Promise.resolve(device);\n },\n\n /**\n * Utility function to update device info on mercury updates\n * @param {object} device\n * @returns {device}\n */\n _receiveDeviceUpdates(device) {\n // we care only the updates are for the registered devices\n if (device && device.spaceUrl) {\n const deviceId = device.spaceUrl.substring(device.spaceUrl.lastIndexOf('/') + 1);\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n return this.webex.internal.lyra.space\n .get({id: deviceId})\n .then((space) => {\n // eslint-disable-next-line no-shadow\n const device = DeviceCollection.get(deviceId);\n\n if (\n device &&\n space.occupants &&\n (!space.occupants.self || !space.occupants.self.verified)\n ) {\n device.productName =\n (space.devices && space.devices[0] && space.devices[0].productName) ||\n DEFAULT_PRODUCT_NAME;\n // pin challenge is not verified reset _pairedDevice if ids\n // match\n const pairedDeviceId =\n this._pairedDevice && (this._pairedDevice.id || this._pairedDevice.identity.id);\n\n if (pairedDeviceId === deviceId) {\n this._pairedDevice = null;\n this.logger.info(\n `DeviceManager#_receiveDeviceUpdates: device ${deviceId} lost pairing`\n );\n\n return Promise.resolve();\n }\n // we do not want to reset the device pending PIN challenge\n if (this._devicePendingPinChallenge.identity.id !== deviceId) {\n return this.upsert(device);\n }\n\n return Promise.resolve();\n }\n\n return Promise.resolve();\n })\n .catch((err) => {\n this.logger.error(\n 'DeviceManager#_receiveDeviceUpdates: failed to receive updates for Lyra space',\n err\n );\n });\n }\n }\n\n return Promise.resolve();\n },\n});\n\nexport default DeviceManager;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAF,sBAAA,CAAAH,OAAA;AAVA;AACA;AACA;;AAUA,IAAMM,aAAa,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACvCC,SAAS,EAAE,eAAe;EAC1BC,0BAA0B,EAAE,IAAI;EAChCC,aAAa,EAAE,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5B;YAEA,OAAOP,QAAA,CAAAC,OAAA,CAAQsC,OAAO,CAAC,CAAC;UAC1B;UAEA,OAAOvC,QAAA,CAAAC,OAAA,CAAQsC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC,CACDzB,KAAK,CAAC,UAACC,GAAG,EAAK;UACd4F,OAAI,CAAC3F,MAAM,CAACC,KAAK,CACf,+EAA+E,EAC/EF,GACF,CAAC;QACH,CAAC,CAAC;MACN;IACF;IAEA,OAAOf,QAAA,CAAAC,OAAA,CAAQsC,OAAO,CAAC,CAAC;EAC1B,CAAC;EAAA6E,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArH,OAAA,GAEY5B,aAAa"}
|
|
1
|
+
{"version":3,"names":["_lodash","require","_webexCore","_uuid","_interopRequireDefault","_constants","_collection","DeviceManager","WebexPlugin","extend","namespace","_devicePendingPinChallenge","_pairedDevice","_boundSpace","initialize","_this","_pairedMethod","webex","internal","mercury","on","_ref","data","_receiveDeviceUpdates","getAll","DeviceCollection","refresh","_this2","reset","request","api","resource","then","res","body","_promise","default","reject","_updateDeviceMetadata","items","devices","forEach","device","deviceInfo","machineType","LYRA_SPACE","lyra","space","get","catch","err","logger","error","set","search","options","_this3","searchQuery","Error","people","searchId","uuid","v4","searchType","searchEntity","includePeople","includeRooms","queryString","upsert","_this4","deviceId","id","identity","existingDevice","resolve","method","concat","auxDevice","_decryptDeviceName","token","_this5","getAdvertisedEndpoint","advertiser","result","displayName","remove","_this6","requestPin","_this7","arguments","length","undefined","url","dev","occupants","pinChallenge","info","join","passType","verificationInitiation","pair","_this8","pin","unpair","_this9","leave","bindSpace","_this10","kmsResourceObjectUrl","bindConversation","unbindSpace","_this11","unbindConversation","getAudioState","putAudioState","audioState","mute","unmute","increaseVolume","decreaseVolume","setVolume","level","_this12","deviceArray","cloneDeep","all","map","index","services","waitForCatalog","deviceClass","UC_CLOUD","updatedDevice","_this13","inDevice","metadata","encryptedUserAssignedName","encryptionKeyUrl","encryption","decryptText","decryptedDeviceName","userAssignedName","_this14","spaceUrl","substring","lastIndexOf","self","verified","productName","DEFAULT_PRODUCT_NAME","pairedDeviceId","getPairedDevice","_this$_pairedDevice","_this$_pairedDevice2","_this$_pairedDevice2$","getPairedMethod","setPairedMethod","pairedMethod","version","_default","exports"],"sources":["device-manager.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport {cloneDeep} from 'lodash';\nimport '@webex/internal-plugin-lyra';\nimport '@webex/internal-plugin-search';\nimport {WebexPlugin} from '@webex/webex-core';\nimport uuid from 'uuid';\n\nimport {LYRA_SPACE, UC_CLOUD, DEFAULT_PRODUCT_NAME} from './constants';\nimport DeviceCollection from './collection';\n\nconst DeviceManager = WebexPlugin.extend({\n namespace: 'DeviceManager',\n _devicePendingPinChallenge: null,\n _pairedDevice: null,\n _boundSpace: null,\n\n initialize() {\n // Initialize the paired method property\n this._pairedMethod = 'Manual';\n\n // Lyra mercury events listener\n this.webex.internal.mercury.on('event:lyra.space_updated', ({data}) => {\n this._receiveDeviceUpdates(data);\n });\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n getAll() {\n return DeviceCollection.getAll();\n },\n\n /**\n * Gets a list of all recent devices associated with the user\n * the device list gets populated from Redis\n * @returns {Promise<Device>}\n */\n refresh() {\n DeviceCollection.reset();\n\n return this.webex\n .request({\n api: 'wdm',\n resource: 'devices/auxiliary',\n })\n .then((res) => {\n if (!res.body) {\n return Promise.reject();\n }\n\n return this._updateDeviceMetadata(res.body.items).then((devices) => {\n /* eslint-disable consistent-return */\n devices.forEach((device) => {\n if (device.deviceInfo && device.deviceInfo.machineType === LYRA_SPACE) {\n return this.webex.internal.lyra.space.get(device.deviceInfo).catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to receive device info', err);\n });\n }\n });\n /* eslint-enable consistent-return */\n res.body.items.forEach((device) => {\n DeviceCollection.set(device);\n });\n\n return this.getAll();\n });\n })\n .catch((err) => {\n this.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);\n });\n },\n\n /**\n * Search for a device by name\n * @param {Object} options\n * @param {string} options.searchQuery\n * @returns {Promise<Device>}\n */\n search(options) {\n if (!options || !options.searchQuery) {\n this.logger.error('DeviceManager#search: options.searchQuery is required');\n\n return Promise.reject(new Error('DeviceManager#search: options.searchQuery is required'));\n }\n\n return this.webex.internal.search\n .people({\n searchId: uuid.v4(),\n searchType: 'DEVICE_SEARCH',\n searchEntity: 'device',\n includePeople: false,\n includeRooms: true,\n queryString: options.searchQuery,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#search: failed to search a device', err);\n\n throw err;\n });\n },\n\n /**\n * Caches the device info and also registers to Redis for subsequent fetches\n * @param {Object} device\n * @param {string} device.id\n * @returns {deviceInfo}\n */\n upsert(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#upsert: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#upsert: device.id is required'));\n }\n this._pairedDevice = this._devicePendingPinChallenge;\n this._devicePendingPinChallenge = null;\n // check if the device is already existing, if so then merge else add\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n }\n\n // new device requested, add to wdm for subsequent retreivals\n return (\n this.webex\n .request({\n api: 'wdm',\n method: 'PUT',\n resource: `devices/auxiliary/Room/${deviceId}`,\n })\n .then((res) => {\n const auxDevice = res.body;\n\n return this._decryptDeviceName(auxDevice);\n })\n // eslint-disable-next-line no-shadow\n .then((device) => {\n DeviceCollection.set(device);\n\n return Promise.resolve(DeviceCollection.get(deviceId));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#upsert: failed to add/update a device', err);\n\n return Promise.reject(err);\n })\n );\n },\n\n /**\n * Retreives device info of a particular device\n * @param {string} token\n * @returns {Promise<deviceInfo>}\n */\n get(token) {\n if (!token) {\n this.logger.error('DeviceManager#get: token is required');\n\n return Promise.reject(new Error('DeviceManager#get: token is required'));\n }\n let deviceInfo;\n\n return this.webex.internal.lyra\n .getAdvertisedEndpoint(token)\n .then((res) => {\n deviceInfo = res;\n\n return this.webex.internal.lyra.space.get({id: res.advertiser.id});\n })\n .then((result) => {\n // the deviceInfo doesn't have proper displayName, hence update\n // displayName on deviceInfo for search to work\n if (result && result.identity && result.identity.displayName) {\n deviceInfo.advertiser.displayName = result.identity.displayName;\n }\n\n return deviceInfo;\n })\n .catch((err) => {\n this.logger.error('DeviceManager#get: failed to get device info', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Unregisters the device from Redis, will not fetch in subsequent loads,\n * similar to space.deleteBinding()\n * @param {string} deviceId\n * @returns {Promise<deviceInfo>}\n */\n remove(deviceId) {\n if (!deviceId) {\n this.logger.error('DeviceManager#remove: deviceId is required');\n\n return Promise.reject(new Error('DeviceManager#remove: deviceId is required'));\n }\n\n return this.webex\n .request({\n method: 'delete',\n api: 'wdm',\n resource: `devices/auxiliary/${deviceId}`,\n })\n .catch((error) => {\n this.logger.error('DeviceManager#remove: failed to remove the device', error);\n\n return Promise.reject(error);\n });\n },\n\n /**\n * Requests to display PIN on the device\n * @param {object} device\n * @param {object} options\n * @param {object} options.data\n * @returns {Promise<deviceInfo>}\n */\n requestPin(device, options = {}) {\n const deviceId = device.id || (device.identity && device.identity.id);\n\n if (!deviceId) {\n this.logger.error('DeviceManager#requestPin: device.id is required');\n\n return Promise.reject(new Error('DeviceManager#requestPin: device.id is required'));\n }\n const space = {id: deviceId, url: `/spaces/${deviceId}`};\n\n return this.webex.internal.lyra.space\n .get(space)\n .then((dev) => {\n // check if the space is pinChallenge capable\n if (dev && dev.occupants && dev.occupants.pinChallenge) {\n this.logger.info('DeviceManager#requestPin: space is PIN challenge capable');\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'MANUAL',\n verificationInitiation: 'PIN',\n data: options.data,\n })\n .then(() => {\n this._devicePendingPinChallenge = dev;\n\n // return the actual device so that it can be upserted on successful\n // PIN exchange\n return dev;\n });\n }\n // pairs with the space if it's not PIN challenge capable\n this.logger.info(\n 'DeviceManager#requestPin: space is not PIN challenge capable, probably already occupied, will still return device info'\n );\n\n return this.webex.internal.lyra.space.get(space).then(() => Promise.resolve(dev));\n })\n .catch((err) => {\n this.logger.error('DeviceManager#requestPin: device failed PIN challenge request', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * pairs the device with the user (manual pairing), also adds it to\n * user's recents list for subsequent fetches.\n * similar to space.join()\n * @param {object} options\n * @param {number} options.pin\n * @returns {Promise<deviceInfo>}\n */\n pair(options = {}) {\n if (!options.pin) {\n this.logger.error('DeviceManager#pair: options.pin is required');\n\n return Promise.reject(new Error('DeviceManager#pair: options.pin is required'));\n }\n if (this._devicePendingPinChallenge) {\n const space = {\n id: this._devicePendingPinChallenge.identity.id,\n url: `/spaces/${this._devicePendingPinChallenge.identity.id}`,\n };\n\n return this.webex.internal.lyra.space\n .join(space, {\n passType: 'PIN_ANSWER',\n data: options.pin,\n })\n .catch((err) => {\n this.logger.error('DeviceManager#pair: incorrect PIN, unable to pair ', err);\n\n return Promise.reject(err);\n })\n .then(() => this.upsert(this._devicePendingPinChallenge));\n }\n this.logger.error('DeviceManager#pair: no device to pair');\n\n return Promise.reject(new Error('DeviceManager#pair: no device to pair'));\n },\n\n /**\n * unpairs the device with the user (manual/ultrasonic pairing), but still\n * keeps in the recents list/does not remove from Redis\n * options.removeAllDevices will remove all associated devices to user\n * similar to space.leave()\n * @param {object} options\n * @param {boolean} options.removeAllDevices\n * @returns {Promise<deviceInfo>}\n */\n unpair(options = {}) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unpair: no device to unpair');\n\n return Promise.reject(new Error('DeviceManager#unpair: no device to unpair'));\n }\n const space = {url: `/spaces/${this._pairedDevice.identity.id}`};\n\n return this.webex.internal.lyra.space.leave(space, options).catch((err) => {\n this.logger.error('DeviceManager#unpair: failed to remove device from Lyra', err);\n\n return Promise.reject(err);\n });\n },\n\n /**\n * binds the space to the paired device (if supported)\n * similar to space.bindConversation()\n * @param {object} options\n * @param {boolean} options.url, conversation url\n * @param {boolean} options.kmsResourceObjectUrl of the convo\n * @returns {Promise<deviceInfo>}\n */\n bindSpace(options = {}) {\n if (!options.url) {\n this.logger.error('DeviceManager#pair: options.url is required');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: options.url is required'));\n }\n if (!options.kmsResourceObjectUrl) {\n this.logger.error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required');\n\n return Promise.reject(\n new Error('DeviceManager#bindSpace: options.kmsResourceObjectUrl is required')\n );\n }\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#bindSpace: No device paired currently');\n\n return Promise.reject(new Error('DeviceManager#bindSpace: No device paired currently'));\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n this._boundSpace = {\n kmsResourceObjectUrl: options.kmsResourceObjectUrl,\n url: options.url,\n };\n\n return this.webex.internal.lyra.space.bindConversation(space, this._boundSpace).catch((err) => {\n this.logger.error('DeviceManager#bindSpace: failed to bind device to Space');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * unbinds the space to the paired device (if supported)\n * similar to space.unbindConversation()\n * @returns {Promise<deviceInfo>}\n */\n unbindSpace() {\n if (!this._pairedDevice || !this._boundSpace) {\n this.logger.error('DeviceManager#unbindSpace: No space currently bound to the device');\n\n return Promise.reject(\n new Error('DeviceManager#unbindSpace: No space currently bound to the device')\n );\n }\n const space = {\n url: `/spaces/${this._pairedDevice.identity.id}`,\n id: this._pairedDevice.identity.id,\n };\n\n return this.webex.internal.lyra.space\n .unbindConversation(space, this._boundSpace)\n .then((res) => {\n this._boundSpace = null;\n\n return Promise.resolve(res);\n })\n .catch((err) => {\n this.logger.error('DeviceManager#unbindSpace: failed to unbind Space to device');\n\n return Promise.reject(err);\n });\n },\n\n /**\n * Gets the audio state of the paired device\n * similar to device.getAudioState()\n * @returns {Promise<audioState>}\n */\n getAudioState() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#getAudioState: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#getAudioState: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);\n },\n\n /**\n * Updates audio state of the paired device, should be called every 10 minutes\n * or when mic or volume state is changed\n * similar to device.putAudioState()\n * @param {object} space\n * @param {object} audioState\n * @returns {Promise<audioState>}\n */\n putAudioState(space, audioState = {}) {\n return this.webex.internal.lyra.device.putAudioState(space, audioState);\n },\n\n /**\n * Mutes paired device\n * similar to device.mute()\n * @returns {Promise<audioState>}\n */\n mute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#mute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#mute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.mute(this._pairedDevice);\n },\n\n /**\n * Unmutes paired device\n * similar to device.unmute()\n * @returns {Promise<audioState>}\n */\n unmute() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#unmute: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#unmute: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.unmute(this._pairedDevice);\n },\n\n /**\n * Increases paired device's volume\n * similar to device.increaseVolume()\n * @returns {Promise<audioState>}\n */\n increaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#increaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#increaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);\n },\n\n /**\n * Decreases paired device's volume\n * similar to device.decreaseVolume()\n * @returns {Promise<audioState>}\n */\n decreaseVolume() {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#decreaseVolume: Currently no device is paired');\n\n return Promise.reject(\n new Error('DeviceManager#decreaseVolume: Currently no device is paired')\n );\n }\n\n return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);\n },\n\n /**\n * Sets paired device's volume but should use increase and decrease api instead\n * similar to device.setVolume()\n * @param {number} level\n * @returns {Promise<audioState>}\n */\n setVolume(level = 0) {\n if (!this._pairedDevice) {\n this.logger.error('DeviceManager#setVolume: Currently no device is paired');\n\n return Promise.reject(new Error('DeviceManager#setVolume: Currently no device is paired'));\n }\n\n return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {Array} deviceArray\n * @returns {device}\n */\n _updateDeviceMetadata(deviceArray = []) {\n if (!deviceArray.length) {\n return Promise.resolve(deviceArray);\n }\n const devices = cloneDeep(deviceArray);\n\n return Promise.all(\n devices.map((device, index) =>\n this.webex.internal.services\n .waitForCatalog('postauth')\n .then(() => {\n if (device.deviceClass === UC_CLOUD) {\n device.id = `${this.webex.internal.services.get('wdm')}/${device.id}`;\n }\n\n return this._decryptDeviceName(device);\n })\n .then((updatedDevice) => {\n devices[index] = updatedDevice;\n\n return Promise.resolve();\n })\n )\n ).then(() => Promise.resolve(devices));\n },\n\n /**\n * Utility function to update decrypted device name on device object\n * @param {object} inDevice\n * @returns {device}\n */\n _decryptDeviceName(inDevice = {}) {\n const device = cloneDeep(inDevice);\n\n if (\n device.metadata &&\n device.metadata.encryptedUserAssignedName &&\n device.metadata.encryptionKeyUrl\n ) {\n return this.webex.internal.encryption\n .decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName)\n .then((decryptedDeviceName) => {\n // set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed\n device.metadata.encryptedUserAssignedName = undefined;\n device.metadata.userAssignedName = decryptedDeviceName;\n\n return Promise.resolve(device);\n })\n .catch((err) => {\n // unset encryptedUserAssignedName if failed to decrypt\n device.metadata.encryptedUserAssignedName = undefined;\n this.logger.error(\n 'DeviceCollection#_decryptDeviceName: failed to decrypt device name',\n err\n );\n });\n }\n\n return Promise.resolve(device);\n },\n\n /**\n * Utility function to update device info on mercury updates\n * @param {object} device\n * @returns {device}\n */\n _receiveDeviceUpdates(device) {\n // we care only the updates are for the registered devices\n if (device && device.spaceUrl) {\n const deviceId = device.spaceUrl.substring(device.spaceUrl.lastIndexOf('/') + 1);\n const existingDevice = DeviceCollection.get(deviceId);\n\n if (existingDevice) {\n return this.webex.internal.lyra.space\n .get({id: deviceId})\n .then((space) => {\n // eslint-disable-next-line no-shadow\n const device = DeviceCollection.get(deviceId);\n\n if (\n device &&\n space.occupants &&\n (!space.occupants.self || !space.occupants.self.verified)\n ) {\n device.productName =\n (space.devices && space.devices[0] && space.devices[0].productName) ||\n DEFAULT_PRODUCT_NAME;\n // pin challenge is not verified reset _pairedDevice if ids\n // match\n const pairedDeviceId =\n this._pairedDevice && (this._pairedDevice.id || this._pairedDevice.identity.id);\n\n if (pairedDeviceId === deviceId) {\n this._pairedDevice = null;\n this.logger.info(\n `DeviceManager#_receiveDeviceUpdates: device ${deviceId} lost pairing`\n );\n\n return Promise.resolve();\n }\n // we do not want to reset the device pending PIN challenge\n if (this._devicePendingPinChallenge.identity.id !== deviceId) {\n return this.upsert(device);\n }\n\n return Promise.resolve();\n }\n\n return Promise.resolve();\n })\n .catch((err) => {\n this.logger.error(\n 'DeviceManager#_receiveDeviceUpdates: failed to receive updates for Lyra space',\n err\n );\n });\n }\n }\n\n return Promise.resolve();\n },\n\n /**\n * gets the currently paired device info if paired\n * @returns {device}\n */\n getPairedDevice() {\n if (!this._pairedDevice) {\n this.logger.info('DeviceManager#getPairedDevice: Currently no device is paired');\n\n return undefined;\n }\n const pairedDeviceId = this._pairedDevice?.id || this._pairedDevice?.identity?.id;\n\n return DeviceCollection.get(pairedDeviceId);\n },\n\n /**\n * Gets the currently set paired method\n * @returns {string} - The paired method (defaults to \"Manual\")\n */\n getPairedMethod() {\n return this._pairedMethod || 'Manual';\n },\n\n /**\n * Sets the paired method\n * @param {string} pairedMethod - The paired method to set\n * @returns {void}\n */\n setPairedMethod(pairedMethod) {\n this._pairedMethod = pairedMethod;\n },\n});\n\nexport default DeviceManager;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAF,sBAAA,CAAAH,OAAA;AAVA;AACA;AACA;;AAUA,IAAMM,aAAa,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACvCC,SAAS,EAAE,eAAe;EAC1BC,0BAA0B,EAAE,IAAI;EAChCC,aAAa,EAAE,IAAI;EACnBC,WAAW,EAAE,IAAI;EAEjBC,UAAU,WAAAA,WAAA,EAAG;IAAA,IAAAC,KAAA;IACX;IACA,IAAI,CAACC,aAAa,GAAG,QAAQ;;IAE7B;IACA,IAAI,CAACC,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACC,EAAE,CAAC,0BAA0B,EAAE,UAAAC,IAAA,EAAY;MAAA,IAAVC,IAAI,GAAAD,IAAA,CAAJC,IAAI;MAC/DP,KAAI,CAACQ,qBAAqB,CAACD,IAAI,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,MAAM,WAAAA,OAAA,EAAG;IACP,OAAOC,mBAAgB,CAACD,MAAM,CAAC,CAAC;EAClC,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,OAAO,WAAAA,QAAA,EAAG;IAAA,IAAAC,MAAA;IACRF,mBAAgB,CAACG,KAAK,CAAC,CAAC;IAExB,OAAO,IAAI,CAACX,KAAK,CACdY,OAAO,CAAC;MACPC,GAAG,EAAE,KAAK;MACVC,QAAQ,EAAE;IACZ,CAAC,CAAC,CACDC,IAAI,CAAC,UAACC,GAAG,EAAK;MACb,IAAI,CAACA,GAAG,CAACC,IAAI,EAAE;QACb,OAAOC,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,aAAa,cAAA6I,oBAAA,wBAAAC,qBAAA,GAAlBD,oBAAA,CAAoBjF,QAAQ,cAAAkF,qBAAA,uBAA5BA,qBAAA,CAA8BnF,EAAE;IAEjF,OAAO9C,mBAAgB,CAACuB,GAAG,CAACsG,cAAc,CAAC;EAC7C,CAAC;EAED;AACF;AACA;AACA;EACEK,eAAe,WAAAA,gBAAA,EAAG;IAChB,OAAO,IAAI,CAAC3I,aAAa,IAAI,QAAQ;EACvC,CAAC;EAED;AACF;AACA;AACA;AACA;EACE4I,eAAe,WAAAA,gBAACC,YAAY,EAAE;IAC5B,IAAI,CAAC7I,aAAa,GAAG6I,YAAY;EACnC,CAAC;EAAAC,OAAA;AACH,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5H,OAAA,GAEY7B,aAAa"}
|
package/package.json
CHANGED
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@webex/internal-plugin-calendar": "3.
|
|
26
|
-
"@webex/internal-plugin-device": "3.
|
|
27
|
-
"@webex/internal-plugin-lyra": "3.
|
|
28
|
-
"@webex/internal-plugin-search": "3.
|
|
29
|
-
"@webex/plugin-authorization": "3.
|
|
30
|
-
"@webex/plugin-logger": "3.
|
|
31
|
-
"@webex/test-helper-chai": "3.
|
|
32
|
-
"@webex/webex-core": "3.
|
|
25
|
+
"@webex/internal-plugin-calendar": "3.10.0",
|
|
26
|
+
"@webex/internal-plugin-device": "3.10.0",
|
|
27
|
+
"@webex/internal-plugin-lyra": "3.10.0",
|
|
28
|
+
"@webex/internal-plugin-search": "3.10.0",
|
|
29
|
+
"@webex/plugin-authorization": "3.10.0",
|
|
30
|
+
"@webex/plugin-logger": "3.10.0",
|
|
31
|
+
"@webex/test-helper-chai": "3.10.0",
|
|
32
|
+
"@webex/webex-core": "3.10.0",
|
|
33
33
|
"lodash": "^4.17.21",
|
|
34
34
|
"uuid": "^3.3.2"
|
|
35
35
|
},
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
49
49
|
"@webex/jest-config-legacy": "0.0.0",
|
|
50
50
|
"@webex/legacy-tools": "0.0.0",
|
|
51
|
-
"@webex/test-helper-chai": "3.
|
|
52
|
-
"@webex/test-helper-mocha": "3.
|
|
53
|
-
"@webex/test-helper-mock-webex": "3.
|
|
54
|
-
"@webex/test-helper-test-users": "3.
|
|
51
|
+
"@webex/test-helper-chai": "3.10.0",
|
|
52
|
+
"@webex/test-helper-mocha": "3.10.0",
|
|
53
|
+
"@webex/test-helper-mock-webex": "3.10.0",
|
|
54
|
+
"@webex/test-helper-test-users": "3.10.0",
|
|
55
55
|
"eslint": "^8.24.0",
|
|
56
56
|
"prettier": "^2.7.1"
|
|
57
57
|
},
|
|
58
|
-
"version": "3.
|
|
58
|
+
"version": "3.10.0"
|
|
59
59
|
}
|
package/src/device-manager.js
CHANGED
|
@@ -17,6 +17,9 @@ const DeviceManager = WebexPlugin.extend({
|
|
|
17
17
|
_boundSpace: null,
|
|
18
18
|
|
|
19
19
|
initialize() {
|
|
20
|
+
// Initialize the paired method property
|
|
21
|
+
this._pairedMethod = 'Manual';
|
|
22
|
+
|
|
20
23
|
// Lyra mercury events listener
|
|
21
24
|
this.webex.internal.mercury.on('event:lyra.space_updated', ({data}) => {
|
|
22
25
|
this._receiveDeviceUpdates(data);
|
|
@@ -638,6 +641,38 @@ const DeviceManager = WebexPlugin.extend({
|
|
|
638
641
|
|
|
639
642
|
return Promise.resolve();
|
|
640
643
|
},
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* gets the currently paired device info if paired
|
|
647
|
+
* @returns {device}
|
|
648
|
+
*/
|
|
649
|
+
getPairedDevice() {
|
|
650
|
+
if (!this._pairedDevice) {
|
|
651
|
+
this.logger.info('DeviceManager#getPairedDevice: Currently no device is paired');
|
|
652
|
+
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
const pairedDeviceId = this._pairedDevice?.id || this._pairedDevice?.identity?.id;
|
|
656
|
+
|
|
657
|
+
return DeviceCollection.get(pairedDeviceId);
|
|
658
|
+
},
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Gets the currently set paired method
|
|
662
|
+
* @returns {string} - The paired method (defaults to "Manual")
|
|
663
|
+
*/
|
|
664
|
+
getPairedMethod() {
|
|
665
|
+
return this._pairedMethod || 'Manual';
|
|
666
|
+
},
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Sets the paired method
|
|
670
|
+
* @param {string} pairedMethod - The paired method to set
|
|
671
|
+
* @returns {void}
|
|
672
|
+
*/
|
|
673
|
+
setPairedMethod(pairedMethod) {
|
|
674
|
+
this._pairedMethod = pairedMethod;
|
|
675
|
+
},
|
|
641
676
|
});
|
|
642
677
|
|
|
643
678
|
export default DeviceManager;
|
package/test/unit/spec/index.js
CHANGED
|
@@ -3,9 +3,220 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {assert} from '@webex/test-helper-chai';
|
|
6
|
+
import Mercury from '@webex/internal-plugin-mercury';
|
|
7
|
+
import WebexCore from '@webex/webex-core';
|
|
8
|
+
import DeviceManager from '../../../src/device-manager';
|
|
9
|
+
import DeviceCollection from '../../../src/collection';
|
|
10
|
+
import sinon from 'sinon';
|
|
11
|
+
import MockWebex from '@webex/test-helper-mock-webex';
|
|
6
12
|
|
|
7
|
-
describe('plugin-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
describe('plugin-device-manager', () => {
|
|
14
|
+
let webex;
|
|
15
|
+
let deviceManager;
|
|
16
|
+
let mockWebex;
|
|
17
|
+
let loggerSpy;
|
|
18
|
+
let deviceCollectionStub;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
loggerSpy = {
|
|
23
|
+
info: sinon.spy(),
|
|
24
|
+
error: sinon.spy(),
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
mockWebex = {
|
|
28
|
+
internal: {
|
|
29
|
+
mercury: {
|
|
30
|
+
on: sinon.stub(),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
logger: loggerSpy,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Create DeviceManager instance
|
|
37
|
+
deviceManager = new DeviceManager({}, {parent: mockWebex});
|
|
38
|
+
|
|
39
|
+
// Stub DeviceCollection.get method
|
|
40
|
+
deviceCollectionStub = sinon.stub(DeviceCollection, 'get');
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
sinon.restore();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('getPairedDevice', () => {
|
|
49
|
+
it('returns undefined when no device is paired (null)', () => {
|
|
50
|
+
deviceManager._pairedDevice = null;
|
|
51
|
+
|
|
52
|
+
const result = deviceManager.getPairedDevice();
|
|
53
|
+
|
|
54
|
+
assert.isUndefined(result);
|
|
55
|
+
assert.isTrue(deviceManager.logger.info.calledOnce);
|
|
56
|
+
assert.isTrue(deviceManager.logger.info.calledWith(
|
|
57
|
+
'DeviceManager#getPairedDevice: Currently no device is paired'
|
|
58
|
+
));
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('returns undefined when no device is paired (undefined)', () => {
|
|
62
|
+
deviceManager._pairedDevice = undefined;
|
|
63
|
+
|
|
64
|
+
const result = deviceManager.getPairedDevice();
|
|
65
|
+
|
|
66
|
+
assert.isUndefined(result);
|
|
67
|
+
assert.isTrue(deviceManager.logger.info.calledOnce);
|
|
68
|
+
assert.isTrue(deviceManager.logger.info.calledWith(
|
|
69
|
+
'DeviceManager#getPairedDevice: Currently no device is paired'
|
|
70
|
+
));
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('returns the paired device when a device is paired with id property', () => {
|
|
74
|
+
const mockDevice = { id: '123', name: 'Test Device' };
|
|
75
|
+
const retrievedDevice = { id: '123', name: 'Test Device', status: 'connected' };
|
|
76
|
+
deviceManager._pairedDevice = mockDevice;
|
|
77
|
+
DeviceCollection.get.withArgs('123').returns(retrievedDevice);
|
|
78
|
+
|
|
79
|
+
const result = deviceManager.getPairedDevice();
|
|
80
|
+
|
|
81
|
+
assert.strictEqual(result, retrievedDevice);
|
|
82
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
83
|
+
assert.isTrue(DeviceCollection.get.calledWith('123'));
|
|
84
|
+
assert.isFalse(deviceManager.logger.info.called);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('returns the paired device when a device is paired with identity.id property', () => {
|
|
88
|
+
const mockDevice = { identity: { id: '456' }, name: 'Test Device' };
|
|
89
|
+
const retrievedDevice = { id: '456', name: 'Test Device', status: 'connected' };
|
|
90
|
+
deviceManager._pairedDevice = mockDevice;
|
|
91
|
+
DeviceCollection.get.withArgs('456').returns(retrievedDevice);
|
|
92
|
+
|
|
93
|
+
const result = deviceManager.getPairedDevice();
|
|
94
|
+
|
|
95
|
+
assert.strictEqual(result, retrievedDevice);
|
|
96
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
97
|
+
assert.isTrue(DeviceCollection.get.calledWith('456'));
|
|
98
|
+
assert.isFalse(deviceManager.logger.info.called);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('handles device with both id and identity.id (id takes precedence)', () => {
|
|
102
|
+
const mockDevice = { id: '123', identity: { id: '456' }, name: 'Test Device' };
|
|
103
|
+
const retrievedDevice = { id: '123', name: 'Test Device', status: 'connected' };
|
|
104
|
+
deviceManager._pairedDevice = mockDevice;
|
|
105
|
+
DeviceCollection.get.withArgs('123').returns(retrievedDevice);
|
|
106
|
+
|
|
107
|
+
const result = deviceManager.getPairedDevice();
|
|
108
|
+
|
|
109
|
+
assert.strictEqual(result, retrievedDevice);
|
|
110
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
111
|
+
assert.isTrue(DeviceCollection.get.calledWith('123'));
|
|
112
|
+
// Should not call with '456' since id takes precedence
|
|
113
|
+
assert.isFalse(DeviceCollection.get.calledWith('456'));
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('returns undefined when DeviceCollection.get returns null', () => {
|
|
117
|
+
const mockDevice = { id: '123', name: 'Test Device' };
|
|
118
|
+
deviceManager._pairedDevice = mockDevice;
|
|
119
|
+
DeviceCollection.get.withArgs('123').returns(null);
|
|
120
|
+
|
|
121
|
+
const result = deviceManager.getPairedDevice();
|
|
122
|
+
|
|
123
|
+
assert.isNull(result);
|
|
124
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
125
|
+
assert.isTrue(DeviceCollection.get.calledWith('123'));
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('returns undefined when DeviceCollection.get returns undefined', () => {
|
|
129
|
+
const mockDevice = { id: '123', name: 'Test Device' };
|
|
130
|
+
deviceManager._pairedDevice = mockDevice;
|
|
131
|
+
DeviceCollection.get.withArgs('123').returns(undefined);
|
|
132
|
+
|
|
133
|
+
const result = deviceManager.getPairedDevice();
|
|
134
|
+
|
|
135
|
+
assert.isUndefined(result);
|
|
136
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
137
|
+
assert.isTrue(DeviceCollection.get.calledWith('123'));
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('handles device with empty identity object gracefully', () => {
|
|
141
|
+
const mockDevice = { identity: {}, name: 'Test Device' };
|
|
142
|
+
deviceManager._pairedDevice = mockDevice;
|
|
143
|
+
// Since neither id nor identity.id exist, pairedDeviceId will be undefined
|
|
144
|
+
DeviceCollection.get.withArgs(undefined).returns(undefined);
|
|
145
|
+
|
|
146
|
+
const result = deviceManager.getPairedDevice();
|
|
147
|
+
|
|
148
|
+
assert.isUndefined(result);
|
|
149
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
150
|
+
assert.isTrue(DeviceCollection.get.calledWith(undefined));
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('handles device with null identity gracefully', () => {
|
|
154
|
+
const mockDevice = { identity: null, name: 'Test Device' };
|
|
155
|
+
deviceManager._pairedDevice = mockDevice;
|
|
156
|
+
// Since neither id nor identity.id exist, pairedDeviceId will be undefined
|
|
157
|
+
DeviceCollection.get.withArgs(undefined).returns(undefined);
|
|
158
|
+
|
|
159
|
+
const result = deviceManager.getPairedDevice();
|
|
160
|
+
|
|
161
|
+
assert.isUndefined(result);
|
|
162
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
163
|
+
assert.isTrue(DeviceCollection.get.calledWith(undefined));
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('handles complex device object with additional properties', () => {
|
|
167
|
+
const mockDevice = {
|
|
168
|
+
identity: { id: '789', displayName: 'Conference Room A' },
|
|
169
|
+
name: 'Test Device',
|
|
170
|
+
deviceInfo: { machineType: 'LYRA_SPACE' },
|
|
171
|
+
metadata: { userAssignedName: 'My Device' }
|
|
172
|
+
};
|
|
173
|
+
const retrievedDevice = {
|
|
174
|
+
id: '789',
|
|
175
|
+
name: 'Test Device',
|
|
176
|
+
status: 'connected',
|
|
177
|
+
capabilities: ['audio', 'video']
|
|
178
|
+
};
|
|
179
|
+
deviceManager._pairedDevice = mockDevice;
|
|
180
|
+
DeviceCollection.get.withArgs('789').returns(retrievedDevice);
|
|
181
|
+
|
|
182
|
+
const result = deviceManager.getPairedDevice();
|
|
183
|
+
|
|
184
|
+
assert.strictEqual(result, retrievedDevice);
|
|
185
|
+
assert.isTrue(DeviceCollection.get.calledOnce);
|
|
186
|
+
assert.isTrue(DeviceCollection.get.calledWith('789'));
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe('pairedMethod', () => {
|
|
191
|
+
it('returns the default paired method value "Manual"', () => {
|
|
192
|
+
const result = deviceManager.getPairedMethod();
|
|
193
|
+
|
|
194
|
+
assert.strictEqual(result, 'Manual');
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it('returns the current paired method value when set', () => {
|
|
198
|
+
deviceManager._pairedMethod = 'Ultrasonic';
|
|
199
|
+
|
|
200
|
+
const result = deviceManager.getPairedMethod();
|
|
201
|
+
|
|
202
|
+
assert.strictEqual(result, 'Ultrasonic');
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('sets the paired method value', () => {
|
|
206
|
+
deviceManager.setPairedMethod('Ultrasonic');
|
|
207
|
+
|
|
208
|
+
assert.strictEqual(deviceManager._pairedMethod, 'Ultrasonic');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('updates the paired method value when called multiple times', () => {
|
|
212
|
+
deviceManager.setPairedMethod('Ultrasonic');
|
|
213
|
+
assert.strictEqual(deviceManager._pairedMethod, 'Ultrasonic');
|
|
214
|
+
|
|
215
|
+
deviceManager.setPairedMethod('Manual');
|
|
216
|
+
assert.strictEqual(deviceManager._pairedMethod, 'Manual');
|
|
217
|
+
|
|
218
|
+
deviceManager.setPairedMethod('QR');
|
|
219
|
+
assert.strictEqual(deviceManager._pairedMethod, 'QR');
|
|
220
|
+
});
|
|
10
221
|
});
|
|
11
222
|
});
|