@webex/plugin-device-manager 2.59.3-next.1 → 2.59.4-next.1
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/.eslintrc.js +6 -6
- package/README.md +80 -80
- package/babel.config.js +3 -3
- package/dist/collection.js +2 -2
- package/dist/collection.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/device-manager.js +111 -107
- package/dist/device-manager.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +13 -13
- package/process +1 -1
- package/sample/app.js +453 -453
- package/sample/index.html +121 -121
- package/src/collection.js +32 -32
- package/src/config.js +1 -1
- package/src/constants.js +3 -3
- package/src/device-manager.js +643 -643
- package/src/index.js +18 -18
- package/test/unit/spec/index.js +11 -11
- package/webex.js +42 -42
package/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# @webex/plugin-device-manager
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
> Plugin for the DeviceManager service
|
|
6
|
-
|
|
7
|
-
# WARNING: This plugin is currently under active development, is not stable, and breaking changes can and will happen!
|
|
8
|
-
|
|
9
|
-
- [Install](#install)
|
|
10
|
-
- [Usage](#usage)
|
|
11
|
-
- [Contribute](#contribute)
|
|
12
|
-
- [Maintainers](#maintainers)
|
|
13
|
-
- [License](#license)
|
|
14
|
-
|
|
15
|
-
## Install
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install --save @webex/plugin-device-manager
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
24
|
-
|
|
25
|
-
###Samples
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
yarn run samples:devicemanager
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
// initialize webex instance -> connects to mercury -> registers device ->
|
|
33
|
-
// initializes plugin-device-manager to listen for device updates
|
|
34
|
-
|
|
35
|
-
```javascript
|
|
36
|
-
import '@webex/plugin-device-manager';
|
|
37
|
-
import WebexCore from '@webex/webex-core';
|
|
38
|
-
function connect() {
|
|
39
|
-
if (!webex) {
|
|
40
|
-
webex = WebexCore.init({
|
|
41
|
-
config: {},
|
|
42
|
-
credentials: {
|
|
43
|
-
access_token: document.getElementById('access-token').value,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (!webex.internal.device.registered) {
|
|
48
|
-
webex.internal.device.register().then(() => {
|
|
49
|
-
return webex.internal.mercury.connect();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Typical flow
|
|
55
|
-
webex.devicemanager
|
|
56
|
-
.getAll() // gets a list of all devices registered to the user
|
|
57
|
-
.refresh() // refreshes and re-populates all devices registered to the user
|
|
58
|
-
.search() // search a device by name
|
|
59
|
-
.requestPin() // displays PIN Challenge on the device
|
|
60
|
-
.pair() // pairs the device and registers for subsequent fetches
|
|
61
|
-
.increaseVolume() // increases paired device's volume
|
|
62
|
-
.decreaseVolume() // decreases paired device's volume
|
|
63
|
-
.mute() // mutes the paired device
|
|
64
|
-
.unmute() // unmutes the paired device
|
|
65
|
-
.bindSpace() // binds the space to the paired device
|
|
66
|
-
.unbindSpace() // unbinds the space to the paired device
|
|
67
|
-
.unpair(); // disconnects the device paired session
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Maintainers
|
|
71
|
-
|
|
72
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
73
|
-
|
|
74
|
-
## Contribute
|
|
75
|
-
|
|
76
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
77
|
-
|
|
78
|
-
## License
|
|
79
|
-
|
|
80
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/plugin-device-manager
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
> Plugin for the DeviceManager service
|
|
6
|
+
|
|
7
|
+
# WARNING: This plugin is currently under active development, is not stable, and breaking changes can and will happen!
|
|
8
|
+
|
|
9
|
+
- [Install](#install)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [Contribute](#contribute)
|
|
12
|
+
- [Maintainers](#maintainers)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install --save @webex/plugin-device-manager
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
This is a plugin for the Cisco Webex JS SDK . Please see our [developer portal](https://developer.webex.com/) and the [API docs](https://webex.github.io/webex-js-sdk/api/) for full details.
|
|
24
|
+
|
|
25
|
+
###Samples
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
yarn run samples:devicemanager
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
// initialize webex instance -> connects to mercury -> registers device ->
|
|
33
|
+
// initializes plugin-device-manager to listen for device updates
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import '@webex/plugin-device-manager';
|
|
37
|
+
import WebexCore from '@webex/webex-core';
|
|
38
|
+
function connect() {
|
|
39
|
+
if (!webex) {
|
|
40
|
+
webex = WebexCore.init({
|
|
41
|
+
config: {},
|
|
42
|
+
credentials: {
|
|
43
|
+
access_token: document.getElementById('access-token').value,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (!webex.internal.device.registered) {
|
|
48
|
+
webex.internal.device.register().then(() => {
|
|
49
|
+
return webex.internal.mercury.connect();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Typical flow
|
|
55
|
+
webex.devicemanager
|
|
56
|
+
.getAll() // gets a list of all devices registered to the user
|
|
57
|
+
.refresh() // refreshes and re-populates all devices registered to the user
|
|
58
|
+
.search() // search a device by name
|
|
59
|
+
.requestPin() // displays PIN Challenge on the device
|
|
60
|
+
.pair() // pairs the device and registers for subsequent fetches
|
|
61
|
+
.increaseVolume() // increases paired device's volume
|
|
62
|
+
.decreaseVolume() // decreases paired device's volume
|
|
63
|
+
.mute() // mutes the paired device
|
|
64
|
+
.unmute() // unmutes the paired device
|
|
65
|
+
.bindSpace() // binds the space to the paired device
|
|
66
|
+
.unbindSpace() // unbinds the space to the paired device
|
|
67
|
+
.unpair(); // disconnects the device paired session
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Maintainers
|
|
71
|
+
|
|
72
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
73
|
+
|
|
74
|
+
## Contribute
|
|
75
|
+
|
|
76
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/dist/collection.js
CHANGED
|
@@ -7,7 +7,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
10
|
-
var
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
11
|
var DeviceCollection = {
|
|
12
12
|
devices: {},
|
|
13
13
|
get: function get(deviceId) {
|
|
@@ -19,7 +19,7 @@ var DeviceCollection = {
|
|
|
19
19
|
var existingDevice = this.devices[deviceId];
|
|
20
20
|
if (existingDevice) {
|
|
21
21
|
// already existing, merge for any new binding information
|
|
22
|
-
(0,
|
|
22
|
+
(0, _lodash.merge)(existingDevice, device);
|
|
23
23
|
} else {
|
|
24
24
|
this.devices[deviceId] = device;
|
|
25
25
|
}
|
package/dist/collection.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceCollection","devices","get","deviceId","set","device","id","identity","existingDevice","
|
|
1
|
+
{"version":3,"names":["_lodash","require","DeviceCollection","devices","get","deviceId","set","device","id","identity","existingDevice","merge","reset","getAll","_values","default","_default","exports"],"sources":["collection.js"],"sourcesContent":["import {merge} from 'lodash';\n\nconst DeviceCollection = {\n devices: {},\n\n get(deviceId) {\n return this.devices[deviceId];\n },\n\n set(device) {\n const deviceId = device.id || (device.identity && device.identity.id);\n // check if the device is already existing, if so then merge else add\n const existingDevice = this.devices[deviceId];\n\n if (existingDevice) {\n // already existing, merge for any new binding information\n merge(existingDevice, device);\n } else {\n this.devices[deviceId] = device;\n }\n },\n\n reset() {\n this.devices = {};\n },\n\n getAll() {\n return Object.values(this.devices);\n },\n};\n\nexport default DeviceCollection;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAMC,gBAAgB,GAAG;EACvBC,OAAO,EAAE,CAAC,CAAC;EAEXC,GAAG,WAAAA,IAACC,QAAQ,EAAE;IACZ,OAAO,IAAI,CAACF,OAAO,CAACE,QAAQ,CAAC;EAC/B,CAAC;EAEDC,GAAG,WAAAA,IAACC,MAAM,EAAE;IACV,IAAMF,QAAQ,GAAGE,MAAM,CAACC,EAAE,IAAKD,MAAM,CAACE,QAAQ,IAAIF,MAAM,CAACE,QAAQ,CAACD,EAAG;IACrE;IACA,IAAME,cAAc,GAAG,IAAI,CAACP,OAAO,CAACE,QAAQ,CAAC;IAE7C,IAAIK,cAAc,EAAE;MAClB;MACA,IAAAC,aAAK,EAACD,cAAc,EAAEH,MAAM,CAAC;IAC/B,CAAC,MAAM;MACL,IAAI,CAACJ,OAAO,CAACE,QAAQ,CAAC,GAAGE,MAAM;IACjC;EACF,CAAC;EAEDK,KAAK,WAAAA,MAAA,EAAG;IACN,IAAI,CAACT,OAAO,GAAG,CAAC,CAAC;EACnB,CAAC;EAEDU,MAAM,WAAAA,OAAA,EAAG;IACP,OAAO,IAAAC,OAAA,CAAAC,OAAA,EAAc,IAAI,CAACZ,OAAO,CAAC;EACpC;AACF,CAAC;AAAC,IAAAa,QAAA,GAEad,gBAAgB;AAAAe,OAAA,CAAAF,OAAA,GAAAC,QAAA"}
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["exports","default","_default"],"sources":["config.js"],"sourcesContent":["export default {};\
|
|
1
|
+
{"version":3,"names":["exports","default","_default"],"sources":["config.js"],"sourcesContent":["export default {};\n"],"mappings":";;;;;;;eAAe,CAAC,CAAC;AAAAA,OAAA,CAAAC,OAAA,GAAAC,QAAA"}
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LYRA_SPACE","exports","UC_CLOUD","DEFAULT_PRODUCT_NAME"],"sources":["constants.js"],"sourcesContent":["export const LYRA_SPACE = 'LYRA_SPACE';\
|
|
1
|
+
{"version":3,"names":["LYRA_SPACE","exports","UC_CLOUD","DEFAULT_PRODUCT_NAME"],"sources":["constants.js"],"sourcesContent":["export const LYRA_SPACE = 'LYRA_SPACE';\nexport const UC_CLOUD = 'uc-cloud';\nexport const DEFAULT_PRODUCT_NAME = 'default';\n"],"mappings":";;;;;;;AAAO,IAAMA,UAAU,GAAG,YAAY;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA;AAChC,IAAME,QAAQ,GAAG,UAAU;AAACD,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAC5B,IAAMC,oBAAoB,GAAG,SAAS;AAACF,OAAA,CAAAE,oBAAA,GAAAA,oBAAA"}
|
package/dist/device-manager.js
CHANGED
|
@@ -7,13 +7,17 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
|
-
var
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
11
|
require("@webex/internal-plugin-lyra");
|
|
12
12
|
require("@webex/internal-plugin-search");
|
|
13
13
|
var _webexCore = require("@webex/webex-core");
|
|
14
14
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
15
|
var _constants = require("./constants");
|
|
16
16
|
var _collection = _interopRequireDefault(require("./collection"));
|
|
17
|
+
/*!
|
|
18
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
|
+
*/
|
|
20
|
+
|
|
17
21
|
var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
18
22
|
namespace: 'DeviceManager',
|
|
19
23
|
_devicePendingPinChallenge: null,
|
|
@@ -27,18 +31,18 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
27
31
|
_this._receiveDeviceUpdates(data);
|
|
28
32
|
});
|
|
29
33
|
},
|
|
30
|
-
/**
|
|
31
|
-
* Gets a list of all recent devices associated with the user
|
|
32
|
-
* the device list gets populated from Redis
|
|
33
|
-
* @returns {Promise<Device>}
|
|
34
|
+
/**
|
|
35
|
+
* Gets a list of all recent devices associated with the user
|
|
36
|
+
* the device list gets populated from Redis
|
|
37
|
+
* @returns {Promise<Device>}
|
|
34
38
|
*/
|
|
35
39
|
getAll: function getAll() {
|
|
36
40
|
return _collection.default.getAll();
|
|
37
41
|
},
|
|
38
|
-
/**
|
|
39
|
-
* Gets a list of all recent devices associated with the user
|
|
40
|
-
* the device list gets populated from Redis
|
|
41
|
-
* @returns {Promise<Device>}
|
|
42
|
+
/**
|
|
43
|
+
* Gets a list of all recent devices associated with the user
|
|
44
|
+
* the device list gets populated from Redis
|
|
45
|
+
* @returns {Promise<Device>}
|
|
42
46
|
*/
|
|
43
47
|
refresh: function refresh() {
|
|
44
48
|
var _this2 = this;
|
|
@@ -69,11 +73,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
69
73
|
_this2.logger.error('DeviceManager#refresh: failed to fetch recent devices', err);
|
|
70
74
|
});
|
|
71
75
|
},
|
|
72
|
-
/**
|
|
73
|
-
* Search for a device by name
|
|
74
|
-
* @param {Object} options
|
|
75
|
-
* @param {string} options.searchQuery
|
|
76
|
-
* @returns {Promise<Device>}
|
|
76
|
+
/**
|
|
77
|
+
* Search for a device by name
|
|
78
|
+
* @param {Object} options
|
|
79
|
+
* @param {string} options.searchQuery
|
|
80
|
+
* @returns {Promise<Device>}
|
|
77
81
|
*/
|
|
78
82
|
search: function search(options) {
|
|
79
83
|
var _this3 = this;
|
|
@@ -93,11 +97,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
93
97
|
throw err;
|
|
94
98
|
});
|
|
95
99
|
},
|
|
96
|
-
/**
|
|
97
|
-
* Caches the device info and also registers to Redis for subsequent fetches
|
|
98
|
-
* @param {Object} device
|
|
99
|
-
* @param {string} device.id
|
|
100
|
-
* @returns {deviceInfo}
|
|
100
|
+
/**
|
|
101
|
+
* Caches the device info and also registers to Redis for subsequent fetches
|
|
102
|
+
* @param {Object} device
|
|
103
|
+
* @param {string} device.id
|
|
104
|
+
* @returns {deviceInfo}
|
|
101
105
|
*/
|
|
102
106
|
upsert: function upsert(device) {
|
|
103
107
|
var _this4 = this;
|
|
@@ -133,10 +137,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
133
137
|
return _promise.default.reject(err);
|
|
134
138
|
});
|
|
135
139
|
},
|
|
136
|
-
/**
|
|
137
|
-
* Retreives device info of a particular device
|
|
138
|
-
* @param {string} token
|
|
139
|
-
* @returns {Promise<deviceInfo>}
|
|
140
|
+
/**
|
|
141
|
+
* Retreives device info of a particular device
|
|
142
|
+
* @param {string} token
|
|
143
|
+
* @returns {Promise<deviceInfo>}
|
|
140
144
|
*/
|
|
141
145
|
get: function get(token) {
|
|
142
146
|
var _this5 = this;
|
|
@@ -162,11 +166,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
162
166
|
return _promise.default.reject(err);
|
|
163
167
|
});
|
|
164
168
|
},
|
|
165
|
-
/**
|
|
166
|
-
* Unregisters the device from Redis, will not fetch in subsequent loads,
|
|
167
|
-
* similar to space.deleteBinding()
|
|
168
|
-
* @param {string} deviceId
|
|
169
|
-
* @returns {Promise<deviceInfo>}
|
|
169
|
+
/**
|
|
170
|
+
* Unregisters the device from Redis, will not fetch in subsequent loads,
|
|
171
|
+
* similar to space.deleteBinding()
|
|
172
|
+
* @param {string} deviceId
|
|
173
|
+
* @returns {Promise<deviceInfo>}
|
|
170
174
|
*/
|
|
171
175
|
remove: function remove(deviceId) {
|
|
172
176
|
var _this6 = this;
|
|
@@ -183,12 +187,12 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
183
187
|
return _promise.default.reject(error);
|
|
184
188
|
});
|
|
185
189
|
},
|
|
186
|
-
/**
|
|
187
|
-
* Requests to display PIN on the device
|
|
188
|
-
* @param {object} device
|
|
189
|
-
* @param {object} options
|
|
190
|
-
* @param {object} options.data
|
|
191
|
-
* @returns {Promise<deviceInfo>}
|
|
190
|
+
/**
|
|
191
|
+
* Requests to display PIN on the device
|
|
192
|
+
* @param {object} device
|
|
193
|
+
* @param {object} options
|
|
194
|
+
* @param {object} options.data
|
|
195
|
+
* @returns {Promise<deviceInfo>}
|
|
192
196
|
*/
|
|
193
197
|
requestPin: function requestPin(device) {
|
|
194
198
|
var _this7 = this;
|
|
@@ -228,13 +232,13 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
228
232
|
return _promise.default.reject(err);
|
|
229
233
|
});
|
|
230
234
|
},
|
|
231
|
-
/**
|
|
232
|
-
* pairs the device with the user (manual pairing), also adds it to
|
|
233
|
-
* user's recents list for subsequent fetches.
|
|
234
|
-
* similar to space.join()
|
|
235
|
-
* @param {object} options
|
|
236
|
-
* @param {number} options.pin
|
|
237
|
-
* @returns {Promise<deviceInfo>}
|
|
235
|
+
/**
|
|
236
|
+
* pairs the device with the user (manual pairing), also adds it to
|
|
237
|
+
* user's recents list for subsequent fetches.
|
|
238
|
+
* similar to space.join()
|
|
239
|
+
* @param {object} options
|
|
240
|
+
* @param {number} options.pin
|
|
241
|
+
* @returns {Promise<deviceInfo>}
|
|
238
242
|
*/
|
|
239
243
|
pair: function pair() {
|
|
240
244
|
var _this8 = this;
|
|
@@ -261,14 +265,14 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
261
265
|
this.logger.error('DeviceManager#pair: no device to pair');
|
|
262
266
|
return _promise.default.reject(new Error('DeviceManager#pair: no device to pair'));
|
|
263
267
|
},
|
|
264
|
-
/**
|
|
265
|
-
* unpairs the device with the user (manual/ultrasonic pairing), but still
|
|
266
|
-
* keeps in the recents list/does not remove from Redis
|
|
267
|
-
* options.removeAllDevices will remove all associated devices to user
|
|
268
|
-
* similar to space.leave()
|
|
269
|
-
* @param {object} options
|
|
270
|
-
* @param {boolean} options.removeAllDevices
|
|
271
|
-
* @returns {Promise<deviceInfo>}
|
|
268
|
+
/**
|
|
269
|
+
* unpairs the device with the user (manual/ultrasonic pairing), but still
|
|
270
|
+
* keeps in the recents list/does not remove from Redis
|
|
271
|
+
* options.removeAllDevices will remove all associated devices to user
|
|
272
|
+
* similar to space.leave()
|
|
273
|
+
* @param {object} options
|
|
274
|
+
* @param {boolean} options.removeAllDevices
|
|
275
|
+
* @returns {Promise<deviceInfo>}
|
|
272
276
|
*/
|
|
273
277
|
unpair: function unpair() {
|
|
274
278
|
var _this9 = this;
|
|
@@ -285,13 +289,13 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
285
289
|
return _promise.default.reject(err);
|
|
286
290
|
});
|
|
287
291
|
},
|
|
288
|
-
/**
|
|
289
|
-
* binds the space to the paired device (if supported)
|
|
290
|
-
* similar to space.bindConversation()
|
|
291
|
-
* @param {object} options
|
|
292
|
-
* @param {boolean} options.url, conversation url
|
|
293
|
-
* @param {boolean} options.kmsResourceObjectUrl of the convo
|
|
294
|
-
* @returns {Promise<deviceInfo>}
|
|
292
|
+
/**
|
|
293
|
+
* binds the space to the paired device (if supported)
|
|
294
|
+
* similar to space.bindConversation()
|
|
295
|
+
* @param {object} options
|
|
296
|
+
* @param {boolean} options.url, conversation url
|
|
297
|
+
* @param {boolean} options.kmsResourceObjectUrl of the convo
|
|
298
|
+
* @returns {Promise<deviceInfo>}
|
|
295
299
|
*/
|
|
296
300
|
bindSpace: function bindSpace() {
|
|
297
301
|
var _this10 = this;
|
|
@@ -321,10 +325,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
321
325
|
return _promise.default.reject(err);
|
|
322
326
|
});
|
|
323
327
|
},
|
|
324
|
-
/**
|
|
325
|
-
* unbinds the space to the paired device (if supported)
|
|
326
|
-
* similar to space.unbindConversation()
|
|
327
|
-
* @returns {Promise<deviceInfo>}
|
|
328
|
+
/**
|
|
329
|
+
* unbinds the space to the paired device (if supported)
|
|
330
|
+
* similar to space.unbindConversation()
|
|
331
|
+
* @returns {Promise<deviceInfo>}
|
|
328
332
|
*/
|
|
329
333
|
unbindSpace: function unbindSpace() {
|
|
330
334
|
var _this11 = this;
|
|
@@ -344,10 +348,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
344
348
|
return _promise.default.reject(err);
|
|
345
349
|
});
|
|
346
350
|
},
|
|
347
|
-
/**
|
|
348
|
-
* Gets the audio state of the paired device
|
|
349
|
-
* similar to device.getAudioState()
|
|
350
|
-
* @returns {Promise<audioState>}
|
|
351
|
+
/**
|
|
352
|
+
* Gets the audio state of the paired device
|
|
353
|
+
* similar to device.getAudioState()
|
|
354
|
+
* @returns {Promise<audioState>}
|
|
351
355
|
*/
|
|
352
356
|
getAudioState: function getAudioState() {
|
|
353
357
|
if (!this._pairedDevice) {
|
|
@@ -356,22 +360,22 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
356
360
|
}
|
|
357
361
|
return this.webex.internal.lyra.device.getAudioState(this._pairedDevice);
|
|
358
362
|
},
|
|
359
|
-
/**
|
|
360
|
-
* Updates audio state of the paired device, should be called every 10 minutes
|
|
361
|
-
* or when mic or volume state is changed
|
|
362
|
-
* similar to device.putAudioState()
|
|
363
|
-
* @param {object} space
|
|
364
|
-
* @param {object} audioState
|
|
365
|
-
* @returns {Promise<audioState>}
|
|
363
|
+
/**
|
|
364
|
+
* Updates audio state of the paired device, should be called every 10 minutes
|
|
365
|
+
* or when mic or volume state is changed
|
|
366
|
+
* similar to device.putAudioState()
|
|
367
|
+
* @param {object} space
|
|
368
|
+
* @param {object} audioState
|
|
369
|
+
* @returns {Promise<audioState>}
|
|
366
370
|
*/
|
|
367
371
|
putAudioState: function putAudioState(space) {
|
|
368
372
|
var audioState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
369
373
|
return this.webex.internal.lyra.device.putAudioState(space, audioState);
|
|
370
374
|
},
|
|
371
|
-
/**
|
|
372
|
-
* Mutes paired device
|
|
373
|
-
* similar to device.mute()
|
|
374
|
-
* @returns {Promise<audioState>}
|
|
375
|
+
/**
|
|
376
|
+
* Mutes paired device
|
|
377
|
+
* similar to device.mute()
|
|
378
|
+
* @returns {Promise<audioState>}
|
|
375
379
|
*/
|
|
376
380
|
mute: function mute() {
|
|
377
381
|
if (!this._pairedDevice) {
|
|
@@ -380,10 +384,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
380
384
|
}
|
|
381
385
|
return this.webex.internal.lyra.device.mute(this._pairedDevice);
|
|
382
386
|
},
|
|
383
|
-
/**
|
|
384
|
-
* Unmutes paired device
|
|
385
|
-
* similar to device.unmute()
|
|
386
|
-
* @returns {Promise<audioState>}
|
|
387
|
+
/**
|
|
388
|
+
* Unmutes paired device
|
|
389
|
+
* similar to device.unmute()
|
|
390
|
+
* @returns {Promise<audioState>}
|
|
387
391
|
*/
|
|
388
392
|
unmute: function unmute() {
|
|
389
393
|
if (!this._pairedDevice) {
|
|
@@ -392,10 +396,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
392
396
|
}
|
|
393
397
|
return this.webex.internal.lyra.device.unmute(this._pairedDevice);
|
|
394
398
|
},
|
|
395
|
-
/**
|
|
396
|
-
* Increases paired device's volume
|
|
397
|
-
* similar to device.increaseVolume()
|
|
398
|
-
* @returns {Promise<audioState>}
|
|
399
|
+
/**
|
|
400
|
+
* Increases paired device's volume
|
|
401
|
+
* similar to device.increaseVolume()
|
|
402
|
+
* @returns {Promise<audioState>}
|
|
399
403
|
*/
|
|
400
404
|
increaseVolume: function increaseVolume() {
|
|
401
405
|
if (!this._pairedDevice) {
|
|
@@ -404,10 +408,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
404
408
|
}
|
|
405
409
|
return this.webex.internal.lyra.device.increaseVolume(this._pairedDevice);
|
|
406
410
|
},
|
|
407
|
-
/**
|
|
408
|
-
* Decreases paired device's volume
|
|
409
|
-
* similar to device.decreaseVolume()
|
|
410
|
-
* @returns {Promise<audioState>}
|
|
411
|
+
/**
|
|
412
|
+
* Decreases paired device's volume
|
|
413
|
+
* similar to device.decreaseVolume()
|
|
414
|
+
* @returns {Promise<audioState>}
|
|
411
415
|
*/
|
|
412
416
|
decreaseVolume: function decreaseVolume() {
|
|
413
417
|
if (!this._pairedDevice) {
|
|
@@ -416,11 +420,11 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
416
420
|
}
|
|
417
421
|
return this.webex.internal.lyra.device.decreaseVolume(this._pairedDevice);
|
|
418
422
|
},
|
|
419
|
-
/**
|
|
420
|
-
* Sets paired device's volume but should use increase and decrease api instead
|
|
421
|
-
* similar to device.setVolume()
|
|
422
|
-
* @param {number} level
|
|
423
|
-
* @returns {Promise<audioState>}
|
|
423
|
+
/**
|
|
424
|
+
* Sets paired device's volume but should use increase and decrease api instead
|
|
425
|
+
* similar to device.setVolume()
|
|
426
|
+
* @param {number} level
|
|
427
|
+
* @returns {Promise<audioState>}
|
|
424
428
|
*/
|
|
425
429
|
setVolume: function setVolume() {
|
|
426
430
|
var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -430,10 +434,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
430
434
|
}
|
|
431
435
|
return this.webex.internal.lyra.device.setVolume(this._pairedDevice, level);
|
|
432
436
|
},
|
|
433
|
-
/**
|
|
434
|
-
* Utility function to update decrypted device name on device object
|
|
435
|
-
* @param {Array} deviceArray
|
|
436
|
-
* @returns {device}
|
|
437
|
+
/**
|
|
438
|
+
* Utility function to update decrypted device name on device object
|
|
439
|
+
* @param {Array} deviceArray
|
|
440
|
+
* @returns {device}
|
|
437
441
|
*/
|
|
438
442
|
_updateDeviceMetadata: function _updateDeviceMetadata() {
|
|
439
443
|
var _this12 = this;
|
|
@@ -441,7 +445,7 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
441
445
|
if (!deviceArray.length) {
|
|
442
446
|
return _promise.default.resolve(deviceArray);
|
|
443
447
|
}
|
|
444
|
-
var devices = (0,
|
|
448
|
+
var devices = (0, _lodash.cloneDeep)(deviceArray);
|
|
445
449
|
return _promise.default.all(devices.map(function (device, index) {
|
|
446
450
|
return _this12.webex.internal.services.waitForCatalog('postauth').then(function () {
|
|
447
451
|
if (device.deviceClass === _constants.UC_CLOUD) {
|
|
@@ -456,15 +460,15 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
456
460
|
return _promise.default.resolve(devices);
|
|
457
461
|
});
|
|
458
462
|
},
|
|
459
|
-
/**
|
|
460
|
-
* Utility function to update decrypted device name on device object
|
|
461
|
-
* @param {object} inDevice
|
|
462
|
-
* @returns {device}
|
|
463
|
+
/**
|
|
464
|
+
* Utility function to update decrypted device name on device object
|
|
465
|
+
* @param {object} inDevice
|
|
466
|
+
* @returns {device}
|
|
463
467
|
*/
|
|
464
468
|
_decryptDeviceName: function _decryptDeviceName() {
|
|
465
469
|
var _this13 = this;
|
|
466
470
|
var inDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
467
|
-
var device = (0,
|
|
471
|
+
var device = (0, _lodash.cloneDeep)(inDevice);
|
|
468
472
|
if (device.metadata && device.metadata.encryptedUserAssignedName && device.metadata.encryptionKeyUrl) {
|
|
469
473
|
return this.webex.internal.encryption.decryptText(device.metadata.encryptionKeyUrl, device.metadata.encryptedUserAssignedName).then(function (decryptedDeviceName) {
|
|
470
474
|
// set userAssignedName as the decypted value, unset encryptedUserAssignedName since it's not needed
|
|
@@ -479,10 +483,10 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
479
483
|
}
|
|
480
484
|
return _promise.default.resolve(device);
|
|
481
485
|
},
|
|
482
|
-
/**
|
|
483
|
-
* Utility function to update device info on mercury updates
|
|
484
|
-
* @param {object} device
|
|
485
|
-
* @returns {device}
|
|
486
|
+
/**
|
|
487
|
+
* Utility function to update device info on mercury updates
|
|
488
|
+
* @param {object} device
|
|
489
|
+
* @returns {device}
|
|
486
490
|
*/
|
|
487
491
|
_receiveDeviceUpdates: function _receiveDeviceUpdates(device) {
|
|
488
492
|
var _this14 = this;
|
|
@@ -520,7 +524,7 @@ var DeviceManager = _webexCore.WebexPlugin.extend({
|
|
|
520
524
|
}
|
|
521
525
|
return _promise.default.resolve();
|
|
522
526
|
},
|
|
523
|
-
version: "2.59.
|
|
527
|
+
version: "2.59.4-next.1"
|
|
524
528
|
});
|
|
525
529
|
var _default = DeviceManager;
|
|
526
530
|
exports.default = _default;
|