os/mm/devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServer.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/telephonyaudiorouting/Server/inc/TelephonyAudioRoutingServer.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,225 @@
1.4 +/*
1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: TelephonyAudioRoutingServer implementation
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +#ifndef TELEPHONYAUDIOROUTINGSERVER_H
1.24 +#define TELEPHONYAUDIOROUTINGSERVER_H
1.25 +
1.26 +#include <e32base.h>
1.27 +#include "TelephonyAudioRouting.h"
1.28 +
1.29 +const TInt KMaxNumberOfSessions = 256;
1.30 +
1.31 +enum TTelephonyAudioRoutingPanic
1.32 + {
1.33 + EPanicGeneral,
1.34 + EPanicIllegalFunction,
1.35 + EPanicResourceError
1.36 + };
1.37 +
1.38 +void PanicClient(const RMessage2& aMessage,TTelephonyAudioRoutingPanic aPanic);
1.39 +
1.40 +// CLASS DECLARATION
1.41 +
1.42 +/**
1.43 +* TelephonyAudioRoutingServer class declaration
1.44 +*
1.45 +* @lib TelephonyAudioRoutingServer.lib
1.46 +* @since Series 60 3.1
1.47 +*/
1.48 +class CTelephonyAudioRoutingServer : public CServer2
1.49 + {
1.50 +
1.51 + public: // Constructors and destructor
1.52 +
1.53 + /**
1.54 + * Two-phased constructor.
1.55 + */
1.56 + IMPORT_C static CTelephonyAudioRoutingServer* NewL();
1.57 +
1.58 + /**
1.59 + * Destructor.
1.60 + */
1.61 + ~CTelephonyAudioRoutingServer();
1.62 +
1.63 + public:
1.64 +
1.65 + /**
1.66 + * Start the TelephonyAudioRoutingServer thread
1.67 + * @since Series 60 3.1
1.68 + * @param TAny* aParams
1.69 + * @return KErrNone is successfull, else appropriate err code
1.70 + */
1.71 + IMPORT_C static TInt StartThreadL(TAny* aParams);
1.72 +
1.73 + /**
1.74 + * Add a new Session.
1.75 + * @since Series 60 3.1
1.76 + * @param none
1.77 + * @return void
1.78 + */
1.79 + void AddSession();
1.80 +
1.81 + /**
1.82 + * Remove an existing session.
1.83 + * @since Series 60 3.1
1.84 + * @param TInt aSessionId Id of the session to remove
1.85 + * @return void
1.86 + */
1.87 + void RemoveSession(TInt aSessionId);
1.88 +
1.89 + /**
1.90 + * Notify the policy session about a request to change output.
1.91 + * @since Series 60 3.1
1.92 + * @param TInt aSessionId Id of the session to utilize, aMessage contains output value
1.93 + * @return void
1.94 + */
1.95 + void DoSetOutputL (TInt aSessionId, const RMessage2& aMessage);
1.96 +
1.97 + /**
1.98 + * Assign a unique session Id to a new session.
1.99 + * @since Series 60 3.1
1.100 + * @param none
1.101 + * @return TInt session Id
1.102 + */
1.103 + TInt IdentifyAndAllocateNextFreeSessionIdL();
1.104 +
1.105 + /**
1.106 + * Free the session Id or a deleted session for re-use.
1.107 + * @since Series 60 3.1
1.108 + * @param TInt aSessionId Id of the session to free
1.109 + * @return void
1.110 + */
1.111 + void FreeSessionId(TInt aSessionId);
1.112 +
1.113 + /**
1.114 + * Used by policy session to indicate the session that requested a SetOutput() that
1.115 + * the request is complete, all the other session get OutputChanged() notification
1.116 + * @since Series 60 3.1
1.117 + * @param aOutput value of modified output, aError result of operation.
1.118 + * @return void
1.119 + */
1.120 + void SetOutputCompleteL(CTelephonyAudioRouting::TAudioOutput aOutput, TInt aError);
1.121 +
1.122 + /**
1.123 + * Used by policy session to notify all sessions that the output has changed.
1.124 + * (Policy initiated change in output)
1.125 + * @since Series 60 3.1
1.126 + * @param aOutput value of modified output
1.127 + * @return void
1.128 + */
1.129 + void OutputChanged(CTelephonyAudioRouting::TAudioOutput aOutput);
1.130 +
1.131 + /**
1.132 + * Used by policy session to indicated to all other sessions that available outputs have changed.
1.133 + * @since Series 60 3.1
1.134 + * @param aOutputs contains array of available outputs
1.135 + * @return void
1.136 + */
1.137 + void AvailableOutputsChangedL( const TArray<CTelephonyAudioRouting::TAudioOutput>& aOutputs);
1.138 +
1.139 + /**
1.140 + * Set the Id of the policy session.
1.141 + * @since Series 60 3.1
1.142 + * @param TInt aSessionId is Id to set
1.143 + * @return void
1.144 + */
1.145 + void SetPolicySessionId(TInt aSessionId);
1.146 +
1.147 + /**
1.148 + * Provide caller with iCurrentAudioOutput
1.149 + * @since Series 60 3.1
1.150 + * @param none
1.151 + * @return iCurrentAudioOutput
1.152 + */
1.153 + CTelephonyAudioRouting::TAudioOutput& CurrentAudioOutput();
1.154 +
1.155 + /**
1.156 + * Provide caller with iPreviousAudioOutput
1.157 + * @since Series 60 3.1
1.158 + * @param none
1.159 + * @return iPreviousAudioOutput
1.160 + */
1.161 + CTelephonyAudioRouting::TAudioOutput& PreviousAudioOutput();
1.162 +
1.163 + /**
1.164 + * Provide caller with iShowNoteMode
1.165 + * @since Series 60 3.1
1.166 + * @param none
1.167 + * @return iShowNoteMode
1.168 + */
1.169 + TBool& ShowNoteMode();
1.170 +
1.171 + /**
1.172 + * Allows caller to set iShowNoteMode
1.173 + * @since Series 60 3.1
1.174 + * @param TBool aShowNoteMode
1.175 + * @return void
1.176 + */
1.177 + void SetShowNoteMode(TBool aShowNoteMode);
1.178 +
1.179 + /**
1.180 + * Provide caller with iAvailableOutputs array
1.181 + * @since Series 60 3.1
1.182 + * @param none
1.183 + * @return: Array of available outputs
1.184 + */
1.185 + RArray<CTelephonyAudioRouting::TAudioOutput>& AvailableOutputs();
1.186 +
1.187 +
1.188 + private:
1.189 +
1.190 + /**
1.191 + * C++ default constructor.
1.192 + */
1.193 + CTelephonyAudioRoutingServer(/*TProcessId& aClientPID*/);
1.194 +
1.195 + /**
1.196 + * By default Symbian 2nd phase constructor is private.
1.197 + */
1.198 + void ConstructL();
1.199 +
1.200 + /**
1.201 + * From CServer2
1.202 + * Creates a server-side client session object.
1.203 + */
1.204 + CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
1.205 +
1.206 + /**
1.207 + * determines if audio output is in available outputs array.
1.208 + * @since Series 60 3.1
1.209 + * @param aOutput is current output value
1.210 + * @return TBool ETrue if current output is available, EFalse if not
1.211 + */
1.212 + TBool IsAvailableOutput(CTelephonyAudioRouting::TAudioOutput aOutput);
1.213 +
1.214 + private:
1.215 +
1.216 + TInt iSessionCount;
1.217 + TInt iPolicySessionId;
1.218 + RArray<TInt> iSetOutputRequests;
1.219 + RArray<TInt> iSessionIdsInUse;
1.220 + CTelephonyAudioRouting::TAudioOutput iCurrentAudioOutput;
1.221 + CTelephonyAudioRouting::TAudioOutput iPreviousAudioOutput;
1.222 + RArray<CTelephonyAudioRouting::TAudioOutput> iAvailableOutputs;
1.223 + TBool iShowNoteMode;
1.224 +
1.225 +
1.226 + };
1.227 +
1.228 +#endif