×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    115

    Volume keys on symbian

    I should capture the volumeup and volumedown events in a qt program.

    I saw this document http://www.developer.nokia.com/Commu...ing_media_keys

    And I have make this object:

    cmediakeygest.h
    Code:
    #ifndef CMEDIAKEYGEST_H
    #define CMEDIAKEYGEST_H
    
    #include <remconcoreapitargetobserver.h>
    #include <remconcoreapitarget.h>
    #include <remconinterfaceselector.h>
    #include <mw/aknappui.h>
    
    #include <QObject>
    
    
    
    class CMediaKeygest:  public QObject, CAknAppUi,
            public MRemConCoreApiTargetObserver
    {
    
        Q_OBJECT
    
    public:
    
        CMediaKeygest(QObject *parent);
        void MrccatoCommand(TRemConCoreApiOperationId aOperationId,
                                TRemConCoreApiButtonAction aButtonAct);
    
    signals:
        void volumeupclicked();
        void volumedownclicked();
    
    private:
        CRemConInterfaceSelector* iInterfaceSelector;
        CRemConCoreApiTarget*     iCoreTarget;
    
    };
    
    #endif // CMEDIAKEYGEST_H
    cmediakeygest.cpp
    Code:
    #include "cmediakeygest.h"
    
    CMediaKeygest::CMediaKeygest(QObject *parent)
    {
        setParent(parent);
    
        iInterfaceSelector = CRemConInterfaceSelector::NewL();
        iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this);
        iInterfaceSelector->OpenTargetL();
    }
    
    
    void CMediaKeygest::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct)
    {
        TRequestStatus status;
    
        switch(aOperationId)
        {
        case ERemConCoreApiVolumeUp:
                 {
                 switch (aButtonAct)
                     {
                       case ERemConCoreApiButtonClick:
                             emit volumeupclicked();
                             break;
                       default:
                            break;
                     }
                 iCoreTarget->VolumeUpResponse(status, KErrNone);
                 User::WaitForRequest(status);
                 break;
    
        case ERemConCoreApiVolumeDown:
                {
                switch (aButtonAct)
                    {
                       case ERemConCoreApiButtonClick:
                            emit volumedownclicked();
                            break;
                       default:
                             break;
                    }
                iCoreTarget->VolumeDownResponse(status, KErrNone);
                User::WaitForRequest(status);
                break;
                }
            }
        }
    
    }
    but when I try to allocate the object with "new" I get this error:
    C:\QtSDK\Symbian\SDKs\Symbian3Qt474\epoc32\include\e32base.inl:36: error: 'static TAny* CBase:perator new(TUint)' is inaccessible

  2. #2
    Registered User
    Join Date
    Nov 2009
    Posts
    18

    Re: Volume keys on symbian

    "I think all you need to do is to add public CAknAppUi in class declaration"

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    89

    Re: Volume keys on symbian

    Hi

    You dont need to derive from CAknAppUi .

    -halderp

  4. #4
    Registered User
    Join Date
    Nov 2011
    Posts
    80

    Re: Volume keys on symbian

    You could copy/include mediakeysobserver.h and mediakeysobserver.cpp from SDK demo "musicplayer" to your project. It worked for me.

    In addition, you have to put following code into your .pro file:
    Code:
    symbian {
    LIBS += -lremconinterfacebase \
            -lremconcoreapi
    }

Similar Threads

  1. Volume Keys on Nokia N8
    By abashir in forum Qt
    Replies: 3
    Last Post: 2011-03-31, 13:51
  2. Replies: 2
    Last Post: 2009-11-17, 07:11
  3. Volume keys when SWF installed using SIS
    By Jii5Hoo in forum [Archived] Flash Lite on Nokia Devices
    Replies: 0
    Last Post: 2009-03-26, 08:23
  4. Volume control keys & APS in N95
    By gs_cmans in forum Symbian
    Replies: 2
    Last Post: 2008-12-17, 06:51
  5. Detecting volume up/down keys
    By AliShafa in forum Symbian
    Replies: 3
    Last Post: 2008-04-24, 11:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×