1753 } |
1753 } |
1754 } |
1754 } |
1755 |
1755 |
1756 return TestStepResult(); |
1756 return TestStepResult(); |
1757 } |
1757 } |
|
1758 |
|
1759 // Packet Data (PDP) specific availability simulation |
|
1760 CSetPacketDataAccessPointAvailabilityStep::CSetPacketDataAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
|
1761 : CTe_EsockStepBase(aEsockTest) |
|
1762 { |
|
1763 SetTestStepName(KSetPppAccessPointAvailabilityStep); |
|
1764 } |
|
1765 |
|
1766 TVerdict CSetPacketDataAccessPointAvailabilityStep::doTestStepPreambleL() |
|
1767 { |
|
1768 SetTestStepResult(EFail); |
|
1769 |
|
1770 if (iEsockTest==NULL) |
|
1771 iEsockTest = new (ELeave) CCEsockTestBase; |
|
1772 |
|
1773 SetTestStepResult(EPass); |
|
1774 return TestStepResult(); |
|
1775 } |
|
1776 |
|
1777 |
|
1778 TInt CSetPacketDataAccessPointAvailabilityStep::ConfigureFromIni() |
|
1779 { |
|
1780 TBool found(EFalse); |
|
1781 TPtrC availState; |
|
1782 if(GetStringFromConfig(iSection, KAccessPointState, availState)) |
|
1783 { |
|
1784 if (availState == KAvailable) |
|
1785 { |
|
1786 iSetToAvailable = ETrue; |
|
1787 found=ETrue; |
|
1788 } |
|
1789 else if (availState == KUnavailable) |
|
1790 { |
|
1791 iSetToAvailable = EFalse; |
|
1792 found=ETrue; |
|
1793 } |
|
1794 } |
|
1795 |
|
1796 if( ! found) |
|
1797 { |
|
1798 INFO_PRINTF1(_L("Must have availability status set to Available or Unavailable.")); |
|
1799 return KErrArgument; |
|
1800 } |
|
1801 |
|
1802 // All ok if we got this far |
|
1803 return KErrNone; |
|
1804 } |
|
1805 |
|
1806 _LIT(KSimtsyName,"SIM"); |
|
1807 |
|
1808 TVerdict CSetPacketDataAccessPointAvailabilityStep::doSingleTestStep() |
|
1809 { |
|
1810 // Fail by default |
|
1811 SetTestStepResult(EFail); |
|
1812 |
|
1813 // Action 1- RTelServer::Connect |
|
1814 RTelServer telServer; |
|
1815 TInt ret = telServer.Connect(); |
|
1816 if (ret!=KErrNone) |
|
1817 { |
|
1818 INFO_PRINTF1(_L("Failed to connect to telephony server")); |
|
1819 } |
|
1820 else |
|
1821 { |
|
1822 // Action 2- RTelServer::LoadPhoneModule |
|
1823 ret=telServer.LoadPhoneModule(KSimtsyName); |
|
1824 if (ret!=KErrNone) |
|
1825 { |
|
1826 INFO_PRINTF1(_L("Failed to load phone module")); |
|
1827 } |
|
1828 else |
|
1829 { |
|
1830 // Action 3- RPhone::Open |
|
1831 RPhone phone; |
|
1832 ret=phone.Open(telServer,KPhoneName) ; |
|
1833 if (ret!=KErrNone) |
|
1834 { |
|
1835 INFO_PRINTF1(_L("Failed to open phone module")); |
|
1836 } |
|
1837 else |
|
1838 { |
|
1839 // Action 4- RPhone::Initialise |
|
1840 ret=phone.Initialise(); |
|
1841 if (ret!=KErrNone) |
|
1842 { |
|
1843 INFO_PRINTF1(_L("Failed to initialise the phone")); |
|
1844 } |
|
1845 else |
|
1846 { |
|
1847 // Action 5- RPacketService::Open |
|
1848 RPacketService packetService; |
|
1849 ret = packetService.Open(phone); |
|
1850 if (ret!=KErrNone) |
|
1851 { |
|
1852 INFO_PRINTF1(_L("Failed to initialise the packet service")); |
|
1853 } |
|
1854 else |
|
1855 { |
|
1856 // Action 6- RPacketService::NotifyStatusChange |
|
1857 TRequestStatus notifyStatus; |
|
1858 RPacketService::TStatus pktStatus; |
|
1859 packetService.NotifyStatusChange(notifyStatus,pktStatus); |
|
1860 |
|
1861 // Action 7- RPacketService::Attach/Detach |
|
1862 TRequestStatus status; |
|
1863 if(iSetToAvailable) |
|
1864 { |
|
1865 packetService.Attach(status); |
|
1866 } |
|
1867 else |
|
1868 { |
|
1869 packetService.Detach(status); |
|
1870 } |
|
1871 User::WaitForRequest(status); |
|
1872 User::WaitForRequest(notifyStatus); |
|
1873 |
|
1874 if(status.Int() != KErrNone ) |
|
1875 { |
|
1876 INFO_PRINTF1(_L("Failed to attach/detach the packet service")); |
|
1877 } |
|
1878 else if( notifyStatus.Int() != KErrNone ) |
|
1879 { |
|
1880 INFO_PRINTF1(_L("Failed to receive notification of packet service attach/detach")); |
|
1881 } |
|
1882 else |
|
1883 { |
|
1884 // Success at last!!! |
|
1885 SetTestStepResult(EPass); |
|
1886 } |
|
1887 |
|
1888 // now clean up: |
|
1889 |
|
1890 // Action 5- RPacketService::Open |
|
1891 packetService.Close(); |
|
1892 } |
|
1893 // Action 4- RPhone::Initialise |
|
1894 // don't need to "un-Initialise" phone |
|
1895 } |
|
1896 // Action 3- RPhone::Open |
|
1897 phone.Close(); |
|
1898 } |
|
1899 // Action 2- RTelServer::LoadPhoneModule |
|
1900 telServer.UnloadPhoneModule(KSimtsyName); |
|
1901 } |
|
1902 // Action 1- RTelServer::Connect |
|
1903 telServer.Close(); |
|
1904 } |
|
1905 // There! CleanupStack ShmeanupStack. |
|
1906 User::LeaveIfError(ret); |
|
1907 |
|
1908 return TestStepResult(); |
|
1909 } |
|
1910 |
|
1911 |
1758 |
1912 |
1759 // wifi specific availability simulation |
1913 // wifi specific availability simulation |
1760 // Requires the "MockupWifiHardware" emulation mechanism to be enabled on udeb |
1914 // Requires the "MockupWifiHardware" emulation mechanism to be enabled on udeb |
1761 CSetWifiAccessPointAvailabilityStep::CSetWifiAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
1915 CSetWifiAccessPointAvailabilityStep::CSetWifiAccessPointAvailabilityStep(CCEsockTestBase*& aEsockTest) |
1762 : CTe_EsockStepBase(aEsockTest) |
1916 : CTe_EsockStepBase(aEsockTest) |