radioengine/utils/src/cradiopropertyobserver.cpp
changeset 28 075425b8d9a4
parent 13 46974bebc798
equal deleted inserted replaced
24:6df133bd92e1 28:075425b8d9a4
    33     , iObserver( aObserver )
    33     , iObserver( aObserver )
    34     , iCategory( aCategory )
    34     , iCategory( aCategory )
    35     , iKey( aKey )
    35     , iKey( aKey )
    36     , iPropertyType( aPropertyType )
    36     , iPropertyType( aPropertyType )
    37     {
    37     {
       
    38     LEVEL3( LOG_METHOD_AUTO );
    38     }
    39     }
    39 
    40 
    40 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    41 //
    42 //
    42 // -----------------------------------------------------------------------------
    43 // -----------------------------------------------------------------------------
    43 //
    44 //
    44 void CRadioPropertyObserver::ConstructL()
    45 void CRadioPropertyObserver::ConstructL()
    45     {
    46     {
       
    47     LEVEL3( LOG_METHOD_AUTO );
    46     switch ( iPropertyType )
    48     switch ( iPropertyType )
    47         {
    49         {
    48         case ERadioPropertyInt:
    50         case ERadioPropertyInt:
    49             {
    51             {
    50             break;
    52             break;
    77 EXPORT_C CRadioPropertyObserver* CRadioPropertyObserver::NewL( MRadioPropertyChangeObserver& aObserver,
    79 EXPORT_C CRadioPropertyObserver* CRadioPropertyObserver::NewL( MRadioPropertyChangeObserver& aObserver,
    78                                                                const TUid& aCategory,
    80                                                                const TUid& aCategory,
    79                                                                const TUint aKey,
    81                                                                const TUint aKey,
    80                                                                const TRadioPropertyType aPropertyType )
    82                                                                const TRadioPropertyType aPropertyType )
    81     {
    83     {
       
    84     LEVEL3( LOG_METHOD_AUTO );
    82     CRadioPropertyObserver* self = new( ELeave )CRadioPropertyObserver( aObserver,
    85     CRadioPropertyObserver* self = new( ELeave )CRadioPropertyObserver( aObserver,
    83                                             aCategory, aKey, aPropertyType );
    86                                             aCategory, aKey, aPropertyType );
    84     CleanupStack::PushL( self );
    87     CleanupStack::PushL( self );
    85     self->ConstructL();
    88     self->ConstructL();
    86     CleanupStack::Pop( self );
    89     CleanupStack::Pop( self );
    91 //
    94 //
    92 // -----------------------------------------------------------------------------
    95 // -----------------------------------------------------------------------------
    93 //
    96 //
    94 CRadioPropertyObserver::~CRadioPropertyObserver()
    97 CRadioPropertyObserver::~CRadioPropertyObserver()
    95     {
    98     {
       
    99     LEVEL3( LOG_METHOD_AUTO );
    96     Cancel();
   100     Cancel();
    97     iProperty.Close();
   101     iProperty.Close();
    98     delete iValueByteArray;
   102     delete iValueByteArray;
    99     delete iValueText;
   103     delete iValueText;
   100     }
   104     }
   103 // Subscribes to a property and reads the value, if not already active.
   107 // Subscribes to a property and reads the value, if not already active.
   104 // ---------------------------------------------------------------------------
   108 // ---------------------------------------------------------------------------
   105 //
   109 //
   106 EXPORT_C void CRadioPropertyObserver::ActivateL()
   110 EXPORT_C void CRadioPropertyObserver::ActivateL()
   107     {
   111     {
       
   112     LEVEL3( LOG_METHOD_AUTO );
   108     if ( !IsActive() )
   113     if ( !IsActive() )
   109         {
   114         {
   110         RunL();
   115         RunL();
   111         }
   116         }
   112     }
   117     }
   115 //
   120 //
   116 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   117 //
   122 //
   118 void CRadioPropertyObserver::RunL()
   123 void CRadioPropertyObserver::RunL()
   119     {
   124     {
   120     LOG_METHOD_AUTO;
   125     LEVEL3( LOG_METHOD_AUTO );
   121 
   126 
   122     iProperty.Subscribe( iStatus );
   127     iProperty.Subscribe( iStatus );
   123     SetActive();
   128     SetActive();
   124 
   129 
   125     TInt err( KErrNone );
   130     TInt err( KErrNone );
   171 // Cancels an outstanding active request
   176 // Cancels an outstanding active request
   172 // -----------------------------------------------------------------------------
   177 // -----------------------------------------------------------------------------
   173 //
   178 //
   174 void CRadioPropertyObserver::DoCancel()
   179 void CRadioPropertyObserver::DoCancel()
   175     {
   180     {
       
   181     LEVEL3( LOG_METHOD_AUTO );
   176     iProperty.Cancel();
   182     iProperty.Cancel();
   177     }
   183     }
   178 
   184 
   179 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   180 // Getter for integer value
   186 // Getter for integer value
   181 // -----------------------------------------------------------------------------
   187 // -----------------------------------------------------------------------------
   182 //
   188 //
   183 EXPORT_C TInt CRadioPropertyObserver::ValueInt() const
   189 EXPORT_C TInt CRadioPropertyObserver::ValueInt() const
   184     {
   190     {
       
   191     LEVEL3( LOG_METHOD_AUTO );
   185     return iValueInt;
   192     return iValueInt;
   186     }
   193     }
   187 
   194 
   188 // -----------------------------------------------------------------------------
   195 // -----------------------------------------------------------------------------
   189 // Getter for byte array value
   196 // Getter for byte array value
   190 // -----------------------------------------------------------------------------
   197 // -----------------------------------------------------------------------------
   191 //
   198 //
   192 EXPORT_C const TDesC8& CRadioPropertyObserver::ValueDes8() const
   199 EXPORT_C const TDesC8& CRadioPropertyObserver::ValueDes8() const
   193     {
   200     {
       
   201     LEVEL3( LOG_METHOD_AUTO );
   194     return *iValueByteArray;
   202     return *iValueByteArray;
   195     }
   203     }
   196 
   204 
   197 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   198 // Getter for text value
   206 // Getter for text value
   199 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   200 //
   208 //
   201 EXPORT_C const TDesC& CRadioPropertyObserver::ValueDes() const
   209 EXPORT_C const TDesC& CRadioPropertyObserver::ValueDes() const
   202     {
   210     {
       
   211     LEVEL3( LOG_METHOD_AUTO );
   203     return *iValueText;
   212     return *iValueText;
   204     }
   213     }