52 #include "WBXMLGeneratorError.h" |
52 #include "WBXMLGeneratorError.h" |
53 #include "WBXMLParser.h" |
53 #include "WBXMLParser.h" |
54 #include "smldtd.h" |
54 #include "smldtd.h" |
55 #include "smldef.h" |
55 #include "smldef.h" |
56 #include "nsmlagenttestdefines.h" |
56 #include "nsmlagenttestdefines.h" |
|
57 #include <hbdevicedialogsymbian.h> |
|
58 #include <hbsymbianvariant.h> |
57 // DM specific includes |
59 // DM specific includes |
58 #include "nsmldmagconstants.h" |
60 #include "nsmldmagconstants.h" |
59 #include "NSmlDMCmds.h" |
61 #include "NSmlDMCmds.h" |
60 #include "nsmldmerror.h" |
62 #include "nsmldmerror.h" |
|
63 #include "OnlineSupportLogger.h" |
61 #ifdef __TEST_TREEMODULE |
64 #ifdef __TEST_TREEMODULE |
62 #include "nsmldmtestmodule.h" |
65 #include "nsmldmtestmodule.h" |
63 #else |
66 #else |
64 #include <nsmldmmodule.h> |
67 #include <nsmldmmodule.h> |
65 #endif |
68 #endif |
82 |
85 |
83 _LIT8 ( KNSmlDMMetaTypeUserRequest, "org.openmobilealliance.dm.firmwareupdate.userrequest" ); |
86 _LIT8 ( KNSmlDMMetaTypeUserRequest, "org.openmobilealliance.dm.firmwareupdate.userrequest" ); |
84 _LIT8 ( KNSmlDMMetaFormatUserRequest, "chr" ); |
87 _LIT8 ( KNSmlDMMetaFormatUserRequest, "chr" ); |
85 _LIT(KChunkName,"AlertItems"); |
88 _LIT(KChunkName,"AlertItems"); |
86 |
89 |
|
90 const TUid dmagentuid = |
|
91 { |
|
92 0x101F6DE5 |
|
93 }; |
|
94 |
|
95 |
|
96 |
|
97 enum TSyncmlHbNotifierKeys |
|
98 { |
|
99 |
|
100 EHbSOSNotifierKeyStatus = 11, // status set will complete the client subscribe |
|
101 EHbSOSNotifierKeyStatusReturn = 12, // Return the content of actual status value accepted from UI |
|
102 |
|
103 EHbDMSyncNotifierKeyStatus = 13, |
|
104 EHbDMSyncNotifierKeyStatusReturn = 14 |
|
105 }; |
87 |
106 |
88 // --------------------------------------------------------- |
107 // --------------------------------------------------------- |
89 // CNSmlDMCmds::NewL() |
108 // CNSmlDMCmds::NewL() |
90 // Creates new instance of CNSmlDMCmds |
109 // Creates new instance of CNSmlDMCmds |
91 // Does not leave instance pointer to CleanupStack. |
110 // Does not leave instance pointer to CleanupStack. |
1507 notifyParams.iMaxTime = maxdt; |
1524 notifyParams.iMaxTime = maxdt; |
1508 notifyParams.iMaxLength = maxlen; |
1525 notifyParams.iMaxLength = maxlen; |
1509 TRequestStatus status; |
1526 TRequestStatus status; |
1510 //Note type to Query note |
1527 //Note type to Query note |
1511 notifyParams.iNoteType = ESyncMLYesNoQuery; |
1528 notifyParams.iNoteType = ESyncMLYesNoQuery; |
1512 TPckgBuf<TSyncMLDlgNotifParams> pkgBuf( notifyParams ); |
1529 TPckgBuf<TSyncMLDlgNotifParams> pkgBuf(notifyParams); |
1513 notifier.StartNotifierAndGetResponse(status,KNSmlSyncDialogUid,pkgBuf,resBuf); |
1530 |
|
1531 |
|
1532 if(!IsHbSyncmlNotifierEnabledL()) |
|
1533 { |
|
1534 RNotifier notifier; |
|
1535 User::LeaveIfError(notifier.Connect()); |
|
1536 CleanupClosePushL(notifier); |
|
1537 |
|
1538 |
|
1539 notifier.StartNotifierAndGetResponse(status, KNSmlSyncDialogUid, pkgBuf, |
|
1540 resBuf); |
1514 User::WaitForRequest(status); |
1541 User::WaitForRequest(status); |
1515 TBool ret = resBuf(); |
1542 |
1516 if ( status == KErrCancel || status == KErrTimedOut ) |
1543 |
|
1544 |
|
1545 //TBool ret = resBuf(); |
|
1546 |
|
1547 CleanupStack::PopAndDestroy(); |
|
1548 } |
|
1549 else |
|
1550 { |
|
1551 |
|
1552 TInt statusval; |
|
1553 ServerHbNotifierL(notifyParams.iNoteType, notifyParams.iServerMsg); |
|
1554 TInt err = RProperty::Get(dmagentuid, EHbDMSyncNotifierKeyStatusReturn, statusval); |
|
1555 LOGSTRING2("get error status = %d", err); |
|
1556 if(err == KErrNone) |
|
1557 { |
|
1558 status = statusval; |
|
1559 LOGSTRING2("get statusval = %d", status.Int()); |
|
1560 } |
|
1561 |
|
1562 } |
|
1563 |
|
1564 if (status == KErrCancel || status == KErrTimedOut) |
1517 { |
1565 { |
1518 TInt error = status == KErrCancel ? TNSmlError::ESmlStatusNotModified : TNSmlError::ESmlStatusRequestTimeout; |
1566 TInt error = status == KErrCancel ? TNSmlError::ESmlStatusNotModified : TNSmlError::ESmlStatusRequestTimeout; |
1519 iStatusToServer->SetStatusCodeL( aStatusId, error ); |
1567 iStatusToServer->SetStatusCodeL( aStatusId, error ); |
1520 HandleAlertErrorL(); |
1568 HandleAlertErrorL(); |
1521 } |
1569 } |
1522 CleanupStack::PopAndDestroy(4); //alertData alertDataWithMDT,databuf16,notifier |
1570 CleanupStack::PopAndDestroy(3); //alertData alertDataWithMDT,databuf16,notifier |
1523 } |
1571 } |
1524 |
1572 |
1525 // --------------------------------------------------------- |
1573 // --------------------------------------------------------- |
1526 // CNSmlDMCmds::HandleUserInputalertL |
1574 // CNSmlDMCmds::HandleUserInputalertL |
1527 // Handles user Text Input Alert command from a server. |
1575 // Handles user Text Input Alert command from a server. |
1685 notifyParams.iMaxTime = maxdt; |
1731 notifyParams.iMaxTime = maxdt; |
1686 notifyParams.iMaxLength = maxlen; |
1732 notifyParams.iMaxLength = maxlen; |
1687 TRequestStatus status; |
1733 TRequestStatus status; |
1688 notifyParams.iNoteType = ESyncMLInfoNote; |
1734 notifyParams.iNoteType = ESyncMLInfoNote; |
1689 TPckgBuf<TSyncMLDlgNotifParams> pkgBuf( notifyParams ); |
1735 TPckgBuf<TSyncMLDlgNotifParams> pkgBuf( notifyParams ); |
1690 notifier.StartNotifierAndGetResponse(status,KNSmlSyncDialogUid,pkgBuf,resBuf); |
1736 if(!IsHbSyncmlNotifierEnabledL()) |
1691 User::WaitForRequest(status); |
1737 { |
1692 CleanupStack::PopAndDestroy(4); //alertData alertDataWithMDT,databuf16,notifier |
1738 RNotifier notifier; |
1693 } |
1739 User::LeaveIfError(notifier.Connect()); |
1694 |
1740 CleanupClosePushL(notifier); |
|
1741 notifier.StartNotifierAndGetResponse(status, KNSmlSyncDialogUid, pkgBuf, |
|
1742 resBuf); |
|
1743 User::WaitForRequest(status); |
|
1744 CleanupStack::PopAndDestroy(); //notifier |
|
1745 } |
|
1746 else |
|
1747 { |
|
1748 LOGSTRING("HandleDisplayAlertL Start test 1 start"); |
|
1749 ServerHbNotifierL(notifyParams.iNoteType, notifyParams.iServerMsg); |
|
1750 LOGSTRING("HandleDisplayAlertL Start test 2 end"); |
|
1751 } |
|
1752 |
|
1753 CleanupStack::PopAndDestroy(3); //alertData alertDataWithMDT,databuf16 |
|
1754 |
|
1755 |
|
1756 } |
|
1757 |
|
1758 void CNSmlDMCmds::ServerHbNotifierL(TSyncMLDlgNoteTypes& aNotetype, TDesC& aServerMsg) |
|
1759 |
|
1760 { |
|
1761 LOGSTRING("HandleDisplayAlertL ServerHbNotifier start"); |
|
1762 |
|
1763 _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0"); |
|
1764 |
|
1765 _LIT(KNotifierId, "syncmlfw"); |
|
1766 _LIT(KServerpushalertInfo, "serverpushinformative"); |
|
1767 _LIT(KServerpushalertConfirm, "serverpushconfirmative"); |
|
1768 |
|
1769 TBuf<25> serverpushalertval; |
|
1770 |
|
1771 if(aNotetype == ESyncMLInfoNote) |
|
1772 serverpushalertval.Copy(KServerpushalertInfo); |
|
1773 else |
|
1774 serverpushalertval.Copy(KServerpushalertConfirm); |
|
1775 |
|
1776 CHbDeviceDialogSymbian *devDialog = NULL; |
|
1777 |
|
1778 CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); |
|
1779 CleanupStack::PushL(varMap); |
|
1780 |
|
1781 |
|
1782 HBufC* keyBuf = HBufC::NewL(25); |
|
1783 CleanupStack::PushL(keyBuf); |
|
1784 |
|
1785 *keyBuf = KNotifierId; |
|
1786 |
|
1787 HBufC* servalertmsg = HBufC::NewL(25); |
|
1788 CleanupStack::PushL(servalertmsg); |
|
1789 |
|
1790 *servalertmsg = serverpushalertval; |
|
1791 |
|
1792 TInt id =0; |
|
1793 |
|
1794 CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id, |
|
1795 CHbSymbianVariant::EInt); |
|
1796 |
|
1797 |
|
1798 CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aServerMsg, |
|
1799 CHbSymbianVariant::EDes); |
|
1800 |
|
1801 varMap->Add(*keyBuf,notifierid); |
|
1802 varMap->Add(*servalertmsg, serveralertmsg); // takes ownership |
|
1803 |
|
1804 LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 2"); |
|
1805 |
|
1806 |
|
1807 RProperty propertykey; |
|
1808 |
|
1809 TRequestStatus status; |
|
1810 |
|
1811 TInt err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatus, RProperty::EInt); |
|
1812 |
|
1813 err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatusReturn, RProperty::EInt); |
|
1814 |
|
1815 TInt err1 = propertykey.Attach(dmagentuid , EHbDMSyncNotifierKeyStatus); |
|
1816 |
|
1817 propertykey.Subscribe(status); |
|
1818 |
|
1819 LOGSTRING2(" err = %d", err); |
|
1820 LOGSTRING2(" err1 = %d", err1); |
|
1821 |
|
1822 |
|
1823 LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 3"); |
|
1824 |
|
1825 |
|
1826 devDialog = CHbDeviceDialogSymbian::NewL(); |
|
1827 devDialog->Show(KHbNotifier, *varMap); |
|
1828 |
|
1829 User::WaitForRequest(status); |
|
1830 |
|
1831 propertykey.Close(); |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 CleanupStack::PopAndDestroy(3); |
|
1837 |
|
1838 |
|
1839 if(devDialog) |
|
1840 { |
|
1841 delete devDialog; |
|
1842 devDialog = NULL; |
|
1843 } |
|
1844 LOGSTRING("HandleDisplayAlertL ServerHbNotifier end"); |
|
1845 |
|
1846 } |
|
1847 TBool CNSmlDMCmds::IsHbSyncmlNotifierEnabledL() |
|
1848 { |
|
1849 CRepository * rep = |
|
1850 CRepository::NewLC(KCRUidDeviceManagementInternalKeys); |
|
1851 |
|
1852 TInt notifierenabled = KErrNone; |
|
1853 |
|
1854 TInt err = rep->Get(KDevManEnableHbNotifier, notifierenabled); |
|
1855 |
|
1856 CleanupStack::PopAndDestroy(rep); |
|
1857 |
|
1858 if (err == KErrNone && notifierenabled) |
|
1859 { |
|
1860 return ETrue; |
|
1861 } |
|
1862 else |
|
1863 { |
|
1864 return EFalse; |
|
1865 } |
|
1866 |
|
1867 } |
|
1868 |
1695 // --------------------------------------------------------- |
1869 // --------------------------------------------------------- |
1696 // CNSmlDMCmds::ProcessSyncL() |
1870 // CNSmlDMCmds::ProcessSyncL() |
1697 // Process received Add, Replace and Delete commands |
1871 // Process received Add, Replace and Delete commands |
1698 // --------------------------------------------------------- |
1872 // --------------------------------------------------------- |
1699 void CNSmlDMCmds::ProcessSyncL( SmlSync_t* /*aSync*/ ) |
1873 void CNSmlDMCmds::ProcessSyncL( SmlSync_t* /*aSync*/ ) |