/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var inherits = require('inherits');
var kurentoClient = require('kurento-client');
var disguise = kurentoClient.disguise;
var checkType = kurentoClient.checkType;
var ChecktypeError = checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var Endpoint = require('./Endpoint');
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* @classdesc
* Interface for endpoints the require a URI to work.
* An example of this, would be a :rom:cls:`PlayerEndpoint` whose URI property
* could be used to locate a file to stream.
*
* @abstract
* @extends module:core/abstracts.Endpoint
*
* @constructor module:core/abstracts.UriEndpoint
*
* @fires {@link module:core#event:UriEndpointStateChanged UriEndpointStateChanged}
*/
function UriEndpoint(){
UriEndpoint.super_.call(this);
};
inherits(UriEndpoint, Endpoint);
//
// Public properties
//
/**
* State of the endpoint
*
* @alias module:core/abstracts.UriEndpoint#getState
*
* @param {module:core/abstracts.UriEndpoint~getStateCallback} [callback]
*
* @return {external:Promise}
*/
UriEndpoint.prototype.getState = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getState', callback), this)
};
/**
* @callback module:core/abstracts.UriEndpoint~getStateCallback
* @param {external:Error} error
* @param {module:core/complexTypes.UriEndpointState} result
*/
/**
* The uri for this endpoint.
*
* @alias module:core/abstracts.UriEndpoint#getUri
*
* @param {module:core/abstracts.UriEndpoint~getUriCallback} [callback]
*
* @return {external:Promise}
*/
UriEndpoint.prototype.getUri = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'getUri', callback), this)
};
/**
* @callback module:core/abstracts.UriEndpoint~getUriCallback
* @param {external:Error} error
* @param {external:String} result
*/
//
// Public methods
//
/**
* Pauses the feed
*
* @alias module:core/abstracts.UriEndpoint.pause
*
* @param {module:core/abstracts.UriEndpoint~pauseCallback} [callback]
*
* @return {external:Promise}
*/
UriEndpoint.prototype.pause = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'pause', callback), this)
};
/**
* @callback module:core/abstracts.UriEndpoint~pauseCallback
* @param {external:Error} error
*/
/**
* Stops the feed
*
* @alias module:core/abstracts.UriEndpoint.stop
*
* @param {module:core/abstracts.UriEndpoint~stopCallback} [callback]
*
* @return {external:Promise}
*/
UriEndpoint.prototype.stop = function(callback){
var transaction = (arguments[0] instanceof Transaction)
? Array.prototype.shift.apply(arguments)
: undefined;
var usePromise = false;
if (callback == undefined) {
usePromise = true;
}
if(!arguments.length) callback = undefined;
callback = (callback || noop).bind(this)
return disguise(this._invoke(transaction, 'stop', callback), this)
};
/**
* @callback module:core/abstracts.UriEndpoint~stopCallback
* @param {external:Error} error
*/
/**
* @alias module:core/abstracts.UriEndpoint.constructorParams
*/
UriEndpoint.constructorParams = {
};
/**
* @alias module:core/abstracts.UriEndpoint.events
*
* @extends module:core/abstracts.Endpoint.events
*/
UriEndpoint.events = Endpoint.events.concat(['UriEndpointStateChanged']);
/**
* Checker for {@link module:core/abstracts.UriEndpoint}
*
* @memberof module:core/abstracts
*
* @param {external:String} key
* @param {module:core/abstracts.UriEndpoint} value
*/
function checkUriEndpoint(key, value)
{
if(!(value instanceof UriEndpoint))
throw ChecktypeError(key, UriEndpoint, value);
};
module.exports = UriEndpoint;
UriEndpoint.check = checkUriEndpoint;