Author: ygrego Date: 2015-06-09 15:19:17 +0000 (Tue, 09 Jun 2015) New Revision: 1656 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1656 Log: Transformation of each class in ES6 class. Modified: oipf/lib/js/impl/OipfObjectFactory.js oipf/lib/js/impl/ParentalControlManagerObject.js oipf/lib/js/impl/RecordingSchedulerObject.js oipf/lib/js/impl/RemoteControlFunctionObject.js oipf/lib/js/impl/RemoteManagementObject.js oipf/lib/js/impl/SearchManagerObject.js oipf/lib/js/impl/StatusViewObject.js oipf/lib/js/impl/VideoBroadcastObject.js oipf/lib/js/impl/VideoMpegObject.js Modified: oipf/lib/js/impl/OipfObjectFactory.js =================================================================== --- oipf/lib/js/impl/OipfObjectFactory.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/OipfObjectFactory.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,37 +1,60 @@ - - /*! * \class OipfObjectFactory * \brief Provide access to components of a terminal supporting OIFP specification. - */ -var OipfObjectFactory = Class.extend({ - - _createDocument: function(filename, callbackName) { - var self = this; - if (window.XMLHttpRequest) { - this.xmlHttpRequest = new XMLHttpRequest(); - this.xmlHttpRequest.open("GET", filename); - this.xmlHttpRequest.send(); - this.xmlHttpRequest.onload = function() { - if(this.status == 200 && this.responseXML != null) { - var xmlToJson = new XmlToJson(this.responseXML); - var jsonData = xmlToJson.getJson(); - - self[callbackName].call(self, jsonData); - console.log("A new doument has been created."); - } else { - console.log("An error occured during the document creation."); - } - }; - } - }, - - init: function() { + */ +class OipfObjectFactory { + + constructor() { console.log("[INFO] constructor of OipfObjectFactory class called."); var modelFactory = new ModelFactory(); var dateUtils = new DateUtils(); - this._oipfConfiguration = new OipfConfiguration(); - this.applicationManagerObject = + this._oipfConfiguration = new OipfConfiguration(); + + /*The ChannelConfig class provides the entry point for applications to get information about the list of channels + * available. It can be obtained in two ways: + * -By calling the method getChannelConfig() of the video/broadcast embedded object as defined in + * section 7.13.1.3. + * -By calling the method createChannelConfig() of the object factory API as defined in section 7.1.1. + * The availability of the properties and methods are dependent on the capabilities description as specified in section 9.3. + * The following table provides a list of the capabilities and the associated properties and methods. If the capability is false + * the properties and methods SHALL NOT be available to the application. Properties and methods not listed in the + * following table SHALL be available to all applications as long as the OITF has indicated support for tuner control (i.e. + * <video_broadcast>true</video_broadcast> as defined in section 9.3.1) in their capability. + * ------------------------------------------------------------------------ + * Capability | Properties | Methods + * --------------------------------- --------------- ---------------------- + * Element <extendedAVControl> | onChannelScan | startScan() + * is set to “ true ” as defined in | | stopScan() + * section 9.3.6. | | + * --------------------------------- --------------- ---------------------- + * Element <video_broadcast | |createChannelList() + * type="ID_IPTV_SDS"> is set as | | + * defined in section 9.3.6. | | + * ------------------------------------------------------------------------ + */ + this.channelConfig = null; + + /* + * Description: Access to the functionality of the application/oipfRemoteManagement embedded object SHALL adhere to the + * security requirements as defined in section 10. + */ + this.remoteManagementObject = null; + + + /* + * Description: OITFs SHALL implement the application/oipfSearchManager embedded object. This object provides a + * mechanism for applications to create and manage metadata searches. + */ + this.searchManagerObject = null; + + /* + * Description: An OITF SHALL support a non-visual embedded object of type “ application/oipfApplicationManager ”, with + * the following JavaScript API, to enable applications to access the privileged functionality related to application lifecycle + * and management that is provided by the application model defined in this section. + * If one of the methods on the application/oipfApplicationManager is called by a webpage that is not a + * privileged DAE application, the OITF SHALL throw an error as defined in section 10.1.1. + */ + this.applicationManagerObject = new ApplicationManagerObject( this._oipfConfiguration.applicationVisualizationMode); this.capabilitiesObject = new CapabilitiesObject(modelFactory); @@ -53,80 +76,29 @@ //this.gatewayInfoObject= new GatewayInfoObject(); //this.remoteManagementObject = new RemoteManagementObject(); //this.remoteControlFunctionObject = new RemoteControlFunctionObject(); - }, - - /* - * Description: An OITF SHALL support a non-visual embedded object of type “ application/oipfApplicationManager ”, with - * the following JavaScript API, to enable applications to access the privileged functionality related to application lifecycle - * and management that is provided by the application model defined in this section. - * If one of the methods on the application/oipfApplicationManager is called by a webpage that is not a - * privileged DAE application, the OITF SHALL throw an error as defined in section 10.1.1. - */ - applicationManagerObject: null, - - capabilitiesObject: null, - - codManagerObject: null, - - /*The ChannelConfig class provides the entry point for applications to get information about the list of channels - * available. It can be obtained in two ways: - * -By calling the method getChannelConfig() of the video/broadcast embedded object as defined in - * section 7.13.1.3. - * -By calling the method createChannelConfig() of the object factory API as defined in section 7.1.1. - * The availability of the properties and methods are dependent on the capabilities description as specified in section 9.3. - * The following table provides a list of the capabilities and the associated properties and methods. If the capability is false - * the properties and methods SHALL NOT be available to the application. Properties and methods not listed in the - * following table SHALL be available to all applications as long as the OITF has indicated support for tuner control (i.e. - * <video_broadcast>true</video_broadcast> as defined in section 9.3.1) in their capability. - * ------------------------------------------------------------------------ - * Capability | Properties | Methods - * --------------------------------- --------------- ---------------------- - * Element <extendedAVControl> | onChannelScan | startScan() - * is set to “ true ” as defined in | | stopScan() - * section 9.3.6. | | - * --------------------------------- --------------- ---------------------- - * Element <video_broadcast | |createChannelList() - * type="ID_IPTV_SDS"> is set as | | - * defined in section 9.3.6. | | - * ------------------------------------------------------------------------ - */ - channelConfig: null, - - /* - * Description: Access to the functionality of the application/oipfRemoteManagement embedded object SHALL adhere to the - * security requirements as defined in section 10. - */ - remoteManagementObject: null, - - remoteControlFunctionObject: null, - - imsObject : null, - - mdtfObject: null, - - notifSocketObject: null, - - parentalControlManagerObject: null, - - recordingSchedulerObject: null, - - configurationObject: null, - - downloadManagerObject: null, - - downloadTriggerObject: null, - - drmAgentObject: null, - - gatewayInfoObject: null, - - /* - * Description: OITFs SHALL implement the application/oipfSearchManager embedded object. This object provides a - * mechanism for applications to create and manage metadata searches. - */ - searchManagerObject: null, - - /* + } + + _createDocument(filename, callbackName) { + var self = this; + if (window.XMLHttpRequest) { + this.xmlHttpRequest = new XMLHttpRequest(); + this.xmlHttpRequest.open("GET", filename); + this.xmlHttpRequest.send(); + this.xmlHttpRequest.onload = function() { + if(this.status == 200 && this.responseXML != null) { + var xmlToJson = new XmlToJson(this.responseXML); + var jsonData = xmlToJson.getJson(); + + self[callbackName].call(self, jsonData); + console.log("A new doument has been created."); + } else { + console.log("An error occured during the document creation."); + } + }; + } + } + + /* * Description: * This method SHALL return true if and only if an object of the specified type is supported by * the OITF, otherwise it SHALL return false. @@ -146,17 +118,17 @@ * application/oipfCommunicationServices, application/oipfMDTF, * application/oipfParentalControlManager, application/oipfRecordingScheduler, * application/oipfRemoteControlFunction, application/oipfRemoteManagement - * + * */ - isObjectSupported: function(mimeType) { - + isObjectSupported(mimeType) { + var mimeType_method = { "channelConfig" : true, "application/notifsocket" : false, "application/oipfApplicationManager" : true, "application/oipfCapabilities" : true, "application/oipfCodManager" : false, - "application/oipfCommunicationServices" : false, + "application/oipfCommunicationServices" : false, "application/oipfConfiguration" : true, "application/oipfDownloadManager" : false, "application/oipfDownloadTrigger" : false, @@ -172,12 +144,12 @@ "video/broadcast" : true, "video/mpeg" : false }; - + return mimeType_method[mimeType]; - }, - + } + /*! - * Description: + * Description: * If the object type is supported, each of these methods shall return an instance of the * corresponding embedded object. * Since objects do not claim scarce resources when they are instantiated, instantiation shall @@ -188,7 +160,7 @@ * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL * match the mimetype of the instantiated object, for example " video/broadcast " in case of * method oipfObjectFactory.createVideoBroadcastObject() . - * + * * Arguments: * -requiredCapabilities : * An optional argument indicating the formats to be supported by @@ -203,7 +175,7 @@ * so instantiation shall never fail if the object type is supported. The * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . */ - createVideoBroadcastObject: function() { + createVideoBroadcastObject() { console.log("[INFO] createVideoBroadcastObject() of OipfObjectFactory class called."); if (this.isObjectSupported("video/broadcast")) { @@ -211,9 +183,9 @@ } else { throw new TypeError("This object type is not supported."); } - - }, + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -225,17 +197,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createSearchManagerObject: function() { + createSearchManagerObject() { if (this.isObjectSupported(SEARCH_MANAGER_DAE_MIME_TYPE)) { console.log("[INFO] createSearchManagerObject() of OipfObjectFactory class called."); return this.searchManagerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -247,17 +219,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createApplicationManagerObject: function() { + createApplicationManagerObject() { if (this.isObjectSupported(APPLICATION_MANAGER_DAE_MIME_TYPE)) { console.log("[INFO] createApplicationManagerObject() of OipfObjectFactory class called."); return this.applicationManagerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -269,17 +241,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createCapabilitiesObject: function() { + createCapabilitiesObject() { if (this.isObjectSupported(CAPABILITIES_DAE_MIME_TYPE)) { console.log("[INFO] createCapabilitiesObject() of OipfObjectFactory class called."); return this.capabilitiesObject; } else { throw new TypeError("This object type is not supported."); - } - }, - + } + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -291,17 +263,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createChannelConfig: function() { + createChannelConfig() { if (this.isObjectSupported(CHANNEL_CONFIG_TYPE)) { console.log("[INFO] createChannelConfigObject() of OipfObjectFactory class called."); return this.channelConfig; } else { throw new TypeError("This object type is not supported."); - } - }, - + } + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -313,17 +285,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createCodManagerObject: function() { + createCodManagerObject() { if (this.isObjectSupported(COD_MANAGER_DAE_MIME_TYPE)) { console.log("[INFO] createCodManagerObject() of OipfObjectFactory class called."); return this.codManagerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -335,17 +307,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createConfigurationObject: function() { + createConfigurationObject() { if (this.isObjectSupported(CONFIGURATION_DAE_MIME_TYPE)) { console.log("[INFO] createConfigurationObject() of OipfObjectFactory class called."); return this.configurationObject; } else { throw new TypeError("This object type is not supported."); - } - }, - + } + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -357,17 +329,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createDownloadManagerObject: function() { + createDownloadManagerObject() { if (this.isObjectSupported(DOWNLOAD_MANAGER_DAE_MIME_TYPE)) { console.log("[INFO] createDownloadManagerObject() of OipfObjectFactory class called."); return this.downloadManagerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -379,17 +351,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createDownloadTriggerObject: function() { + createDownloadTriggerObject() { if (this.isObjectSupported(DOWNLOAD_TRIGGER_DAE_MIME_TYPE)) { console.log("[INFO] createDownloadTriggerObject() of OipfObjectFactory class called."); return this.downloadTriggerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -401,17 +373,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createDrmAgentObject: function() { + createDrmAgentObject() { if (this.isObjectSupported(DRM_AGENT_DAE_MIME_TYPE)) { console.log("[INFO] createDrmAgentObject() of OipfObjectFactory class called."); return this.drmAgentObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -423,17 +395,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createGatewayInfoObject: function() { + createGatewayInfoObject() { if (this.isObjectSupported(GATEWAY_INFO_DAE_MIME_TYPE)) { console.log("[INFO] createGatewayInfoObject() of OipfObjectFactory class called."); return this.gatewayInfoObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -445,17 +417,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createIMSObject: function() { + createIMSObject() { if (this.isObjectSupported(COMMUNICATION_SERVICES_DAE_MIME_TYPE)) { console.log("[INFO] createIMSObject() of OipfObjectFactory class called."); return this.imsObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -467,17 +439,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createMDTFObject: function() { + createMDTFObject() { if (this.isObjectSupported(MDTF_DAE_MIME_TYPE)) { console.log("[INFO] createMDTFObject() of OipfObjectFactory class called."); return this.mdtfObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -489,17 +461,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createNotifSocketObject: function() { + createNotifSocketObject() { if (this.isObjectSupported(NOTIF_SOCKET_DAE_MIME_TYPE)) { console.log("[INFO] createNotifSocketObject() of OipfObjectFactory class called."); return this.notifSocketObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -511,17 +483,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createParentalControlManagerObject: function() { - if (this.isObjectSupported(PARENTAL_CONTROL_MANAGER_DAE_MIME_TYPE)) { + createParentalControlManagerObject() { + if (this.isObjectSupported(PARENTAL_CONTROL_MANAGER_DAE_MIME_TYPE)) { console.log("[INFO] createParentalControlManangerObject() of OipfObjectFactory class called."); return this.parentalControlManagerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -533,17 +505,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createRecordingSchedulerObject: function() { + createRecordingSchedulerObject() { if (this.isObjectSupported(RECORDING_SCHEDULER_DAE_MIME_TYPE)) { console.log("[INFO] createRecordingSchedulerObject() of OipfObjectFactory class called."); return this.recordingSchedulerObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -555,17 +527,17 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createRemoteControlFunctionObject: function() { + createRemoteControlFunctionObject() { if (this.isObjectSupported(REMOTE_CONTROL_FUNCTION_DAE_MIME_TYPE)) { console.log("[INFO] createRemoteControlFunctionObject() of OipfObjectFactory class called."); return this.remoteControlFunctionObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /* * Description * If the object type is supported, each of these methods SHALL return an instance of the @@ -577,19 +549,19 @@ * not supported, the OITF SHALL throw an error with the name property set to the value * " TypeError ". * If the object is supported, the method SHALL return a JavaScript Object which - * implements the interface for the specified object. + * implements the interface for the specified object. */ - createRemoteManagementObject: function() { + createRemoteManagementObject() { if (this.isObjectSupported(REMOTE_MANAGEMENT_DAE_MIME_TYPE)) { console.log("[INFO] createRemoteManagementObject() of OipfObjectFactory class called."); return this.remoteManagementObject; } else { throw new TypeError("This object type is not supported."); } - }, - + } + /*! - * Description: + * Description: * If the object type is supported, each of these methods shall return an instance of the * corresponding embedded object. * Since objects do not claim scarce resources when they are instantiated, instantiation shall @@ -600,7 +572,7 @@ * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL * match the mimetype of the instantiated object, for example " video/broadcast " in case of * method oipfObjectFactory.createVideoBroadcastObject() . - * + * * Arguments: * -requiredCapabilities : * An optional argument indicating the formats to be supported by @@ -615,17 +587,17 @@ * so instantiation shall never fail if the object type is supported. The * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . */ - createStatusViewObject: function() { + createStatusViewObject() { if (this.isObjectSupported(STATUS_VIEW_DAE_MIME_TYPE)) { console.log("[INFO] createStatusViewObject() of OipfObjectFactory class called."); return new StatusViewObject(); } else { throw new TypeError("This object type is not supported."); } - }, - + } + /*! - * Description: + * Description: * If the object type is supported, each of these methods shall return an instance of the * corresponding embedded object. * Since objects do not claim scarce resources when they are instantiated, instantiation shall @@ -636,7 +608,7 @@ * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL * match the mimetype of the instantiated object, for example " video/broadcast " in case of * method oipfObjectFactory.createVideoBroadcastObject() . - * + * * Arguments: * -requiredCapabilities : * An optional argument indicating the formats to be supported by @@ -651,30 +623,30 @@ * so instantiation shall never fail if the object type is supported. The * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . */ - createVideoMpegObject: function() { + createVideoMpegObject() { if (this.isObjectSupported("video/mpeg")) { console.log("[INFO] createVideoMpegObject() of OipfObjectFactory class called."); return new VideoMpegObject(); } else { throw new TypeError("This object type is not supported."); } - }, - - _setChannelConfig: function(channelListJson) { - this._channelService = + } + + _setChannelConfig(channelListJson) { + this._channelService = new ChannelService(this._oipfConfiguration.currentChannel, this._oipfConfiguration.channelNumber, this._oipfConfiguration.channelOrigin, channelListJson.channelList.channel ); this.channelConfig = new ChannelConfig(this._channelService); - }, - - _setSearchManagerObject: function(programmesJson) { + } + + _setSearchManagerObject(programmesJson) { var oipfProgrammes = new ProgrammeHelper(this._channelService) .initProgrammes(programmesJson.tv.programme); var programmeService = new ProgrammeService(oipfProgrammes); - this.searchManagerObject = + this.searchManagerObject = new SearchManagerObject(programmeService); } -}); +} Modified: oipf/lib/js/impl/ParentalControlManagerObject.js =================================================================== --- oipf/lib/js/impl/ParentalControlManagerObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/ParentalControlManagerObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,88 +1,89 @@ -var ParentalControlManagerObject = Class.extend({ - +class ParentalControlManagerObject { + /* - * Descrioption: - * A reference to the collection of rating schemes known by the OITF. - * - * Visibilty Type:readonly ParentalRatingSchemeCollection + * FIXME: + * -Yannis 18/05/2015 The properties "_currentPIN" and "_invalidPINAttemps" + * don't have to be innitialized here. */ - parentalRatingSchemes: null, + constructor() { - /* - * Description: - * The lockout status of the parental control PIN. If the incorrect PIN has - * been entered too many times in the configured timeout period, parental - * control PIN entry SHALL be locked out for a period of time determined by - * the OITF. - * - * Visibility Type: readonly Boolean - */ - isPINEntryLocked: null, - - //The parental control PIN set. - _currentPIN: null, - - //Indicate the number of invalid PIN attemps. - _invalidPINAttemptsMax: null, - - //Contain the number of invalid entry PIN attempts. - _currentInvalidPINAttempts: null, - - //When the PIN entry attempt has been reached this PIN entry must be locked. - _PINLockedTime: null, - - /* - * Let to manage the locking of programmes and/or channels which are - * initially unrated. - */ - _blockUnrated:null, - - /* - * Represent a status indicating if a temporarily authorization for - * the comsumption of any blocked content have been set or not. - * - */ - _parentalControlStatus:null, - - /* - * FIXME: - * -Yannis 18/05/2015 The properties "_currentPIN" and "_invalidPINAttemps" - * don't have to be innitialized here. - */ - init: function() { + /* + * Descrioption: + * A reference to the collection of rating schemes known by the OITF. + * + * Visibilty Type:readonly ParentalRatingSchemeCollection + */ + this.parentalRatingSchemes = null; + + /* + * Description: + * The lockout status of the parental control PIN. If the incorrect PIN has + * been entered too many times in the configured timeout period, parental + * control PIN entry SHALL be locked out for a period of time determined by + * the OITF. + * + * Visibility Type: readonly Boolean + */ + this.isPINEntryLocked = null; + + //The parental control PIN set. + this._currentPIN = null; + + //Indicate the number of invalid PIN attemps. + this._invalidPINAttemptsMax = null; + + //Contain the number of invalid entry PIN attempts. + this._currentInvalidPINAttempts = null; + + //When the PIN entry attempt has been reached this PIN entry must be locked. + this._PINLockedTime = null; + + /* + * Let to manage the locking of programmes and/or channels which are + * initially unrated. + */ + this._blockUnrated = null; + + /* + * Represent a status indicating if a temporarily authorization for + * the comsumption of any blocked content have been set or not. + * + */ + this._parentalControlStatus = null; + this._timerManager = new TimerManager(); this._timeout = this._timerManager.createTimer.bind(this._timerManager, 0); - + this.isPINEntryLocked = false; this._blockUnrated = false; this._parentalControlStatus = false; - + this._currentPIN = "1234"; this._invalidPINAttemptsMax = 4; this._currentInvalidPINAttempts = 0; this._PINLockedTime = 2000; - + this._PIN_CORRECT = parentalControlManagerConstants.pin.CORRECT; this._PIN_INCORRECT = parentalControlManagerConstants.pin.INCORRECT; this._PIN_LOCKED = parentalControlManagerConstants.pin.LOCKED; - }, - + } + /* - * As defined in [OIPF_CSP2], the OITF shall prevent the consumption of a - * programme when its parental rating doesn't meet the parental rating - * criterion currently defined in the OITF. Calling this method with enable - * set to false will temporarily allow the consumption of any blocked - * programme. Setting the parental control status using this method SHALL + * As defined in [OIPF_CSP2], the OITF shall prevent the consumption of a + * programme when its parental rating doesn't meet the parental rating + * criterion currently defined in the OITF. Calling this method with enable + * set to false will temporarily allow the consumption of any blocked + * programme. Setting the parental control status using this method SHALL * set the status until the consumption of any of all the blocked programmes - * terminates (e.g. until the content item being played is changed), - * or another call to the setParentalControlStatus() method is made. + * terminates (e.g. until the content item being played is changed), + * or another call to the setParentalControlStatus() method is made. * Setting the parental control status using this method has the following - * effect; for the Programme and Channel objects as defined in sections - * 7.16.2 and 7.13.11, the blocked property of a programme or channel SHALL - * be set to true for programmes whose parental rating does not meet the - * applicable parental rating criterion, but the locked property SHALL be - * set to false .This operation to temporarily disable parental rating - * control SHALL be protected by the parental control PIN (i.e. through the + * effect; for the Programme and Channel objects as defined in sections + * 7.16.2 and 7.13.11, the blocked property of a programme or channel SHALL + * be set to true for programmes whose parental rating does not meet the + * applicable parental rating criterion, but the locked property SHALL be + * set to false .This operation to temporarily disable parental rating + * control SHALL be protected by the parental control PIN (i.e. through the * pcPIN argument). The return value indicates the success of the operation, * and SHALL take one of the following values: * ------------------------------------------------------------------------ @@ -92,24 +93,24 @@ * ------ ----------------------------------------------------------------- * 1 | The PIN is incorrect. * ------ ----------------------------------------------------------------- - * 2 | PIN entry is locked because an invalid PIN has been entered too - * | many times. The number of invalid PIN attempts before PIN entry + * 2 | PIN entry is locked because an invalid PIN has been entered too + * | many times. The number of invalid PIN attempts before PIN entry * | is locked is outside the scope of this specification. * ------ ----------------------------------------------------------------- - * - * Arguments: + * + * Arguments: * - pcPIN: The parental control PIN. - * + * * - enable: Flag indicating whether parental control should be enabled. - * + * * Return: Integer - * - * FIXME: - * - Yannis 19/05/2015 The unblocking of programme should be done here or - * outside of this method, if the second case is true, + * + * FIXME: + * - Yannis 19/05/2015 The unblocking of programme should be done here or + * outside of this method, if the second case is true, * how notify the programme? Who have to achieve this notification? */ - setParentalControlStatus: function(pcPIN, enable) { + setParentalControlStatus(pcPIN, enable) { if (this._currentPIN == pcPIN) { this._parentalControlStatus = enable; return this._PIN_CORRECT; @@ -120,10 +121,10 @@ this._lockPINEntry(); return this._PIN_LOCKED; } - + return this._PIN_INCORRECT; - }, - + } + /* * Description: * Set the parental control PIN. This operation SHALL be protected by the @@ -137,52 +138,52 @@ * ------ ----------------------------------------------------------------- * 1 | The PIN is incorrect. * ------ ----------------------------------------------------------------- - * 2 | PIN entry is locked because an invalid PIN has been entered too - * | many times. The number of invalid PIN attempts before PIN entry + * 2 | PIN entry is locked because an invalid PIN has been entered too + * | many times. The number of invalid PIN attempts before PIN entry * | is locked is outside the scope of this specification. * ------ ----------------------------------------------------------------- - * - * Arguments: + * + * Arguments: * - oldPcPIN: The current parental control PIN. * - newPcPIN: The new value for the parental control PIN. - * + * * Return: Integer */ - setParentalControlPIN: function(oldPcPIN, newPcPIN) { - + setParentalControlPIN(oldPcPIN, newPcPIN) { + if (this._currentPIN == oldPcPIN) { this._currentPIN = newPcPIN; return this._PIN_CORRECT; } this._currentInvalidPINAttempts++; - + if (this._currentInvalidPINAttempts > this._invalidPINAttemptsMax) { this._lockPINEntry(); return this._PIN_LOCKED; } - + return this._PIN_INCORRECT; - - }, - + + } + /* * Description: * Unlock the object specified by target for viewing if pcPIN contains the - * correct parental control PIN. - * - * The object type of target can be one of the following: - * -video/broadcast object, in which case the content being - * presented through this object SHALL be unlocked until a new channel is - * selected. - * -A/V Control object, in which case the content being presented - * through this object. SHALL be unlocked until a new item of content is - * played using this object. - * - * Otherwise an Invalid Object error SHALL be returned. - * - * The return value indicates the success of the operation, and + * correct parental control PIN. + * + * The object type of target can be one of the following: + * -video/broadcast object, in which case the content being + * presented through this object SHALL be unlocked until a new channel is + * selected. + * -A/V Control object, in which case the content being presented + * through this object. SHALL be unlocked until a new item of content is + * played using this object. + * + * Otherwise an Invalid Object error SHALL be returned. + * + * The return value indicates the success of the operation, and * SHALL take the following values: - * + * * ------------------------------------------------------------------------ * Value | Description * ------ ----------------------------------------------------------------- @@ -190,44 +191,44 @@ * ------ ----------------------------------------------------------------- * 1 | The PIN is incorrect. * ------ ----------------------------------------------------------------- - * 2 | PIN entry is locked because an invalid PIN has been entered too - * | many times. The number of invalid PIN attempts before PIN entry + * 2 | PIN entry is locked because an invalid PIN has been entered too + * | many times. The number of invalid PIN attempts before PIN entry * | is locked is outside the scope of this specification. * ------ ----------------------------------------------------------------- - * - * Arguments: + * + * Arguments: * - pcPIN: The parental control PIN. - * + * * - target: The object to be unlocked. */ - unlockWithParentalControlPIN: function(pcPIN, target) { - - }, - - verifyParentalControlPIN: function(pcPIN) { + unlockWithParentalControlPIN(pcPIN, target) { + + } + + verifyParentalControlPIN(pcPIN) { if (this._currentPIN == pcPIN) { return this._PIN_CORRECT; } this._currentInvalidPINAttempts++; - + if (this._currentInvalidPINAttempts > this._invalidPINAttemptsMax) { this._lockPINEntry(); return this._PIN_LOCKED; } - + return this._PIN_INCORRECT; - - }, - + + } + /* * Description: * Set whether programmes for which no parental rating has been retrieved * from the metadata client nor defined by the service provider should be * blocked automatically by the terminal. - * + * * This operation SHALL be protected * by the parental control PIN (if PIN entry is enabled).The return value - * indicates the success of the operation, and SHALL take one of + * indicates the success of the operation, and SHALL take one of * the following values: * ------------------------------------------------------------------------ * Value | Description @@ -236,18 +237,18 @@ * ------ ----------------------------------------------------------------- * 1 | The PIN is incorrect. * ------ ----------------------------------------------------------------- - * 2 | PIN entry is locked because an invalid PIN has been entered too - * | many times. The number of invalid PIN attempts before PIN entry + * 2 | PIN entry is locked because an invalid PIN has been entered too + * | many times. The number of invalid PIN attempts before PIN entry * | is locked is outside the scope of this specification. * ------ ----------------------------------------------------------------- - * - * Arguments: + * + * Arguments: * - pcPIN: The parental control PIN. - * + * * - block: Flag indicating whether programmes SHALL be blocked. - * + * */ - setBlockUnrated: function(pcPIN, block) { + setBlockUnrated(pcPIN, block) { if (this._currentPIN == pcPIN) { this._blockUnrated = block; return this._PIN_CORRECT; @@ -258,45 +259,45 @@ this._lockPINEntry(); return this._PIN_LOCKED; } - + return this._PIN_INCORRECT; - }, - + } + /* - * Description: + * Description: * Returns a flag indicating whether or not the OITF has been configured by * the user to block content for which a parental rating is absent. */ - getBlockUnrated: function() { + getBlockUnrated() { return this._blockUnrated; - }, + } /* - * Description: - * Returns a flag indicating the temporary parental control status set by - * setParentalControlStatus() . Note that the returned status covers - * parental control functionality related to all rating schemes, not only + * Description: + * Returns a flag indicating the temporary parental control status set by + * setParentalControlStatus() . Note that the returned status covers + * parental control functionality related to all rating schemes, not only * the rating scheme upon which the method is called. */ - getParentalControlStatus: function() { + getParentalControlStatus() { return this._parentalControlStatus; - }, - - _lockPINEntry: function() { + } + + _lockPINEntry() { this.isPINEntryLocked = true; - + //After a periode of time, the PIN entry will be unlocked. this._timeout(this._PINLockedTime) .then(this._setIsPINEntryLocked.bind(this, false)); - }, - - _setIsPINEntryLocked: function(enable) { + } + + _setIsPINEntryLocked(enable) { this.isPINEntryLocked = enable; this._currentInvalidPINAttempts = 0; - }, - - _setCurrentInvalidPINAttempts: function(value) { + } + + _setCurrentInvalidPINAttempts(value) { this._currentInvalidPINAttempts = value; } -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/RecordingSchedulerObject.js =================================================================== --- oipf/lib/js/impl/RecordingSchedulerObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/RecordingSchedulerObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,32 +1,32 @@ -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, +class RecordingSchedulerObject { /* - * FIXME: + * FIXME: * Yannis - 29/014/2015 - Use of a utils class in future to manage 'Date' * object. */ - init: function(subConfiguration, modelFactory, dateUtils) { + constructor(subConfiguration, modelFactory, dateUtils) { + /* + * 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 + */ + this.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 + */ + this.discInfo = null; + this._dateUtils = dateUtils; this._modelFactory = modelFactory; this.SCHEDULED = recordingConstants.state.SCHEDULED; @@ -36,7 +36,7 @@ this.UPDATED = recordingConstants.state.UPDATED; this.BEFORE_STARTED = recordingConstants.state.BEFORE_STARTED; this._subConfiguration = subConfiguration; - this._eventManager = new EventManager(); + this._eventManager = new EventManager(); this._timerManager = new TimerManager(); this._timeout = this._timerManager.createTimer.bind(this._timerManager); this._timerManagerRecording = new TimerRecordingManager(); @@ -52,72 +52,71 @@ this._recordings = {}; this.recordings = new ScheduledRecordingCollection(); this.discInfo = null; - - }, - + } + /* * Description: * - * FIXME: + * FIXME: * Yannis - 27/04/2015 - Do verification on parameter - * Yannis - 27/04/2015 - Verify pvr capability in order to manage + * Yannis - 27/04/2015 - Verify pvr capability in order to manage * recordings to store them into properties "recordings". - * Yannis - 27/04/2015 - Verify parental control settings about recording + * Yannis - 27/04/2015 - Verify parental control settings about recording * right. * */ - record: function() { + record() { var parameters = arguments; if (parameters.length == 1) { var scheduledRecording = new ScheduledRecording(parameters[0]); } else if (parameters.length == 4) { scheduledRecording = new ScheduledRecording(parameters[0], - parameters[1], - parameters[2], + parameters[1], + parameters[2], parameters[3]); } else { return null; } - + scheduledRecording.startPadding = this._subConfiguration.pvrStartPadding; scheduledRecording.endPadding = this._subConfiguration.pvrEndPadding; - + if (this._recordingConflict(scheduledRecording)) { return null; } - + this._fireEventScheduled(scheduledRecording); - + var recording = this._createRecording(scheduledRecording); this._recordings[recording.id] = recording; this.recordings.push(recording); - + this._planifyStartRecording(recording) .then(this._planifyEndRecording.bind(this, recording)); return recording; - }, - + } + /* * Description: * - * FIXME: + * FIXME: * Yannis - 27/04/2015 - Do verification on parameters. - * Yannis - 27/04/2015 - Verify pvr capability in order to know + * Yannis - 27/04/2015 - Verify pvr capability in order to know * if this properties "recordings" can be used. - * Yannis - 27/04/2015 - Verify parental control settings about recording + * Yannis - 27/04/2015 - Verify parental control settings about recording * right. */ - recordAt: function(startTime, duration, repeatDays, channelID) { + recordAt(startTime, duration, repeatDays, channelID) { this.record(startTime, duration, repeatDays, channelID); - }, - + } + /* - * + * * @param {ScheduledRecording} recording * @returns {undefined} */ - remove: function(recording) { + remove(recording) { if (recording) { this._timerManagerRecording.clearTimer(recording.id); this.recordings.splice(this.recordings.indexOf(recording), 1); @@ -129,191 +128,191 @@ return; } console.log("The recording can't be remove."); - }, - + } + /* * Description: - * Returns a subset of all the recordings that are scheduled but which have - * not yet started. The subset SHALL include only scheduled recordings that - * were scheduled using a service from the same FQDN as the domain of the + * Returns a subset of all the recordings that are scheduled but which have + * not yet started. The subset SHALL include only scheduled recordings that + * were scheduled using a service from the same FQDN as the domain of the * service that calls the method. - * + * * @returns { ScheduledRecordingCollection} */ - getScheduledRecordings: function() { + getScheduledRecordings() { if (this.recordings) { return this.recordings; } - }, - + } + /* * Description: - * Returns the channel line-up of the OITF in the form of a ChannelConfig - * object as defined in section 7.13.9. The ChannelConfig object returned - * from this function SHALL be identical to the ChannelConfig object + * Returns the channel line-up of the OITF in the form of a ChannelConfig + * object as defined in section 7.13.9. The ChannelConfig object returned + * from this function SHALL be identical to the ChannelConfig object * returned from the getChannelConfig() method on the video/broadcast object * as defined in section 7.13.1.3. - * + * * @returns {ChannelConfig} */ - getChannelConfig: function() { + getChannelConfig() { return oipfObjectFactory.createChannelConfig(); - }, - - createProgrammeObject: function() { - - }, + } + createProgrammeObject() { + + } + /* * Description: - * Returns the Recording object for which the value of the Recording.id + * Returns the Recording object for which the value of the Recording.id * property corresponds to the given id parameter. If such a Recording does * not exist, the method returns null. - * + * * Arguments: * - id: Identifier corresponding to the id property of a Recording object. - * + * * @returns {Recording} */ - getRecording: function(id) { + getRecording(id) { return this._recordings[id] || null; - }, - + } + /* * Description: * Stop an in-progress recording. The recording SHALL NOT be deleted. - * + * * Arguments: * - recording: The recording to be stopped. - * + * * @returns {undefined} */ - stop: function(recording) { + stop(recording) { console.log("Method stop called"); if (recording && recording.state == this.STARTED) { this._timerManagerRecording.clearTimer(recording.id); return; } console.log("The recording can't be stop."); - }, - + } + /* * Description: - * Update the recordings property to show the current status of all + * Update the recordings property to show the current status of all * recordings. - * + * * @returns {undefined} */ - refresh: function() { - - }, - + refresh() { + + } + /* * Description: - * For scheduled recordings the properties startTime, duration and - * repeatDays can be modified. For ongoing recordings only the duration - * property may be modified. This method SHALL return true if the operation - * succeeded, or false if for any reason it rescheduling is not possible + * For scheduled recordings the properties startTime, duration and + * repeatDays can be modified. For ongoing recordings only the duration + * property may be modified. This method SHALL return true if the operation + * succeeded, or false if for any reason it rescheduling is not possible * (e.g. the updated recording overlaps with another scheduled recording and - * there are insufficient system resources to do both). If the method + * there are insufficient system resources to do both). If the method * returns false then no changes SHALL be made to the recording. - * + * * Arguments: * - id: The id of the recording to update. - * - startTime: The new start time of the recording, or undefined if the + * - startTime: The new start time of the recording, or undefined if the * start time is not to be updated. - * - duration: The new duration of the recording, or undefined if the + * - duration: The new duration of the recording, or undefined if the * duration is not to be updated. - * - repeatDays: The new set of days on which the recording is to be + * - repeatDays: The new set of days on which the recording is to be * repeated, or undefined if this is not to be updated. - * + * * @returns {undefined} */ - update: function(id, startTime, duration, repeatDays) { + update(id, startTime, duration, repeatDays) { var recording = this._recordings[id]; - + if (!recording) { return false; } - + if (recording.state == this.STARTED) { if (duration) { return this._updateDuration(id, duration); } - + } else if (recording.state == this.SCHEDULED) { startTime && recording._setStartTime(startTime); duration && recording._setDuration(duration); repeatDays && (recording.repeatDays = repeatDays); - + } - + return false; - }, - + } + get onPVREvent() { return this._getCallback("PVREvent"); - }, + } set onPVREvent(callback) { this._setCallback("PVREvent", callback); - }, - - _getCallback : function(type) { + } + + _getCallback (type) { if(this._callbacks) { return this._callbacks[type]; } - }, - - _setCallback: function(type, callback) { + } + + _setCallback(type, callback) { if(this._callbacks) { this._callbacks[type] = callback; } - }, - - addEventListener: function(type, listener) { + } + + addEventListener(type, listener) { this._eventManager.addEventListener(type, listener, this); - }, - - _fireEvent: function(state, recording) { + } + + _fireEvent(state, recording) { var event = createCustomEvent("PVREvent", [state, recording]); this._eventManager.fireEvent(event, this); - }, - - _fireEventScheduled: function(recording) { + } + + _fireEventScheduled(recording) { this._fireEvent(this.SCHEDULED, recording); - }, - - _fireEventBeforeStarted: function(recording) { + } + + _fireEventBeforeStarted(recording) { this._fireEvent(this.BEFORE_STARTED, recording); - }, - - _fireEventStarted: function(recording) { + } + + _fireEventStarted(recording) { this._fireEvent(this.STARTED, recording); - }, + } - _fireEventCompleted: function(recording) { + _fireEventCompleted(recording) { this._fireEvent(this.COMPLETED, recording); - }, - - _fireEventUpdated: function(recording) { + } + + _fireEventUpdated(recording) { this._fireEvent(this.UPDATED, recording); - }, - - _fireEventRemoved: function(recording) { + } + + _fireEventRemoved(recording) { this._fireEvent(this.REMOVED, recording); - }, - - removeEventListener: function(type, listener) { + } + + removeEventListener(type, listener) { this._eventManager.removeEventListener(type, listener, this); - }, - - _recordingConflict: function(recording) { - + } + + _recordingConflict(recording) { + if (this._isProgrammeFinished(recording)) { return true; } - + for (var i = 0, l = this.recordings.length; i < l; i++) { var startPadding = this.recordings[i].startPadding; @@ -321,135 +320,135 @@ var currentStartTime = this.recordings[i].startTime + startPadding; var currentDuration = this.recordings[i].duration + endPadding; var currentStopTime = currentStartTime + currentDuration; - + var recordingStartTime = recording.startTime + recording.startPadding; - var recordingStopTime = recordingStartTime + recording.duration + var recordingStopTime = recordingStartTime + recording.duration + recording.endPadding; - + /* * First, verify that two recordings won't schedules at same time. * Second, verify that two recordings don't overlap. */ - if (currentStartTime == recordingStartTime || + if (currentStartTime == recordingStartTime || (recordingStartTime >= currentStartTime && recordingStartTime <= currentStopTime) || (recordingStopTime >= currentStartTime && recordingStopTime <= currentStopTime)) { - + return true; } } return false; - }, - - _createRecording: function(recording) { + } + + _createRecording(recording) { return new Recording(recording); - }, - + } + /* - * FIXME: - * Yannis - 29/04/2015 - Management of negative padding. - * Yannis - 29/04/2015 - Modify recordingStartTime of concerned recording. + * FIXME: + * Yannis - 29/04/2015 - Management of negative padding. + * Yannis - 29/04/2015 - Modify recordingStartTime of concerned recording. */ - _planifyStartRecording: function(recording) { + _planifyStartRecording(recording) { if(this._isProgrammeStarted(recording)) { - + var timer = this._dispatchBeforeStartedEventAndStartedEvent(null, recording); console.log("The recording start now because the programme already had started."); - + } else { - + var timeToStart = this._getDurationFromNowToSpecificTime(recording.startTime + recording.startPadding); - - console.log("The recording will start in", + + console.log("The recording will start in", this._dateUtils.secondsToMinutes(timeToStart), "minutes."); - + this._dispatchBeforeStartedEventAndStartedEvent( this._dateUtils.secondsToMilliseconds(timeToStart), recording); - + } - + this._timerManagerRecording - .recordingTimers[recording.id] = { + .recordingTimers[recording.id] = { "start": timer, "end": null }; - + return timer; - }, - + } + /* - * FIXME: - * Yannis - 29/04/2015 - Managing of negative padding. - * Yannis - 29/04/2015 - Modify recordingEndTime of concerned recording. + * FIXME: + * Yannis - 29/04/2015 - Managing of negative padding. + * Yannis - 29/04/2015 - Modify recordingEndTime of concerned recording. */ - _planifyEndRecording: function(recording) { + _planifyEndRecording(recording) { var timeToEnd = this._getDurationFromNowToSpecificTime(recording.startTime + recording.duration + recording.endPadding); - + var timer = this._timeoutRecording(this._dateUtils.secondsToMilliseconds(timeToEnd)) .then(recording._setState.bind(recording, this.COMPLETED)) .then(this._fireEventCompleted.bind(this, recording)); - + console.log("The recording will end in", this._dateUtils.secondsToMinutes(timeToEnd), "minutes after its starting."); this._timerManagerRecording .recordingTimers[recording.id].end = timer; - + return timer; - }, - - _isProgrammeStarted: function(recording) { + } + + _isProgrammeStarted(recording) { var startTime = recording.startTime; var endTime = startTime + recording.duration; - + var currentTime = this._dateUtils.nowInSeconds(); - + return (currentTime >= startTime && currentTime <= endTime); - }, - + } + /* * Description : * Avoid schedule recording whose the programme already has been broadcasted. - * + * * Return: Boolean */ - _isProgrammeFinished: function(recording) { + _isProgrammeFinished(recording) { var startTime = recording.startTime; var endTime = startTime + recording.duration; - + var currentTime = this._dateUtils.nowInSeconds(); - + return (endTime <= currentTime); - }, - - _getDurationFromNowToSpecificTime: function(time) { + } + + _getDurationFromNowToSpecificTime(time) { return time - this._dateUtils.nowInSeconds(); - }, - - _updateDuration: function(id, duration) { + } + + _updateDuration(id, duration) { console.log("Try updating duration"); var recording = this._recordings[id]; - + if (!recording) { return false; } - + var newStopTime = recording.startTime + duration + recording.endPadding; - + if (newStopTime <= this._dateUtils.nowInSeconds()) { return false; } - + var recordings = this.recordings.filter(function(recording) { return recording.id != id; }); - - + + for (var i = 0, l = recordings.length; i < l; i++) { var startPadding = recordings[i].startPadding; var endPadding = recordings[i].endPadding; @@ -462,105 +461,105 @@ * Second, verify that two recordings don't overlap. */ if (newStopTime >= currentStartTime) { - + return false; } } recording._setDuration(duration); - + this._timerManagerRecording.clearTimer(recording.id); - + this._planifyEndRecording(recording); - + return true; - - }, - - _updateFields: function(id, startTime, duration, repeatDays) { + + } + + _updateFields(id, startTime, duration, repeatDays) { console.log("Try updating duration"); var recording = this._recordings[id]; - + if (!recording || (!startTime && !duration && !repeatDays)) { return false; } - + if (startTime) { var recordingStartTime = startTime + recording.startPadding; - var recordingStopTime = recordingStartTime + recording.duration + var recordingStopTime = recordingStartTime + recording.duration + recording.endPadding; } - + if (duration && startTime) { - var recordingStopTime = recordingStartTime + duration + var recordingStopTime = recordingStartTime + duration + recording.endPadding; } else if (duration && !startTime) { - var recordingStopTime = recording.startTime + recording.duration + var recordingStopTime = recording.startTime + recording.duration + recording.endPadding; } - + if (recordingStartTime <= this._dateUtils.nowInSeconds() || recordingStopTime <= this._dateUtils.nowInSeconds()) { return false; } - + var recordings = this.recordings.filter(function(recording) { return recording.id != id; }); - + for (var i = 0, l = recordings.length; i < l; i++) { var startPadding = recordings[i].startPadding; var endPadding = recordings[i].endPadding; var currentStartTime = recordings[i].startTime + startPadding; var currentDuration = recordings[i].duration + endPadding; var currentStopTime = currentStartTime + currentDuration; - + /* * First, verify that two recordings won't schedules at same time. * Second, verify that two recordings don't overlap. */ - if (recordingStartTime == currentStartTime || + if (recordingStartTime == currentStartTime || (recordingStartTime >= currentStartTime && recordingStartTime <= currentStopTime) || (recordingStopTime >= currentStartTime && recordingStopTime <= currentStopTime)) { - + return false; } } - + repeatDays && recording._setRepeatDays(repeatDays); - + if (startTime) { this._timerManagerRecording.clearTimer(recording.id); startTime && recording._setStartTime(startTime); this._planifyStartRecording(recording) .then(this._planifyEndRecording.bind(this, recording)); - + this._timeoutRecording() .then(this._fireEventUpdated.bind(this, recording)); - + return true; - + } - + if (duration) { this._timerManagerRecording.clearTimer(recording.id); duration && recording._setDuration(duration); - + this._planifyEndRecording(recording); - + this._timeoutRecording() .then(this._fireEventUpdated.bind(this, recording)); - + return true; - + } - + return false; - }, - - _dispatchBeforeStartedEventAndStartedEvent: function(timer, recording) { + } + + _dispatchBeforeStartedEventAndStartedEvent(timer, recording) { return this._timeoutRecording(timer) .then(recording._setState.bind(recording, this.BEFORE_STARTED)) @@ -569,5 +568,5 @@ this.STARTED)) .then(this._fireEventStarted.bind(this, recording)); } - -}); \ No newline at end of file + +} Modified: oipf/lib/js/impl/RemoteControlFunctionObject.js =================================================================== --- oipf/lib/js/impl/RemoteControlFunctionObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/RemoteControlFunctionObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,7 +1,6 @@ -var RemoteControlFunctionObject = Class.extend({ +class RemoteControlFunctionObject { - init : function(){ - + constructor() { } -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/RemoteManagementObject.js =================================================================== --- oipf/lib/js/impl/RemoteManagementObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/RemoteManagementObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,11 +1,10 @@ /* * Description: Access to the functionality of the application/oipfRemoteManagement embedded object SHALL adhere to the * security requirements as defined in section 10. - */ -var RemoteManagementObject = Class.extend({ + */ +class RemoteManagementObject { - init : function(){ - + constructor() { } -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/SearchManagerObject.js =================================================================== --- oipf/lib/js/impl/SearchManagerObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/SearchManagerObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -2,8 +2,16 @@ * Description: OITFs SHALL implement the application/oipfSearchManager embedded object. This object provides a * mechanism for applications to create and manage metadata searches. */ -var SearchManagerObject = Class.extend({ - +class SearchManagerObject { + + constructor(programmeService) { + this._programmeService = programmeService; + this._listeners = {}; + this._callbacks = {}; + this._eventManager = new EventManager(); + this._metadata = this._programmeService.programmes; + } + /* * Description: * This function is the DOM 0 event handler for events indicating changes in metadata. This SHALL be raised @@ -18,22 +26,22 @@ * * * The specified function is called with the arguments action, info and object. These arguments are defined as follows: - * + * * • Integer action – the type of update that has taken place. This field will take one of the following values: * --------------------------------------------------------------------------------------------------------------------------------------------------------------- * Value | Description * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 1 | A new version of metadata is available (see section 4.1.2.1.2 of [OIPF_META2]) and applications SHOULD discard all references to - * | Programme objects immediately and re-acquire them. + * 1 | A new version of metadata is available (see section 4.1.2.1.2 of [OIPF_META2]) and applications SHOULD discard all references to + * | Programme objects immediately and re-acquire them. * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 2 | A change to the parental control flags for a content item has occurred (e.g. the user has unlocked the parental control features of the receiver, - * | allowing a blocked item to be played). + * 2 | A change to the parental control flags for a content item has occurred (e.g. the user has unlocked the parental control features of the receiver, + * | allowing a blocked item to be played). * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * 3 | A flag affecting the filtering criteria of a channel has changed. Applications MAY listen for events with this action code to update lists of favourite * | channels, for instance. * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * - * • Integer info – extended information about the type of update that has taken place. + * • Integer info – extended information about the type of update that has taken place. * If the action argument is set to the value 3, the value of this field SHALL be one or more of the following: * ----------------------------------------------------------------- * Value | Description @@ -57,11 +65,17 @@ * • Object object – the affected channel, programme, or CoD asset prior to the change. If more than * one is affected, then this argument SHALL take the value null. */ - onMetadataUpdate: null, - + get onMetadataUpdate() { + return this._getCallback("MetadataUpdate"); + } + + set onMetadataUpdate(callback) { + this._setCallback("MetadataUpdate", callback); + } + /* * Description: - * This function is the DOM 0 event handler for events relating to metadata searches. The specified function is called with the arguments search and state. + * This function is the DOM 0 event handler for events relating to metadata searches. The specified function is called with the arguments search and state. * These arguments are defined as follows: * • MetadataSearch search – the affected search * @@ -69,49 +83,40 @@ * --------------------------------------------------------------------------------------------------------------------------------------------------------------- * Value | Description * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 0 | Search has finished. This event SHALL be generated when a search has completed. + * 0 | Search has finished. This event SHALL be generated when a search has completed. * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * 1 | This value is not used. * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * 2 | This value is not used. * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * 3 | The MetadataSearch object has returned to the idle state, either because of a call to SearchResults.abort() or because the parameters for the search - * | have been modified (e.g. the query, constraints or search target). + * | have been modified (e.g. the query, constraints or search target). * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- * 4 | The search cannot be completed due to a lack of resources or any other reason (e.g. insufficient memory is available to cache all of the requested * | results). - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - */ + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + */ get onMetadataSearch() { return this._getCallback("MetadataSearch"); - }, - + } + set onMetadataSearch(callback) { this._setCallback("MetadataSearch", callback); - }, - - _getCallback : function(type) { - if(this._callbacks) { + } + + _getCallback(type) { + if (this._callbacks) { return this._callbacks[type]; } - }, - - _setCallback: function(type, callback){ - if(this._callbacks) { + } + + _setCallback(type, callback) { + if (this._callbacks) { this._callbacks[type] = callback; } - }, - - _metadata: null, - - init: function(programmeService) { - this._programmeService = programmeService; - this._listeners = {}; - this._callbacks = {}; - this._eventManager = new EventManager(); - this._metadata = this._programmeService.programmes; - }, - + } + + /* * Description : * Create a MetadataSearch object that can be used to search the metadata. @@ -131,13 +136,13 @@ * * Return MetadataSearch */ - createSearch: function(searchTarget) { - + createSearch(searchTarget) { + if (searchTarget === 2 || searchTarget === 1) { return new MetadataSearch(searchTarget, this); } - }, - + } + /* * Description : * Create a MetadataSearch object that can be used to search the metadata. @@ -149,33 +154,34 @@ * * Return MetadataSearch */ - getChannelConfig: function() { + getChannelConfig() { return oipfObjectFactory.createChannelConfig(); - }, - - addEventListener: function(type, listener) { + } + + addEventListener(type, listener) { this._eventManager.addEventListener(type, listener, this); - }, - - _fireEvent: function(state, search) { - var event = createCustomEvent("MetadataSearch", [search, state]); + } + + _fireEvent(state, search) { + var event = + this._eventManager.createCustomEvent("MetadataSearch", [search, state]); this._eventManager.fireEvent(event, this); - }, - - _fireEventFinished: function(search) { + } + + _fireEventFinished(search) { this._fireEvent(metadataSearchConstants.state.FINISHED, search); - }, - - _fireEventModified: function(search) { + } + + _fireEventModified(search) { this._fireEvent(metadataSearchConstants.state.MODIFIED, search); - }, + } - _fireEventUncompleted: function(search) { + _fireEventUncompleted(search) { this._fireEvent(metadataSearchConstants.state.UNCOMPLETED, search); - }, - - removeEventListener: function(type, listener) { + } + + removeEventListener(type, listener) { this._eventManager.removeEventListener(type, listener, this); } -}); +} Modified: oipf/lib/js/impl/StatusViewObject.js =================================================================== --- oipf/lib/js/impl/StatusViewObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/StatusViewObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,7 +1,6 @@ -var StatusViewObject = Class.extend({ +class StatusViewObject { - init: function() { - + constructor() { } -}); \ No newline at end of file +} Modified: oipf/lib/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/lib/js/impl/VideoBroadcastObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/VideoBroadcastObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,5 +1,5 @@ /* - * Description: + * Description: * If the object type is supported, this method shall return an instance of the * corresponding embedded object. * Since objects do not claim scarce resources when they are instantiated, instantiation shall @@ -10,7 +10,7 @@ * to the specified object. The value of the type attribute of the HTMLObjectElement SHALL * match the mimetype of the instantiated object, for example " video/broadcast " in case of * method oipfObjectFactory.createVideoBroadcastObject() . - * + * * Arguments: * -requiredCapabilities : * An optional argument indicating the formats to be supported by @@ -25,137 +25,139 @@ * so instantiation shall never fail if the object type is supported. The * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . */ -var VideoBroadcastObject = Class.extend({ - - _UNREALIZED: 0, - - _CONNECTING: 1, - - _PRESENTING: 2, - - _STOPPED: 3, - - /* - * Description: - * The width of the area used for rendering the video object. This property is only writable if property - * fullScreen has value false . Changing the width property corresponds to changing the width property - * through the HTMLObjectElement interface, and must have the same effect as changing the width through - * the DOM Level 2 Style interfaces (i.e. CSS2Properties interface style.width ), at least for values - * specified in pixels. - */ - width: null, - /* - * Description: - * The height of the area used for rendering the video object. This property is only writable if property - * fullScreen has value false . Changing the height property corresponds to changing the height property - * through the HTMLObjectElement interface, and must have the same effect as changing the height through - * the DOM Level 2 Style interfaces (i.e. CSS2Properties interface style.height ), at least for values - * specified in pixels. - */ - heigth: null, - - /* - * Description: - * Returns true if this video object is in full-screen mode, false otherwise. The default value is false . - * Visibilité Type: readonly Boolean - */ - fullScreen: null, - - /* - * Description: - * Setting the value of the data property SHALL have no effect on the video/broadcast object. If this property - * is read, the value returned SHALL always be the empty string. - * Type: String - */ - data: null, - - /*! - * Description: - * Visibility Type: readonly Integer - * The current play state of the video/broadcast object. Valid values are: - * --------------------------------------------------------------------------------------------------------------------------------------------------------------- - * Value | Description - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 0 | unrealized; the application has not made a request to start presenting a channel or has stopped presenting a channel and released any resources. The - * | content of the video/broadcast object should be transparent but if not shall be an opaque black rectangle. Control of media presentation is under the * | control of the OITF, as defined in section H.2. - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 1 | connecting; the terminal is connecting to the media source in order to begin playback. Objects in this state may be buffering data in order to start - * | playback. Control of media the control of the OITF, as defined in section H.2. The content of the video/broadcast object is implementation dependent. - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 2 | presenting; the media is currently being presented to the user. The object is in this state regardless of whether the media is playing at normal speed, - * | paused, or playing in a trick mode (e.g. at a speed other than normal speed). Control of media presentation is under the control of the application, - * | as defined in section H.2. The video/broadcast object contains the video being presented. - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * 3 | stopped; the terminal is not presenting media, either inside the video/broadcast object or in the logical video plane. The logical video plane is - * | disabled. The content of the video/broadcast object SHALL be an opaque black rectangle. Control of media presentation is under the control of the - * | application, as defined in section H.2 - * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- - * See section 7.13.1.1 for a description of the state model for a video/broadcast object. - * NOTE: Implementations where the content of the video/broadcast object is transparent in the unrealized state will give a better user experience than - * ones where it is black. This happens for an application with video in the background between when it includes a video/broadcast object in the page and when a - * call to bindToCurrentChannel() completes. Applications which do not need to call bindToCurrentChannel() should not do so. The current channel can - * be obtained from the currentChannel property on the ApplicationPrivateData object which is the same as that on the video/broadcast object under most normal * conditions. - */ - playState: null, - - /* - * Description: - * The list of media formats that are supported by the object. Each item SHALL contain a format label according - * to [OIPF_MEDIA2]. - * If scarce resources are not claimed by the object, the value of this property SHALL be null. - * - * Visibilité Type: readonly StringCollection - */ - playerCapabilities: null, - - /* - * Description: - * Returns the resource allocation method currently in use by the object. Valid values as defined in section 7.14.13.1 are: - * to [OIPF_MEDIA2]. - * • STATIC_ALLOCATION - * • DYNAMIC_ALLOCATION - * - * Visibilité Type: readonly Integer - */ - allocationMethod: null, - - /* - * Description: - * The channel currently being presented by this embedded object if the user has given permission to share this - * information, possibly through a mechanism outside the scope of this specification. If no channel is being - * presented, or if this information is not visible to the caller, the value of this property SHALL be null. - * The value of this property is not affected during timeshift operations and SHALL reflect the value prior to the - * start of a timeshift operation, for both local and network timeshift resources. - * - * Extensions to video/broadcast for current channel information: - * If an OITF has indicated support for extended tuner control (i.e. by giving value true to element - * <extendedAVControl> as specified in section 9.3.6 in its capability description), the OITF SHALL support the - * following additional properties and methods on the video/broadcast object. - * The functionality as described in this section is subject to the security model of section 10.1.3.8. - * Note the property onChannelScan and methods startScan and stopScan have been moved to section 7.13.9. - * - * Visibility Type: readonly Channel - */ - currentChannel: null, - - createdCallback: function() { - console.log("[INFO] createdCallback called."); - this.init(); - }, - - init: function () { +class VideoBroadcastObject { + + constructor() { console.log("[INFO] constructor of VideoBroadcast class called."); + + this._UNREALIZED = 0; + + this._CONNECTING = 1; + + this._PRESENTING = 2; + + this._STOPPED = 3; + + /* + * Description: + * The width of the area used for rendering the video object. This property is only writable if property + * fullScreen has value false . Changing the width property corresponds to changing the width property + * through the HTMLObjectElement interface, and must have the same effect as changing the width through + * the DOM Level 2 Style interfaces (i.e. CSS2Properties interface style.width ), at least for values + * specified in pixels. + */ + this.width = null; + /* + * Description: + * The height of the area used for rendering the video object. This property is only writable if property + * fullScreen has value false . Changing the height property corresponds to changing the height property + * through the HTMLObjectElement interface, and must have the same effect as changing the height through + * the DOM Level 2 Style interfaces (i.e. CSS2Properties interface style.height ), at least for values + * specified in pixels. + */ + this.heigth = null; + + /* + * Description: + * Returns true if this video object is in full-screen mode, false otherwise. The default value is false . + * Visibilité Type: readonly Boolean + */ + this.fullScreen = null; + + /* + * Description: + * Setting the value of the data property SHALL have no effect on the video/broadcast object. If this property + * is read, the value returned SHALL always be the empty string. + * Type: String + */ + this.data = null; + + /*! + * Description: + * Visibility Type: readonly Integer + * The current play state of the video/broadcast object. Valid values are: + * --------------------------------------------------------------------------------------------------------------------------------------------------------------- + * Value | Description + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + * 0 | unrealized; the application has not made a request to start presenting a channel or has stopped presenting a channel and released any resources. The + * | content of the video/broadcast object should be transparent but if not shall be an opaque black rectangle. Control of media presentation is under the * | control of the OITF, as defined in section H.2. + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + * 1 | connecting; the terminal is connecting to the media source in order to begin playback. Objects in this state may be buffering data in order to start + * | playback. Control of media the control of the OITF, as defined in section H.2. The content of the video/broadcast object is implementation dependent. + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + * 2 | presenting; the media is currently being presented to the user. The object is in this state regardless of whether the media is playing at normal speed, + * | paused, or playing in a trick mode (e.g. at a speed other than normal speed). Control of media presentation is under the control of the application, + * | as defined in section H.2. The video/broadcast object contains the video being presented. + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + * 3 | stopped; the terminal is not presenting media, either inside the video/broadcast object or in the logical video plane. The logical video plane is + * | disabled. The content of the video/broadcast object SHALL be an opaque black rectangle. Control of media presentation is under the control of the + * | application, as defined in section H.2 + * ------ -------------------------------------------------------------------------------------------------------------------------------------------------------- + * See section 7.13.1.1 for a description of the state model for a video/broadcast object. + * NOTE: Implementations where the content of the video/broadcast object is transparent in the unrealized state will give a better user experience than + * ones where it is black. This happens for an application with video in the background between when it includes a video/broadcast object in the page and when a + * call to bindToCurrentChannel() completes. Applications which do not need to call bindToCurrentChannel() should not do so. The current channel can + * be obtained from the currentChannel property on the ApplicationPrivateData object which is the same as that on the video/broadcast object under most normal * conditions. + */ + this.playState = null; + + /* + * Description: + * The list of media formats that are supported by the object. Each item SHALL contain a format label according + * to [OIPF_MEDIA2]. + * If scarce resources are not claimed by the object, the value of this property SHALL be null. + * + * Visibilité Type: readonly StringCollection + */ + this.playerCapabilities = null; + + /* + * Description: + * Returns the resource allocation method currently in use by the object. Valid values as defined in section 7.14.13.1 are: + * to [OIPF_MEDIA2]. + * • STATIC_ALLOCATION + * • DYNAMIC_ALLOCATION + * + * Visibilité Type: readonly Integer + */ + this.allocationMethod = null; + + /* + * Description: + * The channel currently being presented by this embedded object if the user has given permission to share this + * information, possibly through a mechanism outside the scope of this specification. If no channel is being + * presented, or if this information is not visible to the caller, the value of this property SHALL be null. + * The value of this property is not affected during timeshift operations and SHALL reflect the value prior to the + * start of a timeshift operation, for both local and network timeshift resources. + * + * Extensions to video/broadcast for current channel information: + * If an OITF has indicated support for extended tuner control (i.e. by giving value true to element + * <extendedAVControl> as specified in section 9.3.6 in its capability description), the OITF SHALL support the + * following additional properties and methods on the video/broadcast object. + * The functionality as described in this section is subject to the security model of section 10.1.3.8. + * Note the property onChannelScan and methods startScan and stopScan have been moved to section 7.13.9. + * + * Visibility Type: readonly Channel + */ + this.currentChannel = null; + this.playState = 0; this._listeners = {}; this._callbacks = {}; this._channelService = oipfObjectFactory._channelService; this._eventManager = new EventManager(); this._timerManager = new TimerManager(); - + this._timeout = this._timerManager.createTimer.bind(this._timerManager, 0); this._timeoutLong = this._timerManager.createTimer.bind(this._timerManager, 100); - }, - + } + + createdCallback() { + console.log("[INFO] createdCallback called."); + this.init(); + } + + /*! * Description: * The function that is called when a request to switch a tuner to another channel resulted in an error preventing @@ -165,7 +167,7 @@ * * These arguments are defined as follows: * - * • Channel channel: + * • Channel channel: * the Channel object to which a channel switch was requested, but for which the * error occurred. This object SHALL have the same properties as the channel that was requested, * except that for channels of type ID_DVB_* the values for the onid and tsid properties SHALL be @@ -205,29 +207,35 @@ * 100 | unidentified error. * --------------------------------------------------------------------------------------------------------------------------------------------------------------- */ - onChannelChangeError: null, - + get onChannelChangeError() { + return this._getCallback("ChannelChangeError"); + } + + set onChannelChangeError(callback) { + this._setCallback("ChannelChangeError", callback); + } + /*! * Description: * The function that is called when the play state of the video/broadcast object changes. This function may * be called either in response to an action initiated by the application, an action initiated by the OITF or an * error (see section 7.13.1.1). - * + * * The specified function is called with the arguments state and error . These arguments are defined as follows: - * - * • Number state: + * + * • Number state: * the new state of the video/broadcast object. Valid values are given in the definition of the playState property above. * * • Number error – if the state has changed due to an error, this field contains an error code detailing the type of error. See the definition of * onChannelChangeError above for valid values. If no error has occurred, this argument SHALL take the value undefined . */ get onPlayStateChange() { return this._getCallback("PlayStateChange"); - }, - + } + set onPlayStateChange(callback) { this._setCallback("PlayStateChange", callback); - }, - + } + /* * Description: * The function that is called when a request to switch a tuner to another channel has successfully completed. @@ -239,68 +247,80 @@ */ get onChannelChangeSucceeded() { return this._getCallback("ChannelChangeSucceeded"); - }, - + } + set onChannelChangeSucceeded(callback) { this._setCallback("ChannelChangeSucceeded", callback); - }, - + } + get onDRMRightsError() { return this._getCallback("DRMRightsError"); - }, - + } + set onDRMRightsError(callback) { this._setCallback("DRMRightsError", callback); - }, + } /* * Description: * The function that is called when the value of fullScreen changes. */ - onFullScreenChange: function() { + get onFullScreenChange() { + return this._getCallback("FullScreenChange"); + } - }, - + set onFullScreenChange(callback) { + this._setCallback("FullScreenChange", callback); + } + /* * Description: * The function that is called when the video object gains focus. */ - onfocus: function() { + get onfocus() { + return this._getCallback("focus"); + } - }, - + set onfocus(callback) { + this._setCallback("focus", callback); + } + /* * Description: * The function that is called when the video object loses focus. */ - onblur: function() { + get onblur() { + return this._getCallback("blur"); + } - }, - - _getCallback : function(type) { - if(this._callbacks) { + set onblur(callback) { + this._setCallback("blur", callback); + } + + _getCallback(type) { + if (this._callbacks) { return this._callbacks[type]; } - }, - - _setCallback: function(type, callback){ - if(this._callbacks) { + } + + _setCallback(type, callback) { + if (this._callbacks) { this._callbacks[type] = callback; } - }, - + } + /* * - * Description: + * Description: * Returns the channel line-up of the tuner in the form of a ChannelConfig object as defined * in section 7.13.9. The method SHALL return the value null if the channel list is not * (partially) managed by the OITF (i.e., if the channel list information is managed entirely in the network). */ - getChannelConfig: function() { + getChannelConfig() { return oipfObjectFactory.createChannelConfig(); - }, - + } + /* - * Description: + * Description: * If the video/broadcast object is in the unrealized state and video from exactly one * channel is currently being presented by the OITF then this binds the video/broadcast * object to that video. @@ -321,13 +341,13 @@ * from that channel is being presented. Applications should listen for the video/broadcast * object entering state 2 (“ presenting ”) in order to determine when audio or video is being * presented. - * + * * TODO : binding of necessary ressources */ - bindToCurrentChannel: function() { + bindToCurrentChannel() { var channelConfig = this._channelService; var currentChannel = channelConfig.currentChannel; - + switch (this.playState) { case this._UNREALIZED: @@ -344,7 +364,7 @@ .then(this.changePlayState.bind(this, this._UNREALIZED, 100)); } break; - + case this._CONNECTING: if (!channelUtils.verifyASuitableTunerAvailable(currentChannel.idType)) { this._timeout() @@ -356,7 +376,7 @@ } //Method documentation indicate it don't have effects in this state. break; - + case this._PRESENTING: /*if (!verifyASuitableTunerAvailable(currentChannel.idType)) { this.timer = oipf.utils.this._timeout() @@ -364,7 +384,7 @@ }*/ //Method documentation indicate it don't have effects in this state. break; - + case this._STOPPED: //FIX-ME :Make enable video and audio presentation if (!channelUtils.verifyASuitableTunerAvailable(currentChannel.idType, this)) { @@ -380,52 +400,52 @@ break; } return this.currentChannel; - }, + } - addEventListener: function(type, listener) { + addEventListener(type, listener) { this._eventManager.addEventListener(type, listener, this); - }, - - _fireEvent: function(event) { + } + + _fireEvent(event) { this._eventManager.fireEvent(event, this); - }, - - removeEventListener: function(type, listener) { + } + + removeEventListener(type, listener) { this._eventManager.removeEventListener(type, listener, this); - }, - - changePlayState: function(state, error) { + } + + changePlayState(state, error) { console.log("changeState", state); this.playState = state; this._fireEvent(createCustomEvent("PlayStateChange", [this.playState, error])); - }, - - noTransientError: function(channel){ - + } + + noTransientError(channel) { + /*if (channel.locked) { return true; } else { return false; }*/ return true; - }, - - noPermanentError: function(channel){ + } + + noPermanentError(channel) { return true; - }, - - changeStateToConnectingWhenSwitching: function(channel) { - + } + + changeStateToConnectingWhenSwitching(channel) { + if (this.noTransientError(this._CONNECTING) && this.noPermanentError(this._CONNECTING, channel)) { this.playState = this._CONNECTING; this._fireEvent(createCustomEvent("PlayStateChange", [this.playState])); this._timeout() .then(this.changeStateToPresentingWhenSwitching.bind(this, channel)); } - }, - - changeStateToPresentingWhenSwitching: function(channel) { + } + changeStateToPresentingWhenSwitching(channel) { + if (this.noTransientError(this._PRESENTING)) { this.setCurrentChannel(channel); this.playState = this._PRESENTING; @@ -433,12 +453,12 @@ this._timeout() .then(this._fireEvent.bind(this, createCustomEvent("ChannelChangeSucceeded", [channel]))); } - }, - - setCurrentChannel: function(channel) { + } + + setCurrentChannel(channel) { this.currentChannel = channel; - }, - + } + /* * Description: * Creates a Channel object of the specified idType . This method is typically used to create a @@ -447,64 +467,64 @@ * be part of the channel list in the OITF. The resulting Channel object represents a locally * defined channel which, if not already present there, does not get added to the channel list * accessed through the ChannelConfig class (see section 7.13.9). - * + * * If the channel of the given type cannot be created or the delivery system descriptor is not * valid, the method SHALL return null . - * + * * If the channel of the given type (ID_DVB_SI_DIRECT) can be created and the delivery system descriptor is valid, * the method SHALL return a Channel object whereby at a minimum the properties with the * same names (i.e. idType , dsd and sid ) are given the same value as argument idType , * dsd and sid of the createChannelObject method. - * + * * Else, if the channel of the given type can be created and arguments are considered valid and * complete, then either: - * + * * 1. If the channel is in the channel list then a new object of the same type and with * properties with the same values SHALL be returned as would be returned by calling * getChannelWithTriplet() with the same parameters as this method. - * + * * 2. Otherwise, the method SHALL return a Channel object whereby at a minimum the * properties with the same names are given the same value as the given arguments of * the createChannelObject() method. The values specified for the remaining - * properties of the Channel object are set to undefined . + * properties of the Channel object are set to undefined . * * Arguments: - * + * * Either (if idType ID_DVB_SI_DIRECT): * - idType: The type of channel, as indicated by one of the ID_* constants defined in * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For * other values this behaviour is not specified. - * + * * - dsd: The delivery system descriptor (tuning parameters) represented as a string * whose characters shall be restricted to the ISO Latin-1 character set. Each * character in the dsd represents a byte of a delivery system descriptor as defined * by DVB-SI [EN 300 468] section 6.2.13, such that a byte at position "i" in the * delivery system descriptor is equal the Latin-1 character code of the character at * position "i" in the dsd. - * + * * - sid: The service ID, which must be within the range of 1 to 65535. - * + * * Or (Any other type): * - idType : The type of channel, as indicated by one of the ID_* constants defined in * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For * other values this behaviour is not specified. - * + * * - onid : The original network ID. Optional argument that SHALL be specified * when the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , * or ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - tsid : The transport stream ID. Optional argument that MAY be specified when * the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or * ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - sid : The service ID. Optional argument that SHALL be specified when the * idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or * ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - sourceID : The source_ID. Optional argument that SHALL be specified when the * idType specifies a channel of type ID_ATSC_T and SHALL otherwise be * gnored by the OITF. - * + * * - ipBroadcastID : The DVB textual service identifier of the IP broadcast service, specified in * the format “ ServiceName.DomainName ” when idType specifies a * channel of type ID_IPTV_SDS , or the URI of the IP broadcast service @@ -513,8 +533,8 @@ * of type ID_IPTV_SDS or ID_IPTV_URI and SHALL otherwise be ignored * by the OITF. */ - createChannelObject: function() { - + createChannelObject() { + if (arguments.length == 3 && arguments[0] == 13) { this._createDvbSiChannelObject(arguments); } else { @@ -523,27 +543,27 @@ } } return null; - }, - - _createDvbSiDirectChannelObject: function(idType, dsd, sid) { - + } + + _createDvbSiDirectChannelObject(idType, dsd, sid) { + if (idType == 13) { //Identify a channel of identifier type : ID_DVB_SI_DIRECT. if (CHANNEL_CREATION[idType]) { //Verify a channel of this idType (ID_DVB_SI_DIRECT = 13). - - + + if (channelUtils.isAValidTerrestrialDsd (dsd)) { //Verify the dsd validity. - + if ((sid >= 1) && (sid <= 65535)) { //Verify the rigth range of service id. - + var newChannel = new Channel(idType, dsd, sid, "localChannel" + createUUID()); var channelConfig = this._channelService; if (channelUtils.getChannelByDsd(channelConfig.channelList, dsd)) { - + /* Normally channelList is readonly but the method documentation say * that the channel must be add if it not already present. - */ + */ channelConfig.channelList.push(newChannel); } @@ -554,8 +574,8 @@ } } - }, - + } + /* * Description: * Creates a Channel object of the specified idType . This method is typically used to create a @@ -577,23 +597,23 @@ * - idType : The type of channel, as indicated by one of the ID_* constants defined in * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For * other values this behaviour is not specified. - * + * * - onid : The original network ID. Optional argument that SHALL be specified * when the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , * or ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - tsid : The transport stream ID. Optional argument that MAY be specified when * the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or * ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - sid : The service ID. Optional argument that SHALL be specified when the * idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or * ID_ISDB_* and SHALL otherwise be ignored by the OITF. - * + * * - sourceID : The source_ID. Optional argument that SHALL be specified when the * idType specifies a channel of type ID_ATSC_T and SHALL otherwise be * gnored by the OITF. - * + * * - ipBroadcastID : The DVB textual service identifier of the IP broadcast service, specified in * the format “ ServiceName.DomainName ” when idType specifies a * channel of type ID_IPTV_SDS , or the URI of the IP broadcast service @@ -601,12 +621,12 @@ * argument that SHALL be specified when the idType specifies a channel * of type ID_IPTV_SDS or ID_IPTV_URI and SHALL otherwise be ignored * by the OITF. - * - * Important : We place us into a world without error. And no validation will be done like + * + * Important : We place us into a world without error. And no validation will be done like * this documentation mention it. This criterion not very useful in our implementation. */ - _createAnyDvbChannelObject: function(idType, onid, tsid, sid, sourceID, ipBroadcastID) { - + _createAnyDvbChannelObject(idType, onid, tsid, sid, sourceID, ipBroadcastID) { + if (CHANNEL_CREATION[idType]) { if (idType == 13 || idType ==0) { return null; @@ -615,49 +635,49 @@ if (idType == 30) { var equivalentChannel = this._channelService.channelList.getChannelBySourceID(sourceID); } else if (idType == 40) { - equivalentChannel = channelUtils.getChannelByIpBroadcastID(ipBroadcastID); + equivalentChannel = channelUtils.getChannelByIpBroadcastID(ipBroadcastID); } else { equivalentChannel = this._channelService.channelList.getChannelByTriplet(onid, tsid, sid); } - + if (equivalentChannel) { var newChannel = new Channel(arguments.push(equivalentChannel.name)); } else { newChannel = new Channel(arguments.push("localChannel:"+createUUID())); } - + this._channelService.channelList.push(newChannel); } - + return null; - }, + } /* * Description: (Validation on Transport Stream won't be done here because this criteria not relevant) * Requests the OITF to switch a (logical or physical) tuner to the channel specified by * channel and render the received broadcast content in the area of the browser allocated for * the video/broadcast object. - * + * * If the channel specifies an idType attribute value which is not supported by the OITF or a * combination of properties that does not identify a valid channel, the request to switch * channel SHALL fail and the OITF SHALL trigger the function specified by the * onChannelChangeError property, specifying the value 0 (“Channel not supported by * tuner”) for the errorState , and dispatch the corresponding DOM event (see below). - * - * FiX-ME: Yannis - 25/03/2015 - No take account trickplay - * FiX-ME: Yannis - 25/03/2015 - No verification about Transport Stream - * FiX-ME: Yannis - 25/03/2015 - No verification about possiblity of a local channel argument - * FiX-ME: Yannis - 25/03/2015 - No verification about same tuning - * parameters of argument channel with + * + * FiX-ME: Yannis - 25/03/2015 - No take account trickplay + * FiX-ME: Yannis - 25/03/2015 - No verification about Transport Stream + * FiX-ME: Yannis - 25/03/2015 - No verification about possiblity of a local channel argument + * FiX-ME: Yannis - 25/03/2015 - No verification about same tuning + * parameters of argument channel with */ - setChannel: function(channel, trickplay, contentAccessDescriptorURL) { - + setChannel(channel, trickplay, contentAccessDescriptorURL) { + if (this.playState >= this._UNREALIZED && this.playState <= this._STOPPED && channel) { - + if (channelUtils.verifyASuitableTunerAvailable(channel.idType, this) && channel.idType != 41) { this._timeout() .then(this.changeStateToConnectingWhenSwitching.bind(this, channel)); - + } else if (channel.idType == 40 || channel.idType == 41) { this._timeout() .then(this._fireEvent.bind(this, createCustomEvent("ChannelChangeError", [null, 8]))); @@ -671,7 +691,7 @@ .then(this.changePlayState.bind(this, this._UNREALIZED)); } } - }, + } /* * Description: @@ -683,7 +703,7 @@ * If the current channel is not part of the channel list, it is implementation dependent whether * the method call succeeds or fails and, if it succeeds, which channel is selected. In both * cases, all appropriate functions SHALL be called and DOM events dispatched. - * + * * If the previous channel is a channel that cannot be received over the tuner currently used by * the video/broadcast object, the OITF SHALL relay the channel switch request to a local * physical or logical tuner that is not in use and that can tune to the specified channel. The @@ -703,11 +723,11 @@ * dispatch the corresponding DOM event. * Calls to this method are valid in the Connecting, Presenting and Stopped states. They are * not valid in the Unrealized state and SHALL fail. - * + * */ - prevChannel: function() { + prevChannel() { this._channelSwitch(-1); - }, + } /* * Description: @@ -719,7 +739,7 @@ * If the current channel is not part of the channel list, it is implementation dependent whether * the method call succeeds or fails and, if it succeeds, which channel is selected. In both * cases, all appropriate functions SHALL be called and DOM events dispatched. - * + * * If the next channel is a channel that cannot be received over the tuner currently used by * the video/broadcast object, the OITF SHALL relay the channel switch request to a local * physical or logical tuner that is not in use and that can tune to the specified channel. The @@ -739,11 +759,11 @@ * dispatch the corresponding DOM event. * Calls to this method are valid in the Connecting, Presenting and Stopped states. They are * not valid in the Unrealized state and SHALL fail. - * + * */ - nextChannel: function() { + nextChannel() { this._channelSwitch(1); - }, + } /* * Description: @@ -751,23 +771,23 @@ * ( fullscreen = false ) mode (as per [Req. 5.7.1.c] of [CEA-2014-A]). If this indicates a * change in mode, this SHALL result in a change of the value of property fullScreen . * Changing the mode SHALL NOT affect the z-index of the video object. - * - * Arguments: + * + * Arguments: * - fullScreen : Boolean to indicate whether video content should be rendered full-screen or not. */ - setFullScreen: function(fullscreen) { - }, - + setFullScreen(fullscreen) { + } + /* * Description: * Adjusts the volume of the currently playing media to the volume as indicated by volume. * Allowed values for the volume argument are all the integer values starting with 0 up to and - * including 100. - * A value of 0 means the sound will be muted. + * including 100. + * A value of 0 means the sound will be muted. * A value of 100 means that the * volume will become equal to current “master” volume of the device, whereby the “master” * volume of the device is the volume currently set for the main audio output mixer of the - * device. + * device. * All values between 0 and 100 define a linear increase of the volume as a percentage * of the current master volume, whereby the OITF SHALL map it to the closest volume level * supported by the platform. @@ -776,52 +796,52 @@ * * Arguments: * - volume: Integer value between 0 up to and including 100 to indicate volume level. - * + * * Actually the norm don't talk about the way to obtain the current master volume for the main * audio output mixer; So we'll base on the system volume. * FIX-ME: Yannis - 24/03/2015 - Bindind with the configuration object. */ - setVolume: function(volume) { - + setVolume(volume) { + if (!Number.isInteger(volume) || volume < 0 || volume > 100 ) { return false; - } - + } + this._volume = volume; return true; - }, - + } + /* * Description: * Returns the actual volume level set; for systems that do not support individual volume * control of players, this method will have no effect and will always return 100. * */ - getVolume: function() { + getVolume() { return this._volume || 0; - }, - + } + /* * Description: * Releases the decoder/tuner used for displaying the video broadcast inside the * video/broadcast object, stopping any form of visualization of the video inside the * video/broadcast object and releasing any other associated resources. - * If the object was created with an allocationMethod of STATIC_ALLOCATION , + * If the object was created with an allocationMethod of STATIC_ALLOCATION , * the releasing of resources shall change this to DYNAMIC_ALLOCATION . */ - release: function() { - if ((this.playState >= this._CONNECTING) && (this.playState <= this._STOPPED)) { - /* Call method to : + release() { + if (this.playState >= this._CONNECTING && this.playState <= this._STOPPED) { + /* Call method to : * - release tuner used by this video/broadcast object. * - stop visualization of the video. * - and scarce ressources loaded previously. */ - - + + this._timeout() .then(this.changePlayState.bind(this, this._UNREALIZED)); } - }, + } /* * Description: @@ -831,28 +851,28 @@ * as EIT information. * Calling this method from the unrealized state SHALL have no effect. * See section 7.13.1.1 for more information of its usage. - * + * */ - stop: function() { - if ((this.playState == this._CONNECTING) || (this.playState == this._PRESENTING)) { - /* Call method to : + stop() { + if (this.playState == this._CONNECTING || this.playState == this._PRESENTING) { + /* Call method to : * - stop the presentation of the video and audio. * - and scarce ressources loaded previously. */ - - + + this._timeout() .then(this.changePlayState.bind(this, this._STOPPED)); } - }, - - _channelSwitch: function(step) { + } + + _channelSwitch(step) { //claimed scarce resources //Call method to claim scarce resources var channelConfig = this._channelService; var favouriteLists = channelConfig.favouriteLists; - + if ((this.playState > 0) && (this.playState < 4)) { //Verify that OITF maintain channel list or favourite list by itself if (channelConfig && favouriteLists) { @@ -863,7 +883,7 @@ .then(this._fireEvent.bind(this, createCustomEvent("ChannelChangeError", [null, 100]))); /*setTimeout(function () { self.onChannelChangeError && self.onChannelChangeError(null, 100); - }, 0);*/ + } 0);*/ if (this.playState == 1) { this._timeout() @@ -871,13 +891,13 @@ /*setTimeout(function () { self.playState = 0; self.onPlayStateChange && self.onPlayStateChange(self.playState, 100); - }, 0);*/ - } + } 0);*/ + } } else { /* - * The norm affirm that the value "undefined" for the property "currentFavouriteList" + * The norm affirm that the value "undefined" for the property "currentFavouriteList" * means no current favourite list is activating. - * But test on this value for "currentFavouriteList" can cause confusion + * But test on this value for "currentFavouriteList" can cause confusion * and when her value equals null, we have not the wanted behaviours. */ if (channelConfig.currentFavouriteList.length == 0) { @@ -901,35 +921,35 @@ this._timeout() .then(this._fireEvent.bind(this, createCustomEvent("ChannelChangeError", [null, 0]))); } - + } } else { //When the OITF does not maintain channel list or favourite list by itself this._timeout() .then(this._fireEvent.bind(this, createCustomEvent("ChannelChangeError", [null, 10]))); - + } - } - }, - + } + } + /* * Description: * Creates a ChannelList object from the specified SD&S Broadcast Discovery * Record. Channels in the returned channel list will not be included in the * channel list that can be retrieved via calls to getChannelConfig(). - * + * * Arguments: * - bdr: An XML-encoded string containing an SD&S Broadcast Discovery - * Record as specified in [OIPF_META2]. If the string is not a valid - * Broadcast Discovery Record, this method SHALL return null. - * + * Record as specified in [OIPF_META2]. If the string is not a valid + * Broadcast Discovery Record, this method SHALL return null. + * * Return: ChannelList - * - * FIXME - * - Yannis 21/05/2015 Validate the parameter bdr + * + * FIXME + * - Yannis 21/05/2015 Validate the parameter bdr */ - createChannelList: function(bdr) { + createChannelList(bdr) { var channelListArray = bdr.split(","); var channelList = new ChannelList(); var channelInfoNumber = { @@ -938,45 +958,45 @@ 5: true, 6: true }; - + if (channelListArray.length > 1) { - + for (var i = 0, li = channelListArray.length; i < li; i++) { var channelInfo = channelListArray[i]; var channelInfoArray = channelInfo.split("-"); - - var isChannelInfoNumberExist = + + var isChannelInfoNumberExist = channelInfoNumber[channelInfoArray.length]; - + if (!isChannelInfoNumberExist) { return null; } - //Validation of channel information return null if false - + //Validation of channel information return null if false + //Create the channel var channelObject = this._createChannel(channelInfoArray); channelList.push(channelObject); } - + if (!this._localChannelList) { this._localChannelList = []; } - + this._localChannelList.push(channelList); - + return channelList; } - + return null; - }, - + } + /* - * We consider that the parameter of this method is valid concerning + * We consider that the parameter of this method is valid concerning * the type of channel information it contains but they are string-encoded. - * And call the associated method which must process a specific + * And call the associated method which must process a specific * group of channel information according to the number of information. */ - _createChannel: function(minimalChannelInfoArray) { + _createChannel(minimalChannelInfoArray) { var mapping = { 3: "_createChannelATSC_T", 4: "_createChannelDVB_SI_DIRECT", @@ -985,36 +1005,36 @@ }; var channelInfoNumber = minimalChannelInfoArray.length; return this[mapping[channelInfoNumber]].call(minimalChannelInfoArray); - }, - + } + /* * This method must transform the information which must be of type Integer. * Then create and return a Channel object. - * The parameter contain in this order: + * The parameter contain in this order: * 0:Integer, 1:Integer, 2:String - * + * * Return: Channel */ - _createChannelATSC_T: function(channelInfoArray) { + _createChannelATSC_T(channelInfoArray) { var i = 0; - + return new Channel( this._convertInInteger(channelInfoArray[i++]), this._convertInInteger(channelInfoArray[i++]), channelInfoArray[i++]); - }, - + } + /* * This method must transform the information which must be of type Integer. * Then create and return a Channel object. - * The parameter contain in this order: + * The parameter contain in this order: * 0:Integer, 1:Integer, 2:Integer, 3:Integer, 4:String, 5:String - * + * * Return: Channel */ - _createChannelIPTV: function(channelInfoArray) { + _createChannelIPTV(channelInfoArray) { var i = 0; - + return new Channel( this._convertInInteger(channelInfoArray[i++]), this._convertInInteger(channelInfoArray[i++]), @@ -1022,47 +1042,47 @@ this._convertInInteger(channelInfoArray[i++]), channelInfoArray[i++], channelInfoArray[i++]); - }, - + } + /* * This method must transform the information which must be of type Integer. * Then create and return a Channel object. - * The parameter contain in this order: + * The parameter contain in this order: * 0:Integer, 1:Integer, 2:Integer, 3:Integer, 4:String - * + * * Return: Channel */ - _createChannelDVBOrISDB: function(channelInfoArray) { + _createChannelDVBOrISDB(channelInfoArray) { var i = 0; - + return new Channel( this._convertInInteger(channelInfoArray[i++]), this._convertInInteger(channelInfoArray[i++]), this._convertInInteger(channelInfoArray[i++]), this._convertInInteger(channelInfoArray[i++]), channelInfoArray[i++]); - }, - + } + /* * This method must transform the information which must be of type Integer. * Then create and return a Channel object. - * The parameter contain in this order: + * The parameter contain in this order: * 0:Integer, 1:String, 2:Integer, 3:String - * + * * Return: Channel */ - _createChannelDVB_SI_DIRECT: function(channelInfoArray) { + _createChannelDVB_SI_DIRECT(channelInfoArray) { var i = 0; - + return new Channel( this._convertInInteger(channelInfoArray[i++]), channelInfoArray[i++], this._convertInInteger(channelInfoArray[i++]), channelInfoArray[i++]); - }, - - _convertInInteger: function(stringValue) { + } + + _convertInInteger(stringValue) { return Number.parseInt(stringValue); } - -}); \ No newline at end of file + +} Modified: oipf/lib/js/impl/VideoMpegObject.js =================================================================== --- oipf/lib/js/impl/VideoMpegObject.js 2015-06-09 15:07:19 UTC (rev 1655) +++ oipf/lib/js/impl/VideoMpegObject.js 2015-06-09 15:19:17 UTC (rev 1656) @@ -1,7 +1,6 @@ -var VideoMpegObject = Class.extend({ +class VideoMpegObject { - init: function () { - + constructor() { } -}); \ No newline at end of file +}
participants (1)
-
ygrego@users.nuiton.org