48 #endif |
48 #endif |
49 //Rnd_AutoRestart |
49 //Rnd_AutoRestart |
50 #include <es_sock.h> // RConnection RSocket |
50 #include <es_sock.h> // RConnection RSocket |
51 #include <es_enum.h> // TConnectionInfo |
51 #include <es_enum.h> // TConnectionInfo |
52 #include <commdb.h> |
52 #include <commdb.h> |
53 #include <ApListItemList.h> |
53 #include <cmconnectionmethoddef.h> |
54 #include <ApListItem.h> |
54 #include <cmconnectionmethod.h> |
55 #include <ApSelect.h> |
55 #include <cmmanager.h> |
56 #include <ApUtils.h> |
56 #include <cmpluginwlandef.h> |
57 #include "nsmlhttp.h" |
57 #include "nsmlhttp.h" |
58 |
58 |
59 //Fix to Remove the Bad Compiler Warnings |
59 //Fix to Remove the Bad Compiler Warnings |
60 #ifndef __WINS__ |
60 #ifndef __WINS__ |
61 // This lowers the unnecessary compiler warning (armv5) to remark. |
61 // This lowers the unnecessary compiler warning (armv5) to remark. |
956 CleanupStack::PopAndDestroy(rep); |
956 CleanupStack::PopAndDestroy(rep); |
957 |
957 |
958 if(error == KErrNone && val == 1) |
958 if(error == KErrNone && val == 1) |
959 { |
959 { |
960 |
960 |
961 DBG_FILE_CODE(iNetmonAPBearerType, _S8("CNSmlAgentBase::SendingStateL The Network Bearer Type is")); |
|
962 DBG_FILE_CODE(err, _S8("CNSmlAgentBase::SendingStateL The Network Error is")); |
961 DBG_FILE_CODE(err, _S8("CNSmlAgentBase::SendingStateL The Network Error is")); |
963 |
962 |
964 if(err == TNSmlHTTPErrCode::ENSmlHTTPErr_RequestTimeout) |
963 if(err == TNSmlHTTPErrCode::ENSmlHTTPErr_RequestTimeout) |
965 { |
964 { |
966 DBG_FILE(_S8("CNSmlAgentBase::SendingStateL Invoking the NETMON exe due to Time Out")); |
965 DBG_FILE(_S8("CNSmlAgentBase::SendingStateL Invoking the NETMON exe due to Time Out")); |
1603 TPckgBuf<TConnectionInfoV2> connectionInfo; |
1601 TPckgBuf<TConnectionInfoV2> connectionInfo; |
1604 err = myConnection.GetConnectionInfo( connectionCount, |
1602 err = myConnection.GetConnectionInfo( connectionCount, |
1605 connectionInfo ); |
1603 connectionInfo ); |
1606 iNetmonAPId = connectionInfo().iIapId; |
1604 iNetmonAPId = connectionInfo().iIapId; |
1607 DBG_FILE_CODE(iNetmonAPId, _S8("CNSmlAgentBase::ReadAcessPointL(), The IAPId is:")); |
1605 DBG_FILE_CODE(iNetmonAPId, _S8("CNSmlAgentBase::ReadAcessPointL(), The IAPId is:")); |
1608 iNetmonAPBearerType = CheckAPBearerTypeL( iNetmonAPId ); |
1606 RCmManager cmmanager; |
1609 DBG_FILE_CODE(TInt(iNetmonAPBearerType), _S8("CNSmlAgentBase::ReadAcessPointL(), The Enumerated IAPId is:")); |
1607 cmmanager.OpenL(); |
1610 |
1608 CleanupClosePushL(cmmanager); |
1611 } |
1609 RCmConnectionMethod cm; |
|
1610 cm = cmmanager.ConnectionMethodL( iNetmonAPId ); |
|
1611 CleanupClosePushL( cm ); |
|
1612 TUint32 bearer = 0; |
|
1613 //TRAP_IGNORE( accesspointId = cm.GetIntAttributeL(CMManager::ECmIapId) );? |
|
1614 bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); |
|
1615 CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm |
|
1616 if ( bearer == KUidWlanBearerType ) |
|
1617 { |
|
1618 iAllowAutoRestart = EFalse; |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 iAllowAutoRestart = ETrue; |
|
1623 } |
|
1624 } |
1612 |
1625 |
1613 myConnection.Close(); |
1626 myConnection.Close(); |
1614 socketServer.Close(); |
1627 socketServer.Close(); |
1615 } |
|
1616 |
|
1617 // ----------------------------------------------------------------------------- |
|
1618 // CNSmlAgentBase::CheckAPBearerTypeL |
|
1619 // Returns bearer type of the selected Access Point. |
|
1620 // ----------------------------------------------------------------------------- |
|
1621 EXPORT_C TApBearerType CNSmlAgentBase::CheckAPBearerTypeL( const TUint32 aIAPId ) |
|
1622 { |
|
1623 // Create connection to the Access Points setting data. |
|
1624 CCommsDatabase* cAPCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
|
1625 |
|
1626 TApBearerType bearerType(TApBearerType(-1)); |
|
1627 |
|
1628 // Attach to the Access Point Engine. |
|
1629 CApSelect* apSelect = CApSelect::NewLC( |
|
1630 *cAPCommsDatabase, |
|
1631 KEApIspTypeAll, |
|
1632 EApBearerTypeWLAN | |
|
1633 EApBearerTypeCDMA | |
|
1634 EApBearerTypeGPRS, |
|
1635 KEApSortUidAscending, |
|
1636 EIPv4 | EIPv6 |
|
1637 ); |
|
1638 |
|
1639 // Create ApUtils for some utilities functions. |
|
1640 CApUtils* apUtils = CApUtils::NewLC( *cAPCommsDatabase ); |
|
1641 |
|
1642 // Get supported Access Points from Access Point Engine.. |
|
1643 CApListItemList* apItems = new (ELeave) CApListItemList; |
|
1644 CleanupStack::PushL( apItems ); |
|
1645 apSelect->AllListItemDataL( *apItems ); |
|
1646 |
|
1647 for ( TInt i = 0; i < apItems->Count(); i++ ) |
|
1648 { |
|
1649 // Get id from APEngine and convert it to the CommsDB id. |
|
1650 TUint32 iapId = apUtils->IapIdFromWapIdL( apItems->At( i )->Uid() ); |
|
1651 |
|
1652 // Change bearer type according to id match. |
|
1653 if ( aIAPId == iapId ) |
|
1654 { |
|
1655 bearerType = apItems->At( i )->BearerType(); |
|
1656 |
|
1657 //Getting the IAP name |
|
1658 const TDesC& name = apItems->At( i )->Name(); |
|
1659 |
|
1660 DBG_ARGS(_S("CNSmlAgentBase::CheckAPBearerTypeL(), The IAP Name is: %S"), &name); |
|
1661 |
|
1662 i = apItems->Count(); |
|
1663 } |
|
1664 } |
|
1665 |
|
1666 // PopAndDestroy some items. |
|
1667 CleanupStack::PopAndDestroy( apItems ); |
|
1668 CleanupStack::PopAndDestroy( apUtils ); |
|
1669 CleanupStack::PopAndDestroy( apSelect ); |
|
1670 |
|
1671 delete cAPCommsDatabase; |
|
1672 |
|
1673 // Return bearer type. |
|
1674 return bearerType; |
|
1675 } |
1628 } |
1676 //RD_AUTO_RESTART |
1629 //RD_AUTO_RESTART |
1677 |
1630 |
1678 // --------------------------------------------------------- |
1631 // --------------------------------------------------------- |
1679 // CNSmlAgentBase::SendDataIssueL() |
1632 // CNSmlAgentBase::SendDataIssueL() |