cmmanager/cmmgr/cmmplugins/cmpluginwlan/src/cmpluginwlan.cpp
changeset 53 4af712113915
parent 46 95d45f234cf3
equal deleted inserted replaced
47:cb7afde124a3 53:4af712113915
   128 
   128 
   129     iBearerType = KUidWlanBearerType;
   129     iBearerType = KUidWlanBearerType;
   130     iWlanServiceRecord = NULL;
   130     iWlanServiceRecord = NULL;
   131     iWlanTableId = 0;
   131     iWlanTableId = 0;
   132     iWAPISupported = EFalse;
   132     iWAPISupported = EFalse;
       
   133     iBearerPriorityTableId = 0;
   133 
   134 
   134     OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CCMPLUGINWLAN_EXIT );
   135     OstTraceFunctionExit0( DUP1_CCMPLUGINWLAN_CCMPLUGINWLAN_EXIT );
   135     }
   136     }
   136 
   137 
   137 // --------------------------------------------------------------------------
   138 // --------------------------------------------------------------------------
  1295 //
  1296 //
  1296 void CCmPluginWlan::DeleteBearerRecordsL()
  1297 void CCmPluginWlan::DeleteBearerRecordsL()
  1297     {
  1298     {
  1298     OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY );
  1299     OstTraceFunctionEntry0( CCMPLUGINWLAN_DELETEBEARERRECORDSL_ENTRY );
  1299 
  1300 
  1300     // Save the wlan service record id for the EAP settings deletion 
  1301     // Save the wlan service record id for the EAP settings deletion.
  1301     TUint wlanServiceRecordId = iWlanServiceRecord->RecordId();
  1302     TUint wlanServiceRecordId = iWlanServiceRecord->RecordId();
  1302     
  1303 
  1303     // As base class deletes service record, in this case LAN, only WLAN
  1304     // As base class deletes service record, in this case LAN, only WLAN
  1304     // related stuff needs to be deleted.
  1305     // related stuff needs to be deleted.
  1305     iWlanServiceRecord->DeleteL( iSession );
  1306     iWlanServiceRecord->DeleteL( iSession );
  1306     
  1307 
  1307     // Delete EAP specific
  1308     // Delete EAP specific.
  1308     CEapGeneralSettings* eapSettings( NULL );
  1309     CEapGeneralSettings* eapSettings( NULL );
  1309     TRAPD( err, eapSettings = CEapGeneralSettings::NewL( ELan, wlanServiceRecordId ) );
  1310     TRAPD( err, eapSettings = CEapGeneralSettings::NewL( ELan, wlanServiceRecordId ) );
  1310     if ( err == KErrNone )
  1311     if ( err == KErrNone )
  1311         {
  1312         {
  1312         eapSettings->DeleteAllEapSettings();
  1313         eapSettings->DeleteAllEapSettings();
  1518     iServiceRecord = NULL;
  1519     iServiceRecord = NULL;
  1519 
  1520 
  1520     iServiceRecord = static_cast<CCDLANServiceRecord *>(
  1521     iServiceRecord = static_cast<CCDLANServiceRecord *>(
  1521             CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
  1522             CCDRecordBase::RecordFactoryL( KCDTIdLANServiceRecord ) );
  1522 
  1523 
  1523     // LAN Service copy does not work so we have to copy it manually.
       
  1524 
       
  1525     // Plugin's commsdat copy.
  1524     // Plugin's commsdat copy.
  1526     CCDLANServiceRecord* origServiceRecord = static_cast<CCDLANServiceRecord*>( iServiceRecord );
  1525     CCDLANServiceRecord* origServiceRecord =
       
  1526             static_cast<CCDLANServiceRecord*>( iServiceRecord );
  1527 
  1527 
  1528     // Client's copy of lan service record.
  1528     // Client's copy of lan service record.
  1529     CCDLANServiceRecord* clientServiceRecordCopy =
  1529     CCDLANServiceRecord* clientServiceRecordCopy =
  1530             static_cast<CCDLANServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
  1530             static_cast<CCDLANServiceRecord*>( aGenRecordArray[KServiceRecordIndex] );
  1531 
  1531 
  1532     if ( !clientServiceRecordCopy->iRecordTag.IsNull() )
  1532     CopyRecordFieldsL( *clientServiceRecordCopy, *origServiceRecord );
  1533         {
       
  1534         origServiceRecord->iRecordTag.SetL( clientServiceRecordCopy->iRecordTag );
       
  1535         }
       
  1536     if ( !clientServiceRecordCopy->iRecordName.IsNull() )
       
  1537         {
       
  1538         origServiceRecord->iRecordName.SetL( clientServiceRecordCopy->iRecordName );
       
  1539         }
       
  1540     if ( !clientServiceRecordCopy->iServiceEnableLlmnr.IsNull() )
       
  1541         {
       
  1542         origServiceRecord->iServiceEnableLlmnr.SetL( clientServiceRecordCopy->iServiceEnableLlmnr );
       
  1543         }
       
  1544     if ( !clientServiceRecordCopy->iIfNetworks.IsNull() )
       
  1545         {
       
  1546         origServiceRecord->iIfNetworks.SetL( clientServiceRecordCopy->iIfNetworks );
       
  1547         }
       
  1548     if ( !clientServiceRecordCopy->iIpNetmask.IsNull() )
       
  1549         {
       
  1550         origServiceRecord->iIpNetmask.SetL( clientServiceRecordCopy->iIpNetmask );
       
  1551         }
       
  1552     if ( !clientServiceRecordCopy->iIpGateway.IsNull() )
       
  1553         {
       
  1554         origServiceRecord->iIpGateway.SetL( clientServiceRecordCopy->iIpGateway );
       
  1555         }
       
  1556     if ( !clientServiceRecordCopy->iIpAddrFromServer.IsNull() )
       
  1557         {
       
  1558         origServiceRecord->iIpAddrFromServer.SetL( clientServiceRecordCopy->iIpAddrFromServer );
       
  1559         }
       
  1560     if ( !clientServiceRecordCopy->iIpAddr.IsNull() )
       
  1561         {
       
  1562         origServiceRecord->iIpAddr.SetL( clientServiceRecordCopy->iIpAddr );
       
  1563         }
       
  1564     if ( !clientServiceRecordCopy->iIpDnsAddrFromServer.IsNull() )
       
  1565         {
       
  1566         origServiceRecord->iIpDnsAddrFromServer.SetL( clientServiceRecordCopy->iIpDnsAddrFromServer );
       
  1567         }
       
  1568     if ( !clientServiceRecordCopy->iIpNameServer1.IsNull() )
       
  1569         {
       
  1570         origServiceRecord->iIpNameServer1.SetL( clientServiceRecordCopy->iIpNameServer1 );
       
  1571         }
       
  1572     if ( !clientServiceRecordCopy->iIpNameServer2.IsNull() )
       
  1573         {
       
  1574         origServiceRecord->iIpNameServer2.SetL( clientServiceRecordCopy->iIpNameServer2 );
       
  1575         }
       
  1576     if ( !clientServiceRecordCopy->iIp6DnsAddrFromServer.IsNull() )
       
  1577         {
       
  1578         origServiceRecord->iIp6DnsAddrFromServer.SetL( clientServiceRecordCopy->iIp6DnsAddrFromServer );
       
  1579         }
       
  1580     if ( !clientServiceRecordCopy->iIp6NameServer1.IsNull() )
       
  1581         {
       
  1582         origServiceRecord->iIp6NameServer1.SetL( clientServiceRecordCopy->iIp6NameServer1 );
       
  1583         }
       
  1584     if ( !clientServiceRecordCopy->iIp6NameServer2.IsNull() )
       
  1585         {
       
  1586         origServiceRecord->iIp6NameServer2.SetL( clientServiceRecordCopy->iIp6NameServer2 );
       
  1587         }
       
  1588     if ( !clientServiceRecordCopy->iIpAddrLeaseValidFrom.IsNull() )
       
  1589         {
       
  1590         origServiceRecord->iIpAddrLeaseValidFrom.SetL( clientServiceRecordCopy->iIpAddrLeaseValidFrom );
       
  1591         }
       
  1592     if ( !clientServiceRecordCopy->iIpAddrLeaseValidTo.IsNull() )
       
  1593         {
       
  1594         origServiceRecord->iIpAddrLeaseValidTo.SetL( clientServiceRecordCopy->iIpAddrLeaseValidTo );
       
  1595         }
       
  1596     if ( !clientServiceRecordCopy->iConfigDaemonManagerName.IsNull() )
       
  1597         {
       
  1598         origServiceRecord->iConfigDaemonManagerName.SetL( clientServiceRecordCopy->iConfigDaemonManagerName );
       
  1599         }
       
  1600     if ( !clientServiceRecordCopy->iConfigDaemonName.IsNull() )
       
  1601         {
       
  1602         origServiceRecord->iConfigDaemonName.SetL( clientServiceRecordCopy->iConfigDaemonName );
       
  1603         }
       
  1604     if ( !clientServiceRecordCopy->iServiceExtensionTableName.IsNull() )
       
  1605         {
       
  1606         origServiceRecord->iServiceExtensionTableName.SetL( clientServiceRecordCopy->iServiceExtensionTableName );
       
  1607         }
       
  1608     if ( !clientServiceRecordCopy->iServiceExtensionTableRecordId.IsNull() )
       
  1609         {
       
  1610         origServiceRecord->iServiceExtensionTableRecordId.SetL( clientServiceRecordCopy->iServiceExtensionTableRecordId ); //TODO, check this works ok.
       
  1611         }
       
  1612 
  1533 
  1613     origServiceRecord->SetElementId( clientServiceRecordCopy->ElementId() );
  1534     origServiceRecord->SetElementId( clientServiceRecordCopy->ElementId() );
  1614 
  1535 
  1615     if ( !origServiceRecord->RecordId() )
  1536     if ( !origServiceRecord->RecordId() )
  1616         {
  1537         {
  1617         origServiceRecord->SetRecordId( KCDNewRecordRequest );
  1538         origServiceRecord->SetRecordId( KCDNewRecordRequest );
  1618         origServiceRecord->StoreL( iSession );
  1539         origServiceRecord->StoreL( iSession );
       
  1540         // Have to be "reloaded" to get possible default values from template records.
       
  1541         origServiceRecord->LoadL( iSession );
  1619 
  1542 
  1620         // Update received element ID to client's copy too.
  1543         // Update received element ID to client's copy too.
  1621         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
  1544         clientServiceRecordCopy->SetElementId( origServiceRecord->ElementId() );
       
  1545 
       
  1546         // Copy record back to client's copy to be exactly same as in database.
       
  1547         CCmPluginBaseEng::CopyRecordFieldsL( *origServiceRecord,
       
  1548                 *clientServiceRecordCopy );
       
  1549 
  1622         // Update needed values to other table records too (wlanservice).
  1550         // Update needed values to other table records too (wlanservice).
  1623         CCDWlanServiceRecord* wlanServiceRecord = static_cast<CCDWlanServiceRecord *>(
  1551         CCDWlanServiceRecord* wlanServiceRecord =
  1624                 aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1552                 static_cast<CCDWlanServiceRecord *>(
       
  1553                         aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1625         wlanServiceRecord->iWlanServiceId.SetL( origServiceRecord->RecordId() );
  1554         wlanServiceRecord->iWlanServiceId.SetL( origServiceRecord->RecordId() );
  1626         }
  1555         }
  1627     else
  1556     else
  1628         {
  1557         {
  1629         origServiceRecord->ModifyL( iSession );
  1558         origServiceRecord->ModifyL( iSession );
       
  1559 
       
  1560         CCmPluginBaseEng::CopyRecordFieldsL( *origServiceRecord,
       
  1561                 *clientServiceRecordCopy );
  1630         }
  1562         }
  1631 
  1563 
  1632     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT );
  1564     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATESERVICERECORDL_EXIT );
  1633     }
  1565     }
  1634 
  1566 
  1647     iWlanServiceRecord = NULL;
  1579     iWlanServiceRecord = NULL;
  1648 
  1580 
  1649     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord( iWlanTableId );
  1581     iWlanServiceRecord = new( ELeave ) CCDWlanServiceRecord( iWlanTableId );
  1650 
  1582 
  1651     // Client's copy of wlan service record.
  1583     // Client's copy of wlan service record.
  1652     CCDWlanServiceRecord* clientWlanServiceRecord = static_cast<CCDWlanServiceRecord*>(
  1584     CCDWlanServiceRecord* clientWlanServiceRecord =
  1653             aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1585             static_cast<CCDWlanServiceRecord*>(
  1654 
  1586                     aBearerSpecRecordArray[KWlanServiceRecordIndex] );
  1655     if ( !clientWlanServiceRecord->iRecordTag.IsNull() )
  1587 
  1656         {
  1588     CopyRecordFieldsL( *clientWlanServiceRecord, *iWlanServiceRecord );
  1657         iWlanServiceRecord->iRecordTag.SetL(
       
  1658                 clientWlanServiceRecord->iRecordTag );
       
  1659         }
       
  1660     if ( !clientWlanServiceRecord->iRecordName.IsNull() )
       
  1661         {
       
  1662         iWlanServiceRecord->iRecordName.SetL(
       
  1663                 clientWlanServiceRecord->iRecordName );
       
  1664         }
       
  1665     if ( !clientWlanServiceRecord->iWlanServiceId.IsNull() )
       
  1666         {
       
  1667         iWlanServiceRecord->iWlanServiceId.SetL(
       
  1668                 clientWlanServiceRecord->iWlanServiceId );
       
  1669         }
       
  1670     if ( !clientWlanServiceRecord->iWlanConnMode.IsNull() )
       
  1671         {
       
  1672         iWlanServiceRecord->iWlanConnMode.SetL(
       
  1673                 clientWlanServiceRecord->iWlanConnMode );
       
  1674         }
       
  1675     if ( !clientWlanServiceRecord->iWLanSSID.IsNull() )
       
  1676         {
       
  1677         iWlanServiceRecord->iWLanSSID.SetL(
       
  1678                 clientWlanServiceRecord->iWLanSSID );
       
  1679         }
       
  1680     if ( !clientWlanServiceRecord->iWLanUsedSSID.IsNull() )
       
  1681         {
       
  1682         iWlanServiceRecord->iWLanUsedSSID.SetL(
       
  1683                 clientWlanServiceRecord->iWLanUsedSSID );
       
  1684         }
       
  1685     if ( !clientWlanServiceRecord->iWLanWepKey1.IsNull() )
       
  1686         {
       
  1687         iWlanServiceRecord->iWLanWepKey1.SetL(
       
  1688                 clientWlanServiceRecord->iWLanWepKey1 );
       
  1689         }
       
  1690     if ( !clientWlanServiceRecord->iWLanWepKey2.IsNull() )
       
  1691         {
       
  1692         iWlanServiceRecord->iWLanWepKey2.SetL(
       
  1693                 clientWlanServiceRecord->iWLanWepKey2 );
       
  1694         }
       
  1695     if ( !clientWlanServiceRecord->iWLanWepKey3.IsNull() )
       
  1696         {
       
  1697         iWlanServiceRecord->iWLanWepKey3.SetL(
       
  1698                 clientWlanServiceRecord->iWLanWepKey3 );
       
  1699         }
       
  1700     if ( !clientWlanServiceRecord->iWLanWepKey4.IsNull() )
       
  1701         {
       
  1702         iWlanServiceRecord->iWLanWepKey4.SetL(
       
  1703                 clientWlanServiceRecord->iWLanWepKey4 );
       
  1704         }
       
  1705     if ( !clientWlanServiceRecord->iWlanWepIndex.IsNull() )
       
  1706         {
       
  1707         iWlanServiceRecord->iWlanWepIndex.SetL(
       
  1708                 clientWlanServiceRecord->iWlanWepIndex );
       
  1709         }
       
  1710     if ( !clientWlanServiceRecord->iWlanSecMode.IsNull() )
       
  1711         {
       
  1712         iWlanServiceRecord->iWlanSecMode.SetL(
       
  1713                 clientWlanServiceRecord->iWlanSecMode );
       
  1714         }
       
  1715     if ( !clientWlanServiceRecord->iWlanAuthMode.IsNull() )
       
  1716         {
       
  1717         iWlanServiceRecord->iWlanAuthMode.SetL(
       
  1718                 clientWlanServiceRecord->iWlanAuthMode );
       
  1719         }
       
  1720     if ( !clientWlanServiceRecord->iWlanEnableWpaPsk.IsNull() )
       
  1721         {
       
  1722         iWlanServiceRecord->iWlanEnableWpaPsk.SetL(
       
  1723                 clientWlanServiceRecord->iWlanEnableWpaPsk );
       
  1724         }
       
  1725     if ( !clientWlanServiceRecord->iWLanWpaPreSharedKey.IsNull() )
       
  1726         {
       
  1727         iWlanServiceRecord->iWLanWpaPreSharedKey.SetL(
       
  1728                 clientWlanServiceRecord->iWLanWpaPreSharedKey );
       
  1729         }
       
  1730     if ( !clientWlanServiceRecord->iWlanWpaKeyLength.IsNull() )
       
  1731         {
       
  1732         iWlanServiceRecord->iWlanWpaKeyLength.SetL(
       
  1733                 clientWlanServiceRecord->iWlanWpaKeyLength );
       
  1734         }
       
  1735     if ( !clientWlanServiceRecord->iWLanEaps.IsNull() )
       
  1736         {
       
  1737         iWlanServiceRecord->iWLanEaps.SetL(
       
  1738                 clientWlanServiceRecord->iWLanEaps );
       
  1739         }
       
  1740     if ( !clientWlanServiceRecord->iWlanScanSSID.IsNull() )
       
  1741         {
       
  1742         iWlanServiceRecord->iWlanScanSSID.SetL(
       
  1743                 clientWlanServiceRecord->iWlanScanSSID );
       
  1744         }
       
  1745     if ( !clientWlanServiceRecord->iWlanChannelID.IsNull() )
       
  1746         {
       
  1747         iWlanServiceRecord->iWlanChannelID.SetL(
       
  1748                 clientWlanServiceRecord->iWlanChannelID );
       
  1749         }
       
  1750     if ( !clientWlanServiceRecord->iWlanFormatKey1.IsNull() )
       
  1751         {
       
  1752         iWlanServiceRecord->iWlanFormatKey1.SetL(
       
  1753                 clientWlanServiceRecord->iWlanFormatKey1 );
       
  1754         }
       
  1755     if ( !clientWlanServiceRecord->iWlanFormatKey2.IsNull() )
       
  1756         {
       
  1757         iWlanServiceRecord->iWlanFormatKey2.SetL(
       
  1758                 clientWlanServiceRecord->iWlanFormatKey2 );
       
  1759         }
       
  1760     if ( !clientWlanServiceRecord->iWlanFormatKey3.IsNull() )
       
  1761         {
       
  1762         iWlanServiceRecord->iWlanFormatKey3.SetL(
       
  1763                 clientWlanServiceRecord->iWlanFormatKey3 );
       
  1764         }
       
  1765     if ( !clientWlanServiceRecord->iWlanFormatKey4.IsNull() )
       
  1766         {
       
  1767         iWlanServiceRecord->iWlanFormatKey4.SetL(
       
  1768                 clientWlanServiceRecord->iWlanFormatKey4 );
       
  1769         }
       
  1770     if ( !clientWlanServiceRecord->iWlanAllowSSIDRoaming.IsNull() )
       
  1771         {
       
  1772         iWlanServiceRecord->iWlanAllowSSIDRoaming.SetL(
       
  1773                 clientWlanServiceRecord->iWlanAllowSSIDRoaming );
       
  1774         }
       
  1775     if ( !clientWlanServiceRecord->iWLanEnabledEaps.IsNull() )
       
  1776         {
       
  1777         iWlanServiceRecord->iWLanEnabledEaps.SetL(
       
  1778                 clientWlanServiceRecord->iWLanEnabledEaps );
       
  1779         }
       
  1780     if ( !clientWlanServiceRecord->iWLanDisabledEaps.IsNull() )
       
  1781         {
       
  1782         iWlanServiceRecord->iWLanDisabledEaps.SetL(
       
  1783                 clientWlanServiceRecord->iWLanDisabledEaps );
       
  1784         }
       
  1785 
  1589 
  1786     iWlanServiceRecord->SetElementId( clientWlanServiceRecord->ElementId() );
  1590     iWlanServiceRecord->SetElementId( clientWlanServiceRecord->ElementId() );
  1787 
  1591 
  1788     if ( !iWlanServiceRecord->RecordId() )
  1592     if ( !iWlanServiceRecord->RecordId() )
  1789         {
  1593         {
  1790         iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
  1594         iWlanServiceRecord->SetRecordId( KCDNewRecordRequest );
  1791         iWlanServiceRecord->StoreL( iSession );
  1595         iWlanServiceRecord->StoreL( iSession );
       
  1596         // Have to be "reloaded" to get possible default values from template records.
       
  1597         iWlanServiceRecord->LoadL( iSession );
  1792 
  1598 
  1793         // Update received element ID to client's copy too.
  1599         // Update received element ID to client's copy too.
  1794         clientWlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1600         clientWlanServiceRecord->SetElementId( iWlanServiceRecord->ElementId() );
  1795         }
  1601         }
  1796     else
  1602     else
  1797         {
  1603         {
  1798         iWlanServiceRecord->ModifyL( iSession );
  1604         iWlanServiceRecord->ModifyL( iSession );
  1799         }
  1605         }
       
  1606 
       
  1607     // Copy record back to client's copy to be exactly same as in database.
       
  1608     CCmPluginBaseEng::CopyRecordFieldsL( *iWlanServiceRecord,
       
  1609             *clientWlanServiceRecord );
  1800 
  1610 
  1801     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_EXIT );
  1611     OstTraceFunctionExit0( CCMPLUGINWLAN_UPDATEBEARERRECORDSL_EXIT );
  1802     }
  1612     }
  1803 
  1613 
  1804 // ---------------------------------------------------------------------------
  1614 // ---------------------------------------------------------------------------
  2526         RArray<TUint32>& aTableIdArray ) const
  2336         RArray<TUint32>& aTableIdArray ) const
  2527     {
  2337     {
  2528     OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY );
  2338     OstTraceFunctionEntry0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_ENTRY );
  2529 
  2339 
  2530     aTableIdArray.AppendL( KCDTIdLANServiceRecord );
  2340     aTableIdArray.AppendL( KCDTIdLANServiceRecord );
  2531     aTableIdArray.AppendL( KCDTIdLANBearerRecord );
       
  2532     aTableIdArray.AppendL( iWlanTableId );
  2341     aTableIdArray.AppendL( iWlanTableId );
  2533 
  2342 
  2534     OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT );
  2343     OstTraceFunctionExit0( CCMPLUGINWLAN_GETBEARERTABLEIDSTOBEOBSERVEDL_EXIT );
  2535     }
  2344     }
  2536 
  2345