epoc-music.hpp

Go to the documentation of this file.
00001 /*
00002  !concept {:name => "Tracking music playback on Symbian",
00003    :desc => "Receiving events from the Music player on Symbian."}
00004 */
00005 
00006 #ifndef __epoc_music_hpp__
00007 #define __epoc_music_hpp__
00008 
00009 #include "application_config.h"
00010 
00011 #if __MUSIC_ENABLED__
00012 
00013 #include "ac_app_context.h"
00014 #include "ld_log_db.h"
00015 #include "utils_cl2.h"
00016 
00017 // Plug-in APIs.
00018 #if __HAVE__MPLAYERREMOTECONTROL__
00019 // http://wiki.forum.nokia.com/index.php/Music_Player_Remote_Control_API
00020 // http://wiki.forum.nokia.com/index.php/KIS001005_-_Music_Player_Remote_Control_API_does_not_work_in_all_S60_3rd_Edition%2C_FP1_and_FP2_devices
00021 #include <mplayerremotecontrol.h>
00022 #include <mplayerconstants.h>
00023 #elif __HAVE_MPXPLAYBACKUTILITY__
00024 // MPX Playback Utility API http://wiki.forum.nokia.com/index.php/TSS001652_-_Using_MPX_Playback_Utility_API
00025 #include <mpxplaybackutility.h>
00026 #include <mpxplaybackobserver.h>
00027 #endif
00028 
00029 #include <e32std.h>
00030 
00031 class MyTrackInfo;
00032 
00033 NONSHARABLE_CLASS(CSensor_music) :
00034   public CBase,
00035   public MMPXPlaybackObserver,
00036   public MMPXPlaybackCallback
00037 {
00038  public: 
00039   static CSensor_music* NewLC(ac_AppContext* aAppContext);
00040   static CSensor_music* NewL(ac_AppContext* aAppContext);
00041   virtual ~CSensor_music();
00042 
00043  private:
00044   CSensor_music(ac_AppContext* aAppContext);
00045   void ConstructL();
00046 
00047  private:
00048   ac_AppContext* iAppContext; // not owned
00049   MMPXPlaybackUtility* iPlaybackUtility; // owned
00050   MyTrackInfo* iOldTrackInfo; // owned
00051   MyTrackInfo* iTrackInfo; // owned
00052   TInt iOldPbState;
00053 
00054  private:
00055   LogDb* GetLogDb() const { return ac_LogDb(iAppContext); }
00056 
00057   void CloseSession();
00058 
00059   void RequestMediaL();
00060 
00061  private: // MMPXPlaybackObserver
00062   virtual void HandlePlaybackMessage(CMPXMessage* aMsg, TInt errCode);
00063 
00064  private: // MMPXPlaybackCallback
00065   virtual void HandlePropertyL(TMPXPlaybackProperty aProperty,
00066              TInt aValue, 
00067              TInt aError) {}
00068     
00069   virtual void HandleSubPlayerNamesL(TUid aPlayer, 
00070              const MDesCArray* aSubPlayers,
00071              TBool aComplete,
00072              TInt aError) {}
00073     
00074   virtual void HandleMediaL(const CMPXMedia& aProperties,
00075           TInt aError);
00076 
00077 };
00078 
00079 #endif // __MUSIC_ENABLED__
00080 
00081 // --------------------------------------------------
00082 // sensor array integration
00083 // --------------------------------------------------
00084 
00085 #if defined(SA_ARRAY_INTEGRATION)
00086 #if __MUSIC_ENABLED__
00087 #define DECLARE_SENSOR_music CSensor_music* iSensor_music
00088 #define SENSOR_MUSIC_DESTROY DELETE_Z(self->iSensor_music)
00089 #define SENSOR_MUSIC_CREATE 
00090 #define SENSOR_MUSIC_START sa_typical_symbian_sensor_create(self->iSensor_music = CSensor_music::NewL(self->ac), "music sensor initialization")
00091 #define SENSOR_MUSIC_STOP SENSOR_MUSIC_DESTROY
00092 #define SENSOR_MUSIC_IS_RUNNING (self->iSensor_music != NULL)
00093 #define SENSOR_MUSIC_RECONFIGURE(key, value) sa_reconfigure_ignore_all_keys
00094 #else
00095 #define DECLARE_SENSOR_music
00096 #endif
00097 #endif /* SA_ARRAY_INTEGRATION */
00098 
00099 #endif /* __epoc_music_hpp__ */
00100 
00101 /**
00102 
00103 epoc-music.hpp
00104 
00105 Copyright 2009-2011 Helsinki Institute for Information Technology
00106 (HIIT) and the authors. All rights reserved.
00107 
00108 Authors: Tero Hasu <tero.hasu@hut.fi>
00109 
00110 Permission is hereby granted, free of charge, to any person
00111 obtaining a copy of this software and associated documentation files
00112 (the "Software"), to deal in the Software without restriction,
00113 including without limitation the rights to use, copy, modify, merge,
00114 publish, distribute, sublicense, and/or sell copies of the Software,
00115 and to permit persons to whom the Software is furnished to do so,
00116 subject to the following conditions:
00117 
00118 The above copyright notice and this permission notice shall be
00119 included in all copies or substantial portions of the Software.
00120 
00121 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00122 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00123 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00124 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
00125 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00126 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00127 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00128 SOFTWARE.
00129 
00130  **/

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1