ipappsrv_plat/media_control_api/inc/mmccevents.h
changeset 0 1bce908db942
child 32 f2ed1fc4c163
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:    Class is used for passing events.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef MMCCEVENTS_H
       
    23 #define MMCCEVENTS_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32std.h>
       
    27 #include <rtpapi.h>
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 typedef TInt TMccEventCategory;
       
    32 typedef TInt TMccEventType;
       
    33 typedef TInt TMccRtcpPacketType;
       
    34 typedef TInt TMccDtmfEventType;
       
    35 
       
    36 const TInt KMccMaxEventDataLength = 1024;
       
    37 const TInt KMccMaxDtmfStringLength = 100;
       
    38 
       
    39 const TMccEventCategory KMccEventCategoryStream = 1;
       
    40 const TMccEventCategory KMccEventCategoryRtcp = 2;
       
    41 const TMccEventCategory KMccEventCategoryRtp = 3;
       
    42 const TMccEventCategory KMccEventCategoryDtmf = 4;
       
    43 const TMccEventCategory KMccEventCategoryTranscode = 5;
       
    44 
       
    45 const TMccEventType KMccEventNone = 1;
       
    46 const TMccEventType KMccStreamPrepared = 2;
       
    47 const TMccEventType KMccStreamStarted = 3;
       
    48 const TMccEventType KMccStreamPaused = 4;
       
    49 const TMccEventType KMccStreamResumed = 5;
       
    50 const TMccEventType KMccStreamStopped = 6;    
       
    51 const TMccEventType KMccStreamClosed = 7;
       
    52 const TMccEventType KMccInactivityEvent = 8;
       
    53 const TMccEventType KMccActivityEvent = 9;
       
    54 const TMccEventType KMccStreamPlaying = 10;
       
    55 const TMccEventType KMccStreamBuffering = 11;
       
    56 const TMccEventType KMccStreamIdle = 12;
       
    57 const TMccEventType KMccStreamMMFEvent = 13;
       
    58 const TMccEventType KMccStreamError = 14;
       
    59 const TMccEventType KMccRtcpControl = 15;
       
    60 const TMccEventType KMccRtcpReceived = 16;
       
    61 const TMccEventType KMccDtmfControl = 17;
       
    62 const TMccEventType KMccDtmfReceived = 18;
       
    63 const TMccEventType KMccResourceReserved = 19;
       
    64 const TMccEventType KMccResourceReleased = 20;
       
    65 const TMccEventType KMccResourceNotAvailable = 21;
       
    66 const TMccEventType KMccTranscodeInProgress = 22;
       
    67 const TMccEventType KMccTranscodeCompleted = 23;
       
    68 const TMccEventType KMccAudioRoutingChanged = 24;
       
    69 const TMccEventType KMccLinkCreated = 25;
       
    70 const TMccEventType KMccTranscodeCancelled = 26;
       
    71 const TMccEventType KMccUnknownMediaReceived = 27;
       
    72 const TMccEventType KMccMediaQualityStatus = 28;
       
    73 const TMccEventType KMccMasterKeyStaled = 29;
       
    74 
       
    75 const TMccRtcpPacketType KRtcpPacketUndefined = 0;
       
    76 const TMccRtcpPacketType KRtcpSdesPacket = 1;
       
    77 const TMccRtcpPacketType KRtcpByePacket = 2;
       
    78 const TMccRtcpPacketType KRtcpAppPacket = 3;
       
    79 const TMccRtcpPacketType KRtcpSrPacket = 4;
       
    80 const TMccRtcpPacketType KRtcpRrPacket = 5;
       
    81 const TMccRtcpPacketType KRtcpAnyPacket = 6;
       
    82      
       
    83 const TMccDtmfEventType KMccDtmfUnknown = 0;
       
    84 const TMccDtmfEventType KMccDtmfSigStartTone = 1;
       
    85 const TMccDtmfEventType KMccDtmfSigStopTone = 2;
       
    86 const TMccDtmfEventType KMccDtmfSigSendString = 3;
       
    87 const TMccDtmfEventType KMccDtmfSigContinueSending = 4;
       
    88 const TMccDtmfEventType KMccDtmfSigCancelSending = 5;
       
    89 const TMccDtmfEventType KMccDtmfSendingComplete = 6;
       
    90 const TMccDtmfEventType KMccDtmfManualStart = 7;
       
    91 const TMccDtmfEventType KMccDtmfManualStop = 8;
       
    92 const TMccDtmfEventType KMccDtmfManualAbort = 9;
       
    93 const TMccDtmfEventType KMccDtmfSequenceStart = 10;
       
    94 const TMccDtmfEventType KMccDtmfSequenceStop = 11;
       
    95 const TMccDtmfEventType KMccDtmfSequenceAbort = 12;
       
    96 const TMccDtmfEventType KMccDtmfStopInDtmfString = 13;
       
    97 
       
    98 // MACROS
       
    99 
       
   100 // DATA TYPES
       
   101         
       
   102 // FUNCTION PROTOTYPES
       
   103 
       
   104 // FORWARD DECLARATIONS
       
   105 
       
   106 // CLASS DECLARATION
       
   107 
       
   108 // Disabling PC-lint warnings 1554 and 1555, for getting rid of them otherwise
       
   109 // might not be possible
       
   110 /*lint -e1554 -e1555*/
       
   111 
       
   112 
       
   113 /**
       
   114 * MCC Event
       
   115 *
       
   116 *  @lib mmccinterface.dll
       
   117 */
       
   118 class TMccEvent 
       
   119 {
       
   120 public: // Constructors
       
   121 
       
   122     /**
       
   123     * Default constructor
       
   124     */
       
   125     inline TMccEvent() :
       
   126         iSessionId( 0 ), iLinkId( 0 ), iStreamId( 0 ), iEndpointId( 0 ),
       
   127         iEventCategory( 0 ), iEventType( KMccEventNone ), iErrorCode( KErrNone ),
       
   128         iEventNumData( 0 ), iEventData( KNullDesC8 ), 
       
   129         iReserved( 0 ), iReserved2( NULL )
       
   130         {
       
   131         }
       
   132     
       
   133     /**
       
   134     * Parametrized constructor
       
   135     */
       
   136     inline TMccEvent( TUint32 aSessionId, TUint32 aLinkId,
       
   137                       TUint32 aStreamId, TUint32 aEndpointId, TMccEventCategory aCategory, 
       
   138                       TMccEventType aEvent, TInt aError, const TDesC8& aData ) : 
       
   139         iSessionId( aSessionId ), iLinkId( aLinkId ), iStreamId( aStreamId ),
       
   140         iEndpointId( aEndpointId ), iEventCategory( aCategory ), iEventType( aEvent ),
       
   141         iErrorCode( aError ), iEventNumData( 0 ), iEventData( aData ),
       
   142         iReserved( 0 ), iReserved2( NULL )
       
   143         {
       
   144         }
       
   145         
       
   146     /**
       
   147     * Copy constructor
       
   148     */
       
   149     inline TMccEvent( const TMccEvent& aEvent ):
       
   150         iSessionId( aEvent.iSessionId ), iLinkId( aEvent.iLinkId ),
       
   151         iStreamId( aEvent.iStreamId ), iEndpointId( aEvent.iEndpointId ),
       
   152         iEventCategory( aEvent.iEventCategory ), iEventType( aEvent.iEventType ),
       
   153         iErrorCode( aEvent.iErrorCode ), iEventNumData(aEvent.iEventNumData),
       
   154         iEventData( aEvent.iEventData ), 
       
   155         iReserved( aEvent.iReserved ), iReserved2( aEvent.iReserved2 )
       
   156         {
       
   157         }
       
   158         
       
   159                 
       
   160     inline TMccEvent& operator=( 
       
   161         const TMccEvent& aEvent )
       
   162         {
       
   163         if ( &aEvent != this )
       
   164             {
       
   165             iSessionId = aEvent.iSessionId;
       
   166             iLinkId = aEvent.iLinkId;
       
   167             iStreamId = aEvent.iStreamId;
       
   168             iEndpointId = aEvent.iEndpointId; 
       
   169             iEventCategory = aEvent.iEventCategory;
       
   170             iEventType = aEvent.iEventType;
       
   171             iErrorCode = aEvent.iErrorCode;
       
   172        	    iEventNumData = aEvent.iEventNumData;
       
   173             iEventData.Copy( aEvent.iEventData );
       
   174             iReserved = aEvent.iReserved;
       
   175             iReserved2 = aEvent.iReserved2;
       
   176             }
       
   177         return *this;
       
   178         }
       
   179         
       
   180 public: // Data
       
   181 
       
   182     // Session identifier
       
   183     TUint32 iSessionId;
       
   184 
       
   185     // Link identifier
       
   186     TUint32 iLinkId;
       
   187 
       
   188     // Stream identifier
       
   189     TUint32 iStreamId;
       
   190 
       
   191     // Endpoint (source/sink) identifier
       
   192     TUint32 iEndpointId;
       
   193     
       
   194     // Event category
       
   195     TMccEventCategory iEventCategory;
       
   196 
       
   197     // Event type
       
   198     TMccEventType iEventType;
       
   199     
       
   200     // Error code for event
       
   201     TInt iErrorCode;
       
   202     
       
   203     // Numeric data for event
       
   204     TUint32 iEventNumData;
       
   205 
       
   206     // Event data
       
   207     TBuf8<KMccMaxEventDataLength> iEventData;
       
   208 
       
   209     // Reserved for future use
       
   210     TUint32 iReserved;
       
   211     
       
   212     // Reserved for future use
       
   213     TAny* iReserved2;
       
   214 
       
   215 };
       
   216 
       
   217 typedef TPckgBuf<TMccEvent> TMccEventPackage;
       
   218 
       
   219 
       
   220 /**
       
   221 * The class TMccRtcpEventData implements the RTCP signalling in the MCC.
       
   222 */
       
   223 
       
   224 const TInt KMccMaxRtcpPacketDataLength = KMccMaxEventDataLength - 
       
   225                                          TInt(sizeof( TMccRtcpPacketType )) - 
       
   226                                          TInt(sizeof( TUint32 )) - 
       
   227                                          TInt(sizeof( TTimeStamps )) - 
       
   228                                          TInt(sizeof( TRtpPeerStat )) -
       
   229                                          /* TPckgBuf overhead */
       
   230                                          TInt(sizeof( TMccEventPackage ))
       
   231                                          + TInt(sizeof( TMccEvent ));
       
   232 
       
   233 /**
       
   234 * Rtp SourceSink event data
       
   235 */
       
   236 class TMccRtpEventData
       
   237     {
       
   238     public: 
       
   239     
       
   240         /**
       
   241         * Default constructor
       
   242         */
       
   243         inline TMccRtpEventData() :
       
   244             iJitterEstimate( 0 ), 
       
   245             iPacketsReceived( 0 ), 
       
   246             iPrevTransTime( 0 ),
       
   247             iTriggeredJitterLevel( 0 )
       
   248             {   
       
   249             }
       
   250     
       
   251         /**
       
   252         * Copy constructor
       
   253         */
       
   254         inline TMccRtpEventData( const TMccRtpEventData& aEvent ) :
       
   255             iJitterEstimate( aEvent.iJitterEstimate ),
       
   256             iPacketsReceived( aEvent.iPacketsReceived ), 
       
   257             iPrevTransTime( aEvent.iPrevTransTime ),
       
   258             iTriggeredJitterLevel( aEvent.iTriggeredJitterLevel )
       
   259             {
       
   260             }
       
   261         
       
   262         /**
       
   263          * parametrized constructor
       
   264          */
       
   265         inline TMccRtpEventData( TInt64 aEstimate, 
       
   266                                  TUint32 aPcksRec, 
       
   267                                  TInt64 aPrevTransTime, 
       
   268                                  TUint64 aTriggeredJitterLevel ) :
       
   269             iJitterEstimate( aEstimate ),
       
   270             iPacketsReceived( aPcksRec ), 
       
   271             iPrevTransTime( aPrevTransTime ),
       
   272             iTriggeredJitterLevel( aTriggeredJitterLevel )
       
   273             {
       
   274             }
       
   275         
       
   276     public: // Data
       
   277         
       
   278         // Current jitter estimate
       
   279         TUint64 iJitterEstimate;
       
   280         
       
   281         // Number of received packets
       
   282         TUint32 iPacketsReceived;
       
   283         
       
   284         // Previous packet transit time
       
   285         TInt64 iPrevTransTime;
       
   286         
       
   287         // Triggered jitter level
       
   288         TUint64 iTriggeredJitterLevel;
       
   289     };
       
   290     
       
   291 typedef TPckgBuf<TMccRtpEventData> TMccRtpEventDataPackage;
       
   292 
       
   293 class TMccRtcpEventData
       
   294     {
       
   295     public: // Constructors
       
   296     
       
   297         /**
       
   298         * Constructor
       
   299         */
       
   300         inline TMccRtcpEventData() :
       
   301             iRtcpPacketData( KNullDesC8 ),
       
   302             iRtcpPacketType( KRtcpPacketUndefined ),
       
   303             iSsrc( 0 )
       
   304             {
       
   305             	iStats.iNumPacketsSent = 0;
       
   306             	iStats.iCumNumOctetsSent = 0;
       
   307             	iStats.iRoundTripDelay = 0;
       
   308             	iStats.iTxBandwidth = 0;
       
   309             	iStats.iCumNumPacketsLost = 0;
       
   310             	iStats.iFractionLost = 0;
       
   311             	iStats.iArrivalJitter = 0;
       
   312             	iStats.iRxBandwidth = 0;
       
   313             	iStats.iChannelBufferSize = 0;
       
   314             	iStats.iNTPTimeStampSec = 0;
       
   315             	iStats.iNTPTimeStampFrac = 0;
       
   316             	iStats.iTimeStamp = 0;
       
   317             	iTimeStamps.iNTPTimeStampSec = 0;
       
   318             	iTimeStamps.iNTPTimeStampFrac = 0;
       
   319             	iTimeStamps.iTimeStamp = 0;
       
   320             }
       
   321 
       
   322         /**
       
   323         * Copy constructor
       
   324         */
       
   325         inline TMccRtcpEventData( const TMccRtcpEventData& aEventData ) :
       
   326             iRtcpPacketData( aEventData.iRtcpPacketData ),
       
   327             iRtcpPacketType( aEventData.iRtcpPacketType ),
       
   328             iSsrc( aEventData.iSsrc ),
       
   329             iTimeStamps( aEventData.iTimeStamps ),
       
   330             iStats( aEventData.iStats )
       
   331             {
       
   332             }
       
   333     
       
   334     public: // Data
       
   335     
       
   336         // RTCP packet data
       
   337         TBuf8<KMccMaxRtcpPacketDataLength> iRtcpPacketData;
       
   338         
       
   339         // Type of the RTCP data
       
   340         TMccRtcpPacketType iRtcpPacketType;
       
   341         
       
   342         // Synchronization source of RTCP packet
       
   343         TUint32 iSsrc;   
       
   344         
       
   345         TTimeStamps iTimeStamps;
       
   346         
       
   347         TRtpPeerStat iStats;
       
   348     };
       
   349     
       
   350 typedef TPckgBuf<TMccRtcpEventData> TMccRtcpEventDataPackage;
       
   351 
       
   352 /**
       
   353 * The class TMccDtmfEventData implements the DTMF signalling in the MCC.
       
   354 */
       
   355 class TMccDtmfEventData
       
   356     {
       
   357     public: // Constructors
       
   358         
       
   359         /**
       
   360         * Constructor
       
   361         */
       
   362         inline TMccDtmfEventData() : 
       
   363             iDtmfEventType( KMccDtmfUnknown ),
       
   364             iContinue( EFalse ),
       
   365             iDtmfString( NULL ),
       
   366             iTimeStamp( 0 ),
       
   367             iSeqNum( 0 )
       
   368             {
       
   369             }    
       
   370             
       
   371         /**
       
   372         * Copy constructor
       
   373         */
       
   374         inline TMccDtmfEventData( const TMccDtmfEventData& aEventData ) : 
       
   375             iDtmfEventType( aEventData.iDtmfEventType ),
       
   376             iContinue( aEventData.iContinue ),
       
   377             iDtmfString( aEventData.iDtmfString ),
       
   378             iTimeStamp( aEventData.iTimeStamp ),
       
   379             iSeqNum( aEventData.iSeqNum )
       
   380             {
       
   381             }      
       
   382             
       
   383     public: // Data
       
   384 
       
   385         // Encapsulates type of the event
       
   386         TMccDtmfEventType iDtmfEventType;
       
   387 
       
   388         // Indicates is Dtmf sending continued after stop
       
   389         TBool iContinue;
       
   390         
       
   391         // Dtmf string to send
       
   392         TBuf8<KMccMaxDtmfStringLength> iDtmfString;
       
   393         
       
   394         // For internal usage
       
   395         TUint32 iTimeStamp;
       
   396         
       
   397         // For internal usage
       
   398         TUint32 iSeqNum;
       
   399         
       
   400     };
       
   401     
       
   402 typedef TPckgBuf<TMccDtmfEventData> TMccDtmfEventDataPackage;
       
   403       
       
   404 #endif      // MMCCEVENTS_H   
       
   405             
       
   406 // End of File