mmserv/tms/inc/tmsshared.h
changeset 0 71ca22bcf22a
child 3 4f62049db6ac
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2  * Copyright (c) 2009 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef TMS_SHARED_H
       
    19 #define TMS_SHARED_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <glib.h>
       
    23 #include <e32std.h>
       
    24 #include "tmsclientserver.h"
       
    25 #include "tmsgstreamer.h"
       
    26 
       
    27 namespace TMS {
       
    28 
       
    29 // CONSTANTS
       
    30 const TUint KQueueCreateWaitTime = 10; //10ms
       
    31 
       
    32 const TUint KTMSG711FrameLen10ms = 82; //10ms ->  80 + 2 for header
       
    33 const TUint KTMSG711FrameLen20ms = 162; //20ms -> 160 + 2 for header
       
    34 
       
    35 const TInt KTMSAMRNBFrameLen   = 14; //frame-mode OFF
       
    36 const TInt KTMSAMRNBFrameLenFM = 32; //frame-mode ON
       
    37 
       
    38 const TInt KTMSILBCFrameLen20ms = 40; //20ms
       
    39 const TInt KTMSILBCFrameLen30ms = 52; //30ms
       
    40 
       
    41 const TInt KTMSG729FrameLen   = 24; //10 octets + 2 for header
       
    42 const TUint KTMSPCM16FrameLen = 4096;
       
    43 
       
    44 // ENUMERATIONS
       
    45 
       
    46 // ITC communication commands between the threads
       
    47 enum TUserCommand
       
    48     {
       
    49     ECmdStartDownlink = 0,
       
    50     ECmdStartUplink,
       
    51     ECmdInitDownlink,
       
    52     ECmdInitUplink,
       
    53     ECmdStopDownlink,
       
    54     ECmdStopUplink,
       
    55     ECmdBufferFilled,
       
    56     ECmdBufferEmptied,
       
    57     ECmdGetVolume,
       
    58     ECmdSetVolume,
       
    59     ECmdGetGain,
       
    60     ECmdSetGain,
       
    61     ECmdSetAudioDevice,
       
    62     ECmdGetAudioDevice,
       
    63     ECmdTerminateThread,
       
    64     ECmdGetDataXferChunkHndl,
       
    65 
       
    66     ECmdDnLinkError,
       
    67     ECmdUpLinkError,
       
    68 
       
    69     ECmdSetG711CodecMode,
       
    70     ECmdGetG711CodecMode,
       
    71     ECmdSetIlbcCodecMode,
       
    72     ECmdGetIlbcCodecMode,
       
    73     ECmdSetG711CodecModeUPL,
       
    74     ECmdGetG711CodecModeUPL,
       
    75     ECmdSetIlbcCodecModeUPL,
       
    76     ECmdGetIlbcCodecModeUPL,
       
    77     ECmdGetSupportedBitrates,
       
    78     ECmdSetBitrate,
       
    79     ECmdGetBitrate,
       
    80     ECmdSetFrameMode,
       
    81     ECmdGetFrameMode,
       
    82     ECmdFrameModeRqrdForEC,
       
    83     ECmdConcealErrForNextBuf,
       
    84     ECmdSetVad,
       
    85     ECmdGetVad,
       
    86     ECmdSetCng,
       
    87     ECmdGetCng,
       
    88     ECmdSetPlc,
       
    89     ECmdGetPlc,
       
    90     ECmdBadLsfNextBuffer,
       
    91 
       
    92     // Event returned from the work thread upon async request complete
       
    93     ECmdGetVolumeComplete,
       
    94     ECmdGetGainComplete,
       
    95     ECmdGetAudioDeviceComplete,
       
    96     ECmdGetG711CodecModeComplete,
       
    97     ECmdGetIlbcCodecModeComplete,
       
    98     ECmdGetFrameModeComplete,
       
    99     ECmdGetFrameModeReqForECComplete,
       
   100     ECmdGetVadComplete,
       
   101     ECmdGetCngComplete,
       
   102     ECmdGetPlcComplete,
       
   103     ECmdGetSupportedBitratesComplete,
       
   104     ECmdGetBitrateComplete,
       
   105 
       
   106     // Server side events sent to the client
       
   107     ECmdDownlinkInitComplete,
       
   108     ECmdUplinkInitComplete,
       
   109     ECmdDownlinkDeInitComplete,
       
   110     ECmdUplinkDeInitComplete,
       
   111     ECmdDownlinkStarted,
       
   112     ECmdUplinkStarted,
       
   113     ECmdDownlinkPaused,
       
   114     ECmdUplinkPaused,
       
   115     ECmdFillBuffer,
       
   116     ECmdEmptyBuffer,
       
   117     ECmdDTMFOpenDnlinkComplete,
       
   118     ECmdDTMFOpenUplinkComplete,
       
   119     ECmdDTMFTonePlayFinished,
       
   120     ECmdRingToneOpenComplete,
       
   121     ECmdRingTonePlayComplete,
       
   122     ECmdDownlinkClosed,
       
   123     ECmdUplinkClosed,
       
   124     ECmdGlobalRoutingChange,
       
   125     ECmdGlobalEffectChange
       
   126     };
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 //  Class Name:  TMSCodecSettings
       
   130 //
       
   131 //  Structure used for setting codec configuration.
       
   132 // -----------------------------------------------------------------------------
       
   133 class TMSCodecSettings
       
   134     {
       
   135 public:
       
   136     enum TG711FrameRate
       
   137         {
       
   138         E10MS,
       
   139         E20MS
       
   140         };
       
   141 
       
   142 public:
       
   143     gint iG711CodecMode;
       
   144     gint iILBCCodecMode;
       
   145     guint32 iFourCC;
       
   146     TG711FrameRate iG711FrameRate;
       
   147     gboolean iVad;
       
   148     gboolean iCng;
       
   149     gboolean iPlc;
       
   150     gboolean iFrameMode;
       
   151     gboolean iFrameModeReqForEC;
       
   152     guint iBitrate;
       
   153     RArray<TUint> iArrBitrates;
       
   154     };
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 //  Class Name:  TSharedData
       
   158 //
       
   159 //  Structure used for ITC communication and data transfer.
       
   160 // -----------------------------------------------------------------------------
       
   161 class TSharedData
       
   162     {
       
   163 public:
       
   164     // Main thread's ID
       
   165     TThreadId iMainThreadID;
       
   166 
       
   167     // For thread end signalling
       
   168     RMutex iMutex;
       
   169 
       
   170     // Request status pointer for signalling thread via A/O
       
   171     TRequestStatus* iThreadStatus;
       
   172     TRequestStatus* iMnThreadStatus;
       
   173 
       
   174     // Audio configuration settings
       
   175     guint iAudioDevice;
       
   176     gint iMaxVolume;
       
   177     gint iMaxGain;
       
   178 
       
   179     // Codec configuration settings
       
   180     TMSCodecSettings iCodecSettings;
       
   181 
       
   182     // Command parameter for signalling between the threads via A/O
       
   183     TUserCommand iCmd;
       
   184 
       
   185     // Size of the data buffer and frame sequence number
       
   186     gint iBufferSize;
       
   187     guint iSequenceNum;
       
   188 
       
   189     // Any data sent between both threads
       
   190     gint iInt;
       
   191     guint iUint;
       
   192     gboolean iBool;
       
   193     guint32 iKeyValue;
       
   194     };
       
   195 
       
   196 } //namespace TMS
       
   197 
       
   198 #endif  // TMS_SHARED_H
       
   199 
       
   200 // End of file