multimediacommscontroller/mmccdtmfpayloadformat/inc/dtmfpayloadformatdefs.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 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:    Provides DTMF payload format spesific definitions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef DTMFPAYLOADFORMATDEFS_H
       
    22 #define DTMFPAYLOADFORMATDEFS_H
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 
       
    27 #ifdef _DEBUG 
       
    28     #include <e32svr.h>
       
    29     #define _DEBUG_DTMF_WRITE
       
    30     #define _DEBUG_DTMF_READ
       
    31     #define _DEBUG_DTMF_STIMER
       
    32     #define _DEBUG_DTMF_DECODE
       
    33     #define _DEBUG_DTMF_ENCODE
       
    34 #endif
       
    35 
       
    36 // CONSTANTS
       
    37 // Redundant events handled, RFC 2833 recommendation
       
    38 const TInt KDTMFDefaultRedundancyCount( 5 );
       
    39 const TUint KMaxDtmfRedCount( 5 );
       
    40 
       
    41 // Redundancy header = 4 bytes, DTMF event size = 4 bytes
       
    42 const TUint KDTMFDefaultPayloadSize( KMaxDtmfRedCount * 4 * 2 + 1 );
       
    43 
       
    44 // Maximum is -63 dBm0, preferred -8 to -3 RFC 2833bis6 4.3.3
       
    45 const TUint KDTMFDefaultToneVolume( 4 );
       
    46 const TUint KDTMFDefaultModulation( 0 );
       
    47 
       
    48 const TUint KDTMFLowGroupFrequencies[] = 
       
    49     {
       
    50     941/*0*/, 697, 697, 697, 770/*4*/, 770, 770, 852/*7*/, 852, 852, 941/***/,
       
    51     941/*#*/, 697/*A*/, 770/*B*/, 852/*C*/, 941/*D*/
       
    52     };
       
    53     
       
    54 const TUint KDTMFHighGroupFrequencies[] =
       
    55     {
       
    56     1336/*0*/, 1209, 1336, 1477, 1209/*4*/, 1336, 1477, 1209/*7*/, 1336, 1477,
       
    57     1209/***/, 1477/*#*/, 1633/*A*/, 1633/*B*/, 1633/*C*/, 1633/*D*/
       
    58     };
       
    59     
       
    60 const TInt KDtmfGroupFrequencyCount = 16;
       
    61 
       
    62 // Local/inband DTMF tone playing parameters
       
    63 const TUint KDTMFDefToneOnLengthInUs = 300000;
       
    64 const TUint KDTMFDefToneOffLengthInUs = 300000;
       
    65 const TUint KDTMFDefPauseLengthInUs = 2000000;
       
    66 const TUint KDTMFDefUpdateIntervalInUs = 50000;
       
    67 
       
    68 // Limit for local playback of tone to avoid getting stucked tones
       
    69 // (RFC2833bis12 2.5.2.2)
       
    70 const TUint KDTMFMaxTonePlaybackTime = KDTMFDefToneOnLengthInUs * 3;
       
    71 const TUint KDTMFMaxDurationFieldValue = 0xFFFF;
       
    72 
       
    73 // Number of bits used for value(s) saving in payload header
       
    74 const TInt KEventBlockLengthInBytes = 4;
       
    75 const TInt KEventFieldBits = 8;
       
    76 const TInt KVolFieldBits = 6;
       
    77 const TInt KDurationFieldBits = 16;
       
    78 const TInt KBlockPTBits = 7;
       
    79 const TInt KModulationBits = 9;
       
    80 const TInt KFrequencyBits = 12;
       
    81 const TInt KTimeStampOffsetBits = 14;
       
    82 const TInt KBlockLengthBits = 10;
       
    83 
       
    84 // Event codes for DTMFs
       
    85 const TInt KEventCodeForAsterisk = 10;
       
    86 const TInt KEventCodeForHashMark = 11;
       
    87 const TInt KEventCodeForA = 12;
       
    88 const TInt KEventCodeForB = 13;
       
    89 const TInt KEventCodeForC = 14;
       
    90 const TInt KEventCodeForD = 15;
       
    91 
       
    92 // MACROS
       
    93 #ifdef _DEBUG_DTMF_WRITE
       
    94     #define DP_DTMF_WRITE(a) RDebug::Print(a);
       
    95     #define DP_DTMF_WRITE2(a, b) RDebug::Print(a, b);
       
    96     #define DP_DTMF_WRITE3(a, b, c) RDebug::Print(a, b, c);
       
    97     #define DP_DTMF_WRITE4(a, b, c, d) RDebug::Print(a, b, c, d);
       
    98 #else
       
    99     #define DP_DTMF_WRITE(a);
       
   100     #define DP_DTMF_WRITE2(a, b);
       
   101     #define DP_DTMF_WRITE3(a, b, c);
       
   102     #define DP_DTMF_WRITE4(a, b, c, d);
       
   103 #endif
       
   104 
       
   105 #ifdef _DEBUG_DTMF_READ
       
   106     #define DP_DTMF_READ(a) RDebug::Print(a);
       
   107     #define DP_DTMF_READ2(a, b) RDebug::Print(a, b);
       
   108     #define DP_DTMF_READ3(a, b, c) RDebug::Print(a, b, c);
       
   109 #else
       
   110     #define DP_DTMF_READ(a);
       
   111     #define DP_DTMF_READ2(a, b);
       
   112     #define DP_DTMF_READ3(a, b, c);
       
   113 #endif
       
   114 
       
   115 #ifdef _DEBUG_DTMF_STIMER
       
   116     #define DP_DTMF_STIMER(a) RDebug::Print(a);
       
   117     #define DP_DTMF_STIMER2(a, b) RDebug::Print(a, b);
       
   118     #define DP_DTMF_STIMER3(a, b, c) RDebug::Print(a, b, c);
       
   119 #else
       
   120     #define DP_DTMF_STIMER(a);
       
   121     #define DP_DTMF_STIMER2(a, b);
       
   122     #define DP_DTMF_STIMER3(a, b, c);
       
   123 #endif
       
   124 
       
   125 #ifdef _DEBUG_DTMF_DECODE
       
   126     #define DP_DTMF_DECODE(a) RDebug::Print(a);
       
   127     #define DP_DTMF_DECODE2(a, b) RDebug::Print(a, b);
       
   128     #define DP_DTMF_DECODE3(a, b, c) RDebug::Print(a, b, c);
       
   129     #define DP_DTMF_DECODE5(a, b, c, d, e) RDebug::Print(a, b, c, d, e);
       
   130 #else
       
   131     #define DP_DTMF_DECODE(a);
       
   132     #define DP_DTMF_DECODE2(a, b);
       
   133     #define DP_DTMF_DECODE3(a, b, c);
       
   134     #define DP_DTMF_DECODE5(a, b, c, d, e);
       
   135 #endif
       
   136 
       
   137 #ifdef _DEBUG_DTMF_ENCODE
       
   138 
       
   139 #endif
       
   140 
       
   141 
       
   142 // DATA TYPES
       
   143 enum TDTMFPayloadFormat
       
   144     {
       
   145     EDTMFPayloadFormatNotDefined,
       
   146     EDTMFPayloadFormatEvent,
       
   147     EDTMFPayloadFormatTone,
       
   148     EDTMFPayloadFormatRedEvents
       
   149     };
       
   150 
       
   151 #endif      // DTMFPAYLOADFORMATDEFS_H
       
   152       
       
   153 // End of File