sl@0: /* sl@0: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: TelephonyAudioRoutingServer implementation sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #ifndef TELEPHONYAUDIOROUTINGSERVER_H sl@0: #define TELEPHONYAUDIOROUTINGSERVER_H sl@0: sl@0: #include sl@0: #include "TelephonyAudioRouting.h" sl@0: sl@0: const TInt KMaxNumberOfSessions = 256; sl@0: sl@0: enum TTelephonyAudioRoutingPanic sl@0: { sl@0: EPanicGeneral, sl@0: EPanicIllegalFunction, sl@0: EPanicResourceError sl@0: }; sl@0: sl@0: void PanicClient(const RMessage2& aMessage,TTelephonyAudioRoutingPanic aPanic); sl@0: sl@0: // CLASS DECLARATION sl@0: sl@0: /** sl@0: * TelephonyAudioRoutingServer class declaration sl@0: * sl@0: * @lib TelephonyAudioRoutingServer.lib sl@0: * @since Series 60 3.1 sl@0: */ sl@0: class CTelephonyAudioRoutingServer : public CServer2 sl@0: { sl@0: sl@0: public: // Constructors and destructor sl@0: sl@0: /** sl@0: * Two-phased constructor. sl@0: */ sl@0: IMPORT_C static CTelephonyAudioRoutingServer* NewL(); sl@0: sl@0: /** sl@0: * Destructor. sl@0: */ sl@0: ~CTelephonyAudioRoutingServer(); sl@0: sl@0: public: sl@0: sl@0: /** sl@0: * Start the TelephonyAudioRoutingServer thread sl@0: * @since Series 60 3.1 sl@0: * @param TAny* aParams sl@0: * @return KErrNone is successfull, else appropriate err code sl@0: */ sl@0: IMPORT_C static TInt StartThreadL(TAny* aParams); sl@0: sl@0: /** sl@0: * Add a new Session. sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return void sl@0: */ sl@0: void AddSession(); sl@0: sl@0: /** sl@0: * Remove an existing session. sl@0: * @since Series 60 3.1 sl@0: * @param TInt aSessionId Id of the session to remove sl@0: * @return void sl@0: */ sl@0: void RemoveSession(TInt aSessionId); sl@0: sl@0: /** sl@0: * Notify the policy session about a request to change output. sl@0: * @since Series 60 3.1 sl@0: * @param TInt aSessionId Id of the session to utilize, aMessage contains output value sl@0: * @return void sl@0: */ sl@0: void DoSetOutputL (TInt aSessionId, const RMessage2& aMessage); sl@0: sl@0: /** sl@0: * Assign a unique session Id to a new session. sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return TInt session Id sl@0: */ sl@0: TInt IdentifyAndAllocateNextFreeSessionIdL(); sl@0: sl@0: /** sl@0: * Free the session Id or a deleted session for re-use. sl@0: * @since Series 60 3.1 sl@0: * @param TInt aSessionId Id of the session to free sl@0: * @return void sl@0: */ sl@0: void FreeSessionId(TInt aSessionId); sl@0: sl@0: /** sl@0: * Used by policy session to indicate the session that requested a SetOutput() that sl@0: * the request is complete, all the other session get OutputChanged() notification sl@0: * @since Series 60 3.1 sl@0: * @param aOutput value of modified output, aError result of operation. sl@0: * @return void sl@0: */ sl@0: void SetOutputCompleteL(CTelephonyAudioRouting::TAudioOutput aOutput, TInt aError); sl@0: sl@0: /** sl@0: * Used by policy session to notify all sessions that the output has changed. sl@0: * (Policy initiated change in output) sl@0: * @since Series 60 3.1 sl@0: * @param aOutput value of modified output sl@0: * @return void sl@0: */ sl@0: void OutputChanged(CTelephonyAudioRouting::TAudioOutput aOutput); sl@0: sl@0: /** sl@0: * Used by policy session to indicated to all other sessions that available outputs have changed. sl@0: * @since Series 60 3.1 sl@0: * @param aOutputs contains array of available outputs sl@0: * @return void sl@0: */ sl@0: void AvailableOutputsChangedL( const TArray& aOutputs); sl@0: sl@0: /** sl@0: * Set the Id of the policy session. sl@0: * @since Series 60 3.1 sl@0: * @param TInt aSessionId is Id to set sl@0: * @return void sl@0: */ sl@0: void SetPolicySessionId(TInt aSessionId); sl@0: sl@0: /** sl@0: * Provide caller with iCurrentAudioOutput sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return iCurrentAudioOutput sl@0: */ sl@0: CTelephonyAudioRouting::TAudioOutput& CurrentAudioOutput(); sl@0: sl@0: /** sl@0: * Provide caller with iPreviousAudioOutput sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return iPreviousAudioOutput sl@0: */ sl@0: CTelephonyAudioRouting::TAudioOutput& PreviousAudioOutput(); sl@0: sl@0: /** sl@0: * Provide caller with iShowNoteMode sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return iShowNoteMode sl@0: */ sl@0: TBool& ShowNoteMode(); sl@0: sl@0: /** sl@0: * Allows caller to set iShowNoteMode sl@0: * @since Series 60 3.1 sl@0: * @param TBool aShowNoteMode sl@0: * @return void sl@0: */ sl@0: void SetShowNoteMode(TBool aShowNoteMode); sl@0: sl@0: /** sl@0: * Provide caller with iAvailableOutputs array sl@0: * @since Series 60 3.1 sl@0: * @param none sl@0: * @return: Array of available outputs sl@0: */ sl@0: RArray& AvailableOutputs(); sl@0: sl@0: sl@0: private: sl@0: sl@0: /** sl@0: * C++ default constructor. sl@0: */ sl@0: CTelephonyAudioRoutingServer(/*TProcessId& aClientPID*/); sl@0: sl@0: /** sl@0: * By default Symbian 2nd phase constructor is private. sl@0: */ sl@0: void ConstructL(); sl@0: sl@0: /** sl@0: * From CServer2 sl@0: * Creates a server-side client session object. sl@0: */ sl@0: CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; sl@0: sl@0: /** sl@0: * determines if audio output is in available outputs array. sl@0: * @since Series 60 3.1 sl@0: * @param aOutput is current output value sl@0: * @return TBool ETrue if current output is available, EFalse if not sl@0: */ sl@0: TBool IsAvailableOutput(CTelephonyAudioRouting::TAudioOutput aOutput); sl@0: sl@0: private: sl@0: sl@0: TInt iSessionCount; sl@0: TInt iPolicySessionId; sl@0: RArray iSetOutputRequests; sl@0: RArray iSessionIdsInUse; sl@0: CTelephonyAudioRouting::TAudioOutput iCurrentAudioOutput; sl@0: CTelephonyAudioRouting::TAudioOutput iPreviousAudioOutput; sl@0: RArray iAvailableOutputs; sl@0: TBool iShowNoteMode; sl@0: sl@0: sl@0: }; sl@0: sl@0: #endif