mmserv/radioutility/fmpresetutility/src/RadioFmPresetUtilityBody.h
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This class provides an interface for controlling the presets
       
    15 *                for an FM tuner.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20  
       
    21 
       
    22 #ifndef C_RADIOFMPRESETUTILITYBODY_H
       
    23 #define C_RADIOFMPRESETUTILITYBODY_H
       
    24 
       
    25 #include <RadioPresetUtility.h>
       
    26 #include <RadioFmPresetUtility.h>
       
    27 #include "RadioFmPresetRadioSettings.h"
       
    28 #include "RadioFmPresetCentralRepositoryHandler.h"
       
    29 #include <e32base.h> 
       
    30 
       
    31 const TInt KDefaultRadioFrequency = 87500000;
       
    32 const TInt KMaxNumberOfPresetStations = 100;
       
    33 const TUint KDefaultRadioPTY = 0;
       
    34 const TUint KDefaultRadioPI = 0;
       
    35 
       
    36 /**
       
    37  *  This class provides an interface for controlling the preset for an FM tuner.
       
    38  *  The maximum number of presets supported by this utility is pre-defined and the
       
    39  *  client must first query it.
       
    40  *
       
    41  *  @lib RadioPresetUtility.lib
       
    42  *  @since S60 3.2
       
    43  */
       
    44 class CRadioFmPresetUtility::CBody : public CBase,
       
    45                               public MRadioPreset,
       
    46                               public MRadioFmPreset
       
    47     {
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Factory function to create a new instance of the FM tuner.
       
    52      *
       
    53      * @since S60 3.2
       
    54      * @param aObserver The observer object
       
    55      * @return A new FM tuner utility object.
       
    56      */
       
    57     static CBody* NewL( MRadioPresetObserver& aObserver );
       
    58 
       
    59     ~CBody();
       
    60     
       
    61 	// from base class MRadioFmPreset
       
    62 
       
    63      /**
       
    64       * From MRadioFmPresetUtility
       
    65       * Set the preset with specified frequency and name. Previous content in the specified index
       
    66       * will be overwritten with the new information.
       
    67       *
       
    68       * The maximum length for the preset name is 32 characters. Names longer than 32 characters
       
    69       * will be truncated.
       
    70       *
       
    71       * @since S60 3.2
       
    72       * @param aIndex A preset index.
       
    73       * @param aName Preset name.
       
    74       * @param aFrequency Frequency in Hz.
       
    75       */
       
    76      void SetPresetL( TInt aIndex, const TFmPresetName& aName, TInt aFrequency );
       
    77 
       
    78      /**
       
    79       * From MRadioFmPresetUtility
       
    80       * Set the preset with specified URL. Previous content in the specified index
       
    81       * will be overwritten with the new information.
       
    82       *
       
    83       * The maximum length for the preset URL is 64 characters. URLs longer than 32 characters
       
    84       * will be truncated.
       
    85       *
       
    86       * @since S60 5.2
       
    87       * @param aIndex A preset index.
       
    88       * @param aUrl Preset URL.
       
    89       */     
       
    90      void SetPresetUrlL( TInt aIndex, const TFmPresetUrl& aUrl );
       
    91  
       
    92      /**
       
    93       * From MRadioFmPresetUtility
       
    94       * Set the preset with specified PTY. Previous content in the specified index
       
    95       * will be overwritten with the new information.
       
    96       *
       
    97       * @since S60 5.2
       
    98       * @param aIndex A preset index.
       
    99       * @param aPty Preset PTY (programme type).
       
   100       */
       
   101      void SetPresetPtyL( TInt aIndex, TUint aPty );
       
   102 
       
   103      /**
       
   104       * From MRadioFmPresetUtility
       
   105       * Set the preset with specified PI code. Previous content in the specified index
       
   106       * will be overwritten with the new information.
       
   107       *
       
   108       * @since S60 5.2
       
   109       * @param aIndex A preset index.
       
   110       * @param aPICode Preset PI (programme identification).
       
   111       */
       
   112      void SetPresetPICodeL( TInt aIndex, TUint aPICode );
       
   113 
       
   114      /**
       
   115       * From MRadioFmPresetUtility
       
   116       * Set the preset with specified favourite information. Previous content in the specified index
       
   117       * will be overwritten with the new information.
       
   118       *
       
   119       * @since S60 5.2
       
   120       * @param aIndex A preset index.
       
   121       * @param aFavourite Preset favourite info.
       
   122       */     
       
   123      void SetPresetFavouriteInfoL( TInt aIndex, TBool aFavourite );
       
   124 
       
   125      /**
       
   126       * From MRadioFmPresetUtility
       
   127       * Set the preset with specified user rename information. Previous content in the specified index
       
   128       * will be overwritten with the new information.
       
   129       *
       
   130       * @since S60 5.2
       
   131       * @param aIndex A preset index.
       
   132       * @param aRename Preset user rename info.
       
   133       */     
       
   134      void SetPresetUserRenameInfoL( TInt aIndex, TBool aRename );
       
   135 
       
   136      /**
       
   137       * From MRadioFmPreset
       
   138       * Get the preset name and frequency at the specified index.
       
   139       * Leaves with KErrNotFound if invalid index is specified.
       
   140       *
       
   141       * Preset name is maximum of 32 characters. Client must allocate buffer big
       
   142       * enough to hold the 32 characters. If not, characters will be truncated to fit the
       
   143       * buffer.
       
   144       *
       
   145       * @since S60 3.2
       
   146       * @param aIndex A preset index.
       
   147       * @param aFrequency On return, contains the preset name.
       
   148       * @param Frequency On return, contains frequency in Hz.
       
   149       */
       
   150      void GetPresetL( TInt aIndex, TFmPresetName& aName, TInt& aFrequency );
       
   151 
       
   152      /**
       
   153       * From MRadioFmPreset      
       
   154       * Get the preset name at the specified index.
       
   155       * Leaves with KErrNotFound if invalid index is specified.
       
   156       *
       
   157       * Preset name is maximum of 32 characters. Client must allocate buffer big
       
   158       * enough to hold the 32 characters. If not, characters will be truncated to fit the
       
   159       * buffer.
       
   160       *
       
   161       * @since S60 5.1
       
   162       * @param aIndex A preset index.
       
   163       * @param aName On return, contains the preset name.
       
   164       */
       
   165      void GetPresetNameL( TInt aIndex, TFmPresetName& aName );
       
   166 
       
   167      /**
       
   168       * From MRadioFmPresetUtility      
       
   169       * Get the preset URL at the specified index.
       
   170       * Leaves with KErrNotFound if invalid index is specified.
       
   171       *
       
   172       * Preset URL is maximum of 64 characters. Client must allocate buffer big
       
   173       * enough to hold the 64 characters. If not, characters will be truncated to fit the
       
   174       * buffer.
       
   175       *
       
   176       * @since S60 5.2
       
   177       * @param aIndex A preset index.
       
   178       * @param aUrl On return, contains the preset name.
       
   179       */
       
   180      void GetPresetUrlL( TInt aIndex, TFmPresetUrl& aUrl );
       
   181 
       
   182      /**
       
   183       * From MRadioFmPresetUtility
       
   184       * Get the preset PTY (programme type) at the specified index.
       
   185       * Leaves with KErrNotFound if invalid index is specified.
       
   186       *
       
   187       * @since S60 5.2
       
   188       * @param aIndex A preset index.
       
   189       * @param aPty On return, contains the preset PTY.
       
   190       */
       
   191      void GetPresetPtyL( TInt aIndex, TUint& aPty );
       
   192      
       
   193      /**
       
   194       * From MRadioFmPresetUtility
       
   195       * Get the preset PI code (programme identification) at the specified index.
       
   196       * Leaves with KErrNotFound if invalid index is specified.
       
   197       *
       
   198       * @since S60 5.2
       
   199       * @param aIndex A preset index.
       
   200       * @param aPICode On return, contains the preset programme identification.
       
   201       */
       
   202      void GetPresetPICodeL( TInt aIndex, TUint& aPICode );
       
   203      
       
   204      /**
       
   205       * From MRadioFmPresetUtility
       
   206       * Get the preset favourite info at the specified index.
       
   207       * Leaves with KErrNotFound if invalid index is specified.
       
   208       *
       
   209       * @since S60 5.2
       
   210       * @param aIndex A preset index.
       
   211       * @param aFavourite On return, contains the preset favourite info.
       
   212       */
       
   213      void GetPresetFavouriteInfoL( TInt aIndex, TBool& aFavourite );
       
   214 
       
   215      /**
       
   216       * From MRadioFmPresetUtility
       
   217       * Get the preset user rename info at the specified index.
       
   218       * Leaves with KErrNotFound if invalid index is specified.
       
   219       *
       
   220       * @since S60 5.2
       
   221       * @param aIndex A preset index.
       
   222       * @param aRename On return, contains the preset rename info.
       
   223       */     
       
   224      void GetPresetUserRenameInfoL( TInt aIndex, TBool& aRename );
       
   225       
       
   226      /**
       
   227       * Get the preset frequency at the specified index.
       
   228       * Leaves with KErrNotFound if invalid index is specified.
       
   229       *
       
   230       * @since S60 5.1
       
   231       * @param aIndex A preset index.
       
   232       * @param aFrequency On return, contains the preset name.
       
   233       */
       
   234      void GetPresetFrequencyL( TInt aIndex, TInt& aFrequency );
       
   235 	       
       
   236 // from base class MRadioPreset
       
   237 
       
   238     /**
       
   239      * From MRadioPreset
       
   240      * Get the maximum number of presets supported by this utility.
       
   241      * The numbering of presets starts from 1 and the largest preset number equals the value
       
   242      * returned from this function.
       
   243      *
       
   244      * @since S60 3.2
       
   245      * @param aMaxNumOfPresets On return contains the maximum number of presets.
       
   246      * @return A standard system error code.
       
   247      */
       
   248      TInt GetMaxNumberOfPresets( TInt& aMaxNumOfPresets ) const;
       
   249 
       
   250     /**
       
   251      * From MRadioPreset
       
   252      * Get the number of presets already set by the client (i.e. contains data).
       
   253      *
       
   254      * @since S60 3.2
       
   255      * @param aNumOfPresets On return contains the current number of presets.
       
   256      * @return A standard system error code.
       
   257      */
       
   258      TInt GetNumberOfPresets( TInt& aNumOfPresets ) const;
       
   259 
       
   260     /**
       
   261      * From MRadioPreset
       
   262      * Get the first preset index that has been set.
       
   263      * Leaves with KErrNone if no preset exists.
       
   264      *
       
   265      * @since S60 3.2
       
   266      * @param aIndex On return contains the index of the first preset.
       
   267      */
       
   268      void GetFirstPresetL( TInt& aIndex ) const;
       
   269 
       
   270     /**
       
   271      * From MRadioPreset
       
   272      * Get the next preset index that has been set, given the current index.
       
   273      * Leaves with KErrNone if no other preset exists.
       
   274      *
       
   275      * @since S60 3.2
       
   276      * @param aIndex Current preset index.
       
   277      * @param aNextIndex On return contains the index of next preset.
       
   278      */
       
   279      void GetNextPresetL( TInt aIndex, TInt& aNextIndex ) const;
       
   280 
       
   281     /**
       
   282      * From MRadioPreset
       
   283      * Reset the specified preset.
       
   284      * Has not effect if specified index contains no preset.
       
   285      *
       
   286      * NOTE: Specifying aIndex == 0, will reset all presets.
       
   287      *
       
   288      * @since S60 3.2
       
   289      * @param aIndex A preset index.
       
   290      */
       
   291      void DeletePresetL( TInt aIndex );
       
   292 
       
   293 private:
       
   294     CBody();
       
   295     void ConstructL();
       
   296     
       
   297     
       
   298 private:
       
   299 
       
   300 	MRadioPresetObserver* 	iRadioPresetClient;
       
   301 	TRadioSettings*         iRadioSettings;
       
   302 	CCentralRepositoryHandler* iCentralRepositoryHandler;
       
   303 
       
   304     };
       
   305 
       
   306 #endif // C_RADIOFMPRESETUTILITY_H