atext/server/src/atextmetadata.cpp
changeset 1 b4a7eebaaebf
parent 0 29b1cd4cb562
child 12 9b6d3ca0c601
equal deleted inserted replaced
0:29b1cd4cb562 1:b4a7eebaaebf
    19 /*
    19 /*
    20  * Here is the plugin managing logic for the AT commands and hopefully also for
    20  * Here is the plugin managing logic for the AT commands and hopefully also for
    21  * future needs:
    21  * future needs:
    22  *
    22  *
    23  * Three types of support:
    23  * Three types of support:
    24  * 1) Master (M): Does not send to S if support found.
    24  * 1) Master (M): Sends to all O if support found. Panics if > 1 M.
    25  * 2) Primary (P): Sends to all S if support found.
    25  * 2) Partial (P): Sends to all O if support found. Replies "ERROR" if two P supports.
    26  * 3) Secondary (S): Process the command and give or not give reply, based on
    26  * 3) Observer (O): Process the command and give or not give reply, based on
    27  *    the following logic:
    27  *    the following logic:
    28  *
    28  *
    29  * => [If] M found, handle command and send reply, stop, [else]
    29  * => [If] M found, handle command and send reply + send to N O {no reply}, stop, [else]
    30  * [If] P found, handle command and send reply + send to N S {no reply}, stop, [else]
    30  * [If] P found, handle command and send reply + send to N O {no reply}, stop, [else]
    31  * [If] > 1 S found, send to N S {no reply}, stop, [else]
    31  * [If] > 1 O found, send to N O {no reply}, stop, [else]
    32  * [If] only 1 S found, handle command and send reply, stop, [else]
    32  * [If] only 1 O found, handle command and send reply, stop, [else]
    33  * Write "ERROR" to client, complete message with KErrNone
    33  * Write "ERROR" to client, complete message with KErrNone
    34  *
    34  *
    35  * When incoming reply:
    35  * When incoming reply:
    36  * => If reply from M, write to client, stop, [else]
    36  * => If reply from M, write to client, stop, [else]
    37  * If reply from P, write to client, stop, [else]
    37  * If reply from P, write to client, stop, [else]
    38  * If reply from S and M, P nor other S exist, write to client, stop, [else]
    38  * If reply from O and M, P nor other O exist, write to client, stop, [else]
    39  * Complete message with KErrNone and empty string
    39  * Complete message with KErrNone and empty string
    40  *
    40  *
    41  * Note: Empty string and "ERROR" string are managed already in HandleCommand()
    41  * Note: Empty string and "ERROR" string are managed already in HandleCommand()
    42  */
    42  */
    43 
    43 
  1357         {
  1357         {
  1358         case 'M':  // Master plugin
  1358         case 'M':  // Master plugin
  1359         case 'm':
  1359         case 'm':
  1360             aSupportType = ESupportTypeMaster;
  1360             aSupportType = ESupportTypeMaster;
  1361             break;
  1361             break;
  1362         case 'P':  // Primary plugin
  1362         case 'P':  // Partial plugin
  1363         case 'p':
  1363         case 'p':
  1364             aSupportType = ESupportTypePrimary;
  1364             aSupportType = ESupportTypePartial;
  1365             break;
  1365             break;
  1366         case 'S':  // Secondary plugin
  1366         case 'O':  // Observer plugin
  1367         case 's':
  1367         case 'o':
  1368             aSupportType = ESupportTypeSecondary;
  1368             aSupportType = ESupportTypeObserver;
  1369             break;
  1369             break;
       
  1370         default:
       
  1371             _LIT( KPluginType, "PluginType" );
       
  1372             User::Panic( KPluginType, EPanicCategoryPluginType );
  1370         }
  1373         }
  1371     i++;
  1374     i++;
  1372     if ( i >= count )
  1375     if ( i >= count )
  1373         {
  1376         {
  1374         TRACE_FUNC_EXIT
  1377         TRACE_FUNC_EXIT
  1517             retVal = AddNewMasterMetadataEntryLinkL( aEntries,
  1520             retVal = AddNewMasterMetadataEntryLinkL( aEntries,
  1518                                                      aSearchHelper,
  1521                                                      aSearchHelper,
  1519                                                      oneCmdSupport );
  1522                                                      oneCmdSupport );
  1520             }
  1523             }
  1521             break;
  1524             break;
  1522         case ESupportTypePrimary:
  1525         case ESupportTypePartial:
  1523             {
  1526             {
  1524             retVal = AddNewPrimaryMetadataEntryLinkL( aEntries,
  1527             retVal = AddNewPartialMetadataEntryLinkL( aEntries,
  1525                                                       aSearchHelper,
  1528                                                       aSearchHelper,
  1526                                                       oneCmdSupport );
  1529                                                       oneCmdSupport );
  1527             }
  1530             }
  1528             break;
  1531             break;
  1529         case ESupportTypeSecondary:
  1532         case ESupportTypeObserver:
  1530             {
  1533             {
  1531             retVal = AddNewSecondaryMetadataEntryLinkL( aEntries,
  1534             retVal = AddNewObserverMetadataEntryLinkL( aEntries,
  1532                                                         aSearchHelper,
  1535                                                        aSearchHelper,
  1533                                                         oneCmdSupport );
  1536                                                        oneCmdSupport );
  1534             }
  1537             }
  1535             break;
  1538             break;
  1536         default:
  1539         default:
  1537             {
  1540             {
  1538             User::Leave( KErrNotSupported );
  1541             User::Leave( KErrNotSupported );
  1550     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1553     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1551     TATExtSearchHelper& aSearchHelper,
  1554     TATExtSearchHelper& aSearchHelper,
  1552     TATExtOneCmdSupport& aOneCmdSupport )
  1555     TATExtOneCmdSupport& aOneCmdSupport )
  1553     {
  1556     {
  1554     TRACE_FUNC_ENTRY
  1557     TRACE_FUNC_ENTRY
       
  1558     if ( aEntries->Count() > 0 )
       
  1559         {
       
  1560         TATExtOneCmdSupport& oneCmdSupport = (*aEntries)[0];
       
  1561         if ( oneCmdSupport.iSupportType == ESupportTypeMaster )
       
  1562             {
       
  1563             _LIT( KFaultyMaster, "FaultyMaster" );
       
  1564             User::Panic( KFaultyMaster, EPanicCategoryFaultyMaster );
       
  1565             }
       
  1566         }
  1555     aEntries->InsertL( 0, aOneCmdSupport );
  1567     aEntries->InsertL( 0, aOneCmdSupport );
  1556     if ( aSearchHelper.iPrimaryIndex >= 0 )
  1568     if ( aSearchHelper.iPartialIndex >= 0 )
  1557        {
  1569        {
  1558         aSearchHelper.iPrimaryIndex++;
  1570         aSearchHelper.iPartialIndex++;
  1559         }
  1571         }
  1560     if ( aSearchHelper.iSecondaryIndex >= 0 )
  1572     if ( aSearchHelper.iObserverIndex >= 0 )
  1561         {
  1573         {
  1562         aSearchHelper.iSecondaryIndex++;
  1574         aSearchHelper.iObserverIndex++;
  1563         }
  1575         }
  1564     TRACE_FUNC_EXIT
  1576     TRACE_FUNC_EXIT
  1565     return 0;
  1577     return 0;
  1566     }
  1578     }
  1567 
  1579 
  1568 // ---------------------------------------------------------------------------
  1580 // ---------------------------------------------------------------------------
  1569 // Adds new primary plugin entry link from plugin support entry to plugin
  1581 // Adds new partial plugin entry link from plugin support entry to plugin
  1570 // entry
  1582 // entry
  1571 // ---------------------------------------------------------------------------
  1583 // ---------------------------------------------------------------------------
  1572 //
  1584 //
  1573 TInt CATExtMetadata::AddNewPrimaryMetadataEntryLinkL(
  1585 TInt CATExtMetadata::AddNewPartialMetadataEntryLinkL(
  1574     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1586     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1575     TATExtSearchHelper& aSearchHelper,
  1587     TATExtSearchHelper& aSearchHelper,
  1576     TATExtOneCmdSupport& aOneCmdSupport )
  1588     TATExtOneCmdSupport& aOneCmdSupport )
  1577     {
  1589     {
  1578     TRACE_FUNC_ENTRY
  1590     TRACE_FUNC_ENTRY
  1579     TInt i = aSearchHelper.iPrimaryIndex;
  1591     TInt i = aSearchHelper.iPartialIndex;
  1580     if ( i < 0 )
  1592     if ( i < 0 )
  1581         {
  1593         {
  1582         TInt count = aEntries->Count();
  1594         TInt count = aEntries->Count();
  1583         for ( i=0; i<count; i++ )
  1595         for ( i=0; i<count; i++ )
  1584             {
  1596             {
  1585             TATExtOneCmdSupport& oneCmdSupport = (*aEntries)[i];
  1597             TATExtOneCmdSupport& oneCmdSupport = (*aEntries)[i];
  1586             if ( oneCmdSupport.iSupportType==ESupportTypePrimary ||
  1598             if ( oneCmdSupport.iSupportType==ESupportTypePartial ||
  1587                  oneCmdSupport.iSupportType==ESupportTypeSecondary )
  1599                  oneCmdSupport.iSupportType==ESupportTypeObserver )
  1588                 {
  1600                 {
  1589                 break;
  1601                 break;
  1590                 }
  1602                 }
  1591             }
  1603             }
  1592         aSearchHelper.iPrimaryIndex = i;
  1604         aSearchHelper.iPartialIndex = i;
  1593         }
  1605         }
  1594     aEntries->InsertL( i, aOneCmdSupport );
  1606     aEntries->InsertL( i, aOneCmdSupport );
  1595     if ( aSearchHelper.iSecondaryIndex >= 0 )
  1607     if ( aSearchHelper.iObserverIndex >= 0 )
  1596         {
  1608         {
  1597         aSearchHelper.iSecondaryIndex++;
  1609         aSearchHelper.iObserverIndex++;
  1598         }
  1610         }
  1599     TRACE_FUNC_EXIT
  1611     TRACE_FUNC_EXIT
  1600     return i;
  1612     return i;
  1601     }
  1613     }
  1602 
  1614 
  1603 // ---------------------------------------------------------------------------
  1615 // ---------------------------------------------------------------------------
  1604 // Adds new secondary plugin entry link from plugin support entry to plugin
  1616 // Adds new observer plugin entry link from plugin support entry to plugin
  1605 // entry. Search starts from the front as there could be multiple S plugins
  1617 // entry. Search starts from the front as there could be multiple O plugins
  1606 // but only one or two M/P plugins.
  1618 // but only one or two M/P plugins.
  1607 // ---------------------------------------------------------------------------
  1619 // ---------------------------------------------------------------------------
  1608 //
  1620 //
  1609 TInt CATExtMetadata::AddNewSecondaryMetadataEntryLinkL(
  1621 TInt CATExtMetadata::AddNewObserverMetadataEntryLinkL(
  1610     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1622     CArrayFixFlat<TATExtOneCmdSupport>* aEntries,
  1611     TATExtSearchHelper& aSearchHelper,
  1623     TATExtSearchHelper& aSearchHelper,
  1612     TATExtOneCmdSupport& aOneCmdSupport )
  1624     TATExtOneCmdSupport& aOneCmdSupport )
  1613     {
  1625     {
  1614     TRACE_FUNC_ENTRY
  1626     TRACE_FUNC_ENTRY
  1615     TInt i = aSearchHelper.iSecondaryIndex;
  1627     TInt i = aSearchHelper.iObserverIndex;
  1616     if ( i < 0 )
  1628     if ( i < 0 )
  1617         {
  1629         {
  1618         TInt count = aEntries->Count();
  1630         TInt count = aEntries->Count();
  1619         for ( i=0; i<count; i++ )
  1631         for ( i=0; i<count; i++ )
  1620             {
  1632             {
  1621             TATExtOneCmdSupport& oneCmdSupport = (*aEntries)[i];
  1633             TATExtOneCmdSupport& oneCmdSupport = (*aEntries)[i];
  1622             if ( oneCmdSupport.iSupportType == ESupportTypeSecondary )
  1634             if ( oneCmdSupport.iSupportType == ESupportTypeObserver )
  1623                 {
  1635                 {
  1624                 break;
  1636                 break;
  1625                 }
  1637                 }
  1626             }
  1638             }
  1627         aSearchHelper.iSecondaryIndex = i;
  1639         aSearchHelper.iObserverIndex = i;
  1628         }
  1640         }
  1629     aEntries->InsertL( i, aOneCmdSupport );
  1641     aEntries->InsertL( i, aOneCmdSupport );
  1630     TRACE_FUNC_EXIT
  1642     TRACE_FUNC_EXIT
  1631     return i;
  1643     return i;
  1632     }
  1644     }
  1972         TBool supported = EFalse;
  1984         TBool supported = EFalse;
  1973         TATExtOneCmdSupport& oneCmdSupport = (*support)[i];
  1985         TATExtOneCmdSupport& oneCmdSupport = (*support)[i];
  1974         entrySupport.iEntry = &(*iPluginData)[oneCmdSupport.iEntryIndex];
  1986         entrySupport.iEntry = &(*iPluginData)[oneCmdSupport.iEntryIndex];
  1975         if ( oneCmdSupport.iSupportType == ESupportTypeMaster )
  1987         if ( oneCmdSupport.iSupportType == ESupportTypeMaster )
  1976             {
  1988             {
  1977             supported = HandleMasterPluginSupportL(
  1989             supported = HandleMasterAndPartialPluginSupportL(
  1978                 entrySupport,
       
  1979                 aComplInfo.iReplyExpected );
       
  1980             }
       
  1981         else if ( oneCmdSupport.iSupportType == ESupportTypePrimary )
       
  1982             {
       
  1983             supported = HandlePrimaryPluginSupportL(
       
  1984                 entrySupport,
  1990                 entrySupport,
  1985                 i+1,
  1991                 i+1,
  1986                 aComplInfo.iReplyExpected );
  1992                 aComplInfo.iReplyExpected );
  1987             }
  1993             }
  1988         else if ( oneCmdSupport.iSupportType == ESupportTypeSecondary )
  1994         else if ( oneCmdSupport.iSupportType == ESupportTypePartial )
  1989             {
  1995             {
  1990             supported = HandleSecondaryPluginSupportL(
  1996             supported = FindExclusivePartialSupportL( entrySupport );
       
  1997             if ( !supported )
       
  1998                 {
       
  1999                 break;
       
  2000                 }
       
  2001             supported = HandleMasterAndPartialPluginSupportL(
       
  2002                 entrySupport,
       
  2003                 i+1,
       
  2004                 aComplInfo.iReplyExpected );
       
  2005             }
       
  2006         else if ( oneCmdSupport.iSupportType == ESupportTypeObserver )
       
  2007             {
       
  2008             supported = HandleObserverPluginSupportL(
  1991                 entrySupport,
  2009                 entrySupport,
  1992                 i+1,
  2010                 i+1,
  1993                 aComplInfo.iReplyExpected );
  2011                 aComplInfo.iReplyExpected );
  1994             }
  2012             }
  1995         if ( supported )
  2013         if ( supported )
  2020     iCmdData.iHandler = NULL;
  2038     iCmdData.iHandler = NULL;
  2021     TRACE_FUNC_EXIT
  2039     TRACE_FUNC_EXIT
  2022     }
  2040     }
  2023 
  2041 
  2024 // ---------------------------------------------------------------------------
  2042 // ---------------------------------------------------------------------------
  2025 // Handles support when a master plugin is detected in the plugin data via
  2043 // Handles support when a master or partial plugin is detected in the plugin
  2026 // support data's link (support for a full AT command). If a master plugin is
  2044 // data via support data's link. If a partial or master plugin is detected
  2027 // detected then reply is detected from that plugin. No further sending to
  2045 // then reply is expected from that plugin. Also if one or more observer
  2028 // primary or secondary plugins is repformed.
  2046 // plugins are detected then no reply is expected from them.
  2029 // ---------------------------------------------------------------------------
  2047 // ---------------------------------------------------------------------------
  2030 //
  2048 //
  2031 TBool CATExtMetadata::HandleMasterPluginSupportL(
  2049 TBool CATExtMetadata::HandleMasterAndPartialPluginSupportL(
  2032     TATExtEntrySupport& aEntrySupport,
       
  2033     TBool& aReplyExpected )
       
  2034     {
       
  2035     TRACE_FUNC_ENTRY
       
  2036     aReplyExpected = EFalse;
       
  2037     TBool supported = HandleCommandSupportL( aEntrySupport );
       
  2038     if ( !supported )
       
  2039         {
       
  2040         TRACE_FUNC_EXIT
       
  2041         return EFalse;
       
  2042         }
       
  2043     iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
       
  2044     HandleCommandL( aEntrySupport, ETrue );
       
  2045     aReplyExpected = ETrue;
       
  2046     TRACE_FUNC_EXIT
       
  2047     return ETrue;
       
  2048     }
       
  2049 
       
  2050 // ---------------------------------------------------------------------------
       
  2051 // Handles support when a primary plugin is detect in the plugin data via
       
  2052 // support data's link. If a primary plugin is detected then reply is expected
       
  2053 // from that plugin. Also if one or more secondary plugins are detected then
       
  2054 // no reply is expected from them.
       
  2055 // ---------------------------------------------------------------------------
       
  2056 //
       
  2057 TBool CATExtMetadata::HandlePrimaryPluginSupportL(
       
  2058     TATExtEntrySupport& aEntrySupport,
  2050     TATExtEntrySupport& aEntrySupport,
  2059     TInt aStartIndex,
  2051     TInt aStartIndex,
  2060     TBool& aReplyExpected )
  2052     TBool& aReplyExpected )
  2061     {
  2053     {
  2062     TRACE_FUNC_ENTRY
  2054     TRACE_FUNC_ENTRY
  2063     aReplyExpected = EFalse;
  2055     aReplyExpected = EFalse;
  2064     TBool supported = HandleCommandSupportL( aEntrySupport );
  2056     if ( !aEntrySupport.iSupportFound )
  2065     if ( !supported )
  2057         {
  2066         {
  2058         TBool supported = HandleCommandSupportL( aEntrySupport );
  2067         TRACE_FUNC_EXIT
  2059         if ( !supported )
  2068         return EFalse;
  2060             {
       
  2061             TRACE_FUNC_EXIT
       
  2062             return EFalse;
       
  2063             }
  2069         }
  2064         }
  2070     // If HandleCommand() is implemented synchronously, the command must be
  2065     // If HandleCommand() is implemented synchronously, the command must be
  2071     // saved before executing as CompleteCommandMessage() closes the string
  2066     // saved before executing as CompleteCommandMessage() closes the string
  2072     HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() );
  2067     HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() );
  2073     TPtr8 atCmdFullPtr = atCmdFull->Des();
  2068     TPtr8 atCmdFullPtr = atCmdFull->Des();
  2074     atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
  2069     atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
  2075     // Now execute the HandleCommand()
  2070     // Now execute the HandleCommand()
  2076     iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
  2071     iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
  2077     HandleCommandL( aEntrySupport, ETrue );
  2072     HandleCommandL( aEntrySupport, ETrue );
  2078     aEntrySupport.iStartIndex = aStartIndex;
  2073     aEntrySupport.iStartIndex = aStartIndex;
  2079     SendToMultipleSecondaryL( aEntrySupport, atCmdFull );
  2074     SendToMultipleObserverL( aEntrySupport, atCmdFull );
  2080     CleanupStack::PopAndDestroy( atCmdFull );
  2075     CleanupStack::PopAndDestroy( atCmdFull );
  2081     aReplyExpected = ETrue;
  2076     aReplyExpected = ETrue;
  2082     TRACE_FUNC_EXIT
  2077     TRACE_FUNC_EXIT
  2083     return ETrue;
  2078     return ETrue;
  2084     }
  2079     }
  2085 
  2080 
  2086 // ---------------------------------------------------------------------------
  2081 // ---------------------------------------------------------------------------
  2087 // Handles support when a secondary plugin is detected in the plugin data via
  2082 // Handles support when a observer plugin is detected in the plugin data via
  2088 // support data's link. If only one secondary plugin is detected then reply is
  2083 // support data's link. If only one observer plugin is detected then reply is
  2089 // expected from that plugin. Instead, if more than one secondary plugins are
  2084 // expected from that plugin. Instead, if more than one observer plugins are
  2090 // detected then no reply is expected from them.
  2085 // detected then no reply is expected from them.
  2091 // ---------------------------------------------------------------------------
  2086 // ---------------------------------------------------------------------------
  2092 //
  2087 //
  2093 TBool CATExtMetadata::HandleSecondaryPluginSupportL(
  2088 TBool CATExtMetadata::HandleObserverPluginSupportL(
  2094     TATExtEntrySupport& aEntrySupport,
  2089     TATExtEntrySupport& aEntrySupport,
  2095     TInt aStartIndex,
  2090     TInt aStartIndex,
  2096     TBool& aReplyExpected )
  2091     TBool& aReplyExpected )
  2097     {
  2092     {
  2098     TRACE_FUNC_ENTRY
  2093     TRACE_FUNC_ENTRY
  2099     aReplyExpected = EFalse;
  2094     aReplyExpected = EFalse;
  2100     TBool supported = HandleCommandSupportL( aEntrySupport );
  2095     if ( !aEntrySupport.iSupportFound )
  2101     if ( !supported )
  2096         {
  2102         {
  2097         TBool supported = HandleCommandSupportL( aEntrySupport );
  2103         TRACE_FUNC_EXIT
  2098         if ( !supported )
  2104         return EFalse;
  2099             {
       
  2100             TRACE_FUNC_EXIT
       
  2101             return EFalse;
       
  2102             }
  2105         }
  2103         }
  2106     TATExtEntrySupport nextSupport = aEntrySupport;
  2104     TATExtEntrySupport nextSupport = aEntrySupport;
  2107     nextSupport.iStartIndex = aStartIndex;
  2105     nextSupport.iStartIndex = aStartIndex;
  2108     TBool entryFound = FindFirstSecondarySupportL( nextSupport );
  2106     TBool entryFound = FindFirstObserverSupportL( nextSupport );
  2109     if ( entryFound )
  2107     if ( entryFound )
  2110         {
  2108         {
  2111         // Entry found; send all without reply request
  2109         // Entry found; send all without reply request
  2112         // If HandleCommand() is implemented synchronously, the command must be
  2110         // If HandleCommand() is implemented synchronously, the command must be
  2113         // saved before executing as CompleteCommandMessage() closes the string
  2111         // saved before executing as CompleteCommandMessage() closes the string
  2114         HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() );
  2112         HBufC8* atCmdFull = HBufC8::NewMaxLC( aEntrySupport.iAtCmdFull.Length() );
  2115         TPtr8 atCmdFullPtr = atCmdFull->Des();
  2113         TPtr8 atCmdFullPtr = atCmdFull->Des();
  2116         atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
  2114         atCmdFullPtr.Copy( aEntrySupport.iAtCmdFull );
  2117         // Now execute the HandleCommand()
  2115         // Now execute the HandleCommand()
  2118         HandleCommandL( aEntrySupport, EFalse );
  2116         HandleCommandL( aEntrySupport, EFalse );
  2119         SendToMultipleSecondaryL( nextSupport, atCmdFull );
  2117         SendToMultipleObserverL( nextSupport, atCmdFull );
  2120         CleanupStack::PopAndDestroy( atCmdFull );
  2118         CleanupStack::PopAndDestroy( atCmdFull );
  2121         }
  2119         }
  2122     else
  2120     else
  2123         {
  2121         {
  2124         // No entry found; send one with reply request
  2122         // No entry found; send one with reply request
  2125         iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
  2123         iCmdData.iReplyExpected = ETrue;  // Set before HandleCommandL()
  2126         HandleCommandL( aEntrySupport, ETrue );
  2124         HandleCommandL( aEntrySupport, ETrue );
  2127         aReplyExpected = ETrue;
  2125         aReplyExpected = ETrue;
       
  2126         }
       
  2127     TRACE_FUNC_EXIT
       
  2128     return ETrue;
       
  2129     }
       
  2130 
       
  2131 // ---------------------------------------------------------------------------
       
  2132 // Finds exclusive partial plugin support
       
  2133 // ---------------------------------------------------------------------------
       
  2134 //
       
  2135 TBool CATExtMetadata::FindExclusivePartialSupportL(
       
  2136     TATExtEntrySupport& aEntrySupport )
       
  2137     {
       
  2138     TRACE_FUNC_ENTRY
       
  2139     TInt i;
       
  2140     TInt supports;
       
  2141     TInt count = aEntrySupport.iSupport->Count();
       
  2142     for ( i=0,supports=0; i<count; i++ )
       
  2143         {
       
  2144         TATExtOneCmdSupport& oneCmdSupport = (*aEntrySupport.iSupport)[i];
       
  2145         if ( oneCmdSupport.iSupportType == ESupportTypePartial )
       
  2146             {
       
  2147             aEntrySupport.iSupportFound = EFalse;
       
  2148             aEntrySupport.iEntry = &(*iPluginData)[oneCmdSupport.iEntryIndex];
       
  2149             TBool supported = HandleCommandSupportL( aEntrySupport );
       
  2150             if ( supported )
       
  2151                 {
       
  2152                 aEntrySupport.iSupportFound = ETrue;
       
  2153                 supports++;
       
  2154                 }
       
  2155             if ( supports != 1 )
       
  2156                 {
       
  2157                 TRACE_FUNC_EXIT
       
  2158                 return EFalse;
       
  2159                 }
       
  2160             }
  2128         }
  2161         }
  2129     TRACE_FUNC_EXIT
  2162     TRACE_FUNC_EXIT
  2130     return ETrue;
  2163     return ETrue;
  2131     }
  2164     }
  2132 
  2165 
  2169                                       searchHelper );
  2202                                       searchHelper );
  2170             }
  2203             }
  2171         }
  2204         }
  2172     // Now, as the normal data was inserted *before* the auxiliary data, the
  2205     // Now, as the normal data was inserted *before* the auxiliary data, the
  2173     // auxiliary data is in front of the created "support" array for each M, P
  2206     // auxiliary data is in front of the created "support" array for each M, P
  2174     // and S entry. This insertion is faster than the other way around as there
  2207     // and O entry. This insertion is faster than the other way around as there
  2175     // can be multiple S plugins for the same command but usually much less
  2208     // can be multiple O plugins for the same command but usually much less
  2176     // auxiliary entries for the same command.
  2209     // auxiliary entries for the same command.
  2177 #if defined(_DEBUG) && defined( PRJ_PRINT_SUPPORT_DATA )
  2210 #if defined(_DEBUG) && defined( PRJ_PRINT_SUPPORT_DATA )
  2178     PrintFoundEntries( support );
  2211     PrintFoundEntries( support );
  2179 #endif
  2212 #endif
  2180     if ( support->Count() > 0 )
  2213     if ( support->Count() > 0 )
  2288         {
  2321         {
  2289         iCmdData.iCmdStarted = ETrue;
  2322         iCmdData.iCmdStarted = ETrue;
  2290         iCmdData.iCmdMessage = aEntrySupport.iMessage;
  2323         iCmdData.iCmdMessage = aEntrySupport.iMessage;
  2291         iCmdData.iHandler = aEntrySupport.iEntry;
  2324         iCmdData.iHandler = aEntrySupport.iEntry;
  2292         }
  2325         }
  2293     // No "else" here as HandleCommandL() is used also with secondary plugins
  2326     // No "else" here as HandleCommandL() is used also with observer plugins
  2294     if ( !aAtCmdFull )
  2327     if ( !aAtCmdFull )
  2295         {
  2328         {
  2296         TRACE_INFO(( _L8("Handling command '%S' for UID:0x%08X, aReplyNeeded=%d..."), &iCmdData.iCmdBuffer, aEntrySupport.iEntry->iPluginUid, aReplyNeeded ));
  2329         TRACE_INFO(( _L8("Handling command '%S' for UID:0x%08X, aReplyNeeded=%d..."), &iCmdData.iCmdBuffer, aEntrySupport.iEntry->iPluginUid, aReplyNeeded ));
  2297         aEntrySupport.iEntry->iInstance->HandleCommand(
  2330         aEntrySupport.iEntry->iInstance->HandleCommand(
  2298             iCmdData.iCmdBuffer,
  2331             iCmdData.iCmdBuffer,
  2309         }
  2342         }
  2310     TRACE_FUNC_EXIT
  2343     TRACE_FUNC_EXIT
  2311     }
  2344     }
  2312 
  2345 
  2313 // ---------------------------------------------------------------------------
  2346 // ---------------------------------------------------------------------------
  2314 // Sends an AT commands to multiple secondary plugins, starting from a given
  2347 // Sends an AT commands to multiple observer plugins, starting from a given
  2315 // position.
  2348 // position.
  2316 // ---------------------------------------------------------------------------
  2349 // ---------------------------------------------------------------------------
  2317 //
  2350 //
  2318 void CATExtMetadata::SendToMultipleSecondaryL(
  2351 void CATExtMetadata::SendToMultipleObserverL(
  2319     TATExtEntrySupport& aEntrySupport,
  2352     TATExtEntrySupport& aEntrySupport,
  2320     const TDesC8* aAtCmdFull )
  2353     const TDesC8* aAtCmdFull )
  2321     {
  2354     {
  2322     TRACE_FUNC_ENTRY
  2355     TRACE_FUNC_ENTRY
  2323     if ( !aEntrySupport.iSupport )
  2356     if ( !aEntrySupport.iSupport )
  2328     TInt i;
  2361     TInt i;
  2329     TInt count = aEntrySupport.iSupport->Count();
  2362     TInt count = aEntrySupport.iSupport->Count();
  2330     for ( i=aEntrySupport.iStartIndex; i<count; i++ )
  2363     for ( i=aEntrySupport.iStartIndex; i<count; i++ )
  2331         {
  2364         {
  2332         TATExtOneCmdSupport& oneCmdSupport = (*aEntrySupport.iSupport)[i];
  2365         TATExtOneCmdSupport& oneCmdSupport = (*aEntrySupport.iSupport)[i];
  2333         if ( oneCmdSupport.iSupportType != ESupportTypeSecondary )
  2366         if ( oneCmdSupport.iSupportType != ESupportTypeObserver )
  2334             {
  2367             {
  2335             continue;
  2368             continue;
  2336             }
  2369             }
  2337         aEntrySupport.iEntry = &(*iPluginData)[i];
  2370         aEntrySupport.iEntry = &(*iPluginData)[oneCmdSupport.iEntryIndex];
  2338         TBool supported = HandleCommandSupportL( aEntrySupport, aAtCmdFull );
  2371         TBool supported = EFalse;
       
  2372         if ( !aEntrySupport.iSupportFound )
       
  2373             {
       
  2374             supported = HandleCommandSupportL( aEntrySupport, aAtCmdFull );
       
  2375             }
  2339         if ( supported )
  2376         if ( supported )
  2340             {
  2377             {
  2341             HandleCommandL( aEntrySupport, EFalse, aAtCmdFull );
  2378             HandleCommandL( aEntrySupport, EFalse, aAtCmdFull );
  2342             }
  2379             aEntrySupport.iSupportFound = ETrue;
  2343         }
  2380             }
  2344     TRACE_FUNC_EXIT
  2381         if ( i < count-1 )
  2345     }
  2382             {
  2346 
  2383             aEntrySupport.iSupportFound = EFalse;
  2347 // ---------------------------------------------------------------------------
  2384             }
  2348 // Finds the first secondary plugin support from a given starting position
  2385         }
  2349 // ---------------------------------------------------------------------------
  2386     TRACE_FUNC_EXIT
  2350 //
  2387     }
  2351 TBool CATExtMetadata::FindFirstSecondarySupportL(
  2388 
       
  2389 // ---------------------------------------------------------------------------
       
  2390 // Finds the first observer plugin support from a given starting position
       
  2391 // ---------------------------------------------------------------------------
       
  2392 //
       
  2393 TBool CATExtMetadata::FindFirstObserverSupportL(
  2352     TATExtEntrySupport& aEntrySupport )
  2394     TATExtEntrySupport& aEntrySupport )
  2353     {
  2395     {
  2354     TRACE_FUNC_ENTRY
  2396     TRACE_FUNC_ENTRY
  2355     if ( !aEntrySupport.iSupport )
  2397     if ( !aEntrySupport.iSupport )
  2356         {
  2398         {
  2360     TInt i;
  2402     TInt i;
  2361     TInt count = aEntrySupport.iSupport->Count();
  2403     TInt count = aEntrySupport.iSupport->Count();
  2362     for ( i=aEntrySupport.iStartIndex; i<count; i++ )
  2404     for ( i=aEntrySupport.iStartIndex; i<count; i++ )
  2363         {
  2405         {
  2364         TATExtOneCmdSupport& oneCmdSupport = (*aEntrySupport.iSupport)[i];
  2406         TATExtOneCmdSupport& oneCmdSupport = (*aEntrySupport.iSupport)[i];
  2365         if ( oneCmdSupport.iSupportType != ESupportTypeSecondary )
  2407         if ( oneCmdSupport.iSupportType != ESupportTypeObserver )
  2366             {
  2408             {
  2367             continue;
  2409             continue;
  2368             }
  2410             }
  2369         aEntrySupport.iEntry = &(*iPluginData)[i];
  2411         aEntrySupport.iSupportFound = EFalse;
       
  2412         aEntrySupport.iEntry = &(*iPluginData)[oneCmdSupport.iEntryIndex];
  2370         TBool supported = HandleCommandSupportL( aEntrySupport );
  2413         TBool supported = HandleCommandSupportL( aEntrySupport );
  2371         if ( supported )
  2414         if ( supported )
  2372             {
  2415             {
       
  2416             aEntrySupport.iSupportFound = ETrue;
  2373             TRACE_FUNC_EXIT
  2417             TRACE_FUNC_EXIT
  2374             return ETrue;
  2418             return ETrue;
  2375             }
  2419             }
  2376         }
  2420         }
  2377     TRACE_FUNC_EXIT
  2421     TRACE_FUNC_EXIT