connectivitylayer/isce/isicommunicationmanager_dll/src/isiindicationhandler.cpp
changeset 7 fa67e03b87df
parent 5 8ccc39f9d787
child 9 8486d82aef45
equal deleted inserted replaced
6:942573423a60 7:fa67e03b87df
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <iscnokiadefinitions.h>
       
    19 #include <pn_eventmodem_extisi.h>         // PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_...
    18 #include <pn_eventmodem_extisi.h>         // PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_...
    20 #include <phonetisi.h>                    // For ISI_HEADER_SIZE
    19 #include <phonetisi.h>                    // For ISI_HEADER_SIZE
    21 #include <pn_const.h>                     // For PN_HEADER_SIZE
    20 #include <pn_const.h>                     // For PN_HEADER_SIZE
    22 #include "isiindicationhandler.h"         // For DISIIndicationHandler
    21 #include "isiindicationhandler.h"         // For DISIIndicationHandler
    23 #include "isicommunicationmanagertrace.h" // For C_TRACE..
    22 #include "isicommunicationmanagertrace.h" // For C_TRACE..
    24 #include "misiobjectrouterif.h"           // For DISICommunicationManager
    23 #include "misiobjectrouterif.h"           // For DISICommunicationManager
    25 #include "memapi.h"                       // For MemApi
    24 #include "memapi.h"                       // For MemApi
       
    25 #ifdef INTERNAL_FLAG_ISI_ROUTER_IN_USE
       
    26 #include "isihelpers.h"                   // For SET_RECEIVER_OBJ...
       
    27 #else
    26 #include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
    28 #include "iadhelpers.h"                   // For SET_RECEIVER_OBJ...
       
    29 #endif
    27 #include "nsisi.h"                        // For PN_MEDIA_ROUTING_REQ
    30 #include "nsisi.h"                        // For PN_MEDIA_ROUTING_REQ
    28 #include "ape_commgrisi.h"                // For APE_COMMGR..
    31 #include "ape_commgrisi.h"                // For APE_COMMGR..
    29 
    32 #include <iscnokiadefinitions.h>
    30 
    33 
    31 /* PUTB8 macro writes byte value to given address.
    34 /* PUTB8 macro writes byte value to given address.
    32  * This macro is used mainly by other PUTBXX macros.
    35  * This macro is used mainly by other PUTBXX macros.
    33  */
    36  */
    34 #define PUTB8(p,v) \
    37 #define PUTB8(p,v) \
    71     (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
    74     (((TUint16) GETB8(p)<<8) | (TUint16) GETB8((TUint8 *)(p)+1))
    72 
    75 
    73 #define GETB32(p) \
    76 #define GETB32(p) \
    74     (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
    77     (((TUint32) GETB16(p)<<16) | (TUint32) GETB16((TUint8 *)(p)+2))
    75 
    78 
       
    79 const TUint8 KMaxAmountOfResources( 255 );
       
    80 const TUint8 KPnsSubscribedResourcesExtendLength( 12 );
       
    81 const TUint8 KResourceArraySize( 4 );
       
    82 
    76 // Faults
    83 // Faults
    77 enum TISIIndincationHandlerFaults
    84 enum TISIIndincationHandlerFaults
    78     {
    85     {
    79     EISIIndicationHandlerWrongParameter = 0x01,
    86     EISIIndicationHandlerWrongParameter = 0x01,
    80     EISIIndicationHandlerMemAllocFailure,
    87     EISIIndicationHandlerMemAllocFailure,
    81     EISIIndicationHandlerMemAllocFailure1,
    88     EISIIndicationHandlerMemAllocFailure1,
    82     EISIIndicationHandlerMemAllocFailure2,
    89     EISIIndicationHandlerMemAllocFailure2,
    83     EISIIndicationHandlerMemAllocFailure3,
    90     EISIIndicationHandlerMemAllocFailure3,
       
    91     EISIIndicationHandlerMemAllocFailure4,
       
    92     EISIIndicationHandlerMemAllocFailure5,
       
    93     EISIIndicationHandlerQueNULLPointer,
       
    94     EISIIndicationHandlerQueNULLPointer1,
       
    95     EISIIndicationHandlerQueNULLPointer2,
       
    96     EISIIndicationHandlerQueNULLPointer3,
       
    97     EISIIndicationHandlerQueNULLPointer4,
       
    98     EISIIndicationHandlerQueNULLPointer5,
       
    99     EISIIndicationHandlerQueNULLPointer6,
       
   100     EISIIndicationHandlerQueNULLPointer7,
       
   101     EISIIndicationHandlerQueNULLPointer8,
       
   102     EISIIndicationHandlerQueNULLPointer9,
       
   103     EISIIndicationHandlerQueNULLPointer10,
       
   104     EISIIndicationHandlerQueNULLPointer11,
       
   105     EISIIndicationHandlerQueNULLPointer12,
       
   106     EISIIndicationHandlerQueNULLPointer13,
       
   107     EISIIndicationHandlerQueNULLPointer14,
       
   108     EISIIndicationHandlerQueNULLPointer15,
       
   109     EISIIndicationHandlerQueNULLPointer16,
       
   110     EISIIndicationHandlerQueNULLPointer17,
       
   111     EISIIndicationHandlerQueNULLPointer18,
       
   112     EISIIndicationHandlerQueNULLPointer19,
       
   113     EISIIndicationHandlerQueNULLPointer20,
       
   114     EISIIndicationHandlerQueNULLPointer21,
       
   115     EISIIndicationHandlerQueNULLPointer22,
       
   116     EISIIndicationHandlerQueNULLPointer23
    84     };
   117     };
    85 
   118 
    86 
   119 
    87 // -----------------------------------------------------------------------------
   120 // -----------------------------------------------------------------------------
    88 // DISIIndicationHandler::
   121 // DISIIndicationHandler::
   125     TSubscriberLink*    subscriberLink = NULL;
   158     TSubscriberLink*    subscriberLink = NULL;
   126     
   159     
   127     while( deviceAnchor != next )
   160     while( deviceAnchor != next )
   128         {
   161         {
   129         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   162         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   163         ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer1 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   130         C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler device: 0x%x"), deviceLink->iDeviceId ) );
   164         C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler device: 0x%x"), deviceLink->iDeviceId ) );
   131         serverAnchor = &deviceLink->iServerQ.iA;
   165         serverAnchor = &deviceLink->iServerQ.iA;
   132         serverNext = serverAnchor->iNext;
   166         serverNext = serverAnchor->iNext;
   133         while( serverAnchor != serverNext )
   167         while( serverAnchor != serverNext )
   134             {
   168             {
   135             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
   169             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
       
   170             ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer2 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   136             indicationAnchor = &serverLink->iIndicationQ.iA;
   171             indicationAnchor = &serverLink->iIndicationQ.iA;
   137             indicationNext = indicationAnchor->iNext;
   172             indicationNext = indicationAnchor->iNext;
   138             while( indicationAnchor != indicationNext )
   173             while( indicationAnchor != indicationNext )
   139                 {
   174                 {
   140                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
   175                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
       
   176                 ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer3 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   141                 C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler indication: 0x%x"), indicationLink->iIndication ));
   177                 C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler indication: 0x%x"), indicationLink->iIndication ));
   142                 // get next link already in case if particular link is to be deleted
   178                 // get next link already in case if particular link is to be deleted
   143                 indicationNext = indicationNext->iNext;
   179                 indicationNext = indicationNext->iNext;
   144                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   180                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   145                 subscriberNext = subscriberAnchor->iNext;
   181                 subscriberNext = subscriberAnchor->iNext;
   146                 while( subscriberAnchor != subscriberNext )
   182                 while( subscriberAnchor != subscriberNext )
   147                     {
   183                     {
   148                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
   184                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
       
   185                     ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer4 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   149                     C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler subscriber: 0x%x"), subscriberLink->iObjId ));
   186                     C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler subscriber: 0x%x"), subscriberLink->iObjId ));
   150                     TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
   187                     TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
   151                     subscriberLink->iSubscriberLink.Deque();
   188                     subscriberLink->iSubscriberLink.Deque();
   152                     delete subscriberLink;
   189                     delete subscriberLink;
   153                     subscriberLink = NULL;
   190                     subscriberLink = NULL;
   193 // -----------------------------------------------------------------------------
   230 // -----------------------------------------------------------------------------
   194 // DISIIndicationHandler::Subscribe
   231 // DISIIndicationHandler::Subscribe
   195 //
   232 //
   196 // -----------------------------------------------------------------------------
   233 // -----------------------------------------------------------------------------
   197 //
   234 //
   198 TInt DISIIndicationHandler::Subscribe(
   235 void DISIIndicationHandler::Subscribe(
   199         TDes8& aSubscriptionReq
   236         TDes8& aSubscriptionReq
   200         )
   237         )
   201     {
   238     {
   202     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe 0x%x>" ), &aSubscriptionReq ) );
   239     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe 0x%x>" ), &aSubscriptionReq ) );
   203     
   240     
   204     TUint8* msgPtr( const_cast<TUint8*>( aSubscriptionReq.Ptr() ) );
   241     TUint8* msgPtr( const_cast<TUint8*>( aSubscriptionReq.Ptr() ) );
   205     
   242     TInt msgLength( aSubscriptionReq.Length() );
   206     TInt msgLength( aSubscriptionReq.Length() ); 
       
   207     TUint32 resourceId( 0 );
   243     TUint32 resourceId( 0 );
   208     TUint8 deviceId( 0 );
   244     TUint8 deviceId( 0 );
   209     TUint8 indication( 0 );
       
   210     TUint16 objId( 0 );
   245     TUint16 objId( 0 );
   211       
   246           
   212     objId = msgPtr[ ISI_HEADER_OFFSET_SENDEROBJECT ];
   247     objId = GET_SENDER_OBJ( aSubscriptionReq );
   213     RemoveSubscription( objId );
   248     RemoveSubscription( objId );
   214     for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ ); subBlockOffset < msgLength; subBlockOffset += ( SIZE_APE_COMMGR_SUBSCRIBE_SB ) )
   249 
   215         {
   250     if( msgPtr[ ISI_HEADER_OFFSET_SENDERDEVICE ] == PN_DEV_OWN )
   216         deviceId = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ];
   251         {            
   217         resourceId = GETB32( &msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] ); //resource offset
   252         //If any subblocks
   218         indication = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ];
   253         if( msgPtr[ ISI_HEADER_SIZE + APE_COMMGR_SUBSCRIBE_REQ_OFFSET_FILLERBYTE1 ] != 0 )
   219         C_TRACE( ( _T("DISIIndicationHandler indication 0x%x objId 0x%x resource 0x%x device 0x%x"), indication, objId, resourceId, deviceId ) );
   254             {
   220         TDeviceIdLink* deviceLink = GetDeviceLink( deviceId );
   255             TUint8 indication( 0 );
   221         if( !deviceLink )
   256             for( TInt subBlockOffset( ISI_HEADER_SIZE + SIZE_APE_COMMGR_SUBSCRIBE_REQ ); subBlockOffset < msgLength; subBlockOffset += ( SIZE_APE_COMMGR_SUBSCRIBE_SB ) )
   222             {
   257                 {
   223             C_TRACE( ( _T("DISIIndicationHandler::Subscribe device not found yet -> create: 0x%x"), deviceId ) );
   258                 deviceId = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_DEVICEID ];
   224             deviceLink = new TDeviceIdLink();
   259                 resourceId = GETB32( &msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_FILLERBYTE1 ] ); //resource offset
   225             ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   260                 indication = msgPtr[ subBlockOffset + APE_COMMGR_SUBSCRIBE_SB_OFFSET_RESOURCEID ];
   226             deviceLink->iDeviceId = deviceId;
   261                 C_TRACE( ( _T("DISIIndicationHandler indication 0x%x objId 0x%x resource 0x%x device 0x%x"), indication, objId, resourceId, deviceId ) );
   227             iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
   262                 TDeviceIdLink* deviceLink = GetDeviceLink( deviceId );
   228             }
   263                 if( !deviceLink )
   229         AddServer( *deviceLink, resourceId, indication, objId );
   264                     {
   230         }
   265                     C_TRACE( ( _T("DISIIndicationHandler::Subscribe device not found yet -> create: 0x%x"), deviceId ) );
   231         
   266                     deviceLink = new TDeviceIdLink();
       
   267                     ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   268                     deviceLink->iDeviceId = deviceId;
       
   269                     iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
       
   270                     }
       
   271                 AddServer( *deviceLink, resourceId, indication, objId );
       
   272                 }
       
   273             }
   232 #ifdef _DEBUG
   274 #ifdef _DEBUG
   233 #ifdef COMPONENT_TRACE_FLAG
   275 #ifdef COMPONENT_TRACE_FLAG
   234     PrintSubscriptions();
   276         PrintSubscriptions();
   235 #endif // COMPONENT_TRACE_FLAG
   277 #endif // COMPONENT_TRACE_FLAG
   236 #endif // _DEBUG
   278 #endif // _DEBUG
   237     
   279     
   238     TDeviceIdLink* deviceLink = NULL;
   280         TDeviceIdLink* deviceLink = NULL;
   239     SDblQueLink* anchor = &iDeviceQ.iA;
   281         SDblQueLink* anchor = &iDeviceQ.iA;
   240     SDblQueLink* next = anchor->iNext;
   282         SDblQueLink* next = anchor->iNext;
   241     while( anchor != next )
   283         while( anchor != next )
   242         {
   284             {
   243         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   285             deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   244         C_TRACE( ( _T("DISIIndicationHandler::Subscribe device: 0x%x"), deviceLink->iDeviceId ) );
   286             ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer5 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   245         if( deviceLink->iDeviceId != PN_DEV_OWN )
   287             C_TRACE( ( _T("DISIIndicationHandler::Subscribe device: 0x%x"), deviceLink->iDeviceId ) );
   246             {
   288             if( deviceLink->iDeviceId != PN_DEV_OWN )
   247             C_TRACE( ( _T("DISIIndicationHandler::Subscribe send subscription to device: 0x%x"), deviceLink->iDeviceId ) );
   289                 {
   248             SendSubscription( *deviceLink );
   290                 C_TRACE( ( _T("DISIIndicationHandler::Subscribe send subscription to device: 0x%x"), deviceLink->iDeviceId ) );
   249             }
   291                 SendSubscription( *deviceLink );
   250         next = next->iNext;
   292                 }
       
   293             next = next->iNext;
       
   294             }
       
   295         }
       
   296     else
       
   297         {
       
   298         deviceId = GET_SENDER_DEV( aSubscriptionReq );
       
   299         TDeviceIdLink* deviceLink = GetExternalDeviceLink( deviceId );
       
   300         if( !deviceLink )
       
   301             {
       
   302             C_TRACE( ( _T("DISIIndicationHandler::Subscribe external device not found yet -> create: 0x%x"), deviceId ) );
       
   303             deviceLink = new TDeviceIdLink();
       
   304             ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerMemAllocFailure4 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   305             deviceLink->iDeviceId = deviceId;
       
   306             iDeviceQ.Add( &( deviceLink->iDeviceLink ) );
       
   307             }
       
   308         else
       
   309             {
       
   310             SDblQueLink* serverAnchor = NULL;
       
   311             SDblQueLink* serverNext = NULL;
       
   312             TServerIdLink* serverLink = NULL;
       
   313             serverAnchor = &deviceLink->iServerQ.iA;
       
   314             serverNext = serverAnchor->iNext;
       
   315             while( serverAnchor != serverNext )
       
   316                 {
       
   317                 serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
       
   318                 ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer6 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   319                 C_TRACE( ( _T("DISIIndicationHandler::~DISIIndicationHandler remove server: 0x%x"), serverLink->iResourceId ));
       
   320                 serverLink->iServerLink.Deque();
       
   321                 delete serverLink;
       
   322                 serverLink = NULL;
       
   323                 serverNext = serverNext->iNext;           
       
   324                 }
       
   325             }
       
   326         for( TInt subBlockOffset( ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST );
       
   327             subBlockOffset < msgLength; subBlockOffset += KResourceArraySize )
       
   328             {
       
   329             resourceId = GETB32( &msgPtr[ subBlockOffset ] );
       
   330             C_TRACE( ( _T("DISIIndicationHandler resource 0x%x device 0x%x"), resourceId, deviceId ) );
       
   331             AddServer( *deviceLink, resourceId );
       
   332             }
   251         }
   333         }
   252     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe<" ) ) );
   334     C_TRACE( ( _T( "DISIIndicationHandler::Subscribe<" ) ) );
   253     return KErrNone;
       
   254     }
   335     }
   255 
   336 
   256 
   337 
   257 // -----------------------------------------------------------------------------
   338 // -----------------------------------------------------------------------------
   258 // DISIIndicationHandler::AddServer
   339 // DISIIndicationHandler::AddServer
   278         aDeviceLink.iServerQ.Add( &( serverLink->iServerLink ) );
   359         aDeviceLink.iServerQ.Add( &( serverLink->iServerLink ) );
   279         }
   360         }
   280     AddIndication( *serverLink, aIndication, aObjId );
   361     AddIndication( *serverLink, aIndication, aObjId );
   281     C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x 0x%x 0x%x<" ), &aDeviceLink, aResourceId, aIndication, aObjId ) );
   362     C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x 0x%x 0x%x<" ), &aDeviceLink, aResourceId, aIndication, aObjId ) );
   282     }
   363     }
       
   364     
       
   365 
       
   366 // -----------------------------------------------------------------------------
       
   367 // DISIIndicationHandler::AddServer
       
   368 //
       
   369 // -----------------------------------------------------------------------------
       
   370 //
       
   371 void DISIIndicationHandler::AddServer(
       
   372         TDeviceIdLink& aDeviceLink,
       
   373         const TUint32 aResourceId
       
   374         )
       
   375     {
       
   376     C_TRACE( ( _T( "DISIIndicationHandler::AddServer external 0x%x 0x%x>" ), &aDeviceLink, aResourceId ) );
       
   377     TServerIdLink* serverLink = GetServerLink( aDeviceLink, aResourceId );
       
   378     if( !serverLink )
       
   379         {
       
   380         C_TRACE( ( _T("DISIIndicationHandler::AddServer external resource: 0x%x not found, create"), aResourceId ));
       
   381         serverLink = new TServerIdLink();
       
   382         ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerMemAllocFailure5 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   383         serverLink->iResourceId = aResourceId;
       
   384         aDeviceLink.iServerQ.Add( &( serverLink->iServerLink ) );
       
   385         }
       
   386     C_TRACE( ( _T( "DISIIndicationHandler::AddServer 0x%x 0x%x<" ), &aDeviceLink, aResourceId ) );
       
   387     }
       
   388 
   283 
   389 
   284 // -----------------------------------------------------------------------------
   390 // -----------------------------------------------------------------------------
   285 // DISIIndicationHandler::AddIndication
   391 // DISIIndicationHandler::AddIndication
   286 //
   392 //
   287 // -----------------------------------------------------------------------------
   393 // -----------------------------------------------------------------------------
   349     SDblQueLink* anchor = &iDeviceQ.iA;
   455     SDblQueLink* anchor = &iDeviceQ.iA;
   350     SDblQueLink* next = anchor->iNext;
   456     SDblQueLink* next = anchor->iNext;
   351     while( anchor != next )
   457     while( anchor != next )
   352         {
   458         {
   353         tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   459         tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   460         ASSERT_RESET_ALWAYS( tmpDeviceLink, ( EISIIndicationHandlerQueNULLPointer7 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   354         C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
   461         C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
   355         if( tmpDeviceLink->iDeviceId == aDeviceId )
   462         if( tmpDeviceLink->iDeviceId == aDeviceId )
   356             {
   463             {
   357             deviceLink = tmpDeviceLink;
   464             deviceLink = tmpDeviceLink;
   358             break;
   465             break;
   361         }
   468         }
   362     C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink 0x%x <-" ), deviceLink ) );
   469     C_TRACE( ( _T( "DISIIndicationHandler::GetDeviceLink 0x%x <-" ), deviceLink ) );
   363     return deviceLink;
   470     return deviceLink;
   364     }
   471     }
   365 
   472 
       
   473 // -----------------------------------------------------------------------------
       
   474 // DISIIndicationHandler::GetExternalDeviceLink
       
   475 //
       
   476 // -----------------------------------------------------------------------------
       
   477 //
       
   478 DISIIndicationHandler::TDeviceIdLink* DISIIndicationHandler::GetExternalDeviceLink(
       
   479         const TUint8 aDeviceId
       
   480         )
       
   481     {
       
   482     C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink 0x%x ->" ), aDeviceId ) );
       
   483     TDeviceIdLink* deviceLink = NULL;
       
   484     TDeviceIdLink* tmpDeviceLink = NULL;
       
   485     SDblQueLink* anchor = &iExternalDeviceQ.iA;
       
   486     SDblQueLink* next = anchor->iNext;
       
   487     while( anchor != next )
       
   488         {
       
   489         tmpDeviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   490         ASSERT_RESET_ALWAYS( tmpDeviceLink, ( EISIIndicationHandlerQueNULLPointer8 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   491         C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink device: 0x%x"), tmpDeviceLink->iDeviceId ) );
       
   492         if( tmpDeviceLink->iDeviceId == aDeviceId )
       
   493             {
       
   494             deviceLink = tmpDeviceLink;
       
   495             break;
       
   496             }
       
   497         next = next->iNext;
       
   498         }
       
   499     C_TRACE( ( _T( "DISIIndicationHandler::GetExternalDeviceLink 0x%x <-" ), deviceLink ) );
       
   500     return deviceLink;
       
   501     }
   366 
   502 
   367 // -----------------------------------------------------------------------------
   503 // -----------------------------------------------------------------------------
   368 // DISIIndicationHandler::GetServerLink
   504 // DISIIndicationHandler::GetServerLink
   369 //
   505 //
   370 // -----------------------------------------------------------------------------
   506 // -----------------------------------------------------------------------------
   381     SDblQueLink* anchor = &aDeviceLink.iServerQ.iA;
   517     SDblQueLink* anchor = &aDeviceLink.iServerQ.iA;
   382     SDblQueLink* next = anchor->iNext;
   518     SDblQueLink* next = anchor->iNext;
   383     while( anchor != next ) // servers
   519     while( anchor != next ) // servers
   384         {
   520         {
   385         tmpServerLink = _LOFF( next, TServerIdLink, iServerLink );
   521         tmpServerLink = _LOFF( next, TServerIdLink, iServerLink );
       
   522         ASSERT_RESET_ALWAYS( tmpServerLink, ( EISIIndicationHandlerQueNULLPointer9 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   386         C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink server: 0x%x"), tmpServerLink->iResourceId ) );
   523         C_TRACE( ( _T( "DISIIndicationHandler::GetServerLink server: 0x%x"), tmpServerLink->iResourceId ) );
   387         if( tmpServerLink->iResourceId == aResourceId )
   524         if( tmpServerLink->iResourceId == aResourceId )
   388             {
   525             {
   389             serverLink = tmpServerLink;
   526             serverLink = tmpServerLink;
   390             break;
   527             break;
   412     SDblQueLink* anchor = &aServerLink.iIndicationQ.iA;
   549     SDblQueLink* anchor = &aServerLink.iIndicationQ.iA;
   413     SDblQueLink* next = anchor->iNext;
   550     SDblQueLink* next = anchor->iNext;
   414     while( anchor != next )
   551     while( anchor != next )
   415         {
   552         {
   416         tmpIndicationLink = _LOFF( next, TIndicationLink, iIndicationLink );
   553         tmpIndicationLink = _LOFF( next, TIndicationLink, iIndicationLink );
       
   554         ASSERT_RESET_ALWAYS( tmpIndicationLink, ( EISIIndicationHandlerQueNULLPointer10 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   417         if( tmpIndicationLink->iIndication == aIndication )
   555         if( tmpIndicationLink->iIndication == aIndication )
   418             {
   556             {
   419             indicationLink = tmpIndicationLink;
   557             indicationLink = tmpIndicationLink;
   420             break;
   558             break;
   421             }
   559             }
   440     TSubscriberLink* subscriberLink = NULL;
   578     TSubscriberLink* subscriberLink = NULL;
   441     SDblQueLink* anchor = &aIndicationLink.iSubscriberQ.iA;
   579     SDblQueLink* anchor = &aIndicationLink.iSubscriberQ.iA;
   442     SDblQueLink* next = anchor->iNext;
   580     SDblQueLink* next = anchor->iNext;
   443     while( anchor != next )
   581     while( anchor != next )
   444         {
   582         {
   445         tmpSubscriberLink= _LOFF( next, TSubscriberLink, iSubscriberLink );
   583         tmpSubscriberLink = _LOFF( next, TSubscriberLink, iSubscriberLink );
       
   584         ASSERT_RESET_ALWAYS( tmpSubscriberLink, ( EISIIndicationHandlerQueNULLPointer11 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   446         if ( tmpSubscriberLink->iObjId == aObjId )
   585         if ( tmpSubscriberLink->iObjId == aObjId )
   447             {
   586             {
   448             subscriberLink = tmpSubscriberLink;
   587             subscriberLink = tmpSubscriberLink;
   449             break;
   588             break;
   450             }
   589             }
   477     SDblQueLink* subscriberNext = NULL;
   616     SDblQueLink* subscriberNext = NULL;
   478     TSubscriberLink* subscriberLink = NULL;
   617     TSubscriberLink* subscriberLink = NULL;
   479     while( anchor != next )
   618     while( anchor != next )
   480         {
   619         {
   481         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   620         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   621         ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer12 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   482         C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions device: 0x%x"), deviceLink->iDeviceId ) );
   622         C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions device: 0x%x"), deviceLink->iDeviceId ) );
   483         serverAnchor = &deviceLink->iServerQ.iA;
   623         serverAnchor = &deviceLink->iServerQ.iA;
   484         serverNext = serverAnchor->iNext;
   624         serverNext = serverAnchor->iNext;
   485         while( serverAnchor != serverNext )
   625         while( serverAnchor != serverNext )
   486             {
   626             {
   487             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
   627             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
       
   628             ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer13 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   488             C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions server: 0x%x"), serverLink->iResourceId ) );
   629             C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions server: 0x%x"), serverLink->iResourceId ) );
   489             indicationAnchor = &serverLink->iIndicationQ.iA;
   630             indicationAnchor = &serverLink->iIndicationQ.iA;
   490             indicationNext = indicationAnchor->iNext;
   631             indicationNext = indicationAnchor->iNext;
   491             while( indicationAnchor != indicationNext )
   632             while( indicationAnchor != indicationNext )
   492                 {
   633                 {
   493                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
   634                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
       
   635                 ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer14 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   494                 C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions indication: 0x%x"), indicationLink->iIndication ) );
   636                 C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions indication: 0x%x"), indicationLink->iIndication ) );
   495                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   637                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   496                 subscriberNext = subscriberAnchor->iNext;
   638                 subscriberNext = subscriberAnchor->iNext;
   497                 while( subscriberAnchor != subscriberNext)
   639                 while( subscriberAnchor != subscriberNext )
   498                     {
   640                     {
   499                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
   641                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
   500                     subscriberLink = subscriberLink;
   642                     ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer15 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   501                     C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions objid: 0x%x"), subscriberLink->iObjId ) );
   643                     C_TRACE( ( _T("DISIIndicationHandler::PrintSubscriptions objid: 0x%x"), subscriberLink->iObjId ) );
   502                     subscriberNext = subscriberNext->iNext;
   644                     subscriberNext = subscriberNext->iNext;
   503                     }
   645                     }
   504                 indicationNext = indicationNext->iNext;
   646                 indicationNext = indicationNext->iNext;
   505                 }
   647                 }
   538     TSubscriberLink*    subscriberLink = NULL;
   680     TSubscriberLink*    subscriberLink = NULL;
   539 
   681 
   540     while( deviceAnchor != next )
   682     while( deviceAnchor != next )
   541         {
   683         {
   542         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
   684         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   685         ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer16 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   543         C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription device: 0x%x"), deviceLink->iDeviceId ) );
   686         C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription device: 0x%x"), deviceLink->iDeviceId ) );
   544         serverAnchor = &deviceLink->iServerQ.iA;
   687         serverAnchor = &deviceLink->iServerQ.iA;
   545         serverNext = serverAnchor->iNext;
   688         serverNext = serverAnchor->iNext;
   546         while( serverAnchor != serverNext )
   689         while( serverAnchor != serverNext )
   547             {
   690             {
   548             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
   691             serverLink = _LOFF( serverNext, TServerIdLink, iServerLink );
       
   692             ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer17 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   549             indicationAnchor = &serverLink->iIndicationQ.iA;
   693             indicationAnchor = &serverLink->iIndicationQ.iA;
   550             indicationNext = indicationAnchor->iNext;
   694             indicationNext = indicationAnchor->iNext;
   551             while( indicationAnchor != indicationNext )
   695             while( indicationAnchor != indicationNext )
   552                 {
   696                 {
   553                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
   697                 indicationLink = _LOFF( indicationNext, TIndicationLink, iIndicationLink );
       
   698                 ASSERT_RESET_ALWAYS( indicationLink, ( EISIIndicationHandlerQueNULLPointer18 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   554                 C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription indication: 0x%x"), indicationLink->iIndication ));
   699                 C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription indication: 0x%x"), indicationLink->iIndication ));
   555                 // get next link already in case if particular link is to be deleted
   700                 // get next link already in case if particular link is to be deleted
   556                 indicationNext = indicationNext->iNext;
   701                 indicationNext = indicationNext->iNext;
   557                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   702                 subscriberAnchor = &indicationLink->iSubscriberQ.iA;
   558                 subscriberNext = subscriberAnchor->iNext;
   703                 subscriberNext = subscriberAnchor->iNext;
   559                 while( subscriberAnchor != subscriberNext )
   704                 while( subscriberAnchor != subscriberNext )
   560                     {
   705                     {
   561                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
   706                     subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
       
   707                     ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer19 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   562                     C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription objid: 0x%x"), subscriberLink->iObjId ));
   708                     C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription objid: 0x%x"), subscriberLink->iObjId ));
   563                     if( subscriberLink->iObjId == aObjId )
   709                     if( subscriberLink->iObjId == aObjId )
   564                         {
   710                         {
   565                         C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove objid: 0x%x"), subscriberLink->iObjId ));
   711                         C_TRACE( ( _T("DISIIndicationHandler::RemoveSubscription remove objid: 0x%x"), subscriberLink->iObjId ));
   566                         TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
   712                         TBool onlySubscriber( subscriberLink->iSubscriberLink.Alone() );
   609         }
   755         }
   610     C_TRACE( ( _T( "DISIIndicationHandler::RemoveSubscription 0x%x<" ), aObjId ) );
   756     C_TRACE( ( _T( "DISIIndicationHandler::RemoveSubscription 0x%x<" ), aObjId ) );
   611     }
   757     }
   612 
   758 
   613 // -----------------------------------------------------------------------------
   759 // -----------------------------------------------------------------------------
       
   760 // DIndicationHandler::
       
   761 //
       
   762 // -----------------------------------------------------------------------------
       
   763 //
       
   764 void DISIIndicationHandler::Multicast(
       
   765         TDes8& aIndication
       
   766         )
       
   767     {
       
   768     C_TRACE( ( _T( "DISIIndicationHandler::Multicast 0x%x ->" ), &aIndication ) );
       
   769 
       
   770     TUint8* ptr = const_cast<TUint8*>( aIndication.Ptr() );
       
   771 
       
   772     TDeviceIdLink* deviceLink = NULL;
       
   773     SDblQueLink* anchor = &iDeviceQ.iA;
       
   774     SDblQueLink* next = anchor->iNext;
       
   775     while( anchor != next )
       
   776         {
       
   777         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   778         ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer20 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   779         C_TRACE( ( _T("DISIIndicationHandler::Multicast device: 0x%x"), deviceLink->iDeviceId ) );
       
   780         TServerIdLink* serverLink = GetServerLink( *deviceLink, ptr[ ISI_HEADER_OFFSET_RESOURCEID ] );
       
   781         TIndicationLink* indicationLink = NULL;
       
   782         TSubscriberLink* subscriberLink = NULL;
       
   783         if( serverLink )
       
   784             {
       
   785             indicationLink = GetIndicationLink( *serverLink, ptr[ ISI_HEADER_OFFSET_MESSAGEID ] );
       
   786             }
       
   787         if( indicationLink )
       
   788             {
       
   789             SDblQueLink* subscriberAnchor = NULL;
       
   790             SDblQueLink* subscriberNext = NULL;
       
   791             subscriberAnchor = &indicationLink->iSubscriberQ.iA;
       
   792             subscriberNext = subscriberAnchor->iNext;
       
   793             while( subscriberAnchor != subscriberNext )
       
   794                 {
       
   795                 subscriberLink = _LOFF( subscriberNext, TSubscriberLink, iSubscriberLink );
       
   796                 ASSERT_RESET_ALWAYS( subscriberLink, ( EISIIndicationHandlerQueNULLPointer21 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   797                 C_TRACE( ( _T("DISIIndicationHandler::Multicast Subscriber objid: 0x%x"), subscriberLink->iObjId ));
       
   798                 // Make a copy to every subscriber
       
   799                 TDes8& tempPtr = MemApi::AllocBlock( aIndication.Length() );
       
   800                 tempPtr.Copy( ptr, aIndication.Length() );
       
   801                 TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
       
   802                 SET_RECEIVER_OBJ( ptr, subscriberLink->iObjId );
       
   803                 iRouter->Send( tempPtr, PN_OBJ_EVENT_MULTICAST );
       
   804                 subscriberNext = subscriberNext->iNext;
       
   805                 }
       
   806             }
       
   807         next = next->iNext;
       
   808         }
       
   809     deviceLink = NULL;
       
   810     anchor = &iExternalDeviceQ.iA;
       
   811     next = anchor->iNext;
       
   812     while( anchor != next )
       
   813         {
       
   814         deviceLink = _LOFF( next, TDeviceIdLink, iDeviceLink );
       
   815         ASSERT_RESET_ALWAYS( deviceLink, ( EISIIndicationHandlerQueNULLPointer22 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
       
   816         C_TRACE( ( _T("DISIIndicationHandler::Multicast external device: 0x%x"), deviceLink->iDeviceId ) );
       
   817         TServerIdLink* serverLink = GetServerLink( *deviceLink, ptr[ ISI_HEADER_OFFSET_RESOURCEID ] );
       
   818         if( serverLink )
       
   819             {
       
   820             C_TRACE( ( _T("DISIIndicationHandler::Multicast resource: 0x%x"), serverLink->iResourceId ));
       
   821             // Make a copy to every external subscriber
       
   822             TDes8& tempPtr = MemApi::AllocBlock( aIndication.Length() );
       
   823             tempPtr.Copy( ptr, aIndication.Length() );
       
   824             TUint8* ptr = const_cast<TUint8*>( tempPtr.Ptr() );
       
   825             SET_RECEIVER_DEV( tempPtr, deviceLink->iDeviceId );
       
   826             tempPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = ptr[ ISI_HEADER_OFFSET_RESOURCEID ];
       
   827             SET_RECEIVER_OBJ( tempPtr, PN_OBJ_EVENT_MULTICAST );
       
   828             SET_SENDER_OBJ( tempPtr, ptr[ ISI_HEADER_OFFSET_SENDEROBJECT ] );
       
   829             iRouter->Send( tempPtr, PN_OBJ_EVENT_MULTICAST );
       
   830             }
       
   831         next = next->iNext;
       
   832         }    
       
   833     C_TRACE( ( _T( "DISIIndicationHandler::Multicast 0x%x <-" ), &aIndication ) );
       
   834     }
       
   835 
       
   836 
       
   837 
       
   838 // -----------------------------------------------------------------------------
   614 // DISIIndicationHandler::SendSubscription
   839 // DISIIndicationHandler::SendSubscription
   615 //
   840 //
   616 // -----------------------------------------------------------------------------
   841 // -----------------------------------------------------------------------------
   617 //
   842 //
   618 TInt DISIIndicationHandler::SendSubscription( TDeviceIdLink& aDevice )
   843 void DISIIndicationHandler::SendSubscription( TDeviceIdLink& aDevice )
   619     {
   844     {
   620     C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription>" ) ) );
   845     C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription>" ) ) );    
   621     const TUint8 KMaxAmountOfResources( 255 );
       
   622     const TUint8 KPnsSubscribedResourcesExtendLength( 12 );
       
   623     const TUint8 KResourceArraySize( 4 );
       
   624     
       
   625     TDes8& desPtr = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_PNS_SUBSCRIBED_RESOURCES_EXTEND_IND + ( KMaxAmountOfResources * KResourceArraySize ) );
   846     TDes8& desPtr = MemApi::AllocBlock( ISI_HEADER_SIZE + SIZE_PNS_SUBSCRIBED_RESOURCES_EXTEND_IND + ( KMaxAmountOfResources * KResourceArraySize ) );
   626 
   847 
   627     TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
   848     TUint8* ptr( const_cast<TUint8*>( desPtr.Ptr() ) );
   628     ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
   849     ptr[ ISI_HEADER_OFFSET_MEDIA ] = PN_MEDIA_ROUTING_REQ;
   629     SET_RECEIVER_DEV( ptr, aDevice.iDeviceId );
   850     // TODO a bug? SET_RECEIVER_DEV( ptr, aDevice.iDeviceId );
   630     SET_SENDER_DEV( ptr, PN_DEV_OWN );
   851 #ifdef NCP_COMMON_BRIDGE_FAMILY
       
   852     SET_SENDER_DEV( ptr, PN_DEV_HOST );
       
   853 		SET_RECEIVER_DEV( ptr, PN_DEV_MODEM );    
       
   854 #else
       
   855     SET_SENDER_DEV( ptr, PN_DEV_SOS );
       
   856 		SET_RECEIVER_DEV( ptr, PN_DEV_HOST );
       
   857 #endif    
   631     ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_COMMGR;
   858     ptr[ ISI_HEADER_OFFSET_RESOURCEID ] = PN_COMMGR;
   632     SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
   859     SET_RECEIVER_OBJ( ptr, PN_OBJ_ROUTER );
   633     SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
   860     SET_SENDER_OBJ( ptr, PN_OBJ_EVENT_MULTICAST );
   634     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_TRANSACTIONID ] = 0x00;
   861     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_TRANSACTIONID ] = 0x00;
   635     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_MESSAGEID ] = PNS_SUBSCRIBED_RESOURCES_EXTEND_IND;
   862     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_MESSAGEID ] = PNS_SUBSCRIBED_RESOURCES_EXTEND_IND;
   641 
   868 
   642     TUint8 resourceCount( 0x00 );
   869     TUint8 resourceCount( 0x00 );
   643     while( anchor != next )
   870     while( anchor != next )
   644         {
   871         {
   645         serverLink = _LOFF( next, TServerIdLink, iServerLink );
   872         serverLink = _LOFF( next, TServerIdLink, iServerLink );
       
   873         ASSERT_RESET_ALWAYS( serverLink, ( EISIIndicationHandlerQueNULLPointer23 | EDISIIndicationHandlerTraceId << KClassIdentifierShift ) );
   646         TUint32 resourceId = serverLink->iResourceId;
   874         TUint32 resourceId = serverLink->iResourceId;
   647         C_TRACE( ( _T("DISIIndicationHandler::SendSubscription Server: 0x%08x"), resourceId ) );
   875         C_TRACE( ( _T("DISIIndicationHandler::SendSubscription Server: 0x%08x"), resourceId ) );
   648         PUTB32( &ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST ], resourceId );
   876         PUTB32( &ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCELIST + ( resourceCount * KResourceArraySize ) ], resourceId );
   649         resourceCount++;
   877         resourceCount++;
   650         next = next->iNext;
   878         next = next->iNext;
   651         }
   879         }
   652     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCECOUNT ] = resourceCount;
   880     ptr[ ISI_HEADER_SIZE + PNS_SUBSCRIBED_RESOURCES_EXTEND_IND_OFFSET_RESOURCECOUNT ] = resourceCount;
   653     TInt messageLength( ( resourceCount * KResourceArraySize ) + KPnsSubscribedResourcesExtendLength );
   881     TInt messageLength( ( resourceCount * KResourceArraySize ) + KPnsSubscribedResourcesExtendLength );
   654     while( messageLength % 4 != 0 )
       
   655         {
       
   656         TRACE_ASSERT_INFO(0, messageLength);
       
   657         messageLength++;
       
   658         }
       
   659     desPtr.SetLength( messageLength );
   882     desPtr.SetLength( messageLength );
   660     SET_LENGTH( ptr, messageLength - PN_HEADER_SIZE );
   883     SET_LENGTH( ptr, messageLength - PN_HEADER_SIZE );
   661       
   884     iRouter->Send( desPtr, PN_OBJ_EVENT_MULTICAST );
   662     for( TInt i( 0 ); i < desPtr.Length(); i++ )
       
   663         {
       
   664         C_TRACE( ( _T( "index[ %d ] data 0x%x"), i, desPtr.Ptr()[i] ) );
       
   665         }
       
   666     TInt error = iRouter->Send( desPtr, PN_OBJ_EVENT_MULTICAST );
       
   667     C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription<" ) ) );  
   885     C_TRACE( ( _T( "DISIIndicationHandler::SendSubscription<" ) ) );  
   668     return error;
       
   669     }
   886     }
   670 
   887 
   671 // End of file.
   888 // End of file.
   672 
   889