Author: ygrego Date: 2015-01-29 10:08:37 +0000 (Thu, 29 Jan 2015) New Revision: 738 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/738 Log: Modification of oipf Factory to create non-visual object as singleton object and implementation of two test methods for SearchManagerObject and ChannelConfig Modified: oipf/js/impl/ChannelConfig.js oipf/js/impl/SearchManagerObject.js oipf/js/impl/VideoBroadcastObject.js oipf/js/lib/oipf_lib.js oipf/js/test/test.js oipf/view/welcome.html Modified: oipf/js/impl/ChannelConfig.js =================================================================== --- oipf/js/impl/ChannelConfig.js 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/js/impl/ChannelConfig.js 2015-01-29 10:08:37 UTC (rev 738) @@ -1,7 +1,122 @@ var ChannelConfig = Class.extend({ + + /* + * Description: + * The current channel of the OITF 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. + * In an OITF where exactly one video/broadcast object is in any state other than Unrealized and the + * channel being presented by that video/broadcast object is the only broadcast channel being presented by + * the OITF then changes to the channel presented by that video/broadcast object SHALL result in changes + * to the current channel of the OITF. + * In an OITF which is presenting more than one broadcast channel at the same time, the current channel of + * the OITF is the channel whose audio is being presented (as defined in the bindToCurrentChannel() + * method). If that current channel is under the control of a DAE application via a video/broadcast object + * then changes to the channel presented by that video/broadcast object SHALL result in changes to the + * current channel of the OITF. + * + * Visibility Type : readonly Channel + */ + currentChannel: null, + + /* + * Description: + * The list of channels. + * If an OITF includes a platform-specific application that enables the end-user to choose a channel to be + * presented from a list then all the channels in the list offered to the user by that application SHALL be + * included in this ChannelList. + * The list of channels will be a subset of all those available to the OITF. The precise algorithm by which this + * subset is selected will be market and/or implementation dependent. For example; + * • If an OITF with a DVB-T tuner receives multiple versions of the same channel, one would be + * included in the list and the duplicates discarded + * • An OITF with a DVB tuner will often filter services based on service type to discard those which are + * obviously inappropriate or impossible for that device to present to the end-user, e.g. firmware + * download services. + * The order of the channels in the list corresponds to the channel ordering as managed by the OITF. 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). + * The properties of channels making up the channel list SHALL be set by the OITF to the appropriate values + * as determined by the tables in section 8.4.3. The OITF SHALL store all these values as part of the channel + * list. + * Some values are set according to the data carried in the broadcast stream. In this case, the OITF MAY set + * these values to undefined until such time as the relevant data has been received by the OITF, for example + * after tuning to the channel. Once the data has been received, the OITF SHALL update the properties of the + * channel in the channel list according to the received data. + * Note: There is no requirement for the OITF to pro-actively tune to every channel to gather such data. + * + * Visibility Type : readonly ChannelList + */ + channelList: null, + + /* Visibility : readonly FavouriteListCollection + */ + favouriteLists: null, + + /* Visibility : readonly FavouriteList + */ + currentFavouriteList: null, + + /* + * \param Integer + * \param Interger + * \param Interger + * \param Interger + * \param Interger + * \param Interger + * \param Interger + * \param Interger + * \param Channel + */ + onChannelScan: function(scanEvent, progress, frequency, signalStrength, channelNumber, channelType, channelCount, transponderCount, newChannel) { + + }, + + init: function() { + }, + + /* + * Description: + * This function is the DOM 0 event handler for events relating to channel list updates. Upon receiving a + * ChannelListUpdate event, if an application has references to any Channel objects then it SHOULD + * dispose of them and rebuild its references. Where possible Channel objects are updated rather than + * removed, but their order in the ChannelConfig.all collection MAY have changed. Any lists created with + * ChannelConfig.createFilteredList() SHOULD be recreated in case channels have been removed. + */ + onChannelListUpdate: function() { - init : function(){ + } +}) + +// Used in the channelType property to indicate a TV channel. +channelConstants ={"TYPE_TV" : 0}; + +var Channel = Class.extend({ + + /* + * Description The type of channel. The value MAY be indicated by one of the TYPE_* constants defined above. If the + * type of the channel is unknown then the value SHALL be “ undefined ”. + * NOTE: Values of this type between 256 and 511 are reserved for use by related specifications on request by + * liaison. + * + * Visibility Type: readonly Integer + */ + channelType: null, + /* + * Description: + * The name of the channel. Can be used for linking analog channels without CNI. Typically, it will contain the + * call sign of the station (e.g. 'HBO'). + * + * + * Type: String + */ + name: null, + + + init: function(name , channelType) { + this.name = name; + this.channelType = channelConstants[channelType]; } + }) \ No newline at end of file Modified: oipf/js/impl/SearchManagerObject.js =================================================================== --- oipf/js/impl/SearchManagerObject.js 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/js/impl/SearchManagerObject.js 2015-01-29 10:08:37 UTC (rev 738) @@ -9,78 +9,66 @@ var SearchManagerObject = Class.extend({ - init : function (){ - - this.addEventListener("MetadataUpdate", onMetadataUpdate, false); - this.addEventListener("MetadataSearch", onMetadataSearch, false); - - }, - /* - * - * *\param Integer *\param Integer *\param Object */ - onMetadataUpdate : function (action, info, object){ - + onMetadataUpdate: function(action, info, object) { }, /* - * - * *\param MetadataSearch *\param Integer */ - onMetadataSearch : function (search, state){ + onMetadataSearch: function(search, state) { console.log("[INFO]: onMetadataSearch called", search); var message = ""; - switch(state){ + switch(state) { - case 0 : + case 0: console.log("RESULT FOUND :-) :-) :-) X-D"); console.log(getCurrentChannelProgramName(search.result[0])); break; - case 3 : + case 3: message = " MetadataSearch in Idle state because of either search abort or parameters have been modified \ (query, constraints or search target)"; break; - case 4 : + case 4: message = " The search cannot be complete because of lack of ressources or any other reason.\ (memory insufficient to cache all of the requested results.)"; break; - default : + default: console.log("Unknow state :("); } }, + init: function() { + + }, + /* - * - *\param Integer - *\return MetadataSearch + * \param Integer + * \return MetadataSearch */ - createSearch : function(searchTarget){ + createSearch: function(searchTarget) { }, /* - * - * - * *\return ChannelConfig */ - getChannelConfig : function (){ + getChannelConfig: function() { } @@ -92,26 +80,26 @@ * *\type SearchResults */ - result : null, + result: null, /* * *\type Integer * */ - searchTarget : null, + searchTarget: null, - init : function(){ + init: function() { }, /* - ** + * *\param Channel *\param Integer * */ - findProgrammesFromStream : function (channel, startTime){ + findProgrammesFromStream: function(channel, startTime) { console.log("[INFO]: findProgrammesFromStream [IN]"); console.log(channel); this.metaDataSearch.findProgrammesFromStream(channel, startTime); @@ -123,13 +111,13 @@ var SearchResults = Class.extend({ //Integer - lentgh : null, + lentgh: null, - offset : null, + offset: null, - totalSize : null, + totalSize: null, - init : function(){ + init: function() { }, @@ -140,12 +128,12 @@ * *\return Boolean always to false */ - getResults : function (offset, count){ + getResults: function(offset, count) { - + }, - abort : function (){ + abort: function() { }, @@ -155,7 +143,7 @@ * *\return Object Instance of Programme, CODAsset, CODFolder , or CODService */ - item : function (index){ + item: function(index) { } @@ -164,7 +152,7 @@ var Query = Class.extend({ - init : function(){ + init: function() { } Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/js/impl/VideoBroadcastObject.js 2015-01-29 10:08:37 UTC (rev 738) @@ -1,20 +1,20 @@ var VideoBroadcastObject = Class.extend({ //Default value - width : 200, + width: 200, //Default value - heigth : 200, + heigth: 200, - playstate : 0, + playstate: 0, //Read only Stringcollection - playerCapabilities : null, + playerCapabilities: null, // Read only Integer - allocationMethod : null, + allocationMethod: null, - init : function(){ + init: function() { console.log("[INFO] constructor of VideoBroadcast class called."); }, @@ -24,7 +24,7 @@ *\param Number errorState * */ - onChannelChangeError : function(channel, errorState ){ + onChannelChangeError: function(channel, errorState) { }, @@ -34,7 +34,7 @@ *\param Number errorState * */ - onPlayStateChange : function(state, error ){ + onPlayStateChange: function(state, error) { }, @@ -43,19 +43,19 @@ *\param Channel channel * */ - onChannelChangeSucceeded : function(channel ){ + onChannelChangeSucceeded: function(channel) { }, - onFullScreenChange : function(){ + onFullScreenChange: function() { }, - onfocus : function(){ + onfocus: function() { }, - onblur : function(){ + onblur: function() { }, @@ -64,12 +64,12 @@ *\retunr ChannelConfig retrieve configuration information on list * channels avialable * */ - getChannelConfig : function() { + getChannelConfig: function() { }, //Channel - bindToCurrentChannel : function() { + bindToCurrentChannel: function() { }, @@ -81,7 +81,7 @@ * *\return Channel */ - createChannelObject : function(idType, dsd, sid ){ + createChannelObject: function(idType, dsd, sid) { }, @@ -96,7 +96,7 @@ * *\return Channel */ - createChannelObject : function(idType, onid, tsid, sid, sourceID, ipBroadcastID){ + createChannelObject: function(idType, onid, tsid, sid, sourceID, ipBroadcastID) { }, @@ -108,17 +108,17 @@ * * */ - setChannel : function(channel, trickplay, - contentAccessDescriptorURL){ + setChannel: function(channel, trickplay, + contentAccessDescriptorURL) { }, - prevChannel : function() { + prevChannel: function() { }, - nextChannel : function() { + nextChannel: function() { }, @@ -128,7 +128,7 @@ *\param Boolean * */ - setFullScreen : function(fullscreen){ + setFullScreen: function(fullscreen) { }, @@ -137,7 +137,7 @@ *\param Integer Between 0 and 100 *\return Boolean */ - setVolume : function(volume) { + setVolume: function(volume) { }, @@ -145,17 +145,17 @@ * *return Integer */ - getVolume : function() { + getVolume: function() { }, - release : function() { + release: function() { }, - stop : function() { + stop: function() { } Modified: oipf/js/lib/oipf_lib.js =================================================================== --- oipf/js/lib/oipf_lib.js 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/js/lib/oipf_lib.js 2015-01-29 10:08:37 UTC (rev 738) @@ -88588,7 +88588,7 @@ "-channel": "TMC1.kazer.org", "title": "Arabesque", "sub-title": "Mort le dimanche", - "desc": "Jessica et Grady visitent la propriété de Christopher Bundy, un homme d'affaires impitoyable. Celui-ci a récemment investi une maigre part de son immense fortune dans l'acquisition d'un magazine littéraire. Peu après, Bundy est retrouvé assassiné. Son ennemi de toujours fait aussitôt figure de principal suspect, mais la version des faits avancée par Jessica est tout autre... ", + "desc": "Jessica et Grady visitent la propriété de Christopher Bundy, un homme d'affaires impitoyable. Celui-ci a récemment investi une maigre part de son \ immense fortune dans l'acquisition d'un magazine littéraire. Peu après, Bundy est retrouvé assassiné. Son ennemi de toujours fait aussitôt figure de principal suspect,\ mais la version des faits avancée par Jessica est tout autre... ", "credits": { "director": "Peter Crane", "actor": [ @@ -95060,8 +95060,27 @@ } } -var video_broadcast_dae_mime_type = "video/broadcast"; +var channelConfig_type = "channelCongig"; //Not a DAE MIME Type +var videoBroadcast_dae_mime_type = "video/broadcast"; +var notifSocket_dae_mime_type = "application/notifsocket"; +var applicationManager_dae_mime_type = "application/oipfApplicationManager"; +var capabilities_dae_mime_type = "application/oipfCapabilities"; +var codManager_dae_mime_type = "application/oipfCodManager"; +var configuration_dae_mime_type = "application/oipfConfiguration"; +var downloadManager_dae_mime_type = "application/oipfDownloadManager"; +var downloadTrigger_dae_mime_type = "application/oipfDownloadTrigger"; +var drmAgent_dae_mime_type = "application/oipfDrmAgent"; +var gatewayInfo_dae_mime_type = "application/oipfGatewayInfo"; +var communicationServices_dae_mime_type = "application/oipfCommunicationServices"; +var mdtf_dae_mime_type = "application/oipfMDTF"; +var parentalControlManager_dae_mime_type = "application/oipfParentalControlManager"; +var recordingScheduler_dae_mime_type = "application/oipfRecordingScheduler"; +var remoteControlFunction_dae_mime_type = "application/oipfRemoteControlFunction"; +var remoteManagement_dae_mime_type = "application/oipfRemoteManagement"; +var searchManager_dae_mime_type = "application/oipfSearchManager"; +var statusView_dae_mime_type = "application/oipfStatusView"; + var Class = new Function(); Function.prototype.extend = function(proto) { @@ -95084,20 +95103,17 @@ */ var OipfObjectFactory = Class.extend({ - - - init : function(listObjects) { + init: function() { console.log("[INFO] constructor of OipfObjectFactory class called."); - this.listObjects = listObjects; }, - listObjects : null, + listObjects: {}, /*! * \class * \brief */ - isObjectSupported : function(mimeType) { + isObjectSupported: function(mimeType) { }, @@ -95106,18 +95122,21 @@ * \brief * \return */ - createVideoBroadcastObject : function() { + createVideoBroadcastObject: function() { + console.log("[INFO] createVideoBroadcastObject() of OipfObjectFactory class called."); - return this.listObjects[video_broadcast_dae_mime_type]; + return new VideoBroadcastObject(); + }, /*! * \class * \brief */ - createSearchManagerObject : function() { + createSearchManagerObject: function() { - + console.log("[INFO] createSearchManagerObject() of OipfObjectFactory class called."); + return this.verifOipfObjectExisting(searchManager_dae_mime_type); }, @@ -95125,136 +95144,269 @@ * \class * \brief */ - createApplicationManagerObject : function() { - + createApplicationManagerObject: function() { + + console.log("[INFO] createApplicationManagerObject() of OipfObjectFactory class called."); + return this.verifOipfObjectExisting(applicationManager_dae_mime_type); }, /*! * \class * \brief */ - createCapabilitiesObject : function() { - + createCapabilitiesObject: function() { + + console.log("[INFO] createCapabilitiesObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(capabilities_dae_mime_type); }, /*! * \class * \brief */ - createChannelConfig : function() { - + createChannelConfig: function() { + + console.log("[INFO] createChannelConfigObject() of OipfObjectFactory class called."); + return this.verifOipfObjectExisting(channelConfig_type); }, /*! * \class * \brief */ - createCodManagerObject : function() { + createCodManagerObject: function() { + console.log("[INFO] createCodManagerObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(codManager_dae_mime_type); }, /*! * \class * \brief */ - createConfigurationObject : function() { + createConfigurationObject: function() { + console.log("[INFO] createConfigurationObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(configuration_dae_mime_type); }, /*! * \class * \brief */ - createDownloadManagerObject : function() { + createDownloadManagerObject: function() { + console.log("[INFO] createDownloadManagerObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(downloadManager_dae_mime_type); }, /*! * \class * \brief */ - createDownloadTriggerObject : function() { - + createDownloadTriggerObject: function() { + + console.log("[INFO] createDownloadTriggerObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(downloadTrigger_dae_mime_type); }, /*! * \class * \brief */ - createDrmAgentObject : function() { + createDrmAgentObject: function() { + console.log("[INFO] createDrmAgentObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(drmAgent_dae_mime_type); }, /*! * \class * \brief */ - createGatewayInfoObject : function() { + createGatewayInfoObject: function() { + console.log("[INFO] createGatewayInfoObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(gatewayInfo_dae_mime_type); }, /*! * \class * \brief */ - createIMSObject : function() { - + createIMSObject: function() { + + console.log("[INFO] createIMSObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(ims_dae_mime_type); }, /*! * \class * \brief */ - createMDTFObject : function() { + createMDTFObject: function() { + console.log("[INFO] createMDTFObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(mdtf_dae_mime_type); }, /*! * \class * \brief */ - createNotifSocketObject : function() { + createNotifSocketObject: function() { + console.log("[INFO] createNotifSocketObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(notifSocket_dae_mime_type); }, /*! * \class * \brief */ - createParentalControlManagerObject : function() { + createParentalControlManagerObject: function() { + console.log("[INFO] createParentalControlManangerObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(parentalControlManager_dae_mime_type); }, /*! * \class * \brief */ - createRecordingSchedulerObject : function() { + createRecordingSchedulerObject: function() { + console.log("[INFO] createRecordingSchedulerObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(recordingScheduler_dae_mime_type); }, /*! * \class * \brief */ - createRemoteControlFunctionObject : function(){ + createRemoteControlFunctionObject: function() { + console.log("[INFO] createRemoteControlFunctionObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(remoteControlFunction_dae_mime_type); }, /*! * \class * \brief */ - createRemoteManagementObject : function(){ + createRemoteManagementObject: function() { - }, + console.log("[INFO] createRemoteManagementObject() of OipfObjectFactory class called."); + return verifOipfObjectExisting(remoteManagement_dae_mime_type); + }, - /*! - * \method - * \brief - * \return - */ - createSearchManagerObject : function() { + createStatusViewObject(): function() { + + console.log("[INFO] createStatusViewObject() of OipfObjectFactory class called."); + return new StatusViewObject(); + + }, + + createVideoMpegObject(): function() { + + console.log("[INFO] createStatusViewObject() of OipfObjectFactory class called."); + return new VideoMpegObject(); + + }, + + verifOipfObjectExisting: function(mimeType) { + + var currentObject = this.listObjects[mimeType]; - } -}) \ No newline at end of file + if(!currentObject){ + + switch(mimeType){ + + case searchManager_dae_mime_type : + currentObject = new SearchManagerObject(); + break; + + case notifSocket_dae_mime_type : + currentObject = new NotifSocketObject(); + break; + + case applicationManager_dae_mime_type : + currentObject = new ApplicationManagerObject(); + break; + + case capabilities_dae_mime_type : + currentObject = new CapabilitiesObject(); + break; + + case codManager_dae_mime_type : + currentObject = new CodManagerObject(); + break; + + case configuration_dae_mime_type : + currentObject = new ConfigurationObject(); + break; + + case downloadManager_dae_mime_type : + currentObject = new DownloadManagerObject(); + break; + + case downloadTrigger_dae_mime_type : + currentObject = new DownloadTriggerObject(); + break; + + case drmAgent_dae_mime_type : + currentObject = new DrmAgentObject(); + break; + + case gatewayInfo_dae_mime_type : + currentObject = new GatewayInfoObject(); + break; + + case communicationServices_dae_mime_type : + currentObject = new CommunicationServicesObject(); + break; + + case mdtf_dae_mime_type : + currentObject = new MDTFObject(); + break; + + case parentalControlManager_dae_mime_type : + currentObject = new ParentalControlManagerObject(); + break; + + case recordingScheduler_dae_mime_type : + currentObject = new RecordingSchedulerObject(); + break; + + case remoteControlFunction_dae_mime_type : + currentObject = new RemoteControlFunctionObject(); + break; + + case remoteManagement_dae_mime_type : + currentObject = new RemoteManagementObject(); + break; + + case searchManager_dae_mime_type : + currentObject = new SearchManagerObject(); + break; + + case channelConfig_type: + currentObject = new ChannelConfig(); + break; + + default: + console.log("[Info][ERROR] : This mime-type: "+ mimeType +" not exist!!!"); + return undefined; + } + + + this.listObjects[mimeType] = currentObject; + } + + return this.listObjects[mimeType]; + + } + +}) + + \ No newline at end of file Modified: oipf/js/test/test.js =================================================================== --- oipf/js/test/test.js 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/js/test/test.js 2015-01-29 10:08:37 UTC (rev 738) @@ -1,6 +1,40 @@ -function testCreatingVidBroadOject(){ - console.log("[TEST-RUNNING][Info]Creating of video/brodacast oipf object."); - var videoBroadcastObject=oipfObjectFactory.createVideoBroadcastObject(); +function testCreatingVidBroadObj(){ + console.log("[TEST-RUNNING][Info] Creating of video/brodacast oipf object."); + + videoBroadcastObject=oipfObjectFactory.createVideoBroadcastObject(); console.assert(videoBroadcastObject!=null,"The object video/broadcast is null."); + console.log("[TEST-RUNNING][Result] Creating of video/brodacast oipf object [SUCESSFULL]."); +} + +function testCreatingSearchManagerObj(){ + + console.log("[TEST-RUNNING][Info] Creating of searchManager oipf object."); + + searchManagerObject=oipfObjectFactory.createSearchManagerObject(); + console.assert(searchManagerObject!=null,"The object searchManager is null."); + + console.log("[TEST-RUNNING][Result] Creating of searchManager oipf object [SUCESSFULL]."); + +} + +function testCreatingChannelConfigObj(){ + + console.log("[TEST-RUNNING][Info] Creating of channelConfig oipf object."); + currentChannelType = "TYPE_TV"; + currentChannelName = "ARTE"; + + currentchannel = new Channel(currentChannelName, currentChannelType); + console.assert(currentchannel != null,"The object currentChannel is null."); + console.assert(currentchannel.name == currentChannelName, "The current channel name don't match the affected name previously."); + console.assert(currentchannel.channelType == channelConstants[currentChannelType], "The current channel type don't match the affected type previously."); + + channelConfigObject=oipfObjectFactory.createChannelConfig(); + console.assert(channelConfigObject!=null,"The object channelConfig is null."); + + channelConfigObject.currentChannel = currentchannel; + console.assert(channelConfigObject.currentChannel == currentchannel, "Unconsistency about the current channel."); + + console.log("[TEST-RUNNING][Result] Creating of channelConfig oipf object [SUCESSFULL]."); + } \ No newline at end of file Modified: oipf/view/welcome.html =================================================================== --- oipf/view/welcome.html 2015-01-28 10:50:24 UTC (rev 737) +++ oipf/view/welcome.html 2015-01-29 10:08:37 UTC (rev 738) @@ -5,15 +5,19 @@ </head> <body> <script src="../js/lib/oipf_lib.js" type="text/javascript"></script> + <script src="../js/impl/ChannelConfig.js" type="text/javascript"></script> <script src="../js/impl/VideoBroadcastObject.js" type="text/javascript"></script> + <script src="../js/impl/SearchManagerObject.js" type="text/javascript"></script> <script src="../js/test/test.js" type="text/javascript"></script> <script> - var videoBroadcastObject = new VideoBroadcastObject(); - var listObjects = {"video/broadcast" : videoBroadcastObject}; - var oipfObjectFactory = new OipfObjectFactory(listObjects); + //////////////////////////Before Test///////////////// + var oipfObjectFactory = new OipfObjectFactory(); + ///////////Run Test/////////// - testCreatingVidBroadOject(); + testCreatingVidBroadObj(); + testCreatingSearchManagerObj(); + testCreatingChannelConfigObj(); </script> </body>
participants (1)
-
ygrego@users.nuiton.org