Author: ygrego Date: 2015-04-27 14:29:28 +0000 (Mon, 27 Apr 2015) New Revision: 1261 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1261 Log: Implementation of methods: "record", "recordAt", "addEventListener", "removeEventListerner" and "_fireEvent". Modified: oipf/js/impl/RecordingSchedulerObject.js Modified: oipf/js/impl/RecordingSchedulerObject.js =================================================================== --- oipf/js/impl/RecordingSchedulerObject.js 2015-04-27 13:05:56 UTC (rev 1260) +++ oipf/js/impl/RecordingSchedulerObject.js 2015-04-27 14:29:28 UTC (rev 1261) @@ -1,7 +1,102 @@ var RecordingSchedulerObject = Class.extend({ + + /* + * Description: + * Provides a list of scheduled and recorded programmes in the system. + * This property may only provide access to a subset of the full list + * of recordings, as determined by the value of the manageRecordings + * attribute of the <recording> element in the client capability + * description (see section 9.3.3). + * + * Visibility Type: readonly ScheduledRecordingCollection + */ + recordings: null, + + /* + * Description: + * Get information about the status of the local storage device. + * The DiscInfo class is defined in section 7.16.4. + * + * Visibility Type: readonly ScheduledRecordingCollection + */ + discInfo: null, - init : function(){ + init: function() { + this.eventMnager = new EventManager(); + this.timerManager = new TimerManager(); + this._timeout = this.timermanager.createTimer; + this.callbacks = {}; + this.listeners = {}; + + this.recordings = new ScheduledRecordingCollection(); + + }, + /* + *Description: + * + * FIXME: + * Yannis - 27/04/2015 - Do verification on parameter + * Yannis - 27/04/2015 - Verify pvr capability in order to manage + * recordings in order to store them into properties "recordings". + */ + record: function(programme) { + return new ScheduledRecording(programme); + }, + + /* + * Description: + * + * FIXME: + * Yannis - 27/04/2015 - Do verification on parameters + * Yannis - 27/04/2015 - Verify pvr capability in order to manage + * recordings in order to store them into properties "recordings". + */ + recordAt: function(startTime, duration, repeatDays, channelID) { + var channel = this.getChannelConfig().channelList.getChannel(channelID); + + if (channel) { + return new ScheduledRecording( + startTime, duration, repeatDays, channel); + } + + return null; + }, + + getChannelConfig: function() { + + }, + + get onPVREvent() { + return this._getCallback("PVREvent"); + }, + + set onPVREvent(callback) { + this._setCallback(callback); + }, + + _getCallback : function(type) { + if(this._callbacks) { + return this._callbacks[type]; + } + }, + + _setCallback: function(type, callback){ + if(this._callbacks) { + this._callbacks[type] = callback; + } + }, + + addEventListener: function(type, listener) { + this._eventManager.addEventListener(type, listener, this); + }, + + _fireEvent: function(event) { + this._eventManager.fireEvent(event, this); + }, + + removeEventListener: function(type, listener) { + this._eventManager.removeEventListener(type, listener, this); } }); \ No newline at end of file