Author: ygrego Date: 2015-05-18 14:25:36 +0000 (Mon, 18 May 2015) New Revision: 1375 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1375 Log: Addition of method "setParentalControlStatus" and property "_parentalControlStatus " which is initialized in constructor. Modified: oipf/js/impl/ParentalControlManagerObject.js Modified: oipf/js/impl/ParentalControlManagerObject.js =================================================================== --- oipf/js/impl/ParentalControlManagerObject.js 2015-05-18 14:00:18 UTC (rev 1374) +++ oipf/js/impl/ParentalControlManagerObject.js 2015-05-18 14:25:36 UTC (rev 1375) @@ -38,6 +38,13 @@ _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. @@ -48,6 +55,7 @@ this.isPINEntryLocked = false; this._blockUnrated = false; + this._parentalControlStatus = true; this._currentPIN = "1234"; this._invalidPINAttemptsMax = 4; @@ -60,6 +68,58 @@ }, /* + * 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. + * 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 + * pcPIN argument). The return value indicates the success of the operation, + * and SHALL take one of the following values: + * ------------------------------------------------------------------------ + * Value | Description + * ------ ----------------------------------------------------------------- + * 0 | The PIN is correct. + * ------ ----------------------------------------------------------------- + * 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 + * | is locked is outside the scope of this specification. + * ------ ----------------------------------------------------------------- + * + * Arguments: + * - pcPIN: The parental control PIN. + * + * - enable: Flag indicating whether parental control should be enabled. + * + * Return: Integer + */ + setParentalControlStatus: function(pcPIN, enable) { + if (this._currentPIN == pcPIN) { + this._parentalControlStatus = enable; + return this._PIN_CORRECT; + } + this._currentInvalidPINAttempts++; + + if (this._currentInvalidPINAttempts > this._invalidPINAttemptsMax) { + this._lockPINEntry(); + return this._PIN_LOCKED; + } + + return this._PIN_INCORRECT; + }, + + /* * Description: * Set the parental control PIN. This operation SHALL be protected by the * parental control PIN (if PIN entry is enabled). The return value @@ -160,7 +220,7 @@ return this._PIN_INCORRECT; }, - + /* * Description: * Returns a flag indicating whether or not the OITF has been configured bythe user to block content for which a parental rating is absent.