connectivitylayer/isce/isaaccessextension_dll/src/router.cpp
changeset 7 fa67e03b87df
parent 5 8ccc39f9d787
child 8 6295dc2169f3
equal deleted inserted replaced
6:942573423a60 7:fa67e03b87df
    21 #include <pipeisi.h>                    // For PNS_PIPE_DATA_OFFSET_DATA
    21 #include <pipeisi.h>                    // For PNS_PIPE_DATA_OFFSET_DATA
    22 #include <commisi.h>                    // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
    22 #include <commisi.h>                    // For SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP
    23 #include "router.h"
    23 #include "router.h"
    24 #include "iadtrace.h"                   // For C_TRACE..
    24 #include "iadtrace.h"                   // For C_TRACE..
    25 #include "isaaccessextension.h"         // For DIsaAccessExtension
    25 #include "isaaccessextension.h"         // For DIsaAccessExtension
    26 #include "indicationhandler.h"          // For DIndicationHandler
       
    27 #include "queue.h"                      // For DQueue
    26 #include "queue.h"                      // For DQueue
    28 #include "iadinternaldefinitions.h"     // For EIADAsync...
    27 #include "iadinternaldefinitions.h"     // For EIADAsync...
    29 #include "iadhelpers.h"                 // For GET_RECEIVER
    28 #include "iadhelpers.h"                 // For GET_RECEIVER
    30 #include <nsisi.h>                      // For PN_NAMESERVICE...
    29 #include <nsisi.h>                      // For PN_NAMESERVICE...
    31 
    30 
    39 //#define MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD // TODO: to be removed when Bridge Modem SW is ok
    38 //#define MODEM_MCE_DOES_NOT_WORK_AS_IT_SHOULD // TODO: to be removed when Bridge Modem SW is ok
    40 
    39 
    41 // ISCE
    40 // ISCE
    42 #include "memapi.h"                     // For MemApi
    41 #include "memapi.h"                     // For MemApi
    43 #include "trxdefs.h"                    // For ETrx...
    42 #include "trxdefs.h"                    // For ETrx...
       
    43 #include "ape_commgrisi.h"              // For APE_COMMGR...
    44 // ISCE
    44 // ISCE
    45 
    45 
    46 // CONSTS
    46 // CONSTS
    47 DRouter* DRouter::iThisPtr = NULL;
    47 DRouter* DRouter::iThisPtr = NULL;
    48 const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
    48 const TUint32 KCommunicationManagerUID( 0x2002B3D0 );
    49 const TUint32 KNameServiceUID( 0x2002A5A1 );
    49 const TUint32 KNameServiceUID( 0x2002A5A1 );
    50 
    50 
       
    51 const TUint8 K8BitResourceId( 2 );
       
    52 const TUint8 K32BitResourceId( 5 );
       
    53 const TUint8 K32BitResourceOffsetByte1( 0 );
       
    54 const TUint8 K32BitResourceOffsetByte2( 1 );
       
    55 const TUint8 K32BitResourceOffsetByte3( 2 );
       
    56 const TUint8 K32BitResourceOffsetByte4( 3 );
       
    57 const TUint8 K8BitResourceOffset( 0 );
       
    58 const TUint8 KEventOffset32Bit( 4 );
       
    59 const TUint8 KEventOffset8Bit( 1 );
       
    60 const TUint8 KFiller( 0 );
       
    61 const TUint8 KNoResource( 0 );
    51 // TODO: change this to use UnuqueID instead and to extension..
    62 // TODO: change this to use UnuqueID instead and to extension..
    52 void DRouter::CheckDfc()
    63 void DRouter::CheckDfc()
    53 {
    64 {
    54     OstTrace0( TRACE_NORMAL, DROUTER_CHECKDFC_ENTRY, ">DRouter::CheckDfc" );
    65     OstTrace0( TRACE_NORMAL, DROUTER_CHECKDFC_ENTRY, ">DRouter::CheckDfc" );
    55 
    66 
    88     C_TRACE( ( _T( "DRouter::DRouter ->" ) ) );
    99     C_TRACE( ( _T( "DRouter::DRouter ->" ) ) );
    89     // owned
   100     // owned
    90 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
   101 #ifdef NCP_COMMON_BRIDGE_FAMILY_PIPE_SUPPORT
    91     iPipeHandler = new DPipeHandler( *this );
   102     iPipeHandler = new DPipeHandler( *this );
    92 #endif
   103 #endif
    93     iIndicationHandler = new DIndicationHandler( *this );
       
    94     iCommonRxQueue = new DQueue( KIADExtensionRxQueueSize );
   104     iCommonRxQueue = new DQueue( KIADExtensionRxQueueSize );
    95     ASSERT_RESET_ALWAYS( /*iPipeHandler &&*/ iIndicationHandler && iCommonRxQueue, EIADMemoryAllocationFailure | EIADFaultIdentifier17 << KFaultIdentifierShift );
       
    96     // Initialize channels to NULL when channel is opened !NULL.
   105     // Initialize channels to NULL when channel is opened !NULL.
    97     for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
   106     for( TInt i( 0 ); i < EIADSizeOfChannels; ++i )
    98         {
   107         {
    99         iChannelTable[ i ].iChannel = NULL;
   108         iChannelTable[ i ].iChannel = NULL;
   100         iChannelTable[ i ].iWaitingChannel = NULL;
   109         iChannelTable[ i ].iWaitingChannel = NULL;
   154         {
   163         {
   155         delete iPipeHandler;
   164         delete iPipeHandler;
   156         iPipeHandler = NULL;
   165         iPipeHandler = NULL;
   157         }
   166         }
   158 #endif
   167 #endif
   159     if( iIndicationHandler )
       
   160         {
       
   161         delete iIndicationHandler;
       
   162         iIndicationHandler = NULL;
       
   163         }
       
   164     if( iCommonRxQueue )
   168     if( iCommonRxQueue )
   165         {
   169         {
   166         delete iCommonRxQueue;
   170         delete iCommonRxQueue;
   167         iCommonRxQueue = NULL;
   171         iCommonRxQueue = NULL;
   168         }
   172         }
   521     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
   525     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
   522     msgOk = ( ( msgOk == KErrNone && ( orderLength > GetMaxDataSize() ) ) ? KErrUnderflow : msgOk );
   526     msgOk = ( ( msgOk == KErrNone && ( orderLength > GetMaxDataSize() ) ) ? KErrUnderflow : msgOk );
   523     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
   527     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
   524     if( KErrNone == msgOk )
   528     if( KErrNone == msgOk )
   525         {
   529         {
   526         msgOk = iIndicationHandler->Subscribe( anOrder, aCh, a32Bit );
   530         TInt numOfOrders( 0 );
   527         TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );
   531         if( a32Bit == EFalse )
   528         }
   532             {
   529     C_TRACE( ( _T( "DRouter::OrderIndication 0x%x 0x%x %d %d <-" ), &anOrder, aCh, a32Bit, msgOk ) );
   533             if( anOrder.Ptr()[ K8BitResourceOffset ] == KNoResource ) //Subscription remove
   530     
   534                 {
   531     OstTrace1( TRACE_NORMAL, DROUTER_ORDERINDICATION, "<DRouter::OrderIndication;msgOk=%x", msgOk );    
   535                 numOfOrders = 0x00;
       
   536                 }
       
   537             else{
       
   538                 numOfOrders = ( anOrder.Length() / K8BitResourceId );
       
   539                 }
       
   540             }
       
   541         else
       
   542             {
       
   543             if( anOrder.Ptr()[ K32BitResourceOffsetByte4 ] == KNoResource ) //Subscription remove
       
   544                 {
       
   545                 numOfOrders = 0x00;
       
   546                 }
       
   547             else{
       
   548                 numOfOrders = ( anOrder.Length() / K32BitResourceId );
       
   549                 }
       
   550             }
       
   551         TUint16 msgLength = ( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ + ( SIZE_APE_COMMGR_SUBSCRIBE_SB * numOfOrders ) );
       
   552         TDes8& desPtr = MemApi::AllocBlock( msgLength );
       
   553         desPtr.SetLength( msgLength );
       
   554         TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
       
   555         ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
       
   556         SET_RECEIVER_DEV( ptr, PN_DEV_OWN );
       
   557         SET_SENDER_DEV( ptr, PN_DEV_OWN );
       
   558         ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_APE_COMMGR;
       
   559         SET_LENGTH( ptr, ( desPtr.Length() - PN_HEADER_SIZE ) );
       
   560         SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
       
   561         SET_SENDER_OBJ( ptr, aCh );
       
   562         ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_TRANSID ] = 0x00;
       
   563         ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_MESSAGEID ] = APE_COMMGR_SUBSCRIBE_REQ;
       
   564         ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_FILLERBYTE1 ] = numOfOrders;
       
   565         ptr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_SUBBLOCKCOUNT ] = 0x00;
       
   566         TInt orderIndex( 0 );
       
   567         //TODO automatically generated ape_commgrisi.h is totally wrong and not according to the specification
       
   568         for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKID ); subBlockOffset < msgLength; subBlockOffset += SIZE_APE_COMMGR_SUBSCRIBE_SB )
       
   569             {
       
   570             ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKID ] = APE_COMMGR_SUBSCRIBE_SB;
       
   571             ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_SUBBLOCKLENGTH ] = SIZE_APE_COMMGR_SUBSCRIBE_SB;
       
   572             ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ] = PN_DEV_HOST;
       
   573             if( a32Bit == EFalse )
       
   574                 {
       
   575                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ]  = ( anOrder.Ptr()[ orderIndex + KEventOffset8Bit ] );
       
   576                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] = KFiller;
       
   577                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE2 ] = KFiller;
       
   578                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE3 ] = KFiller;
       
   579                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_MESSAGEID ]   = ( anOrder.Ptr()[ orderIndex + K8BitResourceOffset ] );
       
   580                 }
       
   581             else
       
   582                 {
       
   583                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ]  = ( anOrder.Ptr()[ orderIndex + KEventOffset32Bit ] );
       
   584                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte1 ] );
       
   585                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE2 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte2 ] );
       
   586                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE3 ] = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte3 ]) ;
       
   587                 ptr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_MESSAGEID ]   = ( anOrder.Ptr()[ orderIndex + K32BitResourceOffsetByte4 ] );
       
   588                 }
       
   589             orderIndex = ( a32Bit == EFalse ) ? orderIndex + K8BitResourceId : orderIndex + K32BitResourceId;
       
   590             }
       
   591         iCommunicationManager->Receive( desPtr );
       
   592         }
       
   593     TRACE_ASSERT_INFO( msgOk == KErrNone, (TUint8)aCh<<KChannelNumberShift );    
       
   594     C_TRACE( ( _T( "DRouter::OrderIndication order:0x%x channel:0x%x  32bit:%d msgok:%d <-" ), &anOrder, aCh, a32Bit, msgOk ) );
       
   595     OstTrace1( TRACE_NORMAL, DROUTER_ORDERINDICATION, "<DRouter::OrderIndication;msgOk=%x", msgOk );
   532     return msgOk;
   596     return msgOk;
   533     }
   597     }
   534 
   598 
   535 EXPORT_C TInt DRouter::SendMessage(
   599 EXPORT_C TInt DRouter::SendMessage(
   536         TDes8& aMessage,
   600         TDes8& aMessage,
   568                 this->DeAllocateBlock( aMessage );
   632                 this->DeAllocateBlock( aMessage );
   569                 }
   633                 }
   570             }
   634             }
   571         else
   635         else
   572             {
   636             {
   573             // Route indication to possible subscribers in this device
       
   574             if( GET_RECEIVER_OBJ( msgBlockPtr ) == PN_OBJ_EVENT_MULTICAST &&
       
   575                 IS_DEV_HOST( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] ) )
       
   576                 {
       
   577                 DATA_DUMP_TRACE( aMessage, ETrue );
       
   578                 OstTraceData( TRACE_ISIMSG, DROUTER_SENDMESSAGE_DATA, "DRouter::SendMsg indication TX: %hx", aMessage.Ptr(), aMessage.Length() );
       
   579                 C_TRACE( ( _T( "DRouter::SendMessage routing indication to device PN_DEV_SOS 0x%x" ), &aMessage ) );
       
   580                 OstTrace0( TRACE_NORMAL, DUP2_DROUTER_SENDMESSAGE, "DRouter::SendMessage indication to PN_DEV_SOS" );
       
   581                 TDes8& tmpIndication = AllocateBlock( aMessage.Length() );
       
   582                 tmpIndication.SetLength( aMessage.Length() );
       
   583                 tmpIndication.Copy( aMessage );
       
   584                 TUint8* indicationPtr = const_cast<TUint8*>( tmpIndication.Ptr() );
       
   585                 SET_RECEIVER_DEV( indicationPtr, THIS_DEVICE );
       
   586                 SET_RECEIVER_OBJ( indicationPtr, KIADEventSubscriptionObjId );
       
   587                 this->MessageReceived( tmpIndication );
       
   588                 }
       
   589             // To communicationmanager
   637             // To communicationmanager
   590             if( ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_EVENT_MULTICAST  )
   638             if( ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] == PN_OBJ_EVENT_MULTICAST  )
   591                && ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
   639                && ( msgBlockPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
   592                 {
   640                 {
   593                 C_TRACE( ( _T( "DRouter::SendMessage sending to COMMUNICATIONMANAGER>" ) ) );
   641                 C_TRACE( ( _T( "DRouter::SendMessage sending to COMMUNICATIONMANAGER>" ) ) );
   632     {
   680     {
   633 
   681 
   634     OstTraceExt2( TRACE_NORMAL, DROUTER_SENDINDICATION_ENTRY, ">DRouter::SendIndication;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
   682     OstTraceExt2( TRACE_NORMAL, DROUTER_SENDINDICATION_ENTRY, ">DRouter::SendIndication;aMessage=%x;aCh=%hx", ( TUint )&( aMessage ), aCh );
   635     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x ->" ), &aMessage, aCh ) );
   683     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x ->" ), &aMessage, aCh ) );
   636     TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
   684     TUint8* msgPtr = const_cast<TUint8*>( aMessage.Ptr() );
   637     SET_RECEIVER_DEV( msgPtr,OTHER_DEVICE_1 );
       
   638     SET_RECEIVER_OBJ( msgPtr,PN_OBJ_EVENT_MULTICAST );
   685     SET_RECEIVER_OBJ( msgPtr,PN_OBJ_EVENT_MULTICAST );
       
   686     if( GET_RECEIVER_DEV( aMessage ) != PN_DEV_OWN )
       
   687         {
       
   688         SET_RECEIVER_DEV( msgPtr, OTHER_DEVICE_1 );
       
   689         // Copy for receivers in this device -> fake event from modem
       
   690         TDes8& tmpIndication = MemApi::AllocBlock( aMessage.Length() );
       
   691         tmpIndication.SetLength( aMessage.Length() );
       
   692         tmpIndication.Copy( aMessage );
       
   693         TUint8* indicationPtr = const_cast<TUint8*>( tmpIndication.Ptr() );
       
   694         SET_SENDER_DEV( indicationPtr, PN_DEV_HOST );
       
   695         SET_RECEIVER_DEV( indicationPtr, PN_DEV_OWN );
       
   696         indicationPtr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_SOS;
       
   697         this->MessageReceived( tmpIndication );
       
   698         }
   639     TInt error( SendMessage( aMessage, aCh ) );
   699     TInt error( SendMessage( aMessage, aCh ) );
   640     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x %d <-" ), &aMessage, aCh, error ) );
   700     C_TRACE( ( _T( "DRouter::SendIndication 0x%x 0x%x %d <-" ), &aMessage, aCh, error ) );
   641     OstTrace1( TRACE_NORMAL, DROUTER_SENDINDICATION_EXIT, "<DRouter::SendIndication;error=%d", error );
   701     OstTrace1( TRACE_NORMAL, DROUTER_SENDINDICATION_EXIT, "<DRouter::SendIndication;error=%d", error );
   642     return error;
   702     return error;
   643 
   703 
   714     OstTrace1( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_ENTRY, ">DRouter::HandleIsiMessage;aMsg=%x", ( TUint )&( aMsg ) );
   774     OstTrace1( TRACE_NORMAL, DROUTER_HANDLEISIMESSAGE_ENTRY, ">DRouter::HandleIsiMessage;aMsg=%x", ( TUint )&( aMsg ) );
   715 
   775 
   716     C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x ->" ), &aMsg ) );
   776     C_TRACE( ( _T( "DRouter::HandleIsiMessage 0x%x ->" ), &aMsg ) );
   717     TUint8* msg = const_cast<TUint8*>( aMsg.Ptr() );
   777     TUint8* msg = const_cast<TUint8*>( aMsg.Ptr() );
   718     // Message from MODEM to APE, or from APE to APE. If Media SOS -> come through link. If dev OWN -> from APE nameservice
   778     // Message from MODEM to APE, or from APE to APE. If Media SOS -> come through link. If dev OWN -> from APE nameservice
   719     if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
   779     if( ( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS ) || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
   720         {
   780         {
   721         const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
   781         const TUint16 rcvObjId( GET_RECEIVER_OBJ( aMsg ) );
   722         C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
   782         C_TRACE( ( _T( "DRouter::HandleIsiMessage rcvObjId 0x%x" ), rcvObjId ) );
   723         ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier22 << KFaultIdentifierShift );
   783         ASSERT_RESET_ALWAYS( rcvObjId < EIADSizeOfChannels, EIADWrongParameter | (TUint8)rcvObjId << KChannelNumberShift | EIADFaultIdentifier22 << KFaultIdentifierShift );
   724         if( rcvObjId == PN_OBJ_ROUTER ) //TODO to channel table
   784         if( rcvObjId == PN_OBJ_ROUTER ) //TODO to channel table
   735             }
   795             }
   736         else
   796         else
   737             {
   797             {
   738             if( iChannelTable[ rcvObjId ].iChannel )
   798             if( iChannelTable[ rcvObjId ].iChannel )
   739                 {
   799                 {
   740                 iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
   800                 if( msg[ ISI_HEADER_OFFSET_RESOURCEID ] == PN_APE_COMMGR )
   741                 // DeAllocation done by the channel after writing to client's address space.
   801                     {
       
   802                     C_TRACE( ( _T( "DRouter::HandleIsiMessage to channel from COMMUNICATIONMANAGER deallocate" ) ) );
       
   803                     DeAllocateBlock( aMsg );
       
   804                     }
       
   805                 else
       
   806                     {
       
   807                     iChannelTable[ rcvObjId ].iChannel->ReceiveMsg( aMsg );
       
   808                     // DeAllocation done by the channel after writing to client's address space.
       
   809                     }
   742                 }
   810                 }
   743             else
   811             else
   744                 {
   812                 {
   745                 SendCommIsaEntityNotReachableResp( aMsg );
   813                 SendCommIsaEntityNotReachableResp( aMsg );
   746                 // Not going to anywhere deallocate.
   814                 // Not going to anywhere deallocate.
   880     C_TRACE( ( _T( "DRouter::CheckRouting 0x%x 0x%x ->" ), msg, msg[ ISI_HEADER_OFFSET_RESOURCEID ] ) );
   948     C_TRACE( ( _T( "DRouter::CheckRouting 0x%x 0x%x ->" ), msg, msg[ ISI_HEADER_OFFSET_RESOURCEID ] ) );
   881     TRoutingRule route( ENotKnownMsg );
   949     TRoutingRule route( ENotKnownMsg );
   882     // Message to symbian side (media sos).
   950     // Message to symbian side (media sos).
   883     if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS )
   951     if( msg[ ISI_HEADER_OFFSET_MEDIA ] == PN_MEDIA_SOS )
   884         {
   952         {
   885         if( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == THIS_DEVICE )
   953         if( ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == THIS_DEVICE ) || ( msg[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN ) )
   886             {
   954             {
   887             switch( msg[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] )
   955             switch( msg[ ISI_HEADER_OFFSET_RECEIVEROBJECT ] )
   888                 {
   956                 {
   889                 // Indication NOTE! INDICATION HANDLING IS STILL LEGACY
   957                 // Indication NOTE! INDICATION HANDLING IS STILL LEGACY
   890                 case KIADEventSubscriptionObjId:
   958                 case KIADEventSubscriptionObjId:
   976             aTmp.HandleMediaMessage( aMsg );
  1044             aTmp.HandleMediaMessage( aMsg );
   977             break;
  1045             break;
   978             }
  1046             }
   979         case EIndicationMsg:
  1047         case EIndicationMsg:
   980             {
  1048             {
   981             aTmp.iIndicationHandler->Multicast( aMsg );
       
   982             // De-allocate, message is multicasted to subsribers as new
  1049             // De-allocate, message is multicasted to subsribers as new
   983             // message and the original is ready to be deallocated.
  1050             // message and the original is ready to be deallocated.
   984             aTmp.DeAllocateBlock( aMsg );
  1051             aTmp.DeAllocateBlock( aMsg );
   985             break;
  1052             break;
   986             }
  1053             }
  1075     // Filler
  1142     // Filler
  1076     tempPtr.Append( 0x00 );
  1143     tempPtr.Append( 0x00 );
  1077     // Filler
  1144     // Filler
  1078     tempPtr.Append( 0x00 );
  1145     tempPtr.Append( 0x00 );
  1079 
  1146 
  1080 //    ASSERT_RESET_ALWAYS( iConnectionStatus == EIADConnectionOk, EIADCmtConnectionLost | EIADFaultIdentifier2 << KFaultIdentifierShift );
       
  1081     if( msgTmpPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN )
  1147     if( msgTmpPtr[ ISI_HEADER_OFFSET_RECEIVERDEVICE ] == PN_DEV_OWN )
  1082         {
  1148         {
  1083         MessageReceived( *reinterpret_cast<TDes8*>( const_cast<TDesC8*>(&aMsg) ) );
  1149         MessageReceived( tempPtr );
  1084         }
  1150         }
  1085     else
  1151     else
  1086         {
  1152         {
  1087         SendMsg( tempPtr );
  1153         SendMsg( tempPtr );
  1088         }
  1154         }
  1316     }
  1382     }
  1317 
  1383 
  1318 //From objectapi
  1384 //From objectapi
  1319 EXPORT_C MISIObjectRouterIf* MISIObjectRouterIf::Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterObjectIf* aCallback )
  1385 EXPORT_C MISIObjectRouterIf* MISIObjectRouterIf::Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterObjectIf* aCallback )
  1320     {
  1386     {
  1321     C_TRACE( ( _T( "MISIObjectRouterIf::Connect %d 0x%x 0x%x>" ), aUID, aObjId, aCallback ) );
  1387     C_TRACE( ( _T( "MISIObjectRouterIf::Connect  %d 0x%x 0x%x>" ), aUID, aObjId, aCallback ) );
       
  1388     Kern::Printf( "IADRouter::Connect" );
  1322     //Connect( aUID, aObjId, aCallback );
  1389     //Connect( aUID, aObjId, aCallback );
  1323     if( aUID == KNameServiceUID )
  1390     if( aUID == KNameServiceUID )
  1324         {
  1391         {
  1325         C_TRACE( ( _T( "MISIObjectRouterIf was nameservice" ) ) );
  1392         C_TRACE( ( _T( "MISIObjectRouterIf was nameservice" ) ) );
  1326         DRouter::iThisPtr->iNameService = aCallback;
  1393         DRouter::iThisPtr->iNameService = aCallback;
  1342     }
  1409     }
  1343 
  1410 
  1344 TInt DRouter::Send( TDes8& aMessage, const TUint8 aObjId )
  1411 TInt DRouter::Send( TDes8& aMessage, const TUint8 aObjId )
  1345     {
  1412     {
  1346   	C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x>" ), &aMessage, aObjId ) );
  1413   	C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x>" ), &aMessage, aObjId ) );
       
  1414     Kern::Printf( "IADRouter::Send" );
  1347     if( aObjId == PN_OBJ_EVENT_MULTICAST ) //from communicationmanager
  1415     if( aObjId == PN_OBJ_EVENT_MULTICAST ) //from communicationmanager
  1348         {
  1416         {
  1349         // Don't put to mainrxqueue
  1417         // Don't put to mainrxqueue
  1350         HandleIsiMessage( aMessage );
  1418         HandleIsiMessage( aMessage );
  1351         }
  1419         }
  1355         }
  1423         }
  1356     C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x<" ), &aMessage, aObjId ) );
  1424     C_TRACE( ( _T( "DRouter::Send objectapi 0x%x 0x%x<" ), &aMessage, aObjId ) );
  1357   	return KErrNone;
  1425   	return KErrNone;
  1358     }
  1426     }
  1359 
  1427 
       
  1428 TDfcQue* DRouter::GetDfcThread(
       
  1429         const TISIDfcQThreadType // aType
       
  1430         )
       
  1431     {
       
  1432     C_TRACE( ( _T( "DRouter::GetDfcThread<>" ) ) );  
       
  1433     Kern::Printf( "IADRouter::GetDfcThread" );
       
  1434     return DIsaAccessExtension::GetDFCThread( EIADExtensionDfcQueue );
       
  1435     //ASSERT_RESET_ALWAYS( 0, -1003 );
       
  1436     //return NULL;
       
  1437     }
       
  1438 
       
  1439 void DRouter::FreeDfcThread( TDfcQue* aThread )
       
  1440     {
       
  1441     C_TRACE( ( _T( "DRouter::FreeDfcThread 0x%x>" ), aThread ) );
       
  1442     Kern::Printf( "IADRouter::FreeDfcThread" );
       
  1443     ASSERT_RESET_ALWAYS( 0, -1002 );
       
  1444     }
  1360 // End of file.
  1445 // End of file.
  1361 
  1446