bria
Version:
CounterPath Bria Desktop API for Node.js
67 lines • 3.12 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var BriaRequest_1 = __importDefault(require("./BriaRequest"));
var sxml_1 = __importDefault(require("sxml"));
var SelectAudioDeviceRequest = /** @class */ (function (_super) {
__extends(SelectAudioDeviceRequest, _super);
function SelectAudioDeviceRequest(devices) {
var e_1, _a;
var _b;
var _this = _super.call(this, 'selectAudioDevices', 'devices') || this;
try {
for (var devices_1 = __values(devices), devices_1_1 = devices_1.next(); !devices_1_1.done; devices_1_1 = devices_1.next()) {
var dev = devices_1_1.value;
if (!dev.roles)
continue;
var devXml = new sxml_1.default.XML();
devXml.setTag('device');
devXml.insertValue('name', dev.name);
devXml.insertValue('id', dev.id.toString());
devXml.insertValue('type', dev.type);
// Bria API only supports changing one role per device per request.
devXml.insertValue('role', dev.roles[0]);
(_b = _this.xml) === null || _b === void 0 ? void 0 : _b.push(devXml);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
}
finally { if (e_1) throw e_1.error; }
}
return _this;
}
return SelectAudioDeviceRequest;
}(BriaRequest_1.default));
exports.default = SelectAudioDeviceRequest;
//# sourceMappingURL=SelectAudioDeviceRequest.js.map