--- a/backupandrestore/backupengine/src/absession.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backupengine/src/absession.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -148,12 +148,7 @@
iCallbackWatchdog = NULL;
// Remove this session from the server's session map
- // Use dynamic_cast in case that ABServer is deconstructing
- CABServer *pServer = dynamic_cast<CABServer*>(const_cast<CServer2*>(CSession2::Server()));
- if(pServer)
- {
- pServer->RemoveElement(iClientSID);
- }
+ Server().RemoveElement(iClientSID);
// Clear up any outstanding message
HandleIPCClosingDownCallback();
@@ -164,10 +159,7 @@
// If the client has detached properly, they should
// have done this - but just in case.
//DoCancelWaitForCallback();
- if(pServer)
- {
- pServer->DropSession();
- }
+ Server().DropSession();
}
void CABSession::CreateL()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/ABTester/data/backup_public_files_registration.xml Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="yes"?>
+
+
+<backup_registration>
+ <passive_backup>
+ <include_directory name = "\"/>
+ </passive_backup>
+
+ <public_backup>
+ <include_directory name = "c:\public\0FA00001\"/>
+ </public_backup>
+
+ <restore requires_reboot = "no"/>
+</backup_registration>
\ No newline at end of file
Binary file backupandrestore/backuptest/ABTester/data/base_active_backup_registration.xml has changed
Binary file backupandrestore/backuptest/ABTester/data/base_active_backup_registration2.xml has changed
Binary file backupandrestore/backuptest/ABTester/data/base_active_backup_registration3.xml has changed
Binary file backupandrestore/backuptest/ABTester/data/incremental_active_backup_registration.xml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/ABTester/data/passive_backup_registration.xml Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,94 @@
+<?xml version="1.0" standalone="yes"?>
+
+
+<backup_registration>
+ <passive_backup supports_selective="no" delete_before_restore="no" base_backup_only="yes">
+ <include_file name = "privatedata.txt"/>
+
+ <include_file name = "sbetest1.txt"/>
+ <include_file name = "sbetest2.txt"/>
+ <include_file name = "\sbetest3.txt"/>
+ <include_file name = "sys\install\log.txt"/>
+ <include_file name = "b:\system\System.ini"/>
+ <include_file name = "z:\resource\locales.txt"/>
+ <include_file name = "\resource2\locales.txt"/>
+ <include_file name = "!:\resource2\locales.txt"/>
+ <include_file name = "?:\resource2\locales.txt"/>
+ <include_file name = "*:\resource2\locales.txt"/>
+ <include_directory name="\" />
+ <include_directory name="c:\private\0AB7E58C" />
+ <include_directory name="c:\private\0AB7E58C\" />
+ <include_directory name="z:\private\0AB7E58C" />
+ <include_directory name="z:\private\0AB7E58C\" />
+ <include_directory name2="\" />
+ <include_directory name="" />
+ <include_directory name2="" />
+
+ <include_directory name="c:\" />
+ <include_directory name="!:\mydatabases\"/>
+ <exclude name = "sbetest1.txt"/>
+ <exclude name = "sbetest2.txt"/>
+ <exclude name = "\sbetest3.txt"/>
+ <exclude name = "sys\install\log.txt"/>
+ <exclude name = "a:\sbetest3_ex.txt"/>
+ <exclude name = "\:\sbetest1_ex.txt"/>
+ <exclude name = "sbetest2_ex.txt"/>
+ <exclude name = "\sys\install\log_ex.txt"/>
+ <exclude name = "\system\System_ex.ini"/>
+ <exclude name = "\resource\locales_ex.txt"/>
+ <exclude name = "\resource2\locales_ex.txt"/>
+ <exclude name = "!:\resource2\locales_ex.txt"/>
+ <exclude name = "?:\resource2\locales_ex.txt"/>
+ <exclude name = "*:\resource2\locales_ex.txt"/>
+ <exclude name="\a_ex" />
+ <exclude name="?:\b_ex" />
+ <exclude name="!:\mydatabases_ex\"/>
+ </passive_backup>
+ <public_backup delete_before_restore="yes">
+ <include_file name = "c:\sbetest1.txt"/>
+ <include_file name = "c:\sbetest2.txt"/>
+ <include_file name = "\sbetest3.txt"/>
+ <include_file name = "c:\sys\install\log.txt"/>
+ <include_file name = "c:\system\System.ini"/>
+ <include_file name = "c:\resource\locales.txt"/>
+ <include_file name = "\resource2\locales.txt"/>
+ <include_file name = "!:\resource2\locales.txt"/>
+ <include_file name = "?:\resource2\locales.txt"/>
+ <include_file name = "*:\resource2\locales.txt"/>
+ <include_directory name="\" />
+ <include_directory name="c:\private\0AB7E58C" />
+ <include_directory name="c:\private\0AB7E58C\" />
+ <include_directory name="z:\private\0AB7E58C" />
+ <include_directory name="z:\private\0AB7E58C\" />
+ <include_directory name2="\" />
+ <include_directory name="" />
+ <include_directory name2="" />
+
+ <include_directory name="c:\" />
+ <include_directory name="!:\mydatabases\"/>
+ <exclude name = "c:\sbetest3_ex.txt"/>
+ <exclude name = "c:\sbetest1_ex.txt"/>
+ <exclude name = "c:\sbetest2_ex.txt"/>
+ <exclude name = "\sbetest3.txt"/>
+ <exclude name = "c:\sys\install\log_ex.txt"/>
+ <exclude name = "c:\system\System_ex.ini"/>
+ <exclude name = "c:\resource\locales_ex.txt"/>
+ <exclude name = "\resource2\locales_ex.txt"/>
+ <exclude name = "!:\resource2\locales_ex.txt"/>
+ <exclude name = "?:\resource2\locales_ex.txt"/>
+ <exclude name = "*:\resource2\locales_ex.txt"/>
+ <exclude name="\a_ex" />
+ <exclude name="c:\b_ex" />
+ <exclude name="!:\mydatabases_ex\"/>
+
+ </public_backup>
+ <dbms_backup policy="AABBCCDDsdfsdafsdfsdafqw2332"/>
+ <dbms_backup policy=""/>
+ <dbms_backup/>
+ <dbms_backup policy="0x0AB7E58C"/>
+ <dbms_backup database="0x0AB7E58C"/>
+ <dbms_backup test1="0x0AB7E58C"/>
+ <system_backup />
+ <proxy_data_manager test2="0x10202BE9" />
+ <restore requires_reboot = "no"/>
+</backup_registration>
Binary file backupandrestore/backuptest/ABTester/data/proxy_active_backup_registration.xml has changed
--- a/backupandrestore/backuptest/ABTester/group/abtester.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/ABTester/group/abtester.iby Wed Sep 01 12:20:56 2010 +0100
@@ -21,13 +21,13 @@
file=ABI_DIR\BUILD_DIR\abtestclient3.EXE System\programs\abtestclient3.EXE
file=ABI_DIR\BUILD_DIR\abtestclient4.EXE System\programs\abtestclient4.EXE
-data=DATAZ_\private\0ab7e57c\backup_registration.xml private\0ab7e57c\backup_registration.xml
-data=DATAZ_\private\0ab7e57d\backup_registration.xml private\0ab7e57d\backup_registration.xml
-data=DATAZ_\private\0ab7e57e\backup_registration.xml private\0ab7e57e\backup_registration.xml
-data=DATAZ_\private\0ab7e58a\backup_registration.xml private\0ab7e58a\backup_registration.xml
-data=DATAZ_\private\0ab7e58b\backup_registration.xml private\0ab7e58b\backup_registration.xml
-data=DATAZ_\private\0ab7e58c\backup_registration.xml private\0ab7e58c\backup_registration.xml
+data=DATAZ_\private\0AB7E57C\backup_registration.xml private\0AB7E57C\backup_registration.xml
+data=DATAZ_\private\0AB7E57D\backup_registration.xml private\0AB7E57D\backup_registration.xml
+data=DATAZ_\private\0AB7E57E\backup_registration.xml private\0AB7E57E\backup_registration.xml
+data=DATAZ_\private\0AB7E58A\backup_registration.xml private\0AB7E58A\backup_registration.xml
+data=DATAZ_\private\0AB7E58B\backup_registration.xml private\0AB7E58B\backup_registration.xml
+data=DATAZ_\private\0AB7E58C\backup_registration.xml private\0AB7E58C\backup_registration.xml
-data=DATAZ_\private\0fa00001\backup_registration.xml private\0fa00001\backup_registration.xml
+data=DATAZ_\private\0FA00001\backup_registration.xml private\0FA00001\backup_registration.xml
#endif
--- a/backupandrestore/backuptest/burtestserver/Group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/Group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -40,8 +40,9 @@
../testscripts/test_restorepackage.script z:/testdata/scripts/sbetestdata/test_restorepackage.script
../testscripts/test_increament.script z:/testdata/scripts/sbetestdata/test_increament.script
-../../testdata/armv5/bigexeforbackup.sis /epoc32/data/z/testdata/scripts/sbetestdata/bigexeforbackup.sis
-../../testdata/armv5/test_dll_nopublic.sis /epoc32/data/z/testdata/scripts/sbetestdata/test_dll_nopublic.sis
+../testscripts/sbeconfig.xml /epoc32/release/winscw/udeb/z/private/10202d56/sbeconfig.xml
+../testscripts/sbeconfig.xml /epoc32/release/winscw/urel/z/private/10202d56/sbeconfig.xml
+
PRJ_TESTMMPFILES
burtestserver.mmp
--- a/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Wed Sep 01 12:20:56 2010 +0100
@@ -35,10 +35,6 @@
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_activebackuprestore.script testdata\scripts\sbetestdata\test_activebackuprestore.script
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_increament.script testdata\scripts\sbetestdata\test_increament.script
-data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\bigexeforbackup.sis testdata\scripts\sbetestdata\bigexeforbackup.sis
-data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_dll_nopublic.sis testdata\scripts\sbetestdata\test_dll_nopublic.sis
-
-
#ifndef __SERIES60_
data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\sbeconfig.xml private\10202d56\sbeconfig.xml
#endif
--- a/backupandrestore/backuptest/burtestserver/TestSteps/inc/t_burteststepbase.h Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/inc/t_burteststepbase.h Wed Sep 01 12:20:56 2010 +0100
@@ -90,9 +90,6 @@
public:
RSIDArray iSidArray;
- // add support for exclude sid list
- RSIDArray iExcludeSidArray;
-
private:
HBufC* GetIndentation(TInt aLevel);
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -63,9 +63,6 @@
iDataOwners.Close();
iSidArray.Close();
-
- iExcludeSidArray.Close();
-
iJidArray.Close();
iPublicFileNames.Close();
iPrivateFileNames.Close();
@@ -390,48 +387,6 @@
/** Read private file sizes into array */
_LIT(KExpectPrivateFileSizes, "ExpectPrivateFileSizes");
ReadListIntoIntArray(KExpectPrivateFileSizes, delimiter, iPrivateFileSizes);
-
- // Read Exclude IDs LIST //
- TSecureId sid;
- TChar ch;
- TPtrC list;
-
- // clear the array
- iExcludeSidArray.Reset();
- // read the string
- _LIT(KExcludeSIDList, "ExcludeIDs");
- GetStringFromConfig(ConfigSection(), KExcludeSIDList, list);
- TLex sidLex(list);
- // parse the string
- while (!sidLex.Eos())
- {
- sidLex.Mark();
- ch=sidLex.Peek();
-
- while(!sidLex.Eos() && ( ch=sidLex.Peek() ) != TChar(','))
- sidLex.Inc();
-
- if(!sidLex.TokenLength())
- continue;
-
- TPtrC pToken = sidLex.MarkedToken();
- TLex token(pToken);
-
- if (pToken.Length() <= KMaxHexLength && token.Val(sid.iId, EHex) == KErrNone)
- {
- iExcludeSidArray.Append(sid);
- _LIT(KFound, "Exclude ID Found in ini file: ");
- LogWithSID(LOG_LEVEL4, KFound, sid);
- } //if
-
- if(ch==TChar(','))
- sidLex.Inc();
-
- sidLex.SkipSpace();
-
- } //while
-
-
}
void CBURTestStepBase::ReadListIntoStringArray(const TDesC& aSectionName, const TChar& aDelimiter, RArray<TPtrC>& aResultList)
@@ -503,6 +458,7 @@
LogWithNum(LOG_LEVEL2,KTempText1, err);
iFailures++;
}
+
// Log
if (iDataOwners.Count() == 0)
{
@@ -514,30 +470,6 @@
_LIT(KTempText4, "Number of data owners found on device: ");
LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
}
-
- //filter the dataowners per the exclude SID list
- for (TInt index = 0; index < iDataOwners.Count(); index++)
- {
- TSecureId sid = NULL;
- sid = ExtractIDL(*iDataOwners[index]);
-
- if (sid != NULL)
- {
- TInt position = iExcludeSidArray.Find(sid);
- if (position != KErrNotFound)
- {
- _LIT(KTempText2, "ExcludeID found in list of data owners: ");
- LogWithSID(LOG_LEVEL3, KTempText2, sid);
-
- delete iDataOwners[index];
- iDataOwners[index] = NULL;
- iDataOwners.Remove(index);
- index--;
- }
- }
- }
-
-
}
void CBURTestStepBase::PopulateListOfDataOwnersAsyncL()
@@ -578,28 +510,6 @@
_LIT(KTempText4, "Number of data owners found on device: ");
LogWithNum(LOG_LEVEL3, KTempText4, iDataOwners.Count());
}
-
- //filter the dataowners per the exclude SID list
- for (TInt index = 0; index < iDataOwners.Count(); index++)
- {
- TSecureId sid = NULL;
- sid = ExtractIDL(*iDataOwners[index]);
-
- if (sid != NULL)
- {
- TInt position = iExcludeSidArray.Find(sid);
- if (position != KErrNotFound)
- {
- _LIT(KTempText2, "ExcludeID found in list of data owners: ");
- LogWithSID(LOG_LEVEL3, KTempText2, sid);
-
- delete iDataOwners[index];
- iDataOwners[index] = NULL;
- iDataOwners.Remove(index);
- index--;
- }
- }
- }
}
void CBURTestStepBase::SetBURModeL(TBURPartType aBURPartType, TBackupIncType aBackupIncType)
@@ -647,8 +557,8 @@
for (TInt index = 0; index < iDataOwners.Count(); index++)
{
TBool notFound = ETrue;
- sid = ExtractIDL(*iDataOwners[index]);
-
+ sid = ExtractIDL(*iDataOwners[index]);
+
if (sid != NULL)
{
TInt position = iSidArray.Find(sid);
@@ -666,22 +576,19 @@
else // possibly jid
{
HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
- if (pSuiteHash != NULL)
- {
- TPtrC suiteHash = pSuiteHash->Des();
- if (iJidArray.Find(suiteHash) != KErrNotFound)
- {
- _LIT(KTempText3, "Java ID found in list of data owners: ");
- LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
- notFound = EFalse;
- }
- else // not found
- {
- notFound = ETrue;
- }
- delete pSuiteHash;
- pSuiteHash = NULL;
- }
+ TPtrC suiteHash = pSuiteHash->Des();
+ if (iJidArray.Find(suiteHash) != KErrNotFound)
+ {
+ _LIT(KTempText3, "Java ID found in list of data owners: ");
+ LogWithText(LOG_LEVEL3, KTempText3, suiteHash);
+ notFound = EFalse;
+ }
+ else // not found
+ {
+ notFound = ETrue;
+ }
+ delete pSuiteHash;
+ pSuiteHash = NULL;
}
if (notFound)
{
@@ -1316,12 +1223,6 @@
j--;
total--;
}
- else
- {
- // print the status
- LogWithSID(LOG_LEVEL3, _L("---The unexpected dataowner status-SID: "),statusArray[j].iSID.iId);
- LogWithNum(LOG_LEVEL3,_L("---The unexpected dataowner status-status: "),statusArray[j].iStatus) ;
- }
} //for
statusArray.Reset();
CleanupStack::PopAndDestroy(&statusArray);
@@ -1466,25 +1367,8 @@
for (TInt i=0; i < KRetries;)
{
-
-
- LogWithNum(LOG_LEVEL3,_L("retryies :"), i);
-
CheckSIDStatusL(iTransferTypes, readyArray);
-
-
- LogWithNum(LOG_LEVEL3,_L("readyArray count :"), readyArray.Count());
-
- // print all the ready array
- for(TInt jj = 0 ; jj < readyArray.Count(); jj++)
- {
- CSBSIDTransferType* type = CSBSIDTransferType::NewL(readyArray[jj]);
- CleanupStack::PushL(type);
-
- LogWithSID(LOG_LEVEL3, _L("readyArray SIDs : ") , type->SecureIdL());
- CleanupStack::PopAndDestroy(type);
- }
-
+
if (readyArray.Count()) // dataowners ready
{
// ========= Supply Data ================
@@ -1505,19 +1389,6 @@
iFailures++;
_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
Log(LOG_LEVEL3, KLogNoTrans);
-
- // print the remenan sids
- for( TInt kk = 0 ; kk <iTransferTypes.Count() ; kk++)
- {
-
- CSBSIDTransferType* sidType = CSBSIDTransferType::NewL(iTransferTypes[kk]);
- CleanupStack::PushL(sidType);
- TSecureId id = NULL;
- id = sidType->SecureIdL();
- CleanupStack::PopAndDestroy(sidType);
- LogWithSID(LOG_LEVEL3, _L("--iTransferTypes, remanent SIDs : "),id.iId);
- }
- //
}
readyArray.ResetAndDestroy();
CleanupStack::PopAndDestroy(&readyArray);
@@ -1611,6 +1482,7 @@
{
User::Leave(KErrInUse);
}
+ iStatus = KRequestPending;
SetActive();
iActiveScheduler->Start();
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -17,7 +17,7 @@
@file
@released
*/
-#include "W32STD.H"
+
#include "t_teststepbackup.h"
namespace bur_ts
@@ -145,8 +145,6 @@
Log(LOG_LEVEL2, KLog3);
}
- _LIT(KLog31, "Checking valid registration...");
- Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -203,13 +201,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // do active backup when in partial backup mode
- if (iIsPartial)
- {
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
- }
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveBaseDataL();
@@ -244,13 +238,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // do active backup when in partial backup mode
- if (iIsPartial)
- {
- //active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
- }
+ // active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveIncDataL();
@@ -540,10 +530,6 @@
TRAPD(error,
for (TInt i=0; i < KRetries;)
{
- //
- LogWithNum(LOG_LEVEL3,_L("doActiveBackup-retryies :"), i);
-
-
CheckSIDStatusL(transferTypes, iTransferTypes);
if (iTransferTypes.Count()) // dataowners ready
{
@@ -565,20 +551,7 @@
iFailures++;
_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
Log(LOG_LEVEL3, KLogNoTrans);
-
-
- //print the remenant sids
- for( TInt kk = 0 ; kk <transferTypes.Count() ; kk++)
- {
-
- CSBSIDTransferType* sidType = CSBSIDTransferType::NewL(transferTypes[kk]);
- CleanupStack::PushL(sidType);
- TSecureId id = NULL;
- id = sidType->SecureIdL();
- CleanupStack::PopAndDestroy(sidType);
- LogWithSID(LOG_LEVEL3, _L("doActiveBackup-transferTypes, remanent SIDs : "),id.iId);
- }
- } //if
+ } //if
transferTypes.ResetAndDestroy();
User::LeaveIfError(error);
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -204,13 +204,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // do active backup when in partial backup mode
- if (iIsPartial)
- {
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
- }
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveBaseDataL();
@@ -245,13 +241,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // do active backup when in partial backup mode
- if (iIsPartial)
- {
- //active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
- }
+ // active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -148,8 +148,6 @@
Log(LOG_LEVEL2, KLog3);
}
- _LIT(KLog31, "Checking valid registration...");
- Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -206,12 +204,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- if (iIsPartial)
- {
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
- }
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveBaseDataL();
@@ -256,12 +251,9 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- if (iIsPartial)
- {
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
- }
+ // active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -241,13 +241,9 @@
SupplyPassiveSnapshotDataL();
RestorePassiveBaseDataL();
- // do active restore when in partial restore mode
- if (iIsPartial)
- {
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- }
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
}
void CBURTestStepRestore::IncrementalRestoreL()
@@ -263,14 +259,11 @@
RestorePassiveBaseDataL();
RestorePassiveIncDataL();
- // do active restore when in partial restore mode
- if (iIsPartial)
- {
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
- }
+
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -200,12 +200,9 @@
{
RestoreJavaMidletDataL();
- if (iIsPartial)
- {
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
- }
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
//active
SupplyActiveSnapshotDataL();
@@ -219,19 +216,17 @@
*/
{
RestoreJavaMidletDataL();
-
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
- RestorePassiveIncDataL();
-
- if (iIsPartial)
- {
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
- }
+
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
+ RestorePassiveIncDataL();
+
+
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
}
--- a/backupandrestore/backuptest/burtestserver/testscripts/test.ini Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test.ini Wed Sep 01 12:20:56 2010 +0100
@@ -17,14 +17,12 @@
IsPartial=0
BaseOnly=1
DriveList=c
-ExcludeIDs=10281d18,101fdf81,2000b4d8,1028246f,1028312B,200286d2,101F51F2,10202BE9,101F99FB,100069CC,20021367,10003A73,101F401D,2002BCC0,1020383E
[BACKUP_RESTORE_0040]
BackupDir=c:\BackupArchive\
IsPartial=0
BaseOnly=0
DriveList=c
-ExcludeIDs=10281d18,101fdf81,2000b4d8,1028246f,1028312B,200286d2,101F51F2,10202BE9,101F99FB,100069CC,20021367,10003A73,101F401D,2002BCC0,1020383E
[BACKUP_RESTORE_0050]
BackupDir=c:\BackupArchive\
--- a/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestore.script Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestore.script Wed Sep 01 12:20:56 2010 +0100
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////
LOAD_SUITE BURTestServer
+DELAY 120000
+
PRINT ----------------------------------------------
PRINT Test Backup Restore
PRINT ----------------------------------------------
--- a/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestoreasync.script Tue Aug 31 16:03:15 2010 +0300
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestoreasync.script Wed Sep 01 12:20:56 2010 +0100
@@ -21,6 +21,8 @@
////////////////////////////////////////////////////////////////////////////////////
LOAD_SUITE BURTestServer
+DELAY 120000
+
PRINT ----------------------------------------------
PRINT Test Backup Restore Async
PRINT ----------------------------------------------
Binary file backupandrestore/backuptest/testdata/armv5/bigexeforbackup.sis has changed
Binary file backupandrestore/backuptest/testdata/armv5/test_dll_nopublic.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Info.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleGetInfoString</key>
+ <string>Nokia S60-32 v1.0, © Nokia</string>
+ <key>CFBundleIdentifier</key>
+ <string>nokia.com.phoneplugin.com.nokia.S6032</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Nokia S60-32</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>556</string>
+ <key>IPHPhoneConduitVersion</key>
+ <string>597.0</string>
+ <key>IPHPhonePluginUID</key>
+ <string>367C0F5C-1E53-44A3-AEA5-54D1EEE12F29</string>
+ <key>IPHPluginProviderName</key>
+ <string>Nokia</string>
+ <key>IPHPluginSupportURL</key>
+ <string>http://www.nokia.com/support</string>
+ <key>IPHPublicPluginVersion</key>
+ <string>2.0</string>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/MetaClasses.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dict>
+ <key>family.com.nokia.S6032</key>
+ <dict>
+ <key>InheritsFrom</key>
+ <array>
+ <string>family.com.apple.external.all-phones.usb-bt</string>
+ </array>
+ <key>Services</key>
+ <array>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.synchro</string>
+ <key>ServiceClass</key>
+ <string>IPHSyncMLSyncTransportServiceObexClient</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>IPHEnginePlist</key>
+ <string>SyncEngine.plist</string>
+ <key>SyncProperties2</key>
+ <string>PhoneConduit.plist</string>
+ <key>SyncMLVersion</key>
+ <string>SyncML11</string>
+ <key>SyncMLLargeObjectSupport</key>
+ <true/>
+ <key>SyncMLNumberOfChangesSupport</key>
+ <true/>
+ <key>SyncMLRefreshFromServerSupport</key>
+ <true/>
+ <key>SyncMLRemoteNeedsRelativePaths</key>
+ <false/>
+ <key>SyncMLBusySignalingSupport</key>
+ <true/>
+ <key>SyncMLOnlyOneBusySignaling</key>
+ <false/>
+ <key>SyncMLBusySignalingInterval</key>
+ <integer>60</integer>
+ <key>SyncMLSimulateBusySignalingWithEmptySync</key>
+ <false/>
+ <key>SyncDataClasses</key>
+ <plist>
+ <array>
+ <string>com.apple.pimsync.contacts</string>
+ <string>com.apple.pimsync.calendars</string>
+ </array>
+ </plist>
+ <key>DontSyncEventsAfterDateValue.visible</key>
+ <true/>
+ <key>DontSyncEventsAfterDateValue.default-value</key>
+ <string>1month</string>
+ <key>OnlySyncContactsWithPhoneNumber.visible</key>
+ <true/>
+ <key>OnlySyncContactsWithPhoneNumber.default-value</key>
+ <false/>
+ <key>SyncAllDayEventsKey.visible</key>
+ <false/>
+ <key>SyncAllDayEventsKey.default-value</key>
+ <true/>
+ <key>DontSyncEventsPriorToDateValue.visible</key>
+ <true/>
+ <key>DontSyncEventsPriorToDateValue.default-value</key>
+ <string>1week</string>
+ <key>DontSyncEventsPriorToDateIsEnabled.visible</key>
+ <false/>
+ <key>DontSyncEventsPriorToDateIsEnabled.default-value</key>
+ <true/>
+ <key>DontSyncEventsAfterDateIsEnabled.visible</key>
+ <true/>
+ <key>DontSyncEventsAfterDateIsEnabled.default-value</key>
+ <true/>
+ <key>SyncMLLocalSource</key>
+ <string>iSync</string>
+ <key>SyncMLCodec</key>
+ <string>SyncMLCodecLibWBXML</string>
+ <key>SyncMLMsgTemporization</key>
+ <integer>500000</integer>
+ <key>SyncMLMaxObjSize</key>
+ <integer>786432</integer>
+ <key>SyncMLMaxMsgSize</key>
+ <integer>65535</integer>
+ <key>BTProtocolService</key>
+ <string>com.nokia.S6032.protocol.bt.obex.syncml</string>
+ <key>USBProtocolService</key>
+ <string>com.nokia.S6032.protocol.usb.obex.syncml</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.nokia.S6032.protocol.usb.obex.syncml</string>
+ <key>ServiceClass</key>
+ <string>IPHObexService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>ObexTargetUUID</key>
+ <string>53 59 4e 43 4d 4c 2d 53 59 4e 43</string>
+ <key>ObexTimeOut</key>
+ <integer>60</integer>
+ <key>TransportService</key>
+ <string>com.nokia.S6032.transport.usb.syncml</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.nokia.S6032.protocol.bt.obex.syncml</string>
+ <key>ServiceClass</key>
+ <string>IPHObexService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>ObexTargetUUID</key>
+ <string>53 59 4e 43 4d 4c 2d 53 59 4e 43</string>
+ <key>ObexTimeOut</key>
+ <integer>60</integer>
+ <key>TransportService</key>
+ <string>com.nokia.S6032.transport.rfcomm.syncml</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.protocol.usb.AT</string>
+ <key>ServiceClass</key>
+ <string>IPHSerialATService</string>
+ <key>ServiceProperties</key>
+ <dict/>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.nokia.S6032.transport.rfcomm.syncml</string>
+ <key>ServiceClass</key>
+ <string>IPHRFCOMMChannelService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>RFCOMMChannelUUID</key>
+ <string>000000020000100080000002ee000002</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.transport.usb.modem</string>
+ <key>ServiceClass</key>
+ <string>IPHUSBCDCChannelService</string>
+ <key>ServiceProperties</key>
+ <dict/>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.nokia.S6032.transport.usb.syncml</string>
+ <key>ServiceClass</key>
+ <string>IPHUSBObexChannelService</string>
+ <key>ServiceProperties</key>
+ <dict/>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.pimsync.parser.vCal</string>
+ <key>ServiceClass</key>
+ <string>IPHSyncParserService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>ParserType</key>
+ <string>vCal</string>
+ <key>Encoding</key>
+ <string>QUOTED-PRINTABLE</string>
+ <key>FoldingStyle</key>
+ <string>FoldingNG</string>
+ <key>Charset</key>
+ <string>UTF-8</string>
+ <key>AllDayEventFormat</key>
+ <string>AllDayEventFromMidnightTo235900</string>
+ <key>vCalRecDropIfUseless</key>
+ <true/>
+ <key>EscapeSemicolonInNotComponedValues</key>
+ <true/>
+ <key>EscapeBackslash</key>
+ <true/>
+ <key>IgnoreProperties</key>
+ <array>
+ <string>X-IRMC-LUID</string>
+ </array>
+ <key>UntilDateInLocal</key>
+ <true/>
+ <key>SetUntilTimeWithStartTime</key>
+ <true/>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.pimsync.parser.vCard</string>
+ <key>ServiceClass</key>
+ <string>IPHSyncParserService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>ParserType</key>
+ <string>vCard</string>
+ <key>Encoding</key>
+ <string>QUOTED-PRINTABLE</string>
+ <key>FoldingStyle</key>
+ <string>FoldingNG</string>
+ <key>Charset</key>
+ <string>UTF-8</string>
+ <key>EscapeSemicolonInNotComponedValues</key>
+ <true/>
+ <key>EscapeBackslash</key>
+ <true/>
+ <key>IgnoreProperties</key>
+ <array>
+ <string>X-IRMC-LUID</string>
+ </array>
+ <key>PropertyNameMapping</key>
+ <dict>
+ <key>X-NICKNAME</key>
+ <string>X-EPOCSECONDNAME</string>
+ </dict>
+ <key>AddCRLFAfterBase64Folding</key>
+ <true/>
+ <key>IgnoreSubTypesForThisMainTypes</key>
+ <array>
+ <string>CELL</string>
+ </array>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.pimsync.contacts</string>
+ <key>ServiceClass</key>
+ <string>IPHSyncDataClassService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>MimeType</key>
+ <string>text/x-vcard</string>
+ <key>ParserService</key>
+ <string>com.apple.pimsync.parser.vCard</string>
+ <key>RemoteName</key>
+ <string></string>
+ <key>needsCompanyNameInFirstName</key>
+ <false/>
+ <key>needsFullAddressInStreetField</key>
+ <false/>
+ <key>DataClassName</key>
+ <string>Contacts</string>
+ <key>needsDeleteAddOnModify</key>
+ <true/>
+ <key>MaxSyncCmd</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.pimsync.calendars</string>
+ <key>ServiceClass</key>
+ <string>IPHSyncDataClassService</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>MimeType</key>
+ <string>text/x-vcalendar</string>
+ <key>ParserService</key>
+ <string>com.apple.pimsync.parser.vCal</string>
+ <key>hasEvent</key>
+ <true/>
+ <key>RemoteName</key>
+ <string></string>
+ <key>hasAllDayEvents</key>
+ <false/>
+ <key>hasAllDayFromMidnightTo235900</key>
+ <true/>
+ <key>hasVCalRecurrence</key>
+ <true/>
+ <key>needsToFormatCountToUntilDate</key>
+ <true/>
+ <key>needsToFormatUntilDateToCount</key>
+ <false/>
+ <key>hasOneAlarmType</key>
+ <true/>
+ <key>alarmTypeIsDisplay</key>
+ <false/>
+ <key>hasTimeZone</key>
+ <true/>
+ <key>hasTask</key>
+ <true/>
+ <key>handleAllDayRecurrent</key>
+ <true/>
+ <key>doNotSyncAlarmIfAfterStartDateTime</key>
+ <true/>
+ <key>DataClassName</key>
+ <string>Calendar</string>
+ <key>allDayInLocalDateTime</key>
+ <true/>
+ <key>untilDateIsDateOnly</key>
+ <true/>
+ <key>exDatesAreDateOnly</key>
+ <false/>
+ <key>doNotSyncAlarmIfCompleted</key>
+ <true/>
+ <key>dueDateIsDateOnly</key>
+ <false/>
+ </dict>
+ </dict>
+ </array>
+ </dict>
+ <key>com.nokia.S6032</key>
+ <dict>
+ <key>Identification</key>
+ <dict>
+ <key>com.apple.usb.vendorid-modelid</key>
+ <string>0x0421/0x0500</string>
+ <key>com.apple.gmi+gmm</key>
+ <string>Nokia+Nokia 6290</string>
+ </dict>
+ <key>InheritsFrom</key>
+ <array>
+ <string>family.com.nokia.S6032</string>
+ </array>
+ <key>Services</key>
+ <array>
+ <dict>
+ <key>ServiceName</key>
+ <string>com.apple.model</string>
+ <key>ServiceProperties</key>
+ <dict>
+ <key>ModelName</key>
+ <string>S60-32</string>
+ <key>CompanyName</key>
+ <string>Nokia</string>
+ <key>ModelIcon</key>
+ <string>com.nokia.S6032.tiff</string>
+ </dict>
+ </dict>
+ </array>
+ </dict>
+</dict>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/PhoneConduit.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Formatting</key>
+ <dict>
+ <key>com.apple.calendars.Event</key>
+ <dict>
+ <key>classification</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>PUBLIC</string>
+ <key>originalValue</key>
+ <string>public</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>private</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>confidential</string>
+ </dict>
+ </array>
+ </dict>
+ <key>description</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>500</integer>
+ </dict>
+ <key>end date</key>
+ <dict/>
+ <key>location</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>start date</key>
+ <dict/>
+ <key>summary</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>500</integer>
+ </dict>
+ </dict>
+ <key>com.apple.calendars.Task</key>
+ <dict>
+ <key>classification</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>PUBLIC</string>
+ <key>originalValue</key>
+ <string>public</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>private</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>confidential</string>
+ </dict>
+ </array>
+ </dict>
+ <key>completion date</key>
+ <dict/>
+ <key>description</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>due date</key>
+ <dict/>
+ <key>priority</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>1</string>
+ <key>originalValue</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>2</string>
+ <key>originalValue</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>3</string>
+ <key>originalValue</key>
+ <integer>3</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>4</string>
+ <key>originalValue</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>5</string>
+ <key>originalValue</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>6</string>
+ <key>originalValue</key>
+ <integer>6</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>7</string>
+ <key>originalValue</key>
+ <integer>7</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>8</string>
+ <key>originalValue</key>
+ <integer>8</integer>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>9</string>
+ <key>originalValue</key>
+ <integer>9</integer>
+ </dict>
+ </array>
+ </dict>
+ <key>status</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>DECLINED</string>
+ <key>originalValue</key>
+ <string>cancelled</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>NEEDS ACTION</string>
+ <key>originalValue</key>
+ <string>needsaction</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>COMPLETED</string>
+ <key>originalValue</key>
+ <string>completed</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>ACCEPTED</string>
+ <key>originalValue</key>
+ <string>inprocess</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>none</string>
+ </dict>
+ </array>
+ </dict>
+ <key>summary</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.Contact</key>
+ <dict>
+ <key>birthday</key>
+ <dict/>
+ <key>company name</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>department</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>first name</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>image</key>
+ <dict>
+ <key>maxLength</key>
+ <integer>0</integer>
+ </dict>
+ <key>job title</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>last name</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>middle name</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>nickname</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>notes</key>
+ <dict>
+ <key>maxLength</key>
+ <integer>1000</integer>
+ </dict>
+ <key>suffix</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>title</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.Date</key>
+ <dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array/>
+ </dict>
+ <key>value</key>
+ <dict/>
+ </dict>
+ <key>com.apple.contacts.Email Address</key>
+ <dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>INTERNET</string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.Phone Number</key>
+ <dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>CELL</string>
+ <key>originalValue</key>
+ <string>mobile</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>FAX</string>
+ <key>originalValue</key>
+ <string>work fax</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>FAX</string>
+ <key>originalValue</key>
+ <string>home fax</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>main</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>PAGER</string>
+ <key>originalValue</key>
+ <string>pager</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>charsToKeep</key>
+ <string>0123456789+#*pw</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.Related Name</key>
+ <dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>X-CHILDREN</string>
+ <key>originalValue</key>
+ <string>child</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>X-SPOUSE</string>
+ <key>originalValue</key>
+ <string>spouse</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>X-ASSISTANT</string>
+ <key>originalValue</key>
+ <string>assistant</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.Street Address</key>
+ <dict>
+ <key>city</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>country</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>postal code</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>state</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>street</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>255</integer>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ <key>relationshipConstraint</key>
+ <string>perSubType</string>
+ <key>relationshipSize</key>
+ <integer>1</integer>
+ </dict>
+ </dict>
+ <key>com.apple.contacts.URL</key>
+ <dict>
+ <key>type</key>
+ <dict>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home page</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <integer>500</integer>
+ </dict>
+ </dict>
+ </dict>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/SyncEngine.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Entities</key>
+ <dict>
+ <key>com.apple.calendars.AudioAlarm</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>triggerdate</string>
+ <string>triggerduration</string>
+ <string>owner</string>
+ </array>
+ <key>com.apple.calendars.Calendar</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>title</string>
+ <string>read only</string>
+ <string>com.apple.PhoneConduitExtension.uid</string>
+ </array>
+ <key>com.apple.calendars.DisplayAlarm</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>triggerdate</string>
+ <string>triggerduration</string>
+ <string>owner</string>
+ </array>
+ <key>com.apple.calendars.Event</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>original date</string>
+ <string>all day</string>
+ <string>exception dates</string>
+ <string>calendar</string>
+ <string>recurrences</string>
+ <string>main event</string>
+ <string>detached events</string>
+ <string>audio alarms</string>
+ <string>display alarms</string>
+ <string>start date</string>
+ <string>location</string>
+ <string>summary</string>
+ <string>end date</string>
+ <string>description</string>
+ <string>classification</string>
+ </array>
+ <key>com.apple.calendars.Recurrence</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>frequency</string>
+ <string>count</string>
+ <string>until</string>
+ <string>interval</string>
+ <string>bymonth</string>
+ <string>byweeknumber</string>
+ <string>byyearday</string>
+ <string>bymonthday</string>
+ <string>bydayfreq</string>
+ <string>bydaydays</string>
+ <string>bysetpos</string>
+ <string>weekstartday</string>
+ <string>owner</string>
+ </array>
+ <key>com.apple.calendars.Task</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>due date is date only</string>
+ <string>calendar</string>
+ <string>audio alarms</string>
+ <string>display alarms</string>
+ <string>status</string>
+ <string>summary</string>
+ <string>completion date</string>
+ <string>description</string>
+ <string>due date</string>
+ <string>classification</string>
+ <string>priority</string>
+ </array>
+ <key>com.apple.contacts.Contact</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>title</string>
+ <string>suffix</string>
+ <string>image</string>
+ <string>last name</string>
+ <string>company name</string>
+ <string>first name</string>
+ <string>middle name</string>
+ <string>job title</string>
+ <string>nickname</string>
+ <string>notes</string>
+ <string>department</string>
+ <string>birthday</string>
+ <string>email addresses</string>
+ <string>phone numbers</string>
+ <string>URLs</string>
+ <string>street addresses</string>
+ <string>related names</string>
+ <string>dates</string>
+ </array>
+ <key>com.apple.contacts.Date</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>value</string>
+ <string>type</string>
+ </array>
+ <key>com.apple.contacts.Email Address</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>value</string>
+ <string>type</string>
+ </array>
+ <key>com.apple.contacts.Phone Number</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>value</string>
+ <string>type</string>
+ </array>
+ <key>com.apple.contacts.Related Name</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>value</string>
+ <string>type</string>
+ </array>
+ <key>com.apple.contacts.Street Address</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>city</string>
+ <string>state</string>
+ <string>street</string>
+ <string>country</string>
+ <string>type</string>
+ <string>postal code</string>
+ </array>
+ <key>com.apple.contacts.URL</key>
+ <array>
+ <string>com.apple.syncservices.RecordEntityName</string>
+ <string>contact</string>
+ <string>value</string>
+ <string>type</string>
+ </array>
+ </dict>
+ <key>Type</key>
+ <string>device</string>
+</dict>
+</plist>
Binary file connectivitymodules/SeCon/apple/S60_RnD_32.phoneplugin/Contents/Resources/com.nokia.S6032.tiff has changed
Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.bom has changed
Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Archive.pax.gz has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Info.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleGetInfoString</key>
+ <string>0.0, Copyright 2006 Apple Computer, Inc.</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.isyncpluginmaker.phoneplugin</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.0</string>
+ <key>IFMajorVersion</key>
+ <integer>1</integer>
+ <key>IFMinorVersion</key>
+ <integer>0</integer>
+ <key>IFPkgFlagAllowBackRev</key>
+ <false/>
+ <key>IFPkgFlagAuthorizationAction</key>
+ <string>AdminAuthorization</string>
+ <key>IFPkgFlagBackgroundAlignment</key>
+ <string>topleft</string>
+ <key>IFPkgFlagBackgroundScaling</key>
+ <string>none</string>
+ <key>IFPkgFlagDefaultLocation</key>
+ <string>/</string>
+ <key>IFPkgFlagFollowLinks</key>
+ <true/>
+ <key>IFPkgFlagInstallFat</key>
+ <false/>
+ <key>IFPkgFlagInstalledSize</key>
+ <integer>156</integer>
+ <key>IFPkgFlagIsRequired</key>
+ <false/>
+ <key>IFPkgFlagOverwritePermissions</key>
+ <false/>
+ <key>IFPkgFlagRelocatable</key>
+ <false/>
+ <key>IFPkgFlagRestartAction</key>
+ <string>NoRestart</string>
+ <key>IFPkgFlagRootVolumeOnly</key>
+ <true/>
+ <key>IFPkgFlagUpdateInstalledLanguages</key>
+ <false/>
+ <key>IFPkgFormatVersion</key>
+ <real>0.10000000149011612</real>
+ <key>IFRequirementDicts</key>
+ <array>
+ <dict>
+ <key>LabelKey</key>
+ <string>iSync24Label</string>
+ <key>MessageKey</key>
+ <string>iSync2XMessage</string>
+ <key>SpecArgument</key>
+ <string>/Applications/iSync.app/Contents/Info.plist</string>
+ <key>SpecProperty</key>
+ <string>CFBundleVersion</string>
+ <key>SpecType</key>
+ <string>plist</string>
+ <key>TestObject</key>
+ <string>500.134</string>
+ <key>TestOperator</key>
+ <string>ge</string>
+ <key>TitleKey</key>
+ <string>iSync24Title</string>
+ </dict>
+ </array>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/PkgInfo Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1 @@
+pkmkrpkg1
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Description.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IFPkgDescriptionDescription</key>
+ <string>Description of a Phone Plug-in</string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>the phone plug-in</string>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/English.lproj/ReadMe.rtf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,6 @@
+{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\fs24 \cf0 This package has been built by Nokia Corporation. It will install a phone plugin to enable iSync support for your phone E60}
\ No newline at end of file
Binary file connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/IFRequirement.strings has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/PhonePlugin.info Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,17 @@
+Title Phone Plug-in
+Version
+Description
+DefaultLocation /Library/PhonePlugins
+DeleteWarning
+
+### Package Flags
+
+NeedsAuthorization NO
+Required YES
+Relocatable YES
+RequiresReboot NO
+UseUserMask NO
+OverwritePermissions NO
+InstallFat NO
+RootVolumeOnly YES
+OnlyUpdateInstalledLanguages NO
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/TokenDefinitions.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>iSyncToken</key>
+ <array>
+ <dict>
+ <key>searchPlugin</key>
+ <string>CommonAppSearch</string>
+ <key>path</key>
+ <string>/Applications/iSync.app</string>
+ <key>identifier</key>
+ <string>com.apple.isync</string>
+ </dict>
+ </array>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/Welcome.rtf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,17 @@
+{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf380
+{\fonttbl\f0\fnil\fcharset77 LucidaGrande-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fnil\fcharset77 LucidaGrande;
+}
+{\colortbl;\red255\green255\blue255;\red1\green1\blue1;}
+\vieww9000\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\b\fs24 \cf0 Welcome to the iSync Phone Plug-in for Mac OS X Installer
+\f1\b0 \
+\
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f2\fs22 \cf0 iSync for Mac OS X is synchronization software that keeps your Address Book contacts and iCal calendar and to-do information in sync between your Mac OS computers and iSync-compatible mobile phones.\
+\
+This installer guides you through the steps necessary to install an iSync Phone Plug-in for Mac OS X. To get started, click Continue.
+\f1\fs24 \cf2 \
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/en.lproj/Description.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>IFPkgDescriptionDescription</key>
+ <string></string>
+ <key>IFPkgDescriptionTitle</key>
+ <string>367C0F5C-1E53-44A3-AEA5-54D1EEE12F29-installerRoot</string>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.pkg/Contents/Resources/package_version Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,2 @@
+major: 1
+minor: 0
\ No newline at end of file
Binary file connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Icon.tiff has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/InstallerReadMe-en.rtf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,6 @@
+{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
+
+\f0\fs24 \cf0 This package has been built by Nokia Corporation. It will install a phone plugin to enable iSync support for your phone E60}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/apple/S60_RnD_32.ppdoc/Properties.plist Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1358 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>TramontaneVersion</key>
+ <string>597.0</string>
+ <key>UUID</key>
+ <string>367C0F5C-1E53-44A3-AEA5-54D1EEE12F29</string>
+ <key>properties</key>
+ <dict>
+ <key>BTOptionsDict</key>
+ <dict>
+ <key>OBEXTimeout</key>
+ <string>60</string>
+ <key>TransportType</key>
+ <integer>0</integer>
+ <key>synchroScriptConnect</key>
+ <false/>
+ <key>synchroScriptDisconnect</key>
+ <false/>
+ </dict>
+ <key>UISettingsOptionsDict</key>
+ <dict>
+ <key>DontSyncEventsAfterDateIsEnabled</key>
+ <dict>
+ <key>default</key>
+ <integer>0</integer>
+ <key>visible</key>
+ <true/>
+ </dict>
+ <key>DontSyncEventsAfterDateValue</key>
+ <dict>
+ <key>default</key>
+ <string>1month</string>
+ <key>visible</key>
+ <true/>
+ </dict>
+ <key>DontSyncEventsPriorToDateIsEnabled</key>
+ <dict>
+ <key>default</key>
+ <integer>0</integer>
+ <key>visible</key>
+ <false/>
+ </dict>
+ <key>DontSyncEventsPriorToDateValue</key>
+ <dict>
+ <key>default</key>
+ <string>1week</string>
+ <key>visible</key>
+ <true/>
+ </dict>
+ <key>OnlySyncContactsWithPhoneNumber</key>
+ <dict>
+ <key>default</key>
+ <integer>1</integer>
+ <key>visible</key>
+ <true/>
+ </dict>
+ <key>SyncAllDayEventsKey</key>
+ <dict>
+ <key>default</key>
+ <integer>0</integer>
+ <key>visible</key>
+ <false/>
+ </dict>
+ </dict>
+ <key>USBOptionsDict</key>
+ <dict>
+ <key>OBEXTimeout</key>
+ <string>60</string>
+ <key>identificationCDCChannel</key>
+ <integer>0</integer>
+ <key>identificationScriptConnect</key>
+ <false/>
+ <key>identificationScriptDisconnect</key>
+ <false/>
+ <key>synchroCDCChannel</key>
+ <integer>1</integer>
+ <key>synchroOBEXChannel</key>
+ <integer>0</integer>
+ <key>synchroScriptConnect</key>
+ <false/>
+ <key>synchroScriptDisconnect</key>
+ <false/>
+ <key>useOBEX</key>
+ <true/>
+ <key>useOtherCDC</key>
+ <false/>
+ <key>useSameCDC</key>
+ <false/>
+ </dict>
+ <key>advancedOptionsSettings</key>
+ <dict>
+ <key>com_apple_pimsync_contacts</key>
+ <dict>
+ <key>DataClassName</key>
+ <string>Contacts</string>
+ <key>MaxAddAndReplaceCmd</key>
+ <integer>0</integer>
+ <key>MaxDeleteCmd</key>
+ <integer>0</integer>
+ <key>MaxSyncCmd</key>
+ <real>1</real>
+ <key>needsDeleteAddOnModify</key>
+ <integer>1</integer>
+ </dict>
+ <key>com_apple_pimsync_events</key>
+ <dict>
+ <key>DataClassName</key>
+ <string>Calendar</string>
+ <key>MaxAddAndReplaceCmd</key>
+ <integer>0</integer>
+ <key>MaxDeleteCmd</key>
+ <integer>0</integer>
+ <key>MaxSyncCmd</key>
+ <integer>0</integer>
+ <key>allDayInLocalDateTime</key>
+ <integer>1</integer>
+ <key>allowedAlarmRelativeValues</key>
+ <string></string>
+ <key>countValueWhenMissing</key>
+ <integer>0</integer>
+ <key>defaultUntilDateWhenMissing</key>
+ <string></string>
+ <key>doNotSyncAlarmForADE</key>
+ <false/>
+ <key>doNotSyncAlarmIfAfterStartDateTime</key>
+ <integer>1</integer>
+ <key>dontSyncEventBeforeDate</key>
+ <string></string>
+ <key>exDatesAreDateOnly</key>
+ <false/>
+ <key>handleMultiDayRecurrent</key>
+ <true/>
+ <key>hasAllDayMultiDay</key>
+ <true/>
+ <key>maxMinutesNbDeltaForAlarm</key>
+ <integer>0</integer>
+ <key>needsDeleteAddOnModify</key>
+ <integer>0</integer>
+ <key>noNewLines</key>
+ <integer>0</integer>
+ <key>onlyAsciiCharacters</key>
+ <false/>
+ <key>syncAlarmOnlyIfSameDayAsADEStartDate</key>
+ <false/>
+ <key>untilDateIsDateOnly</key>
+ <integer>1</integer>
+ </dict>
+ <key>com_apple_pimsync_parser_vCal</key>
+ <dict>
+ <key>AllDayCategories</key>
+ <string>REMINDER</string>
+ <key>EscapeBackslash</key>
+ <integer>1</integer>
+ <key>EscapeSemicolonInNotComponedValues</key>
+ <integer>1</integer>
+ <key>EscapeStrings</key>
+ <string></string>
+ <key>ExDatesInLocal</key>
+ <false/>
+ <key>IgnoreProperties</key>
+ <string>X-IRMC-LUID</string>
+ <key>PropertyNameMapping</key>
+ <array/>
+ <key>SetExDateTimeWithEndTime</key>
+ <false/>
+ <key>SetExDateTimeWithStartTime</key>
+ <false/>
+ <key>SetUntilTimeWithEndTime</key>
+ <integer>0</integer>
+ <key>SetUntilTimeWithStartTime</key>
+ <integer>1</integer>
+ <key>TimedCategories</key>
+ <string>MEETING</string>
+ <key>UntilDateInLocal</key>
+ <integer>1</integer>
+ </dict>
+ <key>com_apple_pimsync_parser_vCard</key>
+ <dict>
+ <key>AddCRLFAfterBase64Folding</key>
+ <integer>1</integer>
+ <key>IgnoreSubTypesForThisMainTypes</key>
+ <string>CELL</string>
+ <key>PropertyNameMapping</key>
+ <array>
+ <dict>
+ <key>key</key>
+ <string>X-NICKNAME</string>
+ <key>value</key>
+ <string>X-EPOCSECONDNAME</string>
+ </dict>
+ </array>
+ </dict>
+ <key>com_apple_pimsync_tasks</key>
+ <dict>
+ <key>DataClassName</key>
+ <string>Tasks</string>
+ <key>MaxAddAndReplaceCmd</key>
+ <integer>0</integer>
+ <key>MaxDeleteCmd</key>
+ <integer>0</integer>
+ <key>MaxSyncCmd</key>
+ <integer>0</integer>
+ <key>completionDateIsDateOnly</key>
+ <false/>
+ <key>defaultDueDateValueWhenMissing</key>
+ <string></string>
+ <key>defaultDueDateWhenMissing</key>
+ <string></string>
+ <key>doNotSyncAlarmForTask</key>
+ <false/>
+ <key>doNotSyncAlarmIfCompleted</key>
+ <integer>1</integer>
+ <key>dueDateIsDateOnly</key>
+ <false/>
+ <key>needsDeleteAddOnModify</key>
+ <false/>
+ <key>setDueDateToCompletionDateIfCompleted</key>
+ <false/>
+ </dict>
+ <key>com_apple_synchro</key>
+ <dict>
+ <key>SyncMLCodec</key>
+ <integer>0</integer>
+ <key>SyncMLDoNotTryToDetectPhoneDBReset</key>
+ <false/>
+ <key>SyncMLLocalSource</key>
+ <string>iSync</string>
+ <key>SyncMLMaxMsgSize</key>
+ <real>65535</real>
+ <key>SyncMLMaxObjSize</key>
+ <real>786432</real>
+ <key>SyncMLMsgTemporization</key>
+ <real>500000</real>
+ <key>SyncMLNoPropertiesCapabilitiesInDevInf</key>
+ <false/>
+ <key>SyncMLSendDevInfIntoPutIfNoGetReceived</key>
+ <integer>0</integer>
+ <key>SyncMLUseBinaryWBXMLPublicID</key>
+ <false/>
+ </dict>
+ </dict>
+ <key>calendarsOptionsDict</key>
+ <dict>
+ <key>Charset</key>
+ <string>UTF-8</string>
+ <key>FoldingStyle</key>
+ <string>FoldingNG</string>
+ <key>RemoteName</key>
+ <string>/</string>
+ <key>allDayFormat</key>
+ <integer>3</integer>
+ <key>eventRecurrenceEndType</key>
+ <integer>1</integer>
+ <key>hasAudioAlarm</key>
+ <true/>
+ <key>hasDisplayAlarm</key>
+ <false/>
+ <key>hasEvent</key>
+ <true/>
+ <key>hasTimeZone</key>
+ <integer>1</integer>
+ <key>hasVCalRecurrence</key>
+ <true/>
+ </dict>
+ <key>contactsOptionsDict</key>
+ <dict>
+ <key>RemoteName</key>
+ <string>/</string>
+ <key>firstAndLastNameInSameField</key>
+ <false/>
+ <key>needsCompanyNameInFirstName</key>
+ <integer>0</integer>
+ <key>needsFullAddressInStreetField</key>
+ <false/>
+ </dict>
+ <key>documentVersion</key>
+ <integer>556</integer>
+ <key>extraOptionsSettings</key>
+ <dict/>
+ <key>familyOptionsDict</key>
+ <dict>
+ <key>BTAvailable</key>
+ <true/>
+ <key>BluetoothAvailable</key>
+ <true/>
+ <key>CGMI</key>
+ <string>Nokia</string>
+ <key>CGMM</key>
+ <string>Nokia 6290</string>
+ <key>GMI</key>
+ <string>Nokia</string>
+ <key>GMM</key>
+ <string>Nokia 6290</string>
+ <key>ModelID</key>
+ <string>com.nokia.S6032</string>
+ <key>Name</key>
+ <string>S60-32</string>
+ <key>PluginProviderName</key>
+ <string>Nokia</string>
+ <key>ProductID</key>
+ <string>0x0500</string>
+ <key>USBAvailable</key>
+ <true/>
+ <key>VendorID</key>
+ <string>0x0421</string>
+ <key>connection</key>
+ <integer>2</integer>
+ <key>constructorName</key>
+ <string>Nokia</string>
+ <key>domainName</key>
+ <string>nokia.com</string>
+ <key>fixedDatabasesNames</key>
+ <integer>0</integer>
+ <key>pluginVersion</key>
+ <string>1.0</string>
+ <key>supportURL</key>
+ <string>http://www.nokia.com/support</string>
+ <key>useCGMICGMM</key>
+ <false/>
+ </dict>
+ <key>javaScriptDict</key>
+ <dict>
+ <key>btObexConnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function prepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ <key>btObexDisconnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function unprepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ <key>usbCdcConnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function prepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ <key>usbCdcDisconnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function unprepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ <key>usbObexConnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function prepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ <key>usbObexDisconnection</key>
+ <dict>
+ <key>Value</key>
+ <string>function unprepareChannelForProtocol()
+{
+ // You can customize this function but do NOT change the signature
+}</string>
+ </dict>
+ </dict>
+ <key>notes</key>
+ <data>
+ WW91IGNhbiBzYXZlIGFueSBraW5kIG9mIGluZm9ybWF0aW9uIG9uIHRoZSBw
+ bHVnaW4gaGVyZS4KVGhleSB3b24ndCBiZSBleHBvcnRlZCBpbiB0aGUgcGx1
+ Z2luLg==
+ </data>
+ <key>syncFieldsSettings</key>
+ <dict>
+ <key>com_apple_calendars_Event</key>
+ <dict>
+ <key>classification</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PUBLIC</string>
+ <key>originalValue</key>
+ <string>public</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>private</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>confidential</string>
+ </dict>
+ </array>
+ </dict>
+ <key>description</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>500</real>
+ </dict>
+ <key>end date</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>location</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>start date</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>summary</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>500</real>
+ </dict>
+ </dict>
+ <key>com_apple_calendars_Task</key>
+ <dict>
+ <key>classification</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PUBLIC</string>
+ <key>originalValue</key>
+ <string>public</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>private</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PRIVATE</string>
+ <key>originalValue</key>
+ <string>confidential</string>
+ </dict>
+ </array>
+ </dict>
+ <key>completion date</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>description</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>due date</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>priority</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>originalValue</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>1</string>
+ <key>originalValue</key>
+ <integer>1</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>2</string>
+ <key>originalValue</key>
+ <integer>2</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>3</string>
+ <key>originalValue</key>
+ <integer>3</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>4</string>
+ <key>originalValue</key>
+ <integer>4</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>5</string>
+ <key>originalValue</key>
+ <integer>5</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>6</string>
+ <key>originalValue</key>
+ <integer>6</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>7</string>
+ <key>originalValue</key>
+ <integer>7</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>8</string>
+ <key>originalValue</key>
+ <integer>8</integer>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>9</string>
+ <key>originalValue</key>
+ <integer>9</integer>
+ </dict>
+ </array>
+ </dict>
+ <key>status</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>DECLINED</string>
+ <key>originalValue</key>
+ <string>cancelled</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>NEEDS ACTION</string>
+ <key>originalValue</key>
+ <string>needsaction</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>COMPLETED</string>
+ <key>originalValue</key>
+ <string>completed</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>ACCEPTED</string>
+ <key>originalValue</key>
+ <string>inprocess</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>none</string>
+ </dict>
+ </array>
+ </dict>
+ <key>summary</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Contact</key>
+ <dict>
+ <key>birthday</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>company name</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>department</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>first name</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>image</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>maxLength</key>
+ <integer>0</integer>
+ </dict>
+ <key>job title</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>last name</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>middle name</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>nickname</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>notes</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>maxLength</key>
+ <real>1000</real>
+ </dict>
+ <key>suffix</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>title</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Date</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-ANNIVERSARY</string>
+ <key>originalValue</key>
+ <string>anniversary</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-DATE</string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Email Address</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>INTERNET</string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Phone Number</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>CELL</string>
+ <key>originalValue</key>
+ <string>mobile</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>FAX</string>
+ <key>originalValue</key>
+ <string>work fax</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>FAX</string>
+ <key>originalValue</key>
+ <string>home fax</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>main</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>PAGER</string>
+ <key>originalValue</key>
+ <string>pager</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>2</integer>
+ <key>charsToKeep</key>
+ <string>0123456789+#*pw</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Related Name</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-FATHER</string>
+ <key>originalValue</key>
+ <string>father</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-MOTHER</string>
+ <key>originalValue</key>
+ <string>mother</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-PARENT</string>
+ <key>originalValue</key>
+ <string>parent</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>X-CHILDREN</string>
+ <key>originalValue</key>
+ <string>child</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-BROTHER</string>
+ <key>originalValue</key>
+ <string>brother</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-SISTER</string>
+ <key>originalValue</key>
+ <string>sister</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-FRIEND</string>
+ <key>originalValue</key>
+ <string>friend</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>X-SPOUSE</string>
+ <key>originalValue</key>
+ <string>spouse</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-PARTNER</string>
+ <key>originalValue</key>
+ <string>partner</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>X-ASSISTANT</string>
+ <key>originalValue</key>
+ <string>assistant</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-MANAGER</string>
+ <key>originalValue</key>
+ <string>manager</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <false/>
+ <key>mappedValue</key>
+ <string>X-NAME</string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_Street Address</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>city</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>country</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>postal code</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>state</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>street</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>255</real>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ <key>relationshipLimitKind</key>
+ <integer>2</integer>
+ </dict>
+ </dict>
+ <key>com_apple_contacts_URL</key>
+ <dict>
+ <key>IPSGlobalEntity</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ </dict>
+ <key>type</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>mappings</key>
+ <array>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>WORK</string>
+ <key>originalValue</key>
+ <string>work</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home page</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string>HOME</string>
+ <key>originalValue</key>
+ <string>home</string>
+ </dict>
+ <dict>
+ <key>activated</key>
+ <true/>
+ <key>mappedValue</key>
+ <string></string>
+ <key>originalValue</key>
+ <string>other</string>
+ </dict>
+ </array>
+ </dict>
+ <key>value</key>
+ <dict>
+ <key>Activated</key>
+ <true/>
+ <key>DontNeedCheckBox</key>
+ <true/>
+ <key>charsFiltering</key>
+ <integer>1</integer>
+ <key>charsToStrip</key>
+ <string>\r,\n</string>
+ <key>maxLength</key>
+ <real>500</real>
+ </dict>
+ </dict>
+ </dict>
+ <key>syncMLOptionsDict</key>
+ <dict>
+ <key>SyncMLBusySignalingInterval</key>
+ <real>60</real>
+ <key>SyncMLBusySignalingSupport</key>
+ <true/>
+ <key>SyncMLLargeObjectSupport</key>
+ <true/>
+ <key>SyncMLMaxSyncCmdNbInEncodedMsg</key>
+ <real>30</real>
+ <key>SyncMLNumberOfChangesSupport</key>
+ <true/>
+ <key>SyncMLOnlyOneBusySignaling</key>
+ <false/>
+ <key>SyncMLRefreshFromServerSupport</key>
+ <true/>
+ <key>SyncMLRemoteNeedsRelativePaths</key>
+ <false/>
+ <key>SyncMLSimulateBusySignalingWithEmptySync</key>
+ <false/>
+ <key>SyncMLVersion</key>
+ <string>SyncML11</string>
+ <key>limitSyncCmd</key>
+ <false/>
+ </dict>
+ <key>tasksOptionsDict</key>
+ <dict>
+ <key>RemoteName</key>
+ <string>Tasks</string>
+ <key>hasDifferentDataclassesForTasksAndEvents</key>
+ <false/>
+ <key>hasTasks</key>
+ <true/>
+ </dict>
+ <key>vCalRecSettings</key>
+ <dict>
+ <key>com_apple_pimsync_events</key>
+ <dict>
+ <key>handleAllDayRecurrent</key>
+ <true/>
+ </dict>
+ <key>com_apple_pimsync_parser_vCal</key>
+ <dict>
+ <key>vCalExDatesSupport</key>
+ <true/>
+ <key>vCalRecDaily</key>
+ <true/>
+ <key>vCalRecDailyInterval</key>
+ <string></string>
+ <key>vCalRecDropIfUseless</key>
+ <integer>1</integer>
+ <key>vCalRecMaxExDatesNb</key>
+ <integer>0</integer>
+ <key>vCalRecMonthlyByDay</key>
+ <true/>
+ <key>vCalRecMonthlyByDayOnlyOnStartDateMonthDay</key>
+ <false/>
+ <key>vCalRecMonthlyByDayOnlyOneMonthDay</key>
+ <false/>
+ <key>vCalRecMonthlyByDayWithMonthDay</key>
+ <true/>
+ <key>vCalRecMonthlyByPos</key>
+ <true/>
+ <key>vCalRecMonthlyByPosOnlyOnStartDateWeekDay</key>
+ <false/>
+ <key>vCalRecMonthlyByPosOnlyOneWeekDay</key>
+ <false/>
+ <key>vCalRecMonthlyInterval</key>
+ <string></string>
+ <key>vCalRecOnlyForever</key>
+ <false/>
+ <key>vCalRecWeekly</key>
+ <true/>
+ <key>vCalRecWeeklyInterval</key>
+ <string></string>
+ <key>vCalRecWeeklyOnlyOnStartDateWeekDay</key>
+ <false/>
+ <key>vCalRecWeeklyOnlyOneWeekDay</key>
+ <false/>
+ <key>vCalRecWeeklyWithWeekDay</key>
+ <true/>
+ <key>vCalRecYearlyByMonth</key>
+ <true/>
+ <key>vCalRecYearlyByMonthInterval</key>
+ <string></string>
+ <key>vCalRecYearlyByMonthOnlyOnStartDateMonthNumber</key>
+ <false/>
+ <key>vCalRecYearlyByMonthOnlyOneMonthNumber</key>
+ <false/>
+ <key>vCalRecYearlyByMonthWithMonthNumber</key>
+ <true/>
+ </dict>
+ </dict>
+ </dict>
+ <key>version</key>
+ <integer>0</integer>
+</dict>
+</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/bwins/catalogspcconnectivitypluginu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,10 @@
+EXPORTS
+ ??1CCatalogsPCConnectivityPlugin@@UAE@XZ @ 1 NONAME ; CCatalogsPCConnectivityPlugin::~CCatalogsPCConnectivityPlugin(void)
+ ?Close@CCatalogsPCConnectivityPlugin@@QAEXXZ @ 2 NONAME ; void CCatalogsPCConnectivityPlugin::Close(void)
+ ?Connect@CCatalogsPCConnectivityPlugin@@QAEHXZ @ 3 NONAME ; int CCatalogsPCConnectivityPlugin::Connect(void)
+ ?GetDataL@CCatalogsPCConnectivityPlugin@@QAEXAAVTDataType@@AAVCBufFlat@@@Z @ 4 NONAME ; void CCatalogsPCConnectivityPlugin::GetDataL(class TDataType &, class CBufFlat &)
+ ?NewL@CCatalogsPCConnectivityPlugin@@SAPAV1@XZ @ 5 NONAME ; class CCatalogsPCConnectivityPlugin * CCatalogsPCConnectivityPlugin::NewL(void)
+ ?NewLC@CCatalogsPCConnectivityPlugin@@SAPAV1@XZ @ 6 NONAME ; class CCatalogsPCConnectivityPlugin * CCatalogsPCConnectivityPlugin::NewLC(void)
+ ?PutDataL@CCatalogsPCConnectivityPlugin@@QAEXABVTDataType@@ABVCBufFlat@@@Z @ 7 NONAME ; void CCatalogsPCConnectivityPlugin::PutDataL(class TDataType const &, class CBufFlat const &)
+ ?SupportedMimeTypesL@CCatalogsPCConnectivityPlugin@@QAE?AV?$RPointerArray@VTDataType@@@@XZ @ 8 NONAME ; class RPointerArray<class TDataType> CCatalogsPCConnectivityPlugin::SupportedMimeTypesL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/eabi/catalogspcconnectivitypluginu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+ _ZN29CCatalogsPCConnectivityPlugin19SupportedMimeTypesLEv @ 1 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin4NewLEv @ 2 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin5CloseEv @ 3 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin5NewLCEv @ 4 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin7ConnectEv @ 5 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin8GetDataLER9TDataTypeR8CBufFlat @ 6 NONAME
+ _ZN29CCatalogsPCConnectivityPlugin8PutDataLERK9TDataTypeRK8CBufFlat @ 7 NONAME
+ _ZN29CCatalogsPCConnectivityPluginD0Ev @ 8 NONAME
+ _ZN29CCatalogsPCConnectivityPluginD1Ev @ 9 NONAME
+ _ZN29CCatalogsPCConnectivityPluginD2Ev @ 10 NONAME
+ _ZTI29CCatalogsPCConnectivityPlugin @ 11 NONAME ; #<TI>#
+ _ZTV29CCatalogsPCConnectivityPlugin @ 12 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info file for Catalogs PC Connectivity Plugin
+*
+*/
+
+
+PRJ_MMPFILES
+
+catalogspcconnectivityplugin.mmp
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/group/catalogspcconnectivityplugin.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Project definition file for project Catalogs PC Connectivity
+* Plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET catalogspcconnectivityplugin.dll
+TARGETTYPE dll
+UID 0x1000008D 0x10207E73
+
+CAPABILITY CAP_ECOM_PLUGIN
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE catalogspcconnectivityplugin.cpp
+SOURCE catalogspcconnectivityclient.cpp
+
+USERINCLUDE ../inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY apmime.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is a client which communicate with the server
+* CatalogsEnginePCClientFrontEnd
+*
+*/
+
+
+#ifndef R_CATALOGSPCCONNECTIVITYCLIENT_H
+#define R_CATALOGSPCCONNECTIVITYCLIENT_H
+
+#include <e32base.h>
+#include <apmstd.h>
+
+/**
+ * This client communicate with the server CatalogsEnginePCClientFrontEnd
+ *
+ * This class get requests from CatalogsPCConnectivityPlugin.
+ * Class itself is client in client-server solution. When request
+ * is received it will start the server (CatalogsEnginePCClientFrontEnd).
+ * This client class is dummy, the server have all the functionality.
+ *
+ * @lib catalogspcconnectivityplugin
+ * @since S60 v3.1
+ */
+class RCatalogsPCConnectivityClient : public RSessionBase
+ {
+public:
+
+ /**
+ * Constructor
+ *
+ * @since S60 v3.1
+ */
+ RCatalogsPCConnectivityClient();
+
+ /**
+ * Destructor
+ *
+ * @since S60 v3.1
+ */
+ ~RCatalogsPCConnectivityClient();
+
+ /**
+ * A connection is formed to the Catalogs engine pc client front-end.
+ * This will start up the front-end server and connect to it
+ *
+ * @since S60 v3.1
+ * @return TInt Standard error code, KErrNone if connection is formed
+ * or the connection was formed already
+ */
+ TInt Connect();
+
+ /**
+ * The connection to the Catalogs engine front-end is closed
+ *
+ * @since S60 v3.1
+ */
+ void Close();
+
+ /**
+ * All MIME types supported by this component can be asked using this method
+ *
+ * @since S60 v3.1
+ * @return RPointerArray< TDataType > contain all supported MIME types
+ * RPointerArray TDataTypes have allocated using new, caller
+ * have to remember to delete them properly
+ * @exeption Leaves with standard error codes
+ */
+ RPointerArray<TDataType> SupportedMimeTypesL();
+
+ /**
+ * A data packet of max length 65535 (0xFFFF) bytes is synchronously
+ * sent to the Catalogs engine front-end
+ * Usage: After PutDataL have been called, you have to call GetDataL
+ * before you can call PutDataL again
+ *
+ * @since S60 v3.1
+ * @param aMimeType data packet MIME type
+ * @param aData data buffer to read from
+ * @exeption Leaves with standard error codes
+ */
+ void PutDataL( const TDataType& aMimeType,
+ const CBufFlat& aData );
+
+ /**
+ * A data packet is synchronously transfered from the Catalogs front-end
+ * and returned to caller
+ * Usage: Everytime before calling GetDataL, you have to call PutDataL.
+ * So you can't call GetData in sequentially.
+ *
+ * @since S60 v3.1
+ * @param aMimeType data packet MIME type
+ * @param aData data buffer to write to. Will call ExpandL function
+ * for aData, but never more than max length 65535 (OxFFFF)
+ * @return nothing, but parameter aData work as return buffer
+ * @exeption Leaves with standard error codes
+ */
+ void GetDataL( TDataType& aMimeType, CBufFlat& aData );
+
+
+private:
+
+// private functions
+
+ /**
+ * Returns the earliest version number of the server that we can talk to
+ *
+ * @since S60 v3.1
+ * @return TVersion Earliest version number we can talk to
+ */
+ TVersion Version() const;
+
+ /**
+ * Start server if it isn't running already
+ *
+ * @since S60 v3.1
+ * @return TInt Standard error code, KErrNone if server was running
+ * already or start was succesfull
+ */
+ TInt StartServer();
+
+ /**
+ * Create server process
+ *
+ * @since S60 v3.1
+ * @return TInt standard error code, KErrNone when creation was success
+ */
+ TInt CreateServerProcess();
+
+ };
+
+#endif // R_CATALOGSPCCONNECTIVITYCLIENT_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivitydefines.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Server information that the client needs
+*
+*/
+
+
+#include <e32base.h>
+
+/** Server name */
+_LIT( KCatalogsPCConnectivityServerName,
+ "CatalogsPCConnectivityServer" );
+
+/** Semaphore that is used when creating a new server */
+_LIT( KCatalogsPCConnectivityServerSemaphoreName,
+ "CATALOGSPCCONNECTIVITYSemaphore" );
+
+/** File that is passed to the new server-process for execution */
+_LIT( KCatalogsPCConnectivityServerFilename,
+ "catalogsenginepcclientfrontend" );
+
+// Default message slot amount in a session
+const TUint KCatalogsPCConnectivityDefaultMessageSlots = 255;
+
+/** Version numbers */
+const TUint KCatalogsPCConnectivityMajorVersionNumber=1;
+const TUint KCatalogsPCConnectivityMinorVersionNumber=0;
+const TUint KCatalogsPCConnectivityBuildVersionNumber=0;
+
+/** Function opcodes used in message passing between client and server */
+enum TCatalogsPCConnectivityServRqst
+ {
+ ECatalogsPCConnectivitySupportedMimeTypes = 1,
+ ECatalogsPCConnectivityPutData,
+ ECatalogsPCConnectivityGetData,
+ ECatalogsPCConnectivityGetSize
+ };
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/inc/catalogspcconnectivityplugin.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This plugin enables the Catalogs PC client to communicate
+* with the Catalogs engine
+*
+*/
+
+
+#ifndef C_CATALOGSPCCONNECTIVITYPLUGIN_H
+#define C_CATALOGSPCCONNECTIVITYPLUGIN_H
+
+#include "catalogspcconnectivityclient.h"
+
+/**
+ * Plugin enables Catalogs PC client to communicate with the Catalogs engine
+ *
+ * This class get requests from Catalogs PC client. It passes the requests
+ * to client CatalogsPCConnectivityClient
+ *
+ * @lib catalogspcconnectivityplugin
+ * @since S60 v3.1
+ */
+class CCatalogsPCConnectivityPlugin : public CBase
+ {
+public:
+
+ /**
+ * Standard symbian object construction first phase
+ *
+ * @since S60 v3.1
+ * @return CCatalogsPCConnectivityPlugin pointer
+ */
+ IMPORT_C static CCatalogsPCConnectivityPlugin* NewL();
+
+ /**
+ * Standard symbian object constructing first phase
+ *
+ * @since S60 v3.1
+ * @return CCatalogsPCConnectivityPlugin pointer
+ */
+ IMPORT_C static CCatalogsPCConnectivityPlugin* NewLC();
+
+ /**
+ * Destructor
+ *
+ * @since S60 v3.1
+ */
+ IMPORT_C virtual ~CCatalogsPCConnectivityPlugin();
+
+ /**
+ * A connection is formed to the Catalogs engine pc client front-end.
+ * This will start up the front-end server and connect to it
+ *
+ * @return TInt Standard error code, KErrNone if connection is formed
+ * @since S60 v3.1
+ */
+ IMPORT_C TInt Connect();
+
+ /**
+ * The connection to the Catalogs engine front-end is closed
+ *
+ * @since S60 v3.1
+ */
+ IMPORT_C void Close();
+
+ /**
+ * All MIME types supported by this component can be asked using this method
+ *
+ * @return RPointerArray<TDataType> contains all supported MIME types.
+ * The ownership is transferred to the caller.
+ * Use ResetAndDestroy method to free all allocated memory
+ * @exeption Leaves with standard error codes
+ * @since S60 v3.1
+ */
+ IMPORT_C RPointerArray<TDataType> SupportedMimeTypesL();
+
+ /**
+ * A Data packet of max length 65535 (0xFFFF) bytes is synchronously
+ * sent to the Catalogs engine front-end.
+ * Usage: After PutDataL has been called, you must call GetDataL
+ * before you can call PutDataL again
+ *
+ * @param aMimeType Data packet MIME type
+ * @param aData Data buffer to read from
+ * @exeption Leaves with standard error codes
+ * KErrNotSupported if not supported MIME type
+ * @since S60 v3.1
+ */
+ IMPORT_C void PutDataL( const TDataType& aMimeType,
+ const CBufFlat& aData );
+
+ /**
+ * A data packet is synchronously transfered from the Catalogs front-end
+ * and returned to caller
+ * Usage: Everytime before calling GetDataL, you have to call PutDataL.
+ * You may not call GetData in sequentially.
+ *
+ * @since S60 v3.1
+ * @param aMimeType MIME type of the received data packet
+ * @param aData Data buffer to write to. ExpandL function will be called
+ * with the correct size for aData, but not more than max length
+ * 65535 (OxFFFF)
+ * @return The reference parameters contain the return data
+ * @exeption Leaves with standard error codes
+ */
+ IMPORT_C void GetDataL( TDataType& aMimeType, CBufFlat& aData );
+
+
+private:
+
+// private functions
+
+
+ /**
+ * Constructor
+ *
+ * @since S60 v3.1
+ */
+ CCatalogsPCConnectivityPlugin();
+
+ /**
+ * Standard symbian object construction second phase
+ */
+ void ConstructL();
+
+
+private: // data
+
+ /**
+ * Client that communicate with the CatalogsEnginePCClientFrontEnd
+ */
+ RCatalogsPCConnectivityClient iClient;
+
+ };
+
+#endif // C_CATALOGSPCCONNECTIVITYPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,229 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Client that communicate with CatalogsEnginePCClientFrontEnd
+*
+*/
+
+
+#include "catalogspcconnectivityclient.h"
+#include "catalogspcconnectivitydefines.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+RCatalogsPCConnectivityClient::RCatalogsPCConnectivityClient()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+RCatalogsPCConnectivityClient::~RCatalogsPCConnectivityClient()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Start server and create session with server
+// ---------------------------------------------------------------------------
+//
+TInt RCatalogsPCConnectivityClient::Connect()
+ {
+ TInt err = StartServer();
+
+ if ( err == KErrNone )
+ {
+ err = CreateSession(
+ KCatalogsPCConnectivityServerName,
+ Version(),
+ KCatalogsPCConnectivityDefaultMessageSlots );
+ }
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// Close session (After session is closed will server be closed too)
+// ---------------------------------------------------------------------------
+//
+void RCatalogsPCConnectivityClient::Close()
+ {
+ RHandleBase::Close();
+ }
+
+// ---------------------------------------------------------------------------
+// Give MIME types supported by this Module
+// ---------------------------------------------------------------------------
+//
+RPointerArray<TDataType> RCatalogsPCConnectivityClient::
+SupportedMimeTypesL()
+ {
+ RPointerArray<TDataType> supportedMIMEs;
+ TBool isThereMore = ETrue;
+ TPckgBuf<TBool> pckgIsThereMore;
+ TDataType* tempMIME = 0;
+ TPckgBuf<TDataType> pckgMIME;
+
+ while( isThereMore )
+ {
+ User::LeaveIfError( SendReceive(
+ ECatalogsPCConnectivitySupportedMimeTypes,
+ TIpcArgs( &pckgMIME, &pckgIsThereMore ) ) );
+ isThereMore = pckgIsThereMore();
+ tempMIME = new( ELeave ) TDataType( pckgMIME() );
+ User::LeaveIfError( supportedMIMEs.Append( tempMIME ) );
+ }
+
+ return supportedMIMEs;
+ }
+
+// ---------------------------------------------------------------------------
+// Data package from CatalogsPCConnectivityPlugin
+// ---------------------------------------------------------------------------
+//
+void RCatalogsPCConnectivityClient::PutDataL(
+ const TDataType& aMimeType, const CBufFlat& aData )
+ {
+ TInt size = aData.Size();
+
+ RBuf8 desData;
+ desData.CreateL( size );
+ desData.CleanupClosePushL();
+ aData.Read( 0, desData, size );
+ TPckgBuf<TDataType> pckgMIME( aMimeType );
+
+ User::LeaveIfError( SendReceive(
+ ECatalogsPCConnectivityPutData,
+ TIpcArgs( &pckgMIME, &desData, size ) ) );
+
+ CleanupStack::Pop(); //desData
+ desData.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// Data request from CatalogsPCConnectivityPlugin
+// First ask the size from server, then give correct size CBufFlat
+// ---------------------------------------------------------------------------
+//
+void RCatalogsPCConnectivityClient::GetDataL(
+ TDataType& aMimeType, CBufFlat& aData )
+ {
+ TPckgBuf<TInt> pckgSize;
+ TPckgBuf<TDataType> pckgMIME;
+
+ User::LeaveIfError( SendReceive(
+ ECatalogsPCConnectivityGetSize,
+ TIpcArgs( &pckgMIME, &pckgSize ) ) );
+
+ TInt size = pckgSize();
+ aMimeType = pckgMIME();
+
+ RBuf8 desData;
+ desData.CreateL( size );
+ desData.CleanupClosePushL();
+
+ User::LeaveIfError( SendReceive(
+ ECatalogsPCConnectivityGetData,
+ TIpcArgs( &desData ) ) );
+
+ aData.Reset();
+ aData.ExpandL( 0, size );
+ aData.Write( 0, desData, size );
+
+ CleanupStack::Pop(); //desData
+ desData.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// Return version number
+// ---------------------------------------------------------------------------
+//
+TVersion RCatalogsPCConnectivityClient::Version() const
+ {
+ return( TVersion( KCatalogsPCConnectivityMajorVersionNumber,
+ KCatalogsPCConnectivityMinorVersionNumber,
+ KCatalogsPCConnectivityBuildVersionNumber ) );
+ }
+
+// ---------------------------------------------------------------------------
+// Start server if it isn't running already
+// ---------------------------------------------------------------------------
+//
+TInt RCatalogsPCConnectivityClient::StartServer()
+ {
+ // Check if the server is already running
+ TFindServer findServer( KCatalogsPCConnectivityServerName );
+ TFullName name;
+
+ TInt result = findServer.Next( name );
+ if ( result == KErrNone )
+ {
+ // Server is running
+ return KErrNone;
+ }
+
+ // Create a semaphore so we can wait while the server starts
+ RSemaphore semaphore;
+ result = semaphore.CreateGlobal(
+ KCatalogsPCConnectivityServerSemaphoreName, 0 );
+ if ( result != KErrNone )
+ {
+ return result;
+ }
+
+ // Create new Engine service process
+ result = CreateServerProcess();
+ if ( result != KErrNone )
+ {
+ semaphore.Close();
+ return result;
+ }
+
+ // Wait while the server starts
+ semaphore.Wait();
+
+ // Semaphore has been signaled, close and return
+ semaphore.Close();
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Create server process
+// ---------------------------------------------------------------------------
+//
+TInt RCatalogsPCConnectivityClient::CreateServerProcess()
+ {
+
+ RProcess server;
+
+ TInt result = server.Create(
+ KCatalogsPCConnectivityServerFilename, KNullDesC );
+ if ( result != KErrNone )
+ {
+ return result;
+ }
+
+ // Resume server thread and close handle
+ server.Resume();
+ server.Close();
+
+ return KErrNone;
+ }
+
+
+//end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/catalogspcconnectivityplugin/src/catalogspcconnectivityplugin.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This plugin enables the Catalogs PC client to communicate
+* with the Catalogs engine
+*
+*/
+
+
+
+#include "catalogspcconnectivityplugin.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCatalogsPCConnectivityPlugin::CCatalogsPCConnectivityPlugin()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Empty
+// ---------------------------------------------------------------------------
+//
+void CCatalogsPCConnectivityPlugin::ConstructL()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// Standard symbian object constructing first phase
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCatalogsPCConnectivityPlugin* CCatalogsPCConnectivityPlugin::NewL()
+ {
+ CCatalogsPCConnectivityPlugin* self =
+ CCatalogsPCConnectivityPlugin::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// Standard symbian object constructing first phase
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCatalogsPCConnectivityPlugin* CCatalogsPCConnectivityPlugin::NewLC()
+ {
+ CCatalogsPCConnectivityPlugin* self =
+ new( ELeave ) CCatalogsPCConnectivityPlugin;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCatalogsPCConnectivityPlugin::~CCatalogsPCConnectivityPlugin()
+ {
+ iClient.Close();
+ }
+
+
+// ---------------------------------------------------------------------------
+// Connect to Catalogs engine pc client front-end
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCatalogsPCConnectivityPlugin::Connect()
+ {
+ return iClient.Connect();
+ }
+
+// ---------------------------------------------------------------------------
+// Close the connection to Catalogs engine pc client front-end
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCatalogsPCConnectivityPlugin::Close()
+ {
+ iClient.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// Give all MIME types supported by this component
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RPointerArray<TDataType> CCatalogsPCConnectivityPlugin::
+ SupportedMimeTypesL()
+ {
+ return iClient.SupportedMimeTypesL();
+ }
+
+// ---------------------------------------------------------------------------
+// Data package from PC Client
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCatalogsPCConnectivityPlugin::PutDataL(
+ const TDataType& aMimeType, const CBufFlat& aData )
+ {
+ iClient.PutDataL( aMimeType, aData );
+ }
+
+// ---------------------------------------------------------------------------
+// Data request from PC Client
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCatalogsPCConnectivityPlugin::GetDataL(
+ TDataType& aMimeType, CBufFlat& aData )
+ {
+ iClient.GetDataL( aMimeType, aData );
+ }
+
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Dll entry point
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Dll()
+ {
+ return( KErrNone );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file provides the information required for building the
+* whole of SConPCConnClient
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+../bld/sconpcconnclient.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+ ??0RSConPCConnSession@@QAE@XZ @ 1 NONAME ; RSConPCConnSession::RSConPCConnSession(void)
+ ??1RSConPCConnSession@@QAE@XZ @ 2 NONAME ; RSConPCConnSession::~RSConPCConnSession(void)
+ ?Close@RSConPCConnSession@@QAEXXZ @ 3 NONAME ; void RSConPCConnSession::Close(void)
+ ?Connect@RSConPCConnSession@@QAEHXZ @ 4 NONAME ; int RSConPCConnSession::Connect(void)
+ ?GetPacketL@RSConPCConnSession@@QAEHABVTDesC16@@ABVTDesC8@@AAPAVCBufFlat@@@Z @ 5 NONAME ; int RSConPCConnSession::GetPacketL(class TDesC16 const &, class TDesC8 const &, class CBufFlat * &)
+ ?PutPacketL@RSConPCConnSession@@QAEHABVTDesC16@@ABVTDesC8@@AAPAVCBufFlat@@@Z @ 6 NONAME ; int RSConPCConnSession::PutPacketL(class TDesC16 const &, class TDesC8 const &, class CBufFlat * &)
+ ?ResetServer@RSConPCConnSession@@QAEHXZ @ 7 NONAME ; int RSConPCConnSession::ResetServer(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/bld/def/eabiuu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,11 @@
+EXPORTS
+ _ZN18RSConPCConnSession10GetPacketLERK7TDesC16RK6TDesC8RP8CBufFlat @ 1 NONAME
+ _ZN18RSConPCConnSession10PutPacketLERK7TDesC16RK6TDesC8RP8CBufFlat @ 2 NONAME
+ _ZN18RSConPCConnSession11ResetServerEv @ 3 NONAME
+ _ZN18RSConPCConnSession5CloseEv @ 4 NONAME
+ _ZN18RSConPCConnSession7ConnectEv @ 5 NONAME
+ _ZN18RSConPCConnSessionC1Ev @ 6 NONAME
+ _ZN18RSConPCConnSessionC2Ev @ 7 NONAME
+ _ZN18RSConPCConnSessionD1Ev @ 8 NONAME
+ _ZN18RSConPCConnSessionD2Ev @ 9 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/bld/sconpcconnclient.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Client side of PC Connectivity Server-Client
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_CLIENT_DLL
+
+TARGET sconpcconnclient.dll
+TARGETTYPE dll
+
+UID 0x10009D8D 0x101F99F7
+
+TARGETPATH sys/bin
+
+#if defined(ARMCC)
+DEFFILE ./def/eabiu
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+
+SOURCEPATH ../src
+
+SOURCE sconpcconnclient.cpp
+
+// Client
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+// Server
+USERINCLUDE ../../../servers/pcconn/inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY estor.lib // RMemWriteStream
+LIBRARY efsrv.lib // Rfs, RFile
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/inc/sconpcconnclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity client
+*
+*/
+
+
+#ifndef __SCONPCCONNCLIENT_H__
+#define __SCONPCCONNCLIENT_H__
+
+// -----------------------------------------------------------------------------
+// class RSConPCConnSession - the client session
+// -----------------------------------------------------------------------------
+class RSConPCConnSession : public RSessionBase
+ {
+public:
+ IMPORT_C RSConPCConnSession();
+ IMPORT_C ~RSConPCConnSession();
+
+ /**
+ * Starts the server and connects to it
+ * @param none
+ * @return KerrNone or an error code
+ */
+ IMPORT_C TInt Connect();
+
+ /**
+ * Disconnects from the server and terminates the server
+ * @param none
+ * @return none
+ */
+ IMPORT_C void Close();
+
+ /**
+ * Passes an OBEX Put -message to the server
+ * @param none
+ * @return none
+ */
+ IMPORT_C TInt PutPacketL( const TDesC& aNameHeader,
+ const TDesC8& aTypeHeader,
+ CBufFlat*& aBuffer );
+
+ /**
+ * Passes an OBEX Get -message to the server
+ * @param none
+ * @return none
+ */
+ IMPORT_C TInt GetPacketL( const TDesC& aNameHeader,
+ const TDesC8& aTypeHeader,
+ CBufFlat*& aBuffer );
+
+ /**
+ * Passes an reset -message to the server
+ * @param none
+ * @return none
+ */
+ IMPORT_C TInt ResetServer();
+
+private:
+ TVersion Version() const;
+ TInt LaunchServer();
+ TInt CreateAndSendChunkHandle();
+
+private:
+ RChunk iChunk;
+ };
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/pcconn/src/sconpcconnclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity client
+*
+*/
+
+
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include <e32base.h>
+#include <s32mem.h>
+
+// Client - server
+#include "sconpcconnclient.h"
+#include "sconpcconnclientserver.h"
+#include "debug.h"
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::RSConPCConnSession()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSConPCConnSession::RSConPCConnSession()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::~RSConPCConnSession()
+// Default destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RSConPCConnSession::~RSConPCConnSession()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Connect()
+// Creates a chunk and server, starts the server connection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RSConPCConnSession::Connect()
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret ( KErrNone );
+
+ ret = CreateSession(KSConPCConnServerName,Version());
+
+ if ( ret == KErrNotFound || ret == KErrServerTerminated )
+ {
+ ret = LaunchServer();
+
+ if ( ret == KErrNone || ret == KErrAlreadyExists )
+ {
+ ret = CreateSession( KSConPCConnServerName, Version() );
+ }
+ }
+
+ if ( ret == KErrNone )
+ {
+ ret = CreateAndSendChunkHandle();
+ if ( ret != KErrNone )
+ {
+ LOGGER_WRITE("CreateAndSendChunkHandle failed, close session");
+ Close();
+ }
+ }
+
+ LOGGER_WRITE_1( "RSConPCConnSession::Connect() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Close()
+// Closes the server connection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSConPCConnSession::Close()
+ {
+ TRACE_FUNC_ENTRY;
+ iChunk.Close();
+ RSessionBase::Close();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Version()
+// Returns the version of the client
+// -----------------------------------------------------------------------------
+//
+TVersion RSConPCConnSession::Version(void) const
+ {
+ return (TVersion(KSConPCConnServerVersionMajor,
+ KSConPCConnServerVersionMinor,
+ KSConPCConnServerVersionBuild));
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Version()
+// Forwards a PUT -message to the server
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RSConPCConnSession::PutPacketL(
+ const TDesC& aNameHeader, const TDesC8& aTypeHeader, CBufFlat*& aBuffer )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( !aBuffer )
+ {
+ return KErrArgument;
+ }
+
+ if ((aBuffer->Size() + aTypeHeader.Size() +
+ aNameHeader.Size()) > KSConPCConnChunkMaxSize)
+ {
+ LOGGER_WRITE( "RSConPCConnSession::PutPacketL() :\
+ WBXML document too big" );
+ return KErrTooBig;
+ }
+
+ TInt ret (KErrNone);
+ iChunk.Adjust( KSConPCConnChunkMaxSize );
+ RMemWriteStream buf( iChunk.Base(), iChunk.Size() );
+
+ buf.WriteInt32L( aNameHeader.Size() );
+ buf.WriteL( aNameHeader );
+
+ buf.WriteInt32L( aTypeHeader.Size() );
+ buf.WriteL( aTypeHeader );
+
+ // WBXML document
+ buf.WriteInt32L( aBuffer->Size() );
+ buf.WriteL( aBuffer->Ptr(0) );
+ buf.CommitL();
+ buf.Close();
+
+ TIpcArgs args;
+ ret = SendReceive ( EPutMessage, args );
+
+ LOGGER_WRITE_1( "RSConPCConnSession::PutPacketL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Version()
+// Forwards a GET -message to the server
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RSConPCConnSession::GetPacketL(
+ const TDesC& aNameHeader, const TDesC8& aTypeHeader, CBufFlat*& aBuffer )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( !aBuffer )
+ {
+ return KErrArgument;
+ }
+
+ TInt ret (KErrNone);
+
+ iChunk.Adjust( KSConPCConnChunkMaxSize);
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ writeBuf.WriteInt32L( aNameHeader.Size() );
+ writeBuf.WriteL( aNameHeader );
+
+ writeBuf.WriteInt32L( aTypeHeader.Size() );
+ writeBuf.WriteL( aTypeHeader );
+
+ writeBuf.CommitL();
+ writeBuf.Close();
+
+ TIpcArgs args;
+ ret = SendReceive ( EGetMessage, args );
+
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSConPCConnSession::GetPacketL() :\
+ Send Receive failed with code %d", ret );
+ return ret;
+ };
+
+ // copy data from the chunk
+ RMemReadStream readBuf( iChunk.Base(), iChunk.Size() );
+ TInt32 length ( 0 );
+
+ aBuffer->Reset();
+ length = readBuf.ReadInt32L();
+
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 dataPtr = data->Des();
+
+ readBuf.ReadL( dataPtr, length );
+ aBuffer->ExpandL( 0, length );
+ aBuffer->Write ( 0, dataPtr );
+
+ readBuf.Close();
+
+ CleanupStack::PopAndDestroy(); // data;
+
+ LOGGER_WRITE_1( "RSConPCConnSession::GetPacketL()\
+ : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::Version()
+// Forwards a Reset -message to the server
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RSConPCConnSession::ResetServer()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TIpcArgs args;
+ ret = SendReceive ( EResetMessage, args );
+ LOGGER_WRITE_1( "RSConPCConnSession::ResetServerL(): ret %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::LaunchServer()
+// Launches the server
+// -----------------------------------------------------------------------------
+//
+TInt RSConPCConnSession::LaunchServer()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ // Create server
+ RProcess p;
+ ret = p.Create(KSConPCConnServerExe, KNullDesC);
+
+ if ( ret != KErrNone )
+ {
+ // Loading failed.
+ LOGGER_WRITE_1( "RProcess::Create failed, err: %d", ret );
+ return ret;
+ }
+
+
+ TRequestStatus status;
+ p.Rendezvous( status );
+
+ if ( status != KRequestPending )
+ {
+ p.Kill(0); // abort startup
+ p.Close();
+ LOGGER_WRITE("Abort startup, return KErrGeneral");
+ return KErrGeneral;
+ }
+ else
+ {
+ p.Resume(); // logon OK - start the server
+ }
+
+ User::WaitForRequest(status);
+
+ p.Close();
+
+ LOGGER_WRITE_1( "RSConPCConnSession::LaunchServerL(): returned %d", status.Int() );
+ return status.Int();
+ }
+
+// -----------------------------------------------------------------------------
+// RSConPCConnSession::CreateAndSendChunkHandle()
+// Creates a chunk and sends a handle to server
+// -----------------------------------------------------------------------------
+//
+TInt RSConPCConnSession::CreateAndSendChunkHandle()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err = iChunk.CreateGlobal( KNullDesC,
+ KSConPCConnChunkSize,
+ KSConPCConnChunkMaxSize );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1("iChunk.CreateGlobal failed, err: %d", err);
+ return err;
+ }
+ TIpcArgs args;
+ args.Set( 0, iChunk );
+ err = SendReceive( EChunkMessage, args );
+
+ LOGGER_WRITE_1("RSConPCConnSession::CreateAndSendChunkHandle : returned: %d", err);
+ return err;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/bwins/sconsyncclientu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,43 @@
+EXPORTS
+ ??0RSconSyncSession@@QAE@XZ @ 1 NONAME ; RSconSyncSession::RSconSyncSession(void)
+ ??1CSconDataproviderInfo@@UAE@XZ @ 2 NONAME ; CSconDataproviderInfo::~CSconDataproviderInfo(void)
+ ??1RSconSyncSession@@QAE@XZ @ 3 NONAME ; RSconSyncSession::~RSconSyncSession(void)
+ ?AddedItemsL@RSconSyncSession@@QBEXAAV?$RArray@H@@@Z @ 4 NONAME ; void RSconSyncSession::AddedItemsL(class RArray<int> &) const
+ ?CancelRequest@RSconSyncSession@@QAEXXZ @ 5 NONAME ; void RSconSyncSession::CancelRequest(void)
+ ?Close@RSconSyncSession@@QAEXXZ @ 6 NONAME ; void RSconSyncSession::Close(void)
+ ?CloseDataStore@RSconSyncSession@@QBEXXZ @ 7 NONAME ; void RSconSyncSession::CloseDataStore(void) const
+ ?CommitChangeInfoL@RSconSyncSession@@QAEXABV?$RArray@H@@@Z @ 8 NONAME ; void RSconSyncSession::CommitChangeInfoL(class RArray<int> const &)
+ ?Connect@RSconSyncSession@@QAEHXZ @ 9 NONAME ; int RSconSyncSession::Connect(void)
+ ?CreateItemL@RSconSyncSession@@QAEXAAHHABVTDesC8@@11@Z @ 10 NONAME ; void RSconSyncSession::CreateItemL(int &, int, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &)
+ ?CreateItemL@RSconSyncSession@@QAEXAAV?$TPckg@H@@HABVTDesC8@@11AAVTRequestStatus@@@Z @ 11 NONAME ; void RSconSyncSession::CreateItemL(class TPckg<int> &, int, class TDesC8 const &, class TDesC8 const &, class TDesC8 const &, class TRequestStatus &)
+ ?DefaultStoreL@CSconDataproviderInfo@@QAEAAVTDesC16@@XZ @ 12 NONAME ; class TDesC16 & CSconDataproviderInfo::DefaultStoreL(void)
+ ?DeleteAllItems@RSconSyncSession@@QAEXAAVTRequestStatus@@@Z @ 13 NONAME ; void RSconSyncSession::DeleteAllItems(class TRequestStatus &)
+ ?DeleteItemL@RSconSyncSession@@QAEXH@Z @ 14 NONAME ; void RSconSyncSession::DeleteItemL(int)
+ ?DeletedItemsL@RSconSyncSession@@QBEXAAV?$RArray@H@@@Z @ 15 NONAME ; void RSconSyncSession::DeletedItemsL(class RArray<int> &) const
+ ?DisplayNameL@CSconDataproviderInfo@@QAEAAVTDesC16@@XZ @ 16 NONAME ; class TDesC16 & CSconDataproviderInfo::DisplayNameL(void)
+ ?ExternalizeL@CSconDataproviderInfo@@QBEXAAVRWriteStream@@@Z @ 17 NONAME ; void CSconDataproviderInfo::ExternalizeL(class RWriteStream &) const
+ ?GetParent@RSconSyncSession@@QAEHHAAH@Z @ 18 NONAME ; int RSconSyncSession::GetParent(int, int &)
+ ?GetSyncTimeStampL@RSconSyncSession@@QBEXHHAAVTDateTime@@@Z @ 19 NONAME ; void RSconSyncSession::GetSyncTimeStampL(int, int, class TDateTime &) const
+ ?HasSyncHistoryL@RSconSyncSession@@QBEHXZ @ 20 NONAME ; int RSconSyncSession::HasSyncHistoryL(void) const
+ ?ImplementationUid@CSconDataproviderInfo@@QBE?AVTUid@@XZ @ 21 NONAME ; class TUid CSconDataproviderInfo::ImplementationUid(void) const
+ ?InternalizeL@CSconDataproviderInfo@@QAEXAAVRReadStream@@@Z @ 22 NONAME ; void CSconDataproviderInfo::InternalizeL(class RReadStream &)
+ ?ListAllImplementationsL@RSconSyncSession@@QAEXAAV?$RPointerArray@VCSconDataproviderInfo@@@@@Z @ 23 NONAME ; void RSconSyncSession::ListAllImplementationsL(class RPointerArray<class CSconDataproviderInfo> &)
+ ?ListStoresL@CSconDataproviderInfo@@QBEPAVCDesC16Array@@XZ @ 24 NONAME ; class CDesC16Array * CSconDataproviderInfo::ListStoresL(void) const
+ ?ModifiedItemsL@RSconSyncSession@@QBEXAAV?$RArray@H@@@Z @ 25 NONAME ; void RSconSyncSession::ModifiedItemsL(class RArray<int> &) const
+ ?MoveItemL@RSconSyncSession@@QAEXHH@Z @ 26 NONAME ; void RSconSyncSession::MoveItemL(int, int)
+ ?MovedItemsL@RSconSyncSession@@QBEXAAV?$RArray@H@@@Z @ 27 NONAME ; void RSconSyncSession::MovedItemsL(class RArray<int> &) const
+ ?NewL@CSconDataproviderInfo@@SAPAV1@XZ @ 28 NONAME ; class CSconDataproviderInfo * CSconDataproviderInfo::NewL(void)
+ ?OpenDataStoreL@RSconSyncSession@@QAEXHABVTDesC16@@H@Z @ 29 NONAME ; void RSconSyncSession::OpenDataStoreL(int, class TDesC16 const &, int)
+ ?OpenItemL@RSconSyncSession@@QAEXHAAH0AAVTDes8@@1AAVCBufFlat@@@Z @ 30 NONAME ; void RSconSyncSession::OpenItemL(int, int &, int &, class TDes8 &, class TDes8 &, class CBufFlat &)
+ ?ReplaceItemL@RSconSyncSession@@QAEXHHHABVTDesC8@@@Z @ 31 NONAME ; void RSconSyncSession::ReplaceItemL(int, int, int, class TDesC8 const &)
+ ?ReplaceItemL@RSconSyncSession@@QAEXHHHABVTDesC8@@AAVTRequestStatus@@@Z @ 32 NONAME ; void RSconSyncSession::ReplaceItemL(int, int, int, class TDesC8 const &, class TRequestStatus &)
+ ?ResetChangeInfoL@RSconSyncSession@@QAEXXZ @ 33 NONAME ; void RSconSyncSession::ResetChangeInfoL(void)
+ ?SetDefaultStoreL@CSconDataproviderInfo@@QAEXABVTDesC16@@@Z @ 34 NONAME ; void CSconDataproviderInfo::SetDefaultStoreL(class TDesC16 const &)
+ ?SetDisplayNameL@CSconDataproviderInfo@@QAEXABVTDesC16@@@Z @ 35 NONAME ; void CSconDataproviderInfo::SetDisplayNameL(class TDesC16 const &)
+ ?SetImplementationUid@CSconDataproviderInfo@@QAEXVTUid@@@Z @ 36 NONAME ; void CSconDataproviderInfo::SetImplementationUid(class TUid)
+ ?SetRemoteStoreFormatL@RSconSyncSession@@QAEXABVCSmlDataStoreFormat@@@Z @ 37 NONAME ; void RSconSyncSession::SetRemoteStoreFormatL(class CSmlDataStoreFormat const &)
+ ?SetStoresL@CSconDataproviderInfo@@QAEXABVCDesC16Array@@@Z @ 38 NONAME ; void CSconDataproviderInfo::SetStoresL(class CDesC16Array const &)
+ ?SoftDeleteItemL@RSconSyncSession@@QAEXH@Z @ 39 NONAME ; void RSconSyncSession::SoftDeleteItemL(int)
+ ?SoftDeletedItemsL@RSconSyncSession@@QBEXAAV?$RArray@H@@@Z @ 40 NONAME ; void RSconSyncSession::SoftDeletedItemsL(class RArray<int> &) const
+ ?StoreFormatL@RSconSyncSession@@QAEPAVCSmlDataStoreFormat@@ABVRStringPool@@@Z @ 41 NONAME ; class CSmlDataStoreFormat * RSconSyncSession::StoreFormatL(class RStringPool const &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/eabi/sconsyncclientu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,49 @@
+EXPORTS
+ _ZN16RSconSyncSession11CreateItemLER5TPckgIiEiRK6TDesC8S5_S5_R14TRequestStatus @ 1 NONAME
+ _ZN16RSconSyncSession11CreateItemLERiiRK6TDesC8S3_S3_ @ 2 NONAME
+ _ZN16RSconSyncSession11DeleteItemLEi @ 3 NONAME
+ _ZN16RSconSyncSession12ReplaceItemLEiiiRK6TDesC8 @ 4 NONAME
+ _ZN16RSconSyncSession12ReplaceItemLEiiiRK6TDesC8R14TRequestStatus @ 5 NONAME
+ _ZN16RSconSyncSession12StoreFormatLERK11RStringPool @ 6 NONAME
+ _ZN16RSconSyncSession13CancelRequestEv @ 7 NONAME
+ _ZN16RSconSyncSession14DeleteAllItemsER14TRequestStatus @ 8 NONAME
+ _ZN16RSconSyncSession14OpenDataStoreLEiRK7TDesC16i @ 9 NONAME
+ _ZN16RSconSyncSession15SoftDeleteItemLEi @ 10 NONAME
+ _ZN16RSconSyncSession16ResetChangeInfoLEv @ 11 NONAME
+ _ZN16RSconSyncSession17CommitChangeInfoLERK6RArrayIiE @ 12 NONAME
+ _ZN16RSconSyncSession21SetRemoteStoreFormatLERK19CSmlDataStoreFormat @ 13 NONAME
+ _ZN16RSconSyncSession23ListAllImplementationsLER13RPointerArrayI21CSconDataproviderInfoE @ 14 NONAME
+ _ZN16RSconSyncSession5CloseEv @ 15 NONAME
+ _ZN16RSconSyncSession7ConnectEv @ 16 NONAME
+ _ZN16RSconSyncSession9GetParentEiRi @ 17 NONAME
+ _ZN16RSconSyncSession9MoveItemLEii @ 18 NONAME
+ _ZN16RSconSyncSession9OpenItemLEiRiS0_R5TDes8S2_R8CBufFlat @ 19 NONAME
+ _ZN16RSconSyncSessionC1Ev @ 20 NONAME
+ _ZN16RSconSyncSessionC2Ev @ 21 NONAME
+ _ZN16RSconSyncSessionD1Ev @ 22 NONAME
+ _ZN16RSconSyncSessionD2Ev @ 23 NONAME
+ _ZN21CSconDataproviderInfo10SetStoresLERK12CDesC16Array @ 24 NONAME
+ _ZN21CSconDataproviderInfo12DisplayNameLEv @ 25 NONAME
+ _ZN21CSconDataproviderInfo12InternalizeLER11RReadStream @ 26 NONAME
+ _ZN21CSconDataproviderInfo13DefaultStoreLEv @ 27 NONAME
+ _ZN21CSconDataproviderInfo15SetDisplayNameLERK7TDesC16 @ 28 NONAME
+ _ZN21CSconDataproviderInfo16SetDefaultStoreLERK7TDesC16 @ 29 NONAME
+ _ZN21CSconDataproviderInfo20SetImplementationUidE4TUid @ 30 NONAME
+ _ZN21CSconDataproviderInfo4NewLEv @ 31 NONAME
+ _ZN21CSconDataproviderInfoD0Ev @ 32 NONAME
+ _ZN21CSconDataproviderInfoD1Ev @ 33 NONAME
+ _ZN21CSconDataproviderInfoD2Ev @ 34 NONAME
+ _ZNK16RSconSyncSession11AddedItemsLER6RArrayIiE @ 35 NONAME
+ _ZNK16RSconSyncSession11MovedItemsLER6RArrayIiE @ 36 NONAME
+ _ZNK16RSconSyncSession13DeletedItemsLER6RArrayIiE @ 37 NONAME
+ _ZNK16RSconSyncSession14CloseDataStoreEv @ 38 NONAME
+ _ZNK16RSconSyncSession14ModifiedItemsLER6RArrayIiE @ 39 NONAME
+ _ZNK16RSconSyncSession15HasSyncHistoryLEv @ 40 NONAME
+ _ZNK16RSconSyncSession17GetSyncTimeStampLEiiR9TDateTime @ 41 NONAME
+ _ZNK16RSconSyncSession17SoftDeletedItemsLER6RArrayIiE @ 42 NONAME
+ _ZNK21CSconDataproviderInfo11ListStoresLEv @ 43 NONAME
+ _ZNK21CSconDataproviderInfo12ExternalizeLER12RWriteStream @ 44 NONAME
+ _ZNK21CSconDataproviderInfo17ImplementationUidEv @ 45 NONAME
+ _ZTI21CSconDataproviderInfo @ 46 NONAME ; #<TI>#
+ _ZTV21CSconDataproviderInfo @ 47 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project SyncClient
+*
+*/
+
+
+PRJ_EXPORTS
+../rom/sconsyncclient.iby CORE_APP_LAYER_IBY_EXPORT_PATH(sconsyncclient.iby)
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconsyncclient.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/group/sconsyncclient.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Client side of sconsyncserver
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET sconsyncclient.dll
+TARGETTYPE dll
+
+CAPABILITY CAP_CLIENT_DLL
+
+UID 0x1000008d 0x2001A963
+VENDORID VID_DEFAULT
+
+SOURCEPATH ../src
+SOURCE sconsyncclient.cpp
+SOURCE scondataproviderinfo.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+// Server
+USERINCLUDE ../../../servers/syncserver/inc
+
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY estor.lib
+LIBRARY bafl.lib
+LIBRARY charconv.lib
+LIBRARY smlstoreformat.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/inc/scondataproviderinfo.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconDataproviderInfo header
+*
+*/
+
+
+#ifndef SCONDATAPROVIDERINFO_H_
+#define SCONDATAPROVIDERINFO_H_
+
+#include <e32base.h>
+#include <badesca.h>
+
+class RWriteStream;
+class RReadStream;
+
+/**
+ * Contains information about DataSync dataprovider.
+ */
+class CSconDataproviderInfo : public CBase
+{
+public:
+ IMPORT_C static CSconDataproviderInfo* NewL();
+ IMPORT_C ~CSconDataproviderInfo();
+
+ IMPORT_C void ExternalizeL( RWriteStream& aStream ) const;
+ IMPORT_C void InternalizeL( RReadStream& aStream );
+
+ IMPORT_C TUid ImplementationUid() const;
+ IMPORT_C void SetImplementationUid( const TUid aUid );
+ IMPORT_C TDesC& DisplayNameL();
+ IMPORT_C void SetDisplayNameL( const TDesC& aName );
+ IMPORT_C TDesC& DefaultStoreL();
+ IMPORT_C void SetDefaultStoreL( const TDesC& aStore );
+ IMPORT_C CDesCArray* ListStoresL() const;
+ IMPORT_C void SetStoresL( const CDesCArray& aStores );
+private:
+ CSconDataproviderInfo();
+ void ConstructL();
+
+private:
+ TInt iUid;
+ HBufC* iName;
+ HBufC* iDefaultStore;
+ CDesCArrayFlat* iStores;
+};
+
+typedef RPointerArray<CSconDataproviderInfo> RSconDataProviderInfoArray;
+
+#endif /*SCONDATAPROVIDERINFO_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/inc/sconsyncclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RSconSyncSession header
+*
+*/
+
+
+#ifndef _SCONSYNCCLIENT_H_
+#define _SCONSYNCCLIENT_H_
+
+#include <e32base.h>
+#include <e32std.h>
+#include <ecom/ImplementationInformation.h>
+#include <SmlDataProvider.h>
+
+#include "scondataproviderinfo.h"
+
+
+
+class CNSmlDataItemUidSet;
+
+class RSconSyncSession : public RSessionBase
+{
+public:
+ IMPORT_C RSconSyncSession();
+ IMPORT_C ~RSconSyncSession();
+
+ IMPORT_C TInt Connect();
+ IMPORT_C void Close();
+
+ IMPORT_C void ListAllImplementationsL( RSconDataProviderInfoArray& aInfoArray );
+
+ IMPORT_C void OpenDataStoreL( const TSmlDataProviderId aProviderId, const TDesC& aStoreName, const TInt aContextId );
+
+ IMPORT_C void OpenItemL(TSmlDbItemUid aUid, TBool& aFieldChange,
+ TSmlDbItemUid& aParent, TDes8& aMimeType, TDes8& aMimeVer,
+ CBufFlat& aItemData );
+
+ IMPORT_C void CreateItemL(TSmlDbItemUid& aUid, TSmlDbItemUid aParent,
+ const TDesC8& aMimeType, const TDesC8& aMimeVer, const TDesC8& aData);
+ IMPORT_C void CreateItemL(TPckg<TSmlDbItemUid>& aUidPckg, TSmlDbItemUid aParent,
+ const TDesC8& aMimeType, const TDesC8& aMimeVer, const TDesC8& aData,
+ TRequestStatus& aStatus );
+
+ IMPORT_C void ReplaceItemL(TSmlDbItemUid aUid, TSmlDbItemUid aParent,
+ TBool aFieldChange, const TDesC8& aData);
+ IMPORT_C void ReplaceItemL(TSmlDbItemUid aUid, TSmlDbItemUid aParent,
+ TBool aFieldChange, const TDesC8& aData,
+ TRequestStatus& aStatus );
+
+ IMPORT_C void MoveItemL(TSmlDbItemUid aUid, TSmlDbItemUid aNewParent);
+ IMPORT_C void DeleteItemL(TSmlDbItemUid aUid);
+ IMPORT_C void SoftDeleteItemL(TSmlDbItemUid aUid);
+ IMPORT_C void DeleteAllItems( TRequestStatus& aStatus );
+
+ IMPORT_C TBool HasSyncHistoryL() const;
+ IMPORT_C void AddedItemsL( RArray<TSmlDbItemUid>& aItems ) const;
+ IMPORT_C void DeletedItemsL( RArray<TSmlDbItemUid>& aItems ) const;
+ IMPORT_C void SoftDeletedItemsL( RArray<TSmlDbItemUid>& aItems ) const;
+ IMPORT_C void ModifiedItemsL( RArray<TSmlDbItemUid>& aItems ) const;
+ IMPORT_C void MovedItemsL( RArray<TSmlDbItemUid>& aItems ) const;
+
+ IMPORT_C void CloseDataStore() const;
+
+ IMPORT_C void ResetChangeInfoL();
+ IMPORT_C void CommitChangeInfoL(const RArray<TSmlDbItemUid>& aItems );
+
+ IMPORT_C void GetSyncTimeStampL( const TSmlDataProviderId aProviderId, const TInt aContextId, TDateTime& aTimeStamp ) const;
+
+ IMPORT_C CSmlDataStoreFormat* StoreFormatL( const RStringPool& aStringPool );
+ IMPORT_C void SetRemoteStoreFormatL( const CSmlDataStoreFormat& aServerDataStoreFormat );
+
+
+ IMPORT_C void CancelRequest();
+
+ IMPORT_C TInt GetParent( TSmlDbItemUid aUid, TSmlDbItemUid& aParent );
+private:
+ TInt StartServer();
+ TInt CreateAndSendChunkHandle();
+private:
+ RChunk iChunk;
+ TIpcArgs iArgs;
+
+};
+
+#endif // _SCONSYNCCLIENT_H_
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/rom/sconsyncclient.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SconSyncClient
+*
+*/
+
+#ifndef _SCONSYNCCLIENT_IBY_
+#define _SCONSYNCCLIENT_IBY_
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\sconsyncclient.dll SHARED_LIB_DIR\sconsyncclient.dll
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/src/scondataproviderinfo.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconDataproviderInfo implementation
+*
+*/
+
+
+#include "scondataproviderinfo.h"
+#include <s32strm.h>
+#include <badesca.h>
+#include <utf.h> // for CnvUtfConverter
+#include "debug.h"
+
+CSconDataproviderInfo::CSconDataproviderInfo()
+ {
+ }
+
+EXPORT_C CSconDataproviderInfo::~CSconDataproviderInfo()
+ {
+ delete iName;
+ delete iDefaultStore;
+ delete iStores;
+ }
+
+EXPORT_C CSconDataproviderInfo* CSconDataproviderInfo::NewL()
+ {
+ return new (ELeave) CSconDataproviderInfo();
+ }
+
+EXPORT_C void CSconDataproviderInfo::ExternalizeL( RWriteStream& aStream ) const
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("iUid: 0x%x", iUid);
+ aStream.WriteInt32L( iUid );
+ if ( iName )
+ {
+ HBufC8* temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iName->Des() );
+ CleanupStack::PushL( temp );
+ TPtrC8 tempPtr = temp->Des();
+ aStream.WriteUint16L( tempPtr.Length() );
+ aStream.WriteL( tempPtr );
+ CleanupStack::PopAndDestroy( temp );
+ }
+ else
+ {
+ aStream.WriteUint16L( 0 );
+ }
+
+ if ( iDefaultStore )
+ {
+ HBufC8* temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iDefaultStore->Des() );
+ CleanupStack::PushL( temp );
+ TPtrC8 tempPtr = temp->Des();
+ aStream.WriteUint16L( tempPtr.Length() );
+ aStream.WriteL( tempPtr );
+ CleanupStack::PopAndDestroy( temp );
+ }
+ else
+ {
+ aStream.WriteUint16L( 0 );
+ }
+ if ( iStores )
+ {
+ aStream.WriteUint16L( iStores->Count() );
+ for ( TInt i=0; i<iStores->Count(); i++ )
+ {
+ TPtrC storePtr = (*iStores)[i];
+ HBufC8* temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( storePtr );
+ CleanupStack::PushL( temp );
+ TPtrC8 tempPtr = temp->Des();
+ aStream.WriteUint16L( tempPtr.Length() );
+ if ( tempPtr.Length() > 0 )
+ {
+ aStream.WriteL( tempPtr );
+ }
+ CleanupStack::PopAndDestroy( temp );
+ }
+ }
+ else
+ {
+ aStream.WriteUint16L( 0 );
+ }
+ aStream.CommitL();
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void CSconDataproviderInfo::InternalizeL( RReadStream& aStream )
+ {
+ TRACE_FUNC_ENTRY;
+ delete iName;
+ iName = NULL;
+ delete iDefaultStore;
+ iDefaultStore = NULL;
+ delete iStores;
+ iStores = NULL;
+ iStores = new ( ELeave ) CDesCArrayFlat( 1 );
+ iUid = aStream.ReadInt32L();
+ TInt len = aStream.ReadUint16L();
+ if ( len > 0 )
+ {
+ HBufC8* tempBuf = HBufC8::NewLC( len );
+ TPtr8 tempPtr = tempBuf->Des();
+ aStream.ReadL( tempPtr, len );
+
+ iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( tempPtr );
+ CleanupStack::PopAndDestroy( tempBuf );
+ }
+
+ len = aStream.ReadUint16L();
+ if ( len > 0 )
+ {
+ HBufC8* tempBuf = HBufC8::NewLC( len );
+ TPtr8 tempPtr = tempBuf->Des();
+ aStream.ReadL( tempPtr, len );
+
+ iDefaultStore = CnvUtfConverter::ConvertToUnicodeFromUtf8L( tempPtr );
+ CleanupStack::PopAndDestroy( tempBuf );
+ }
+
+ TInt storeCount = aStream.ReadUint16L();
+ for (TInt i=0; i<storeCount; i++ )
+ {
+ len = aStream.ReadUint16L();
+ if ( len > 0 )
+ {
+ HBufC8* tempBuf8 = HBufC8::NewLC( len );
+ TPtr8 tempPtr8 = tempBuf8->Des();
+ aStream.ReadL( tempPtr8, len );
+
+ HBufC* temp = CnvUtfConverter::ConvertToUnicodeFromUtf8L( tempPtr8 );
+ CleanupStack::PushL( temp );
+ TPtr tempPtr = temp->Des();
+ iStores->AppendL( tempPtr );
+ CleanupStack::PopAndDestroy( temp );
+ CleanupStack::PopAndDestroy( tempBuf8 );
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C TUid CSconDataproviderInfo::ImplementationUid() const
+ {
+ return TUid::Uid( iUid );
+ }
+
+EXPORT_C void CSconDataproviderInfo::SetImplementationUid( const TUid aUid )
+ {
+ iUid = aUid.iUid;
+ }
+
+EXPORT_C TDesC& CSconDataproviderInfo::DisplayNameL()
+ {
+ if ( iName )
+ {
+ return *iName;
+ }
+ else
+ {
+ iName = KNullDesC().AllocL();
+ return *iName;
+ }
+ }
+
+EXPORT_C void CSconDataproviderInfo::SetDisplayNameL( const TDesC& aName )
+ {
+ delete iName;
+ iName = NULL;
+ iName = aName.AllocL();
+ }
+
+EXPORT_C TDesC& CSconDataproviderInfo::DefaultStoreL()
+ {
+ if ( iDefaultStore )
+ {
+ return *iDefaultStore;
+ }
+ else
+ {
+ iDefaultStore = KNullDesC().AllocL();
+ return *iDefaultStore;
+ }
+ }
+
+EXPORT_C void CSconDataproviderInfo::SetDefaultStoreL( const TDesC& aStore )
+ {
+ delete iDefaultStore;
+ iDefaultStore = NULL;
+ iDefaultStore = aStore.AllocL();
+ }
+
+EXPORT_C CDesCArray* CSconDataproviderInfo::ListStoresL() const
+ {
+ if ( !iStores )
+ {
+ User::Leave( KErrNotFound );
+ }
+ return iStores;
+ }
+
+EXPORT_C void CSconDataproviderInfo::SetStoresL( const CDesCArray& aStores )
+ {
+ delete iStores;
+ iStores = NULL;
+ iStores = new ( ELeave ) CDesCArrayFlat( 1 );
+ for ( TInt i=0; i<aStores.Count(); i++ )
+ {
+ iStores->AppendL( aStores[i] );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/clients/syncclient/src/sconsyncclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,668 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RSconSyncSession implementation
+*
+*/
+
+
+#include "sconsyncclient.h"
+
+#include <SmlDataProvider.h>
+#include <s32mem.h>
+
+#include "sconsyncclientserver.h"
+#include "debug.h"
+
+const TInt KSConSyncChunkSize = 0xFFFF; // 65535 bytes;
+const TInt KSConSyncChunkMaxSize = 0x400000; // 4194304 bytes
+
+EXPORT_C RSconSyncSession::RSconSyncSession()
+ {
+ TRACE_FUNC;
+ }
+
+EXPORT_C RSconSyncSession::~RSconSyncSession()
+ {
+ TRACE_FUNC;
+ }
+
+EXPORT_C TInt RSconSyncSession::Connect()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt retryCount = 2;
+ TInt error = KErrNone;
+ while(retryCount)
+ {
+ error = CreateSession(KSconSyncServerName, TVersion(1,0,0));
+ if ( error != KErrNotFound && error != KErrServerTerminated )
+ {
+ break;
+ }
+ error = StartServer();
+ if( error != KErrNone && error != KErrAlreadyExists )
+ {
+ break;
+ }
+ --retryCount;
+ }
+
+ if ( error == KErrNone )
+ {
+ error = CreateAndSendChunkHandle();
+ if ( error != KErrNone )
+ {
+ LOGGER_WRITE("CreateAndSendChunkHandle failed, close session");
+ Close();
+ }
+ }
+ TRACE_FUNC_EXIT;
+ return error;
+ }
+
+// -----------------------------------------------------------------------------
+// RSconSyncSession::Close()
+// Closes the server connection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RSconSyncSession::Close()
+ {
+ TRACE_FUNC_ENTRY;
+ iChunk.Close();
+ RSessionBase::Close();
+ TRACE_FUNC_EXIT
+ }
+
+EXPORT_C void RSconSyncSession::ListAllImplementationsL( RSconDataProviderInfoArray& aInfoArray )
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EListImplementations, args );
+
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::ListAllImplementationsL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+
+ // copy data from the chunk
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ TInt count( readStream.ReadUint16L() );
+ LOGGER_WRITE_1("count: %d", count);
+ for ( TInt i=0; i<count; i++ )
+ {
+ LOGGER_WRITE_1("Import[%d]", i);
+ CSconDataproviderInfo *dpInfo = CSconDataproviderInfo::NewL();
+ CleanupStack::PushL( dpInfo );
+
+ dpInfo->InternalizeL( readStream );
+ aInfoArray.AppendL( dpInfo );
+ CleanupStack::Pop( dpInfo );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::OpenDataStoreL( const TSmlDataProviderId aProviderId, const TDesC& aStoreName, TInt aContextId )
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iChunk.Adjust(
+ sizeof(TInt32)
+ + sizeof(TInt32)
+ + aStoreName.Size()
+ + sizeof(TInt) ));
+
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ writeBuf.WriteInt32L( aProviderId );
+
+ writeBuf.WriteInt32L( aStoreName.Length() );
+ writeBuf.WriteL( aStoreName );
+
+ writeBuf.WriteInt32L( aContextId );
+
+ writeBuf.CommitL();
+ writeBuf.Close();
+
+ TIpcArgs args;
+ TInt ret = SendReceive ( EOpenStore, args );
+
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::OpenDataStoreL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::OpenItemL( TSmlDbItemUid aUid, TBool& aFieldChange,
+ TSmlDbItemUid& aParent, TDes8& aMimeType, TDes8& aMimeVer, CBufFlat& aItemData )
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args( aUid );
+ TInt ret = SendReceive ( EOpenItem, args );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::OpenItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+
+ // copy data from the chunk
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+ TInt32 length ( 0 );
+
+ aItemData.Reset();
+ length = readStream.ReadInt32L();
+
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 dataPtr = data->Des();
+
+ readStream.ReadL( dataPtr, length );
+ aItemData.ExpandL( 0, length );
+ aItemData.Write ( 0, dataPtr );
+
+ CleanupStack::PopAndDestroy( data );
+
+ aFieldChange = readStream.ReadInt8L();
+
+ aParent = readStream.ReadInt32L();
+ length = readStream.ReadInt32L();
+ readStream.ReadL( aMimeType, length );
+
+ length = readStream.ReadInt32L();
+ readStream.ReadL( aMimeVer, length );
+
+ CleanupStack::PopAndDestroy( &readStream );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::CreateItemL(TSmlDbItemUid& aUid/*, TInt aSize*/,
+ TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& aMimeVer,
+ const TDesC8& aData)
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iChunk.Adjust(
+ sizeof(TInt32)
+ + sizeof(TInt32)
+ + aMimeType.Length()
+ + sizeof(TInt32)
+ + aMimeVer.Length()
+ + sizeof(TInt32)
+ + aData.Length() ));
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( writeBuf );
+ writeBuf.WriteInt32L( aParent );
+ writeBuf.WriteInt32L( aMimeType.Length() );
+ writeBuf.WriteL( aMimeType );
+ writeBuf.WriteInt32L( aMimeVer.Length() );
+ writeBuf.WriteL( aMimeVer );
+ writeBuf.WriteInt32L( aData.Length() );
+ writeBuf.WriteL( aData );
+
+ writeBuf.CommitL();
+ CleanupStack::PopAndDestroy( &writeBuf );
+
+
+
+ TPckg<TSmlDbItemUid> pckg(aUid);
+ iArgs = TIpcArgs( &pckg );
+
+ TInt ret = SendReceive ( ECreateItem, iArgs );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::CreateItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ LOGGER_WRITE_1("aUid: %d", aUid);
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::CreateItemL(TPckg<TSmlDbItemUid>& aUidPckg,
+ TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& aMimeVer,
+ const TDesC8& aData, TRequestStatus& aStatus)
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iChunk.Adjust(
+ sizeof(TInt32)
+ + sizeof(TInt32)
+ + aMimeType.Length()
+ + sizeof(TInt32)
+ + aMimeVer.Length()
+ + sizeof(TInt32)
+ + aData.Length() ));
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( writeBuf );
+ writeBuf.WriteInt32L( aParent );
+ writeBuf.WriteInt32L( aMimeType.Length() );
+ writeBuf.WriteL( aMimeType );
+ writeBuf.WriteInt32L( aMimeVer.Length() );
+ writeBuf.WriteL( aMimeVer );
+ writeBuf.WriteInt32L( aData.Length() );
+ writeBuf.WriteL( aData );
+
+ writeBuf.CommitL();
+ CleanupStack::PopAndDestroy( &writeBuf );
+
+ iArgs = TIpcArgs( &aUidPckg );
+ SendReceive( ECreateItem, iArgs, aStatus );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::ReplaceItemL(TSmlDbItemUid aUid,
+ TSmlDbItemUid aParent, TBool aFieldChange, const TDesC8& aData)
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iChunk.Adjust(
+ sizeof(TInt32)
+ + sizeof(TInt32)
+ + sizeof(TInt8)
+ + sizeof(TInt32)
+ + aData.Length() ));
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( writeBuf );
+ writeBuf.WriteInt32L( aUid );
+ writeBuf.WriteInt32L( aParent );
+ writeBuf.WriteInt8L( aFieldChange );
+ writeBuf.WriteInt32L( aData.Length() );
+ writeBuf.WriteL( aData );
+ writeBuf.CommitL();
+ CleanupStack::PopAndDestroy( &writeBuf );
+
+ TIpcArgs args;
+ TInt ret = SendReceive( EReplaceItem, args );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::ReplaceItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::ReplaceItemL(TSmlDbItemUid aUid,
+ TSmlDbItemUid aParent, TBool aFieldChange, const TDesC8& aData,
+ TRequestStatus& aStatus)
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iChunk.Adjust(
+ sizeof(TInt32)
+ + sizeof(TInt32)
+ + sizeof(TInt8)
+ + sizeof(TInt32)
+ + aData.Length() ));
+ RMemWriteStream writeBuf( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( writeBuf );
+ writeBuf.WriteInt32L( aUid );
+ writeBuf.WriteInt32L( aParent );
+ writeBuf.WriteInt8L( aFieldChange );
+ writeBuf.WriteInt32L( aData.Length() );
+ writeBuf.WriteL( aData );
+ writeBuf.CommitL();
+ CleanupStack::PopAndDestroy( &writeBuf );
+
+ TIpcArgs args;
+ SendReceive( EReplaceItem, args, aStatus );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::MoveItemL( TSmlDbItemUid aUid, TSmlDbItemUid aNewParent )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TIpcArgs args(aUid, aNewParent);
+ TInt ret = SendReceive ( EMoveItem, args );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::MoveItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::DeleteItemL( TSmlDbItemUid aUid )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TIpcArgs args( aUid );
+ TInt ret = SendReceive ( EDeleteItem, args );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::DeleteItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ TRACE_FUNC_EXIT;
+ }
+
+
+EXPORT_C void RSconSyncSession::SoftDeleteItemL( TSmlDbItemUid aUid )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TIpcArgs args( aUid );
+ TInt ret = SendReceive ( ESoftDeleteItem, args );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "RSconSyncSession::SoftDeleteItemL() :\
+ Send Receive failed with code %d", ret );
+ User::Leave( ret );
+ };
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::DeleteAllItems( TRequestStatus& aStatus )
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ SendReceive( EDeleteAllItems, args, aStatus );
+ TRACE_FUNC_EXIT;
+ }
+
+
+EXPORT_C TBool RSconSyncSession::HasSyncHistoryL() const
+ {
+ TRACE_FUNC;
+ TBool history(EFalse);
+ TPckg<TBool> pck(history);
+ TIpcArgs args(&pck);
+ TInt ret = SendReceive ( EHasHistory, args );
+ User::LeaveIfError( ret );
+ TRACE_FUNC_EXIT;
+ return history;
+ }
+
+EXPORT_C void RSconSyncSession::AddedItemsL( RArray<TSmlDbItemUid>& aItems) const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EAddedItems, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ aItems.Reset();
+ TInt itemCount = readStream.ReadInt32L();
+ for (TInt i=0; i<itemCount; i++)
+ {
+ aItems.AppendL( readStream.ReadInt32L() );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::DeletedItemsL( RArray<TSmlDbItemUid>& aItems) const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EDeletedItems, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ aItems.Reset();
+ TInt itemCount = readStream.ReadInt32L();
+ for (TInt i=0; i<itemCount; i++)
+ {
+ aItems.AppendL( readStream.ReadInt32L() );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::SoftDeletedItemsL( RArray<TSmlDbItemUid>& aItems) const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( ESoftDeletedItems, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ aItems.Reset();
+ TInt itemCount = readStream.ReadInt32L();
+ for (TInt i=0; i<itemCount; i++)
+ {
+ aItems.AppendL( readStream.ReadInt32L() );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::ModifiedItemsL( RArray<TSmlDbItemUid>& aItems) const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EModifiedItems, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ aItems.Reset();
+ TInt itemCount = readStream.ReadInt32L();
+ for (TInt i=0; i<itemCount; i++)
+ {
+ aItems.AppendL( readStream.ReadInt32L() );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::MovedItemsL( RArray<TSmlDbItemUid>& aItems) const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EMovedItems, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ aItems.Reset();
+ TInt itemCount = readStream.ReadInt32L();
+ for (TInt i=0; i<itemCount; i++)
+ {
+ aItems.AppendL( readStream.ReadInt32L() );
+ }
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::CloseDataStore() const
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ SendReceive ( ECloseStore, args );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::ResetChangeInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EResetChangeInfo, args );
+ User::LeaveIfError( ret );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::CommitChangeInfoL(const RArray<TSmlDbItemUid>& aItems )
+ {
+ TRACE_FUNC_ENTRY;
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ LOGGER_WRITE_1("items count: %d", aItems.Count());
+ stream.WriteInt32L( aItems.Count() );
+ for (TInt i=0; i < aItems.Count(); i++ )
+ {
+ LOGGER_WRITE("Write item");
+ stream.WriteInt32L( aItems[i] );
+ }
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+
+ TIpcArgs args;
+ TInt ret = SendReceive ( ECommitChangeInfo, args );
+ User::LeaveIfError( ret );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::GetSyncTimeStampL( const TSmlDataProviderId aProviderId, const TInt aContextId, TDateTime& aTimeStamp ) const
+ {
+ TRACE_FUNC_ENTRY;
+
+ TPckg<TDateTime> timeBuf( aTimeStamp );
+ TIpcArgs args( aProviderId, aContextId, &timeBuf );
+ TInt ret = SendReceive ( EGetSyncTimeStamp, args );
+ User::LeaveIfError( ret );
+
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C CSmlDataStoreFormat* RSconSyncSession::StoreFormatL( const RStringPool& aStringPool )
+ {
+ TRACE_FUNC_ENTRY;
+ TIpcArgs args;
+ TInt ret = SendReceive ( EExportStoreFormat, args );
+ User::LeaveIfError( ret );
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+ TInt len = readStream.ReadInt32L();
+ LOGGER_WRITE_1("data size from server: %d", len);
+ LOGGER_WRITE("CSmlDataStoreFormat::NewLC");
+ CSmlDataStoreFormat* tempStoreFormat = CSmlDataStoreFormat::NewLC( aStringPool, readStream );
+ LOGGER_WRITE("CSmlDataStoreFormat::NewLC -ok");
+ CleanupStack::Pop( tempStoreFormat );
+
+ LOGGER_WRITE("PopAndDestroy( &readStream )");
+ CleanupStack::PopAndDestroy( &readStream );
+ LOGGER_WRITE("return");
+ TRACE_FUNC_EXIT;
+ return tempStoreFormat;
+ }
+
+EXPORT_C void RSconSyncSession::SetRemoteStoreFormatL( const CSmlDataStoreFormat& aServerDataStoreFormat )
+ {
+ TRACE_FUNC_ENTRY;
+ const TInt KMaximumDataStoreFormatSize = 100000; // 100kb should be enought
+ User::LeaveIfError( iChunk.Adjust( KMaximumDataStoreFormatSize ));
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+
+ aServerDataStoreFormat.ExternalizeL( stream );
+
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+
+ TIpcArgs args;
+ TInt ret = SendReceive ( ESetRemoteStoreFormat, args );
+ User::LeaveIfError( ret );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C void RSconSyncSession::CancelRequest()
+ {
+ TRACE_FUNC_ENTRY;
+ SendReceive( ECancelRequest, TIpcArgs() );
+ TRACE_FUNC_EXIT;
+ }
+
+EXPORT_C TInt RSconSyncSession::GetParent( TSmlDbItemUid aUid, TSmlDbItemUid& aParent )
+ {
+ TRACE_FUNC_ENTRY;
+ TPckg<TSmlDbItemUid> pckg(aParent);
+ TIpcArgs args( aUid, &pckg );
+ TInt ret = SendReceive( EReadParent, args );
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+TInt RSconSyncSession::StartServer()
+ {
+ TRACE_FUNC_ENTRY;
+
+ RProcess server;
+ TInt error = server.Create(KSconSyncServerExe, KNullDesC);
+ if ( error != KErrNone )
+ {
+ return error;
+ }
+ // start server and wait for signal before proceeding
+ TRequestStatus status;
+ server.Rendezvous(status);
+ if ( status.Int() != KRequestPending )
+ {
+ server.Kill(0);
+ }
+ else
+ {
+ server.Resume();
+ }
+
+ User::WaitForRequest( status );
+ error = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
+ server.Close();
+ TRACE_FUNC_EXIT;
+ return error;
+ }
+
+// -----------------------------------------------------------------------------
+// RSconSyncSession::CreateAndSendChunkHandle()
+// Creates a chunk and sends a handle to server
+// -----------------------------------------------------------------------------
+//
+TInt RSconSyncSession::CreateAndSendChunkHandle()
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt err = iChunk.CreateGlobal( KNullDesC,
+ KSConSyncChunkSize,
+ KSConSyncChunkMaxSize );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1("iChunk.CreateGlobal failed, err: %d", err);
+ return err;
+ }
+ TIpcArgs args;
+ args.Set( 0, iChunk );
+ err = SendReceive( ESendChunkHandle, args );
+
+ LOGGER_WRITE_1("RSconSyncSession::CreateAndSendChunkHandle : returned: %d", err);
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser Client-Server build information file.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_MMPFILES
+cntparsersrv.mmp
+cntparsersrvexe.mmp
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/bld/cntparsersrv.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser Client
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_CLIENT_DLL
+
+TARGET cntparserserver.dll
+TARGETTYPE dll
+
+UID 0x10009d8d 0x101F99F8
+
+#if defined(ARMCC)
+DEFFILE ./def/eabiu
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+SOURCEPATH ../src
+SOURCE cntparserclient.cpp
+SOURCE cntparserinfolog.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY cntmodel.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY versit.lib
+LIBRARY vcard.lib
+LIBRARY bafl.lib
+DEBUGLIBRARY flogger.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/bld/cntparsersrvexe.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser Server
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_SERVER
+
+TARGET cntparserserverexe.exe
+TARGETTYPE exe
+
+UID 0 0x101F99F9
+
+SOURCEPATH ../src
+SOURCE cntparserserverexe.cpp
+SOURCE cntparserserversession.cpp
+SOURCE cntparsercollector.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../inc
+
+// Default system include paths
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY cntmodel.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY versit.lib
+LIBRARY vcard.lib
+LIBRARY bafl.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+ ??0RCntParserServer@@QAE@XZ @ 1 NONAME ; RCntParserServer::RCntParserServer(void)
+ ?Cancel@RCntParserServer@@QAEHXZ @ 2 NONAME ; int RCntParserServer::Cancel(void)
+ ?CancelAll@RCntParserServer@@QAEHXZ @ 3 NONAME ; int RCntParserServer::CancelAll(void)
+ ?Connect@RCntParserServer@@QAEHXZ @ 4 NONAME ; int RCntParserServer::Connect(void)
+ ?ContactsParsed@RCntParserServer@@QAEHXZ @ 5 NONAME ; int RCntParserServer::ContactsParsed(void)
+ ?ContactsSaved@RCntParserServer@@QAEHXZ @ 6 NONAME ; int RCntParserServer::ContactsSaved(void)
+ ?CreateIrMCL2PhoneBook@RCntParserServer@@QAEHHH@Z @ 7 NONAME ; int RCntParserServer::CreateIrMCL2PhoneBook(int, int)
+ ?Disconnect@RCntParserServer@@QAEHXZ @ 8 NONAME ; int RCntParserServer::Disconnect(void)
+ ?MaximumRecords@CCntParserInfoLog@@QBEHXZ @ 9 NONAME ; int CCntParserInfoLog::MaximumRecords(void) const
+ ?NewL@CCntParserInfoLog@@SAPAV1@XZ @ 10 NONAME ; class CCntParserInfoLog * CCntParserInfoLog::NewL(void)
+ ?SaveToFileL@CCntParserInfoLog@@QBEXABVTDesC16@@@Z @ 11 NONAME ; void CCntParserInfoLog::SaveToFileL(class TDesC16 const &) const
+ ?SetMaximumRecords@CCntParserInfoLog@@QAEXH@Z @ 12 NONAME ; void CCntParserInfoLog::SetMaximumRecords(int)
+ ?SetTotalRecords@CCntParserInfoLog@@QAEXH@Z @ 13 NONAME ; void CCntParserInfoLog::SetTotalRecords(int)
+ ?TotalNumberOfContacts@RCntParserServer@@QAEHXZ @ 14 NONAME ; int RCntParserServer::TotalNumberOfContacts(void)
+ ?TotalRecords@CCntParserInfoLog@@QBEHXZ @ 15 NONAME ; int CCntParserInfoLog::TotalRecords(void) const
+ ?Version@RCntParserServer@@QBE?AVTVersion@@XZ @ 16 NONAME ; class TVersion RCntParserServer::Version(void) const
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/bld/def/eabiuu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,21 @@
+EXPORTS
+ _ZN16RCntParserServer10DisconnectEv @ 1 NONAME
+ _ZN16RCntParserServer13ContactsSavedEv @ 2 NONAME
+ _ZN16RCntParserServer14ContactsParsedEv @ 3 NONAME
+ _ZN16RCntParserServer21CreateIrMCL2PhoneBookEii @ 4 NONAME
+ _ZN16RCntParserServer21TotalNumberOfContactsEv @ 5 NONAME
+ _ZN16RCntParserServer6CancelEv @ 6 NONAME
+ _ZN16RCntParserServer7ConnectEv @ 7 NONAME
+ _ZN16RCntParserServer9CancelAllEv @ 8 NONAME
+ _ZN16RCntParserServerC1Ev @ 9 NONAME
+ _ZN16RCntParserServerC2Ev @ 10 NONAME
+ _ZN17CCntParserInfoLog15SetTotalRecordsEi @ 11 NONAME
+ _ZN17CCntParserInfoLog17SetMaximumRecordsEi @ 12 NONAME
+ _ZN17CCntParserInfoLog4NewLEv @ 13 NONAME
+ _ZNK16RCntParserServer7VersionEv @ 14 NONAME
+ _ZNK17CCntParserInfoLog11SaveToFileLERK7TDesC16 @ 15 NONAME
+ _ZNK17CCntParserInfoLog12TotalRecordsEv @ 16 NONAME
+ _ZNK17CCntParserInfoLog14MaximumRecordsEv @ 17 NONAME
+ _ZTI17CCntParserInfoLog @ 18 NONAME ; #<TI>#
+ _ZTV17CCntParserInfoLog @ 19 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/clientserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser Server definitions
+*
+*/
+
+
+#ifndef __CLIENTSERVER_H__
+#define __CLIENTSERVER_H__
+#include <e32base.h>
+
+// server name
+_LIT(KCntParserName,"Contacts Parser");
+
+// A version must be specified when creating a session with the server
+
+const TUint KCntParserMajorVersionNumber=0;
+const TUint KCntParserMinorVersionNumber=1;
+const TUint KCntParserBuildVersionNumber=1;
+
+// opcodes used in message passing between client and server
+enum TCntParserRqst
+ {
+ ECntParserServerCancel,
+ ECntParserServerClose,
+ ECntParserServerCreateIrMCL2,
+ ECntParserServerTotalNumOfContacts,
+ ECntParserServerDisconnect,
+ ECntParserServerCntParsed,
+ ECntParserServerCntSaved,
+ ECntParserServerCancelAll
+ };
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/cntparserclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser Client
+*
+*/
+
+
+
+#if !defined(__CNTPARSERCLIENT_H__)
+#define __CNTPARSERCLIENT_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+enum TCntParserConnection
+{
+ ECntParserNotConnected,
+ ECntParserConnected
+};
+
+//**********************************
+//RCntParserServer
+//**********************************
+
+class RCntParserServer : public RSessionBase
+{
+ public:
+ IMPORT_C RCntParserServer();
+ IMPORT_C TInt Connect();
+ IMPORT_C TInt Disconnect();
+ IMPORT_C TVersion Version() const;
+ IMPORT_C TInt CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced);
+ IMPORT_C TInt ContactsParsed();
+ IMPORT_C TInt ContactsSaved();
+ IMPORT_C TInt TotalNumberOfContacts();
+ IMPORT_C TInt Cancel(); //cancels phonebook request
+ IMPORT_C TInt CancelAll(); //cancels all request
+
+ private:
+ TCntParserConnection iConnected;
+};
+
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/cntparsercollector.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserCollector header
+*
+*/
+
+
+
+#ifndef __CNTPARSERCOLLECTOR_H__
+#define __CNTPARSERCOLLECTOR_H__
+
+#include <f32file.h>
+#include <s32file.h>
+
+class CCntParserServer;
+class CContactDatabase;
+class CContactIdArray;
+class CCntFilter;
+class CVersitTlsData;
+
+class CCntParserCollector : public CActive
+{
+ public:
+
+ CCntParserCollector();
+ static CCntParserCollector* NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase);
+ static CCntParserCollector* NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase);
+ virtual ~CCntParserCollector();
+ void ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase);
+ TInt CreateIrMCL2FileL(const TDesC& aFileName,TInt aMaxNumberOfContacts,TBool aForced);
+ void PrepareParserL();
+ void ParseCntDatabaseL();
+ void DoCancel();
+
+ TInt CurrentItem();
+ TInt Count();
+ TInt ContactsSaved();
+
+ protected:
+ void RunL();
+ TInt RunError(TInt aError);
+ void ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty);
+ void CloseResources();
+ void SaveTotalCountL();
+ TInt ReadTotalCountL() const;
+ TBool ContactCountChanged();
+
+ private:
+ CContactDatabase* iContactsDb; //Caller has the ownership
+ TInt iCurrentItem;
+ TInt iCount; //Contacts in CDB
+ TInt iMaxNumberOfContacts; //Max contacts to be parsed (MAXIMUM RECORDS in info.log)
+ RFileWriteStream iWriter;
+ CContactIdArray* iIds; //List of ID numbers of contacts
+ CCntParserServer* iServer; //Caller has the ownership
+ CCntFilter* iFilter;
+ CVersitTlsData* iVersitTLS; //For speed optimization
+ TBool iCancel;
+ TInt iContactsSaved;
+ TInt iTotalCount;
+
+ RFs iFsSession;
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/cntparserinfolog.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserInfoLog header.
+* This class is intended to create the INFO.LOG file for RANSI car phone when
+* downloading contacts using IrMC L2. The implementation contains only mandatory
+* needs and some extension possibilities. This class is RANSI specific and
+* should _NOT_ be used by anyone else without a deeper knowledge.
+*
+*/
+
+
+#ifndef _CNTPARSERINFOLOG_H_
+#define _CNTPARSERINFOLOG_H_
+
+
+class CCntParserInfoLog : public CBase
+{
+ public:
+ CCntParserInfoLog();
+ virtual ~CCntParserInfoLog();
+ IMPORT_C static CCntParserInfoLog* NewL();
+ void ConstructL();
+
+ IMPORT_C void SaveToFileL(const TDesC& aFileName) const;
+
+ IMPORT_C void SetTotalRecords(TInt aTotalRecords);
+ IMPORT_C void SetMaximumRecords(TInt aMaximumRecords);
+
+ IMPORT_C TInt TotalRecords() const;
+ IMPORT_C TInt MaximumRecords() const;
+
+ private:
+
+ TInt iTotalRecords;
+ TInt iLastUsedIndex;
+ TInt iMaximumRecords;
+};
+
+#endif // _CNTPARSERINFOLOG_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/cntparserserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserServer header
+*
+*/
+
+
+#ifndef __CNTPARSERSERVER_H__
+#define __CNTPARSERSERVER_H__
+
+#include <e32base.h>
+#include <e32svr.h>
+
+class CCntParserCollector;
+class CContactDatabase;
+
+_LIT(KTxtServer,"CntParserServerExe.exe");
+
+// needed for creating server thread.
+const TUint KDefaultHeapSize=0x10000;
+
+// reasons for server panic
+enum TCntParserServerPanic
+{
+ EBadRequest,
+ EBadDescriptor,
+ EMainSchedulerError,
+ ESvrCreateServer,
+ ESvrStartServer,
+ ECreateTrapCleanup,
+ ENotImplementedYet,
+};
+
+
+//**********************************
+//CCntParserServer
+//**********************************
+class CCntParserServer : public CServer2
+{
+ public:
+ IMPORT_C static CCntParserServer* NewL();
+ IMPORT_C virtual ~CCntParserServer();
+ static TInt RunServer();
+ static void RunServerL();
+ void IncreaseSessionCountL();
+ void DecreaseSessionCount();
+ void Stop();
+
+ TInt CreateIrMCL2PhoneBookL(const TDesC& path, TInt aMaxNumberOfContacts,TBool aForced);
+ void PrepareCollectorL();
+ TInt ContactsParsed();
+ void CancelPhoneBookRequest();
+ void CancelAllPhoneBookRequests();
+ TInt TotalNumOfContacts();
+ TInt ContactsSaved();
+ void Disconnect();
+ void CompletePhoneBookRequests(TInt aErr);
+ void SetRequests(TInt aRequests);
+
+ protected:
+ virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2& aMsg) const;
+
+
+ protected:
+ CCntParserServer();
+
+
+ private:
+ TInt iSessionCount;
+ TInt iRequests; //How many PB.VCF requests are ongoing, if 0 collector is canceled
+
+ CCntParserCollector* iCollector;
+ CContactDatabase* iCurrentDatabase;
+};
+
+//**********************************
+//global functions
+//**********************************
+
+// function to panic the server
+GLREF_C void PanicServer(TCntParserServerPanic aPanic);
+
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/cntparserserversession.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserServerSession header
+*
+*/
+
+
+#ifndef __CNTPARSERSERVERSESSION_H__
+#define __CNTPARSERSERVERSESSION_H__
+
+#include "clientserver.h"
+#include "cntparserclient.h"
+#include "cntparserserver.h"
+#include "cntparsercollector.h"
+
+class CCntParserServer;
+
+//**********************************
+//CCntParserServerSession
+//**********************************
+class CCntParserServerSession : public CSession2
+{
+ public:
+ static CCntParserServerSession* NewL(CCntParserServer* aServer);
+ virtual ~CCntParserServerSession();
+ void ConstructL(CCntParserServer* aServer);
+
+ private:
+ CCntParserServerSession();
+
+ public:
+ virtual void ServiceL(const RMessage2& aMessage);
+ TInt DispatchMessageL(const RMessage2& aMessage);
+ void CompletePhoneBookRequest(TInt aErr);
+
+ protected:
+ // panic the client
+ void PanicClient(TInt aPanic) const;
+
+ private:
+ CCntParserServer* iContactsParserSrv;
+ TBool iPhoneBookRequest;
+ RMessage2 iPhoneBookRequestMessage;
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/inc/irmcconsts.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Contact Parser constants
+*
+*/
+
+
+#ifndef _IRMCCONSTS_H_
+#define _IRMCCONSTS_H_
+
+_LIT(KPhoneBookFilename,"c:\\IrMC\\pb.vcf");
+const TInt KMaximumNumberOfContacts=-1; //-1 == all contacts are transferred
+const TInt KPBNotUpdated=1; //Must be grater than 0
+const TInt KPerformComplete=2; //Must be grater than 0 and different than KPBNotUpdated
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/src/cntparserclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: RCntParserServer implementation.
+*
+*/
+
+
+// needed for client interface
+#include "clientserver.h"
+#include "cntparserserver.h"
+#include "cntparserclient.h"
+
+#include "debug.h"
+
+const TUint KDefaultMessageSlots=4;
+
+
+//------------------------------------------------------------
+// RCntParserServer::RCntParserServer()
+//------------------------------------------------------------
+EXPORT_C RCntParserServer::RCntParserServer():iConnected(ECntParserNotConnected)
+ {
+ }
+//------------------------------------------------------------
+// RCntParserServer::Connect()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::Connect()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::Connect()" );
+
+ TInt r = KErrNone;
+
+ if( iConnected == ECntParserNotConnected )
+ {
+ r = CreateSession( KCntParserName, Version(), KDefaultMessageSlots );
+ if(r==KErrNone)
+ {
+ iConnected=ECntParserConnected;
+ }
+ else
+ {
+ RProcess p;
+ TInt err = p.Create(KTxtServer, KNullDesC);
+ if ( err != KErrNone )
+ {
+ // Loading failed.
+ return err;
+ }
+ TRequestStatus status;
+ p.Rendezvous( status );
+ if( status != KRequestPending )
+ {
+ p.Kill(0); // abort startup
+ p.Close();
+ return KErrGeneral; // status can be KErrNone: don't return status.Int()
+ }
+ else
+ {
+ p.Resume(); // logon OK - start the server
+ }
+
+ User::WaitForRequest( status );
+
+ if( status != KErrNone )
+ {
+ p.Close();
+ return status.Int();
+ }
+
+ r = CreateSession( KCntParserName, Version() );
+ if( r == KErrNone )
+ {
+ iConnected = ECntParserConnected;
+ }
+ p.Close();
+ }
+ }
+ else
+ {
+ r = KErrCouldNotConnect;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::Connect() : return %d", r );
+ return r;
+ }
+//------------------------------------------------------------
+// RCntParserServer::Disconnect()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::Disconnect()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::Disconnect()" );
+
+ TInt res = KErrNone;
+ if(iConnected==ECntParserConnected)
+ {
+ res = SendReceive( ECntParserServerDisconnect, TIpcArgs(NULL) );
+ if( res == KErrNone )
+ {
+ iConnected = ECntParserNotConnected;
+ RSessionBase::Close();
+ }
+ }
+ else
+ {
+ res = KErrCouldNotDisconnect;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::CreateIrMCL2PhoneBook() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::Version(void) const
+//------------------------------------------------------------
+EXPORT_C TVersion RCntParserServer::Version(void) const
+ {
+ return(TVersion(KCntParserMajorVersionNumber,KCntParserMinorVersionNumber,KCntParserBuildVersionNumber));
+ }
+//------------------------------------------------------------
+// RCntParserServer::CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced)
+//------------------------------------------------------------
+EXPORT_C int RCntParserServer::CreateIrMCL2PhoneBook(TInt aMaxNumberOfContacts, TBool aForced)
+ {
+ LOGGER_ENTERFN( "RCntParserServer::CreateIrMCL2PhoneBook()" );
+ TInt res(KErrNone);
+ if( iConnected == ECntParserConnected )
+ {
+ res = SendReceive(ECntParserServerCreateIrMCL2,TIpcArgs(aMaxNumberOfContacts,aForced));
+ }
+ else
+ {
+ res = KErrNotReady;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::CreateIrMCL2PhoneBook() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::ContactsParsed()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::ContactsParsed()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::ContactsParsed()" );
+
+ TInt res=KErrNone;
+ if( iConnected == ECntParserConnected )
+ {
+ TPckgBuf<TInt> pckg;
+ res = SendReceive(ECntParserServerCntParsed,TIpcArgs(&pckg));
+ if( res == KErrNone )
+ {
+ res = pckg();
+ }
+ }
+ else
+ {
+ res = KErrNotReady;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::ContactsParsed() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::TotalNumberOfContacts()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::TotalNumberOfContacts()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::TotalNumberOfContacts()" );
+
+ TInt res = KErrNone;
+ if( iConnected == ECntParserConnected )
+ {
+ TPckgBuf<TInt> pckg;
+ res = SendReceive(ECntParserServerTotalNumOfContacts,TIpcArgs(&pckg));
+ if( res == KErrNone)
+ {
+ res = pckg();
+ }
+ }
+ else
+ {
+ res = KErrNotReady;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::TotalNumberOfContacts() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::Cancel()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::Cancel()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::Cancel()" );
+
+ TInt res = KErrNone;
+ if( iConnected == ECntParserConnected )
+ {
+ res = SendReceive(ECntParserServerCancel,TIpcArgs(NULL));
+ }
+ else
+ {
+ res = KErrCancel;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::Cancel() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::CancelAll()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::CancelAll()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::CancelAll()" );
+
+ TInt res = KErrNone;
+ if(iConnected==ECntParserConnected)
+ {
+ res = SendReceive(ECntParserServerCancelAll,TIpcArgs(NULL));
+ }
+ else
+ {
+ res = KErrCancel;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::CancelAll() : return %d", res );
+ return res;
+ }
+//------------------------------------------------------------
+// RCntParserServer::ContactsSaved()
+//------------------------------------------------------------
+EXPORT_C TInt RCntParserServer::ContactsSaved()
+ {
+ LOGGER_ENTERFN( "RCntParserServer::ContactsSaved()" );
+
+ TInt res = KErrNone;
+ if( iConnected == ECntParserConnected )
+ {
+ TPckgBuf<TInt> pckg;
+ SendReceive(ECntParserServerCntSaved,TIpcArgs(&pckg));
+ res = pckg();
+ }
+ else
+ {
+ res = KErrNotReady;
+ }
+ LOGGER_WRITE_1( "RCntParserServer::ContactsSaved() : return %d", res );
+ return res;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/src/cntparsercollector.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,620 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserCollector implementation.
+*
+*/
+
+
+
+#include <cntfilt.h>
+#include <cntitem.h>
+#include <cntfldst.h>
+
+#include <vcard.h>
+#include <versit.h>
+#include <s32mem.h>
+
+#include "cntparsercollector.h"
+#include "cntparserserver.h"
+#include "irmcconsts.h"
+#include "debug.h"
+
+//Next values are defined in cntdef.h
+const TUid typesToBeSearched[]={{KUidContactFieldPhoneNumberValue},{KUidContactFieldFaxValue}};
+
+_LIT( KTotalCountFilePath, "count.txt" );
+
+_LIT8( KNameProperty, "N" );
+_LIT8( KTelProperty, "TEL" );
+
+
+//------------------------------------------------------------
+// CCntParserCollector::CCntParserCollector():CActive( 0 )
+//------------------------------------------------------------
+CCntParserCollector::CCntParserCollector():CActive( 0 )
+ {
+ }
+//------------------------------------------------------------
+// CCntParserCollector::~CCntParserCollector()
+//------------------------------------------------------------
+CCntParserCollector::~CCntParserCollector()
+ {
+ LOGGER_ENTERFN( "CntParserCollector::~CCntParserCollector()" );
+
+ if( iVersitTLS != NULL )
+ {
+ iVersitTLS->VersitTlsDataClose(); //Close reference
+ }
+ LOGGER_WRITE( "CntParserCollector: Versit OK!" );
+
+ iFsSession.Close();
+ LOGGER_WRITE( "CntParserCollector: FsSession OK!" );
+ iWriter.Close();
+ LOGGER_WRITE( "CntParserCollector: iWriter OK!" );
+ delete iFilter;
+ LOGGER_LEAVEFN( "CntParserCollector::~CCntParserCollector()" );
+ }
+//------------------------------------------------------------
+// CCntParserCollector::NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+//------------------------------------------------------------
+CCntParserCollector* CCntParserCollector::NewL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+ {
+ CCntParserCollector* self=NewLC(aServer, aCurrentDatabase);
+ CleanupStack::Pop();
+ return self;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+//------------------------------------------------------------
+CCntParserCollector* CCntParserCollector::NewLC(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+ {
+ CCntParserCollector* self=new (ELeave) CCntParserCollector();
+ CleanupStack::PushL( self );
+ self->ConstructL( aServer, aCurrentDatabase );
+ return self;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+//------------------------------------------------------------
+void CCntParserCollector::ConstructL(CCntParserServer* aServer,CContactDatabase* aCurrentDatabase)
+ {
+ LOGGER_WRITE( "CntParserCollector: ConstructL" );
+
+ CVersitTlsData& VersitTLS = CVersitTlsData::VersitTlsDataL(); //For speed optimization take a reference to TLS, SEE DESTRUCTOR!!
+ iVersitTLS = &VersitTLS;
+
+ iServer = aServer;
+ iContactsDb = aCurrentDatabase;
+ PrepareParserL();
+
+ CActiveScheduler::Add(this);
+ }
+//------------------------------------------------------------
+// CCntParserCollector::CreateIrMCL2FileL(const TDesC& aFileName, TInt aMaxNumberOfContacts,TBool aForced)
+//------------------------------------------------------------
+TInt CCntParserCollector::CreateIrMCL2FileL(const TDesC& aFileName, TInt aMaxNumberOfContacts,TBool aForced)
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL" );
+ LOGGER_WRITE_1( "CCntParserCollector::CreateIrMCL2FileL aFileName %S", &aFileName );
+
+ iMaxNumberOfContacts = aMaxNumberOfContacts;
+
+ CContactIdArray* changedItems;
+ TTime tTime;
+
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Does the PB.VCF already exist" );
+
+ //Is there a previously created pb.vcf file?
+ RFile file;
+ TInt err = file.Open( iFsSession, aFileName, EFileShareExclusive ); //Open file
+ if( err == KErrNone )
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Yes, when created" );
+ file.Modified(tTime); //When modified
+ }
+ file.Close();
+
+ err = iWriter.Open( iFsSession, aFileName, EFileShareExclusive ); //Open stream
+ CleanupClosePushL( iWriter ); //Yes, this is a member variable, but it's considered
+
+ if( err == KErrPathNotFound )
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: dir did not exist, creating..." );
+ err = iFsSession.MkDir( aFileName );
+ LOGGER_WRITE_1( "CCntParserCollector MkDir returned %d", err );
+ if ( err == KErrNone )
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file after MkDir" );
+ //This is the situation that the file is created for the first time
+ User::LeaveIfError( iWriter.Create( iFsSession, aFileName, EFileShareExclusive ) );
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file created after MkDir" );
+ CleanupStack::Pop(); //iWriter
+ ParseCntDatabaseL(); //create IrMC L2 stuff
+ SaveTotalCountL();
+ return KErrNone; //File created normally
+ }
+ }
+ if( err == KErrNotFound ) // file does not exist - create it
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file" );
+
+ //This is the situation that the file is created for the first time
+ User::LeaveIfError( iWriter.Create( iFsSession, aFileName, EFileShareExclusive ) );
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: New file created" );
+ CleanupStack::Pop(); //iWriter
+ ParseCntDatabaseL(); //create IrMC L2 stuff
+ SaveTotalCountL();
+ return KErrNone; //File created normally
+ }
+ else
+ {
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CreateIrMCL2FileL errror leaving %d", err );
+ User::Leave(err);
+ }
+ iWriter.Close();
+
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: File exists, any changes in CDB?" );
+ //The file exists, but are there any changes?
+
+ changedItems = iContactsDb->ContactsChangedSinceL( tTime ); //Create a contactidarray, user takes the ownership
+ CleanupStack::PushL(changedItems);
+
+ LOGGER_WRITE_1( "CreateIrMCL2FileL changedItems %d", changedItems->Count() );
+ LOGGER_WRITE_1( "CreateIrMCL2FileL aForced %d", aForced );
+ //Are there changes in any contact
+ if( changedItems->Count()!=0 || aForced || ContactCountChanged() )
+ {
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: Changes in CDB, replace existing PB.VCF" );
+
+ CleanupStack::PopAndDestroy(changedItems);
+
+ //Create pb.vcf
+ User::LeaveIfError( iWriter.Replace( iFsSession, aFileName, EFileShareExclusive) );
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: file replaced" );
+ CleanupStack::Pop(); //iWriter
+ ParseCntDatabaseL(); //create IrMC L2 stuff
+ SaveTotalCountL();
+ return KErrNone; //File created normally
+ }
+
+ //No changes
+ CleanupStack::PopAndDestroy(changedItems);
+ CleanupStack::PopAndDestroy();
+
+ LOGGER_WRITE( "CntParserCollector: CreateIrMCL2FileL: No Changes in CDB, keep old PB.VCF" );
+ }
+ return KPBNotUpdated; //No error occured, KPBNotUpdated used as return value to tell that the file was not created..
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ParseCntDatabaseL()
+//------------------------------------------------------------
+void CCntParserCollector::ParseCntDatabaseL()
+ {
+ LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL" );
+
+ iCurrentItem = 0;
+ iCancel = EFalse;
+ iContactsSaved = 0;
+
+ //Create owncard (it's always included, even if it's empty)
+
+ TFileName defaultDb;
+ CContactDatabase::GetDefaultNameL( defaultDb );
+ TFileName currentDb;
+ iContactsDb->GetCurrentDatabase( currentDb );
+
+ if( defaultDb.CompareF(currentDb) == 0 || currentDb == KNullDesC16 /*|| currentDb.CompareF(KSimDummyDatabase)==0*/) //Is current database also default?
+ {
+ LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL: Using default database" );
+ TContactItemId ownCardId = iContactsDb->OwnCardId();
+ ExternalizeCurrentContactL( iContactsDb, ownCardId, ETrue);
+ }
+ else
+ {
+ LOGGER_WRITE( "CntParserCollector: ParseCntDatabaseL: Not using default database" );
+ CContactDatabase* db=CContactDatabase::OpenL(); //My contact card is only in default db, so open it
+ CleanupStack::PushL(db);
+
+ TContactItemId ownCardId = db->OwnCardId();
+ ExternalizeCurrentContactL( db, ownCardId, ETrue );
+
+ CleanupStack::PopAndDestroy( db );
+ }
+
+ //Start running RunL method and create everything else..
+ TRequestStatus* s = &iStatus;
+ User::RequestComplete( s, KErrNone );
+ SetActive();
+ }
+//------------------------------------------------------------
+// CCntParserCollector::CloseResources()
+//------------------------------------------------------------
+void CCntParserCollector::CloseResources()
+ {
+ LOGGER_WRITE( "CntParserCollector: CloseResources: Closing resources (iWriter)" );
+ iWriter.Close();
+ }
+//------------------------------------------------------------
+// CCntParserCollector::PrepareParserL()
+//------------------------------------------------------------
+void CCntParserCollector::PrepareParserL()
+ {
+ LOGGER_WRITE( "CntParserCollector: PrepareParserL" );
+ iFilter = CCntFilter::NewL(); //Filter all contact cards out of others
+
+ iFilter->SetContactFilterTypeALL( EFalse );
+ iFilter->SetContactFilterTypeCard( ETrue );
+ iContactsDb->FilterDatabaseL( *iFilter );
+
+ iIds=iFilter->iIds; //Get IDs to filtered contacts
+ iCount=iIds->Count(); //Get number of contacts to be collected
+
+ User::LeaveIfError( iFsSession.Connect() ); //Connect to the file server
+
+ LOGGER_WRITE_1( "CntParserCollector: PrepareParserL: iCount == %d", iCount);
+ }
+//------------------------------------------------------------
+// CCntParserCollector::RunL()
+//------------------------------------------------------------
+void CCntParserCollector::RunL()
+ {
+ //MaxNumberOfContacts-1 for OwnCard
+ if( iCurrentItem < iCount && (iCurrentItem < ( iMaxNumberOfContacts - 1 ) || iMaxNumberOfContacts == -1 ) ) //If no more contacts left or maximum number of contacts already parsed
+ {
+ ExternalizeCurrentContactL( iContactsDb, (*iIds)[iCurrentItem], EFalse );
+ iCurrentItem++;
+ TRequestStatus* s = &iStatus; //Let's rerun this RunL method as soon as possible
+ User::RequestComplete( s, KErrNone );
+ SetActive();
+ return;
+ }
+ iCurrentItem++; //for OwnCard that is created separately
+ LOGGER_WRITE( "CntParserCollector: RunL: No more items" );
+ CloseResources();
+ iServer->CompletePhoneBookRequests( KErrNone );
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty)
+//------------------------------------------------------------
+void CCntParserCollector::ExternalizeCurrentContactL(CContactDatabase* aContactsDb,TInt aCurrentItem,TBool ExternalizeEmpty)
+ {
+ CContactItem* ownCard;
+
+ if( aCurrentItem < 0 )
+ {
+ ownCard = CContactCard::NewLC();
+ }
+ else
+ {
+ ownCard = aContactsDb->ReadContactLC( aCurrentItem ); //Take a new contact item
+ }
+
+ CParserVCard* VCard=CParserVCard::NewL(); //Create new VCard
+ CleanupStack::PushL( VCard );
+
+ TInt nField = ownCard->CardFields().Find( KUidContactFieldGivenName );
+ TInt fField = ownCard->CardFields().Find( KUidContactFieldFamilyName );
+ TInt cField = ownCard->CardFields().Find( KUidContactFieldCompanyName );
+
+ //FOR NAMES
+ //N: -field always included even if it's empty
+ CDesC16Array* ValueArray=new (ELeave) CDesCArrayFlat(4);
+ CleanupStack::PushL( ValueArray );
+ CParserPropertyValueCDesCArray* NameValues=new (ELeave) CParserPropertyValueCDesCArray( ValueArray );
+ CleanupStack::PushL( NameValues );
+ CArrayPtr<CParserParam>* parameters=new (ELeave) CArrayPtrFlat<CParserParam>(1);
+ CleanupStack::PushL( parameters );
+
+ TPtrC fName;
+ TPtrC nName;
+ TPtrC cName;
+
+ if( fField != KErrNotFound )
+ {
+ fName.Set( ownCard->CardFields()[fField].TextStorage()->Text() );
+ }
+ if( nField != KErrNotFound )
+ {
+ nName.Set( ownCard->CardFields()[nField].TextStorage()->Text() );
+ }
+ if( cField != KErrNotFound )
+ {
+ cName.Set( ownCard->CardFields()[cField].TextStorage()->Text() );
+ }
+
+ if( fName.Length() == 0)
+ {
+ fField = KErrNotFound;
+ }
+ if(nName.Length()==0)
+ {
+ nField = KErrNotFound;
+ if( fField==KErrNotFound )
+ {
+ ValueArray->AppendL( cName );
+ }
+ else
+ {
+ ValueArray->AppendL( fName );
+ }
+ }
+ else
+ {
+ ValueArray->AppendL( fName );
+ ValueArray->AppendL( nName );
+ }
+
+ VCard->AddPropertyL( CParserProperty::NewL((*NameValues),KNameProperty,parameters) ); //Add name property to VCard (VCard takes the ownership of the property)
+ CleanupStack::Pop(3); //parameters namevalues valuearray
+
+ TBool isNumber = EFalse;
+
+ TInt typeIndex = 0;
+ TInt index = -1; //NOTE: +1 added before used first time
+
+ for(;;) //Go through all fields (Number of fields is unknown)
+ {
+ index = ownCard->CardFields().FindNext(typesToBeSearched[typeIndex],index+1);//Find next field (of current type)
+ if( index == KErrNotFound ) //No more phone numbers, move to the next group -> (See TypesToBeSearched)
+ {
+ typeIndex++;
+ if( typeIndex >= (signed) (sizeof(typesToBeSearched) / sizeof(TUid)) )
+ {
+ break; //if no more types to search -> exit FOR-loop
+ }
+
+ index=ownCard->CardFields().FindNext(typesToBeSearched[typeIndex],0); //Find next field
+ if( index==KErrNotFound )
+ {
+ break; //No fields -> exit
+ }
+ }
+
+ TPtrC number = ownCard->CardFields()[index].TextStorage()->Text();
+ if( number.Length() != 0)
+ {
+ CDesC16Array* ValueArray2=new (ELeave) CDesCArrayFlat(4);
+ CleanupStack::PushL( ValueArray2 );
+ CParserPropertyValueCDesCArray* NumberValues=new (ELeave) CParserPropertyValueCDesCArray(ValueArray2);
+ CleanupStack::PushL( NumberValues );
+ CArrayPtr<CParserParam>* parameters2=new (ELeave) CArrayPtrFlat<CParserParam>(1);
+ CleanupStack::PushL( parameters2 );
+
+ //Take label name to parameter
+
+ for( TInt i=0;i<ownCard->CardFields()[index].ContentType().FieldTypeCount();i++ )
+ {
+ TFieldType fieldType=ownCard->CardFields()[index].ContentType().FieldType(i);
+
+ if(fieldType==KUidContactFieldVCardMapWORK) parameters2->AppendL(CParserParam::NewL(KVersitParam8Work,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapHOME) parameters2->AppendL(CParserParam::NewL(KVersitParam8Home,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapMSG) parameters2->AppendL(CParserParam::NewL(KVersitParam8Msg,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapVOICE)parameters2->AppendL(CParserParam::NewL(KVersitParam8Voice,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapFAX) parameters2->AppendL(CParserParam::NewL(KVersitParam8Fax,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapPREF) parameters2->AppendL(CParserParam::NewL(KVersitParam8Pref,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapCELL) parameters2->AppendL(CParserParam::NewL(KVersitParam8Cell,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapPAGER)parameters2->AppendL(CParserParam::NewL(KVersitParam8Pager,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapBBS) parameters2->AppendL(CParserParam::NewL(KVersitParam8Bbs,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapMODEM)parameters2->AppendL(CParserParam::NewL(KVersitParam8Modem,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapCAR) parameters2->AppendL(CParserParam::NewL(KVersitParam8Car,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapISDN) parameters2->AppendL(CParserParam::NewL(KVersitParam8Isdn,KNullDesC8));
+ if(fieldType==KUidContactFieldVCardMapVIDEO)parameters2->AppendL(CParserParam::NewL(KVersitParam8Video,KNullDesC8));
+ }
+
+ ValueArray2->AppendL( number );
+ VCard->AddPropertyL(CParserProperty::NewL((*NumberValues),KTelProperty,parameters2)); //VCard takes the ownership of the property
+ isNumber=ETrue;
+
+ CleanupStack::Pop(3); //parameters2 numbervalues valuearray2
+ }
+ }
+
+ if( (nField!=KErrNotFound) || (fField!=KErrNotFound) || (cField!=KErrNotFound) || isNumber || ExternalizeEmpty )
+ {
+ if( !isNumber )
+ {
+ //Create empty TEL field (required by the specs)
+
+ CDesC16Array* ValueArray3=new (ELeave) CDesCArrayFlat(4);
+ CleanupStack::PushL(ValueArray3);
+ CParserPropertyValueCDesCArray* NumberValues2=new (ELeave) CParserPropertyValueCDesCArray(ValueArray3);
+ CleanupStack::PushL(NumberValues2);
+ CArrayPtr<CParserParam>* parameters3=new (ELeave) CArrayPtrFlat<CParserParam>(1);
+ CleanupStack::PushL(parameters3);
+
+ VCard->AddPropertyL(CParserProperty::NewL((*NumberValues2),KTelProperty,parameters3)); //VCard takes the ownership of the property
+
+ CleanupStack::Pop(3); //parameters3 numbervalues valuearray3
+ }
+
+ TRAPD( err, VCard->ExternalizeL( iWriter );) //If there are no name or numbers, then no externalizing..
+ //if error then only current contact card is discarded, but others will be still collected..
+ if( err == KErrNone )
+ {
+ iContactsSaved++;
+ }
+ else
+ {
+ LOGGER_WRITE( "CntParserCollector: RunL: Error,VCARD _NOT_ saved" );
+ }
+ }
+
+ aContactsDb->CloseContactL( aCurrentItem ); //Close current contact item
+
+ CleanupStack::PopAndDestroy( VCard ); // VCard and all arrays (parameters2, numvervalues, valuearray2) related to this VCard are deleted through the ownership relations
+ CleanupStack::PopAndDestroy( ownCard );
+ }
+//------------------------------------------------------------
+// CCntParserCollector::DoCancel()
+//------------------------------------------------------------
+void CCntParserCollector::DoCancel()
+ {
+ LOGGER_WRITE( "CntParserCollector: DoCancel" );
+ CloseResources();
+ }
+//------------------------------------------------------------
+// CCntParserCollector::RunError(TInt aError)
+//------------------------------------------------------------
+TInt CCntParserCollector::RunError( TInt aError )
+ {
+ LOGGER_WRITE( "CntParserCollector: RunError!" );
+ CloseResources(); //JIC
+
+ iServer->CompletePhoneBookRequests( aError ); //complete all requests with an error
+ return KErrNone;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::CurrentItem()
+//------------------------------------------------------------
+TInt CCntParserCollector::CurrentItem()
+ {
+ return iCurrentItem;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::Count()
+//------------------------------------------------------------
+TInt CCntParserCollector::Count()
+ {
+ return iCount;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ContactsSaved()
+//------------------------------------------------------------
+TInt CCntParserCollector::ContactsSaved()
+ {
+ return iContactsSaved;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::SaveTotalCountL() const
+//------------------------------------------------------------
+void CCntParserCollector::SaveTotalCountL()
+ {
+ LOGGER_WRITE( "CntParserCollector: SaveTotalCount begin" );
+
+ if( iContactsDb )
+ {
+ iTotalCount = iContactsDb->CountL();
+ LOGGER_WRITE_1( "CntParserCollector: SaveTotalCount iTotalCount %d", iTotalCount );
+ }
+
+ RFs Fs;
+ RFile writer;
+ User::LeaveIfError(Fs.Connect()); //Connect to the file server
+ CleanupClosePushL(Fs);
+
+ User::LeaveIfError(Fs.CreatePrivatePath( EDriveC ));
+ User::LeaveIfError(Fs.SetSessionToPrivate( EDriveC ));
+
+ User::LeaveIfError(writer.Replace(Fs,KTotalCountFilePath,EFileWrite)); //Open file
+ CleanupClosePushL(writer);
+ LOGGER_WRITE( "CntParserCollector: SaveTotalCount file replaced" );
+
+ // Prepare externalized representation of iTotalCount
+ TBuf8< 256 > countData;
+ RDesWriteStream writeStream( countData );
+ CleanupClosePushL( writeStream );
+ writeStream.WriteInt32L( iTotalCount );
+ writeStream.CommitL();
+ CleanupStack::PopAndDestroy( &writeStream );
+
+ // Then write them to the file itself
+ User::LeaveIfError(writer.Write( countData ));
+
+ CleanupStack::PopAndDestroy(); //writer
+ CleanupStack::PopAndDestroy(); //Fs
+
+ LOGGER_WRITE( "CntParserCollector: SaveTotalCount end" );
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ReadTotalCountL() const
+//------------------------------------------------------------
+TInt CCntParserCollector::ReadTotalCountL() const
+ {
+ LOGGER_WRITE( "CntParserCollector: ReadTotalCount begin" );
+ TInt total;
+ RFs Fs;
+ RFile reader;
+ User::LeaveIfError(Fs.Connect()); //Connect to the file server
+ CleanupClosePushL(Fs);
+
+ User::LeaveIfError(Fs.CreatePrivatePath( EDriveC ));
+ User::LeaveIfError(Fs.SetSessionToPrivate( EDriveC ));
+
+ User::LeaveIfError(reader.Open(Fs,KTotalCountFilePath,EFileRead)); //Open file
+ CleanupClosePushL(reader);
+ LOGGER_WRITE( "CntParserCollector: ReadTotalCount file opened" );
+
+ RFileReadStream readStream(reader);
+ readStream.PushL();
+
+ total = readStream.ReadInt32L();
+
+ LOGGER_WRITE_1( "CntParserCollector: ReadTotalCount total %d", total );
+
+ CleanupStack::PopAndDestroy(); //readStream
+ CleanupStack::PopAndDestroy(); //writer
+ CleanupStack::PopAndDestroy(); //Fs
+ LOGGER_WRITE( "CntParserCollector: ReadTotalCount end" );
+ return total;
+ }
+//------------------------------------------------------------
+// CCntParserCollector::ContactCountChanged() const
+//------------------------------------------------------------
+TBool CCntParserCollector::ContactCountChanged()
+ {
+ LOGGER_WRITE( "CntParserCollector: ContactCountChanged begin" );
+ TInt oldCount = 0;
+ TInt err( KErrNone );
+
+ if( iContactsDb )
+ {
+ TRAP( err, iTotalCount = iContactsDb->CountL() );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "iContactsDb->CountL leaved: %d", err );
+ LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" );
+ return ETrue;
+ }
+ LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged iTotalCount %d", iTotalCount );
+ }
+
+ TRAP( err, oldCount = ReadTotalCountL() );
+
+ LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged err %d", err );
+ LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged oldCount %d", oldCount );
+ LOGGER_WRITE_1( "CntParserCollector: ContactCountChanged iTotalCount %d", iTotalCount );
+
+ if( err == KErrNone )
+ {
+ if( iTotalCount != oldCount )
+ {
+ LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" );
+ return ETrue;
+ }
+ else
+ {
+ LOGGER_WRITE( "CntParserCollector: ContactCountChanged EFalse" );
+ return EFalse;
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CntParserCollector: ContactCountChanged ETrue" );
+ return ETrue;
+ }
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/src/cntparserinfolog.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserInfoLog implementation.
+*
+*/
+
+
+#include <s32strm.h>
+#include <f32file.h>
+#include <s32file.h>
+
+#include "cntparserinfolog.h"
+
+_LIT8(KNewLine,"\r\n");
+
+_LIT8(KMaxRecords,"Maximum-Records:");
+_LIT8(KTotalRecords,"Total-Records:");
+
+//------------------------------------------------------------
+// CCntParserInfoLog::CCntParserInfoLog()
+//------------------------------------------------------------
+CCntParserInfoLog::CCntParserInfoLog()
+ {
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::~CCntParserInfoLog()
+//------------------------------------------------------------
+CCntParserInfoLog::~CCntParserInfoLog()
+ {
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::CCntParserInfoLog::NewL()
+//------------------------------------------------------------
+EXPORT_C CCntParserInfoLog* CCntParserInfoLog::NewL()
+ {
+ CCntParserInfoLog* self=new (ELeave) CCntParserInfoLog();
+ return self;
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::SaveToFileL(const TDesC& aFileName) const
+//------------------------------------------------------------
+EXPORT_C void CCntParserInfoLog::SaveToFileL( const TDesC& aFileName ) const
+ {
+ TInt err = KErrNone;
+ RFs Fs;
+ RFile writer;
+ User::LeaveIfError( Fs.Connect() ); //Connect to the file server
+ CleanupClosePushL( Fs );
+ err = writer.Replace( Fs, aFileName, EFileWrite ); //Open file
+ CleanupClosePushL( writer );
+
+ if( err == KErrNone )
+ {
+ writer.Write( KMaxRecords );
+
+ TBuf8<16> numVal;
+ numVal.Num( iMaximumRecords );
+ writer.Write( numVal );
+
+ writer.Write( KNewLine );
+
+ writer.Write( KTotalRecords );
+
+ TBuf8<16> numVal2;
+ numVal2.Num( iTotalRecords );
+ writer.Write( numVal2 );
+ }
+
+ CleanupStack::PopAndDestroy(); //writer
+ CleanupStack::PopAndDestroy(); //Fs
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords)
+//------------------------------------------------------------
+EXPORT_C void CCntParserInfoLog::SetTotalRecords(TInt aTotalRecords)
+ {
+ iTotalRecords = aTotalRecords;
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords)
+//------------------------------------------------------------
+EXPORT_C void CCntParserInfoLog::SetMaximumRecords(TInt aMaximumRecords)
+ {
+ iMaximumRecords = aMaximumRecords;
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::TotalRecords() const
+//------------------------------------------------------------
+EXPORT_C TInt CCntParserInfoLog::TotalRecords() const
+ {
+ return iTotalRecords;
+ }
+
+//------------------------------------------------------------
+// CCntParserInfoLog::MaximumRecords() const
+//------------------------------------------------------------
+EXPORT_C TInt CCntParserInfoLog::MaximumRecords() const
+ {
+ return iMaximumRecords;
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/src/cntparserserverexe.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,322 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserServer implementation.
+*
+*/
+
+
+#include "clientserver.h"
+#include "cntparserserver.h"
+#include "cntparserserversession.h"
+#include "irmcconsts.h"
+
+#include "debug.h"
+
+#include <cntdb.h>
+
+//------------------------------------------------------------
+// RunServer
+//------------------------------------------------------------
+TInt CCntParserServer::RunServer()
+ {
+ LOGGER_ENTERFN( "CCntParserServer::RunServer" );
+
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ TInt ret( KErrNoMemory );
+ if( cleanup )
+ {
+ TRAP( ret, CCntParserServer::RunServerL() );
+ delete cleanup;
+ }
+ if( ret != KErrNone )
+ {
+ // Signal the client that server creation failed
+ RProcess::Rendezvous( ret );
+ }
+ LOGGER_LEAVEFN( "CCntParserServer::RunServer" );
+ return ret;
+ }
+//------------------------------------------------------------
+// RunServerL
+//------------------------------------------------------------
+void CCntParserServer::RunServerL()
+ {
+ // Create and install the active scheduler we need
+ LOGGER_ENTERFN( "CCntParserServer::RunServerL" );
+ CActiveScheduler *as=new (ELeave)CActiveScheduler;
+ CleanupStack::PushL( as );
+ CActiveScheduler::Install( as );
+
+ // Create server
+ CCntParserServer::NewL();
+
+ // Initialisation complete, now signal the client
+ User::LeaveIfError( RThread().RenameMe( KTxtServer ) );
+ RProcess::Rendezvous( KErrNone );
+
+ // Ready to run
+ CActiveScheduler::Start();
+
+ // Cleanup the scheduler
+ CleanupStack::PopAndDestroy( as );
+ LOGGER_LEAVEFN( "CCntParserServer::RunServerL" );
+ }
+//------------------------------------------------------------
+// E32Main()
+//------------------------------------------------------------
+TInt E32Main()
+ {
+ return CCntParserServer::RunServer();
+ }
+//------------------------------------------------------------
+// PanicServer(TCntParserServerPanic aPanic)
+//------------------------------------------------------------
+GLDEF_C void PanicServer(TCntParserServerPanic aPanic)
+ {
+ LOGGER_WRITE( "PANIC SERVER!" );
+ _LIT(KTxtServerPanic,"Parser server panic");
+ User::Panic( KTxtServerPanic, aPanic );
+ }
+
+
+//**********************************
+//CCntParserServer
+//**********************************
+
+//------------------------------------------------------------
+// CCntParserServer::CCntParserServer()
+//------------------------------------------------------------
+CCntParserServer::CCntParserServer() : CServer2( EPriorityStandard )
+ {
+ }
+//------------------------------------------------------------
+// CCntParserServer::~CCntParserServer()
+//------------------------------------------------------------
+EXPORT_C CCntParserServer::~CCntParserServer()
+ {
+ if( iCollector )
+ {
+ iCollector->Cancel();
+ }
+ delete iCollector;
+ delete iCurrentDatabase;
+ LOGGER_WRITE( "CntParserServer: DELETED!" );
+ }
+//------------------------------------------------------------
+// CCntParserServer* CCntParserServer::NewL()
+//------------------------------------------------------------
+EXPORT_C CCntParserServer* CCntParserServer::NewL()
+ {
+ LOGGER_WRITE( "CntParserServer: NEW" );
+ CCntParserServer* pS=new (ELeave) CCntParserServer();
+ CleanupStack::PushL(pS);
+ pS->StartL( KCntParserName );
+ CleanupStack::Pop( pS );
+ LOGGER_WRITE( "CntParserServer: Created" );
+ return pS;
+ }
+//------------------------------------------------------------
+// CCntParserServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMsg*/) const
+//------------------------------------------------------------
+CSession2* CCntParserServer::NewSessionL(const TVersion &aVersion, const RMessage2& /*aMsg*/) const
+ {
+ LOGGER_WRITE( "CntParserServer: NEW SessionL" );
+ // check we're the right version
+ TVersion v( KCntParserMajorVersionNumber,KCntParserMinorVersionNumber,KCntParserBuildVersionNumber );
+ if ( !User::QueryVersionSupported( v,aVersion ) )
+ User::Leave( KErrNotSupported );
+ CCntParserServerSession* self=CCntParserServerSession::NewL( (CCntParserServer*)this );
+ return self;
+ }
+//------------------------------------------------------------
+// CCntParserServer::IncreaseSessionCountL()
+//------------------------------------------------------------
+void CCntParserServer::IncreaseSessionCountL()
+ {
+ LOGGER_WRITE( "CntParserServer: Increase Session Count" );
+ iSessionCount++;
+ if( iSessionCount == 1 ) //If first session, prepare collector
+ {
+ PrepareCollectorL();
+ }
+ }
+//------------------------------------------------------------
+// CCntParserServer::DecreaseSessionCount()
+//------------------------------------------------------------
+void CCntParserServer::DecreaseSessionCount()
+ {
+ LOGGER_WRITE( "CntParserServer: Decrease Session Count" );
+ iSessionCount--;
+ if( iSessionCount==0 ) //if last session is disconnected, delete server
+ {
+ Stop();
+ }
+ }
+//------------------------------------------------------------
+// CCntParserServer::ContactsParsed()
+//------------------------------------------------------------
+TInt CCntParserServer::ContactsParsed()
+ {
+ return iCollector->CurrentItem();
+ }
+//------------------------------------------------------------
+// CCntParserServer::TotalNumOfContacts()
+//------------------------------------------------------------
+TInt CCntParserServer::TotalNumOfContacts()
+ {
+ //After the PrepareCollector is called, the number of contacts can be returned
+ return iCollector->Count();
+ }
+//------------------------------------------------------------
+// CCntParserServer::ContactsSaved()
+//------------------------------------------------------------
+TInt CCntParserServer::ContactsSaved()
+ {
+ return iCollector->ContactsSaved();
+ }
+//------------------------------------------------------------
+// CCntParserServer::PrepareCollectorL()
+//------------------------------------------------------------
+void CCntParserServer::PrepareCollectorL()
+ {
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: Open Contact Database" );
+
+ TFileName dbFile;
+ TFileName defaultDb;
+
+ CContactDatabase::GetDefaultNameL( defaultDb );
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: GetDefault" );
+
+ iCurrentDatabase=CContactDatabase::OpenL();
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: OpenDefault" );
+
+ iCurrentDatabase->GetCurrentDatabase( dbFile ); //Get selected database
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: CompareDefault" );
+
+ if( dbFile.CompareF(defaultDb)!=0 && dbFile!=KNullDesC16 /*&& dbFile.CompareF(KSimDummyDatabase)!=0*/) //If the selected database is not the default and something is selected
+ {
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: Close Default" );
+ delete iCurrentDatabase;
+ iCurrentDatabase = NULL;
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: OpenSelected" );
+ iCurrentDatabase=CContactDatabase::OpenL( dbFile ); //open the selected one
+ }
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: Is everything ok?" );
+ if( !iCurrentDatabase )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ LOGGER_WRITE( "CntParserServer: Prepare collectorL: Create Collector" );
+ iCollector = CCntParserCollector::NewL( this,iCurrentDatabase );
+
+ iRequests = 0;
+ }
+//------------------------------------------------------------
+// CCntParserServer::CreateIrMCL2PhoneBookL()
+//------------------------------------------------------------
+TInt CCntParserServer::CreateIrMCL2PhoneBookL(const TDesC& path, TInt aMaxNumberOfContacts,TBool aForced)
+ {
+ LOGGER_WRITE( "CntParserServer: CreateIrMCL2PhoneBookL" );
+
+ TInt err( KErrNone );
+
+ iRequests++;
+ if( iRequests == 1 )
+ {
+ LOGGER_WRITE( "CntParserServer: CreateIrMCL2PhoneBookL: Ready to call collector" );
+
+ err = iCollector->CreateIrMCL2FileL( path,aMaxNumberOfContacts,aForced );
+ if( err==KPBNotUpdated )
+ {
+ iRequests = 0; //If the file exists (no parsing), then more requests can be made
+ }
+ }
+ else
+ {
+ return KErrNotReady;
+ }
+ return err;
+ }
+//------------------------------------------------------------
+// CCntParserServer::CompletePhoneBookRequests()
+//------------------------------------------------------------
+void CCntParserServer::CompletePhoneBookRequests(TInt aErr) //Goes through all the sessions and completes the request
+ {
+ LOGGER_WRITE( "CntParserServer: Complete phonebook request" );
+ iSessionIter.SetToFirst();
+ while( iSessionIter!=NULL ) //Go through all sessions
+ {
+ ( (CCntParserServerSession*) (iSessionIter++) )->CompletePhoneBookRequest( aErr );
+ }
+ iRequests = 0; //Collector is ready to start again..
+ }
+//------------------------------------------------------------
+// CCntParserServer::CancelPhoneBookRequest()
+//------------------------------------------------------------
+void CCntParserServer::CancelPhoneBookRequest()
+ {
+ if( iRequests == 1 )
+ {
+ iCollector->Cancel();
+ }
+ iRequests--;
+ }
+//------------------------------------------------------------
+// CCntParserServer::CancelAllPhoneBookRequests()
+//------------------------------------------------------------
+void CCntParserServer::CancelAllPhoneBookRequests()
+ {
+ iCollector->Cancel();
+ iRequests = 0;
+ }
+//------------------------------------------------------------
+// CCntParserServer::Disconnect()
+//------------------------------------------------------------
+void CCntParserServer::Disconnect()
+ {
+ LOGGER_WRITE( "CntParserServer: Disconnect" );
+ }
+//------------------------------------------------------------
+// CCntParserServer::Stop()
+//------------------------------------------------------------
+void CCntParserServer::Stop()
+ {
+ LOGGER_ENTERFN( "CntParserServer::Stop()" );
+ if( iCollector )
+ {
+ iCollector->Cancel();
+ }
+ delete iCollector;
+ iCollector = NULL;
+ delete iCurrentDatabase;
+ iCurrentDatabase = NULL;
+ CActiveScheduler::Stop();
+ LOGGER_LEAVEFN( "CntParserServer::Stop()" );
+ }
+//------------------------------------------------------------
+// CCntParserServer::SetRequests()
+//------------------------------------------------------------
+void CCntParserServer::SetRequests(TInt aRequests)
+ {
+ iRequests=aRequests;
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/cntparser/src/cntparserserversession.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCntParserServerSession implementation.
+*
+*/
+
+
+#include "cntparserserversession.h"
+#include <cntdb.h>
+#include "cntparsercollector.h"
+#include "cntparserinfolog.h"
+#include "irmcconsts.h"
+
+#include "debug.h"
+
+//------------------------------------------------------------
+// CCntParserServerSession::CCntParserServerSession()
+//------------------------------------------------------------
+CCntParserServerSession::CCntParserServerSession()
+ {
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::NewL(CCntParserServer* aServer)
+//------------------------------------------------------------
+CCntParserServerSession* CCntParserServerSession::NewL( CCntParserServer* aServer )
+ {
+ LOGGER_ENTERFN( "CntParserServerSession::NewL()" );
+
+ CCntParserServerSession* self = new( ELeave ) CCntParserServerSession();
+ CleanupStack::PushL( self );
+ self->ConstructL( aServer );
+ CleanupStack::Pop( self );
+ LOGGER_LEAVEFN( "CntParserServerSession::NewL()" );
+ return self;
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::ConstructL( CCntParserServer* aServer )
+//------------------------------------------------------------
+void CCntParserServerSession::ConstructL( CCntParserServer* aServer )
+ {
+ iContactsParserSrv = aServer;
+ iContactsParserSrv->IncreaseSessionCountL();
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::~CCntParserServerSession()
+//------------------------------------------------------------
+CCntParserServerSession::~CCntParserServerSession()
+ {
+ LOGGER_ENTERFN( "CntParserServerSession::~CCntParserServerSession()" );
+ if ( iContactsParserSrv )
+ {
+ iContactsParserSrv->DecreaseSessionCount();
+ }
+ LOGGER_LEAVEFN( "CntParserServerSession::~CCntParserServerSession()" );
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::ServiceL( const RMessage2& aMessage )
+//------------------------------------------------------------
+void CCntParserServerSession::ServiceL( const RMessage2& aMessage )
+ {
+ LOGGER_WRITE( "CntParserServerSession: ServiceL" );
+
+ TInt err( KErrNone );
+ TInt ret( KErrNone );
+
+ TRAP( err, ret = DispatchMessageL( aMessage ) );
+
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CntParserServerSession: ServiceL: Error trapped, complete with ERR code %d", err );
+
+ iPhoneBookRequest = EFalse; //If requested, then clear request flag
+ iContactsParserSrv->SetRequests( 0 ); //Reset requests count in server to allow new requests to start..
+ aMessage.Complete( err ); //If trap error, complete with it
+ return;
+ }
+
+ if ( ret == KErrNone )
+ {
+ LOGGER_WRITE( "CntParserServerSession: ServiceL: No complete" );
+ return;
+ }
+
+ if ( ret == KPerformComplete )
+ {
+ LOGGER_WRITE( "CntParserServerSession: ServiceL: Normal complete" );
+
+ aMessage.Complete( KErrNone );
+ return;
+ }
+
+ if ( ret == KPBNotUpdated )
+ {
+ LOGGER_WRITE( "CntParserServerSession: ServiceL: Complete (PB not updated)" );
+
+ iPhoneBookRequest = EFalse;
+ aMessage.Complete( KPBNotUpdated );
+ return;
+ }
+ LOGGER_WRITE( "CntParserServerSession: ServiceL: Error, should never come here" );
+ aMessage.Complete( KErrGeneral );
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::CompletePhoneBookRequest( TInt aErr )
+//------------------------------------------------------------
+void CCntParserServerSession::CompletePhoneBookRequest( TInt aErr )
+ {
+ LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest" );
+
+ if ( iPhoneBookRequest ) //If this session has requested phonebook, then the completion should be done here, as it was not done in ServiceL
+ {
+ LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest: collector or cancel" );
+ iPhoneBookRequest = EFalse;
+ iPhoneBookRequestMessage.Complete( aErr );
+ }
+ else
+ {
+ LOGGER_WRITE( "CntParserServerSession: CompletePhoneBookRequest: No complete for this session" );
+ }
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::DispatchMessageL( const RMessage2 &aMessage )
+//------------------------------------------------------------
+TInt CCntParserServerSession::DispatchMessageL( const RMessage2 &aMessage )
+ {
+ LOGGER_WRITE( "CntParserServerSession: DispatchMessageL" );
+
+ TInt res( KPerformComplete );
+
+ switch( aMessage.Function() )
+ {
+ case ECntParserServerCreateIrMCL2: //Create pb.vcf file
+ {
+ res = ETrue;
+
+ if ( iPhoneBookRequest == EFalse )
+ {
+ iPhoneBookRequestMessage = aMessage;
+ iPhoneBookRequest = ETrue;
+
+ TInt sid=aMessage.SecureId();
+ TInt MaxNumOfContacts = aMessage.Int0();
+ TBool Forced = aMessage.Int1();
+ TBuf<8> sidLit;
+ sidLit.AppendNumFixedWidth( sid, EHex, 8);
+ TBuf<255> path;
+ path.Insert( 0, KPhoneBookFilename );
+
+ res = iContactsParserSrv->CreateIrMCL2PhoneBookL( path, (TInt) MaxNumOfContacts, Forced );
+ }
+ break;
+ }
+ case ECntParserServerCntParsed: //How many contacts already parsed
+ {
+ TPckgBuf<TInt> p((TInt) iContactsParserSrv->ContactsParsed());
+ aMessage.WriteL( 0, p, 0 );
+ break;
+ }
+ case ECntParserServerTotalNumOfContacts: //How many contacts total?
+ {
+ TPckgBuf<TInt> p((TInt) iContactsParserSrv->TotalNumOfContacts());
+ aMessage.WriteL( 0, p, 0 );
+ break;
+ }
+ case ECntParserServerDisconnect: //Disconnect session from server
+ {
+ iContactsParserSrv->Disconnect();
+ break;
+ }
+ case ECntParserServerCancel: //Cancel phone book request
+ {
+ if (iPhoneBookRequest)
+ {
+ iContactsParserSrv->CancelPhoneBookRequest();
+ CompletePhoneBookRequest( KErrCancel );
+ }
+ break;
+ }
+ case ECntParserServerCntSaved: //How many contacts total?
+ {
+ TPckgBuf<TInt> p((TInt) iContactsParserSrv->ContactsSaved());
+ aMessage.WriteL( 0, p, 0 );
+ break;
+ }
+ case ECntParserServerCancelAll: //Cancel all requests, not just current?
+ {
+ iContactsParserSrv->CancelAllPhoneBookRequests();
+ break;
+ }
+ // requests we don't understand
+ // so panic the client here, this function also completes the message
+ default:
+ {
+ PanicClient( EBadRequest );
+ break;
+ }
+ }
+ return res;
+ }
+//------------------------------------------------------------
+// CCntParserServerSession::PanicClient(TInt aPanic) const
+//------------------------------------------------------------
+void CCntParserServerSession::PanicClient(TInt aPanic) const
+ {
+ User::Panic( KTxtServer,aPanic );
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/common/conmltask/inc/sconconmltask.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,598 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file for ConML tasks
+*
+*/
+
+
+#ifndef _SCONCONMLTASK_H_
+#define _SCONCONMLTASK_H_
+
+#include <e32base.h>
+#include <f32file.h>
+
+const TInt KSConTaskPartiallyCompleted( 206 );
+const TInt KMaxPackageNameLength = 128;
+
+enum TSConMethodName
+ {
+ ECancel = 0,
+ EGetDataOwnerStatus,
+ EGetDataSize,
+ EGetStatus,
+ EInstall,
+ EListDataOwners,
+ EListInstalledApps,
+ EListPublicFiles,
+ ERequestData,
+ ESetBURMode,
+ ESetInstParams,
+ ESupplyData,
+ EUninstall,
+ EUpdateDeviceInfo,
+ EReboot,
+ EGetMetadata
+ };
+
+enum TSConInstallMode
+ {
+ ESilentInstall = 0,
+ EUnsilentInstall,
+ EUnknown
+ };
+
+enum TSConUserPerm
+ {
+ EPermReadOnly = 0,
+ EPermNormal
+ };
+
+enum TSConDOType
+ {
+ EActiveDataOwner = 1,
+ EPassiveDataOwner,
+ EHybridDataOwner
+ };
+
+enum TSConHasFiles
+ {
+ ENoFiles = 0,
+ EPublicFiles,
+ ESystemFiles,
+ EPublicSystemFiles
+ };
+
+enum TSConAppType
+ {
+ ESisApplication = 0,
+ ESisAugmentation,
+ EJavaApplication,
+ EWidgetApplication
+ };
+
+enum TSConBurMode
+ {
+ ESConBurNormal = 1, // 1 BUR mode - normal
+ ESConBurBackupFull, // 2 BUR mode – backup full
+ ESConBurBackupPartial, // 3 BUR mode – backup partial
+ ESConBurRestoreFull, // 4 BUR mode – restore full
+ ESConBurRestorePartial // 5 BUR mode – restore partial
+ };
+
+enum TSConIncType
+ {
+ ESConNoBackup = 0, // 0 No backup
+ ESConBackupBase = 100, // 100 Backup – base
+ ESConBackupIncrement = 200 // 200 Backup - increment
+ };
+
+enum TSConTransferDataType
+ {
+ ESConRegistrationData = 1, // 1 RegistrationData
+ ESConPassiveSnapshotData, // 2 Passive snapshot data
+ ESConPassiveBaseData, // 3 Passive base data
+ ESConPassiveIncrementalData,// 4 Passive incremental data
+ ESConActiveSnapshotData, // 5 Active snapshot data
+ ESConActiveBaseData, // 6 Active base data
+ ESConActiveIncrementalData, // 7 Active incremental data
+ ESConSystemData, // 8 System data
+ ESConSystemSnapshotData // 9 System snapshot data
+ };
+
+enum TSConDataOwnerStatus
+ {
+ ESConUnset = 0, // 0 Unset
+ ESConNotFound, // 1 Not found
+ ESConReady, // 2 Ready
+ ESConNotReady, // 3 Not ready
+ ESConFailed, // 4 Failed
+ ESConNotConnected, // 5 Not connected
+ ESConNotImplemented // 6 Not implemented
+ };
+
+
+
+
+//============================================================
+// class CSConReboot declaration
+//============================================================
+NONSHARABLE_CLASS( CSConReboot ) : public CBase
+ {
+ public:
+ CSConReboot();
+ ~CSConReboot();
+ CSConReboot* CopyL();
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConDataOwner declaration
+//============================================================
+NONSHARABLE_CLASS( CSConDataOwner ) : public CBase
+ {
+ public:
+ CSConDataOwner();
+ ~CSConDataOwner();
+ CSConDataOwner* CopyL();
+
+ public:
+ //dataowner type
+ TSConDOType iType;
+ //unique identifier
+ TUid iUid;
+ //drive list
+ TDriveList iDriveList;
+ //package name
+ TBuf<KMaxPackageNameLength> iPackageName;
+ //requires reboot
+ TBool iReqReboot;
+ //has files
+ TSConHasFiles iHasFiles;
+ //supports incremental backup
+ TBool iSupportsInc;
+ //supports selective backup
+ TBool iSupportsSel;
+ //delay to prepare data
+ TBool iDelayToPrep;
+ //size
+ TUint iSize;
+ //data owner status
+ TSConDataOwnerStatus iDataOwnStatus;
+ //transfer data type
+ TSConTransferDataType iTransDataType;
+ //Java hash
+ HBufC* iJavaHash;
+ };
+
+//============================================================
+// class CSConUpdateDeviceInfo declaration
+//============================================================
+NONSHARABLE_CLASS( CSConUpdateDeviceInfo ) : public CBase
+ {
+ public:
+ CSConUpdateDeviceInfo();
+ ~CSConUpdateDeviceInfo();
+ CSConUpdateDeviceInfo* CopyL();
+
+ TBuf8<3> iVersion; //version number
+ TBool iInstallSupp;
+ TBool iUninstallSupp;
+ TBool iInstParamsSupp;
+ TBool iInstAppsSupp;
+ TBool iDataOwnersSupp;
+ TBool iSetBURModeSupp;
+ TBool iGetSizeSupp;
+ TBool iReqDataSupp;
+ TBool iSupplyDataSupp;
+ TBool iRebootSupp;
+ TInt iMaxObjectSize; //kBytes
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+//============================================================
+// class CSConInstApp declaration
+//============================================================
+NONSHARABLE_CLASS( CSConInstApp ) : public CBase
+ {
+ public:
+ CSConInstApp() {};
+ ~CSConInstApp();
+ CSConInstApp* CopyL();
+
+ TFileName iName;
+ TFileName iParentName;
+ TFileName iVendor;
+ TFileName iVersion;
+ TInt64 iSize;
+ TSConAppType iType;
+ TUid iUid;
+ HBufC* iWidgetBundleId; // Widget bundle identifier like "com.nokia.widget.HelloWorld"
+ };
+
+//============================================================
+// class CSConListInstApps declaration
+//============================================================
+NONSHARABLE_CLASS( CSConListInstApps ) : public CBase
+ {
+ public:
+ CSConListInstApps();
+ ~CSConListInstApps();
+ CSConListInstApps* CopyL();
+
+ TBool iAllApps; //list all apps
+ TDriveList iDriveList; //drive list
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+
+ RPointerArray<CSConInstApp> iApps; //installed apps
+ };
+
+//============================================================
+// class CSConGetStatus declaration
+//============================================================
+NONSHARABLE_CLASS( CSConGetStatus ) : public CBase
+ {
+ public:
+ TBool iAll; //list all statuses
+ TInt iTaskId; //task id
+ };
+
+//============================================================
+// class CSConFile declaration
+//============================================================
+NONSHARABLE_CLASS( CSConFile ) : public CBase
+ {
+ public:
+ CSConFile();
+ ~CSConFile();
+ CSConFile* CopyL();
+
+ TFileName iPath; //file path + name
+ TBuf<KMaxTimeFormatSpec> iModified; //modified date
+ TUint iSize; //file size
+ TSConUserPerm iUserPerm; //user permission
+ };
+
+//============================================================
+// class CSConInstall declaration
+//============================================================
+NONSHARABLE_CLASS( CSConInstall ) : public CBase
+ {
+ public:
+ CSConInstall();
+ ~CSConInstall();
+
+ CSConInstall* CopyL();
+
+ TFileName iPath; //path to file
+ TSConInstallMode iMode; //install mode
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConUninstall declaration
+//============================================================
+NONSHARABLE_CLASS( CSConUninstall ) : public CBase
+ {
+ public:
+ CSConUninstall();
+ ~CSConUninstall();
+
+ CSConUninstall* CopyL();
+
+ TFileName iName; // application name
+ TFileName iVendor; // application vendor
+ TUid iUid; // application uid
+ TSConAppType iType; // application type
+ TSConInstallMode iMode; // install mode
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConListDataOwners declaration
+//============================================================
+NONSHARABLE_CLASS( CSConListDataOwners ) : public CBase
+ {
+ public:
+ CSConListDataOwners();
+ ~CSConListDataOwners();
+ CSConListDataOwners* CopyL();
+ void DeleteDataOwners();
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+
+ RPointerArray<CSConDataOwner> iDataOwners; //data owners
+ };
+
+//============================================================
+// class CSConSetBURMode declaration
+//============================================================
+NONSHARABLE_CLASS( CSConSetBURMode ) : public CBase
+ {
+ public:
+ TDriveList iDriveList; //drive list
+ TSConBurMode iPartialType; //partial backup type
+ TSConIncType iIncType; //incremental backup type
+
+ CSConSetBURMode();
+ ~CSConSetBURMode();
+ CSConSetBURMode* CopyL();
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConGetDataSize declaration
+//============================================================
+NONSHARABLE_CLASS( CSConGetDataSize ) : public CBase
+ {
+ public:
+ CSConGetDataSize();
+ ~CSConGetDataSize();
+
+ CSConGetDataSize* CopyL();
+ void DeleteDataOwners();
+
+ public:
+ RPointerArray<CSConDataOwner> iDataOwners; //data owners
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConListPublicFiles declaration
+//============================================================
+NONSHARABLE_CLASS( CSConListPublicFiles ) : public CBase
+ {
+ public:
+ CSConListPublicFiles();
+ ~CSConListPublicFiles();
+ CSConListPublicFiles* CopyL();
+
+ public:
+ RPointerArray<CSConFile> iFiles; //data owners
+ RPointerArray<CSConDataOwner> iDataOwners; //data owners
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConRequestData declaration
+//============================================================
+NONSHARABLE_CLASS( CSConRequestData ) : public CBase
+ {
+ public:
+ CSConRequestData();
+ ~CSConRequestData();
+ CSConRequestData* CopyL();
+ void DeleteDataAndDataOwner();
+
+ CSConDataOwner* iDataOwner; //data owner
+ HBufC8* iBackupData; //backup data
+ TBool iMoreData; //more data
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConGetDataOwnerStatus declaration
+//============================================================
+NONSHARABLE_CLASS( CSConGetDataOwnerStatus ) : public CBase
+ {
+ public:
+ CSConGetDataOwnerStatus();
+ ~CSConGetDataOwnerStatus();
+ CSConGetDataOwnerStatus* CopyL();
+ void DeleteDataOwners();
+
+ public:
+ RPointerArray<CSConDataOwner> iDataOwners; //data owners
+
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConSupplyData declaration
+//============================================================
+NONSHARABLE_CLASS( CSConSupplyData ) : public CBase
+ {
+ public:
+ CSConSupplyData();
+ ~CSConSupplyData();
+ CSConSupplyData* CopyL();
+ public:
+ CSConDataOwner* iDataOwner;
+ HBufC8* iRestoreData; //restore data
+ TBool iMoreData; //more data
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConGetMetadata declaration
+//============================================================
+NONSHARABLE_CLASS( CSConGetMetadata ) : public CBase
+ {
+ public:
+ CSConGetMetadata();
+ ~CSConGetMetadata();
+ CSConGetMetadata* CopyL();
+ public:
+ TFileName iFilename;
+ HBufC8* iData; //metadata
+ TBool iMoreData; //more data
+ //used only with reply
+ TBool iComplete; //task complete
+ TInt iProgress; //task progress
+ };
+
+//============================================================
+// class CSConTask declaration
+//============================================================
+NONSHARABLE_CLASS( CSConTask ): public CBase
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @return CSConTask instance
+ */
+ static CSConTask* NewL( TSConMethodName aMethod );
+ static CSConTask* NewLC( TSConMethodName aMethod );
+
+ CSConTask();
+ ~CSConTask();
+ TSConMethodName GetServiceId() const;
+ CSConTask* CopyL() const;
+ TBool GetComplete();
+ void SetCompleteValue( TBool aValue );
+ TBool GetCompleteValue();
+ void SetProgressValue( TInt aValue );
+ private:
+
+ void ConstructL( TSConMethodName aMethod );
+ public:
+ //Task
+ //service id
+ TSConMethodName iMethod;
+ //task number
+ TInt iTaskId;
+
+ //DeviceInfo -params
+ CSConUpdateDeviceInfo* iDevInfoParams;
+ //ListInstalledTasks -params
+ CSConListInstApps* iListAppsParams;
+ //GetStatus -params
+ CSConGetStatus* iGetStatusParams;
+ //Install -params
+ CSConInstall* iInstallParams;
+ //Uninstall -params
+ CSConUninstall* iUninstallParams;
+ //SetBURMode -params
+ CSConSetBURMode* iBURModeParams;
+ //GetDataSize -params
+ CSConGetDataSize* iGetDataSizeParams;
+ //RequestData -params
+ CSConRequestData* iRequestDataParams;
+ //GetDataOwnerStatus -params
+ CSConGetDataOwnerStatus* iGetDataOwnerParams;
+ //SupplyData -params
+ CSConSupplyData* iSupplyDataParams;
+ //ListPublicFiles -params
+ CSConListPublicFiles* iPubFilesParams;
+ //ListDataOwners -params
+ CSConListDataOwners* iListDataOwnersParams;
+ //Reboot -params
+ CSConReboot* iRebootParams;
+ //GetMetadata -params
+ CSConGetMetadata* iGetMetadataParams;
+
+ TInt iCancelTaskId;
+ TBool iCancelTaskAll;
+ };
+
+//============================================================
+// class CSConTaskReply declaration
+//============================================================
+NONSHARABLE_CLASS( CSConTaskReply ) : public CBase
+ {
+ public:
+ CSConTaskReply();
+ CSConTaskReply( TSConMethodName aMethod );
+ ~CSConTaskReply();
+ void InitializeL( const CSConTask& aTask );
+ void InitializeL( TSConMethodName aMethod,
+ TInt aProgress, TBool aComplete );
+ CSConTaskReply* CopyAndFreeL();
+ void CleanTaskData();
+
+ public:
+ //task id number
+ TInt iTaskId;
+ //method type
+ TSConMethodName iMethod;
+
+ //DeviceInfo -params
+ CSConUpdateDeviceInfo* iDevInfoParams;
+ //ListInstalledTasks -params
+ CSConListInstApps* iListAppsParams;
+ //GetStatus -params
+ CSConGetStatus* iGetStatusParams;
+ //Install -params
+ CSConInstall* iInstallParams;
+ //Uninstall -params
+ CSConUninstall* iUninstallParams;
+ //SetBURMode -params
+ CSConSetBURMode* iBURModeParams;
+ //GetDataSize -params
+ CSConGetDataSize* iGetDataSizeParams;
+ //RequestData -params
+ CSConRequestData* iRequestDataParams;
+ //GetDataOwnerStatus -params
+ CSConGetDataOwnerStatus* iGetDataOwnerParams;
+ //SupplyData -params
+ CSConSupplyData* iSupplyDataParams;
+ //ListPublicFiles -params
+ CSConListPublicFiles* iPubFilesParams;
+ //ListDataOwners -params
+ CSConListDataOwners* iListDataOwnersParams;
+ //Reboot -params
+ CSConReboot* iRebootParams;
+ //GetMetadata -params
+ CSConGetMetadata* iGetMetadataParams;
+ };
+
+//============================================================
+// class CSConStatusReply declaration
+//============================================================
+NONSHARABLE_CLASS( CSConStatusReply ): public CBase
+ {
+ public:
+ CSConStatusReply();
+ ~CSConStatusReply();
+
+ public:
+ TBool iNoTasks; //no active tasks
+ RPointerArray<CSConTaskReply> iTasks;
+ };
+
+#endif
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/common/conmltask/src/sconconmltask.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1696 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML Task implementations
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconconmltask.h"
+
+// -----------------------------------------------------------------------------
+// CSConReboot::CSConReboot()
+//
+// -----------------------------------------------------------------------------
+//
+CSConReboot::CSConReboot() : iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConReboot::~CSConReboot()
+//
+// -----------------------------------------------------------------------------
+//
+CSConReboot::~CSConReboot()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConReboot::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConReboot* CSConReboot::CopyL()
+ {
+ CSConReboot* copy = new (ELeave) CSConReboot();
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConDataOwner::CSConDataOwner()
+//
+// -----------------------------------------------------------------------------
+//
+CSConDataOwner::CSConDataOwner()
+ {
+ iHasFiles = ENoFiles;
+ iJavaHash = NULL;
+ iUid.iUid = 0;
+
+ //Initialize iDriveList with zeros
+ iDriveList.Fill( '\x0' );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConDataOwner::~CSConDataOwner()
+//
+// -----------------------------------------------------------------------------
+//
+CSConDataOwner::~CSConDataOwner()
+ {
+ delete iJavaHash;
+ iJavaHash = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConDataOwner::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConDataOwner* CSConDataOwner::CopyL()
+ {
+ CSConDataOwner* copy = new (ELeave) CSConDataOwner();
+ copy->iType = iType;
+ copy->iUid = iUid;
+ copy->iDriveList.Copy( iDriveList );
+ copy->iPackageName = iPackageName;
+ copy->iReqReboot = iReqReboot;
+ copy->iHasFiles = iHasFiles;
+ copy->iSupportsInc = iSupportsInc;
+ copy->iSupportsSel = iSupportsSel;
+ copy->iDelayToPrep = iDelayToPrep;
+ copy->iSize = iSize;
+ copy->iDataOwnStatus = iDataOwnStatus;
+ copy->iTransDataType = iTransDataType;
+
+ if ( iJavaHash )
+ {
+ if ( copy->iJavaHash )
+ {
+ delete copy->iJavaHash;
+ copy->iJavaHash = NULL;
+ }
+ copy->iJavaHash = iJavaHash->Alloc();
+ }
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUpdateDeviceInfo::CSConUpdateDeviceInfo()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUpdateDeviceInfo::CSConUpdateDeviceInfo() :
+ iInstallSupp(EFalse), iUninstallSupp(EFalse),
+ iInstParamsSupp(EFalse), iInstAppsSupp(EFalse),
+ iDataOwnersSupp(EFalse), iSetBURModeSupp(EFalse),
+ iGetSizeSupp(EFalse), iReqDataSupp(EFalse),
+ iSupplyDataSupp(EFalse), iRebootSupp(EFalse),
+ iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUpdateDeviceInfo::~CSConUpdateDeviceInfo()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUpdateDeviceInfo::~CSConUpdateDeviceInfo()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUpdateDeviceInfo::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUpdateDeviceInfo* CSConUpdateDeviceInfo::CopyL()
+ {
+ CSConUpdateDeviceInfo* copy = new (ELeave) CSConUpdateDeviceInfo();
+ copy->iVersion.Copy( iVersion );
+ copy->iInstallSupp = iInstallSupp;
+ copy->iUninstallSupp = iUninstallSupp;
+ copy->iInstParamsSupp = iInstParamsSupp;
+ copy->iInstAppsSupp = iInstAppsSupp;
+ copy->iDataOwnersSupp = iDataOwnersSupp;
+ copy->iSetBURModeSupp = iSetBURModeSupp;
+ copy->iGetSizeSupp = iGetSizeSupp;
+ copy->iReqDataSupp = iReqDataSupp;
+ copy->iSupplyDataSupp = iSupplyDataSupp;
+ copy->iMaxObjectSize = iMaxObjectSize;
+ copy->iRebootSupp = iRebootSupp;
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+CSConInstApp::~CSConInstApp()
+ {
+ delete iWidgetBundleId;
+ }
+// -----------------------------------------------------------------------------
+// CSConInstApp::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConInstApp* CSConInstApp::CopyL()
+ {
+ CSConInstApp* copy = new (ELeave) CSConInstApp();
+
+ copy->iName.Copy( iName );
+ copy->iParentName.Copy( iParentName );
+ copy->iVendor.Copy( iVendor );
+ copy->iVersion.Copy( iVersion );
+ copy->iSize = iSize;
+ copy->iType = iType;
+ copy->iUid = iUid;
+ if ( iWidgetBundleId )
+ {
+ copy->iWidgetBundleId = iWidgetBundleId->AllocL();
+ }
+ else
+ {
+ copy->iWidgetBundleId = NULL;
+ }
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListInstApps::CSConListInstApps()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListInstApps::CSConListInstApps() : iComplete( EFalse ), iProgress( 0 )
+ {
+ //Initialize iDriveList with zeros
+ iDriveList.Fill( '\x0' );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListInstApps::~CSConListInstApps()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListInstApps::~CSConListInstApps()
+ {
+ iApps.ResetAndDestroy();
+ iApps.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListInstApps::CopyL()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListInstApps* CSConListInstApps::CopyL()
+ {
+ CSConListInstApps* copy = new (ELeave) CSConListInstApps();
+ copy->iAllApps = iAllApps;
+ copy->iDriveList = iDriveList;
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ for( TInt i = 0; i < iApps.Count(); i++ )
+ {
+ copy->iApps.Append( iApps[i]->CopyL() );
+ }
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFile::CSConFile
+//
+// -----------------------------------------------------------------------------
+//
+CSConFile::CSConFile()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFile::~CSConFile
+//
+// -----------------------------------------------------------------------------
+//
+CSConFile::~CSConFile()
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFile::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConFile* CSConFile::CopyL()
+ {
+ CSConFile* copy = new (ELeave) CSConFile();
+
+ copy->iPath.Copy( iPath );
+ copy->iModified.Copy( iModified );
+ copy->iSize = iSize;
+ copy->iUserPerm = iUserPerm;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstall::CSConInstall()
+//
+// -----------------------------------------------------------------------------
+//
+CSConInstall::CSConInstall() : iMode( EUnknown ), iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstall::~CSConInstall()
+//
+// -----------------------------------------------------------------------------
+//
+CSConInstall::~CSConInstall()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstall::CopyL()
+//
+// -----------------------------------------------------------------------------
+//
+CSConInstall* CSConInstall::CopyL()
+ {
+ CSConInstall* copy = new (ELeave) CSConInstall();
+ copy->iPath = iPath;
+ copy->iMode = iMode;
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUninstall::CSConUninstall()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUninstall::CSConUninstall() : iMode( EUnknown ), iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUninstall::~CSConUninstall()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUninstall::~CSConUninstall()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConUninstall::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConUninstall* CSConUninstall::CopyL()
+ {
+ CSConUninstall* copy = new (ELeave) CSConUninstall();
+ copy->iName = iName;
+ copy->iVendor = iVendor;
+ copy->iUid = iUid;
+ copy->iMode = iMode;
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListDataOwners::CSConListDataOwners()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListDataOwners::CSConListDataOwners() : iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListDataOwners::~CSConListDataOwners()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListDataOwners::~CSConListDataOwners()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListDataOwners::CopyL()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListDataOwners* CSConListDataOwners::CopyL()
+ {
+ CSConListDataOwners* copy = new (ELeave) CSConListDataOwners();
+ CleanupStack::PushL( copy );
+ for( TInt i = 0; i < iDataOwners.Count(); i++ )
+ {
+ copy->iDataOwners.Append( iDataOwners[i]->CopyL() );
+ }
+ CleanupStack::Pop( copy );
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListDataOwners::DeleteDataOwners()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConListDataOwners::DeleteDataOwners()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CCSConSetBURMode::CSConSetBURMode()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSetBURMode::CSConSetBURMode() : iComplete( EFalse ), iProgress( 0 )
+ {
+ //Initialize iDriveList with zeros
+ iDriveList.Fill( '\x0' );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSetBURMode::~CSConSetBURMode()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSetBURMode::~CSConSetBURMode()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSetBURMode::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSetBURMode* CSConSetBURMode::CopyL()
+ {
+ CSConSetBURMode* copy = new (ELeave) CSConSetBURMode();
+ copy->iDriveList.Copy( iDriveList );
+ copy->iPartialType = iPartialType;
+ copy->iIncType = iIncType;
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataSize::CSConGetDataSize()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataSize::CSConGetDataSize() : iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataSize::~CSConGetDataSize()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataSize::~CSConGetDataSize()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataSize::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataSize* CSConGetDataSize::CopyL()
+ {
+ CSConGetDataSize* copy = new (ELeave) CSConGetDataSize();
+ CleanupStack::PushL( copy );
+ for( TInt i = 0; i < iDataOwners.Count(); i++ )
+ {
+ copy->iDataOwners.Append( iDataOwners[i]->CopyL() );
+ }
+ CleanupStack::Pop( copy );
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataSize::DeleteDataOwners()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConGetDataSize::DeleteDataOwners()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListPublicFiles::CSConListPublicFiles()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListPublicFiles::CSConListPublicFiles() : iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListPublicFiles::~CSConListPublicFiles()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListPublicFiles::~CSConListPublicFiles()
+ {
+ iFiles.ResetAndDestroy();
+ iFiles.Close();
+
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConListPublicFiles::CopyL()
+//
+// -----------------------------------------------------------------------------
+//
+CSConListPublicFiles* CSConListPublicFiles::CopyL()
+ {
+ CSConListPublicFiles* copy = new (ELeave) CSConListPublicFiles();
+ CleanupStack::PushL( copy );
+ for( TInt i = 0; i < iFiles.Count(); i++ )
+ {
+ copy->iFiles.Append( iFiles[i]->CopyL() );
+ }
+
+ for( TInt j = 0; j < iDataOwners.Count(); j++ )
+ {
+ copy->iDataOwners.Append( iDataOwners[j]->CopyL() );
+ }
+ CleanupStack::Pop( copy );
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConRequestData::CSConRequestData()
+//
+// -----------------------------------------------------------------------------
+//
+CSConRequestData::CSConRequestData() : iDataOwner( NULL ), iBackupData( NULL ),
+ iMoreData( EFalse ), iComplete( EFalse ), iProgress( 0 )
+ {
+ iDataOwner = new CSConDataOwner();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConRequestData::~CSConRequestData()
+//
+// -----------------------------------------------------------------------------
+//
+CSConRequestData::~CSConRequestData()
+ {
+ if ( iDataOwner )
+ {
+ delete iDataOwner;
+ iDataOwner = NULL;
+ }
+
+ if ( iBackupData )
+ {
+ delete iBackupData;
+ iBackupData = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConRequestData::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConRequestData* CSConRequestData::CopyL()
+ {
+ CSConRequestData* copy = new (ELeave) CSConRequestData();
+
+ if ( iDataOwner )
+ {
+ if ( copy->iDataOwner )
+ {
+ delete copy->iDataOwner;
+ copy->iDataOwner = NULL;
+ }
+ copy->iDataOwner = iDataOwner->CopyL();
+ }
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ if ( iBackupData )
+ {
+ if ( copy->iBackupData )
+ {
+ delete copy->iBackupData;
+ copy->iBackupData = NULL;
+ }
+ copy->iBackupData = iBackupData->Alloc();
+ }
+
+ copy->iMoreData = iMoreData;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConRequestData::DeleteDataAndDataOwner()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConRequestData::DeleteDataAndDataOwner()
+ {
+ if ( iDataOwner )
+ {
+ delete iDataOwner;
+ iDataOwner = NULL;
+ }
+
+ if ( iBackupData )
+ {
+ delete iBackupData;
+ iBackupData = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataOwnerStatus::CSConGetDataOwnerStatus()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataOwnerStatus::CSConGetDataOwnerStatus() : iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataOwnerStatus::~CSConGetDataOwnerStatus()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataOwnerStatus::~CSConGetDataOwnerStatus()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataOwnerStatus::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetDataOwnerStatus* CSConGetDataOwnerStatus::CopyL()
+ {
+ CSConGetDataOwnerStatus* copy = new (ELeave) CSConGetDataOwnerStatus();
+ CleanupStack::PushL( copy );
+ for( TInt i = 0; i < iDataOwners.Count(); i++ )
+ {
+ copy->iDataOwners.Append( iDataOwners[i]->CopyL() );
+ }
+ CleanupStack::Pop( copy );
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetDataOwnerStatus::DeleteDataOwners()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConGetDataOwnerStatus::DeleteDataOwners()
+ {
+ iDataOwners.ResetAndDestroy();
+ iDataOwners.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSupplyData::CSConSupplyData()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSupplyData::CSConSupplyData() : iDataOwner( NULL ), iRestoreData( NULL ),
+ iComplete( EFalse ), iProgress( 0 )
+ {
+ iDataOwner = new CSConDataOwner();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSupplyData::~CSConSupplyData()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSupplyData::~CSConSupplyData()
+ {
+ if ( iDataOwner )
+ {
+ delete iDataOwner;
+ iDataOwner = NULL;
+ }
+
+ if ( iRestoreData )
+ {
+ delete iRestoreData;
+ iRestoreData = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSupplyData::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConSupplyData* CSConSupplyData::CopyL()
+ {
+ CSConSupplyData* copy = new (ELeave) CSConSupplyData();
+ CleanupStack::PushL( copy );
+
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ if ( iDataOwner )
+ {
+ if ( copy->iDataOwner )
+ {
+ delete copy->iDataOwner;
+ copy->iDataOwner = NULL;
+ }
+
+ copy->iDataOwner = iDataOwner->CopyL();
+ }
+ CleanupStack::Pop( copy );
+
+ if ( iRestoreData )
+ {
+ if ( copy->iRestoreData )
+ {
+ delete copy->iRestoreData;
+ copy->iRestoreData = NULL;
+ }
+
+ copy->iRestoreData = iRestoreData->Alloc();
+ }
+
+ copy->iMoreData = iMoreData;
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetMetadata::CSConGetMetadata()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetMetadata::CSConGetMetadata() : iData( NULL ),
+ iMoreData( EFalse ), iComplete( EFalse ), iProgress( 0 )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetMetadata::~CSConGetMetadata()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetMetadata::~CSConGetMetadata()
+ {
+ if ( iData )
+ {
+ delete iData;
+ iData = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConGetMetadata::Copy()
+//
+// -----------------------------------------------------------------------------
+//
+CSConGetMetadata* CSConGetMetadata::CopyL()
+ {
+ CSConGetMetadata* copy = new (ELeave) CSConGetMetadata();
+
+ copy->iFilename = iFilename;
+
+ if ( iData )
+ {
+ if ( copy->iData )
+ {
+ delete copy->iData;
+ copy->iData = NULL;
+ }
+
+ copy->iData = iData->Alloc();
+ }
+
+ copy->iMoreData = iMoreData;
+ copy->iComplete = iComplete;
+ copy->iProgress = iProgress;
+
+ return copy;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConTask::NewL( TSConMethodName aMethod )
+//
+// -----------------------------------------------------------------------------
+//
+CSConTask* CSConTask::NewL( TSConMethodName aMethod )
+ {
+ CSConTask* self = NewLC( aMethod );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::NewLC( TSConMethodName aMethod )
+//
+// -----------------------------------------------------------------------------
+//
+CSConTask* CSConTask::NewLC( TSConMethodName aMethod )
+ {
+ CSConTask* self = new (ELeave) CSConTask();
+ CleanupStack::PushL( self );
+ self->ConstructL( aMethod );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::ConstructL( TSConMethodName aMethod )
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConTask::ConstructL( TSConMethodName aMethod )
+ {
+ iMethod = aMethod;
+
+ switch( aMethod )
+ {
+ case ECancel :
+ break;
+ case EGetDataOwnerStatus :
+ iGetDataOwnerParams = new (ELeave) CSConGetDataOwnerStatus();
+ break;
+ case EGetDataSize :
+ iGetDataSizeParams = new (ELeave) CSConGetDataSize();
+ break;
+ case EGetStatus :
+ iGetStatusParams = new (ELeave) CSConGetStatus();
+ break;
+ case EInstall :
+ iInstallParams = new (ELeave) CSConInstall();
+ break;
+ case EListDataOwners :
+ iListDataOwnersParams = new (ELeave) CSConListDataOwners();
+ break;
+ case EListInstalledApps :
+ iListAppsParams = new (ELeave) CSConListInstApps();
+ break;
+ case EListPublicFiles :
+ iPubFilesParams = new (ELeave) CSConListPublicFiles();
+ break;
+ case ERequestData :
+ iRequestDataParams = new (ELeave) CSConRequestData();
+ break;
+ case ESetBURMode :
+ iBURModeParams = new (ELeave) CSConSetBURMode();
+ break;
+ case ESetInstParams :
+ break;
+ case ESupplyData :
+ iSupplyDataParams = new (ELeave) CSConSupplyData();
+ break;
+ case EUninstall :
+ iUninstallParams = new (ELeave) CSConUninstall();
+ break;
+ case EUpdateDeviceInfo :
+ iDevInfoParams = new (ELeave) CSConUpdateDeviceInfo();
+ break;
+ case EReboot :
+ iRebootParams = new (ELeave) CSConReboot();
+ break;
+ case EGetMetadata :
+ iGetMetadataParams = new (ELeave) CSConGetMetadata();
+ break;
+ default :
+ break;
+ }
+ }
+// -----------------------------------------------------------------------------
+// CSConTask::CSConTask()
+//
+// -----------------------------------------------------------------------------
+//
+CSConTask::CSConTask()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::~CSConTask()
+//
+// -----------------------------------------------------------------------------
+//
+CSConTask::~CSConTask()
+ {
+ delete iDevInfoParams;
+ delete iListAppsParams;
+ delete iGetStatusParams;
+ delete iInstallParams;
+ delete iUninstallParams;
+ delete iBURModeParams;
+ delete iGetDataSizeParams;
+ delete iRequestDataParams;
+ delete iGetDataOwnerParams;
+ delete iSupplyDataParams;
+ delete iPubFilesParams;
+ delete iListDataOwnersParams;
+ delete iRebootParams;
+ delete iGetMetadataParams;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::GetServiceId() const
+//
+// -----------------------------------------------------------------------------
+//
+TSConMethodName CSConTask::GetServiceId() const
+ {
+ return iMethod;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::Copy() const
+//
+// -----------------------------------------------------------------------------
+//
+CSConTask* CSConTask::CopyL() const
+ {
+ CSConTask* copy = new (ELeave) CSConTask();
+ copy->iMethod = iMethod;
+
+ if ( iDevInfoParams )
+ {
+ copy->iDevInfoParams = iDevInfoParams->CopyL();
+ }
+ if ( iListAppsParams )
+ {
+ copy->iListAppsParams = iListAppsParams->CopyL();
+ }
+ if ( iGetStatusParams )
+ {
+
+ }
+ if ( iInstallParams )
+ {
+ copy->iInstallParams = iInstallParams->CopyL();
+ }
+ if ( iUninstallParams )
+ {
+ copy->iUninstallParams = iUninstallParams->CopyL();
+ }
+ if ( iBURModeParams )
+ {
+ copy->iBURModeParams = iBURModeParams->CopyL();
+ }
+ if ( iGetDataSizeParams )
+ {
+ copy->iGetDataSizeParams = iGetDataSizeParams->CopyL();
+ }
+ if ( iRequestDataParams )
+ {
+ copy->iRequestDataParams = iRequestDataParams->CopyL();
+ }
+ if ( iGetDataOwnerParams )
+ {
+ copy->iGetDataOwnerParams = iGetDataOwnerParams->CopyL();
+ }
+ if ( iSupplyDataParams )
+ {
+ copy->iSupplyDataParams = iSupplyDataParams->CopyL();
+ }
+ if ( iPubFilesParams )
+ {
+ copy->iPubFilesParams = iPubFilesParams->CopyL();
+ }
+ if ( iListDataOwnersParams )
+ {
+ copy->iListDataOwnersParams = iListDataOwnersParams->CopyL();
+ }
+ if ( iRebootParams )
+ {
+ copy->iRebootParams = iRebootParams->CopyL();
+ }
+ if ( iGetMetadataParams )
+ {
+ copy->iGetMetadataParams = iGetMetadataParams->CopyL();
+ }
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::GetComplete()
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSConTask::GetComplete()
+ {
+ TBool complete( EFalse );
+
+ switch( iMethod )
+ {
+ case EInstall :
+ complete = this->iInstallParams->iComplete;
+ break;
+ case EUninstall :
+ complete = this->iUninstallParams->iComplete;
+ break;
+ case EListInstalledApps :
+ complete = this->iListAppsParams->iComplete;
+ break;
+ case ESetInstParams :
+ break;
+ case ESetBURMode :
+ complete = this->iBURModeParams->iComplete;
+ break;
+ case EListPublicFiles :
+ complete = this->iPubFilesParams->iComplete;
+ break;
+ case EListDataOwners :
+ complete = this->iListDataOwnersParams->iComplete;
+ break;
+ case EGetDataSize :
+ complete = this->iGetDataSizeParams->iComplete;
+ break;
+ case EReboot :
+ complete = this->iRebootParams->iComplete;
+ break;
+ case ERequestData :
+ //If task is partially completed,
+ //it can be removed from the queue
+ if ( this->iRequestDataParams->iProgress == KSConTaskPartiallyCompleted )
+ {
+ complete = ETrue;
+ }
+ else
+ {
+ complete = this->iRequestDataParams->iComplete;
+ }
+
+ break;
+ case EGetDataOwnerStatus :
+ complete = this->iGetDataOwnerParams->iComplete;
+ break;
+ case ESupplyData :
+ //If task is partially completed,
+ //it can be removed from the queue
+ if ( this->iSupplyDataParams->iProgress == KSConTaskPartiallyCompleted )
+ {
+ complete = ETrue;
+ }
+ else
+ {
+ complete = this->iSupplyDataParams->iComplete;
+ }
+
+ break;
+ case EGetMetadata :
+ complete = this->iGetMetadataParams->iComplete;
+ break;
+ default :
+ break;
+ }
+
+ return complete;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::SetCompleteValue( TBool aValue )
+//
+// -----------------------------------------------------------------------------
+//
+void CSConTask::SetCompleteValue( TBool aValue )
+ {
+ switch( iMethod )
+ {
+ case EInstall :
+ this->iInstallParams->iComplete = aValue;
+ break;
+ case EUninstall :
+ this->iUninstallParams->iComplete = aValue;
+ break;
+ case EListInstalledApps :
+ this->iListAppsParams->iComplete = aValue;
+ break;
+ case ESetInstParams :
+ this->iInstallParams->iComplete = aValue;
+ break;
+ case ESetBURMode :
+ this->iBURModeParams->iComplete = aValue;
+ break;
+ case EListPublicFiles :
+ this->iPubFilesParams->iComplete = aValue;
+ break;
+ case EListDataOwners :
+ this->iListDataOwnersParams->iComplete = aValue;
+ break;
+ case EGetDataSize :
+ this->iGetDataSizeParams->iComplete = aValue;
+ break;
+ case EReboot :
+ this->iRebootParams->iComplete = aValue;
+ break;
+ case ERequestData :
+ this->iRequestDataParams->iComplete = aValue;
+ break;
+ case EGetDataOwnerStatus :
+ this->iGetDataOwnerParams->iComplete = aValue;
+ break;
+ case ESupplyData :
+ this->iSupplyDataParams->iComplete = aValue;
+ break;
+ case EGetMetadata :
+ this->iGetMetadataParams->iComplete = aValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::GetCompleteValue()
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSConTask::GetCompleteValue()
+ {
+ TBool complete( EFalse );
+
+ switch( iMethod )
+ {
+ case EInstall :
+ complete = this->iInstallParams->iComplete;
+ break;
+ case EUninstall :
+ complete = this->iUninstallParams->iComplete;
+ break;
+ case EListInstalledApps :
+ complete = this->iListAppsParams->iComplete;
+ break;
+ case ESetInstParams :
+ complete = this->iInstallParams->iComplete;
+ break;
+ case ESetBURMode :
+ complete = this->iBURModeParams->iComplete;
+ break;
+ case EListPublicFiles :
+ complete = this->iPubFilesParams->iComplete;
+ break;
+ case EListDataOwners :
+ complete = this->iListDataOwnersParams->iComplete;
+ break;
+ case EGetDataSize :
+ complete = this->iGetDataSizeParams->iComplete;
+ break;
+ case EReboot :
+ complete = this->iRebootParams->iComplete;
+ break;
+ case ERequestData :
+ if ( this->iRequestDataParams->iProgress != KSConTaskPartiallyCompleted )
+ {
+ complete = this->iRequestDataParams->iComplete;
+ }
+ else
+ {
+ complete = ETrue;
+ }
+
+ break;
+ case EGetDataOwnerStatus :
+ complete = this->iGetDataOwnerParams->iComplete;
+ break;
+ case ESupplyData :
+ if ( this->iSupplyDataParams->iProgress != KSConTaskPartiallyCompleted )
+ {
+ complete = this->iSupplyDataParams->iComplete;
+ }
+ else
+ {
+ complete = ETrue;
+ }
+ break;
+ case EGetMetadata :
+ complete = this->iGetMetadataParams->iComplete;
+ break;
+ default:
+ break;
+ }
+ return complete;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTask::SetProgressValue( TInt aValue )
+//
+// -----------------------------------------------------------------------------
+//
+void CSConTask::SetProgressValue( TInt aValue )
+ {
+ switch( iMethod )
+ {
+ case EInstall :
+ this->iInstallParams->iProgress = aValue;
+ break;
+ case EUninstall :
+ this->iUninstallParams->iProgress = aValue;
+ break;
+ case EListInstalledApps :
+ this->iListAppsParams->iProgress = aValue;
+ break;
+ case ESetInstParams :
+ this->iInstallParams->iProgress = aValue;
+ break;
+ case ESetBURMode :
+ this->iBURModeParams->iProgress = aValue;
+ break;
+ case EListPublicFiles :
+ this->iPubFilesParams->iProgress = aValue;
+ break;
+ case EListDataOwners :
+ this->iListDataOwnersParams->iProgress = aValue;
+ break;
+ case EGetDataSize :
+ this->iGetDataSizeParams->iProgress = aValue;
+ break;
+ case EReboot :
+ this->iRebootParams->iProgress = aValue;
+ break;
+ case ERequestData :
+ this->iRequestDataParams->iProgress = aValue;
+ break;
+ case EGetDataOwnerStatus :
+ this->iGetDataOwnerParams->iProgress = aValue;
+ break;
+ case ESupplyData :
+ this->iSupplyDataParams->iProgress = aValue;
+ break;
+ case EGetMetadata :
+ this->iGetMetadataParams->iProgress = aValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::CSConTaskReply()
+//
+// -----------------------------------------------------------------------------
+//
+CSConTaskReply::CSConTaskReply()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::CSConTaskReply( TSConMethodName aMethod )
+//
+// -----------------------------------------------------------------------------
+//
+CSConTaskReply::CSConTaskReply( TSConMethodName aMethod )
+ {
+ iMethod = aMethod;
+ switch( aMethod )
+ {
+ case ECancel :
+ break;
+ case EGetDataOwnerStatus :
+ iGetDataOwnerParams = new CSConGetDataOwnerStatus();
+ break;
+ case EGetDataSize :
+ iGetDataSizeParams = new CSConGetDataSize();
+ break;
+ case EGetStatus :
+ iGetStatusParams = new CSConGetStatus();
+ break;
+ case EInstall :
+ iInstallParams = new CSConInstall();
+ break;
+ case EListDataOwners :
+ iListDataOwnersParams = new CSConListDataOwners();
+ break;
+ case EListInstalledApps :
+ iListAppsParams = new CSConListInstApps();
+ break;
+ case EListPublicFiles :
+ iPubFilesParams = new CSConListPublicFiles();
+ break;
+ case ERequestData :
+ iRequestDataParams = new CSConRequestData();
+ break;
+ case ESetBURMode :
+ iBURModeParams = new CSConSetBURMode();
+ break;
+ case ESetInstParams :
+ break;
+ case ESupplyData :
+ iSupplyDataParams = new CSConSupplyData();
+ break;
+ case EUninstall :
+ iUninstallParams = new CSConUninstall();
+ break;
+ case EUpdateDeviceInfo :
+ iDevInfoParams = new CSConUpdateDeviceInfo();
+ break;
+ case EReboot :
+ iRebootParams = new CSConReboot();
+ break;
+ case EGetMetadata :
+ iGetMetadataParams = new CSConGetMetadata();
+ break;
+ default :
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::~CSConTaskReply()
+//
+// -----------------------------------------------------------------------------
+//
+CSConTaskReply::~CSConTaskReply()
+ {
+ delete iDevInfoParams;
+ delete iListAppsParams;
+ delete iGetStatusParams;
+ delete iInstallParams;
+ delete iUninstallParams;
+ delete iBURModeParams;
+ delete iGetDataSizeParams;
+ delete iRequestDataParams;
+ delete iGetDataOwnerParams;
+ delete iSupplyDataParams;
+ delete iPubFilesParams;
+ delete iListDataOwnersParams;
+ delete iRebootParams;
+ delete iGetMetadataParams;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::Initialize( const CSConTask& aTask )
+//
+// -----------------------------------------------------------------------------
+//
+void CSConTaskReply::InitializeL( const CSConTask& aTask )
+ {
+ iTaskId = aTask.iTaskId;
+ iMethod = aTask.iMethod;
+
+ if ( iMethod == EInstall )
+ {
+ if ( iInstallParams )
+ {
+ delete iInstallParams;
+ iInstallParams = NULL;
+ }
+ iInstallParams = aTask.iInstallParams->CopyL();
+ }
+ else if ( iMethod == EListInstalledApps )
+ {
+ if ( iListAppsParams )
+ {
+ delete iListAppsParams;
+ iListAppsParams = NULL;
+ }
+
+ iListAppsParams = aTask.iListAppsParams->CopyL();
+ }
+ else if ( iMethod == EUninstall )
+ {
+ if ( iUninstallParams )
+ {
+ delete iUninstallParams;
+ iUninstallParams = NULL;
+ }
+
+ iUninstallParams = aTask.iUninstallParams->CopyL();
+ }
+ else if ( iMethod == ESetBURMode )
+ {
+ if ( iBURModeParams )
+ {
+ delete iBURModeParams;
+ iBURModeParams = NULL;
+ }
+
+ iBURModeParams = aTask.iBURModeParams->CopyL();
+ }
+ else if ( iMethod == EListPublicFiles )
+ {
+ if ( iPubFilesParams )
+ {
+ delete iPubFilesParams;
+ iPubFilesParams = NULL;
+ }
+
+ iPubFilesParams = aTask.iPubFilesParams->CopyL();
+ }
+ else if ( iMethod == EListDataOwners )
+ {
+ if ( iListDataOwnersParams )
+ {
+ delete iListDataOwnersParams;
+ iListDataOwnersParams = NULL;
+ }
+
+ iListDataOwnersParams = aTask.iListDataOwnersParams->CopyL();
+ }
+ else if ( iMethod == EGetDataSize )
+ {
+ if ( iGetDataSizeParams )
+ {
+ delete iGetDataSizeParams;
+ iGetDataSizeParams = NULL;
+ }
+
+ iGetDataSizeParams = aTask.iGetDataSizeParams->CopyL();
+ }
+ else if ( iMethod == EReboot )
+ {
+ if ( iRebootParams )
+ {
+ delete iRebootParams;
+ iRebootParams = NULL;
+ }
+ }
+ else if ( iMethod == ERequestData )
+ {
+ if ( iRequestDataParams )
+ {
+ delete iRequestDataParams;
+ iRequestDataParams = NULL;
+ }
+
+ iRequestDataParams = aTask.iRequestDataParams->CopyL();
+ }
+ else if ( iMethod == EGetDataOwnerStatus )
+ {
+ if ( iGetDataOwnerParams )
+ {
+ delete iGetDataOwnerParams;
+ iGetDataOwnerParams = NULL;
+ }
+
+ iGetDataOwnerParams = aTask.iGetDataOwnerParams->CopyL();
+ }
+ else if ( iMethod == ESupplyData )
+ {
+ if ( iSupplyDataParams )
+ {
+ delete iSupplyDataParams;
+ iSupplyDataParams = NULL;
+ }
+
+ iSupplyDataParams = aTask.iSupplyDataParams->CopyL();
+ }
+ else if ( iMethod == EGetMetadata )
+ {
+ if ( iGetMetadataParams )
+ {
+ delete iGetMetadataParams;
+ iGetMetadataParams = NULL;
+ }
+
+ iGetMetadataParams = aTask.iGetMetadataParams->CopyL();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::Initialize( TSConMethodName aMethod,
+// TInt aProgress, TBool aComplete )
+//
+// -----------------------------------------------------------------------------
+//
+void CSConTaskReply::InitializeL( TSConMethodName aMethod,
+ TInt aProgress, TBool aComplete )
+ {
+ iMethod = aMethod;
+ if ( aMethod == EUpdateDeviceInfo )
+ {
+ if ( !iDevInfoParams )
+ {
+ iDevInfoParams = new (ELeave) CSConUpdateDeviceInfo();
+ }
+
+ iDevInfoParams->iComplete = aComplete;
+ iDevInfoParams->iProgress = aProgress;
+ }
+ else if ( aMethod == EReboot )
+ {
+ if ( !iRebootParams )
+ {
+ iRebootParams = new (ELeave) CSConReboot();
+ }
+
+ iRebootParams->iComplete = aComplete;
+ iRebootParams->iProgress = aProgress;
+ }
+ else if ( aMethod == EGetMetadata )
+ {
+ if ( !iGetMetadataParams )
+ {
+ iGetMetadataParams = new (ELeave) CSConGetMetadata();
+ }
+
+ iGetMetadataParams->iComplete = aComplete;
+ iGetMetadataParams->iProgress = aProgress;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::CopyAndFree()
+//
+// -----------------------------------------------------------------------------
+//
+CSConTaskReply* CSConTaskReply::CopyAndFreeL()
+ {
+ CSConTaskReply* copy = new (ELeave) CSConTaskReply();
+ copy->iTaskId = iTaskId;
+ copy->iMethod = iMethod;
+
+ if ( iDevInfoParams )
+ {
+ copy->iDevInfoParams = iDevInfoParams->CopyL();
+
+ //free allocated memory
+ delete iDevInfoParams;
+ iDevInfoParams = NULL;
+ }
+ if ( iListAppsParams )
+ {
+ copy->iListAppsParams = iListAppsParams->CopyL();
+
+ //free allocated memory
+ delete iListAppsParams;
+ iListAppsParams = NULL;
+ }
+ if ( iInstallParams )
+ {
+ copy->iInstallParams = iInstallParams->CopyL();
+
+ //free allocated memory
+ delete iInstallParams;
+ iInstallParams = NULL;
+ }
+ if ( iUninstallParams )
+ {
+ copy->iUninstallParams = iUninstallParams->CopyL();
+
+ //free allocated memory
+ delete iUninstallParams;
+ iUninstallParams = NULL;
+ }
+ if ( iBURModeParams )
+ {
+ copy->iBURModeParams = iBURModeParams->CopyL();
+
+ //free allocated memory
+ delete iBURModeParams;
+ iBURModeParams = NULL;
+ }
+ if ( iGetDataSizeParams )
+ {
+ copy->iGetDataSizeParams = iGetDataSizeParams->CopyL();
+
+ //free allocated memory
+ delete iGetDataSizeParams;
+ iGetDataSizeParams = NULL;
+ }
+ if ( iRequestDataParams )
+ {
+ copy->iRequestDataParams = iRequestDataParams->CopyL();
+
+ //free allocated memory
+ delete iRequestDataParams;
+ iRequestDataParams = NULL;
+ }
+ if ( iGetDataOwnerParams )
+ {
+ copy->iGetDataOwnerParams = iGetDataOwnerParams->CopyL();
+
+ //free allocated memory
+ delete iGetDataOwnerParams;
+ iGetDataOwnerParams = NULL;
+ }
+ if ( iSupplyDataParams )
+ {
+ copy->iSupplyDataParams = iSupplyDataParams->CopyL();
+
+ //free allocated memory
+ delete iSupplyDataParams;
+ iSupplyDataParams = NULL;
+ }
+ if ( iPubFilesParams )
+ {
+ copy->iPubFilesParams = iPubFilesParams->CopyL();
+
+ //free allocated memory
+ delete iPubFilesParams;
+ iPubFilesParams = NULL;
+ }
+ if ( iListDataOwnersParams )
+ {
+ copy->iListDataOwnersParams = iListDataOwnersParams->CopyL();
+
+ //free allocated memory
+ delete iListDataOwnersParams;
+ iListDataOwnersParams = NULL;
+ }
+ if ( iRebootParams )
+ {
+ copy->iRebootParams = iRebootParams->CopyL();
+
+ //free allocated memory
+ delete iRebootParams;
+ iRebootParams = NULL;
+ }
+ if ( iGetMetadataParams )
+ {
+ copy->iGetMetadataParams = iGetMetadataParams->CopyL();
+
+ //free allocated memory
+ delete iGetMetadataParams;
+ iGetMetadataParams = NULL;
+ }
+
+ return copy;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskReply::CleanTaskData()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConTaskReply::CleanTaskData()
+ {
+ switch( iMethod )
+ {
+ case EGetDataSize :
+ if ( iGetDataSizeParams )
+ {
+ this->iGetDataSizeParams->DeleteDataOwners();
+ }
+ break;
+ case EGetDataOwnerStatus :
+ if ( iGetDataOwnerParams )
+ {
+ this->iGetDataOwnerParams->DeleteDataOwners();
+ }
+ break;
+ case EListDataOwners :
+ if ( iListDataOwnersParams )
+ {
+ this->iListDataOwnersParams->DeleteDataOwners();
+ }
+ break;
+ case ERequestData :
+ if ( iRequestDataParams )
+ {
+ this->iRequestDataParams->DeleteDataAndDataOwner();
+ }
+ break;
+ default :
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConStatusReply::CSConStatusReply()
+//
+// -----------------------------------------------------------------------------
+//
+CSConStatusReply::CSConStatusReply() : iNoTasks( EFalse )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConStatusReply::~CSConStatusReply()
+//
+// -----------------------------------------------------------------------------
+//
+CSConStatusReply::~CSConStatusReply()
+ {
+ iTasks.ResetAndDestroy();
+ iTasks.Close();
+ };
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build info file for SeCon
+*
+*/
+
+#include <platform_paths.hrh>
+
+#include "../catalogspcconnectivityplugin/group/bld.inf"
+#include "../cntparser/bld/bld.inf"
+#include "../services/csc/bld/bld.inf"
+#include "../services/ftp/bld/bld.inf"
+#include "../services/pcd/bld/bld.inf"
+
+#include "../wbxml/conmlhandler/bld/bld.inf"
+#include "../servers/pcconn/bld/bld.inf"
+#include "../servers/syncserver/group/bld.inf"
+
+#include "../clients/pcconn/bld/bld.inf"
+#include "../clients/syncclient/group/bld.inf"
+
+#include "../plugins/pcconn/bld/bld.inf"
+#include "../plugins/ftp/bld/bld.inf"
+#include "../plugins/hapticsconnplugin/group/bld.inf"
+
+PRJ_EXPORTS
+
+// Export stub files
+stubs/secon_stub.SIS /epoc32/data/z/system/install/secon_stub.SIS
+stubs/sconpcconnplugin_stub.SIS /epoc32/data/z/system/install/sconpcconnplugin_stub.SIS
+stubs/sconftpplugin_stub.SIS /epoc32/data/z/system/install/sconftpplugin_stub.SIS
+
+../rom/sconpcd.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcd.iby)
+../rom/sconpcconnplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcconnplugin.iby)
+../rom/sconpcconnclientserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconpcconnclientserver.iby)
+../rom/sconftpresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(sconftpresources.iby)
+../rom/sconftpplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconftpplugin.iby)
+../rom/sconftp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconftp.iby)
+../rom/sconcsc.iby CORE_MW_LAYER_IBY_EXPORT_PATH(sconcsc.iby)
+../rom/cntparser.iby CORE_MW_LAYER_IBY_EXPORT_PATH(cntparser.iby)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/group/stubs/createstubs.bat Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,19 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: Batch file for creating needed stub files.
+rem
+
+makesis -s sconftpplugin_stub.pkg
+makesis -s sconpcconnplugin_stub.pkg
+makesis -s secon_stub.pkg
Binary file connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/group/stubs/sconftpplugin_stub.pkg Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,30 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Sis-stub file for FTP Plugin
+;
+; Languages
+&EN
+
+; Header
+#{"FTP Plugin"},(0x101F9686),1,0,0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files to install
+""-"z:\resource\plugins\sconftpplugin.rsc"
+""-"z:\sys\bin\sconftpplugin.dll"
Binary file connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/group/stubs/sconpcconnplugin_stub.pkg Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,30 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Sis-stub file for PCConn Plugin
+;
+; Languages
+&EN
+
+; Header
+#{"PCConn Plugin"},(0x101F9688),1,0,0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files to install
+""-"z:\resource\plugins\sconpcconnplugin.rsc"
+""-"z:\sys\bin\sconpcconnplugin.dll"
Binary file connectivitymodules/SeCon/group/stubs/secon_stub.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/group/stubs/secon_stub.pkg Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,38 @@
+;
+; Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Sis-stub file for Service Controllers
+;
+; Languages
+&EN
+
+; Header
+#{"Service Controllers"},(0x101F99F6),1,72,0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files to install
+""-"z:\sys\bin\sconpcconnserver.exe"
+""-"z:\sys\bin\sconpcconnclient.dll"
+""-"z:\sys\bin\sconpcd.dll"
+""-"z:\resource\sconftp.r??"
+""-"z:\sys\bin\sconftp.dll"
+""-"z:\sys\bin\sconcsc.dll"
+""-"z:\sys\bin\sconconmlhandler.dll"
+""-"z:\sys\bin\catalogspcconnectivityplugin.dll"
+""-"z:\sys\bin\cntparserserver.dll"
+""-"z:\sys\bin\cntparserserverexe.exe"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/inc/debug.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Debug utility for SeCon components.
+*
+*/
+
+
+#ifndef _SECON_DEBUG_H
+#define _SECON_DEBUG_H
+
+#ifdef _DEBUG
+
+ #ifdef __WINS__
+ // Enable file logging
+ #define __FLOGGING__
+ #endif //__WINS__
+
+ #include <e32svr.h>
+ #ifdef __FLOGGING__
+ #include <f32file.h>
+ #include <flogger.h>
+ #endif
+
+ NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+ {
+ public:
+ void Overflow(TDes16& /*aDes*/) {}
+ };
+
+ NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+ {
+ public:
+ void Overflow(TDes8& /*aDes*/) {}
+ };
+
+ _LIT( KLogDir, "SECON" );
+ _LIT( KLogFile, "SeconDebug.txt" );
+
+ _LIT(KTracePrefix16, "[SeCon] ");
+ _LIT8(KTracePrefix8, "[SeCon] ");
+ _LIT8(KFuncEntryFormat8, "%S : Begin");
+ _LIT8(KFuncExitFormat8, "%S : End");
+ _LIT8(KFuncReturnFormat8, "%S : End, return: %d");
+ _LIT8(KFuncFormat8, "><%S");
+
+ const TInt KMaxLogLineLength = 512;
+
+ // old function loggin macros
+ #define LOGGER_ENTERFN( name ) {TRACE_FUNC_ENTRY;}
+ #define LOGGER_LEAVEFN( name ) {TRACE_FUNC_EXIT;}
+
+ #define LOGGER_WRITE( text ) {_LIT( KTemp, text ); FPrint( KTemp );}
+ #define LOGGER_WRITE_1( text,par1 ) {_LIT( KTemp, text ); FPrint( KTemp, par1 );}
+ #define LOGGER_WRITE8_1( text,par1 ) {_LIT8( KTemp, text ); FPrint( KTemp, par1 );}
+ #define LOGGER_WRITE_2( text,par1,par2 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2 );}
+ #define LOGGER_WRITE_3( text,par1,par2,par3 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2, par3 );}
+
+ // New function logging macros
+ #define TRACE_FUNC_ENTRY {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncEntryFormat8, &ptr8);}
+ #define TRACE_FUNC_EXIT {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncExitFormat8, &ptr8);}
+ #define TRACE_FUNC {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncFormat8, &ptr8);}
+
+ #define TRACE_FUNC_RET( number ) {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncReturnFormat8, &ptr8, number);}
+ // Declare the FPrint function
+ inline void FPrint( TRefByValue<const TDesC16> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list,aFmt);
+ #ifdef __FLOGGING__
+ RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list );
+ #endif
+ TBuf16<KMaxLogLineLength> theFinalString;
+ theFinalString.Append(KTracePrefix16);
+ TOverflowTruncate16 overflow;
+ theFinalString.AppendFormatList(aFmt,list,&overflow);
+ RDebug::Print(theFinalString);
+ }
+
+ // Declare the FPrint function
+ inline void FPrint(TRefByValue<const TDesC8> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list, aFmt);
+ #ifdef __FLOGGING__
+ RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+ #endif
+ TOverflowTruncate8 overflow;
+ TBuf8<KMaxLogLineLength> buf8;
+ buf8.Append(KTracePrefix8);
+ buf8.AppendFormatList(aFmt, list, &overflow);
+ TBuf16<KMaxLogLineLength> buf16(buf8.Length());
+ buf16.Copy(buf8);
+ TRefByValue<const TDesC> tmpFmt(_L("%S"));
+ RDebug::Print(tmpFmt, &buf16);
+ }
+#else
+
+ // No loggings --> reduced code size
+
+ #define LOGGER_ENTERFN( name )
+ #define LOGGER_LEAVEFN( name )
+ #define LOGGER_WRITE( text )
+ #define LOGGER_WRITE_1( text, par1 )
+ #define LOGGER_WRITE8_1( text, par1 )
+ #define LOGGER_WRITE_2( text, par1, par2 )
+ #define LOGGER_WRITE_3( text, par1, par2, par3 )
+ #define TRACE_FUNC_ENTRY
+ #define TRACE_FUNC_EXIT
+ #define TRACE_FUNC
+ #define TRACE_FUNC_RET( number )
+
+#endif //_DEBUG
+
+#endif // SECON_DEBUG_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in build information file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconftpplugin.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/bld/def/bwinscwU.DEF Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/bld/def/eabiU.DEF Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZTI14CSConFTPplugin @ 2 NONAME ; #<TI>#
+ _ZTV14CSConFTPplugin @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/bld/sconftpplugin.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET sconftpplugin.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x101F9686
+
+SOURCEPATH ../src
+
+SOURCE sconftpplugin.cpp
+SOURCE proxy.cpp
+SOURCE sconftppluginutils.cpp
+SOURCE sconservicetimer.cpp
+SOURCE sconshutdownwatcher.cpp
+
+START RESOURCE 101f9686.rss
+ TARGET sconftpplugin.rsc
+END
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../../services/ftp/inc
+
+DEBUGLIBRARY flogger.lib
+LIBRARY euser.lib
+LIBRARY irobex.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY bluetooth.lib
+LIBRARY esock.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/inc/sconftpplugin.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,194 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in header file
+*
+*/
+
+
+#ifndef _SCONFTPPLUGIN_H
+#define _SCONFTPPLUGIN_H
+
+#include <obexserver.h>
+#include <SrcsInterface.h>
+
+#include "sconshutdownwatcher.h"
+
+// forward declaration
+class CSConFTP;
+class CSConServiceTimer;
+// CLASS DECLARATION
+
+/*
+* File Transfer Profile Plugin class
+*
+*/
+
+class CSConFTPplugin : public CSrcsInterface, public MObexServerNotify,
+ public MShutdownObserver
+ {
+ public:
+ static CSConFTPplugin* NewL();
+ ~CSConFTPplugin();
+
+ /**
+ * Returns active status of OBEX session
+ * @return ETrue if session is active, else EFalse
+ */
+ TBool IsOBEXActive();
+
+ /**
+ * Device is shutting down, abort connection.
+ */
+ void NotifyShutdown();
+
+ private:
+ /**
+ * Loads sconftp.dll module
+ * @return none
+ */
+ void LoadFTPDllL();
+ /**
+ * Closes initialized services
+ * @return none
+ */
+ void Disconnect();
+ /**
+ * Removes spaces and nulls from the end of the string
+ * @param aDes String to be formatted
+ * @return none
+ */
+ void TrimRightSpaceAndNull( TDes8& aDes ) const;
+ /**
+ * Current used transfer media (IR,USB,BT)
+ * @param aMediaType Enumeration indicating the media type
+ * @return none
+ */
+ void SetMediaType( TSrcsMediaType aMediaType );
+ /**
+ * MObexServerNotify implementation
+ * @param aError Error code
+ * @return none
+ */
+ void ErrorIndication( TInt aError );
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void TransportUpIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void TransportDownIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aRemoteInfo Structure containing information used during OBEX
+ * connection
+ * @param aInfo Further information about the requested connection
+ * @return System wide error code that indicates the success of the connection
+ */
+ TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
+ const TDesC8& aInfo );
+ /**
+ * MObexServerNotify implementation
+ * @param aInfo Contains information about the disconnection
+ * @return none
+ */
+ void ObexDisconnectIndication( const TDesC8& aInfo );
+ /**
+ * MObexServerNotify implementation
+ * @return CObexBaseObject-derived object, which the object being put
+ * will be parsed into.
+ */
+ CObexBufObject* PutRequestIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * PUT packet operation.
+ */
+ TInt PutPacketIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * PUT packet operation.
+ */
+ TInt PutCompleteIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aRequiredObject Details about the object the remote client
+ * has requested
+ * @returnObject to return to the client
+ */
+ CObexBufObject* GetRequestIndication( CObexBaseObject
+ *aRequiredObject );
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * GET packet operation.
+ */
+ TInt GetPacketIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * GET packet operation.
+ */
+ TInt GetCompleteIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aPathInfo SETPATH command parameters
+ * @param aInfo Not currently used
+ * @return System wide error code indicating the success of the
+ * setpath command.
+ */
+ TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+ const TDesC8& aInfo );
+ /**
+ * SetObexServer
+ * @param aObexServer pass obex server pointer to sevice controller
+ * @return System wide error code.
+ */
+ TInt SetObexServer( CObexServer* aObexServer );
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void AbortIndication();
+
+ void ConstructL();
+ CSConFTPplugin();
+
+ private:
+ RLibrary iFTPlib;
+ CObexBufObject* iObject;
+ CBufFlat* iBuffer;
+ CSConFTP* iFTPHandler;
+ TInt iPutError;
+ TBool iSessionActive;
+ CSConServiceTimer* iServiceTimer;
+ TBool iStartTimer;
+ TSrcsMediaType iMediaType;
+ CObexFileObject* iFileObject;
+ TBool iPutPacketIndicationCalled;
+ CShutdownWatcher* iShutdownWatcher;
+ TBool iShutdownInProgress;
+ CObexServer* iObexServer;
+ RSocketServ iSocketServer;
+ RBTPhysicalLinkAdapter iLinkAdapter;
+ private:
+ // Friend class is used,because existing impelentation has been working
+ // properly. Avoiding re-design.
+ friend class CSConServiceTimer;
+ };
+
+#endif // SCONPCCONNPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/inc/sconftppluginutils.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in Utils header
+*
+*/
+
+
+#ifndef _SCONFTPPLUGINUTILS_H
+#define _SCONFTPPLUGINUTILS_H
+
+#include <e32base.h>
+//============================================================
+// Class TFTPpluginUtils declaration
+//============================================================
+class TFTPpluginUtils
+ {
+ public:
+ /**
+ * Converts Symbian error code to OBEX error code
+ * @param aError The error code
+ * @return The converted error code
+ */
+ static TInt ConvertFTPResponseCode( TInt aError );
+ };
+
+#endif // _SCONFTPPLUGINUTILS_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/inc/sconservicetimer.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in Service Timer Header file
+*
+*/
+
+
+#ifndef _SCONSERVICETIMER_H
+#define _SCONSERVICETIMER_H
+
+#include <e32base.h>
+
+class CSConFTPplugin;
+
+
+//============================================================
+// Class CSConServiceTimer declaration
+//============================================================
+
+NONSHARABLE_CLASS ( CSConServiceTimer ) : public CActive
+ {
+ public:
+ CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue );
+ void ConstructL();
+ ~CSConServiceTimer();
+
+ /**
+ * Starts the timer
+ * @return none
+ */
+ void StartTimer();
+ /**
+ * Stops the timer
+ * @return none
+ */
+ void StopTimer();
+
+ private:
+ void DoCancel();
+ void RunL();
+
+ private:
+ RTimer iTimer;
+ CSConFTPplugin* iEngine;
+ TInt iValue;
+ };
+
+#endif //_SCONSERVICETIMER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/inc/sconshutdownwatcher.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Power shutdown -watcher header file
+*
+*/
+
+
+#ifndef _SCONSHUTDOWNWATCHER_H
+#define _SCONSHUTDOWNWATCHER_H
+
+
+#include <e32base.h>
+#include <e32property.h>
+
+//============================================================
+// Class MShutdownObserver declaration
+//============================================================
+class MShutdownObserver
+ {
+public:
+ virtual void NotifyShutdown()=0;
+ };
+
+//============================================================
+// Class CShutdownWatcher declaration
+//============================================================
+NONSHARABLE_CLASS ( CShutdownWatcher ) : public CActive
+ {
+ public:
+ static CShutdownWatcher* NewL( MShutdownObserver* aObserver );
+ ~CShutdownWatcher();
+
+ /**
+ * Starts to watch shutdown status
+ * @return none
+ */
+ void StartShutdownWatcher();
+
+ private:
+ //construct/destruct
+ CShutdownWatcher( MShutdownObserver* aObserver );
+ void ConstructL();
+
+ // from CActive
+ void DoCancel();
+ void RunL();
+
+ private:
+ MShutdownObserver* iObserver;
+ RProperty iProperty;
+ };
+
+#endif //_SCONSHUTDOWNWATCHER_H
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/101f9686.rss Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in resource file
+*
+*/
+
+
+#include "ecom/registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x101F9686;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x101F7C8C;
+ implementations =
+ {
+ // Info for CSConFTPplugin
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x101F9687;
+ version_no = 1;
+ display_name = "OBEX File Transfer";
+ default_data = "OBEX/BT";
+
+ //
+ // opaque_data contains parameters used by following API calls in SRCS:
+ // 1. Setup USB interface string descriptor in Unicode;
+ // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo);
+ // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService,
+ // TInt aProtocol,
+ // TInt aChannel,
+ // TBool aAuthenticate,
+ // TBool aAuthorise,
+ // TBool aEncrypt );
+ // opaque_data = "@0||@1||@2||@3||@4||@5||@6"
+ // @0 aStrDesc e.g. "OBEX File Transfer"
+ // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
+ // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106
+ // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013
+ // @4 aAuthenticate e.g. EFalse, 0
+ // @5 aAuthorise e.g. EFalse, 0
+ // @6 aEncrypt e.g. EFalse, 0
+ //
+ opaque_data = "OBEX File Transfer||\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09||0x1106||0x1013||1||1||1";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/proxy.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in proxy implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "sconftpplugin.h"
+
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x101F9687, CSConFTPplugin::NewL)
+ };
+
+// -----------------------------------------------------------------------------
+// TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+// Exported proxy for instantiation method resolution
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+ TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+ return ImplementationTable;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/sconftpplugin.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,880 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <obexconstantsinternal.h>
+#endif
+#include "sconftpplugin.h"
+#include "sconftp.h"
+#include "sconftppluginutils.h"
+#include "sconservicetimer.h"
+#include "debug.h"
+
+
+// CONSTANTS
+_LIT(KSConFTPLibName, "sconftp.dll");
+const TInt KSConFTPUidValue = 0x10009D8D;
+const TUid KSConFTPUid = {KSConFTPUidValue};
+
+// Folder listing type from IrObex specification
+_LIT8( KSConFolderListType, "x-obex/folder-listing" );
+
+_LIT( K_C_ROOT, "C:\\" );
+const TInt KSConBufSize = 262144; // 256KB
+// Time (in milliseconds) for the timer
+const TInt KSConTimeOutValue = 60000000;
+// Flags used to indicate SetPath commands
+const TInt KSConNULLSetPath = 0x00;
+
+const TInt KSConHeaderMaxLength = 256;
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConFTPplugin* CSConFTPplugin::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConFTPplugin* self = new ( ELeave ) CSConFTPplugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return( self );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::~CSConFTPplugin()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConFTPplugin::~CSConFTPplugin()
+ {
+ TRACE_FUNC_ENTRY;
+
+ // Disconnect from services.
+ Disconnect();
+
+ if ( iFTPHandler )
+ {
+ delete iFTPHandler;
+ iFTPHandler = NULL;
+ iFTPlib.Close();
+ }
+
+ delete iBuffer;
+ iBuffer = NULL;
+ delete iObject;
+ iObject = NULL;
+
+ if ( iServiceTimer )
+ {
+ iServiceTimer->Cancel();
+ }
+
+ delete iServiceTimer;
+ iServiceTimer = NULL;
+
+ if ( iFileObject )
+ {
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::IsOBEXActive()
+// Returns active status of OBEX session
+// -----------------------------------------------------------------------------
+//
+TBool CSConFTPplugin::IsOBEXActive()
+ {
+ TRACE_FUNC;
+ return iSessionActive;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::NotifyShutdown()
+// System is shutting down
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::NotifyShutdown()
+ {
+ TRACE_FUNC;
+ iShutdownInProgress = ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::LoadFTPDllL()
+// Loads sconftp.dll module
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::LoadFTPDllL()
+ {
+ TRACE_FUNC_ENTRY;
+ // Dynamically load DLL
+ User::LeaveIfError( iFTPlib.Load( KSConFTPLibName ) );
+ if ( iFTPlib.Type()[1] != KSConFTPUid )
+ {
+ LOGGER_WRITE( "KSConFTPUidValue incorrect" );
+ iFTPlib.Close();
+ User::Leave( KErrNotFound );
+ }
+ TSConCreateCSConFTPFunc CreateCSConFTPL =
+ (TSConCreateCSConFTPFunc)iFTPlib.Lookup(1);
+ iFTPHandler = (CSConFTP*)CreateCSConFTPL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::Disconnect()
+// Closes initialized services
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::Disconnect()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iLinkAdapter.Close();
+ iSocketServer.Close();
+
+ if ( iStartTimer != EFalse )
+ {
+ iServiceTimer->Cancel();
+ iServiceTimer->StartTimer();
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ if ( iFileObject )
+ {
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+ if ( iFTPHandler )
+ {
+ delete iFTPHandler;
+ iFTPHandler = NULL;
+ iFTPlib.Close();
+ }
+
+ TRACE_FUNC_EXIT
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::ErrorIndication( TInt aError )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::ErrorIndication( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aError : %d", aError );
+
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ // Keep compiler happy
+ (void)aError;
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err2 = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::AbortIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::AbortIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::TransportUpIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::TransportUpIndication()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
+// const TDesC8& aInfo )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::ObexConnectIndication(
+ const TObexConnectInfo& /*aRemoteInfo*/,
+ const TDesC8& /*aInfo*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+ iStartTimer = ETrue;
+
+ if ( iMediaType == ESrcsMediaBT && iObexServer )
+ {
+ TSockAddr remoteAddr;
+ iObexServer->RemoteAddr( remoteAddr );
+
+ TBTSockAddr btSockAddr( remoteAddr );
+ TBTDevAddr devAddr = btSockAddr.BTAddr();
+
+ err = iSocketServer.Connect();
+ LOGGER_WRITE_1("iSocketServer.Connect err: %d", err );
+ if ( !err )
+ {
+ err = iLinkAdapter.Open( iSocketServer, devAddr );
+ LOGGER_WRITE_1("iLinkAdapter.Open err: %d", err );
+ }
+ // Ignore all BT link errors
+ err = KErrNone;
+ }
+
+ if ( err == KErrNone && !iFTPHandler )
+ {
+ TRAP( err, LoadFTPDllL() );
+ LOGGER_WRITE_1( "LoadFTPDllL returned : %d", err );
+ }
+
+ if ( err == KErrNone )
+ {
+ iFTPHandler->SetProfile( EStandard );
+ LOGGER_WRITE( "CSConFTPplugin::ObexConnectIndication() : iServiceTimer->StopTimer()" );
+ iServiceTimer->Cancel();
+ iServiceTimer->StopTimer();
+ }
+
+ TRACE_FUNC_EXIT;
+ LOGGER_WRITE_1( "CSConFTPplugin::ObexConnectIndication returned %d", err );
+ return TFTPpluginUtils::ConvertFTPResponseCode( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::ObexDisconnectIndication( const TDesC8& )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::ObexDisconnectIndication( const TDesC8& )
+ {
+ TRACE_FUNC_ENTRY;
+ Disconnect();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::TransportDownIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::TransportDownIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ Disconnect();
+ if ( iBuffer )
+ {
+ iBuffer->Reset();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::PutRequestIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+CObexBufObject* CSConFTPplugin::PutRequestIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+ iPutError = KErrNone;
+
+ if ( iBuffer )
+ {
+ iBuffer->Reset();
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) );
+
+ if ( err != KErrNone )
+ {
+ return NULL;
+ }
+
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return NULL;
+ }
+
+ TRAP( err, ret = iFTPHandler->PutFileObjectInitL( iObject, iBuffer ) );
+
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "iFTPHandler->PutFileObjectInitL() leaves: %d", err );
+ return NULL;
+ }
+ if ( ret != KErrNone )
+ {
+ LOGGER_WRITE_1( "PutFileObjectInitL failed - returning error in next PutPacketIndication : %d", ret );
+ iPutError = ret;
+ }
+ iPutPacketIndicationCalled = EFalse;
+
+ if ( !iShutdownWatcher )
+ {
+ TRAP( err, iShutdownWatcher = CShutdownWatcher::NewL( this ) );
+ if ( err == KErrNone )
+ {
+ iShutdownWatcher->StartShutdownWatcher();
+ }
+ else
+ {
+ LOGGER_WRITE_1( "CShutdownWatcher::NewL leaves: %d", err );
+ }
+ }
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // request active BT mode (high power mode)
+ err = iLinkAdapter.ActivateActiveRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err );
+ }
+
+ TRACE_FUNC_EXIT;
+ return( iObject );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::PutPacketIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::PutPacketIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ // always normal file transfer
+ if ( (TInt)iObject->Length() > 0 )
+ {
+ if ( !iPutPacketIndicationCalled )
+ {
+ // This is first check, need to check only once
+ TFileName path;
+ iFTPHandler->GetPath( path );
+ if ( path.CompareF( K_C_ROOT ) == 0 )
+ {
+ // path forbidden
+ ret = KErrAccessDenied;
+ }
+ else
+ {
+ if ( iPutError != KErrNone )
+ {
+ ret = iPutError;
+ LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() : PutError : %d", iPutError );
+ }
+ else
+ {
+ // check required free space
+ // if filesize is small ( <65k ) it fits into one package and its already saved to filesystem.
+ // if file is larger, need to check is there enought free space in device.
+
+ const TUint32 filesize = iObject->Length();
+ LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() filesize %d", filesize );
+ LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication() iObject->BytesReceived() %d", iObject->BytesReceived() );
+ if ( filesize > iObject->BytesReceived() )
+ {
+ LOGGER_WRITE( "CSConFTPplugin::PutPacketIndication() : check freespace" );
+ // file does not fit into one obex packet, check is there enought free space in current drive
+ if ( iFTPHandler->IsCurrentDiskSpaceBelowCritical( filesize ) )
+ {
+ LOGGER_WRITE( "CSConFTPplugin::PutPacketIndication() : returning KErrNoMemory" );
+ ret = KErrNoMemory;
+ }
+ }
+ }
+ }
+ }
+
+ if ( iShutdownInProgress )
+ {
+ LOGGER_WRITE( "ShutdownInProgress, abort" );
+ ret = KErrDisconnected;
+ }
+ }
+
+ if ( !iPutPacketIndicationCalled )
+ {
+ // Need to check only once
+ iPutPacketIndicationCalled = ETrue;
+
+ //Check if filename is too long.
+ TFileName path;
+ iFTPHandler->GetPath( path );
+ if ( ret == KErrNone && path.Length() + iObject->Name().Length() > KMaxFileName )
+ {
+ LOGGER_WRITE_1( "Name length overflow! : %d", path.Length() + iObject->Name().Length() );
+ ret = KErrBadName;
+ }
+ }
+
+ if ( ret != KErrNone )
+ {
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+ }
+
+ LOGGER_WRITE_1( "CSConFTPplugin::PutPacketIndication returned: %d", ret );
+ return TFTPpluginUtils::ConvertFTPResponseCode( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::PutCompleteIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::PutCompleteIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err2 = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 );
+ }
+
+ TObexHeaderMask validHdrs = iObject->ValidHeaders();
+ TTime time = iObject->Time();
+
+ // shutdownWatcher is not needed anymore
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ TInt size = iObject->BytesReceived();
+
+ if (!(validHdrs & KObexHdrTime))
+ {
+ LOGGER_WRITE( "CSConFTPplugin::PutCompleteIndication() no valid time header received - using hometime" );
+ time.HomeTime();
+ TRAP( ret, iObject->SetTimeL(time) );
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication SetTimeL %d", ret );
+ }
+
+ if ( ( validHdrs & KObexHdrBody ) || ( validHdrs & KObexHdrEndOfBody ) )
+ {
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : number of received bytes %d", size );
+ TSConUsedMedia media( ESConNoMedia );
+
+ switch ( iMediaType )
+ {
+ case ESrcsMediaBT:
+ media = ESConBTMedia;
+ break;
+ case ESrcsMediaIrDA:
+ media = ESConIRMedia;
+ break;
+ case ESrcsMediaUSB:
+ media = ESConUSBMedia;
+ break;
+ default:
+ media = ESConNoMedia;
+ break;
+ }
+ iFTPHandler->SetUsedMedia( media );
+
+ TRAP( ret, err =
+ this->iFTPHandler->PutFileObjectFinalizeL( iObject ) );
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication :PutFileObjectL %d", ret );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConFTPplugin::PutCompleteIndication() : Delete starts" );
+ TRAP( ret, err = this->iFTPHandler->DeleteObjectL( iObject->Name() ) );
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : DeleteObjectL %d", ret );
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ iFTPHandler->DeleteTempFile();
+
+ if ( ret != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : returned %d", ret );
+ return TFTPpluginUtils::ConvertFTPResponseCode( ret );
+ }
+
+ LOGGER_WRITE_1( "CSConFTPplugin::PutCompleteIndication : returned %d", err );
+ return TFTPpluginUtils::ConvertFTPResponseCode( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::GetRequestIndication( CObexBaseObject* aRequiredObject )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+CObexBufObject* CSConFTPplugin::GetRequestIndication(
+ CObexBaseObject* aRequiredObject )
+ {
+ TRACE_FUNC_ENTRY;
+ CObexBufObject* bufObject(NULL);
+ if ( aRequiredObject->Type().Length() > KSConHeaderMaxLength )
+ {
+ LOGGER_WRITE("TypeHeader too big");
+ return NULL;
+ }
+ if ( aRequiredObject->Name().Length() > KMaxFileName )
+ {
+ LOGGER_WRITE("NameHeader is too long");
+ return NULL;
+ }
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+ TBuf8<KSConHeaderMaxLength> typeHeader( aRequiredObject->Type() );
+ TrimRightSpaceAndNull( typeHeader );
+ LOGGER_WRITE8_1("type: %S", &typeHeader);
+ LOGGER_WRITE_1("name: %S", &aRequiredObject->Name());
+
+ iBuffer->Reset();
+
+ delete iObject;
+ iObject = NULL;
+
+ TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) );
+ if ( err != KErrNone )
+ {
+ return NULL;
+ }
+
+ // Client requests folder listing
+ if ( typeHeader == KSConFolderListType )
+ {
+ LOGGER_WRITE( "Client requests folder listning" );
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return NULL;
+ }
+
+ TRAP( err, ret = iFTPHandler->GetFolderObjectL( iObject ) );
+ LOGGER_WRITE_1( "iFTPHandler->GetFolderObjectL() returned: %d", ret );
+ if ( err == KErrNone && ret == KErrNone )
+ {
+ bufObject = iObject;
+ }
+ else
+ {
+ LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : Leavecode returned %d", err );
+ return NULL;
+ }
+ }
+
+ // Client requests a file
+ else
+ {
+ if ( iFileObject )
+ {
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ TRAP( err, iFileObject = CObexFileObject::NewL() );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE( "Creating iFileObject has failed" );
+ return NULL;
+ }
+ iFileObject->Reset();
+ TRAP( err, iFileObject->SetNameL( aRequiredObject->Name() ) );
+
+ if ( err == KErrNone )
+ {
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "CSConFTPplugin::GetRequestIndication() Creating iFTPHandler has failed" );
+ return NULL;
+ }
+
+ TRAP( err, ret =
+ this->iFTPHandler->GetFileObjectL( iFileObject ) );
+ LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : GetFileObjectL returned %d", ret );
+ }
+ if ( err == KErrNone && ret == KErrNone )
+ {
+ bufObject = (CObexBufObject*)iFileObject;
+ }
+ else
+ {
+ LOGGER_WRITE_1( "CSConFTPplugin::GetRequestIndication : Leavecode %d", err );
+ return NULL;
+ }
+ }
+ if ( bufObject && iLinkAdapter.IsOpen() )
+ {
+ // request active BT mode (high power mode)
+ err = iLinkAdapter.ActivateActiveRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err );
+ }
+ return bufObject;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::GetPacketIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::GetPacketIndication()
+ {
+ TRACE_FUNC;
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::GetCompleteIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::GetCompleteIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+
+ TInt ret( KErrNone );
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ LOGGER_WRITE_1( "CSConFTPplugin::GetCompleteIndication() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+// const TDesC8& aInfo )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+ const TDesC8& /*aInfo*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return TFTPpluginUtils::ConvertFTPResponseCode( KErrNoMemory );
+ }
+
+ if ( aPathInfo.iFlags == KSConNULLSetPath )
+ {
+ TRAP( err, ret = this->iFTPHandler->CreateFolderL( aPathInfo.iName ) );
+ }
+ else
+ {
+ TRAP( err, ret = this->iFTPHandler->SetPathL( aPathInfo.iName,
+ aPathInfo.iFlags ) );
+ }
+
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConFTPplugin::SetPathIndication : returned %d", err );
+ return TFTPpluginUtils::ConvertFTPResponseCode( err );
+ }
+ LOGGER_WRITE_1( "CSConFTPplugin::SetPathIndication : returned %d", ret );
+ return TFTPpluginUtils::ConvertFTPResponseCode( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::TrimRightSpaceAndNull( TDes8& aDes ) const
+// Removes spaces and nulls from the end of the string
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::TrimRightSpaceAndNull( TDes8& aDes ) const
+ {
+ TRACE_FUNC;
+ aDes.TrimRight();
+ if ( aDes.Length() > 0 )
+ {
+ if ( !aDes[aDes.Length() - 1] )
+ {
+ aDes.SetLength( aDes.Length() - 1 );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::SetMediaType ( TSrcsMediaType aMediaType )
+// Current used transfer media (IR,USB,BT)
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::SetMediaType ( TSrcsMediaType aMediaType )
+ {
+ TRACE_FUNC;
+ iMediaType = aMediaType;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::CSConFTPplugin()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConFTPplugin::CSConFTPplugin()
+ {
+ TRACE_FUNC;
+ iBuffer = NULL;
+ iObject = NULL;
+ iFileObject = NULL;
+ iSessionActive = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConFTPplugin::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iBuffer = CBufFlat::NewL( KSConBufSize );
+ iObject = CObexBufObject::NewL ( iBuffer );
+ iServiceTimer = new (ELeave) CSConServiceTimer( this, KSConTimeOutValue );
+ iServiceTimer->ConstructL();
+ CActiveScheduler::Add( iServiceTimer );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTPplugin::SetObexServer( CObexServer* aObexServer )
+// SetObexServer
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTPplugin::SetObexServer( CObexServer* aObexServer )
+ {
+ iObexServer = aObexServer;
+ TInt ret = iObexServer->Start(this);
+ LOGGER_WRITE_1( "CSConFTPplugin::SetObexServer() ret: %d", ret );
+ return ret;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/sconftppluginutils.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in utilities
+*
+*/
+
+
+// INCLUDE FILES
+#include <obexconstants.h>
+#include "sconftppluginutils.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TFTPpluginUtils::ConvertFTPResponseCode( TInt aError )
+// Converts Symbian error code to OBEX error code
+// -----------------------------------------------------------------------------
+//
+TInt TFTPpluginUtils::ConvertFTPResponseCode( TInt aError )
+ {
+ LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : begin Code %d", aError );
+ TInt obexErr ( KErrIrObexRespBadRequest );
+ switch( aError )
+ {
+ case KErrNone:
+ obexErr = KErrNone;
+ break;
+ case KErrNotFound:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrGeneral:
+ case KErrCancel:
+ obexErr = KErrIrObexRespBadRequest;
+ break;
+ case KErrNoMemory:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrNotSupported:
+ obexErr = KErrIrObexRespNotImplemented;
+ break;
+ case KErrArgument:
+ case KErrTotalLossOfPrecision:
+ case KErrBadHandle:
+ case KErrOverflow:
+ case KErrUnderflow:
+ case KErrAlreadyExists:
+ obexErr = KErrIrObexRespConflict;
+ break;
+ case KErrPathNotFound:
+ case KErrDied:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrInUse:
+ obexErr = KErrIrObexRespTimedOut;
+ break;
+ case KErrServerTerminated:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrServerBusy:
+ case KErrCompletion:
+ case KErrNotReady:
+ case KErrUnknown:
+ case KErrCorrupt:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrAccessDenied:
+ case KErrLocked:
+ obexErr = KErrIrObexRespUnauthorized;
+ break;
+ case KErrWrite:
+ case KErrDisMounted:
+ case KErrEof:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrDiskFull:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrBadDriver:
+ case KErrBadName:
+ obexErr = KErrIrObexRespPreCondFailed;
+ break;
+ case KErrCommsLineFail:
+ case KErrCommsFrame:
+ case KErrCommsOverrun:
+ case KErrCommsParity:
+ case KErrTimedOut:
+ case KErrCouldNotConnect:
+ case KErrCouldNotDisconnect:
+ case KErrBadLibraryEntryPoint:
+ case KErrBadDescriptor:
+ case KErrAbort:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrTooBig:
+ obexErr = KErrIrObexRespReqEntityTooLarge;
+ break;
+ case KErrDivideByZero:
+ case KErrBadPower:
+ case KErrDirFull:
+ case KErrHardwareNotAvailable:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrDisconnected: // System is shutting down
+ obexErr = KErrIrObexRespMethodNotAllowed;
+ break;
+ default:
+ obexErr = KErrIrObexRespBadRequest;
+ break;
+ };
+ LOGGER_WRITE_1( "TFTPpluginUtils::ConvertFTPResponseCode : returned %d", obexErr );
+ return obexErr;
+};
+
+//End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/sconservicetimer.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Profile Plug-in Service Timer implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconservicetimer.h"
+#include "sconftpplugin.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue )
+// Constuctor
+// -----------------------------------------------------------------------------
+//
+CSConServiceTimer::CSConServiceTimer( CSConFTPplugin* aEngine, TInt aValue )
+ : CActive( EPriorityStandard ), iEngine( aEngine ), iValue( aValue ) {}
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::ConstructL()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::ConstructL()" );
+ // create a thread-relative timer
+ User::LeaveIfError( iTimer.CreateLocal() );
+ LOGGER_LEAVEFN( "CSConServiceTimer::ConstructL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::~CSConServiceTimer()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConServiceTimer::~CSConServiceTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::~CSConServiceTimer()" );
+ iTimer.Close();
+ LOGGER_LEAVEFN( "CSConServiceTimer::~CSConServiceTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::~CSConServiceTimer()
+// Starts the timer
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::StartTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::StartTimer()" );
+ if( !IsActive() )
+ {
+ LOGGER_WRITE( "CSConServiceTimer::StartTimer() : !IsActive()" );
+ iTimer.After( iStatus, TTimeIntervalMicroSeconds32( iValue ) );
+ iEngine->iSessionActive = ETrue;
+ SetActive();
+ LOGGER_WRITE( "CSConServiceTimer::StartTimer() : SetActive()" );
+ }
+ LOGGER_LEAVEFN( "CSConServiceTimer::StartTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::StopTimer()
+// StopTimer()
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::StopTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::StopTimer()" );
+ iEngine->iSessionActive = ETrue;
+ LOGGER_WRITE( "CSConServiceTimer::StopTimer() : iSessionActive = ETrue" );
+ LOGGER_LEAVEFN( "CSConServiceTimer::StopTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::DoCancel()
+// Cancels the timer
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::DoCancel()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::DoCancel()" );
+ iTimer.Cancel();
+ LOGGER_LEAVEFN( "CSConServiceTimer::DoCancel()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::RunL()
+// Executed when timer is triggered
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::RunL()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::RunL()" );
+ iEngine->iSessionActive = EFalse;
+ LOGGER_WRITE( "CSConServiceTimer::RunL() : iSessionActive = EFalse" );
+ iEngine->iStartTimer = EFalse;
+ LOGGER_WRITE( "CSConServiceTimer::RunL() : iStartTimer = EFalse " );
+ LOGGER_LEAVEFN( "CSConServiceTimer::RunL()" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/ftp/src/sconshutdownwatcher.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Power shutdown -watcher implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconshutdownwatcher.h"
+#include "debug.h"
+
+#include <startupdomainpskeys.h>
+
+
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::NewL( MShutdownObserver* aObserver )
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher* CShutdownWatcher::NewL( MShutdownObserver* aObserver )
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::NewL()" );
+ CShutdownWatcher* self = new (ELeave) CShutdownWatcher( aObserver );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ LOGGER_LEAVEFN( "CShutdownWatcher::NewL()" );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::~CShutdownWatcher()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher::~CShutdownWatcher()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::~CShutdownWatcher()" );
+ Cancel();
+ iProperty.Close();
+ LOGGER_LEAVEFN( "CShutdownWatcher::~CShutdownWatcher()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::StartShutdownWatcher()
+// Starts to watch shutdown status
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::StartShutdownWatcher()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::StartShutdownWatcher()" );
+ TInt status;
+ TInt err = iProperty.Get( KPSUidStartup, KPSGlobalSystemState, status );
+ LOGGER_WRITE_2( "CShutdownWatcher::StartShutdownWatcher() :\
+ err %d, KPSGlobalSystemState status %d", err, status);
+ if ( err == KErrNone )
+ {
+ if ( status == ESwStateShuttingDown )
+ {
+ LOGGER_WRITE( "Call NotifyShutdown" );
+ iObserver->NotifyShutdown();
+ return;
+ }
+ }
+
+ err = iProperty.Attach( KPSUidStartup, KPSGlobalSystemState );
+ LOGGER_WRITE_1( "CShutdownWatcher::StartShutdownWatcher() :\
+ iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) : err %d", err );
+ iProperty.Subscribe( iStatus );
+ LOGGER_WRITE( "CShutdownWatcher::StartShutdownWatcher() :\
+ iProperty.Subscribe( iStatus ) : ok" );
+ SetActive();
+
+ LOGGER_LEAVEFN( "CShutdownWatcher::StartShutdownWatcher()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::DoCancel()
+// Executed when CActive is canceled.
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::DoCancel()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::DoCancel()" );
+ iProperty.Cancel();
+ LOGGER_LEAVEFN( "CShutdownWatcher::DoCancel()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::RunL()
+// Executed when disk watcher is triggered
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::RunL()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::RunL()" );
+ TInt status;
+ iProperty.Get( status );
+ LOGGER_WRITE_1( "CShutdownWatcher::RunL() : status %d", status );
+
+ if ( status == ESwStateShuttingDown )
+ {
+ LOGGER_WRITE( "Call NotifyShutdown" );
+ iObserver->NotifyShutdown();
+ return;
+ }
+
+ iProperty.Cancel();
+ iProperty.Close();
+
+ LOGGER_LEAVEFN( "CShutdownWatcher::RunL()" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver )
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver )
+: CActive(EPriorityStandard),
+ iObserver(aObserver)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::ConstructL()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::ConstructL()" );
+ CActiveScheduler::Add(this);
+ LOGGER_LEAVEFN( "CShutdownWatcher::ConstructL()" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/data/2001FE54.rss Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2001 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Plugin info file.
+*
+*/
+
+
+#include "ecom/registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x2001FE54;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x101F7C8C;
+ implementations =
+ {
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x2001FE53;
+ version_no = 1;
+ display_name = "Haptics Bridge";
+ default_data = "OBEX/USB||OBEX/BT";
+ //
+ // opaque_data contains parameters used by following API calls in SRCS:
+ // 1. Setup USB interface string descriptor in Unicode;
+ // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo);
+ // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService,
+ // TInt aProtocol,
+ // TInt aChannel,
+ // TBool aAuthenticate,
+ // TBool aAuthorise,
+ // TBool aEncrypt );
+ // opaque_data = "@0||@1||@2||@3||@4||@5||@6"
+ // @0 aStrDesc e.g. "PC Connectivity"
+ // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
+ // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106
+ // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013
+ // @4 aAuthenticate e.g. EFalse, 0
+ // @5 aAuthorise e.g. EFalse, 0
+ // @6 aEncrypt e.g. EFalse, 0
+ //
+ opaque_data = "Haptics Bridge|"\
+ "|\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09|"\
+ "|0x2001E2B5|"\
+ "|0x1013|"\
+ "|0|"\
+ "|1|"\
+ "|0|"\
+ "|0xffff|"\
+ "|0xffff";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Haptics connection plugin build file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/hapticsconnplugin.iby CORE_IBY_EXPORT_PATH(mw, hapticsconnplugin.iby)
+
+PRJ_MMPFILES
+hapticsconnplugin.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/group/hapticsconnplugin.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Haptics connection plugin project definition file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET hapticsconnplugin.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x2001FE54
+
+SOURCEPATH ../src
+
+SOURCE hapticsconnplugin.cpp
+SOURCE hapticsconntimer.cpp
+SOURCE hapticsmsghandler.cpp
+SOURCE hapticsbridgeclient.cpp
+SOURCE proxy.cpp
+
+SOURCEPATH ../data
+
+START RESOURCE 2001FE54.rss
+ TARGET hapticsconnplugin.rsc
+END
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/stdapis
+
+USERINCLUDE ../inc
+
+LIBRARY flogger.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY platformenv.lib
+LIBRARY irobex.lib
+LIBRARY hwrmhapticspacketizer.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsbridgeclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Client interface to haptics server for haptics bridge
+* commands.
+*
+*/
+
+
+#ifndef C_HAPTICSBRIDGECLIENT_H
+#define C_HAPTICSBRIDGECLIENT_H
+
+#include <e32base.h>
+
+class CHWRMHapticsPacketizer;
+
+class RHapticsBridgeClient : public RSessionBase
+{
+public:
+ /**
+ * Constructor
+ */
+ RHapticsBridgeClient();
+
+ /**
+ * Destructor
+ */
+ virtual ~RHapticsBridgeClient();
+
+public:
+ /**
+ * Create a connection to haptics server.
+ */
+ TInt Connect();
+
+ /**
+ * Close the connection to haptics server.
+ */
+ void Close();
+
+ /**
+ * Send message to haptics server.
+ * @param aReqData Data request to be sent to haptics server.
+ * @param aRetDataPckg Returned data from haptics server.
+ * @return KErrNone if sent succesfully, otherwise system wide error code.
+ */
+ TInt SendBridgeBuffer( const TDesC8& aReqData, TDes8& aRetDataPckg );
+
+ /**
+ * Sends a message clean-up commend to haptics server.
+ */
+ void CleanUp();
+
+
+private:
+
+ /**
+ * Returns the version of the haptics server.
+ * @return Version.
+ */
+ TVersion ServerVersion() const;
+
+ /**
+ * Starts the server process if it is not already running.
+ * @return KErrNone on success, otherwise a system error code.
+ */
+ TInt StartServer() const;
+
+ /**
+ * Handles the device opening request.
+ * @param aResponse Reference to a descriptor containing the response
+ * received from haptics server.
+ */
+ void HandleOpenDeviceResponseL( const TDesC8& aResponse );
+
+ /**
+ * Opens the haptic effect ("vibra") device.
+ * @return KErrNone on success, otherwise a system error code.
+ */
+ TInt OpenHapticsDevice();
+
+private:
+
+ /**
+ * Haptic packetizer.
+ * Owned.
+ */
+ CHWRMHapticsPacketizer* iPacketizer;
+};
+
+#endif // C_HAPTICSBRIDGECLIENT_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconnplugin.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Haptics OBEX connection plugin.
+*
+*/
+
+
+#ifndef C_HAPTICSCONNPLUGIN_H
+#define C_HAPTICSCONNPLUGIN_H
+
+#include <obexserver.h>
+#include <SrcsInterface.h>
+
+class CHapticsMsgHandler;
+
+class CHapticsConnPlugin : public CSrcsInterface
+ {
+ public:
+ /**
+ * 2-phased constructor.
+ */
+ static CHapticsConnPlugin* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHapticsConnPlugin();
+
+ /**
+ * From CSrcsInterface.
+ * @see CSrcsInterface.
+ */
+ TBool IsOBEXActive();
+
+ private:
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Constructor.
+ */
+ CHapticsConnPlugin();
+
+ private:
+ /**
+ * Component to handle messages between file systen and
+ * haptics server.
+ * Own.
+ */
+ CHapticsMsgHandler* iMsgHandler;
+ };
+
+#endif // C_HAPTICSCONNPLUGIN_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntimer.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection shutdown timer for haptics server connection.
+*
+*/
+
+
+#ifndef C_HAPTICSCONNTIMER_H
+#define C_HAPTICSCONNTIMER_H
+
+#include <e32base.h>
+
+#include "hapticsmsghandler.h"
+
+NONSHARABLE_CLASS ( CHapticsConnTimer ) : public CTimer
+ {
+ public:
+ /**
+ * 2-phased constructor.
+ */
+ static CHapticsConnTimer* NewL( MHapticsConnectionShutdown* aCallback );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CHapticsConnTimer();
+
+ /**
+ * Starts the timer
+ */
+ void Start();
+
+ private: // From CActive.
+ /**
+ * Notifies client on timeout.
+ */
+ void RunL();
+
+ private:
+ /**
+ * Constructor.
+ */
+ CHapticsConnTimer( MHapticsConnectionShutdown* aCallback );
+
+ /**
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+
+ private:
+ /**
+ * Callback interface to notify about timeout.
+ * Not own.
+ */
+ MHapticsConnectionShutdown* iCallback;
+ };
+
+#endif // C_HAPTICSCONNTIMER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsconntrace.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Haptics conn plugin debug trace macro definition header file.
+*
+*/
+#ifndef HAPTICSCONNTRACE_H
+#define HAPTICSCONNTRACE_H
+
+#include <bldvariant.hrh>
+#include <e32svr.h>
+#include <e32std.h>
+#include <e32svr.h>
+#include <flogger.h>
+
+/**
+ * Writes formatted string data to a file using RFileLogger.
+ *
+ * @param aFmt Value-referenced descriptor containing the formatted string.
+ */
+inline void HwrmWriteFormat( TRefByValue<const TDesC> aFmt, ... )
+ {
+ _LIT( KDir, "Hwrm" );
+ _LIT( KName, "Hwres.log" );
+
+ // take the ellipsis parameters
+ VA_LIST args;
+ VA_START( args, aFmt );
+ RFileLogger::WriteFormat( KDir, KName, EFileLoggingModeAppend, aFmt, args );
+ VA_END( args );
+ }
+
+/**
+ * Writes data dump in hex format in "[ 00 01 FF ]" style.
+ *
+ * @param aPrefix Descriptor containing the string to be appended in
+ * front of the actual data dump.
+ * @param aData An 8-bit descriptor containing the data buffer for which
+ * the data dump is written.
+ */
+inline void DataDumpTrace( const TDesC& aPrefix, const TDesC8& aData )
+ {
+ _LIT( KSATraceDataDumpStart, " [ " );
+ _LIT( KSATraceDataDumpLineAlign, " " );
+ _LIT( KSATraceDataDumpStop, " ] " );
+ _LIT( KSATraceDataDumpValue, "%02x " );
+ const TInt KSASDataDumpTraceBytesPerLine = 10;
+
+ HBufC* buffer = HBufC::New( 255 );
+
+ if ( buffer != NULL )
+ {
+ buffer->Des().Copy( aPrefix );
+ buffer->Des().Append( KSATraceDataDumpStart );
+ for ( TInt i = 0; i < aData.Length(); i++)
+ {
+ buffer->Des().AppendFormat( KSATraceDataDumpValue, aData[i] );
+
+ if( ( i % KSASDataDumpTraceBytesPerLine == ( KSASDataDumpTraceBytesPerLine - 1 ) ) &&
+ ( i + 1 < aData.Length() ) )
+ {
+ RDebug::Print( buffer->Des() );
+
+ buffer->Des().Copy( aPrefix);
+ buffer->Des().Append( KSATraceDataDumpLineAlign );
+ }
+ }
+ buffer->Des().Append( KSATraceDataDumpStop );
+
+ RDebug::Print( buffer->Des() );
+
+ }
+
+ delete buffer;
+ }
+
+#ifdef _DEBUG
+
+ #ifdef USE_FILE_LOGGING
+
+ #define COMPONENT_TRACE( a ) HwrmWriteFormat a
+ #define API_TRACE( a ) HwrmWriteFormat a
+ #define DATADUMP_TRACE( a, b )
+
+ #else
+
+ #define COMPONENT_TRACE( a ) RDebug::Print a
+ #define API_TRACE( a ) RDebug::Print a
+ #define DATADUMP_TRACE( a, b ) DataDumpTrace( a, b )
+
+ #endif // #ifdef USE_FILE_LOGGING
+
+#else // #ifdef _DEBUG
+
+ #define COMPONENT_TRACE( a )
+ #define API_TRACE( a )
+ #define DATADUMP_TRACE( a, b )
+
+#endif //#ifdef _DEBUG
+#endif //#ifndef HAPTICSCONNTRACE_H
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/inc/hapticsmsghandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handles messaging between file system and haptics
+* client interface.
+*
+*/
+
+
+#ifndef C_HAPTICSMSGHANDLER_H
+#define C_HAPTICSMSGHANDLER_H
+
+#include <e32base.h>
+#include <e32debug.h>
+#include <f32file.h>
+
+#include "hapticsbridgeclient.h"
+
+class CHapticsConnTimer;
+
+/**
+ * Interface to notify about connection timeout.
+ */
+class MHapticsConnectionShutdown
+ {
+ public:
+ /**
+ * Called to notify about connection timeout.
+ */
+ virtual void NotifyShutdown() = 0;
+
+ };
+
+/**
+ * Helper class for Bridge functionality for handling RFs (File Session)
+ * change notifications for VibeTonz request file.
+ *
+ * @since S60 5.1
+ */
+class CHapticsMsgHandler : public CActive,
+ public MHapticsConnectionShutdown
+ {
+public:
+ /**
+ * 2-phased constructor.
+ */
+ static CHapticsMsgHandler* NewL();
+
+ /**
+ * Destructor
+ */
+ virtual ~CHapticsMsgHandler();
+
+ /**
+ * Method for starting the listening for change notifications
+ */
+ void StartNotifier();
+
+ /**
+ * From MHapticsConnectionShutdown.
+ * Called to notify about connection timeout.
+ */
+ void NotifyShutdown();
+
+protected: // From CActive.
+ /**
+ * @see CActive
+ */
+ void RunL();
+ /**
+ * @see CActive
+ */
+ TInt RunError(TInt aError);
+ /**
+ * @see CActive
+ */
+ void DoCancel();
+
+private:
+
+ /**
+ * Constructor
+ */
+ CHapticsMsgHandler();
+
+ /**
+ * Two-phase construction ConstructL
+ */
+ void ConstructL();
+
+ /**
+ * Method for connecting to file system. Also sets the paths and
+ * creates directories (if not already exists).
+ */
+ void ConnectToFilesystemL();
+
+ /**
+ * Helper for clearing the possible left-over request file from
+ * previous runs.
+ */
+ void ClearRequestFile();
+
+private: // data
+
+ /**
+ * File server session through which all file server related
+ * services are requested.
+ */
+ RFs iFs;
+
+ /**
+ * Buffer for the request file data
+ */
+ HBufC8* iReqBuf;
+
+ /**
+ * The RHapticsBridgeClient object that is responsible for further
+ * handling of received Bridge commands
+ */
+ RHapticsBridgeClient iClient;
+
+ CHapticsConnTimer* iConnectionTimeout;
+
+ };
+
+#endif // C_HAPTICSMSGHANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/rom/hapticsconnplugin.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for Haptics conn plugin.
+*
+*/
+
+
+#ifndef HAPTICSCONNPLUGIN_IBY
+#define HAPTICSCONNPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN(hapticsconnplugin.dll,hapticsconnplugin.rsc)
+
+#endif // HAPTICSCONNPLUGIN_IBY
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsbridgeclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,317 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Client interface to haptics server for haptics bridge
+* commands.
+*
+*/
+
+
+#include <e32svr.h>
+#include <f32file.h>
+#include <data_caging_path_literals.hrh> // KDC_PROGRAMS_DIR
+#include <hwrmhaptics.h>
+#include <hwrmlogicalactuators.h>
+#include <hwrmhapticspacketizer.h>
+
+#include "hapticsbridgeclient.h"
+#include "hapticsconntrace.h"
+
+const TInt KServerVersionMajor = 1;
+const TInt KServerVersionMinor = 1;
+const TInt KServerVersionBuild = 1;
+_LIT( KServerProcessName, "!hwrmhapticsserver" );
+_LIT( KServerExeName, "hwrmhapticsserver.exe" );
+const TInt KAsyncMsgSlots = 10;
+
+const TInt KHWRMHapticsServiceCommand = 2001;
+const TInt KHWRMHapticsOpenActuatorCommand = 2004;
+const TInt KHWRMHapticsCleanupCommand = 2008;
+const TInt KHWRMHapticsBridgeCommand = 2011;
+
+// --------------------------------------------------------------------------
+// Simple constructor
+//
+// --------------------------------------------------------------------------
+//
+RHapticsBridgeClient::RHapticsBridgeClient()
+ {
+ TRAP_IGNORE( iPacketizer =
+ CHWRMHapticsPacketizer::NewL( EHWRMLogicalActuatorAny ) );
+ }
+
+// --------------------------------------------------------------------------
+// Simple destructor
+//
+// --------------------------------------------------------------------------
+//
+RHapticsBridgeClient::~RHapticsBridgeClient()
+ {
+ delete iPacketizer;
+ }
+
+// --------------------------------------------------------------------------
+// Method for connecting (creating a new session) with Haptics Server
+//
+// --------------------------------------------------------------------------
+//
+TInt RHapticsBridgeClient::Connect()
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::Connect()" ) ) );
+ TInt ret = CreateSession( KServerProcessName,
+ ServerVersion(),
+ KAsyncMsgSlots );
+ if ( ret != KErrNone )
+ {
+ ret = StartServer();
+ if ( ret == KErrNone )
+ {
+ ret = CreateSession( KServerProcessName,
+ ServerVersion(),
+ KAsyncMsgSlots );
+ COMPONENT_TRACE(_L("RHapticsBridgeClient::Connect(), Session created"));
+ }
+ }
+
+ // Initialize server components.
+ if ( ret == KErrNone )
+ {
+ ret = SendReceive( KHWRMHapticsServiceCommand );
+ }
+
+ // Open the haptic effect ("vibra") device.
+ if ( ret == KErrNone )
+ {
+ ret = OpenHapticsDevice();
+ }
+
+
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::Connect - return(%d)" ), ret ) );
+ return ret;
+ }
+
+// --------------------------------------------------------------------------
+// Method for starting Haptics Server (if not already running)
+//
+// --------------------------------------------------------------------------
+//
+TInt RHapticsBridgeClient::StartServer() const
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::StartServer()" ) ) );
+
+ TParse parser;
+ parser.Set( KServerExeName, &KDC_PROGRAMS_DIR, NULL );
+
+ RProcess server;
+ TInt ret = server.Create( parser.FullName(), KNullDesC );
+
+ if ( ret != KErrNone ) // Loading failed.
+ {
+ return ret;
+ }
+
+ TRequestStatus status;
+ server.Rendezvous( status );
+
+ if ( status != KRequestPending )
+ {
+ server.Kill( 0 ); // Abort startup.
+ server.Close();
+ return KErrGeneral;
+ }
+ else
+ {
+ server.Resume(); // Logon OK - start the server.
+ }
+
+ User::WaitForRequest( status );
+ server.Close();
+
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::StartServer() - return %d" ), status.Int() ) );
+ return status.Int();
+ }
+
+// --------------------------------------------------------------------------
+// Method for closing session to haptics server.
+//
+// --------------------------------------------------------------------------
+//
+void RHapticsBridgeClient::Close()
+ {
+ RSessionBase::Close();
+ }
+
+// --------------------------------------------------------------------------
+// Getter method for server version.
+//
+// --------------------------------------------------------------------------
+//
+TVersion RHapticsBridgeClient::ServerVersion() const
+ {
+ return TVersion( KServerVersionMajor,
+ KServerVersionMinor,
+ KServerVersionBuild );
+ }
+
+// --------------------------------------------------------------------------
+// Method for sending commands to Haptics Server.
+//
+// --------------------------------------------------------------------------
+//
+TInt RHapticsBridgeClient::SendBridgeBuffer( const TDesC8& aReqData, TDes8& aRetDataPckg )
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::SendBridgeBufferL() - Begin" ) ) );
+
+ TInt retVal( KErrDisconnected );
+ if ( iHandle )
+ {
+ TInt vibeStatus(0);
+ TPckg<TInt> vibeStatusPckg( vibeStatus );
+ retVal = SendReceive( KHWRMHapticsBridgeCommand,
+ TIpcArgs( &aReqData,
+ &vibeStatusPckg,
+ &aRetDataPckg ) );
+
+ if ( retVal == KErrNone )
+ {
+ TRAP( retVal, HandleOpenDeviceResponseL( aRetDataPckg ) );
+ }
+ }
+
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::SendBridgeBufferL() - End (%d)" ), retVal ) );
+ return retVal;
+ }
+
+// --------------------------------------------------------------------------
+// Method for cleaning up session to Haptics Server.
+//
+// --------------------------------------------------------------------------
+//
+void RHapticsBridgeClient::CleanUp()
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::CleanUp() - Begin" ) ) );
+ if ( iHandle )
+ {
+ SendReceive ( KHWRMHapticsCleanupCommand );
+ }
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::CleanUp() - End" ) ) );
+ }
+
+// --------------------------------------------------------------------------
+// Method for handling Open Device responses (basically for requesting the
+// setting of the license key).
+//
+// --------------------------------------------------------------------------
+//
+void RHapticsBridgeClient::HandleOpenDeviceResponseL( const TDesC8& aResponse )
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - Begin" ) ) );
+ TInt err( KErrNone );
+ if ( !iPacketizer )
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - No Packetizer!" ) ) );
+ User::Leave( KErrGeneral );
+ }
+ else
+ {
+ const TUint8* pRsp ( aResponse.Ptr() );
+ if ( 0x12 == pRsp[0] && 0x00 == pRsp[1] && 0x00 == pRsp[2] )
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - OPEN DEVICE RESPONSE handling" ) ) );
+ iPacketizer->DecodeMessageL( aResponse, err );
+ if ( !err )
+ {
+ RBuf8 reqBuf;
+ err = iPacketizer->EncSetPlatformLicenseKeyReq(
+ iPacketizer->DeviceHandle(), reqBuf );
+ if ( !err )
+ {
+ TBuf8<50> dummyRetBuf;
+ TInt dummyStatus;
+ TPckg<TInt> dummyStatusPckg( dummyStatus );
+ err = SendReceive( KHWRMHapticsBridgeCommand,
+ TIpcArgs ( &reqBuf,
+ &dummyStatusPckg,
+ &dummyRetBuf ) );
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - Sent set license command (%d)"), err ) );
+ }
+ reqBuf.Close();
+ }
+ User::LeaveIfError( err );
+ }
+ }
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::HandleOpenDeviceResponse() - End" ) ) );
+ }
+
+
+// --------------------------------------------------------------------------
+// Method for opening haptics device. This is needed since there's possibility
+// that no other haptics client has opened the device prior to this bridge
+// connectivity. This method also call set license key, i.e., completes the
+// device opening.
+//
+// --------------------------------------------------------------------------
+//
+TInt RHapticsBridgeClient::OpenHapticsDevice()
+ {
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Begin" ) ) );
+ TInt err( KErrGeneral );
+ if ( iPacketizer )
+ {
+ RBuf8 openDevReqBuf;
+ RBuf8 setLicenseReqBuf;
+ TBuf8<50> setLicenseRspBuf;
+ TInt dummyStatus;
+ TPckg<TInt> dummyStatusPckg( dummyStatus );
+
+ err = iPacketizer->EncOpenDeviceReq( EHWRMLogicalActuatorAny,
+ openDevReqBuf );
+
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - EncOpenDevice (%d)" ), err ) );
+ if ( !err )
+ {
+ TInt deviceHandle;
+ TPckg<TInt> deviceHandlePckg( deviceHandle );
+ err = SendReceive( KHWRMHapticsOpenActuatorCommand,
+ TIpcArgs ( &openDevReqBuf,
+ &deviceHandlePckg,
+ EHWRMLogicalActuatorAny ) );
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Send OpenDevice (%d)" ), err ) );
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Device handle = %d" ), deviceHandle ) );
+ if ( !err )
+ {
+ err = iPacketizer->EncSetPlatformLicenseKeyReq(
+ deviceHandle, setLicenseReqBuf );
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - EncSetEmptyLicenseKey (%d)" ), err ) );
+ if ( !err )
+ {
+ TBuf8<50> dummyRspBuf;
+ TInt dummyStatus;
+ TPckg<TInt> dummyStatusPckg( dummyStatus );
+ err = SendReceive( KHWRMHapticsBridgeCommand,
+ TIpcArgs ( &setLicenseReqBuf,
+ &dummyStatusPckg,
+ &dummyRspBuf ) );
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - Send SetLicense (%d)" ), err ) );
+ }
+ }
+ }
+
+ openDevReqBuf.Close();
+ setLicenseReqBuf.Close();
+ }
+ COMPONENT_TRACE( ( _L( "RHapticsBridgeClient::OpenHapticsDevice - End (err=%d)" ),err ) );
+ return err;
+ }
+
+// eof
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconnplugin.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Haptics OBEX connection plugin.
+*
+*/
+
+
+#include "hapticsconnplugin.h"
+#include "hapticsmsghandler.h"
+#include "hapticsconntrace.h"
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::NewL()
+// Two-phase constructing
+// -----------------------------------------------------------------------------
+//
+CHapticsConnPlugin* CHapticsConnPlugin::NewL()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::NewL - Begin" ) ) );
+ CHapticsConnPlugin* self = new ( ELeave ) CHapticsConnPlugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::NewL - End" ) ) );
+ return( self );
+ }
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::ConstructL()
+//
+// -----------------------------------------------------------------------------
+//
+void CHapticsConnPlugin::ConstructL()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::ConstructL() - Begin" ) ) );
+ iMsgHandler = CHapticsMsgHandler::NewL();
+ iMsgHandler->StartNotifier();
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::ConstructL() - End" )));
+ }
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::~CHapticsConnPlugin()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CHapticsConnPlugin::~CHapticsConnPlugin()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::~CHapticsConnPlugin() - Begin" ) ) );
+ delete iMsgHandler;
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::~CHapticsConnPlugin() - End" ) ) );
+ }
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::CHapticsConnPlugin()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CHapticsConnPlugin::CHapticsConnPlugin()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::IsOBEXActive()
+//
+// -----------------------------------------------------------------------------
+//
+TBool CHapticsConnPlugin::IsOBEXActive()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsConnPlugin::IsOBEXActive" ) ));
+ return ETrue;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsconntimer.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Connection shutdown timer for haptics server connection.
+*
+*/
+
+
+#include "hapticsconntimer.h"
+
+const TInt KHapticsConnectionTimeout = 30000000; // 30 sec.
+
+// ---------------------------------------------------------------------------
+// Two phased constructor.
+// ---------------------------------------------------------------------------
+//
+CHapticsConnTimer* CHapticsConnTimer::NewL( MHapticsConnectionShutdown* aCallback )
+ {
+ CHapticsConnTimer* self = new ( ELeave ) CHapticsConnTimer(aCallback);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CHapticsConnTimer::~CHapticsConnTimer()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Activates this timer.
+// ---------------------------------------------------------------------------
+//
+void CHapticsConnTimer::Start()
+ {
+ After( KHapticsConnectionTimeout );
+ }
+
+// ---------------------------------------------------------------------------
+// Constructor of the shutdown timer.
+// ---------------------------------------------------------------------------
+//
+CHapticsConnTimer::CHapticsConnTimer( MHapticsConnectionShutdown* aCallback )
+ : CTimer( EPriorityStandard ), iCallback(aCallback)
+ {
+ CActiveScheduler::Add( this );
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase construction.
+// ---------------------------------------------------------------------------
+//
+void CHapticsConnTimer::ConstructL()
+ {
+ CTimer::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHapticsConnTimer::RunL()
+ {
+ iCallback->NotifyShutdown();
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/hapticsmsghandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handles messaging between file system and haptics
+* client interface.
+*
+*/
+
+
+#include <f32file.h>
+#include <bautils.h>
+#include <pathinfo.h>
+#include <hwrmhaptics.h>
+
+#include "hapticsmsghandler.h"
+#include "hapticsconntimer.h"
+#include "hapticsconntrace.h"
+
+_LIT( KVibeTonzFolder,"VibeTonz\\" );
+_LIT( KSourceFileName,"VibeTonzDataReq" );
+_LIT( KTargetFileName,"VibeTonzDataRsp" );
+
+// ---------------------------------------------------------------------------
+// CHapticsMsgHandler* CHapticsMsgHandler::NewL()
+// ---------------------------------------------------------------------------
+//
+CHapticsMsgHandler* CHapticsMsgHandler::NewL()
+ {
+ CHapticsMsgHandler* self = new (ELeave) CHapticsMsgHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Default C++ constructor
+// ---------------------------------------------------------------------------
+//
+CHapticsMsgHandler::CHapticsMsgHandler () : CActive( EPriorityStandard )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// void CHapticsMsgHandler::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::ConstructL()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConstructL - Begin") ) );
+ CActiveScheduler::Add( this );
+ ConnectToFilesystemL();
+ iConnectionTimeout = CHapticsConnTimer::NewL(this);
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConstructL - End") ) );
+ }
+
+// ---------------------------------------------------------------------------
+// CHapticsMsgHandler::~CHapticsMsgHandler()
+// ---------------------------------------------------------------------------
+//
+CHapticsMsgHandler::~CHapticsMsgHandler()
+ {
+ Cancel();
+
+ if ( iConnectionTimeout )
+ {
+ iConnectionTimeout->Cancel();
+ delete iConnectionTimeout;
+ }
+
+ delete iReqBuf;
+
+ iClient.Close();
+ iFs.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// void ClearRequestFile()
+// ---------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::ClearRequestFile()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ClearRequestFile - Begin") ) );
+
+ TFindFile findDataFile( iFs );
+
+ TFileName sourcefile = PathInfo::PhoneMemoryRootPath();
+ sourcefile.Append( PathInfo::OthersPath() );
+ sourcefile.Append( KVibeTonzFolder );
+ sourcefile.Append( KSourceFileName );
+
+ if( findDataFile.FindByDir( sourcefile, KNullDesC ) == KErrNone )
+ {
+ COMPONENT_TRACE( _L("CHapticsMsgHandler::ClearRequestFile - Deleting REQ file") );
+ iFs.Delete( KSourceFileName );
+ }
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ClearRequestFile - End") ) );
+ }
+// ---------------------------------------------------------------------------
+// void ConnectToFilesystem()
+// ---------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::ConnectToFilesystemL()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConnectToFilesystemL - Begin") ) );
+ User::LeaveIfError( iFs.Connect() );
+
+ TFileName sessionPath = PathInfo::PhoneMemoryRootPath();
+ sessionPath.Append( PathInfo::OthersPath() );
+ sessionPath.Append( KVibeTonzFolder );
+ TBool folderExists = BaflUtils::FolderExists( iFs, sessionPath );
+
+ if( folderExists )
+ {
+ User::LeaveIfError( iFs.SetSessionPath( sessionPath ) );
+ ClearRequestFile();
+ }
+ else
+ {
+ User::LeaveIfError( iFs.MkDir( sessionPath ) );
+ User::LeaveIfError( iFs.SetSessionPath( sessionPath ) );
+ }
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::ConnectToFilesystemL - End") ) );
+ }
+
+// ---------------------------------------------------------------------------
+// CHapticsMsgHandler::StartNotifier()
+// ---------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::StartNotifier()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - Begin" ) ) );
+ if ( !IsActive() )
+ {
+ TFileName sessionPath = PathInfo::PhoneMemoryRootPath();
+ sessionPath.Append( PathInfo::OthersPath() );
+ sessionPath.Append( KVibeTonzFolder );
+ iFs.NotifyChange( ENotifyAll, iStatus, sessionPath );
+ SetActive();
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - Started" ) ) );
+ }
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::StartNotifier - End" ) ) );
+ }
+
+// ---------------------------------------------------------------------------
+// CHapticsMsgHandler::RunL()
+// ---------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::RunL()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunL - Begin" ) ) );
+
+ StartNotifier(); // re-subscribe for change notifications.
+
+ TFindFile findDataFile(iFs);
+ TFileName sourcefileName = PathInfo::PhoneMemoryRootPath();
+ sourcefileName.Append( PathInfo::OthersPath() );
+ sourcefileName.Append( KVibeTonzFolder );
+ sourcefileName.Append( KSourceFileName );
+
+ if( findDataFile.FindByDir( sourcefileName, KNullDesC ) == KErrNone )
+ {
+ COMPONENT_TRACE( ( _L("CHapticsMsgHandler::RunL - found request file") ) );
+
+ RFile sourceFile;
+ TInt sourceFileSize;
+
+ User::LeaveIfError( sourceFile.Open( iFs, sourcefileName, EFileShareAny ) );
+ CleanupClosePushL( sourceFile );
+ sourceFile.Size( sourceFileSize );
+
+ iReqBuf = HBufC8::NewL( sourceFileSize );
+ TPtr8 reqBufPtr = iReqBuf->Des();
+ sourceFile.Read( reqBufPtr );
+ CleanupStack::PopAndDestroy( &sourceFile );
+
+ ClearRequestFile();
+
+ DATADUMP_TRACE( _L("CHapticsMsgHandler::RunL - request data dump:"), reqBufPtr );
+
+ if ( !iClient.Handle() )
+ {
+ User::LeaveIfError( iClient.Connect() );
+ }
+
+ TBuf8<256> retData;
+ TInt bridgeErr = iClient.SendBridgeBuffer( reqBufPtr, retData );
+
+ delete iReqBuf;
+ iReqBuf = NULL;
+
+ if ( bridgeErr == KErrNone )
+ {
+ iConnectionTimeout->Cancel();
+ iConnectionTimeout->Start();
+
+ DATADUMP_TRACE( _L("CHapticsMsgHandler::RunL - response data dump:"), retData );
+ RFile targetFile;
+ targetFile.Replace( iFs, KTargetFileName, EFileWrite );
+ targetFile.Write( retData );
+ targetFile.Close();
+ }
+ }
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunL - End" ) ) );
+ }
+
+// -----------------------------------------------------------------------------
+//
+//
+// -----------------------------------------------------------------------------
+//
+TInt CHapticsMsgHandler::RunError( TInt aError )
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::RunError: %d" ), aError ) );
+ return aError;
+ }
+
+// -----------------------------------------------------------------------------
+//
+//
+// -----------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::DoCancel()
+ {
+ COMPONENT_TRACE( ( _L( "Inside CHapticsMsgHandler::DoCancel" ) ) );
+ if ( IsActive() )
+ {
+ iFs.NotifyChangeCancel( iStatus );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CHapticsConnPlugin::CHapticsConnPlugin()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+void CHapticsMsgHandler::NotifyShutdown()
+ {
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::NotifyShutdown - Begin" ) ) );
+ iClient.CleanUp();
+ iClient.Close();
+ COMPONENT_TRACE( ( _L( "CHapticsMsgHandler::NotifyShutdown - End" ) ) );
+ }
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/hapticsconnplugin/src/proxy.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation proxy for haptics connection plugin.
+*
+*/
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "hapticsconnplugin.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY( 0x2001FE53, CHapticsConnPlugin::NewL )
+ };
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+ return ImplementationTable;
+ }
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in build information file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconpcconnplugin.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/bld/def/eabiu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z24ImplementationGroupProxyRi @ 1 NONAME
+ _ZTI17CSConPCConnplugin @ 2 NONAME ; #<TI>#
+ _ZTV17CSConPCConnplugin @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/bld/sconpcconnplugin.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in MMP file
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+TARGET sconpcconnplugin.dll
+TARGETTYPE PLUGIN
+
+UID 0x10009D8D 0x101F9688
+
+SOURCEPATH ../src
+
+SOURCE sconpcconnplugin.cpp
+SOURCE proxy.cpp
+SOURCE sconpcconnpluginutils.cpp
+SOURCE sconservicetimer.cpp
+SOURCE sconshutdownwatcher.cpp
+
+START RESOURCE 101f9688.rss
+ TARGET sconpcconnplugin.rsc
+END
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../../clients/pcconn/inc
+USERINCLUDE ../../../servers/pcconn/inc
+USERINCLUDE ../../../services/ftp/inc
+USERINCLUDE ../../../catalogspcconnectivityplugin/inc
+
+DEBUGLIBRARY flogger.lib
+LIBRARY sconpcconnclient.lib
+LIBRARY euser.lib
+LIBRARY irobex.lib
+LIBRARY ecom.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY catalogspcconnectivityplugin.lib
+LIBRARY apmime.lib
+LIBRARY bluetooth.lib
+LIBRARY esock.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnplugin.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity plugin header file
+*
+*/
+
+#ifndef _SCONPCCONNPLUGIN_H
+#define _SCONPCCONNPLUGIN_H
+
+#include <obexserver.h>
+#include <SrcsInterface.h>
+#include <apmstd.h>
+
+#include "sconpcconnclient.h"
+#include "sconshutdownwatcher.h"
+
+// forward declaration
+class CSConFTP;
+class CSConServiceTimer;
+class CCatalogsPCConnectivityPlugin;
+
+
+
+class CSConPCConnplugin : public CSrcsInterface, public MObexServerNotify,
+ public MShutdownObserver
+ {
+ public:
+ static CSConPCConnplugin* NewL();
+ virtual ~CSConPCConnplugin();
+
+ /**
+ * Returns active status of OBEX session
+ * @return ETrue if session is active, else EFalse
+ */
+ TBool IsOBEXActive();
+
+ /**
+ * Device is shutting down, abort connection.
+ */
+ void NotifyShutdown();
+
+ private:
+ /**
+ * Loads sconftp.dll module
+ * @return none
+ */
+ void LoadFTPDllL();
+ /**
+ * Closes initialized services
+ * @return none
+ */
+ void Disconnect();
+ /**
+ * Removes spaces and nulls from the end of the string
+ * @param aDes String to be formatted
+ * @return none
+ */
+ void TrimRightSpaceAndNull( TDes8& aDes ) const;
+ /**
+ * Current used transfer media (IR,USB,BT)
+ * @param aMediaType Enumeration indicating the media type
+ * @return none
+ */
+ void SetMediaType( TSrcsMediaType aMediaType );
+ /**
+ * MObexServerNotify implementation
+ * @param aError Error code
+ * @return none
+ */
+ void ErrorIndication( TInt aError );
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void TransportUpIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void TransportDownIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aRemoteInfo Structure containing information used during OBEX
+ * connection
+ * @param aInfo Further information about the requested connection
+ * @return System wide error code that indicates the success of the connection
+ */
+ TInt ObexConnectIndication( const TObexConnectInfo& aRemoteInfo,
+ const TDesC8& aInfo );
+ /**
+ * MObexServerNotify implementation
+ * @param aInfo Contains information about the disconnection
+ * @return none
+ */
+ void ObexDisconnectIndication( const TDesC8& aInfo );
+ /**
+ * MObexServerNotify implementation
+ * @return CObexBaseObject-derived object, which the object being put
+ * will be parsed into.
+ */
+ CObexBufObject* PutRequestIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * PUT packet operation.
+ */
+ TInt PutPacketIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * PUT packet operation.
+ */
+ TInt PutCompleteIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aRequiredObject Details about the object the remote client
+ * has requested
+ * @returnObject to return to the client
+ */
+ CObexBufObject* GetRequestIndication( CObexBaseObject
+ *aRequiredObject );
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * GET packet operation.
+ */
+ TInt GetPacketIndication();
+ /**
+ * MObexServerNotify implementation
+ * @return System wide error code that indicates the success of the
+ * GET packet operation.
+ */
+ TInt GetCompleteIndication();
+ /**
+ * MObexServerNotify implementation
+ * @param aPathInfo SETPATH command parameters
+ * @param aInfo Not currently used
+ * @return System wide error code indicating the success of the
+ * setpath command.
+ */
+ TInt SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+ const TDesC8& aInfo );
+ /**
+ * SetObexServer
+ * @param aObexServer pass obex server pointer to sevice controller
+ * @return System wide error code.
+ */
+ TInt SetObexServer( CObexServer* aObexServer );
+ /**
+ * MObexServerNotify implementation
+ * @return none
+ */
+ void AbortIndication();
+ /**
+ * Checks if mime type belongs to Catalogs
+ * @return TBool
+ */
+ TBool IsCatalogsMimeType( TDataType aMime );
+
+ void ConstructL();
+ CSConPCConnplugin();
+
+ /**
+ * Handles PCD object. Used for advanced file handling.
+ * @param aDescriptionHeader Contains command code and destination filename
+ * @param aNameHeader Source filename
+ * @return System wide error code.
+ */
+ TInt HandlePCDObjectPut( const TDesC& aDescriptionHeader, const TDesC& aNameHeader );
+
+ /**
+ * Get Capbility object or ConML message from PCConnServer
+ * @param aNameHeader Name information.
+ * @param aTypeHeader Object type header. ConML or Capability object type
+ * @return none
+ */
+ void HandleGetPCConnObjectL( const TDesC& aNameHeader, const TDesC8& aTypeHeader );
+
+ /**
+ * Get Catalogs object
+ * @param aTypeHeader Object type header.
+ * @return none
+ */
+ void HandleGetCatalogsObjectL( const TDesC8& aTypeHeader );
+
+ /**
+ * Get file object
+ * @param aNameHeader requested filename.
+ * @return none
+ */
+ void HandleGetFileObjectL( const TDesC& aNameHeader );
+
+ private:
+ RLibrary iFTPlib;
+ CObexBufObject* iObject;
+ CBufFlat* iBuffer;
+ CSConFTP* iFTPHandler;
+ TInt iPutError;
+ TBool iSessionActive;
+ CSConServiceTimer* iServiceTimer;
+ TBool iStartTimer;
+ TSrcsMediaType iMediaType;
+ CObexFileObject* iFileObject;
+ RSConPCConnSession iPCConnSession;
+ TBool iPCConnSessionConnected;
+ CCatalogsPCConnectivityPlugin* iCatalogs;
+ TBool iCatalogsConnected;
+ HBufC8* iCatalogsMimeType;
+ RPointerArray<TDataType> iMimeArray;
+ TBool iCatalogsMimeTypesExist;
+ TBool iPutPacketIndicationCalled;
+ CShutdownWatcher* iShutdownWatcher;
+ TBool iShutdownInProgress;
+ CObexServer* iObexServer;
+ RSocketServ iSocketServer;
+ RBTPhysicalLinkAdapter iLinkAdapter;
+ private:
+ // Friend class is used,because existing impelentation has been working
+ // properly. Avoiding re-design.
+ friend class CSConServiceTimer;
+ };
+
+#endif // SCONPCCONNPLUGIN_H
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/inc/sconpcconnpluginutils.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in Utils header
+*
+*/
+
+
+#ifndef _SCONPCCONNPLUGINUTILS_H
+#define _SCONPCCONNPLUGINUTILS_H
+
+#include <e32base.h>
+//============================================================
+// Class TPCConnpluginUtils declaration
+//============================================================
+class TPCConnpluginUtils
+ {
+ public:
+ /**
+ * Converts Symbian error code to OBEX error code
+ * @param aError The error code
+ * @return The converted error code
+ */
+ static TInt ConvertPCDResponseCode( TInt aError );
+ /**
+ * Converts Symbian error code to OBEX error code
+ * @param aError The error code
+ * @return The converted error code
+ */
+ static TInt ConvertFTPResponseCode( TInt aError );
+
+ /**
+ * Converts Symbian error code to OBEX error code
+ * @param aError The error code
+ * @return The converted error code
+ */
+ static TInt ConvertObexMoveResponseCode( TInt aError );
+ };
+
+#endif //_SCONPCCONNPLUGINUTILS_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/inc/sconservicetimer.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in Service Timer Header file
+*
+*/
+
+
+#ifndef _SCONSERVICETIMER_H
+#define _SCONSERVICETIMER_H
+
+#include <e32base.h>
+
+class CSConPCConnplugin;
+
+
+//============================================================
+// Class CSConServiceTimer declaration
+//============================================================
+
+NONSHARABLE_CLASS ( CSConServiceTimer ) : public CActive
+ {
+ public:
+ CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue );
+ void ConstructL();
+ ~CSConServiceTimer();
+
+ /**
+ * Starts the timer
+ * @return none
+ */
+ void StartTimer();
+ /**
+ * Stops the timer
+ * @return none
+ */
+ void StopTimer();
+
+ private:
+ void DoCancel();
+ void RunL();
+
+ private:
+ RTimer iTimer;
+ CSConPCConnplugin* iEngine;
+ TInt iValue;
+ };
+
+#endif //_SCONSERVICETIMER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/inc/sconshutdownwatcher.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Power shutdown -watcher header file
+*
+*/
+
+
+#ifndef _SCONSHUTDOWNWATCHER_H
+#define _SCONSHUTDOWNWATCHER_H
+
+
+#include <e32base.h>
+#include <e32property.h>
+
+//============================================================
+// Class MShutdownObserver declaration
+//============================================================
+class MShutdownObserver
+ {
+public:
+ virtual void NotifyShutdown()=0;
+ };
+
+//============================================================
+// Class CShutdownWatcher declaration
+//============================================================
+NONSHARABLE_CLASS ( CShutdownWatcher ) : public CActive
+ {
+ public:
+ static CShutdownWatcher* NewL( MShutdownObserver* aObserver );
+ ~CShutdownWatcher();
+
+ /**
+ * Starts to watch shutdown status
+ * @return none
+ */
+ void StartShutdownWatcher();
+
+ private:
+ //construct/destruct
+ CShutdownWatcher( MShutdownObserver* aObserver );
+ void ConstructL();
+
+ // from CActive
+ void DoCancel();
+ void RunL();
+
+ private:
+ MShutdownObserver* iObserver;
+ RProperty iProperty;
+ };
+
+#endif //_SCONSHUTDOWNWATCHER_H
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/101f9688.rss Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in resource file
+*
+*/
+
+
+#include "ecom/registryinfo.rh"
+
+// Declares info for two implementations
+RESOURCE REGISTRY_INFO theInfo
+ {
+ // UID for the DLL
+ dll_uid = 0x101F9688;
+ // Declare array of interface info
+ interfaces =
+ {
+ INTERFACE_INFO
+ {
+ // UID of interface that is implemented
+ interface_uid = 0x101F7C8C;
+ implementations =
+ {
+ // Info for CSConPCConnplugin
+ IMPLEMENTATION_INFO
+ {
+ implementation_uid = 0x101F9689;
+ version_no = 1;
+ display_name = "PC Suite Services";
+ default_data = "OBEX/USB||OBEX/BT||OBEX/IrDA";
+
+ //
+ // opaque_data contains parameters used by following API calls in SRCS:
+ // 1. Setup USB interface string descriptor in Unicode;
+ // 2. TInt CObex::SetLocalWho(const TDesC8& aInfo);
+ // 3. TInt CBTConnection::RegisterSecuritySettingsL( TUint aService,
+ // TInt aProtocol,
+ // TInt aChannel,
+ // TBool aAuthenticate,
+ // TBool aAuthorise,
+ // TBool aEncrypt );
+ // opaque_data = "@0||@1||@2||@3||@4||@5||@6"
+ // @0 aStrDesc e.g. "PC Connectivity"
+ // @1 aInfo e.g. KFolderBrowsingID, "\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
+ // @2 aService e.g. KBTSecurityUidFileTransfer, 0x1106
+ // @3 aProtocol e.g. KSolBtRFCOMM, 0x1013
+ // @4 aAuthenticate e.g. EFalse, 0
+ // @5 aAuthorise e.g. EFalse, 0
+ // @6 aEncrypt e.g. EFalse, 0
+ //
+ opaque_data = "PC Suite Services||\xF9\xEC\x7B\xC4\x95\x3C\x11\xd2\x98\x4E\x52\x54\x00\xDC\x9E\x09||0x000050050000100080000002EE000001||0x1013||1||1||1||0xffff||0xffff";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/proxy.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in proxy implementation
+*
+*/
+
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "sconpcconnplugin.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+ {
+ IMPLEMENTATION_PROXY_ENTRY(0x101F9689, CSConPCConnplugin::NewL)
+ };
+
+// Exported proxy for instantiation method resolution
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+ {
+ aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+
+ return ImplementationTable;
+ }
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnplugin.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1254 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <obexconstantsinternal.h>
+#endif
+#include "sconpcconnplugin.h"
+#include "sconftp.h"
+#include "sconpcconnpluginutils.h"
+#include "sconservicetimer.h"
+#include "catalogspcconnectivityplugin.h"
+#include "debug.h"
+
+
+// CONSTANTS
+_LIT(KSConFTPLibName, "sconftp.dll");
+const TInt KSConFTPUidValue = 0x10009D8D;
+const TUid KSConFTPUid = {KSConFTPUidValue};
+
+// Folder listing type from IrObex specification
+_LIT8( KSConFolderListType, "x-obex/folder-listing" );
+// Folder listing type from IrObex specification
+_LIT8( KSConCapabilityObjectType, "x-obex/capability" );
+// PCD types
+_LIT8( KSConPCDObjectType, "application/vnd.nokia.pcd" );
+_LIT8( KSConPCDXMLObjectType, "application/vnd.nokia.conml+xml" );
+_LIT8( KSConPCDWBXMLObjectType, "application/vnd.nokia.conml+wbxml" );
+_LIT8( KSConPCDXMLObjectType2, "application/vnd.nokia.pcd+xml" );
+_LIT8( KSConPCDWBXMLObjectType2, "application/vnd.nokia.pcd+wbxml" );
+_LIT( K_C_ROOT, "C:\\" );
+
+// PCD header commands
+const TInt KSCon_PCD_TAG = 0x003A;
+const TInt KSCon_PCD_CMD_COPY = 0x0037;
+const TInt KSCon_PCD_CMD_MOVE_OR_RENAME = 0x0038;
+const TInt KSCon_PCD_CMD_SET_PERMISSION = 0x0039;
+// PCD header parameters
+const TInt KSCon_PCD_PAR_FULL_PERMISSION = 0x0040;
+const TInt KSCon_PCD_PAR_READ_ONLY_PERMISSION = 0x0041;
+
+
+const TInt KSConBufSize = 262144; // 256KB
+// Time (in milliseconds) for the timer
+const TInt KSConTimeOutValue = 180000000;
+// Flags used to indicate SetPath commands
+const TInt KSConNULLSetPath = 0x00;
+
+const TInt KSConHeaderMaxLength = 256;
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::NewL()
+// Two-phase constructing
+// -----------------------------------------------------------------------------
+//
+CSConPCConnplugin* CSConPCConnplugin::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConPCConnplugin* self = new ( ELeave ) CSConPCConnplugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return( self );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::~CSConPCConnplugin()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConPCConnplugin::~CSConPCConnplugin()
+ {
+ TRACE_FUNC_ENTRY;
+
+ // Disconnect from services.
+ Disconnect();
+
+ delete iBuffer;
+ iBuffer = NULL;
+
+ if ( iServiceTimer )
+ {
+ iServiceTimer->Cancel();
+ }
+
+ delete iServiceTimer;
+ iServiceTimer = NULL;
+
+ delete iCatalogs;
+ iCatalogs = NULL;
+ delete iCatalogsMimeType;
+ iCatalogsMimeType = NULL;
+
+ iMimeArray.Reset();
+ iMimeArray.Close();
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::IsOBEXActive()
+// Returns active status of OBEX session
+// -----------------------------------------------------------------------------
+//
+TBool CSConPCConnplugin::IsOBEXActive()
+ {
+ TRACE_FUNC;
+ return iSessionActive;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::NotifyShutdown()
+// System is shutting down
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::NotifyShutdown()
+ {
+ TRACE_FUNC;
+ iShutdownInProgress = ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::LoadFTPDllL()
+// Loads sconftp.dll module
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::LoadFTPDllL()
+ {
+ TRACE_FUNC_ENTRY;
+ // Dynamically load DLL
+ User::LeaveIfError( iFTPlib.Load( KSConFTPLibName ) );
+ if ( iFTPlib.Type()[1] != KSConFTPUid )
+ {
+ LOGGER_WRITE( "KSConFTPUidValue incorrect" );
+ iFTPlib.Close();
+ User::Leave( KErrNotFound );
+ }
+ TSConCreateCSConFTPFunc CreateCSConFTPL =
+ (TSConCreateCSConFTPFunc)iFTPlib.Lookup(1);
+ iFTPHandler = (CSConFTP*)CreateCSConFTPL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::Disconnect()
+// Closes initialized services
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::Disconnect()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iLinkAdapter.Close();
+ iSocketServer.Close();
+
+ //Disconnect from server
+ iPCConnSession.Close();
+ iPCConnSessionConnected = EFalse;
+
+ if ( iStartTimer != EFalse )
+ {
+ iServiceTimer->Cancel();
+ iServiceTimer->StartTimer();
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ if ( iFTPHandler )
+ {
+ delete iFTPHandler;
+ iFTPHandler = NULL;
+ iFTPlib.Close();
+ }
+ if ( iFileObject )
+ {
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+ if ( iCatalogsConnected )
+ {
+ iCatalogs->Close();
+ iCatalogsConnected = EFalse;
+ iCatalogsMimeTypesExist = EFalse;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::ErrorIndication( TInt aError )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::ErrorIndication( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aError : %d", aError );
+
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ if ( iPCConnSessionConnected )
+ {
+ iPCConnSession.ResetServer();
+ }
+
+ // Keep compiler happy
+ (void)aError;
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::AbortIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::AbortIndication()
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ if ( iPCConnSessionConnected )
+ {
+ iPCConnSession.ResetServer();
+ }
+
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::TransportUpIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::TransportUpIndication()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::ObexConnectIndication( const TObexConnectInfo&
+// aRemoteInfo, const TDesC8& aInfo )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::ObexConnectIndication( const TObexConnectInfo&
+ /*aRemoteInfo*/, const TDesC8& /*aInfo*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+ TInt catalogsErr( KErrNone );
+ iStartTimer = ETrue;
+
+ if ( iMediaType == ESrcsMediaBT && iObexServer )
+ {
+ TSockAddr remoteAddr;
+ iObexServer->RemoteAddr( remoteAddr );
+
+ TBTSockAddr btSockAddr( remoteAddr );
+ TBTDevAddr devAddr = btSockAddr.BTAddr();
+
+ err = iSocketServer.Connect();
+ LOGGER_WRITE_1("iSocketServer.Connect err: %d", err );
+ if ( !err )
+ {
+ err = iLinkAdapter.Open( iSocketServer, devAddr );
+ LOGGER_WRITE_1("iLinkAdapter.Open err: %d", err );
+ }
+ // Ignore all BT link errors
+ err = KErrNone;
+ }
+
+ //Connect to server
+ if ( !iPCConnSessionConnected )
+ {
+ LOGGER_WRITE("Try to connect to iPCConnSession");
+ err = iPCConnSession.Connect();
+ LOGGER_WRITE_1( "iPCConnSession.Connect returned : %d", err );
+ if ( err == KErrNone )
+ {
+ iPCConnSessionConnected = ETrue;
+ }
+ }
+
+ if ( err == KErrNone && !iFTPHandler )
+ {
+ TRAP( err, LoadFTPDllL() );
+ LOGGER_WRITE_1( "LoadFTPDllL returned : %d", err );
+ }
+
+ if ( err == KErrNone )
+ {
+ iFTPHandler->SetProfile( EProprietary );
+ LOGGER_WRITE( "iServiceTimer->StopTimer()" );
+ iServiceTimer->Cancel();
+ iServiceTimer->StopTimer();
+ }
+
+ if ( !iCatalogsConnected )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::ObexConnectIndication() before iCatalogs->Connect()" );
+ catalogsErr = iCatalogs->Connect();
+ LOGGER_WRITE_1( "CSConPCConnplugin::ObexConnectIndication() iCatalogs->Connect() err: %d", catalogsErr );
+ if ( catalogsErr == KErrNone )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::ObexConnectIndication() iCatalogs->Connect() success" );
+ iCatalogsConnected = ETrue;
+ TRAPD( ret, iMimeArray = iCatalogs->SupportedMimeTypesL() );
+ if ( ret == KErrNone )
+ {
+ LOGGER_WRITE_1( "iCatalogs->SupportedMimeTypesL count: %d", iMimeArray.Count() );
+ iCatalogsMimeTypesExist = ETrue;
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ return TPCConnpluginUtils::ConvertFTPResponseCode( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::ObexDisconnectIndication( const TDesC8& )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::ObexDisconnectIndication( const TDesC8& )
+ {
+ TRACE_FUNC_ENTRY;
+ Disconnect();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::TransportDownIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::TransportDownIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ Disconnect();
+ if ( iBuffer )
+ {
+ iBuffer->Reset();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::PutRequestIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+CObexBufObject* CSConPCConnplugin::PutRequestIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+ iPutError = KErrNone;
+
+ if ( iBuffer )
+ {
+ iBuffer->Reset();
+ }
+
+ if ( iObject )
+ {
+ delete iObject;
+ iObject = NULL;
+ }
+
+ TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) );
+
+ if ( err != KErrNone )
+ {
+ return NULL;
+ }
+
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return NULL;
+ }
+
+ TRAP( err, ret = iFTPHandler->PutFileObjectInitL( iObject, iBuffer ) );
+
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "iFTPHandler->PutFileObjectInitL() leaves: %d", err );
+ return NULL;
+ }
+ if ( ret != KErrNone )
+ {
+ LOGGER_WRITE_1( "PutFileObjectInitL failed - returning error in next PutPacketIndication : %d", ret );
+ iPutError = ret;
+ }
+ iPutPacketIndicationCalled = EFalse;
+
+ if ( !iShutdownWatcher )
+ {
+ TRAP( err, iShutdownWatcher = CShutdownWatcher::NewL( this ) );
+ if ( err == KErrNone )
+ {
+ iShutdownWatcher->StartShutdownWatcher();
+ }
+ else
+ {
+ LOGGER_WRITE_1( "CShutdownWatcher::NewL leaves: %d", err );
+ }
+ }
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // request active BT mode (high power mode)
+ err = iLinkAdapter.ActivateActiveRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err );
+ }
+
+ TRACE_FUNC_EXIT;
+ return( iObject );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::PutPacketIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::PutPacketIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ TBool catalogsMime( EFalse );
+ if ( iObject->Type().Length() > KSConHeaderMaxLength )
+ {
+ LOGGER_WRITE("TypeHeader too big, return KErrNotSupported");
+ return TPCConnpluginUtils::ConvertFTPResponseCode( KErrNotSupported );
+ }
+ TBuf8<KSConHeaderMaxLength> typeHeader( iObject->Type() );
+ TrimRightSpaceAndNull( typeHeader );
+
+ if ( iCatalogsConnected && IsCatalogsMimeType( TDataType( typeHeader ) ) )
+ {
+ catalogsMime = ETrue;
+ }
+
+ if ( (TInt)iObject->Length() > 0
+ && typeHeader != KSConPCDWBXMLObjectType
+ && typeHeader != KSConPCDWBXMLObjectType2
+ && !catalogsMime
+ && typeHeader != KSConPCDObjectType )
+ {
+ // normal file transfer
+ if ( !iPutPacketIndicationCalled )
+ {
+ // This is first check, need to check only once
+
+ TFileName path;
+ iFTPHandler->GetPath( path );
+ if ( path.CompareF( K_C_ROOT ) == 0 )
+ {
+ // path forbidden
+ ret = KErrAccessDenied;
+ }
+ else
+ {
+ if ( iPutError != KErrNone )
+ {
+ ret = iPutError;
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() : PutError : %d", iPutError );
+ }
+ else
+ {
+ // check required free space
+ // if filesize is small ( <65k ) it fits into one package and its already saved to filesystem.
+ // if file is larger, need to check is there enought free space in device.
+
+ const TUint32 filesize = iObject->Length();
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() filesize %d", filesize );
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication() iObject->BytesReceived() %d", iObject->BytesReceived() );
+ if ( filesize > iObject->BytesReceived() )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::PutPacketIndication() : check freespace" );
+ // file does not fit into one obex packet, check is there enought free space in current drive
+ if ( iFTPHandler->IsCurrentDiskSpaceBelowCritical( filesize ) )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::PutPacketIndication() : returning KErrNoMemory" );
+ ret = KErrNoMemory;
+ }
+ }
+ }
+ }
+ }
+
+ if ( iShutdownInProgress )
+ {
+ LOGGER_WRITE( "ShutdownInProgress, abort" );
+ ret = KErrDisconnected;
+ }
+ }
+
+ if ( !iPutPacketIndicationCalled )
+ {
+ // Need to check only once
+ iPutPacketIndicationCalled = ETrue;
+
+ //Check if filename is too long.
+ TFileName path;
+ iFTPHandler->GetPath( path );
+ if ( ret == KErrNone && path.Length() + iObject->Name().Length() > KMaxFileName )
+ {
+ LOGGER_WRITE_1( "Name length overflow! : %d", path.Length() + iObject->Name().Length() );
+ ret = KErrBadName;
+ }
+ }
+
+ if ( ret != KErrNone )
+ {
+ if ( iFTPHandler )
+ {
+ iFTPHandler->AbortFileTransfer( iObject );
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+ }
+
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutPacketIndication(): ret %d", ret );
+ return TPCConnpluginUtils::ConvertFTPResponseCode( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::PutCompleteIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::PutCompleteIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err2 = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err2 );
+ }
+
+ if ( iObject->Type().Length() > KSConHeaderMaxLength )
+ {
+ LOGGER_WRITE("TypeHeader too big, return KErrNotSupported");
+ delete iObject;
+ iObject = NULL;
+
+ iFTPHandler->DeleteTempFile();
+ return TPCConnpluginUtils::ConvertPCDResponseCode( KErrNotSupported );
+ }
+ if ( iObject->Name().Length() > KSConHeaderMaxLength )
+ {
+ LOGGER_WRITE("NameHeader too big, return KErrNotSupported");
+ delete iObject;
+ iObject = NULL;
+
+ iFTPHandler->DeleteTempFile();
+ return TPCConnpluginUtils::ConvertPCDResponseCode( KErrNotSupported );
+ }
+
+ // check if ConML signal is received
+ TBuf8<KSConHeaderMaxLength> typeHeader( iObject->Type() );
+ TBuf<KSConHeaderMaxLength> nameHeader( iObject->Name() );
+ TrimRightSpaceAndNull( typeHeader );
+ LOGGER_WRITE8_1("type: %S", &typeHeader);
+ LOGGER_WRITE_1("name: %S", &nameHeader);
+ LOGGER_WRITE_1("description: %S", &iObject->Description());
+ TInt size = iObject->BytesReceived();
+ TTime time = iObject->Time();
+
+ // shutdownWatcher is not needed anymore
+ delete iShutdownWatcher;
+ iShutdownWatcher = NULL;
+
+ if ( IsCatalogsMimeType( TDataType( typeHeader ) ) )
+ {
+ if ( iCatalogsConnected )
+ {
+ LOGGER_WRITE( "iCatalogs->PutDataL" );
+ TRAP( err, iCatalogs->PutDataL( typeHeader, *iBuffer ) );
+ LOGGER_WRITE_1( "iCatalogs->PutDataL : %d", err );
+ if ( err == KErrServerTerminated )
+ {
+ err = iCatalogs->Connect();
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutCompleteIndication() iCatalogs->Connect() err: %d", err );
+ if ( err == KErrNone )
+ {
+ LOGGER_WRITE( "iCatalogs->PutDataL" );
+ TRAP( err, iCatalogs->PutDataL( typeHeader, *iBuffer ) );
+ LOGGER_WRITE_1( "iCatalogs->PutDataL : %d", err );
+ }
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "Catalogs mime type recognised - failing due no connection" );
+ err = KErrNotSupported;
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ iFTPHandler->DeleteTempFile();
+ return TPCConnpluginUtils::ConvertPCDResponseCode( err );
+ }
+
+ if ( typeHeader == KSConPCDObjectType )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication KSConPCDObjectType" );
+ err = HandlePCDObjectPut( iObject->Description(), iObject->Name() );
+ delete iObject;
+ iObject = NULL;
+
+ iFTPHandler->DeleteTempFile();
+ LOGGER_WRITE_1( "CSConPCConnplugin::PutCompleteIndication() end, err: %d", err );
+ return TPCConnpluginUtils::ConvertObexMoveResponseCode( err );
+ }
+
+ if ( typeHeader != KSConPCDWBXMLObjectType &&
+ typeHeader != KSConPCDWBXMLObjectType2 )
+ {
+ TObexHeaderMask validHdrs = iObject->ValidHeaders();
+ if ( ( validHdrs & KObexHdrBody ) || ( validHdrs & KObexHdrEndOfBody ) )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication() normal filetransfer" );
+ LOGGER_WRITE_1( "Number of received bytes : %d", size );
+ TSConUsedMedia media( ESConNoMedia );
+
+ switch( iMediaType )
+ {
+ case ESrcsMediaBT :
+ media = ESConBTMedia;
+ break;
+ case ESrcsMediaIrDA :
+ media = ESConIRMedia;
+ break;
+ case ESrcsMediaUSB :
+ media = ESConUSBMedia;
+ break;
+ default :
+ media = ESConNoMedia;
+ break;
+ }
+
+ iFTPHandler->SetUsedMedia( media );
+
+ TRAP( ret, err = iFTPHandler->PutFileObjectFinalizeL( iObject ) );
+ LOGGER_WRITE_1( "PutFileObjectL() returned : %d", ret );
+ }
+ else
+ {
+ LOGGER_WRITE( "Delete starts" );
+ TRAP( ret, err = iFTPHandler->DeleteObjectL( iObject->Name() ) );
+ LOGGER_WRITE_1( "DeleteObjectL() returned : %d", ret );
+ }
+ }
+
+ delete iObject;
+ iObject = NULL;
+
+ if ( typeHeader == KSConPCDWBXMLObjectType ||
+ typeHeader == KSConPCDWBXMLObjectType2 )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::PutCompleteIndication() ReadWBXMLDataL" );
+ TRAP( ret, err = iFTPHandler->ReadWBXMLDataL( iBuffer ) );
+
+ if ( err == KErrNone && ret == KErrNone )
+ {
+ TRAP( ret, err = iPCConnSession.PutPacketL( nameHeader,
+ typeHeader, iBuffer ) );
+ LOGGER_WRITE_1( "iPCConnSession.PutPacketL() leaveCode : %d", ret );
+ LOGGER_WRITE_1( "iPCConnSession.PutPacketL() returned : %d", err );
+ }
+
+ iFTPHandler->DeleteTempFile();
+
+ return TPCConnpluginUtils::ConvertPCDResponseCode( err );
+ }
+
+ iFTPHandler->DeleteTempFile();
+
+ TRACE_FUNC_EXIT;
+ if ( ret != KErrNone )
+ {
+ return TPCConnpluginUtils::ConvertFTPResponseCode( ret );
+ }
+ return TPCConnpluginUtils::ConvertFTPResponseCode( err );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::GetRequestIndication( CObexBaseObject* aRequiredObject )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+CObexBufObject* CSConPCConnplugin::GetRequestIndication( CObexBaseObject*
+ aRequiredObject )
+ {
+ TRACE_FUNC_ENTRY;
+ CObexBufObject* bufObject(NULL);
+ if ( aRequiredObject->Type().Length() > KSConHeaderMaxLength )
+ {
+ LOGGER_WRITE("TypeHeader too big");
+ return NULL;
+ }
+ if ( aRequiredObject->Name().Length() > KMaxFileName )
+ {
+ LOGGER_WRITE("NameHeader is too long");
+ return NULL;
+ }
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+ TBuf8<KSConHeaderMaxLength> typeHeader( aRequiredObject->Type() );
+ TrimRightSpaceAndNull( typeHeader );
+ LOGGER_WRITE8_1("type: %S", &typeHeader);
+ LOGGER_WRITE_1("name: %S", &aRequiredObject->Name());
+
+ iBuffer->Reset();
+
+ delete iObject;
+ iObject = NULL;
+
+ TRAP( err, iObject = CObexBufObject::NewL ( iBuffer ) );
+ if ( err != KErrNone )
+ {
+ return NULL;
+ }
+
+ // Client requests folder listing
+ if ( typeHeader == KSConFolderListType )
+ {
+ LOGGER_WRITE( "Client requests folder listning" );
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return NULL;
+ }
+
+ TRAP( err, ret = iFTPHandler->GetFolderObjectL( iObject ) );
+ LOGGER_WRITE_1( "iFTPHandler->GetFolderObjectL() returned: %d", ret );
+ if ( err == KErrNone && ret == KErrNone )
+ {
+ bufObject = iObject;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+ // Client requests capability object or ConML packet
+ else if ( typeHeader == KSConCapabilityObjectType
+ || typeHeader == KSConPCDWBXMLObjectType
+ || typeHeader == KSConPCDWBXMLObjectType2)
+ {
+ LOGGER_WRITE( "Client requests capability object or ConML packet" );
+ // HandleGetPCConnObjectL will set some data to iObject, or leaves if error occurs
+ TRAP( err, HandleGetPCConnObjectL( aRequiredObject->Name(), typeHeader ) );
+
+ if ( err == KErrNone )
+ {
+ bufObject = iObject;
+ }
+ else
+ {
+ LOGGER_WRITE_1("Get PCConn object failed, err: %d", err);
+ return NULL;
+ }
+ }
+ // Client requests file conversion
+ else if ( typeHeader == KSConPCDObjectType )
+ {
+ LOGGER_WRITE("request of KSConPCDObjectType is not supported.")
+ return NULL;
+ }
+ // catalogs
+ else if ( IsCatalogsMimeType( TDataType( typeHeader ) ) )
+ {
+ TRAP( err, HandleGetCatalogsObjectL( typeHeader ) );
+ if ( err == KErrNone )
+ {
+ bufObject = iObject;
+ }
+ else
+ {
+ LOGGER_WRITE_1("Get catalogs object failed, err: %d", err);
+ return NULL;
+ }
+ }
+ // Client requests file
+ else
+ {
+ LOGGER_WRITE( "Client requests file" );
+ TRAP( err, HandleGetFileObjectL( aRequiredObject->Name() ) );
+ if ( err == KErrNone )
+ {
+ bufObject = (CObexBufObject*)iFileObject;
+ }
+ else
+ {
+ LOGGER_WRITE_1("Get file object failed, err: %d", err);
+ return NULL;
+ }
+ }
+ if ( bufObject && iLinkAdapter.IsOpen() )
+ {
+ // request active BT mode (high power mode)
+ err = iLinkAdapter.ActivateActiveRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.ActivateActiveRequester() err: %d", err );
+ }
+ return bufObject;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::GetPacketIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::GetPacketIndication()
+ {
+ TRACE_FUNC;
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::GetCompleteIndication()
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::GetCompleteIndication()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iLinkAdapter.IsOpen() )
+ {
+ // Cancel ActivateActiveRequester & allow going to low power mode
+ TInt err = iLinkAdapter.CancelLowPowerModeRequester();
+ LOGGER_WRITE_1( "iLinkAdapter.CancelLowPowerModeRequester() err: %d", err );
+ }
+
+ TInt ret( KErrNone );
+ if ( iFileObject )
+ {
+ iFileObject->Reset();
+ delete iFileObject;
+ iFileObject = NULL;
+ }
+
+ LOGGER_WRITE_1( "CSConPCConnplugin::GetCompleteIndication() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+// const TDesC8& aInfo )
+// MObexServerNotify implementation
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::SetPathIndication( const CObex::TSetPathInfo& aPathInfo,
+ const TDesC8& /*aInfo*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt err( KErrNone );
+
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ return TPCConnpluginUtils::ConvertFTPResponseCode( KErrNoMemory );
+ }
+
+ if ( aPathInfo.iFlags == KSConNULLSetPath )
+ {
+ TRAP( err, ret = this->iFTPHandler->CreateFolderL( aPathInfo.iName ) );
+ }
+ else
+ {
+ TRAP( err, ret = this->iFTPHandler->SetPathL( aPathInfo.iName,
+ aPathInfo.iFlags ) );
+ }
+
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConPCConnplugin::SetPathIndication : returned %d", err );
+ return TPCConnpluginUtils::ConvertFTPResponseCode( err );
+ }
+ LOGGER_WRITE_1( "CSConPCConnplugin::SetPathIndication : returned %d", ret );
+ return TPCConnpluginUtils::ConvertFTPResponseCode( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::TrimRightSpaceAndNull( TDes8& aDes ) const
+// Removes spaces and nulls from the end of the string
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::TrimRightSpaceAndNull( TDes8& aDes ) const
+ {
+ TRACE_FUNC;
+ aDes.TrimRight();
+ if ( aDes.Length() > 0 )
+ {
+ if ( !aDes[aDes.Length() - 1] )
+ {
+ aDes.SetLength( aDes.Length() - 1 );
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::SetMediaType( TSrcsMediaType aMediaType )
+// Current used transfer media (IR,USB,BT)
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::SetMediaType( TSrcsMediaType aMediaType )
+ {
+ TRACE_FUNC;
+ iMediaType = aMediaType;
+ }
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::TBool IsCatalogsMimeType( TDataType aMime )
+// Checks if mime type belogs to Catalogs
+// -----------------------------------------------------------------------------
+//
+TBool CSConPCConnplugin::IsCatalogsMimeType( TDataType aMime )
+ {
+ TRACE_FUNC_ENTRY;
+ TBool result = EFalse;
+
+ if ( !iCatalogsConnected
+ && aMime.Des8() != KSConPCDObjectType
+ && aMime.Des8() != KSConPCDXMLObjectType
+ && aMime.Des8() != KSConPCDWBXMLObjectType
+ && aMime.Des8() != KSConPCDXMLObjectType2
+ && aMime.Des8() != KSConPCDWBXMLObjectType2
+ )
+ {
+ // Catalogs never connected and not secon mime type
+ // Try to connect to catalogs to get catalogstypes
+ TInt catalogsErr = iCatalogs->Connect();
+ LOGGER_WRITE_1( "CSConPCConnplugin::IsCatalogsMimeType() iCatalogs->Connect() err: %d", catalogsErr );
+ if ( catalogsErr == KErrNone )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::IsCatalogsMimeType() iCatalogs->Connect() success" );
+ iCatalogsConnected = ETrue;
+ TRAPD( ret, iMimeArray = iCatalogs->SupportedMimeTypesL() );
+ if ( ret == KErrNone )
+ {
+ LOGGER_WRITE_1( "iCatalogs->SupportedMimeTypesL count: %d", iMimeArray.Count() );
+ iCatalogsMimeTypesExist = ETrue;
+ }
+ }
+ }
+
+ if ( iCatalogsMimeTypesExist )
+ {
+ // Compare to supported values
+ for ( TInt j = 0; j < iMimeArray.Count(); j++ )
+ {
+ if ( (*iMimeArray[j]) == aMime )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::IsCatalogsMimeTypeL returns TRUE" );
+ result = ETrue;
+ break;
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::CSConPCConnplugin()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConPCConnplugin::CSConPCConnplugin()
+ {
+ TRACE_FUNC;
+ iBuffer = NULL;
+ iObject = NULL;
+ iFileObject = NULL;
+ iSessionActive = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iBuffer = CBufFlat::NewL( KSConBufSize );
+ iObject = CObexBufObject::NewL ( iBuffer );
+ iServiceTimer = new (ELeave) CSConServiceTimer( this, KSConTimeOutValue );
+ iServiceTimer->ConstructL();
+ CActiveScheduler::Add( iServiceTimer );
+
+ // catalogs
+ iCatalogs = CCatalogsPCConnectivityPlugin::NewL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::SetObexServer( CObexServer* aObexServer )
+// SetObexServer
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::SetObexServer( CObexServer* aObexServer )
+ {
+ iObexServer = aObexServer;
+ TInt ret = iObexServer->Start(this);
+ LOGGER_WRITE_1( "CSConPCConnplugin::SetObexServer() ret: %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::HandlePCDObjectPut
+// Handles PCD object. Used for advanced file handling.
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnplugin::HandlePCDObjectPut( const TDesC& aDescriptionHeader,
+ const TDesC& aNameHeader )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNotSupported);
+ if ( aDescriptionHeader.Length() >= 3 )
+ {
+ TInt commandTag = aDescriptionHeader[0];
+ TInt commandID = aDescriptionHeader[1];
+ TInt commandParam1 = aDescriptionHeader[2];
+
+ TPtrC destination;
+ if ( aDescriptionHeader.Length() >= 3 )
+ {
+ destination.Set( aDescriptionHeader.Mid(3) );
+ }
+ TPtrC source;
+ if ( aNameHeader.Length() >= 1 )
+ {
+ // remove ":" character from beginning
+ source.Set( aNameHeader.Mid(1) );
+ }
+
+ if ( commandTag == KSCon_PCD_TAG )
+ {
+ LOGGER_WRITE( "CSConPCConnplugin::HandlePCDObjectPut KSCon_PCD_TAG found" );
+ switch (commandID)
+ {
+ case KSCon_PCD_CMD_COPY:
+ err = iFTPHandler->CopyFile( source, destination );
+ break;
+
+ case KSCon_PCD_CMD_MOVE_OR_RENAME:
+ err = iFTPHandler->MoveFile( source, destination );
+ break;
+
+ case KSCon_PCD_CMD_SET_PERMISSION:
+ if ( commandParam1 == KSCon_PCD_PAR_FULL_PERMISSION )
+ {
+ err = iFTPHandler->SetReadOnly( source, EFalse );
+ }
+ else if ( commandParam1 == KSCon_PCD_PAR_READ_ONLY_PERMISSION )
+ {
+ err = iFTPHandler->SetReadOnly( source, ETrue );
+ }
+ else
+ {
+ err = KErrNotSupported;
+ }
+ break;
+
+ default:
+ LOGGER_WRITE( "CSConPCConnplugin::HandlePCDObjectPut unknown commandID" );
+ err = KErrNotSupported;
+ break;
+ }
+
+ }
+
+ }
+ TRACE_FUNC_EXIT;
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::HandleGetPCConnObjectL
+// Get Capbility object or ConML message from PCConnServer
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::HandleGetPCConnObjectL( const TDesC& aNameHeader,
+ const TDesC8& aTypeHeader )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( !iPCConnSessionConnected )
+ {
+ LOGGER_WRITE( "ERROR, iPCConnSession was not connected" );
+ User::Leave( KErrNotReady );
+ }
+ TInt err = iPCConnSession.GetPacketL( aNameHeader, aTypeHeader, iBuffer );
+ LOGGER_WRITE_1( "iPCConnSession.GetPacketL() returned: %d", err );
+ User::LeaveIfError( err );
+ iObject->SetDataBufL( iBuffer );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::HandleGetCatalogsObjectL
+// Get Catalogs object
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::HandleGetCatalogsObjectL( const TDesC8& aTypeHeader )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err(KErrNone);
+ if ( !iCatalogsConnected )
+ {
+ LOGGER_WRITE( "catalogs mime type recognised - failing due to no connection" );
+ User::Leave( KErrNotReady );
+ }
+ else
+ {
+ LOGGER_WRITE( "iCatalogs->GetDataL" );
+ TDataType mime( aTypeHeader );
+ TRAP( err, iCatalogs->GetDataL( mime, *iBuffer ) );
+ LOGGER_WRITE_1( "iCatalogs->GetDataL : %d", err );
+ if ( err == KErrServerTerminated )
+ {
+ // server was terminated, try to reconnect
+ err = iCatalogs->Connect();
+ LOGGER_WRITE_1( "iCatalogs->Connect() err: %d", err );
+ User::LeaveIfError( err );
+ LOGGER_WRITE( "iCatalogs->GetDataL" );
+ iCatalogs->GetDataL( mime, *iBuffer );
+ }
+ }
+ User::LeaveIfError( err );
+ iObject->SetDataBufL( iBuffer );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnplugin::HandleGetFileObjectL
+// Get file object
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnplugin::HandleGetFileObjectL( const TDesC& aNameHeader )
+ {
+ TRACE_FUNC_ENTRY;
+ delete iFileObject;
+ iFileObject = NULL;
+ iFileObject = CObexFileObject::NewL();
+
+ iFileObject->Reset();
+ iFileObject->SetNameL( aNameHeader );
+
+ if ( !iFTPHandler )
+ {
+ LOGGER_WRITE( "Creating iFTPHandler has failed" );
+ User::Leave( KErrNotReady );
+ }
+
+ TInt err = iFTPHandler->GetFileObjectL( iFileObject );
+ User::LeaveIfError( err );
+ TRACE_FUNC_EXIT;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/sconpcconnpluginutils.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in Utils implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <obexconstants.h>
+#include "sconpcconnpluginutils.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError )
+// Converts Symbian error code to OBEX error code
+// -----------------------------------------------------------------------------
+//
+TInt TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError )
+ {
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( TInt aError )\
+ : begin, aError: %d", aError );
+ TInt obexErr ( KErrIrObexRespBadRequest );
+ switch( aError )
+ {
+ case KErrNone:
+ obexErr = KErrNone;
+ break;
+ case KErrNotFound:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrGeneral:
+ case KErrCancel:
+ obexErr = KErrIrObexRespBadRequest;
+ break;
+ case KErrNoMemory:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrNotSupported:
+ obexErr = KErrIrObexRespNotImplemented;
+ break;
+ case KErrArgument:
+ case KErrTotalLossOfPrecision:
+ case KErrBadHandle:
+ case KErrOverflow:
+ case KErrUnderflow:
+ case KErrAlreadyExists:
+ obexErr = KErrIrObexRespConflict;
+ break;
+ case KErrPathNotFound:
+ case KErrDied:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrInUse:
+ obexErr = KErrIrObexRespTimedOut;
+ break;
+ case KErrServerTerminated:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrServerBusy:
+ case KErrCompletion:
+ case KErrNotReady:
+ case KErrUnknown:
+ case KErrCorrupt:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrAccessDenied:
+ case KErrLocked:
+ obexErr = KErrIrObexRespUnauthorized;
+ break;
+ case KErrWrite:
+ case KErrDisMounted:
+ case KErrEof:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrDiskFull:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrBadDriver:
+ case KErrBadName:
+ obexErr = KErrIrObexRespPreCondFailed;
+ break;
+ case KErrCommsLineFail:
+ case KErrCommsFrame:
+ case KErrCommsOverrun:
+ case KErrCommsParity:
+ case KErrTimedOut:
+ case KErrCouldNotConnect:
+ case KErrCouldNotDisconnect:
+ case KErrBadLibraryEntryPoint:
+ case KErrBadDescriptor:
+ case KErrAbort:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrTooBig:
+ obexErr = KErrIrObexRespReqEntityTooLarge;
+ break;
+ case KErrDivideByZero:
+ case KErrBadPower:
+ case KErrDirFull:
+ case KErrHardwareNotAvailable:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrDisconnected: // System is shutting down
+ obexErr = KErrIrObexRespMethodNotAllowed;
+ break;
+ default:
+ obexErr = KErrIrObexRespBadRequest;
+ break;
+ };
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertFTPResponseCode( \
+ TInt aError ) returned : %d", obexErr );
+ return obexErr;
+};
+
+// -----------------------------------------------------------------------------
+// TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError )
+// Converts Symbian error code to OBEX error code
+// -----------------------------------------------------------------------------
+//
+TInt TPCConnpluginUtils::ConvertPCDResponseCode( TInt aError )
+ {
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode( TInt \
+ aError ) : begin, aError: %d", aError );
+
+ TInt obexErr ( KErrIrObexRespInternalError );
+ switch( aError )
+ {
+ case KErrNone:
+ obexErr = KErrNone;
+ break;
+ case KErrNotFound:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrGeneral:
+ case KErrCancel:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ case KErrNoMemory:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrNotSupported:
+ obexErr = KErrIrObexRespUnsupMediaType;
+ break;
+ case KErrArgument:
+ case KErrTotalLossOfPrecision:
+ case KErrBadHandle:
+ case KErrOverflow:
+ case KErrUnderflow:
+ obexErr = KErrIrObexRespPreCondFailed;
+ break;
+ case KErrAlreadyExists:
+ obexErr = KErrIrObexRespConflict;
+ break;
+ case KErrPathNotFound:
+ case KErrDied:
+ case KErrInUse:
+ obexErr = KErrIrObexRespTimedOut;
+ break;
+ case KErrServerTerminated:
+ obexErr = KErrIrObexRespPreCondFailed;
+ break;
+ case KErrServerBusy:
+ obexErr = KErrIrObexRespConflict;
+ break;
+ case KErrCompletion:
+ case KErrNotReady:
+ case KErrUnknown:
+ case KErrCorrupt:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ case KErrAccessDenied:
+ case KErrLocked:
+ obexErr = KErrIrObexRespUnauthorized;
+ break;
+ case KErrWrite:
+ case KErrDisMounted:
+ case KErrEof:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ case KErrDiskFull:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrBadDriver:
+ case KErrBadName:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrCommsLineFail:
+ case KErrCommsFrame:
+ case KErrCommsOverrun:
+ case KErrCommsParity:
+ case KErrTimedOut:
+ case KErrCouldNotConnect:
+ case KErrCouldNotDisconnect:
+ case KErrBadLibraryEntryPoint:
+ case KErrBadDescriptor:
+ case KErrAbort:
+ case KErrTooBig:
+ case KErrDivideByZero:
+ case KErrBadPower:
+ case KErrDirFull:
+ case KErrHardwareNotAvailable:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ default:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ };
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertPCDResponseCode(\
+ TInt aError ) returned : %d", obexErr );
+ return obexErr;
+};
+
+// -----------------------------------------------------------------------------
+// TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError )
+// Converts Symbian error code to OBEX error code
+// -----------------------------------------------------------------------------
+//
+TInt TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt aError )
+ {
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode( TInt \
+ aError ) : begin, aError: %d", aError );
+
+ TInt obexErr ( KErrIrObexRespInternalError );
+ switch( aError )
+ {
+ case KErrNone:
+ obexErr = KErrIrObexRespSuccess;
+ break;
+ case KErrNotFound:
+ case KErrPathNotFound:
+ obexErr = KErrIrObexRespNotFound;
+ break;
+ case KErrAccessDenied:
+ obexErr = KErrIrObexRespForbidden;
+ break;
+ case KErrNoMemory:
+ case KErrDiskFull:
+ obexErr = KErrIrObexRespDatabaseFull;
+ break;
+ case KErrInUse:
+ case KErrLocked:
+ obexErr = KErrIrObexRespConflict;
+ break;
+ case KErrNotSupported:
+ obexErr = KErrIrObexRespNotImplemented;
+ break;
+ case KErrAlreadyExists:
+ obexErr = KErrIrObexRespNotModified;
+ break;
+
+ default:
+ obexErr = KErrIrObexRespInternalError;
+ break;
+ };
+ LOGGER_WRITE_1( "TPCConnpluginUtils::ConvertObexMoveResponseCode(\
+ TInt aError ) returned : %d", obexErr );
+ return obexErr;
+};
+
+//End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/sconservicetimer.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Plug-in Service Timer implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconservicetimer.h"
+#include "sconpcconnplugin.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue )
+// Constuctor
+// -----------------------------------------------------------------------------
+//
+CSConServiceTimer::CSConServiceTimer( CSConPCConnplugin* aEngine, TInt aValue )
+ : CActive( EPriorityStandard ), iEngine( aEngine ), iValue( aValue ) {}
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::ConstructL()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::ConstructL()" );
+ // create a thread-relative timer
+ User::LeaveIfError( iTimer.CreateLocal() );
+ LOGGER_LEAVEFN( "CSConServiceTimer::ConstructL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::~CSConServiceTimer()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConServiceTimer::~CSConServiceTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::~CSConServiceTimer()" );
+ iTimer.Close();
+ LOGGER_LEAVEFN( "CSConServiceTimer::~CSConServiceTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::~CSConServiceTimer()
+// Starts the timer
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::StartTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::StartTimer()" );
+ if( !IsActive() )
+ {
+ LOGGER_WRITE( "CSConServiceTimer::StartTimer() : !IsActive()" );
+ iTimer.After( iStatus, TTimeIntervalMicroSeconds32( iValue ) );
+ iEngine->iSessionActive = ETrue;
+ SetActive();
+ LOGGER_WRITE( "CSConServiceTimer::StartTimer() : SetActive()" );
+ }
+ LOGGER_LEAVEFN( "CSConServiceTimer::StartTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::StopTimer()
+// StopTimer()
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::StopTimer()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::StopTimer()" );
+ iEngine->iSessionActive = ETrue;
+ LOGGER_WRITE( "CSConServiceTimer::StopTimer() : iSessionActive = ETrue" );
+ LOGGER_LEAVEFN( "CSConServiceTimer::StopTimer()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::DoCancel()
+// Cancels the timer
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::DoCancel()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::DoCancel()" );
+ iTimer.Cancel();
+ LOGGER_LEAVEFN( "CSConServiceTimer::DoCancel()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConServiceTimer::RunL()
+// Executed when timer is triggered
+// -----------------------------------------------------------------------------
+//
+void CSConServiceTimer::RunL()
+ {
+ LOGGER_ENTERFN( "CSConServiceTimer::RunL()" );
+ iEngine->iSessionActive = EFalse;
+ LOGGER_WRITE( "CSConServiceTimer::RunL() : iSessionActive = EFalse" );
+ iEngine->iStartTimer = EFalse;
+ LOGGER_WRITE( "CSConServiceTimer::RunL() : iStartTimer = EFalse " );
+ LOGGER_LEAVEFN( "CSConServiceTimer::RunL()" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/plugins/pcconn/src/sconshutdownwatcher.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Power shutdown -watcher implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconshutdownwatcher.h"
+#include "debug.h"
+
+#include <startupdomainpskeys.h>
+
+
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::NewL( MShutdownObserver* aObserver )
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher* CShutdownWatcher::NewL( MShutdownObserver* aObserver )
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::NewL()" );
+ CShutdownWatcher* self = new (ELeave) CShutdownWatcher( aObserver );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ LOGGER_LEAVEFN( "CShutdownWatcher::NewL()" );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::~CShutdownWatcher()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher::~CShutdownWatcher()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::~CShutdownWatcher()" );
+ Cancel();
+ iProperty.Close();
+ LOGGER_LEAVEFN( "CShutdownWatcher::~CShutdownWatcher()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::StartShutdownWatcher()
+// Starts to watch shutdown status
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::StartShutdownWatcher()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::StartShutdownWatcher()" );
+ TInt status;
+ TInt err = iProperty.Get( KPSUidStartup, KPSGlobalSystemState, status );
+ LOGGER_WRITE_2( "CShutdownWatcher::StartShutdownWatcher() :\
+ err %d, KPSGlobalSystemState status %d",err, status);
+ if ( err == KErrNone )
+ {
+ if ( status == ESwStateShuttingDown )
+ {
+ LOGGER_WRITE( "Call NotifyShutdown" );
+ iObserver->NotifyShutdown();
+ return;
+ }
+ }
+
+ err = iProperty.Attach( KPSUidStartup, KPSGlobalSystemState );
+ LOGGER_WRITE_1( "CShutdownWatcher::StartShutdownWatcher() :\
+ iProperty.Attach( KPSUidStartup, KPSGlobalSystemState ) : err %d", err );
+ iProperty.Subscribe( iStatus );
+ LOGGER_WRITE( "CShutdownWatcher::StartShutdownWatcher() :\
+ iProperty.Subscribe( iStatus ) : ok" );
+ SetActive();
+
+ LOGGER_LEAVEFN( "CShutdownWatcher::StartShutdownWatcher()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::DoCancel()
+// Executed when CActive is canceled.
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::DoCancel()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::DoCancel()" );
+ iProperty.Cancel();
+ LOGGER_LEAVEFN( "CShutdownWatcher::DoCancel()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::RunL()
+// Executed when disk watcher is triggered
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::RunL()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::RunL()" );
+ TInt status;
+ iProperty.Get( status );
+ LOGGER_WRITE_1( "CShutdownWatcher::RunL() : status %d", status );
+
+ if ( status == ESwStateShuttingDown )
+ {
+ LOGGER_WRITE( "Call NotifyShutdown" );
+ iObserver->NotifyShutdown();
+ return;
+ }
+
+ iProperty.Cancel();
+ iProperty.Close();
+
+ LOGGER_LEAVEFN( "CShutdownWatcher::RunL()" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver )
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CShutdownWatcher::CShutdownWatcher( MShutdownObserver* aObserver )
+: CActive(EPriorityStandard),
+ iObserver(aObserver)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CShutdownWatcher::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CShutdownWatcher::ConstructL()
+ {
+ LOGGER_ENTERFN( "CShutdownWatcher::ConstructL()" );
+ CActiveScheduler::Add(this);
+ LOGGER_LEAVEFN( "CShutdownWatcher::ConstructL()" );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/cntparser.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for Contact Parser Client and Server.
+*
+*/
+
+
+file=ABI_DIR\BUILD_DIR\cntparserserverexe.exe PROGRAMS_DIR\cntparserserverexe.exe
+file=ABI_DIR\BUILD_DIR\cntparserserver.dll SHARED_LIB_DIR\cntparserserver.dll
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconcsc.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for project SConCSC
+*
+*/
+
+
+#ifndef __SCONCSC_IBY__
+#define __SCONCSC_IBY__
+//file content
+
+file=ABI_DIR\BUILD_DIR\sconcsc.dll SHARED_LIB_DIR\sconcsc.dll
+data=ZPRIVATE\101F99F6\capability\101F9698.xml PRIVATE\101F99F6\capability\101F9698.xml
+data=ZPRIVATE\101F99F6\capability\fwdcomp.xml PRIVATE\101F99F6\capability\fwdcomp.xml
+data=ZPRIVATE\101F99F6\capability\101F99F6.xml PRIVATE\101F99F6\capability\101F99F6.xml
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconftp.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for CSConFTP
+*
+*/
+
+
+#ifndef __SCONFTP_IBY__
+#define __SCONFTP_IBY__
+//file content
+
+file=ABI_DIR\BUILD_DIR\sconftp.dll SHARED_LIB_DIR\sconftp.dll
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconftpplugin.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for FTPplugin
+*
+*/
+
+
+#ifndef __SCONFTP_PLUGIN_IBY__
+#define __SCONFTP_PLUGIN_IBY__
+//file content
+
+ECOM_PLUGIN(sconftpplugin.dll,101F9686.RSC)
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconftpresources.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for SConFTP resources.
+*
+*/
+
+#ifndef __SCONFTP_RESOURCE_IBY__
+#define __SCONFTP_RESOURCE_IBY__
+
+data=DATAZ_\RESOURCE_FILES_DIR\sconftp.rsc RESOURCE_FILES_DIR\sconftp.rsc
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconpcconnclientserver.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for project PCCONNClientServer
+*
+*/
+
+
+#ifndef __SCONPCCONNCLIENTSERVER_IBY__
+#define __SCONPCCONNCLIENTSERVER_IBY__
+//file content
+
+file=ABI_DIR\BUILD_DIR\sconconmlhandler.dll SHARED_LIB_DIR\sconconmlhandler.dll
+
+file=ABI_DIR\BUILD_DIR\sconpcconnserver.exe PROGRAMS_DIR\sconpcconnserver.exe
+file=ABI_DIR\BUILD_DIR\sconpcconnclient.dll SHARED_LIB_DIR\sconpcconnclient.dll
+
+// stub files
+data=ZSYSTEM\install\secon_stub.sis system\install\secon_stub.sis
+data=ZSYSTEM\install\sconpcconnplugin_stub.sis system\install\sconpcconnplugin_stub.sis
+data=ZSYSTEM\install\sconftpplugin_stub.sis system\install\sconftpplugin_stub.sis
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconpcconnplugin.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for PC Connectivity Plug-in.
+*
+*/
+#ifndef __SCONPCCONN_PLUGIN_IBY__
+#define __SCONPCCONN_PLUGIN_IBY__
+//file content
+
+ECOM_PLUGIN(sconpcconnplugin.dll,101F9688.RSC)
+
+file=ABI_DIR\BUILD_DIR\catalogspcconnectivityplugin.dll SHARED_LIB_DIR\catalogspcconnectivityplugin.dll
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/rom/sconpcd.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Image description file for SConPCD.
+*
+*/
+#ifndef __SCONPCD_IBY__
+#define __SCONPCD_IBY__
+//file content
+
+file=ABI_DIR\BUILD_DIR\sconpcd.dll system\libs\sconpcd.dll
+
+data=ZPRIVATE\10202D56\sbeconfig.xml PRIVATE\10202D56\sbeconfig.xml
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project PCConnServer
+*
+*/
+
+
+PRJ_EXPORTS
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconpcconnserver.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/bld/sconpcconnserver.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Server
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_SERVER TrustedUI
+
+TARGET sconpcconnserver.exe
+TARGETTYPE exe
+
+EPOCSTACKSIZE 0x10000
+EPOCHEAPSIZE 0x10000 0x1000000 // heap memory 16MB
+
+UID 0 0x101F99F6
+
+// Server
+SOURCEPATH ../src
+SOURCE sconpcconnserver.cpp
+SOURCE sconimsireader.cpp
+SOURCE sconfolderlister.cpp
+SOURCE sconbtengine.cpp
+
+// ConML
+SOURCEPATH ../../../wbxml/conmlhandler/src
+SOURCE sconconmldtd.cpp
+SOURCE sconxmlelement.cpp
+
+SOURCEPATH ../../../common/conmltask/src
+SOURCE sconconmltask.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../../common/conmltask/inc
+USERINCLUDE ../../../services/pcd/inc
+USERINCLUDE ../../../services/csc/inc
+USERINCLUDE ../../../services/oviaccounthandler/inc
+USERINCLUDE ../../../wbxml/conmlhandler/inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY estor.lib // RMemWriteStream, RMemReadStream
+LIBRARY efsrv.lib // Rfs, RFile
+LIBRARY charconv.lib // For Unicode conversion
+LIBRARY etel3rdparty.lib
+LIBRARY platformenv.lib // For pathinfo
+LIBRARY directorylocalizer.lib // For localizing directories
+LIBRARY centralrepository.lib
+LIBRARY commonengine.lib // For resource reader
+LIBRARY bafl.lib // Basic Application Framework Library
+LIBRARY btengdevman.lib
+LIBRARY btmanclient.lib
+LIBRARY btdevice.lib
+LIBRARY bluetooth.lib
+LIBRARY btengsettings.lib
+DEBUGLIBRARY flogger.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconbtengine.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconBtEngine declaration
+*
+*/
+
+
+
+#ifndef SCONBTENGINE_H_
+#define SCONBTENGINE_H_
+
+#include <e32std.h>
+#include <e32base.h>
+#include <s32mem.h>
+#include <BTEngDevMan.h>
+#include <btengsettings.h>
+
+const TInt KCenRepAddrBufSize = 2 * KBTDevAddrSize;
+
+class CSconBtEngine : public CBase,
+ public MBTEngDevManObserver,
+ public MBTEngSettingsObserver
+ {
+public:
+ static CSconBtEngine* NewL();
+ ~CSconBtEngine();
+
+ void ReadBTInfoL( RBufWriteStream& aStream );
+
+ void SetBtAuthorizedL( const TDesC& aBtDevAddress, TBool aAuthorized );
+
+ TInt SetBtPowerState( TBool aPower );
+
+ TInt SetBtName( const TDesC& aBtName );
+
+protected:
+ // From MBTEngDevManObserver
+ void HandleDevManComplete( TInt aErr );
+ void HandleGetDevicesComplete( TInt aErr,
+ CBTDeviceArray* aDeviceArray );
+
+ // From MBTEngSettingsObserver
+ void PowerStateChanged( TBTPowerStateValue aState );
+ void VisibilityModeChanged( TBTVisibilityMode aState );
+
+private:
+ CSconBtEngine();
+ void ConstructL();
+
+ void PrintDevicesL();
+
+private:
+ enum TState
+ {
+ EIdle,
+ ERequestBtInfo,
+ EChangeBtState,
+ EChangeAuthorized
+ };
+ TState iState;
+ TInt iOperationError;
+ CActiveSchedulerWait iWait;
+ RBufWriteStream* iStream;
+ CBTEngDevMan* iBtEng;
+ CBTDeviceArray* iBtDevArray;
+ CBTEngSettings* iBtSettings;
+ TBool iAuthorizedValue;
+ TBuf<KCenRepAddrBufSize> iBtAddress;
+ };
+
+#endif /* SCONBTENGINE_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconfolderlister.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconFolderLister declaration
+*
+*/
+
+
+#ifndef CSCONFOLDERLISTER_H
+#define CSCONFOLDERLISTER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <s32mem.h> // For RMemReadStream
+#include <f32file.h>
+// CLASS DECLARATION
+
+class TSconDriveInfoEntry
+ {
+public:
+ TUint8 iDriveType;
+ TUint8 iDriveTypeCount;
+ TInt64 iSize;
+ TInt64 iFree;
+ };
+
+class TSconDriveInfo : public TSconDriveInfoEntry
+ {
+public:
+ TUint iDriveStatus;
+ TBuf16<2> iDriveLetter;
+ TUint iDriveAttr;
+ TBufC<KMaxFileName> iVolumeName;
+ };
+
+
+class CSconFolderEntry : public CBase
+ {
+public:
+ static CSconFolderEntry* NewLC();
+ static CSconFolderEntry* NewLC( const TEntry& aEntry );
+ ~CSconFolderEntry();
+private:
+ CSconFolderEntry();
+ void ConstructL( const TEntry& aEntry );
+
+public:
+ TUint iAtt;
+ TTime iModified;
+ HBufC *iName;
+ HBufC *iLabel;
+ TBool iDriveInfoEntryExists;
+ TSconDriveInfoEntry iDriveInfoEntry;
+ };
+
+
+class CDirectoryLocalizer;
+
+/**
+ * CSconFolderLister
+ *
+ */
+class CSconFolderLister : public CBase
+ {
+public:
+ // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CSconFolderLister();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CSconFolderLister* NewL( RFs& aFs );
+
+ /**
+ *
+ * @param aStream
+ * @param aStartPath
+ * @param aLevelsToSearch -1 = Search all levels, 0 = Search only current level, 1..N Search N levels
+ */
+ void GenerateFolderListL( RBufWriteStream& aStream, const TDesC& aStartPath, const TInt aLevelsToSearch );
+
+private:
+
+ void ListAllDrivesL( RBufWriteStream& aStream, const TInt aLevelsToSearch );
+ void ListDriveAndPathL( RBufWriteStream& aStream, TInt aDrive, const TDesC& aStartPath, const TInt aLevelsToSearch );
+
+ void ExportDriveL( RBufWriteStream& aStream, const TSconDriveInfo& aDriveInfo,
+ const TDesC& aPathName, const TInt aLevelsToSearch );
+
+ /**
+ *
+ * @param aStream
+ * @param aPathName
+ */
+ void ExportPathL( RBufWriteStream& aStream, const TDesC& aPathName,
+ const CSconFolderEntry& aEntry, const TBool aLocalize, const TInt aLevelsToSearch );
+
+ void GetDriveTypeNumberL( TInt aDrive , TUint driveStatus, TInt& aTypeNumber);
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CSconFolderLister( RFs& aFs );
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL();
+
+ TBool IsDirectoryPrintable( const TDesC& aParentPath, const TEntry& aFolderEntry );
+
+ void GetLocalizedVolumeNameL( CSconFolderEntry& aDriveEntry );
+private:
+ RFs& iFs;
+ TInt iFolders;
+ TInt iFiles;
+ TInt iCriticalLevel;
+ CDirectoryLocalizer* iLocalizer;
+ };
+
+#endif // CSCONFOLDERLISTER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconimsireader.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Imsi reader
+*
+*/
+
+
+#ifndef __SCONIMSIREADER_H__
+#define __SCONIMSIREADER_H__
+
+#include <e32base.h>
+#include <Etel3rdParty.h>
+
+enum TImsiReaderStatus
+ {
+ EIdle,
+ ERequestingImsi,
+ ERequestingNetworkStatus
+ };
+
+class CSconImsiReader : public CActive
+ {
+ public:
+
+ static TInt GetImsiL( TDes& aImsi );
+
+ static TInt GetNetworkStatusL( CTelephony::TRegistrationStatus& aRegistrationStatus );
+
+ private:
+ CSconImsiReader( TDes& aImsi, CTelephony::TRegistrationStatus& aRegistrationStatus );
+ void ConstructL();
+ ~CSconImsiReader();
+
+ void RequestImsi();
+ void RequestNetworkStatus();
+
+ private: // From CActive
+
+ void RunL();
+ void DoCancel();
+
+ private: // data
+ TDes& iImsi;
+ CTelephony::TRegistrationStatus& iNetworkStatus;
+ CTelephony* iTelephony;
+ CTelephony::TSubscriberIdV1 iSubscriberIdV1;
+ CTelephony::TSubscriberIdV1Pckg iSubscriberIdV1Pckg;
+
+ CTelephony::TNetworkRegistrationV1 iNetworkRegistrationV1;
+ CTelephony::TNetworkRegistrationV1Pckg iNetworkRegistrationV1Pckg;
+ TImsiReaderStatus iImsiReaderStatus;
+ };
+
+#endif // __SCONIMSIREADER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity server client
+*
+*/
+
+
+
+
+#ifndef __SCONPCCONNCLIENTSERVER_H__
+#define __SCONPCCONNCLIENTSERVER_H__
+
+#include <e32base.h>
+
+// for debugging ConML messages and capability objects
+//#define DEBUG_XML
+
+
+// reasons for server panic
+enum TPCConnServPanic
+ {
+ E_BadRequest = 1,
+ E_DispatchRequest,
+ E_InvalidClient,
+ E_CleanupCreate,
+ E_MainSchedulerError
+ };
+
+
+// server related constants
+_LIT( KSConPCConnServerName,"SConPCConnServer" );
+_LIT( KSConPCConnServerExe, "SConPCConnServer.exe" );
+
+// client
+_LIT( KSConPCConnClientDll, "SConPCConnClient.dll" );
+
+
+// Chunk
+const TUint KSConPCConnChunkSize = 128;
+const TUint KSConPCConnChunkMaxSize = 65536;
+const TUint KSConPCConnBufferMaxSize = 65000;
+
+// Version number
+const TUint KSConPCConnServerVersionMajor = 1;
+const TUint KSConPCConnServerVersionMinor = 0;
+const TUint KSConPCConnServerVersionBuild = 1;
+
+
+// Function codes
+
+enum TRequest
+{
+ EPutMessage,
+ EGetMessage,
+ EResetMessage,
+ EChunkMessage
+};
+
+#endif // __SCONPCCONNCLIENTSERVER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity server
+*
+*/
+
+
+#ifndef __SCONPCCONNSERVER_H__
+#define __SCONPCCONNSERVER_H__
+
+#include "sconconmlhandler.h"
+#include "sconconmltask.h"
+
+
+class CSConPCD;
+class CSConCSC;
+class CSConConMLParser;
+
+const TUint KSConDefaultHeapSize=0x10000;
+const TInt KSConFirstDrive = 65;
+
+_LIT8 ( KParamNameSilent, "Silent" );
+
+
+// PCD Handler Dll
+_LIT(KSConPCDLibName, "sconpcd.dll");
+const TInt KSConPCDUidValue = 0x10009D8D;
+const TUid KSConPCDUid = {KSConPCDUidValue};
+
+// CSC Handler Dll
+_LIT(KSConCSCLibName, "sconcsc.dll");
+const TInt KSConCSCUidValue = 0x10009D8D;
+const TUid KSConCSCUid = {KSConCSCUidValue};
+
+// ConML Handler Dll
+_LIT (KSConConMLHandlerLibName, "sconconmlhandler.dll");
+const TInt KSConConMLHandlerUidValue = 0x10009D8D;
+const TUid KSConConMLHandlerUid = {KSConConMLHandlerUidValue};
+
+// debug file for put and get messages
+_LIT ( KSConConMLDebugFile, "c:\\data\\handler_result.txt");
+
+// Secure ids
+_LIT_SECURE_ID(KSConPCConnClientSecureId,0x101F7C87);
+
+// PCD types
+_LIT8( KSConPCDXMLObjectType, "application/vnd.nokia.conml+xml" );
+_LIT8( KSConPCDXMLObjectType2, "application/vnd.nokia.pcd+xml" );
+_LIT8( KSConPCDWBXMLObjectType, "application/vnd.nokia.conml+wbxml" );
+_LIT8( KSConPCDWBXMLObjectType2, "application/vnd.nokia.pcd+wbxml" );
+
+// CSC types
+_LIT8( KSConCapabilityObjectType, "x-obex/capability" );
+
+// Drives
+_LIT( KSConNoDrive, "\x0" );
+_LIT( KSConDriveExists, "\x1" );
+
+// user permissions
+_LIT8( KSConPermReadOnly, "R" );
+_LIT8( KSConPermNormal, "RW" );
+// Java hash id for ConML
+_LIT8( KSConJavaHashId, "JAVA_");
+
+_LIT8( KSConAppInfoSeparator, "#" );
+
+//**********************************
+//CSConPCConnServer - PC Connectivity Server
+//**********************************
+
+class CSConPCConnServer : public CServer2
+ {
+public:
+ // From CServer2
+ IMPORT_C static CSConPCConnServer* NewLC();
+ IMPORT_C ~CSConPCConnServer();
+
+ /**
+ * Function to start the server
+ * @param none
+ * @return Error code
+ */
+ static TInt RunServer();
+
+ /**
+ * Function to start the server
+ * @param none
+ * @return none
+ */
+ static void RunServerL();
+
+ /**
+ * Increments session count.
+ * @param none
+ * @return none
+ */
+ void IncSessionCount();
+
+ /**
+ * Decrements session count.
+ * When count reaches zero, stops active scheduler
+ * @param none
+ * @return none
+ */
+ void DecSessionCount();
+
+
+protected:
+ virtual CSession2* NewSessionL( const TVersion &aVersion,
+ const RMessage2& aMessage) const;
+
+private:
+ CSConPCConnServer();
+
+ TInt iSessionCount;
+
+ };
+
+
+class CSconFolderLister;
+class CSconBtEngine;
+
+//**********************************
+//CSConPCConnSession - Server session class, handles the requested operations
+//**********************************
+class CSConPCConnSession : public CSession2, public MWBXMLConMLCallback
+ {
+
+public:
+ static CSConPCConnSession* NewL(CSConPCConnServer& aServer);
+
+ /**
+ * From CSession2
+ */
+ void ServiceL( const RMessage2 &aMessage);
+
+private:
+ void DispatchRequestL( const RMessage2 &aMessage);
+ void LoadPCDDllL();
+ void LoadCSCDllL();
+ void LoadConMLHandlerDllL();
+
+protected:
+ // Callback funktion for WBXML parsing
+ void ConMLL ( ConML_ConMLPtr_t aContent );
+
+private:
+ void ConstructL();
+ CSConPCConnSession ( CSConPCConnServer& aServer);
+ ~CSConPCConnSession();
+
+ TInt HandlePutMessageL();
+ TInt HandleGetMessageL();
+ TInt HandleWBXMLGetRequestL( const TDesC& aFileName );
+ TInt HandleResetMessage();
+ TInt HandleChunkMessage( const RMessage2& aMessage );
+ TInt OptionsFromExecuteL ( ConML_ExecutePtr_t aContent );
+ TInt TaskCancelL(ConML_CancelPtr_t aContent);
+ TInt TaskGetStatusL(ConML_GetStatusPtr_t aContent );
+ TInt TaskInstallL( ConML_InstallPtr_t aContent );
+ TInt TaskUnInstallL( ConML_UnInstallPtr_t aContent );
+ void SplitL( const TDesC8& aText, const TChar aSeparator, RArray<TPtrC8>& aArray );
+ TInt TaskListInstalledAppsL( ConML_ListInstalledAppsPtr_t aContent );
+ TInt TaskListDataOwnersL();
+ TInt TaskSetBURModeL( ConML_SetBURModePtr_t aContent );
+ TInt TaskGetDataSizeL( ConML_GetDataSizePtr_t aContent );
+ TInt TaskRequestDataL( ConML_RequestDataPtr_t aContent );
+ TInt TaskUpdateDeviceInfoL( ConML_UpdateDeviceInfoPtr_t aContent );
+ TInt TaskListPublicFilesL( ConML_ListPublicFilesPtr_t aContent );
+ TInt TaskGetDataOwnerStatusL( ConML_GetDataOwnerStatusPtr_t aContent );
+ TInt TaskSupplyDataL ( ConML_SupplyDataPtr_t aContent );
+ TInt TaskRebootL();
+ TInt TaskGetMetadataL( ConML_GetMetadataPtr_t aContent );
+ void AppendStatusL( ConML_ConMLPtr_t aContent, CSConStatusReply* reply );
+ void AppendUpdateDeviceInfoResultsL( ConML_ResultsPtr_t aContent,
+ CSConUpdateDeviceInfo* aResult );
+ void AppendSetBURModeResultsL ( ConML_ResultsPtr_t aContent,
+ CSConSetBURMode* aResult );
+ void AppendListInstalledAppsResultsL ( ConML_ResultsPtr_t aContent,
+ CSConListInstApps* aResult );
+ void AppendListPublicFilesResultsL ( ConML_ResultsPtr_t aContent,
+ CSConListPublicFiles* aResult );
+ void AppendRequestDataResultsL( ConML_ResultsPtr_t aContent,
+ CSConRequestData* aResult );
+ void AppendSupplyDataResultsL( ConML_ResultsPtr_t aContent,
+ CSConSupplyData* aResult );
+ void AppendInstallResultsL( ConML_ResultsPtr_t aContent,
+ CSConInstall* aResult );
+ void AppendUninstallResultsL( ConML_ResultsPtr_t aContent,
+ CSConUninstall* aResult );
+ void AppendListDataOwnersResultsL ( ConML_ResultsPtr_t aContent,
+ CSConListDataOwners* aResult );
+ void AppendGetDataOwnerStatusResultsL ( ConML_ResultsPtr_t aContent,
+ CSConGetDataOwnerStatus* aResult );
+ void AppendGetDataSizeResultsL ( ConML_ResultsPtr_t aContent,
+ CSConGetDataSize* aResult );
+ void AppendGetMetadataResultsL ( ConML_ResultsPtr_t aContent,
+ CSConGetMetadata* aResult );
+ void AppendProgressL ( ConML_ResultsPtr_t aContent, TInt progress );
+ void AppendDrivesL( ConML_DrivesPtr_t aContent, TDriveList aDrives );
+ TDriveList DriveList( ConML_DriveListPtr_t aContent );
+ TDesC8& IntToDesLC( const TInt& anInt);
+ TDesC8& DriveNumToDesLC( const TInt& anInt );
+ TDesC8& BufToDesLC( const TDesC& aBuf );
+ TDesC8& UidToDesLC( const TUid& aUid );
+ TUid DesToUid ( const TDesC8& aDes );
+ TInt DesToInt( const TDesC8& aDes);
+ TBool HasDrives( TDriveList& aDrive );
+ TDesC8& HashToDesLC( const TDesC& aBuf );
+ TPtr DesToHashLC( const TDesC8& aDes );
+ TBool IsJavaHash( const TDesC8& aDes );
+
+ TInt ReadOviAccountInfoL( RWriteStream& aAccountInfoStream );
+
+// data
+private:
+ CSConPCConnServer& iServer;
+
+ RLibrary iPCDlib;
+ RLibrary iCSClib;
+ RLibrary iConMLHandlerLib;
+
+ CSConPCD* iPCDHandler;
+ CSConCSC* iCSCHandler;
+ CSConConMLHandler* iConMLHandler;
+
+ RChunk iChunk;
+ CBufFlat* iBuffer;
+ TInt iResult;
+
+ CSconFolderLister* iFolderLister;
+ RFs iFs;
+ CSconBtEngine* iBtEngine;
+ };
+
+#endif // __SCONPCCONNSERVER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/src/sconbtengine.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,415 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconBtEngine implementation
+*
+*/
+
+
+
+#include <centralrepository.h>
+#include <btengdomaincrkeys.h>
+
+#include <e32property.h>
+#include <bttypes.h>
+#include <bt_subscribe.h>
+
+#include "sconbtengine.h"
+#include "debug.h"
+
+CSconBtEngine* CSconBtEngine::NewL()
+ {
+ TRACE_FUNC;
+ CSconBtEngine* self = new (ELeave) CSconBtEngine();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+CSconBtEngine::~CSconBtEngine()
+ {
+ TRACE_FUNC;
+ if ( iBtEng )
+ {
+ iBtEng->Cancel();
+ delete iBtEng;
+ }
+
+ delete iBtSettings;
+ }
+
+CSconBtEngine::CSconBtEngine()
+ {
+ }
+
+void CSconBtEngine::ConstructL()
+ {
+ iBtEng = CBTEngDevMan::NewL( this );
+ iBtSettings = CBTEngSettings::NewL( this );
+ iState = EIdle;
+ }
+
+void CSconBtEngine::ReadBTInfoL( RBufWriteStream& aStream )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iState != EIdle )
+ {
+ User::Leave( KErrInUse );
+ }
+ iStream = &aStream;
+ iOperationError = KErrNone;
+
+ // Write local name (8 bit name length + unicode name)
+ TBuf<100> localName;
+ TInt err = iBtSettings->GetLocalName( localName );
+ User::LeaveIfError( err );
+ LOGGER_WRITE_1("localName: %S", &localName);
+ iStream->WriteUint8L( localName.Length() );
+ iStream->WriteL( localName, localName.Length() );
+
+ if ( iBtAddress.Length() == 0 )
+ {
+ LOGGER_WRITE("Try to read bt address");
+
+ CRepository* cenRep = NULL;
+ // Use TRAP to catch a leave if the CenRep key does not exist.
+ TRAP( err, cenRep = CRepository::NewL( KCRUidBluetoothLocalDeviceAddress ) );
+ CleanupStack::PushL( cenRep );
+ if( !err )
+ {
+ err = cenRep->Get( KBTLocalDeviceAddress, iBtAddress );
+ LOGGER_WRITE_1("cenRep->Get err: %d", err);
+ }
+ CleanupStack::PopAndDestroy( cenRep );
+
+ if ( err )
+ {
+ iBtAddress.Zero();
+ }
+ }
+
+ // Write bt address (8 bit addr length + unicode address)
+ if ( iBtAddress.Length() > 0 )
+ {
+ LOGGER_WRITE_1("btAddr: %S", &iBtAddress);
+ iStream->WriteUint8L( iBtAddress.Length() );
+ iStream->WriteL( iBtAddress, iBtAddress.Length() );
+ }
+ else
+ {
+ iStream->WriteUint8L( 0 );
+ }
+
+ // Write BT Power State (8-bit, 0=Off, 1=On)
+ TBTPowerStateValue state;
+ err = iBtSettings->GetPowerState( state );
+ User::LeaveIfError( err );
+ LOGGER_WRITE_1("PowerState: %d", state);
+ iStream->WriteUint8L( state );
+
+ // Get device info
+ TBTRegistrySearch crit;
+ crit.FindAll();
+ if ( !iBtDevArray )
+ {
+ LOGGER_WRITE("create arr");
+ iBtDevArray = new (ELeave) CBTDeviceArray(5);
+ LOGGER_WRITE("create arr -ok");
+ }
+ else
+ {
+ iBtDevArray->ResetAndDestroy();
+ }
+ err = iBtEng->GetDevices( crit, iBtDevArray );
+ LOGGER_WRITE_1("GetDevices err: %d", err);
+ User::LeaveIfError( err );
+ iState = ERequestBtInfo;
+
+ // Wait until completed
+ iWait.Start();
+ iState = EIdle;
+ if ( iOperationError )
+ {
+ LOGGER_WRITE_1("Operation failed, leave %d", iOperationError);
+ User::Leave( iOperationError );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconBtEngine::SetBtAuthorizedL( const TDesC& aBtDevAddress, TBool aAuthorized )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iState != EIdle )
+ {
+ User::Leave( KErrInUse );
+ }
+
+ TBTRegistrySearch crit;
+ TBTDevAddr addr;
+ addr.SetReadable( aBtDevAddress );
+ crit.FindAddress( addr );
+
+ if ( !iBtDevArray )
+ {
+ LOGGER_WRITE("create arr");
+ iBtDevArray = new (ELeave) CBTDeviceArray(5);
+ LOGGER_WRITE("create arr -ok");
+ }
+ else
+ {
+ iBtDevArray->ResetAndDestroy();
+ }
+ TInt err = iBtEng->GetDevices( crit, iBtDevArray );
+ LOGGER_WRITE_1("GetDevices err: %d", err);
+ User::LeaveIfError( err );
+ iState = EChangeAuthorized;
+ iOperationError = KErrNone;
+ iAuthorizedValue = aAuthorized;
+
+ // Wait until completed
+ iWait.Start();
+ iState = EIdle;
+ if ( iOperationError )
+ {
+ LOGGER_WRITE_1("Operation failed, leave %d", iOperationError);
+ User::Leave( iOperationError );
+
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+TInt CSconBtEngine::SetBtPowerState( TBool aPower )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iState != EIdle )
+ {
+ return KErrInUse;
+ }
+
+ TBTPowerStateValue state;
+ iOperationError = iBtSettings->GetPowerState( state );
+ if ( iOperationError )
+ {
+ return iOperationError;
+ }
+ else if ( ( aPower && state == EBTPowerOn )
+ || ( !aPower && state == EBTPowerOff ) )
+ {
+ // No need to change state
+ return KErrNone;
+ }
+
+ state = EBTPowerOff;
+ if ( aPower )
+ {
+ state = EBTPowerOn;
+ }
+ iOperationError = iBtSettings->SetPowerState( state );
+ if ( iOperationError )
+ {
+ return iOperationError;
+ }
+ iState = EChangeBtState;
+
+ // Wait until completed
+ iWait.Start();
+
+ iState = EIdle;
+ TRACE_FUNC_RET( iOperationError );
+ return iOperationError;
+ }
+
+TInt CSconBtEngine::SetBtName( const TDesC& aBtName )
+ {
+ LOGGER_WRITE_1("SetBtName aBtName: %S", &aBtName);
+ TInt err = iBtSettings->SetLocalName( static_cast<const TDes&>( aBtName ) );
+ TRACE_FUNC_RET( err );
+ return err;
+ }
+
+// From MBTEngDevManObserver
+void CSconBtEngine::HandleDevManComplete( TInt aErr )
+ {
+ TRACE_FUNC;
+ LOGGER_WRITE_1("aErr: %d", aErr );
+ if ( iState == EChangeAuthorized )
+ {
+ if ( iWait.IsStarted() )
+ {
+ iOperationError = aErr;
+ iWait.AsyncStop();
+ }
+ }
+
+ }
+
+void CSconBtEngine::HandleGetDevicesComplete( TInt aErr,
+ CBTDeviceArray* aDeviceArray )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aErr: %d", aErr);
+ //iBtReqOngoing = EFalse;
+ if ( iState == ERequestBtInfo )
+ {
+ // Continue to write devices info
+ TRAP( iOperationError, PrintDevicesL() );
+ LOGGER_WRITE_1("PrintDevicesL err: %d", iOperationError);
+
+ if ( iWait.IsStarted() )
+ {
+ iWait.AsyncStop();
+ }
+ }
+ else if ( iState == EChangeAuthorized )
+ {
+ iOperationError = aErr;
+ if ( !aErr && aDeviceArray->Count() == 1 )
+ {
+ CBTDevice* btRef = aDeviceArray->At(0);
+ TBTDeviceSecurity devSec = btRef->GlobalSecurity();
+ if ( btRef->IsPaired() && !devSec.Banned() )
+ {
+ LOGGER_WRITE8_1("btAdrr: %S", &btRef->BDAddr().Des() );
+ CBTDevice* btDevice = CBTDevice::NewLC( btRef->BDAddr() );
+
+ btDevice->SetPaired( ETrue );
+
+ btDevice->SetDeviceNameL( btRef->DeviceName() );
+ btDevice->SetFriendlyNameL( btRef->FriendlyName() );
+ LOGGER_WRITE8_1("name: %S", &btRef->DeviceName());
+ LOGGER_WRITE8_1("FriendlyName: %S", &btRef->FriendlyName());
+
+ LOGGER_WRITE_1("iAuthorizedValue: %d", iAuthorizedValue);
+ // Set as authorized and store the device
+ TBTDeviceSecurity security;
+ security.SetNoAuthenticate( EFalse );
+ security.SetNoAuthorise( iAuthorizedValue );
+ security.SetBanned( EFalse );
+
+ btDevice->SetGlobalSecurity (security );
+
+ //iOperationError = iBtEng->ModifyDevice(*aDeviceArray->At(0));
+ iOperationError = iBtEng->ModifyDevice( *btDevice );
+ LOGGER_WRITE_1( "ModifyDevice err: %d", iOperationError );
+ CleanupStack::PopAndDestroy( btDevice );
+ }
+ else
+ {
+ LOGGER_WRITE("Device was not paired or it's banned")
+ iOperationError = KErrAccessDenied;
+ }
+ }
+
+ // If error occured stop waiting, otherwise continue waiting until
+ // HandleDevManComplete has been called
+ if ( iOperationError && iWait.IsStarted() )
+ {
+ iWait.AsyncStop();
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconBtEngine::PrintDevicesL()
+ {
+ TRACE_FUNC_ENTRY;
+ // calculate devices count
+ TInt devCount(0);
+
+ for ( TInt i=0 ; i<iBtDevArray->Count(); i++ )
+ {
+ CBTDevice* device = iBtDevArray->At(i);
+ // show only paired and banned devices
+ if ( device->IsPaired() || device->GlobalSecurity().Banned() )
+ {
+ devCount++;
+ }
+ }
+
+ // Print info
+ iStream->WriteUint8L( devCount );
+
+ for ( TInt i=0 ; i<iBtDevArray->Count(); i++ )
+ {
+ CBTDevice* device = iBtDevArray->At(i);
+
+ const TBTDeviceSecurity btSec = device->GlobalSecurity();
+
+ // show only paired and banned devices
+ if ( device->IsPaired() || btSec.Banned() )
+ {
+ LOGGER_WRITE_1("IsValidDeviceName: %d", device->IsValidDeviceName());
+ const TDesC8& deviceName = device->DeviceName();
+ LOGGER_WRITE8_1("DeviceName: %S", &deviceName );
+ iStream->WriteUint8L( deviceName.Length() );
+ iStream->WriteL( deviceName, deviceName.Length() );
+
+ LOGGER_WRITE_1("IsValidFriendlyName: %d", device->IsValidFriendlyName());
+ LOGGER_WRITE_1("FriendlyName: %S", &device->FriendlyName() );
+
+ const TBTDevAddr& addr = device->BDAddr();
+
+ TBuf<100> readable;
+ addr.GetReadable( readable );
+ LOGGER_WRITE_1("readable addr: %S", &readable);
+ iStream->WriteUint8L( readable.Length() );
+ iStream->WriteL( readable, readable.Length() );
+
+ LOGGER_WRITE_1("paired: %d", device->IsPaired() );
+ LOGGER_WRITE_1("IsValidPaired: %d", device->IsValidPaired() );
+ TUint8 paired(0);
+ if ( device->IsPaired() && device->IsValidPaired() )
+ {
+ paired = 1;
+ }
+ iStream->WriteUint8L( paired );
+
+ TUint8 noAuthorise(0);
+ if ( btSec.NoAuthorise() )
+ {
+ noAuthorise = 1;
+ }
+ iStream->WriteUint8L( noAuthorise );
+
+ TUint8 banned(0);
+ if ( btSec.Banned() )
+ {
+ banned = 1;
+ }
+ iStream->WriteUint8L( banned );
+
+ LOGGER_WRITE("");
+ }
+ }
+ iStream->CommitL();
+ iStream = NULL; //delete reference only
+ TRACE_FUNC_EXIT;
+ }
+
+// From MBTEngSettingsObserver
+void CSconBtEngine::PowerStateChanged( TBTPowerStateValue /*aState*/ )
+ {
+ TRACE_FUNC;
+ if ( iState == EChangeBtState && iWait.IsStarted() )
+ {
+ iWait.AsyncStop();
+ }
+
+ }
+
+void CSconBtEngine::VisibilityModeChanged( TBTVisibilityMode /*aState*/ )
+ {
+ TRACE_FUNC;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/src/sconfolderlister.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,717 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconFolderLister implementation
+*
+*/
+
+
+#include "sconfolderlister.h"
+
+#include <driveinfo.h>
+#include <centralrepository.h>
+#include <sysutildomaincrkeys.h>
+#include <CDirectoryLocalizer.h>
+#include <stringresourcereader.h>
+#include <sconftp.rsg>
+#include <bautils.h>
+
+#include "debug.h"
+
+const TUint16 KFormatVersion( 1 );
+
+// Obex package size
+const TInt KPackageSize = 65536;
+
+const TInt KMaxLevelsToSearch = 80;
+
+_LIT( KSConResourceName, "z:\\Resource\\sconftp.rsc" );
+
+CSconFolderEntry* CSconFolderEntry::NewLC()
+ {
+ CSconFolderEntry* self = new (ELeave) CSconFolderEntry();
+ CleanupStack::PushL( self );
+ return self;
+ }
+CSconFolderEntry* CSconFolderEntry::NewLC( const TEntry& aEntry )
+ {
+ CSconFolderEntry* self = new (ELeave) CSconFolderEntry();
+ CleanupStack::PushL( self );
+ self->ConstructL( aEntry );
+ return self;
+ }
+CSconFolderEntry::CSconFolderEntry()
+ {
+ }
+CSconFolderEntry::~CSconFolderEntry()
+ {
+ delete iName;
+ delete iLabel;
+ }
+
+
+void CSconFolderEntry::ConstructL( const TEntry& aEntry )
+ {
+ iAtt = aEntry.iAtt;
+ iModified = aEntry.iModified.Int64();
+ iName = aEntry.iName.AllocL();
+ }
+
+CSconFolderLister::CSconFolderLister( RFs& aFs ) : iFs(aFs)
+ {
+ // No implementation required
+ }
+
+CSconFolderLister::~CSconFolderLister()
+ {
+ TRACE_FUNC;
+ delete iLocalizer;
+ }
+
+CSconFolderLister* CSconFolderLister::NewL( RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ CSconFolderLister* self = new (ELeave) CSconFolderLister( aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+void CSconFolderLister::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iLocalizer = CDirectoryLocalizer::NewL();
+
+ // set free memory up to critical level for all drives
+ CRepository* repository = CRepository::NewLC( KCRUidDiskLevel );
+ TInt iCriticalLevel(0);
+ User::LeaveIfError( repository->Get( KDiskCriticalThreshold, iCriticalLevel ) );
+ CleanupStack::PopAndDestroy( repository );
+ iCriticalLevel += KPackageSize; // add obex package size to critical level
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconFolderLister::GenerateFolderListL( RBufWriteStream& aStream, const TDesC& aStartPath,
+ const TInt aLevelsToSearch )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aStartPath: %S", &aStartPath );
+ LOGGER_WRITE_1("aLevelsToSearch: %d", aLevelsToSearch );
+ TInt levelsToSearch = aLevelsToSearch;
+ if ( levelsToSearch > KMaxLevelsToSearch || levelsToSearch == KErrNotFound )
+ levelsToSearch = KMaxLevelsToSearch;
+ iFolders = 0;
+ iFiles = 0;
+ const TInt KDriveNameLength( 3 );
+
+ if ( aStartPath.CompareF( _L("\\") ) == 0 )
+ {
+ LOGGER_WRITE("List all drives");
+ aStream.WriteUint16L( KFormatVersion );
+ ListAllDrivesL( aStream, levelsToSearch );
+ }
+ else if ( aStartPath.Length() >= KDriveNameLength )
+ {
+ if ( aStartPath.Length() > KDriveNameLength )
+ {
+ // check root path permissions, is listing allowed
+ TPtrC path = aStartPath.Mid(KDriveNameLength);
+ LOGGER_WRITE_1("pathFromRoot: %S", &path);
+ TInt pathEndMark = path.Locate(TChar('\\'));
+ if ( pathEndMark == KErrNotFound )
+ {
+ User::Leave( KErrArgument );
+ }
+ //"private\" locate = 7"
+ TPtrC pathName = aStartPath.Left( KDriveNameLength+pathEndMark );
+ LOGGER_WRITE_1("pathName: %S", &path);
+ TEntry pathEntry;
+ User::LeaveIfError( iFs.Entry(pathName, pathEntry) );
+
+ TBool printable = IsDirectoryPrintable( aStartPath.Left(3), pathEntry );
+ if ( !printable )
+ {
+ // access denied
+ LOGGER_WRITE("Access denied!");
+ User::Leave( KErrAccessDenied );
+ }
+ User::LeaveIfError( iFs.Entry(aStartPath, pathEntry) );
+ if ( pathEntry.IsSystem() )
+ {
+ // access denied
+ LOGGER_WRITE("System folder, Access denied!");
+ User::Leave( KErrAccessDenied );
+ }
+ }
+
+
+ aStream.WriteUint16L( KFormatVersion );
+
+ TInt drive;
+ User::LeaveIfError( iFs.CharToDrive( aStartPath[0], drive) );
+ ListDriveAndPathL( aStream, drive, aStartPath, levelsToSearch);
+
+ }
+ else
+ {
+ LOGGER_WRITE("aStartPath KErrArgument");
+ User::Leave( KErrArgument );
+ }
+
+
+ LOGGER_WRITE_1("iFolders: %d", iFolders);
+ LOGGER_WRITE_1("iFiles: %d", iFiles);
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconFolderLister::ListAllDrivesL( RBufWriteStream& aStream, const TInt aLevelsToSearch )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt devDriveCount = 0;
+ TInt mmcDriveCount = 0;
+ TChar driveLetter;
+ TBuf8<1> driveBuf;
+ RArray<TSconDriveInfo> sconDriveInfo(5);
+
+ // Write all drives to folderlisting object
+ TDriveList driveList;
+ // Get all drives that are visible to the user.
+ TInt driveCount;
+ User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) );
+
+ for( TInt i = EDriveA; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) );
+ //LOGGER_WRITE_1( "DriveInfo for drive: %d", i);
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt
+ || (driveStatus & DriveInfo::EDriveRemote) )
+ {
+ //LOGGER_WRITE_1( "skip drive %d", i);
+ continue;
+ }
+
+ User::LeaveIfError( iFs.DriveToChar( i, driveLetter ) );
+ //Letter to uppercase form.
+ driveLetter.UpperCase();
+
+ TSconDriveInfo info;
+ info.iDriveStatus = driveStatus;
+ info.iDriveLetter.Zero();
+ info.iDriveLetter.Append( driveLetter );
+ info.iDriveLetter.Append( _L(":") );
+
+
+ info.iDriveAttr = KEntryAttNormal; // ReadWrite
+
+ if( driveStatus & DriveInfo::EDriveInternal && devDriveCount==0 )
+ {
+ //permission always R for first internal drive
+ info.iDriveAttr = KEntryAttReadOnly;
+ }
+
+ //memory type
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ LOGGER_WRITE( "DriveInfo::EDriveInternal" );
+ devDriveCount++;
+ info.iDriveType = DriveInfo::EDriveInternal; // =1
+ info.iDriveTypeCount = devDriveCount;
+
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ LOGGER_WRITE( "DriveInfo::EDriveRemovable" );
+ mmcDriveCount++;
+ info.iDriveType = DriveInfo::EDriveRemovable;; // =2
+ info.iDriveTypeCount = mmcDriveCount;
+ }
+
+ TVolumeInfo volumeInfo;
+ User::LeaveIfError( iFs.Volume( volumeInfo, i) );
+
+ info.iVolumeName = volumeInfo.iName;
+ if ( volumeInfo.iFree > iCriticalLevel )
+ {
+ volumeInfo.iFree = volumeInfo.iFree - iCriticalLevel;
+ }
+ else
+ {
+ volumeInfo.iFree = 0;
+ }
+
+ info.iFree = volumeInfo.iFree;
+ info.iSize = volumeInfo.iSize;
+
+
+ sconDriveInfo.AppendL( info );
+
+ }
+ }
+
+ LOGGER_WRITE_1("Drives: %d", sconDriveInfo.Count());
+ aStream.WriteUint8L( sconDriveInfo.Count() );
+ for ( TInt i=0; i < sconDriveInfo.Count(); i++ )
+ {
+
+ TBuf<3> path(KNullDesC);
+ path.Copy(sconDriveInfo[i].iDriveLetter);
+ path.Append(_L("\\"));
+
+ ExportDriveL( aStream, sconDriveInfo[i], path, aLevelsToSearch);
+ }
+ sconDriveInfo.Close();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconFolderLister::ListDriveAndPathL( RBufWriteStream& aStream, TInt aDrive, const TDesC& aStartPath, const TInt aLevelsToSearch )
+ {
+ TRACE_FUNC_ENTRY;
+ TVolumeInfo volumeInfo;
+ User::LeaveIfError( iFs.Volume(volumeInfo, aDrive) );
+ TInt driveCount(0);
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, aDrive, driveStatus ) );
+ GetDriveTypeNumberL( aDrive, driveStatus, driveCount );
+
+
+ TSconDriveInfo info;
+ info.iDriveLetter.Copy( aStartPath.Left(2) );
+ info.iVolumeName = volumeInfo.iName;
+
+ info.iDriveAttr = KEntryAttNormal; // ReadWrite
+ if( driveStatus & DriveInfo::EDriveInternal && driveCount==0 )
+ {
+ //permission always R for first internal drive
+ info.iDriveAttr = KEntryAttReadOnly;
+ }
+ info.iDriveType = 0;
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ info.iDriveType = DriveInfo::EDriveInternal; // =1
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ info.iDriveType = DriveInfo::EDriveRemovable;; // =2
+ }
+
+ if ( volumeInfo.iFree > iCriticalLevel )
+ {
+ volumeInfo.iFree = volumeInfo.iFree - iCriticalLevel;
+ }
+ else
+ {
+ volumeInfo.iFree = 0;
+ }
+
+ info.iFree = volumeInfo.iFree;
+ info.iSize = volumeInfo.iSize;
+
+ aStream.WriteUint8L( 1 );
+ ExportDriveL( aStream, info, aStartPath, aLevelsToSearch);
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconFolderLister::ExportDriveL( RBufWriteStream& aStream, const TSconDriveInfo& aDriveInfo,
+ const TDesC& aPathName, const TInt aLevelsToSearch )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("Drive: %S", &aDriveInfo.iDriveLetter);
+ LOGGER_WRITE_1("aLevelsToSearch: %d", aLevelsToSearch );
+
+ CSconFolderEntry* driveEntry = CSconFolderEntry::NewLC();
+ driveEntry->iName = aDriveInfo.iDriveLetter.AllocL();
+
+ if ( driveEntry->iLabel )
+ {
+ LOGGER_WRITE_1("Label: %S", &driveEntry->iLabel->Des());
+ }
+ driveEntry->iAtt = aDriveInfo.iDriveAttr;
+
+ driveEntry->iDriveInfoEntryExists = ETrue;
+ driveEntry->iDriveInfoEntry.iDriveType = aDriveInfo.iDriveType;
+ driveEntry->iDriveInfoEntry.iDriveTypeCount = aDriveInfo.iDriveTypeCount;
+
+ driveEntry->iDriveInfoEntry.iFree = aDriveInfo.iFree;
+ driveEntry->iDriveInfoEntry.iSize = aDriveInfo.iSize;
+
+ driveEntry->iLabel = aDriveInfo.iVolumeName.AllocL();
+ GetLocalizedVolumeNameL( *driveEntry );
+
+ ExportPathL( aStream, aPathName, *driveEntry, ETrue, aLevelsToSearch );
+ CleanupStack::PopAndDestroy( driveEntry );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconFolderLister::GetLocalizedVolumeNameL( CSconFolderEntry& aDriveEntry )
+ {
+ TRACE_FUNC_ENTRY;
+ // Get localized names
+ if ( aDriveEntry.iDriveInfoEntry.iDriveType == DriveInfo::EDriveInternal
+ && aDriveEntry.iDriveInfoEntry.iDriveTypeCount > 1 )
+ {
+ LOGGER_WRITE("Internal mass memory");
+ // internal second memory (Mass memory)
+ TFileName file( KSConResourceName );
+ BaflUtils::NearestLanguageFile( iFs, file );
+
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+ if ( aDriveEntry.iLabel )
+ {
+ delete aDriveEntry.iLabel;
+ aDriveEntry.iLabel = NULL;
+ }
+ aDriveEntry.iLabel = reader->ReadResourceString( R_SECON_VALUE_MASS_STORAGE ).AllocL();
+ delete reader;
+ }
+ else if ( aDriveEntry.iLabel && aDriveEntry.iLabel->Length()>0 )
+ {
+ LOGGER_WRITE("Use normal volume label");
+
+ }
+ else
+ {
+ TFileName file( KSConResourceName );
+ BaflUtils::NearestLanguageFile( iFs, file );
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+ if (aDriveEntry.iLabel)
+ {
+ delete aDriveEntry.iLabel;
+ aDriveEntry.iLabel = NULL;
+ }
+ if ( aDriveEntry.iDriveInfoEntry.iDriveType == DriveInfo::EDriveRemovable )
+ {
+ LOGGER_WRITE("EDriveRemovable");
+ // read default MMC name
+ aDriveEntry.iLabel = reader->ReadResourceString( R_SECON_VALUE_MMC ).AllocL();
+ }
+ else
+ {
+ LOGGER_WRITE("EDriveInternal");
+ // read default DEV name
+ aDriveEntry.iLabel = reader->ReadResourceString( R_SECON_VALUE_DEVICE ).AllocL();
+ }
+ delete reader;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSconFolderLister::GetDriveTypeNumberL()
+//
+// -----------------------------------------------------------------------------
+//
+void CSconFolderLister::GetDriveTypeNumberL( TInt aDrive, TUint aDriveStatus , TInt& aTypeNumber)
+ {
+ TRACE_FUNC_ENTRY;
+ aTypeNumber = 0;
+
+ //TUint driveStatus;
+ //
+ // if true, search internal drives, else search removable drives
+ TBool searchInternalDrives = (aDriveStatus & DriveInfo::EDriveInternal);
+
+ TInt driveCount;
+ TDriveList driveList;
+
+ User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) );
+
+ for( TInt i = EDriveA; i <= aDrive; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) );
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "not present or corrupted" );
+ continue;
+ }
+
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ if( searchInternalDrives )
+ {
+ aTypeNumber++;
+ }
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ if( !searchInternalDrives )
+ {
+ aTypeNumber++;
+ }
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconFolderLister::ExportPathL( RBufWriteStream& aStream, const TDesC& aPathName,
+ const CSconFolderEntry& aEntry, const TBool aLocalize, const TInt aLevelsToSearch )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aPathName: %S", &aPathName );
+ LOGGER_WRITE_1("aLevelsToSearch: %d", aLevelsToSearch );
+
+ LOGGER_WRITE_1("aEntry.iName: %S", &aEntry.iName->Des() );
+
+ TBool localized(EFalse);
+
+ // foldername length + name
+ aStream.WriteUint8L( aEntry.iName->Length() );
+ aStream.WriteL( aEntry.iName->Des() );
+
+ TUint att = aEntry.iAtt;
+
+ if ( aEntry.iLabel && aEntry.iLabel->Length() > 0 )
+ {
+ aStream.WriteUint8L( aEntry.iLabel->Length() );
+ aStream.WriteL( aEntry.iLabel->Des() );
+ }
+ else
+ {
+ if ( aLocalize )
+ {
+ // initialize Localizer
+ iLocalizer->SetFullPath( aPathName );
+ localized = iLocalizer->IsLocalized();
+ }
+
+ if( localized )
+ {
+ const TDesC& localizedName = iLocalizer->LocalizedName();
+ aStream.WriteUint8L( localizedName.Length() );
+ aStream.WriteL( localizedName );
+ LOGGER_WRITE_1("LocalizedName: %S", &localizedName );
+ }
+ else if ( aPathName.CompareF(_L("C:\\Data\\")) == 0 )
+ {
+ TFileName file( KSConResourceName );
+
+ BaflUtils::NearestLanguageFile( iFs, file );
+
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+ CleanupStack::PushL( reader );
+
+ const TDesC& localizedName = reader->ReadResourceString( R_SECON_DATA_FOLDER );
+ aStream.WriteUint8L( localizedName.Length() );
+ aStream.WriteL( localizedName );
+ LOGGER_WRITE_1("LocalizedName: %S", &localizedName );
+
+ CleanupStack::PopAndDestroy( reader );
+ localized = ETrue;
+ }
+ else
+ {
+ aStream.WriteUint8L( 0 );
+ }
+ // attributes
+ if ( localized )
+ {
+ // localized folder, set readonly flag
+ att = att | KEntryAttReadOnly;
+ }
+ }
+
+ if ( aPathName.Length() == 3 && aLocalize )
+ {
+ // enable subfolder localization, even when root cannot be localized
+ localized = ETrue;
+ }
+
+ // DriveInfoEntry
+ if ( aEntry.iDriveInfoEntryExists )
+ {
+ aStream.WriteUint8L( 1 );
+ aStream.WriteUint8L( aEntry.iDriveInfoEntry.iDriveType );
+ aStream.WriteUint8L( aEntry.iDriveInfoEntry.iDriveTypeCount );
+ aStream << aEntry.iDriveInfoEntry.iFree;
+ aStream << aEntry.iDriveInfoEntry.iSize;
+ }
+ else
+ {
+ aStream.WriteUint8L( 0 );
+ }
+
+
+ // modified time
+ TDateTime time = aEntry.iModified.DateTime();
+ aStream.WriteInt16L( time.Year() );
+ aStream.WriteInt8L( time.Month()+1 ); // range 1...12
+ aStream.WriteInt8L( time.Day()+1 );
+ aStream.WriteInt8L( time.Hour() );
+ aStream.WriteInt8L( time.Minute() );
+ aStream.WriteInt8L( time.Second() );
+
+ // write attribute
+ aStream.WriteUint32L( att );
+
+
+ if ( aLevelsToSearch == 0 )
+ {
+ // don't list directory content
+ LOGGER_WRITE("Not listing directory content");
+ aStream.WriteInt16L( 0 ); // files count
+ aStream.WriteInt16L( 0 ); // directory count
+ return;
+ }
+
+ CDir *fileList = 0;
+ CDir *dirList = 0;
+
+ // show normal and hidden files and folders
+ TUint entryAttMask = KEntryAttNormal | KEntryAttHidden;
+
+ // get folders and files
+ TInt err = iFs.GetDir( aPathName, entryAttMask, ESortByName,
+ fileList, dirList );
+
+ if ( err )
+ {
+ LOGGER_WRITE_1( "ParseFolderListL GetDir returned: %d", err );
+ User::Leave( err );
+ }
+
+ CleanupStack::PushL( dirList );
+ CleanupStack::PushL( fileList );
+
+
+ LOGGER_WRITE_1("files: %d", fileList->Count());
+ aStream.WriteUint16L( fileList->Count() );
+
+ // Print files to folder listing object
+ for( TInt i = 0; i < fileList->Count(); i++ )
+ {
+ const TEntry& fileEntry = ( *fileList )[i];
+ iFiles++;
+ LOGGER_WRITE_1("fileEntry.iName: %S", &fileEntry.iName);
+ // filename length + name
+ aStream.WriteUint8L( fileEntry.iName.Length() );
+ aStream.WriteL( fileEntry.iName );
+
+ // modified time
+ TDateTime time = fileEntry.iModified.DateTime();
+ aStream.WriteInt16L( time.Year() );
+ aStream.WriteInt8L( time.Month()+1 ); // range 1...12
+ aStream.WriteInt8L( time.Day()+1 );
+ aStream.WriteInt8L( time.Hour() );
+ aStream.WriteInt8L( time.Minute() );
+ aStream.WriteInt8L( time.Second() );
+
+ // attributes
+ aStream.WriteUint32L( fileEntry.iAtt );
+
+ // file size
+ aStream.WriteUint32L( fileEntry.iSize );
+ }
+ CleanupStack::PopAndDestroy( fileList );
+
+
+ // calculate ow many directories we are going to list
+ TInt directoryCount(0);
+ for( TInt i = 0; i < dirList->Count(); i++ )
+ {
+ if ( IsDirectoryPrintable(aPathName, ( *dirList )[i] ) )
+ {
+ directoryCount++;
+ }
+ }
+ LOGGER_WRITE_1("directories: %d", directoryCount);
+ aStream.WriteUint16L( directoryCount );
+
+ HBufC* fullpath = HBufC::NewL( KMaxPath );
+ TPtr fullpathPtr = fullpath->Des();
+ CleanupStack::PushL( fullpath );
+
+ // Print folders to folder listing object
+ for( TInt i = 0; i < dirList->Count(); i++ )
+ {
+ const TEntry& folderEntry = ( *dirList )[i];
+ if ( !IsDirectoryPrintable(aPathName, folderEntry) )
+ {
+ continue;
+ }
+ iFolders++;
+
+ fullpathPtr.Copy( aPathName );
+ fullpathPtr.Append( folderEntry.iName );
+ fullpathPtr.Append( _L("\\") );
+ CSconFolderEntry* subFolderEntry = CSconFolderEntry::NewLC( folderEntry );
+ if ( aLevelsToSearch == KErrNotFound )
+ {
+ ExportPathL( aStream, fullpathPtr, *subFolderEntry, localized, aLevelsToSearch);
+ }
+ else
+ {
+ ExportPathL( aStream, fullpathPtr, *subFolderEntry, localized, aLevelsToSearch-1);
+ }
+ CleanupStack::PopAndDestroy( subFolderEntry );
+ }
+ CleanupStack::PopAndDestroy( fullpath );
+ CleanupStack::PopAndDestroy( dirList );
+
+ TRACE_FUNC_EXIT;
+ }
+TBool CSconFolderLister::IsDirectoryPrintable( const TDesC& aParentPath, const TEntry& aFolderEntry )
+ {
+ if ( aFolderEntry.IsSystem() )
+ {
+ LOGGER_WRITE_1("folder '%S' was system folder", &aFolderEntry.iName);
+ return EFalse;
+ }
+ if ( aParentPath.Length() == 3 )
+ {
+ if ( aParentPath.FindF(_L("C:\\")) == 0 && aFolderEntry.iName.CompareF(_L("data")) != 0 )
+ {
+ // C root not visible, exept Data folder
+ LOGGER_WRITE_1("folder '%S' not visible to user in c-root", &aFolderEntry.iName);
+ return EFalse;
+ }
+
+ if ( aFolderEntry.iName.CompareF(_L("private")) == 0 )
+ {
+ LOGGER_WRITE_1("folder '%S' not visible to user", &aFolderEntry.iName);
+ return EFalse;
+ }
+ else if ( aFolderEntry.iName.CompareF(_L("sys")) == 0 )
+ {
+ LOGGER_WRITE_1("folder '%S' not visible to user", &aFolderEntry.iName);
+ return EFalse;
+ }
+ else if ( aFolderEntry.iName.CompareF(_L("system")) == 0 )
+ {
+ LOGGER_WRITE_1("folder '%S' not visible to user", &aFolderEntry.iName);
+ return EFalse;
+ }
+ else if ( aFolderEntry.iName.CompareF(_L("resource")) == 0 )
+ {
+ LOGGER_WRITE_1("folder '%S' not visible to user", &aFolderEntry.iName);
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/src/sconimsireader.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconImsiReader implementation
+*
+*/
+
+
+#include "sconimsireader.h"
+#include "debug.h"
+
+TInt CSconImsiReader::GetImsiL( TDes& aImsi )
+ {
+ TRACE_FUNC_ENTRY;
+ CTelephony::TRegistrationStatus temp;
+ CSconImsiReader* self = new (ELeave) CSconImsiReader(aImsi, temp);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ self->RequestImsi();
+
+ TInt err = self->iStatus.Int();
+ CleanupStack::PopAndDestroy(self);
+ TRACE_FUNC_RET(err);
+ return err;
+ }
+
+TInt CSconImsiReader::GetNetworkStatusL( CTelephony::TRegistrationStatus& aRegistrationStatus )
+ {
+ TRACE_FUNC_ENTRY;
+ TBuf<CTelephony::KIMSISize> temp;
+ CSconImsiReader* self = new (ELeave) CSconImsiReader(temp, aRegistrationStatus);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+
+ self->RequestNetworkStatus();
+
+ TInt err = self->iStatus.Int();
+ CleanupStack::PopAndDestroy(self);
+ TRACE_FUNC_RET(err);
+ return err;
+ }
+
+void CSconImsiReader::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iTelephony = CTelephony::NewL();
+ CActiveScheduler::Add(this);
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconImsiReader::RequestImsi()
+ {
+ iImsiReaderStatus = ERequestingImsi;
+ iTelephony->GetSubscriberId(iStatus,iSubscriberIdV1Pckg);
+ SetActive();
+ CActiveScheduler::Start();
+ }
+
+void CSconImsiReader::RequestNetworkStatus()
+ {
+ iImsiReaderStatus = ERequestingNetworkStatus;
+ iTelephony->GetNetworkRegistrationStatus(iStatus, iNetworkRegistrationV1Pckg);
+ SetActive();
+ CActiveScheduler::Start();
+ }
+
+CSconImsiReader::~CSconImsiReader()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iTelephony;
+ TRACE_FUNC_EXIT;
+ }
+
+CSconImsiReader::CSconImsiReader(TDes& aImsi, CTelephony::TRegistrationStatus& aRegistrationStatus): CActive(EPriorityStandard),
+ iImsi(aImsi), iNetworkStatus(aRegistrationStatus), iSubscriberIdV1Pckg(iSubscriberIdV1), iNetworkRegistrationV1Pckg(iNetworkRegistrationV1)
+ {
+ }
+
+void CSconImsiReader::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("iStatus: %d", iStatus.Int() );
+ if ( iStatus == KErrNone )
+ {
+ if ( iImsiReaderStatus == ERequestingImsi )
+ {
+ iImsi = iSubscriberIdV1.iSubscriberId;
+ LOGGER_WRITE_1("iImsi: %S", &iImsi);
+ }
+ else if ( iImsiReaderStatus == ERequestingNetworkStatus )
+ {
+ iNetworkStatus = iNetworkRegistrationV1.iRegStatus;
+ LOGGER_WRITE_1( "iNetworkStatus: %d", (TInt)iNetworkStatus);
+ }
+ }
+ CActiveScheduler::Stop();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconImsiReader::DoCancel()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iImsiReaderStatus == ERequestingImsi )
+ {
+ iTelephony->CancelAsync( CTelephony::EGetSubscriberIdCancel );
+ }
+ else if ( iImsiReaderStatus == ERequestingNetworkStatus )
+ {
+ iTelephony->CancelAsync( CTelephony::EGetNetworkRegistrationStatusCancel );
+ }
+ TRACE_FUNC_EXIT;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/pcconn/src/sconpcconnserver.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3028 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity server
+*
+*/
+
+
+#include <s32mem.h> // For RMemReadStream
+#include <utf.h>
+#include <Etel3rdParty.h>
+#include <f32file.h>
+
+#include "sconpcconnclientserver.h"
+#include "sconpcconnserver.h"
+#include "sconpcd.h"
+#include "sconcsc.h"
+#include "sconconmlhandler.h"
+#include "sconimsireader.h"
+#include "sconoviaccounthandler.h"
+#include "sconfolderlister.h"
+#include "sconbtengine.h"
+#include "debug.h"
+
+#ifdef DEBUG_XML
+#include <s32file.h>
+_LIT8( KTimeFormat, "%02d:%02d:%02d.%03d" );
+_LIT8( KXmlBegin, "\nXML:\n" );
+#endif
+
+_LIT( KSCONGetMetadataRequest, "METADATA:" );
+_LIT8( KSCONSyncRequest, "SYNC:" );
+_LIT( KSCONReadImsi, "READIMSI");
+_LIT( KSCONReadNetworkInfo, "READNETWORKINFO");
+_LIT( KSCONReadOviAccount, "READOVIACCOUNT");
+_LIT( KSCONListPath, "LISTP:");
+_LIT( KSCONReadBtInfo, "READBTINFO" );
+_LIT( KSCONSetBtPower, "SETBTPOWER:" );
+_LIT( KSCONSetBtName, "SETBTNAME:" );
+_LIT( KSCONSetBtAuthorized, "SETBTAUTHORIZED:" );
+
+//------------------------------------------------------------
+// Global functions
+//------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// E32Main()
+// Entry point
+// -----------------------------------------------------------------------------
+//
+TInt E32Main()
+ {
+ TRACE_FUNC_ENTRY;
+ __UHEAP_MARK;
+ TInt error( KErrNone );
+ error = CSConPCConnServer::RunServer();
+ __UHEAP_MARKEND;
+ TRACE_FUNC_EXIT;
+ return error;
+ }
+
+// -----------------------------------------------------------------------------
+// PanicServer()
+// Panics the server with panic reason aPanic
+// -----------------------------------------------------------------------------
+//
+GLDEF_C void PanicServer(TPCConnServPanic aPanic)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::PanicServer() : Panic code %d", aPanic );
+ _LIT(KTxtServerPanic,"PCConn server panic");
+ User::Panic(KTxtServerPanic,aPanic);
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::CSConPCConnServer ()
+// Default constructor - can not leave
+// -----------------------------------------------------------------------------
+//
+CSConPCConnServer::CSConPCConnServer () : CServer2( EPriorityStandard)
+ {
+ LOGGER_WRITE( "* * * * CSConPCConnServer * * * *" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::~CSConPCConnServer()
+// Default destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConPCConnServer::~CSConPCConnServer()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::NewLC()
+// Creates a new instance of CSConPCConnServer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConPCConnServer* CSConPCConnServer::NewLC()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConPCConnServer* self = new (ELeave) CSConPCConnServer();
+ CleanupStack::PushL( self );
+ self->StartL( KSConPCConnServerName );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::NewSessionL()
+// Creates a new session to the client
+// -----------------------------------------------------------------------------
+//
+CSession2* CSConPCConnServer::NewSessionL(
+ const TVersion &aVersion, const RMessage2& /*aMessage*/ ) const
+ {
+ TRACE_FUNC_ENTRY;
+
+ // check version
+ TVersion version( KSConPCConnServerVersionMajor,
+ KSConPCConnServerVersionMinor,
+ KSConPCConnServerVersionBuild);
+
+ if (!User::QueryVersionSupported(version, aVersion))
+ {
+ User::Leave(KErrNotSupported);
+ }
+
+ // check client identity
+ RThread client;
+ Message().Client( client );
+ TSecureId clientId = client.SecureId();
+
+ if ( clientId != KSConPCConnClientSecureId )
+ {
+ LOGGER_WRITE( "CSConPCConnServer::NewSessionL() : Secure ID does not match" );
+#ifndef __WINS__
+ LOGGER_WRITE( "Leave KErrAccessDenied");
+ User::Leave( KErrAccessDenied );
+#else
+ // does not leave on WINS environment. Easier to run module tests.
+ LOGGER_WRITE( "Not leaving on WINS environment" );
+#endif
+ }
+
+ TRACE_FUNC_EXIT;
+ return CSConPCConnSession::NewL( *CONST_CAST( CSConPCConnServer*, this));
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::RunServer()
+// Starts the server
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnServer::RunServer()
+ {
+ TRACE_FUNC_ENTRY;
+
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+ TInt ret = KErrNoMemory;
+ if( cleanup )
+ {
+ TRAP( ret, CSConPCConnServer::RunServerL( ) );
+ delete cleanup;
+ }
+ if( ret != KErrNone )
+ {
+ // Signal the client that server creation failed
+ RProcess::Rendezvous( ret );
+ }
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::RunServerL()
+// Starts the server
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnServer::RunServerL()
+ {
+ // Create and install the active scheduler we need
+ TRACE_FUNC_ENTRY;
+ CActiveScheduler *as=new (ELeave)CActiveScheduler;
+ CleanupStack::PushL( as );
+ CActiveScheduler::Install( as );
+
+ // Create server
+ CSConPCConnServer* server = CSConPCConnServer::NewLC();
+
+ // Initialisation complete, now signal the client
+ User::LeaveIfError( RThread().RenameMe( KSConPCConnServerName ) );
+ RProcess::Rendezvous( KErrNone );
+
+ // Ready to run
+ CActiveScheduler::Start();
+
+ // Cleanup the scheduler
+ CleanupStack::PopAndDestroy( 2, as );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::IncSessionCount()
+// Increments session count
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnServer::IncSessionCount()
+ {
+ TRACE_FUNC_ENTRY;
+ iSessionCount++;
+ LOGGER_WRITE_1( "There are now %d sessions", iSessionCount );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnServer::DecSessionCount()
+// Decrements session count
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnServer::DecSessionCount()
+ {
+ TRACE_FUNC_ENTRY;
+ iSessionCount--;
+ LOGGER_WRITE_1( "There are still %d sessions", iSessionCount );
+ if ( iSessionCount < 1 )
+ {
+ Cancel();
+ CActiveScheduler::Stop();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::CSConPCConnSession()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConPCConnSession::CSConPCConnSession (
+ CSConPCConnServer& aServer ) : iServer (aServer)
+ {
+ TRACE_FUNC_ENTRY;
+ iServer.IncSessionCount();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::CSConPCConnSession()
+// Default destructor - frees resources
+// -----------------------------------------------------------------------------
+//
+CSConPCConnSession::~CSConPCConnSession()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iServer.DecSessionCount();
+
+ if ( iConMLHandler )
+ {
+ delete iConMLHandler;
+ iConMLHandler = NULL;
+ iConMLHandlerLib.Close();
+ }
+
+ if ( iPCDHandler )
+ {
+ delete iPCDHandler;
+ iPCDHandler = NULL;
+ iPCDlib.Close();
+ }
+
+ if ( iCSCHandler )
+ {
+ delete iCSCHandler;
+ iCSCHandler = NULL;
+ iCSClib.Close();
+ }
+
+ if ( iBuffer )
+ {
+ delete iBuffer;
+ iBuffer = NULL;
+ }
+
+ iChunk.Close();
+ delete iFolderLister;
+
+ iFs.Close();
+
+ delete iBtEngine;
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::NewL()
+// Creates a new instance of CSConPCConnSession
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConPCConnSession *CSConPCConnSession::NewL(
+ CSConPCConnServer& aServer)
+ {
+ TRACE_FUNC_ENTRY;
+ CSConPCConnSession* self = new ( ELeave ) CSConPCConnSession(aServer);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::ConstructL()
+// 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ iResult = KErrNone;
+
+ User::LeaveIfError( iFs.Connect() );
+
+#ifdef DEBUG_XML
+ // create log file
+
+ RFile file;
+ TInt err = file.Create ( iFs, KSConConMLDebugFile, EFileWrite );
+ if( err == KErrNone )
+ {
+ // file created, close it
+ file.Close();
+ }
+#endif
+
+ // initialize buffer
+ iBuffer = CBufFlat::NewL ( KSConPCConnBufferMaxSize );
+
+ // load handlers
+ if ( !iPCDHandler )
+ {
+ TRAP( ret, LoadPCDDllL() );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : PCD load failed with error code %d", ret );
+ User::Leave( ret );
+ }
+ }
+
+ if ( !iCSCHandler )
+ {
+ TRAP( ret, LoadCSCDllL() );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : CSC dll load failed with error code %d", ret );
+ User::Leave ( ret );
+ }
+ }
+
+ // Load parser
+ if ( !iConMLHandler )
+ {
+ TRAPD( ret, LoadConMLHandlerDllL() );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::ConstructL() : Parser dll load failed with error code %d", ret );
+ User::Leave ( ret );
+ }
+ }
+
+ iFolderLister = CSconFolderLister::NewL( iFs );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::ServiceL()
+// Gets the client's request
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::ServiceL( const RMessage2 &aMessage)
+ {
+ TRACE_FUNC_ENTRY;
+ TRAPD(err,DispatchRequestL(aMessage) );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::ServiceL() : leave code %d", err );
+ PanicServer( E_DispatchRequest );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DispatchRequestL()
+// Identifies an IPC command from the client
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::DispatchRequestL(const RMessage2 &aMessage)
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret (KErrNone);
+
+ switch (aMessage.Function())
+ {
+ case EPutMessage:
+ LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EPutMessage" );
+ ret = HandlePutMessageL();
+ break;
+
+ case EGetMessage:
+ LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EGetMessage" );
+ ret = HandleGetMessageL();
+ break;
+
+ case EResetMessage:
+ LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EResetMessage" );
+ ret = HandleResetMessage();
+ break;
+
+ case EChunkMessage:
+ LOGGER_WRITE( "CSConPCConnSession::DispatchRequestL() : EChunkMessage" );
+ ret = HandleChunkMessage( aMessage );
+ break;
+
+ default:
+ PanicServer (E_BadRequest);
+ break;
+ }
+
+ aMessage.Complete( ret );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HandlePutMessageL()
+// Handles a PUT -type message from the client
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::HandlePutMessageL()
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() : begin : Heap count : %d", User::Heap().Count() );
+ TInt ret ( KErrNone );
+
+ if ( !iPCDHandler )
+ {
+ TRAP( ret, LoadPCDDllL() );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL (): PCD dll load failed with error code %d", ret );
+ return ( ret );
+ }
+ }
+
+ if ( ! iConMLHandler )
+ {
+ TRAP ( ret, LoadConMLHandlerDllL() );
+ if ( ret != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL (): ConML Handler dll load failed with error code %d", ret );
+ return ( ret );
+ }
+ }
+
+ TInt length ( 0 );
+
+ RMemReadStream buf( iChunk.Base(), iChunk.Size() );
+
+
+ iBuffer->Reset();
+
+ length = buf.ReadInt32L();
+ HBufC8* name8 = HBufC8::NewLC( length );
+ TPtr8 namePtr8 = name8->Des();
+ buf.ReadL( namePtr8, length);
+
+ const TUint8* ptr8 = namePtr8.Ptr();
+ const TUint16* ptr16 = reinterpret_cast<const TUint16*>( ptr8 );
+ TPtrC namePtr;
+ namePtr.Set( ptr16, length/2 );
+
+ length = buf.ReadInt32L();
+ HBufC8* type = HBufC8::NewLC( length );
+ TPtr8 typePtr = type->Des();
+ buf.ReadL( typePtr, length);
+
+ // WBXML Document
+ length = buf.ReadInt32L();
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 dataPtr = data->Des();
+
+ buf.ReadL( dataPtr, length );
+ iBuffer->ResizeL( length );
+ iBuffer->Write( 0, dataPtr );
+
+ buf.Close();
+
+#ifdef DEBUG_XML
+
+ RFile file;
+ if ( file.Open( iFs, KSConConMLDebugFile, EFileWrite ) == KErrNone )
+ {
+ RFileWriteStream fws;
+ TInt fileSize;
+ file.Size( fileSize );
+
+ TTime now;
+ now.HomeTime();
+ TDateTime time = now.DateTime();
+ TBuf8<16> timeLine;
+ timeLine.Format (KTimeFormat, time.Hour(), time.Minute(),
+ time.Second(), time.MicroSecond() );
+
+ fws.Attach( file, fileSize );
+ fws.PushL();
+ fws.WriteL( timeLine );
+ _LIT8( KPutMessage, "__________PUT-MESSAGE \nWBXML:\n" );
+ fws.WriteL( KPutMessage );
+ fws.WriteL( iBuffer->Ptr(0), iBuffer->Size() );
+ TRAP_IGNORE( fws.CommitL() );
+ fws.Close();
+
+ CleanupStack::PopAndDestroy( &fws );
+ }
+ file.Close();
+#endif
+ if ( ( ( typePtr.CompareC( KSConPCDWBXMLObjectType)== KErrNone ) ||
+ ( typePtr.CompareC( KSConPCDWBXMLObjectType2 )== KErrNone ) )
+ && namePtr8.Find(KSCONSyncRequest) == 0 )
+ {
+ LOGGER_WRITE_1("Sync request: %S", &namePtr);
+ RBufReadStream stream( *iBuffer );
+
+ CleanupClosePushL( stream );
+ TRAP( ret, iPCDHandler->HandlePutSyncRequestL( namePtr8, stream ));
+ if ( ret )
+ {
+ LOGGER_WRITE_1("HandlePutSyncRequestL() Leaved with %d", ret);
+ }
+
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ else if ( ( typePtr.Compare( KSConPCDWBXMLObjectType ) == KErrNone) ||
+ ( typePtr.Compare( KSConPCDWBXMLObjectType2 )== KErrNone) )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::HandlePutMessageL() : Object type PCD " );
+ TRAPD( err, ret = iConMLHandler->ParseDocumentL( *iBuffer, this ) );
+ if ( err != KErrNone )
+ {
+ ret = err;
+ }
+ if ( ret == KErrNone )
+ {
+ // Possible error code returned from PCCS
+ ret = iResult;
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "Object type not regognized " );
+ ret = KErrNotSupported;
+ }
+ CleanupStack::PopAndDestroy( data );
+ CleanupStack::PopAndDestroy( type );
+ CleanupStack::PopAndDestroy( name8 );
+ LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() end : Heap count : %d", User::Heap().Count() );
+ LOGGER_WRITE_1( "CSConPCConnSession::HandlePutMessageL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HandleGetMessageL()
+// Handles a GET -type message from the client
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::HandleGetMessageL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+
+ if ( !iCSCHandler )
+ {
+ TRAP( ret, LoadCSCDllL() );
+ if ( ret != KErrNone)
+ {
+ LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : CSC dll load failed with error code %d", ret );
+ return ret;
+ }
+ }
+
+ TInt32 length ( 0 );
+ RMemReadStream readBuf( iChunk.Base(), iChunk.Size() );
+ iBuffer->Reset();
+
+ length = readBuf.ReadInt32L();
+ HBufC8* name = HBufC8::NewLC( length );
+ TPtr8 namePtr8 = name->Des();
+ readBuf.ReadL( namePtr8, length);
+ namePtr8.SetLength( length );
+ LOGGER_WRITE8_1("namePtr: %S", &namePtr8);
+
+ const TUint8* ptr8 = namePtr8.Ptr();
+ const TUint16* ptr16 = reinterpret_cast<const TUint16*>( ptr8 );
+ TPtrC namePtr;
+ namePtr.Set( ptr16, length/2 );
+
+ length = readBuf.ReadInt32L();
+ HBufC8* type = HBufC8::NewLC( length );
+ TPtr8 typePtr = type->Des();
+ readBuf.ReadL( typePtr, length);
+
+ readBuf.Close();
+
+ if ( typePtr.Compare( KSConCapabilityObjectType ) == KErrNone )
+ {
+ ret = iCSCHandler->CapabilityObject( *iBuffer );
+
+#ifdef DEBUG_XML
+
+ RFile file;
+ if ( file.Open(iFs, KSConConMLDebugFile, EFileWrite ) == KErrNone )
+ {
+ RFileWriteStream fws;
+ TInt fileSize;
+ file.Size ( fileSize );
+ TTime now;
+ now.HomeTime();
+ TDateTime time = now.DateTime();
+ TBuf8<16> timeLine;
+ timeLine.Format( KTimeFormat, time.Hour(), time.Minute(),
+ time.Second(), time.MicroSecond() );
+
+ fws.Attach ( file, fileSize);
+ fws.PushL();
+ fws.WriteL( timeLine );
+ _LIT8( KGetMessage, "__________GET -MESSAGE - Capability Object \n " );
+ fws.WriteL( KGetMessage );
+ fws.WriteL( iBuffer->Ptr(0), iBuffer->Size() );
+ TRAP_IGNORE( fws.CommitL() );
+ fws.Close();
+
+ CleanupStack::PopAndDestroy( &fws );
+ }
+ file.Close();
+#endif
+
+ }
+ else if ( typePtr.CompareC( KSConPCDWBXMLObjectType) == KErrNone )
+ {
+ if ( namePtr8.Find(KSCONSyncRequest) == 0 ) // 8-bit search
+ {
+ LOGGER_WRITE("Sync request");
+
+ RBufWriteStream stream( *iBuffer );
+
+ CleanupClosePushL( stream );
+
+ TRAP( ret, iPCDHandler->HandleGetSyncRequestL( namePtr8, stream, iChunk.MaxSize() - sizeof(TInt32) ));
+ if ( ret )
+ {
+ LOGGER_WRITE_1("HandleGetSyncRequestL() Leaved with %d", ret);
+ }
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+
+ LOGGER_WRITE_1("iBuffer size: %d", iBuffer->Size());
+
+ }
+ else if ( namePtr.Find(KSCONReadImsi) == 0 ) // 16-bit search
+ {
+ LOGGER_WRITE("Read IMSI");
+ TBuf<CTelephony::KIMSISize> imsi;
+ ret = CSconImsiReader::GetImsiL( imsi );
+
+ if ( ret == KErrNone )
+ {
+ TBuf8<CTelephony::KIMSISize> imsi8;
+ User::LeaveIfError( CnvUtfConverter::ConvertFromUnicodeToUtf8(imsi8,imsi) );
+
+ iBuffer->ResizeL( imsi8.Length() );
+ iBuffer->Write( 0, imsi8 );
+ }
+ else
+ {
+ // Change error code more generic
+ ret = KErrNotFound;
+ }
+ }
+ else if ( namePtr.Find(KSCONReadNetworkInfo) == 0 ) // 16-bit search
+ {
+ LOGGER_WRITE("Read NetworkInfo");
+ CTelephony::TRegistrationStatus regStatus;
+ ret = CSconImsiReader::GetNetworkStatusL( regStatus );
+
+ if ( ret == KErrNone )
+ {
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ stream.WriteInt8L( regStatus );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ else
+ {
+ // Change error code more generic
+ ret = KErrNotFound;
+ }
+ }
+ else if ( namePtr.Find(KSCONReadOviAccount) == 0 )
+ {
+ LOGGER_WRITE("Read Ovi account");
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+
+ ret = ReadOviAccountInfoL( stream );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+
+ }
+ else if ( namePtr.Find(KSCONListPath) == 0 )
+ {
+ LOGGER_WRITE("List path");
+ // LISTP:0:pathname
+ if ( namePtr.Length() > KSCONListPath().Length()+2)
+ {
+ TPtrC pathname = namePtr.Mid( KSCONListPath().Length()+2 );
+
+ const TUint16 levelsChar = namePtr[ KSCONListPath().Length() ];
+ TInt level(KErrNotFound);
+ if ( levelsChar >= TChar('0') )
+ {
+ level = levelsChar - TChar('0');
+ }
+
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ TRAP( ret, iFolderLister->GenerateFolderListL( stream, pathname, level ));
+ LOGGER_WRITE_1("GenerateFolderListL leaved with err: %d", ret);
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ else
+ {
+ ret = KErrArgument;
+ }
+
+ }
+ else if ( namePtr.Find(KSCONReadBtInfo) == 0 )
+ {
+ LOGGER_WRITE( "Read BT info");
+ if ( !iBtEngine )
+ {
+ iBtEngine = CSconBtEngine::NewL();
+ }
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ TRAP( ret, iBtEngine->ReadBTInfoL( stream ) );
+ LOGGER_WRITE_1("ReadBTInfoL leaved with err: %d", ret);
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ else if ( namePtr.Find(KSCONSetBtPower) == 0 )
+ {
+ LOGGER_WRITE( "Change BT Power state");
+ if ( namePtr.Length() == KSCONSetBtPower().Length()+1 )
+ {
+ const TUint16 lastChar = namePtr[ KSCONSetBtPower().Length() ];
+ TBool changeBtOn;
+ if ( lastChar == TChar('0') )
+ {
+ changeBtOn = EFalse;
+ }
+ else if ( lastChar == TChar('1') )
+ {
+ changeBtOn = ETrue;
+ }
+ else
+ {
+ ret = KErrArgument;
+ }
+
+ if ( !ret )
+ {
+ if ( !iBtEngine )
+ {
+ iBtEngine = CSconBtEngine::NewL();
+ }
+ TInt err = iBtEngine->SetBtPowerState( changeBtOn );
+
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ stream.WriteInt32L( err );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ }
+ else
+ {
+ ret = KErrArgument;
+ }
+ }
+ else if ( namePtr.Find(KSCONSetBtName) == 0 )
+ {
+ LOGGER_WRITE( "Set BT Name");
+ TPtrC btName = namePtr.Mid( KSCONSetBtName().Length() );
+ TInt err = iBtEngine->SetBtName( btName );
+
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ stream.WriteInt32L( err );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+ else if ( namePtr.Find(KSCONSetBtAuthorized) == 0 )
+ {
+ LOGGER_WRITE( "Set BT Authorized");
+ ret = KErrArgument;
+ // SETBTAUTHORIZED:0:00245f8d6a26
+ // 1. param = auth. state ("0"=off, "1"=true)
+ // 2. param = bt address (hex string)
+
+ if ( namePtr.Length() > KSCONSetBtAuthorized().Length()+2)
+ {
+ TPtrC btAddr = namePtr.Mid( KSCONSetBtAuthorized().Length()+2 );
+
+ const TUint16 authStateChar = namePtr[ KSCONSetBtAuthorized().Length() ];
+ TBool authorize(EFalse);
+ if ( authStateChar == TChar('0') )
+ {
+ authorize = EFalse;
+ ret = KErrNone;
+ }
+ else if ( authStateChar == TChar('1') )
+ {
+ authorize = ETrue;
+ ret = KErrNone;
+ }
+
+ if ( !iBtEngine )
+ {
+ iBtEngine = CSconBtEngine::NewL();
+ }
+ TRAPD(err, iBtEngine->SetBtAuthorizedL( btAddr, authorize ) );
+
+ RBufWriteStream stream( *iBuffer );
+ CleanupClosePushL( stream );
+ stream.WriteInt32L( err );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ }
+
+ }
+ else
+ {
+ ret = HandleWBXMLGetRequestL( namePtr );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCConnSession::HandleGetMessageL() : Header type not regognized " );
+ ret = KErrNotSupported;
+ }
+
+ CleanupStack::PopAndDestroy( 2 ); // name, type
+
+ if ( ret != KErrNone )
+ {
+ return ret;
+ }
+
+ length = iBuffer->Size();
+
+ if ( sizeof(TInt32) + length > iChunk.Size() )
+ {
+ // need to resize chunk
+ TInt err = iChunk.Adjust( sizeof(TInt32) + length );
+ LOGGER_WRITE_2("iChunk.Adjust( %d ) err: %d", sizeof(TInt32) + length, err);
+ if ( err )
+ {
+ iBuffer->Reset();
+ LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : returned %d", ret );
+ return err;
+ }
+ }
+
+ // copy data to chunk
+ RMemWriteStream writeBuf ( iChunk.Base(), iChunk.Size() );
+
+ if ( length > 0 )
+ {
+ writeBuf.WriteInt32L( length );
+ writeBuf.WriteL( iBuffer->Ptr(0), length );
+ writeBuf.CommitL();
+ }
+ else
+ {
+ writeBuf.WriteInt32L( 0 );
+ }
+ writeBuf.CommitL();
+ writeBuf.Close();
+ iBuffer->Reset();
+ LOGGER_WRITE_1( "CSConPCConnSession::HandleGetMessageL() : returned %d", ret );
+ return ( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HandleWBXMLGetRequestL()
+// Handles a ConML(wbxml) Get request from the client
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::HandleWBXMLGetRequestL( const TDesC& aFileName )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret(KErrNone);
+ if ( aFileName.Find(KSCONGetMetadataRequest) == 0 )
+ {
+ // ConML get metadata request --> Create metadata task
+ LOGGER_WRITE( "ConML GetMetadataRequest" );
+ TPtrC filename = aFileName.Mid( KSCONGetMetadataRequest().Length() );
+
+ TSConMethodName method ( EGetMetadata );
+ CSConTask* task = CSConTask::NewLC( method );
+
+ if ( filename.Length() > task->iGetMetadataParams->iFilename.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+ task->iGetMetadataParams->iFilename = filename;
+
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1("iPCDHandler->PutTaskL ret: %d", ret);
+ }
+ else if ( aFileName.Length() > 0 )
+ {
+ LOGGER_WRITE("Error: aFilename does not match to any definitions");
+ TRACE_FUNC_RET( KErrArgument );
+ return KErrArgument;
+ }
+
+ // Get reply
+ LOGGER_WRITE( "CSConPCConnSession::HandleGetMessageL() before ConML GetReplyL" );
+ CSConStatusReply* reply = iPCDHandler->GetReply();
+ CleanupStack::PushL( reply );
+
+ ConML_ConMLPtr_t content = new ( ELeave ) ConML_ConML_t();
+ CleanupStack::PushL( content );
+
+ AppendStatusL( content, reply );
+ ret = iConMLHandler->GenerateDocument( content );
+
+ CleanupStack::PopAndDestroy( content );
+ CleanupStack::PopAndDestroy( reply );
+
+ TPtrC8 ptr( iConMLHandler->WBXMLDocument() );
+ LOGGER_WRITE_1("ptr.Size(): %d", ptr.Size());
+ iBuffer->ResizeL( ptr.Size() );
+ iBuffer->Write( 0, ptr );
+
+#ifdef DEBUG_XML
+ RFile file;
+ if ( file.Open( iFs, KSConConMLDebugFile, EFileWrite) == KErrNone )
+ {
+ RFileWriteStream fws;
+ TInt fileSize;
+ file.Size ( fileSize );
+ fws.Attach ( file, fileSize);
+ fws.PushL();
+ TTime now;
+ now.HomeTime();
+ TDateTime time = now.DateTime();
+ TBuf8<16> timeLine;
+ timeLine.Format( KTimeFormat, time.Hour(), time.Minute(),
+ time.Second(), time.MicroSecond() );
+
+ fws.WriteL( timeLine );
+ _LIT8( KGetMessage, "__________GET -MESSAGE" );
+ fws.WriteL( KGetMessage );
+ fws.WriteL(KXmlBegin);
+ fws.WriteL(iConMLHandler->XMLDocument().Ptr(),
+ iConMLHandler->XMLDocument().Length());
+ fws.WriteL(_L("\n\n"));
+ TRAP_IGNORE( fws.CommitL() );
+ fws.Close();
+ CleanupStack::PopAndDestroy( &fws );
+ }
+
+ file.Close();
+#endif
+ TRACE_FUNC_RET(ret);
+ return ret;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::ReadOviAccountInfoL()
+// Reads ovi account information to stream
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::ReadOviAccountInfoL( RWriteStream& aAccountInfoStream )
+ {
+ TRACE_FUNC_ENTRY;
+ RLibrary oviaccounthandlerLib;
+ CleanupClosePushL( oviaccounthandlerLib );
+ // Dynamically load DLL
+ TInt err = oviaccounthandlerLib.Load( KSconOviAccountHandlerDllName );
+ if ( err )
+ {
+ LOGGER_WRITE_1("oviaccounthandlerLib.Load err: %d", err);
+ err = KErrNotSupported;
+ }
+ else if( oviaccounthandlerLib.Type()[1] != KSconOviAccountHandlerDllUid )
+ {
+ LOGGER_WRITE_1( "KSconOviAccountHandlerDllUid incorrect... (0x%08X)",oviaccounthandlerLib.Type()[1].iUid );
+ err = KErrNotSupported;
+ }
+
+ if ( err == KErrNone )
+ {
+ TSConCreateCSconOviAccountHandlerFunc CreateCSconOviAccountHandlerL =
+ (TSConCreateCSconOviAccountHandlerFunc)oviaccounthandlerLib.Lookup(1);
+
+ CSconOviAccountHandler* oviAccountHandler = (CSconOviAccountHandler*)CreateCSconOviAccountHandlerL();
+
+ TRAP(err, oviAccountHandler->GetOviAccountDetailsL( aAccountInfoStream ) );
+ LOGGER_WRITE_1("GetOviAccountDetailsL err: %d", err);
+
+ delete oviAccountHandler;
+ oviAccountHandler = NULL;
+
+ if ( err )
+ {
+ // change error code
+ err = KErrNotFound;
+ }
+ }
+ else
+ {
+ err = KErrNotSupported;
+ }
+
+ CleanupStack::PopAndDestroy( &oviaccounthandlerLib );
+ TRACE_FUNC_EXIT;
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HandleResetMessage()
+// Resets the PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::HandleResetMessage()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+
+ // reset PCD
+ if ( iPCDHandler )
+ {
+ iPCDHandler->ResetPCD();
+ }
+
+ LOGGER_WRITE_1( "CSConPCConnSession::HandleResetMessage() : ret %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HandleChunkMessage( const RMessage2& aMessage )
+// Receives the chunk handle from the client
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::HandleChunkMessage( const RMessage2& aMessage )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+
+ ret = iChunk.Open( aMessage, 0, EFalse );
+
+ LOGGER_WRITE_1( "CSConPCConnSession::HandleChunkMessageL() : ret %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::LoadPCDDllL()
+// Loads the PCCS service
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::LoadPCDDllL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ // Dynamically load DLL
+ User::LeaveIfError( iPCDlib.Load( KSConPCDLibName ) );
+ if( iPCDlib.Type()[1] != KSConPCDUid )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::LoadPCDDllL() : KSConPCDUidValue incorrect..." );
+ iPCDlib.Close();
+ User::Leave( KErrNotFound );
+ }
+ TSConCreateCSConPCDFunc CreateCSConPCDL =
+ (TSConCreateCSConPCDFunc)iPCDlib.Lookup(1);
+
+ iPCDHandler = (CSConPCD*)CreateCSConPCDL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::LoadCSCDllL()
+// Loads the CSC service
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::LoadCSCDllL()
+ {
+ TRACE_FUNC_ENTRY;
+ // Dynamically load DLL
+ User::LeaveIfError( iCSClib.Load( KSConCSCLibName ) );
+ if( iCSClib.Type()[1] != KSConCSCUid )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::LoadCSCDllL() : KSConCSCUidValue incorrect" );
+ iCSClib.Close();
+ User::Leave( KErrNotFound );
+ }
+ TSConCreateCSConCSCFunc CreateCSConCSCL =
+ (TSConCreateCSConCSCFunc)iCSClib.Lookup(1);
+
+ iCSCHandler = (CSConCSC*)CreateCSConCSCL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::LoadConMLHandlerDllL()
+// Loads the ConML handler
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::LoadConMLHandlerDllL()
+ {
+ TRACE_FUNC_ENTRY;
+ // Dynamically load DLL
+ User::LeaveIfError( iConMLHandlerLib.Load( KSConConMLHandlerLibName ) );
+ if ( iConMLHandlerLib.Type()[1] != KSConConMLHandlerUid )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::LoadConMLHandlerDllL() : KSConConMLHandlerUidValue incorrect" );
+ iConMLHandlerLib.Close();
+ User::Leave( KErrNotFound );
+ }
+ TSConCreateCSConConMLHandlerFunc CreateCSConConMLHandlerL =
+ (TSConCreateCSConConMLHandlerFunc)iConMLHandlerLib.Lookup(1);
+
+ iConMLHandler = (CSConConMLHandler*)CreateCSConConMLHandlerL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::ConMLL()
+// Callback function for ConML handler - parsed data processing starts
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::ConMLL( ConML_ConMLPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+
+#ifdef DEBUG_XML
+ iConMLHandler->GenerateDocument( aContent );
+ RFile file;
+ if ( file.Open(iFs, KSConConMLDebugFile, EFileWrite) == KErrNone )
+ {
+ RFileWriteStream fws;
+ TInt fileSize;
+ file.Size( fileSize );
+ fws.Attach ( file, fileSize );
+ fws.PushL();
+
+ TTime now;
+ now.HomeTime();
+ TDateTime time = now.DateTime();
+ TBuf8<16> timeLine;
+ timeLine.Format (KTimeFormat, time.Hour(), time.Minute(),
+ time.Second(), time.MicroSecond() );
+
+ fws.WriteL( timeLine );
+ _LIT8( KPutMessage, "__________PUT-MESSAGE" );
+ fws.WriteL( KPutMessage );
+ fws.WriteL( KXmlBegin );
+ fws.WriteL( iConMLHandler->XMLDocument().Ptr(),
+ iConMLHandler->XMLDocument().Length());
+ fws.WriteL(_L("\n\n"));
+ TRAP_IGNORE( fws.CommitL() );
+ fws.Close();
+ CleanupStack::PopAndDestroy( &fws );
+ }
+ file.Close();
+
+#endif
+
+
+ if ( aContent )
+ {
+ if ( aContent->execute )
+ {
+ ret = OptionsFromExecuteL( aContent->execute );
+ }
+ else if ( aContent->cancel )
+ {
+ ret = TaskCancelL( aContent->cancel );
+ }
+ else if ( aContent->getStatus )
+ {
+ ret = TaskGetStatusL ( aContent->getStatus );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCConnSession::ConML() : No appropriate content in ConML -element " );
+ ret = KErrArgument;
+ }
+ }
+ else
+ {
+ ret = KErrArgument;
+ }
+
+ // store result for later use
+ iResult = ret;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::OptionsFromExecuteL()
+// Handles data of an execute -element
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::OptionsFromExecuteL(ConML_ExecutePtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret ( KErrNone );
+ if ( aContent->updateDeviceInfo )
+ {
+ ret = TaskUpdateDeviceInfoL( aContent->updateDeviceInfo);
+ }
+ else if ( aContent->listInstalledApps )
+ {
+ ret = TaskListInstalledAppsL( aContent->listInstalledApps);
+ }
+ else if ( aContent->install )
+ {
+ ret = TaskInstallL( aContent->install );
+ }
+ else if ( aContent->unInstall )
+ {
+ ret = TaskUnInstallL( aContent->unInstall );
+ }
+ else if ( aContent->listDataOwners )
+ {
+ ret = TaskListDataOwnersL();
+ }
+ else if ( aContent->setBurMode )
+ {
+ ret = TaskSetBURModeL( aContent->setBurMode );
+ }
+ else if ( aContent->getDataSize )
+ {
+ ret = TaskGetDataSizeL( aContent->getDataSize );
+ }
+ else if ( aContent->requestData )
+ {
+ ret = TaskRequestDataL( aContent->requestData );
+ }
+ else if ( aContent->listPublicFiles )
+ {
+ ret = TaskListPublicFilesL( aContent->listPublicFiles );
+ }
+ else if ( aContent->reboot )
+ {
+ ret = TaskRebootL();
+ }
+ else if ( aContent->getDataOwnerStatus )
+ {
+ ret = TaskGetDataOwnerStatusL( aContent->getDataOwnerStatus );
+ }
+ else if ( aContent->supplyData )
+ {
+ ret = TaskSupplyDataL( aContent->supplyData );
+ }
+ else if ( aContent->getMetadata )
+ {
+ ret = TaskGetMetadataL( aContent->getMetadata );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCConnSession::OptionsFromExecute() : No content " );
+ ret = KErrNotSupported;
+ }
+ LOGGER_WRITE_1( "CSConPCConnSession::OptionsFromExecute() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskCancelL(ConML_CancelPtr_t aContent)
+// Sends a Cancel -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskCancelL( ConML_CancelPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( ECancel );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent->all )
+ {
+ task->iCancelTaskAll = ETrue;
+ }
+ if ( aContent->id )
+ {
+ task->iCancelTaskId = ( DesToInt( aContent->id->Data() ));
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskCancelL() : returned %d", ret );
+ return ret;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskGetStatusL()
+// Sends a Get Status -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskGetStatusL( ConML_GetStatusPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EGetStatus );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent->all )
+ {
+ task->iGetStatusParams->iAll = ETrue;
+ }
+ if ( aContent->id)
+ {
+ task->iGetStatusParams->iTaskId = ( DesToInt( aContent->id->Data() ));
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskGetStatusL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskInstallL()
+// Sends an Install -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskInstallL( ConML_InstallPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EInstall );
+ CSConTask* task = CSConTask::NewLC( method);
+ task->iInstallParams->iMode = EUnknown;
+ if ( aContent->name )
+ {
+ // Unicode conversion from 8-bit to 16-bit
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(task->iInstallParams->iPath,
+ aContent->name->Data());
+ }
+ if ( aContent->instParams )
+ {
+ if ( aContent->instParams->param )
+ {
+ for ( ConML_ParamListPtr_t p = aContent->instParams->param;
+ p && p->data; p = p->next)
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : Parameters found " );
+ if ( p->data->name )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : name param found " );
+ TPtrC8 silent(KParamNameSilent);
+
+ TInt comp = Mem::Compare((TUint8*)p->data->name->content, (TInt)p->data->name->length, silent.Ptr(), silent.Length());
+ if( comp == 0)
+ {
+ // "Silent"-param found
+ LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : Silent-param found " );
+ if ( p->data->value )
+ {
+ TPtrC8 dataValue((TUint8*)p->data->value->content, (TInt)p->data->value->length);
+ TInt value = DesToInt( dataValue );
+ if (value == 1)
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : ESilentInstall " );
+ task->iInstallParams->iMode = ESilentInstall;
+ }
+ else if( value == 0 )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskInstallL() : EUnsilentInstall " );
+ task->iInstallParams->iMode = EUnsilentInstall;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskInstallL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskUnInstallL()
+// Sends an Uninstall -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskUnInstallL( ConML_UnInstallPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EUninstall );
+ CSConTask* task = CSConTask::NewLC( method );
+ task->iUninstallParams->iMode = EUnknown;
+
+ if ( aContent->applications->application)
+ {
+ for ( ConML_ApplicationListPtr_t p =
+ aContent->applications->application; p && p->data; p = p->next )
+ {
+ if ( p->data )
+ {
+ if ( p->data->name )
+ {
+ // get application name
+ HBufC* nameBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( p->data->name->Data() );
+ task->iUninstallParams->iName.Copy( nameBuf->Des() );
+ delete nameBuf;
+ nameBuf = NULL;
+ }
+ if ( p->data->uid )
+ {
+ // parse uid: UID # Type # Size # Version # Vendor # Parent app. name #
+ // only UID and Vendor are needed from whole uid-field.
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : start parsing uid " );
+
+ TPtrC8 buf( p->data->uid->Data() );
+
+ RArray<TPtrC8> arr(6);
+ CleanupClosePushL( arr );
+ TBuf8<1> separator(KSConAppInfoSeparator);
+
+ SplitL(buf, separator[0], arr);
+ if ( arr.Count() >= 5 )
+ {
+ task->iUninstallParams->iUid = DesToUid( arr[0] );
+ task->iUninstallParams->iType = (TSConAppType)DesToInt( arr[1] );
+ HBufC* vendorBuf = CnvUtfConverter::ConvertToUnicodeFromUtf8L( arr[4] );
+ task->iUninstallParams->iVendor.Copy( vendorBuf->Des() );
+ delete vendorBuf;
+ vendorBuf = NULL;
+ }
+ CleanupStack::PopAndDestroy( &arr );
+
+
+ } // endif p->data->uid
+ }
+ }
+ }
+
+ if ( aContent->instParams)
+ {
+ if ( aContent->instParams->param )
+ {
+ for ( ConML_ParamListPtr_t p = aContent->instParams->param;
+ p && p->data; p = p->next )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : Parameters found " );
+ if ( p->data->name )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : name param found " );
+ TPtrC8 silent(KParamNameSilent);
+
+ TInt comp = Mem::Compare((TUint8*)p->data->name->content, (TInt)p->data->name->length, silent.Ptr(), silent.Length());
+ if( comp == 0)
+ {
+ // "Silent"-param found
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : Silent-param found " );
+ if ( p->data->value )
+ {
+ TPtrC8 dataValue((TUint8*)p->data->value->content, (TInt)p->data->value->length);
+ TInt value = DesToInt( dataValue );
+ if ( value == 1 )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : ESilentInstall " );
+ task->iUninstallParams->iMode = ESilentInstall;
+ }
+ else if ( value == 0 )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::TaskUnInstallL() : EUnsilentInstall " );
+ task->iUninstallParams->iMode = EUnsilentInstall;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskUnInstallL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::SplitL(const TDesC& aText, const TChar aSeparator,
+// RArray<TPtrC>& aArray)
+// Function splits string (eg "name1, name2, name3") into substrings.
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::SplitL(const TDesC8& aText, const TChar aSeparator,
+ RArray<TPtrC8>& aArray)
+ {
+ TRACE_FUNC_ENTRY;
+ TPtrC8 ptr;
+ ptr.Set(aText);
+
+ for (;;)
+ {
+ TInt pos=ptr.Locate(aSeparator);
+ if (pos==KErrNotFound)
+ {
+ aArray.AppendL(ptr);
+ break;
+ }
+
+ TPtrC8 subStr=ptr.Left(pos); // get pos characters starting from position 0
+ aArray.AppendL(subStr);
+
+ if (!(ptr.Length()>pos+1))
+ {
+ break;
+ }
+
+ ptr.Set(ptr.Mid(pos+1));// get all characters starting from position pos+1
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskListInstalledAppsL()
+// Sends a List installed apps -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskListInstalledAppsL(
+ ConML_ListInstalledAppsPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EListInstalledApps );
+ CSConTask* task = CSConTask::NewLC( method );
+ if( aContent-> drives )
+ {
+ task->iListAppsParams->iDriveList = DriveList( aContent->drives->drive);
+ }
+ if ( aContent->all )
+ {
+ task->iListAppsParams->iAllApps = ETrue;
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskListInstalledAppsL() : returned %d", ret);
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskListDataOwnersL()
+// Sends a List data owners -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskListDataOwnersL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EListDataOwners );
+ CSConTask* task = CSConTask::NewLC( method );
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskListDataOwnersL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskSetBURModeL()
+// Sends a Set BUR mode -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskSetBURModeL(ConML_SetBURModePtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( ESetBURMode );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent->drives )
+ {
+ task->iBURModeParams->iDriveList = DriveList( aContent->drives->drive);
+ }
+ if ( aContent->partialType )
+ {
+ TInt intValue = DesToInt( aContent->partialType->Data() );
+ task->iBURModeParams->iPartialType = static_cast<TSConBurMode> (intValue) ;
+ }
+ if ( aContent->incType )
+ {
+ TInt intValue = DesToInt( aContent->incType->Data() );
+ task->iBURModeParams->iIncType = static_cast<TSConIncType> (intValue) ;
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskSetBURModeL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskGetDataSizeL()
+// Sends a Get data size -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskGetDataSizeL(ConML_GetDataSizePtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EGetDataSize );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent->dataOwners )
+ {
+ for ( ConML_SIDListPtr_t p = aContent->dataOwners->sid;
+ p && p->data; p=p->next )
+ {
+ CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner();
+ CleanupStack::PushL( dataOwner );
+ if ( p->data->type )
+ {
+ dataOwner->iType = TSConDOType (DesToInt(
+ p->data->type->Data() ));
+ }
+ if (p->data->uid )
+ {
+ if( !IsJavaHash( p->data->uid->Data() ) )
+ {
+ dataOwner->iUid = DesToUid( p->data->uid->Data() );
+ }
+ else
+ {
+ TPtr hashPtr = DesToHashLC( p->data->uid->Data() );
+ dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() );
+ dataOwner->iJavaHash->Des().Copy( hashPtr );
+ CleanupStack::PopAndDestroy(); //DesToHashLC()
+ }
+ }
+ if ( p->data->drives )
+ {
+ dataOwner->iDriveList = DriveList ( p->data->drives->drive );
+ }
+ if ( p->data->transferDataType )
+ {
+ TInt intValue = DesToInt( p->data->transferDataType->Data() );
+ dataOwner->iTransDataType = static_cast<TSConTransferDataType> (intValue);
+ }
+ task->iGetDataSizeParams->iDataOwners.AppendL( dataOwner );
+ CleanupStack::Pop( dataOwner );
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskGetDataSizeL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskRequestDataL()
+// Sends a Request data -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskRequestDataL(ConML_RequestDataPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( ERequestData );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent )
+ {
+ if ( aContent->sid )
+ {
+ for ( ConML_SIDListPtr_t p=aContent->sid; p && p->data; p=p->next )
+ {
+ if ( p->data->type )
+ {
+ task->iRequestDataParams->iDataOwner->iType =
+ TSConDOType ( DesToInt ( p->data->type->Data() ) );
+ }
+ if ( p->data->uid )
+ {
+ if( !IsJavaHash( p->data->uid->Data() ) )
+ {
+ task->iRequestDataParams->iDataOwner->iUid = DesToUid(
+ p->data->uid->Data() );
+ }
+ else
+ {
+ TPtr hashPtr = DesToHashLC( p->data->uid->Data() );
+ task->iRequestDataParams->iDataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() );
+ task->iRequestDataParams->iDataOwner->iJavaHash->Des().Copy( hashPtr );
+ CleanupStack::PopAndDestroy(); //DesToHashLC()
+ }
+ }
+ if ( p->data->drives )
+ {
+ task->iRequestDataParams->iDataOwner->iDriveList =
+ DriveList ( p->data->drives->drive );
+ }
+ if ( p->data->transferDataType )
+ {
+ TInt intValue = DesToInt( p->data->transferDataType->Data() );
+ task->iRequestDataParams->iDataOwner->iTransDataType =
+ static_cast<TSConTransferDataType> (intValue);
+ }
+ }
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskRequestDataL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskUpdateDeviceInfoL()
+// Sends a Update device info -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskUpdateDeviceInfoL(
+ ConML_UpdateDeviceInfoPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EUpdateDeviceInfo );
+ CSConTask* task = CSConTask::NewLC( method );
+
+ if ( aContent->deviceInfo)
+ {
+ ConML_DeviceInfoPtr_t dPtr = aContent->deviceInfo;
+ if ( dPtr->version )
+ {
+ task->iDevInfoParams->iVersion.Copy( dPtr->version->Data());
+ }
+ if ( dPtr->maxObjectSize )
+ {
+ task->iDevInfoParams->iMaxObjectSize = DesToInt(
+ dPtr->maxObjectSize->Data());
+ }
+ if ( dPtr->supportedMethods )
+ {
+ ConML_SupportedMethodsPtr_t smPtr = dPtr->supportedMethods;
+ if ( smPtr->install )
+ {
+ task->iDevInfoParams->iInstallSupp = ETrue;
+ }
+ if ( smPtr->unInstall )
+ {
+ task->iDevInfoParams->iUninstallSupp = ETrue;
+ }
+ if ( smPtr->listInstalledApps )
+ {
+ task->iDevInfoParams->iInstAppsSupp = ETrue;
+ }
+ if ( smPtr->listDataOwners )
+ {
+ task->iDevInfoParams->iDataOwnersSupp = ETrue;
+ }
+ if ( smPtr->setBurMode )
+ {
+ task->iDevInfoParams->iSetBURModeSupp = ETrue;
+ }
+ if ( smPtr->getDataSize )
+ {
+ task->iDevInfoParams->iGetSizeSupp = ETrue;
+ }
+ if ( smPtr->requestData )
+ {
+ task->iDevInfoParams->iReqDataSupp = ETrue;
+ }
+ if ( smPtr->supplyData )
+ {
+ task->iDevInfoParams->iSupplyDataSupp = ETrue;
+ }
+ if ( smPtr->reboot )
+ {
+ task->iDevInfoParams->iRebootSupp = ETrue;
+ }
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskUpdateDeviceInfoL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskListPublicFilesL()
+// Sends a List public files -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskListPublicFilesL(
+ ConML_ListPublicFilesPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EListPublicFiles );
+ CSConTask* task = CSConTask::NewLC( method );
+ if ( aContent->sid )
+ {
+ for ( ConML_SIDListPtr_t p = aContent->sid; p && p->data; p = p->next )
+ {
+ CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner();
+ CleanupStack::PushL( dataOwner );
+ if ( p->data->type )
+ {
+ dataOwner->iType = TSConDOType ( DesToInt(
+ p->data->type->Data() ) );
+ }
+ if ( p->data->uid )
+ {
+ if( !IsJavaHash( p->data->uid->Data() ) )
+ {
+ dataOwner->iUid = DesToUid( p->data->uid->Data() );
+ }
+ else
+ {
+ TPtr hashPtr = DesToHashLC( p->data->uid->Data() );
+ dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() );
+ dataOwner->iJavaHash->Des().Copy( hashPtr );
+ CleanupStack::PopAndDestroy(); //DesToHashLC()
+ }
+ }
+ if ( p->data->drives )
+ {
+ dataOwner->iDriveList = DriveList ( p->data->drives->drive );
+ }
+ if ( p->data->packageInfo && p->data->packageInfo->name )
+ {
+ // Unicode conversion from 8-bit to 16-bit
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(
+ dataOwner->iPackageName,
+ p->data->packageInfo->name->Data());
+ }
+ task->iPubFilesParams->iDataOwners.AppendL( dataOwner );
+ CleanupStack::Pop( dataOwner );
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskListPublicFilesL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskSupplyDataL()
+// Sends a Supply data -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskSupplyDataL ( ConML_SupplyDataPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( ESupplyData );
+ CSConTask* task = CSConTask::NewLC( method );
+ if (aContent )
+ {
+ for ( ConML_SIDListPtr_t p = aContent->sid; p && p->data; p = p->next )
+ {
+ if ( p->data->type )
+ {
+ task->iSupplyDataParams->iDataOwner->iType =
+ TSConDOType ( DesToInt( p->data->type->Data() ) );
+ }
+ if ( p->data->uid )
+ {
+ if( !IsJavaHash( p->data->uid->Data() ) )
+ {
+ task->iSupplyDataParams->iDataOwner->iUid = DesToUid(
+ p->data->uid->Data() );
+ }
+ else
+ {
+ TPtr hashPtr = DesToHashLC( p->data->uid->Data() );
+ task->iSupplyDataParams->iDataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() );
+ task->iSupplyDataParams->iDataOwner->iJavaHash->Des().Copy( hashPtr );
+ CleanupStack::PopAndDestroy(); //DesToHashLC()
+ }
+ }
+ if ( p->data->drives )
+ {
+ task->iSupplyDataParams->iDataOwner->iDriveList =
+ DriveList ( p->data->drives->drive );
+ }
+ if ( p->data->transferDataType )
+ {
+ TInt intValue = DesToInt ( p->data->transferDataType->Data() );
+ task->iSupplyDataParams->iDataOwner->iTransDataType =
+ static_cast<TSConTransferDataType> (intValue);
+ }
+ if ( p->data->data )
+ {
+ task->iSupplyDataParams->iRestoreData = HBufC8::NewL(
+ p->data->data->Data().Size() );
+ *task->iSupplyDataParams->iRestoreData = p->data->data->Data();
+ }
+ if ( p->data->moreData )
+ {
+ task->iSupplyDataParams->iMoreData = ETrue;
+ }
+ else
+ {
+ task->iSupplyDataParams->iMoreData = EFalse;
+ }
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskSupplyDataL() : returned %d", ret );
+ return ret;
+}
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskGetDataOwnerStatusL()
+// Sends a Get data owner status -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskGetDataOwnerStatusL
+ ( ConML_GetDataOwnerStatusPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EGetDataOwnerStatus );
+ CSConTask* task = CSConTask::NewLC( method );
+
+ if ( aContent->dataOwners )
+ {
+ for ( ConML_SIDListPtr_t p = aContent->dataOwners->sid;
+ p && p->data; p=p->next )
+ {
+ CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner();
+ CleanupStack::PushL( dataOwner );
+ if ( p->data->type )
+ {
+ dataOwner->iType = TSConDOType (DesToInt(
+ p->data->type->Data() ));
+ }
+ if ( p->data->uid )
+ {
+ if( !IsJavaHash( p->data->uid->Data() ) )
+ {
+ dataOwner->iUid = DesToUid( p->data->uid->Data() );
+ }
+ else
+ {
+ TPtr hashPtr = DesToHashLC( p->data->uid->Data() );
+ dataOwner->iJavaHash = HBufC::NewL( hashPtr.Size() );
+ dataOwner->iJavaHash->Des().Copy( hashPtr );
+ CleanupStack::PopAndDestroy(); //DesToHashLC()
+ }
+ }
+ task->iGetDataOwnerParams->iDataOwners.AppendL( dataOwner );
+ CleanupStack::Pop( dataOwner );
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskGetDataOwnerStatusL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskRebootL()
+// Sends a Reboot -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskRebootL( )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EReboot );
+ CSConTask* task = CSConTask::NewLC( method );
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskRebootL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskGetMetadataL()
+// Sends a GetMetadata -task to PCCS service
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::TaskGetMetadataL( ConML_GetMetadataPtr_t aContent )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+ TSConMethodName method ( EGetMetadata );
+ CSConTask* task = CSConTask::NewLC( method );
+ if( aContent )
+ {
+ if ( aContent->filename )
+ {
+ // Unicode conversion from 8-bit to 16-bit
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(task->iGetMetadataParams->iFilename,
+ aContent->filename->Data());
+ }
+ }
+ ret = iPCDHandler->PutTaskL( task );
+ CleanupStack::Pop( task );
+ LOGGER_WRITE_1( "CSConPCConnSession::TaskGetMetadataL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::TaskRebootL()
+// Appends a status element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendStatusL(
+ ConML_ConMLPtr_t aContent, CSConStatusReply* reply )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( !reply )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::AppendStatus() : No data in reply!" );
+ return;
+ }
+ aContent->status = new ( ELeave ) ConML_Status_t();
+
+ if ( reply->iTasks.Count() > 0 )
+ {
+ for ( TInt i=0; i < reply->iTasks.Count(); i ++)
+ {
+ ConML_TaskListPtr_t task = new ( ELeave ) ConML_TaskList_t();
+ CleanupStack::PushL( task );
+ GenericListAddL ( &aContent->status->task, task );
+ CleanupStack::Pop(); // task
+
+ task->data = new ( ELeave ) ConML_Task_t();
+ task->data->id = new ( ELeave ) pcdata_t();
+ task->data->id->SetDataL ( IntToDesLC(reply->iTasks[i]->iTaskId) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ TSConMethodName method ( reply->iTasks[i]->iMethod );
+
+ switch ( method )
+ {
+ case EUpdateDeviceInfo:
+ task->data->updateDeviceInfo =
+ new ( ELeave ) ConML_UpdateDeviceInfo_t();
+ task->data->updateDeviceInfo->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendUpdateDeviceInfoResultsL(
+ task->data->updateDeviceInfo->results,
+ reply->iTasks[i]->iDevInfoParams );
+ break;
+
+ case ESetBURMode:
+ task->data->setBurMode =
+ new ( ELeave ) ConML_SetBURMode_t();
+ task->data->setBurMode->results =
+ new ( ELeave) ConML_Results_t();
+ AppendSetBURModeResultsL(
+ task->data->setBurMode->results,
+ reply->iTasks[i]->iBURModeParams );
+ break;
+
+ case EListInstalledApps:
+ task->data->listInstalledApps =
+ new ( ELeave ) ConML_ListInstalledApps_t();
+ task->data->listInstalledApps->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendListInstalledAppsResultsL(
+ task->data->listInstalledApps->results,
+ reply->iTasks[i]->iListAppsParams);
+ break;
+
+ case EInstall:
+ task->data->install = new ( ELeave ) ConML_Install_t();
+ task->data->install->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendInstallResultsL(
+ task->data->install->results,
+ reply->iTasks[i]->iInstallParams );
+ break;
+
+ case EUninstall:
+ task->data->unInstall = new ( ELeave ) ConML_UnInstall_t();
+ task->data->unInstall->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendUninstallResultsL(
+ task->data->unInstall->results,
+ reply->iTasks[i]->iUninstallParams );
+ break;
+
+ case EListDataOwners:
+ task->data->listDataOwners =
+ new ( ELeave ) ConML_ListDataOwners_t();
+ task->data->listDataOwners->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendListDataOwnersResultsL(
+ task->data->listDataOwners->results,
+ reply->iTasks[i]->iListDataOwnersParams );
+ break;
+
+ case EGetDataOwnerStatus:
+ task->data->getDataOwnerStatus =
+ new ( ELeave ) ConML_GetDataOwnerStatus_t();
+ task->data->getDataOwnerStatus->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendGetDataOwnerStatusResultsL(
+ task->data->getDataOwnerStatus->results,
+ reply->iTasks[i]->iGetDataOwnerParams);
+ break;
+
+ case EGetDataSize:
+ task->data->getDataSize =
+ new ( ELeave ) ConML_GetDataSize_t();
+ task->data->getDataSize->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendGetDataSizeResultsL(
+ task->data->getDataSize->results,
+ reply->iTasks[i]->iGetDataSizeParams );
+ break;
+
+ case EListPublicFiles:
+ task->data->listPublicFiles =
+ new ( ELeave ) ConML_ListPublicFiles_t();
+ task->data->listPublicFiles->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendListPublicFilesResultsL (
+ task->data->listPublicFiles->results,
+ reply->iTasks[i]->iPubFilesParams );
+ break;
+
+ case ERequestData:
+ task->data->requestData =
+ new ( ELeave ) ConML_RequestData_t();
+ task->data->requestData->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendRequestDataResultsL(
+ task->data->requestData->results,
+ reply->iTasks[i]->iRequestDataParams );
+ break;
+
+ case ESupplyData:
+ task->data->supplyData =
+ new ( ELeave ) ConML_SupplyData_t();
+ task->data->supplyData->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendSupplyDataResultsL (
+ task->data->supplyData->results,
+ reply->iTasks[i]->iSupplyDataParams );
+ break;
+
+ case EGetMetadata:
+ task->data->getMetadata =
+ new ( ELeave ) ConML_GetMetadata_t();
+ task->data->getMetadata->results =
+ new ( ELeave ) ConML_Results_t();
+ AppendGetMetadataResultsL (
+ task->data->getMetadata->results,
+ reply->iTasks[i]->iGetMetadataParams );
+ break;
+
+ default:
+ LOGGER_WRITE_1( "CSConPCConnSession:: AppendStatus() : Unknown method %d ", method );
+ break;
+ }
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCConnSession::AppendStatus() : No Task " );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendUpdateDeviceInfoResultsL()
+// Appends a update device info -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendUpdateDeviceInfoResultsL
+ ( ConML_ResultsPtr_t aContent, CSConUpdateDeviceInfo* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL ( aContent, aResult->iProgress );
+
+ aContent->deviceInfo = new ( ELeave ) ConML_DeviceInfo_t();
+ aContent->deviceInfo->version = new ( ELeave ) pcdata_t();
+ aContent->deviceInfo->version->SetDataL ( aResult->iVersion );
+
+ aContent->deviceInfo->supportedMethods =
+ new ( ELeave ) ConML_SupportedMethods_t();
+
+ if ( aResult->iInstallSupp )
+ {
+ aContent->deviceInfo->supportedMethods->install =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iUninstallSupp )
+ {
+ aContent->deviceInfo->supportedMethods->unInstall =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iInstAppsSupp )
+ {
+ aContent->deviceInfo->supportedMethods->listInstalledApps =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iDataOwnersSupp )
+ {
+ aContent->deviceInfo->supportedMethods->listDataOwners =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iSetBURModeSupp )
+ {
+ aContent->deviceInfo->supportedMethods->setBurMode =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iGetSizeSupp )
+ {
+ aContent->deviceInfo->supportedMethods->getDataSize =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iReqDataSupp )
+ {
+ aContent->deviceInfo->supportedMethods->requestData =
+ new (ELeave ) pcdata_t();
+ }
+ if ( aResult->iSupplyDataSupp )
+ {
+ aContent->deviceInfo->supportedMethods->supplyData =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iRebootSupp )
+ {
+ aContent->deviceInfo->supportedMethods->reboot =
+ new ( ELeave ) pcdata_t();
+ }
+ aContent->deviceInfo->maxObjectSize = new ( ELeave ) pcdata_t();
+ aContent->deviceInfo->maxObjectSize->SetDataL ( IntToDesLC(
+ aResult->iMaxObjectSize ));
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendSetBURModeResultsL()
+// Appends a Set BUR mode -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendSetBURModeResultsL (
+ ConML_ResultsPtr_t aContent, CSConSetBURMode* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL ( aContent, aResult->iProgress );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendListInstalledAppsResultsL()
+// Appends a List installed apps -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendListInstalledAppsResultsL (
+ ConML_ResultsPtr_t aContent, CSConListInstApps* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL ( aContent, aResult->iProgress );
+
+ if ( aResult->iApps.Count() > 0 )
+ {
+ // 6 * KMaxFileName should be enought
+ // ( 5 items of TFileName and uid + type + size + 7* "#" )
+ HBufC8* buf = HBufC8::NewLC( 6 * KMaxFileName );
+ TPtr8 ptrBuf = buf->Des();
+
+ aContent->applications = new ( ELeave ) ConML_Applications_t();
+ for ( TInt i=0; i<aResult->iApps.Count(); i++)
+ {
+ ConML_ApplicationListPtr_t app =
+ new ( ELeave )ConML_ApplicationList_t();
+ CleanupStack::PushL ( app );
+ GenericListAddL ( &aContent->applications->application, app );
+ CleanupStack::Pop(); // app
+
+ app->data = new ( ELeave ) ConML_Application_t();
+ app->data->name = new ( ELeave ) pcdata_t();
+ app->data->name->SetDataL( BufToDesLC(
+ aResult->iApps[i]->iName));
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+
+ // create uid: UID # Type # Size # Version # Vendor # Parent app. name # WidgetBundleId #
+ LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : Create Uid" );
+
+ ptrBuf.Copy( UidToDesLC( aResult->iApps[i]->iUid ) );
+ CleanupStack::PopAndDestroy(); // UidToDesLC
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+
+ ptrBuf.Append( IntToDesLC(aResult->iApps[i]->iType ));
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+
+ ptrBuf.Append( IntToDesLC(aResult->iApps[i]->iSize ) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+ ptrBuf.Append( aResult->iApps[i]->iVersion );
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+ ptrBuf.Append( BufToDesLC( aResult->iApps[i]->iVendor ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+ ptrBuf.Append( BufToDesLC( aResult->iApps[i]->iParentName ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+ if (aResult->iApps[i]->iWidgetBundleId)
+ {
+ ptrBuf.Append( BufToDesLC( *aResult->iApps[i]->iWidgetBundleId ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+ }
+
+ ptrBuf.Append( KSConAppInfoSeparator );
+
+ LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : set data" );
+ app->data->uid = new ( ELeave ) pcdata_t();
+ app->data->uid->SetDataL( *buf );
+
+ LOGGER_WRITE( "CSConPCConnSession::AppendListInstalledAppsResultsL() : Info added" );
+ }
+ CleanupStack::PopAndDestroy(buf);
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendListPublicFilesResultsL()
+// Appends a List public files -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendListPublicFilesResultsL (
+ ConML_ResultsPtr_t aContent, CSConListPublicFiles* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL ( aContent, aResult->iProgress );
+
+ if ( aResult->iFiles.Count() > 0 )
+ {
+ aContent->files = new ( ELeave ) ConML_Files_t();
+ for ( TInt i=0;i<aResult->iFiles.Count(); i++ )
+ {
+ ConML_FileListPtr_t file = new ( ELeave ) ConML_FileList_t();
+ CleanupStack::PushL( file );
+ GenericListAddL ( &aContent->files->file, file );
+ CleanupStack::Pop(); // file
+
+ file->data = new ( ELeave ) ConML_File_t();
+ file->data->name = new ( ELeave ) pcdata_t();
+ file->data->name->SetDataL( BufToDesLC (
+ aResult->iFiles[i]->iPath ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+
+ file->data->modified = new ( ELeave ) pcdata_t();
+ file->data->modified->SetDataL( BufToDesLC (
+ aResult->iFiles[i]->iModified ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+
+ file->data->size = new ( ELeave ) pcdata_t();
+ file->data->size->SetDataL( IntToDesLC (
+ aResult->iFiles[i]->iSize ) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ file->data->userPerm = new ( ELeave ) pcdata_t();
+ switch ( aResult->iFiles[i]->iUserPerm )
+ {
+ case EPermReadOnly:
+ file->data->userPerm->SetDataL ( KSConPermReadOnly );
+ break;
+
+ case EPermNormal:
+ file->data->userPerm->SetDataL ( KSConPermNormal );
+ break;
+
+ default:
+ LOGGER_WRITE( "CSConPCConnSession:: AppendListPublicFilesResultsL() : Unknown userPerm! " );
+ break;
+ }
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendRequestDataResultsL()
+// Appends a Request data -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendRequestDataResultsL(
+ ConML_ResultsPtr_t aContent, CSConRequestData* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL ( aContent, aResult->iProgress );
+
+ if ( aResult->iMoreData )
+ {
+ aContent->moreData = new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iBackupData )
+ {
+ aContent->data = new ( ELeave ) pcdata_t();
+ aContent->data->SetDataL( aResult->iBackupData->Des() );
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendSupplyDataResultsL()
+// Appends a Supply data -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendSupplyDataResultsL(
+ ConML_ResultsPtr_t aContent, CSConSupplyData* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendInstallResultsL()
+// Appends an Install -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendInstallResultsL(
+ ConML_ResultsPtr_t aContent, CSConInstall* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendUninstallResultsL()
+// Appends an Uninstall -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendUninstallResultsL(
+ ConML_ResultsPtr_t aContent, CSConUninstall* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ LOGGER_WRITE( "CSConPCConnSession::AppendUninstallResultsL() Complete" );
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ LOGGER_WRITE_1( "CSConPCConnSession::AppendUninstallResultsL() iProgress: %d", aResult->iProgress );
+ AppendProgressL( aContent, aResult->iProgress );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendListDataOwnersResultsL()
+// Appends a List data owners -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendListDataOwnersResultsL (
+ ConML_ResultsPtr_t aContent, CSConListDataOwners* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+
+ if ( aResult->iDataOwners.Count() > 0 )
+ {
+ aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t();
+ for ( TInt i=0; i < aResult->iDataOwners.Count(); i ++)
+ {
+ ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t();
+ CleanupStack::PushL( sid );
+ GenericListAddL ( &aContent->dataOwners->sid, sid );
+ CleanupStack::Pop();
+
+ sid->data = new ( ELeave ) ConML_SID_t();
+
+ sid->data->type = new ( ELeave ) pcdata_t();
+ sid->data->type->SetDataL ( IntToDesLC (
+ aResult->iDataOwners[i]->iType) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ sid->data->uid = new ( ELeave ) pcdata_t();
+
+ if( aResult->iDataOwners[i]->iUid.iUid )
+ {
+ sid->data->uid->SetDataL ( UidToDesLC (
+ aResult->iDataOwners[i]->iUid ) );
+ CleanupStack::PopAndDestroy(); // UidToDesLC
+ }
+
+ if( aResult->iDataOwners[i]->iJavaHash )
+ {
+ sid->data->uid->SetDataL ( HashToDesLC (
+ aResult->iDataOwners[i]->iJavaHash->Des() ) );
+ CleanupStack::PopAndDestroy(); // HashToDesLC
+ }
+
+ if ( HasDrives ( aResult->iDataOwners[i]->iDriveList ) )
+ {
+ sid->data->drives = new ( ELeave ) ConML_Drives_t();
+ AppendDrivesL ( sid->data->drives,
+ aResult->iDataOwners[i]->iDriveList );
+ }
+
+ if ( aResult->iDataOwners[i]->iPackageName.Length() > 0 )
+ {
+ sid->data->packageInfo =
+ new ( ELeave ) ConML_PackageInfo_t();
+ sid->data->packageInfo->name = new ( ELeave ) pcdata_t();
+ sid->data->packageInfo->name->SetDataL ( BufToDesLC (
+ aResult->iDataOwners[i]->iPackageName ) );
+
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+ }
+
+ if ( aResult->iDataOwners[i]->iHasFiles ||
+ aResult->iDataOwners[i]->iSupportsInc ||
+ aResult->iDataOwners[i]->iDelayToPrep ||
+ aResult->iDataOwners[i]->iReqReboot )
+ {
+ sid->data->burOptions = new ( ELeave ) ConML_BUROptions_t();
+ if ( aResult->iDataOwners[i]->iHasFiles )
+ {
+ sid->data->burOptions->hasFiles =
+ new ( ELeave ) pcdata_t();
+ sid->data->burOptions->hasFiles->SetDataL( IntToDesLC(
+ aResult->iDataOwners[i]->iHasFiles ));
+
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ }
+ if ( aResult->iDataOwners[i]->iSupportsInc )
+ {
+ sid->data->burOptions->supportsInc =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iDataOwners[i]->iDelayToPrep )
+ {
+ sid->data->burOptions->delayToPrepareData =
+ new ( ELeave ) pcdata_t();
+ }
+ if ( aResult->iDataOwners[i]->iReqReboot )
+ {
+ sid->data->burOptions->requiresReboot =
+ new ( ELeave ) pcdata_t();
+ }
+ }
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendGetDataOwnerStatusResultsL()
+// Appends a Get data owner status -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendGetDataOwnerStatusResultsL
+ ( ConML_ResultsPtr_t aContent, CSConGetDataOwnerStatus* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+
+ if ( aResult->iDataOwners.Count() > 0 )
+ {
+ aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t();
+ for ( TInt i=0; i < aResult->iDataOwners.Count(); i ++)
+ {
+ ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t();
+ CleanupStack::PushL( sid );
+ GenericListAddL ( &aContent->dataOwners->sid, sid );
+ CleanupStack::Pop();
+
+ sid->data = new ( ELeave ) ConML_SID_t();
+
+ sid->data->type = new ( ELeave ) pcdata_t();
+ sid->data->type->SetDataL ( IntToDesLC (
+ aResult->iDataOwners[i]->iType) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ sid->data->uid = new ( ELeave ) pcdata_t();
+ sid->data->uid->SetDataL ( UidToDesLC (
+ aResult->iDataOwners[i]->iUid ) );
+ CleanupStack::PopAndDestroy(); // UidToDesLC
+
+ sid->data->dataOwnerStatus = new ( ELeave ) pcdata_t();
+ sid->data->dataOwnerStatus->SetDataL ( IntToDesLC(
+ aResult->iDataOwners[i]->iDataOwnStatus ));
+
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendGetDataSizeResultsL()
+// Appends a Get data owner size -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendGetDataSizeResultsL (
+ ConML_ResultsPtr_t aContent, CSConGetDataSize* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+
+ if ( aResult->iDataOwners.Count() > 0 )
+ {
+ aContent->dataOwners = new ( ELeave ) ConML_DataOwners_t();
+
+ for ( TInt i=0; i< aResult->iDataOwners.Count(); i++ )
+ {
+ ConML_SIDListPtr_t sid = new ( ELeave ) ConML_SIDList_t();
+ CleanupStack::PushL( sid );
+ GenericListAddL ( &aContent->dataOwners->sid, sid );
+ CleanupStack::Pop();
+
+ sid->data = new ( ELeave ) ConML_SID_t();
+
+ sid->data->type = new ( ELeave ) pcdata_t();
+ sid->data->type->SetDataL ( IntToDesLC (
+ aResult->iDataOwners[i]->iType) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ sid->data->uid = new ( ELeave ) pcdata_t();
+
+ if( aResult->iDataOwners[i]->iUid.iUid )
+ {
+ sid->data->uid->SetDataL ( UidToDesLC (
+ aResult->iDataOwners[i]->iUid ) );
+ CleanupStack::PopAndDestroy(); // UidToDesLC
+ }
+
+ if( aResult->iDataOwners[i]->iJavaHash )
+ {
+ sid->data->uid->SetDataL ( HashToDesLC (
+ aResult->iDataOwners[i]->iJavaHash->Des() ) );
+ CleanupStack::PopAndDestroy(); // HashToDesLC
+ }
+
+ if ( HasDrives ( aResult->iDataOwners[i]->iDriveList ) )
+ {
+ sid->data->drives = new ( ELeave ) ConML_Drives_t();
+ AppendDrivesL ( sid->data->drives,
+ aResult->iDataOwners[i]->iDriveList );
+ }
+
+ sid->data->size = new ( ELeave ) pcdata_t();
+ sid->data->size->SetDataL( IntToDesLC(
+ aResult->iDataOwners[i]->iSize ) );
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+
+ sid->data->transferDataType = new ( ELeave ) pcdata_t();
+ sid->data->transferDataType->SetDataL( IntToDesLC(
+ aResult->iDataOwners[i]->iTransDataType ) );
+
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendGetMetadataResultsL()
+// Appends a GetMetadata -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendGetMetadataResultsL(
+ ConML_ResultsPtr_t aContent, CSConGetMetadata* aResult )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( aResult )
+ {
+ if ( aResult->iComplete )
+ {
+ aContent->complete = new ( ELeave ) pcdata_t();
+
+ // add filename only if task is completed
+ aContent->filename = new ( ELeave ) pcdata_t();
+ aContent->filename->SetDataL( BufToDesLC(aResult->iFilename ) );
+ CleanupStack::PopAndDestroy(); // BufToDesLC
+ }
+ AppendProgressL( aContent, aResult->iProgress );
+
+ if ( aResult->iData )
+ {
+ aContent->data = new ( ELeave ) pcdata_t();
+ aContent->data->SetDataL( aResult->iData->Des() );
+ }
+
+ if ( aResult->iMoreData )
+ {
+ aContent->moreData = new ( ELeave ) pcdata_t();
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendProgressL()
+// Appends a Progress -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendProgressL (
+ ConML_ResultsPtr_t aContent, TInt progress )
+ {
+ TRACE_FUNC_ENTRY;
+ aContent->progress = new ( ELeave ) ConML_Progress_t();
+ aContent->progress->value = new ( ELeave ) pcdata_t();
+ aContent->progress->value->SetDataL ( IntToDesLC ( progress ));
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::AppendDrivesL()
+// Appends a Drives -element from the reply data of PCCS
+// -----------------------------------------------------------------------------
+//
+void CSConPCConnSession::AppendDrivesL(
+ ConML_DrivesPtr_t aContent, TDriveList aDrives )
+ {
+ TRACE_FUNC_ENTRY;
+
+ for ( TInt i = 0; i<KMaxDrives; i++ )
+ {
+ if ( aDrives[i] )
+ {
+ ConML_DriveListPtr_t drive = new ( ELeave ) ConML_DriveList_t();
+ CleanupStack::PushL ( drive );
+ GenericListAddL ( &aContent->drive, drive );
+ CleanupStack::Pop(); // drive
+
+ drive->data = new ( ELeave ) ConML_Drive_t();
+ drive->data->name = new ( ELeave ) pcdata_t();
+ drive->data->name->SetDataL( DriveNumToDesLC(i+KSConFirstDrive ));
+ CleanupStack::PopAndDestroy(); // IntToDesLC
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DriveList()
+// Converts an Drives -element to TDriveList
+// -----------------------------------------------------------------------------
+//
+TDriveList CSConPCConnSession::DriveList( ConML_DriveListPtr_t aContent )
+ {
+ TBuf8<KMaxDrives> driveBuf;
+ TDriveList driveList;
+
+ for ( ConML_DriveListPtr_t p = aContent; p && p->data; p = p->next )
+ {
+ if ( p->data->name )
+ {
+ driveBuf.Append( p->data->name->Data() );
+ }
+ }
+
+ for ( TInt i = 0; i<KMaxDrives; i++ )
+ {
+ if ( driveBuf.Locate ( TChar( i + KSConFirstDrive ) ) != KErrNotFound )
+ {
+ driveList.Append( KSConDriveExists );
+ }
+ else
+ {
+ driveList.Append( KSConNoDrive );
+ }
+ }
+ return driveList;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::IntToDesLC()
+// Converts an integer to descriptor
+// -----------------------------------------------------------------------------
+//
+TDesC8& CSConPCConnSession::IntToDesLC(const TInt& anInt)
+ {
+ HBufC8* buf = HBufC8::NewLC(20);
+ TPtr8 ptrBuf = buf->Des();
+ ptrBuf.Num(anInt);
+ return *buf;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DriveNumToDesLC()
+// Convers a drive number to equivalent drive letter
+// -----------------------------------------------------------------------------
+//
+TDesC8& CSConPCConnSession::DriveNumToDesLC( const TInt& anInt )
+ {
+ TChar mark ( anInt );
+ HBufC8* buf = HBufC8::NewLC(1);
+ TPtr8 ptrBuf = buf->Des();
+ ptrBuf.Append(mark);
+ return *buf;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::BufToDesLC()
+// converts a buffer to descriptor
+// -----------------------------------------------------------------------------
+//
+TDesC8& CSConPCConnSession::BufToDesLC( const TDesC& aBuf)
+ {
+ HBufC8* buf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aBuf );
+ CleanupStack::PushL( buf );
+ return *buf;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::UidToDesLC()
+// converts an UID to a descriptor
+// -----------------------------------------------------------------------------
+//
+TDesC8& CSConPCConnSession::UidToDesLC( const TUid& aUid )
+ {
+ HBufC8* buf = HBufC8::NewLC(10);
+ TPtr8 ptrBuf = buf->Des();
+ ptrBuf.Copy (aUid.Name().Mid(1, 8) );
+ return *buf;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DesToUid()
+// converts a descriptor to a UID value
+// -----------------------------------------------------------------------------
+//
+TUid CSConPCConnSession::DesToUid ( const TDesC8& aDes )
+ {
+ TLex8 lex( aDes );
+ TUint32 value;
+ lex.Val( value, EHex );
+ TUid uid = TUid::Uid( value );
+ return uid;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DesToInt()
+// converts a descriptor to a integer value
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCConnSession::DesToInt( const TDesC8& aDes)
+ {
+ TLex8 lex(aDes);
+ TInt value = 0;
+ lex.Val(value);
+ return value;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HasDrives()
+// Returns ETrue if at least one drive is found from the given TDriveList
+// -----------------------------------------------------------------------------
+//
+TBool CSConPCConnSession::HasDrives( TDriveList& aDrive )
+ {
+ TBool hasDrives ( EFalse );
+ for ( TInt i = 0; i<KMaxDrives; i++ )
+ {
+ if ( aDrive[i] )
+ {
+ hasDrives = ETrue;
+ }
+ }
+ return hasDrives;
+ }
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::HashToDesLC()
+// converts a Java hash to descriptor
+// -----------------------------------------------------------------------------
+//
+TDesC8& CSConPCConnSession::HashToDesLC( const TDesC& aBuf)
+ {
+ HBufC8* buf = HBufC8::NewLC(aBuf.Size()+5);
+ TPtr8 ptrBuf = buf->Des();
+ // Unicode conversion from 16-bit to 8-bit
+ CnvUtfConverter::ConvertFromUnicodeToUtf8(ptrBuf, aBuf);
+ //Add JAVA_ identifier to the begining of the hash
+ ptrBuf.Insert(0, KSConJavaHashId);
+ return *buf;
+ }
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::DesToHashLC()
+// converts descriptor to Java hash
+// -----------------------------------------------------------------------------
+//
+TPtr CSConPCConnSession::DesToHashLC( const TDesC8& aDes )
+ {
+ HBufC* buf = HBufC::NewLC(aDes.Size());
+ TPtr ptrBuf = buf->Des();
+ // Unicode conversion from 8-bit to 16-bit
+ CnvUtfConverter::ConvertToUnicodeFromUtf8(ptrBuf, aDes);
+ //Delete JAVA_
+ ptrBuf.Delete(0, KSConJavaHashId().Length());
+ return ptrBuf;
+ }
+// -----------------------------------------------------------------------------
+// CSConPCConnSession::IsJavaHash()
+// Returns ETrue if descriptor is Java hash, else EFalse
+// -----------------------------------------------------------------------------
+//
+TBool CSConPCConnSession::IsJavaHash( const TDesC8& aDes )
+ {
+ if ( aDes.FindC(KSConJavaHashId) == 0 )
+ {
+ return ETrue;
+ }
+ else
+ {
+ return EFalse;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file for project SyncServer
+*
+*/
+
+
+PRJ_EXPORTS
+../rom/sconsyncserver.iby CORE_APP_LAYER_IBY_EXPORT_PATH(sconsyncserver.iby)
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconsyncserver.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/group/sconsyncserver.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: sconsyncserver mmp file
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+
+TARGET sconsyncserver.exe
+TARGETTYPE exe
+
+// Same capabilities than in DS Ui application
+CAPABILITY LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData NetworkServices UserEnvironment ProtServ SwEvent NetworkControl Location
+
+UID 0x0 0x2001A964
+VENDORID VID_DEFAULT
+
+EPOCSTACKSIZE 0x2000
+EPOCHEAPSIZE 0x500 0x800000 // minimum and maximum heap sizes
+
+SOURCEPATH ../src
+SOURCE sconsyncserver.cpp
+SOURCE sconsyncsession.cpp
+SOURCE sconsyncrelationship.cpp
+SOURCE sconasynchandler.cpp
+SOURCE cscontimeout.cpp
+
+// common components (dataproviderinfo)
+SOURCEPATH ../../../clients/syncclient/src
+USERINCLUDE ../../../clients/syncclient/inc
+SOURCE scondataproviderinfo.cpp
+
+USERINCLUDE ..\inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+
+DEBUGLIBRARY flogger.lib
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY ecom.lib
+LIBRARY estor.lib // CDictionaryFileStore
+LIBRARY smldataprovider.lib
+LIBRARY nsmlchangefinder.lib
+LIBRARY smlstoreformat.lib
+LIBRARY charconv.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/cscontimeout.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCSconTimeOut header file
+*
+*/
+
+
+#ifndef CSCONTIMEOUT_H
+#define CSCONTIMEOUT_H
+
+#include <e32base.h> // For CActive, link against: euser.lib
+#include <e32std.h> // For RTimer, link against: euser.lib
+
+class MTimeOutObserver
+ {
+public:
+ virtual void TimeOut() = 0;
+ };
+
+class CCSconTimeOut : public CActive
+ {
+public:
+ // Cancel and destroy
+ ~CCSconTimeOut();
+
+ // Two-phased constructor.
+ static CCSconTimeOut* NewL( MTimeOutObserver& aTimeOutObserver );
+
+public:
+ // New functions
+ // Function for making the timeout request
+ void Start(TTimeIntervalMicroSeconds32 aDelay);
+
+private:
+ // C++ constructor
+ CCSconTimeOut( MTimeOutObserver& aTimeOutObserver );
+
+ // Second-phase constructor
+ void ConstructL();
+
+private:
+ // From CActive
+ // Handle completion
+ void RunL();
+
+ // How to cancel me
+ void DoCancel();
+
+ // Override to handle leaves from RunL(). Default implementation causes
+ // the active scheduler to panic.
+ TInt RunError(TInt aError);
+
+private:
+ enum TCSconTimeOutState
+ {
+ EUninitialized, // Uninitialized
+ EInitialized, // Initalized
+ EError
+ // Error condition
+ };
+
+private:
+ TInt iState; // State of the active object
+ RTimer iTimer; // Provides async timing service
+ MTimeOutObserver& iTimeOutObserver;
+ };
+
+#endif // CSCONTIMEOUT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/debug.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Debug utility for SyncServer
+*
+*/
+
+
+#ifndef _SECON_DEBUG_H
+#define _SECON_DEBUG_H
+
+#ifdef _DEBUG
+
+ // File logging
+ #define __FLOGGING__
+
+ #include <e32svr.h>
+ #ifdef __FLOGGING__
+ #include <f32file.h>
+ #include <flogger.h>
+ #endif
+
+ NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
+ {
+ public:
+ void Overflow(TDes16& /*aDes*/) {}
+ };
+
+ NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
+ {
+ public:
+ void Overflow(TDes8& /*aDes*/) {}
+ };
+
+ _LIT( KLogDir, "SECON" );
+ _LIT( KLogFile, "SeconDebug.txt" );
+
+ _LIT(KTracePrefix16, "[SeConSync] ");
+ _LIT8(KTracePrefix8, "[SeConSync] ");
+ _LIT8(KFuncEntryFormat8, "%S : Begin");
+ _LIT8(KFuncExitFormat8, "%S : End");
+ _LIT8(KFuncFormat8, "><%S");
+
+ const TInt KMaxLogLineLength = 512;
+
+ // old function loggin macros
+ #define FLOG(a) {FPrint(a);}
+ #define FLOG_1(a,b) {FPrint(a,b);}
+ #define FLOG_2(a,b,c) {FPrint(a,b,c);}
+ #define FTRACE(a) {a;}
+ #define LOGGER_ENTERFN( name ) {TRACE_FUNC_ENTRY;}
+ #define LOGGER_LEAVEFN( name ) {TRACE_FUNC_EXIT;}
+
+ #define LOGGER_WRITE( text ) {_LIT( KTemp, text ); FPrint( KTemp );}
+ #define LOGGER_WRITE_1( text,par1 ) {_LIT( KTemp, text ); FPrint( KTemp, par1 );}
+ #define LOGGER_WRITE8_1( text,par1 ) {_LIT8( KTemp, text ); FPrint( KTemp, par1 );}
+ #define LOGGER_WRITE_2( text,par1,par2 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2 );}
+ #define LOGGER_WRITE_3( text,par1,par2,par3 ) {_LIT( KTemp, text ); FPrint( KTemp, par1, par2, par3 );}
+
+ // New function logging macros
+ #define TRACE_FUNC_ENTRY {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncEntryFormat8, &ptr8);}
+ #define TRACE_FUNC_EXIT {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncExitFormat8, &ptr8);}
+ #define TRACE_FUNC {TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); FPrint(KFuncFormat8, &ptr8);}
+
+ // Declare the FPrint function
+ inline void FPrint( TRefByValue<const TDesC16> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list,aFmt);
+ #ifdef __FLOGGING__
+ RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list );
+ #endif
+ TBuf16<KMaxLogLineLength> theFinalString;
+ theFinalString.Append(KTracePrefix16);
+ TOverflowTruncate16 overflow;
+ theFinalString.AppendFormatList(aFmt,list,&overflow);
+ RDebug::Print(theFinalString);
+ }
+
+ // Declare the FPrint function
+ inline void FPrint(TRefByValue<const TDesC8> aFmt, ...)
+ {
+ VA_LIST list;
+ VA_START(list, aFmt);
+ #ifdef __FLOGGING__
+ RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
+ #endif
+ TOverflowTruncate8 overflow;
+ TBuf8<KMaxLogLineLength> buf8;
+ buf8.Append(KTracePrefix8);
+ buf8.AppendFormatList(aFmt, list, &overflow);
+ TBuf16<KMaxLogLineLength> buf16(buf8.Length());
+ buf16.Copy(buf8);
+ TRefByValue<const TDesC> tmpFmt(_L("%S"));
+ RDebug::Print(tmpFmt, &buf16);
+ }
+#else
+
+ // No loggings --> reduced code size
+ #define FLOG(a)
+ #define FLOG_1(a,b)
+ #define FLOG_2(a,b,c)
+ #define FTRACE(a)
+ #define LOGGER_ENTERFN( name )
+ #define LOGGER_LEAVEFN( name )
+ #define LOGGER_WRITE( text )
+ #define LOGGER_WRITE_1( text, par1 )
+ #define LOGGER_WRITE8_1( text, par1 )
+ #define LOGGER_WRITE_2( text, par1, par2 )
+ #define LOGGER_WRITE_3( text, par1, par2, par3 )
+ #define TRACE_FUNC_ENTRY
+ #define TRACE_FUNC_EXIT
+ #define TRACE_FUNC
+
+#endif //_DEBUG
+
+#endif // SECON_DEBUG_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/logdatastoreformat.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Simple class for tracing datastore format
+*
+*/
+
+#ifndef LOGDATASTOREFORMAT_H_
+#define LOGDATASTOREFORMAT_H_
+
+//
+#include "debug.h"
+
+NONSHARABLE_CLASS(TLogDataStoreFormat)
+ {
+ public:
+#ifndef _DEBUG
+// does nothing on release version
+static void TLogDataStoreFormat::LogDataStoreFormatL( const TDesC& /*aLogInfo*/, const CSmlDataStoreFormat& /*aDataStoreFormat*/ )
+ {
+ }
+#else
+static void TLogDataStoreFormat::LogDataStoreFormatL( const TDesC& aLogInfo, const CSmlDataStoreFormat& aDataStoreFormat )
+ {
+ LOGGER_WRITE_1("LogDataStoreFormatL, aLogInfo: %S", &aLogInfo);
+ LOGGER_WRITE_1("DisplayName: %S", &aDataStoreFormat.DisplayName());
+ TBool hasMaxSize = aDataStoreFormat.IsSupported( CSmlDataStoreFormat::EOptionHasMaxSize );
+ TBool hasMaxItems = aDataStoreFormat.IsSupported( CSmlDataStoreFormat::EOptionHasMaxItems );
+ TBool hierarcial = aDataStoreFormat.IsSupported( CSmlDataStoreFormat::EOptionHierarchial );
+ LOGGER_WRITE_1("hasMaxSize: %d", (TInt)hasMaxSize);
+ LOGGER_WRITE_1("hasMaxItems: %d", (TInt)hasMaxItems);
+ LOGGER_WRITE_1("hierarcial: %d", (TInt)hierarcial);
+ LOGGER_WRITE_1("MimeFormatCount: %d", aDataStoreFormat.MimeFormatCount());
+ for ( TInt i = 0; i < aDataStoreFormat.MimeFormatCount(); i++)
+ {
+ LOGGER_WRITE_1(" MimeFormat(%d)",i);
+ const CSmlMimeFormat& mimeformat = aDataStoreFormat.MimeFormat(i);
+ LOGGER_WRITE8_1(" MimeType: %S", &mimeformat.MimeType().DesC());
+ LOGGER_WRITE8_1(" MimeVersion: %S", &mimeformat.MimeVersion().DesC());
+ LOGGER_WRITE_1( " FieldLevel, bool: %d", (TInt) mimeformat.FieldLevel());
+ LOGGER_WRITE_1( " PropertyCount: %d", mimeformat.PropertyCount());
+ for ( TInt j=0; j<mimeformat.PropertyCount(); j++ )
+ {
+ LOGGER_WRITE_1(" MimeFormat property(%d)",j);
+ const CSmlDataProperty& dataProp = mimeformat.Property(j);
+ const CSmlDataField& dataField = dataProp.Field();
+ LOGGER_WRITE8_1(" dataField: %S", &dataField.Name().DesC());
+ LOGGER_WRITE_1( " DisplayName: %S", &dataField.DisplayName());
+ LOGGER_WRITE_1( " HasMaxSize: %d", (TInt)dataProp.HasMaxSize());
+ LOGGER_WRITE_1( " MaxSize: %d", dataProp.MaxSize());
+ LOGGER_WRITE_1( " HasMaxOccur: %d", (TInt)dataProp.HasMaxOccur());
+ LOGGER_WRITE_1( " MaxOccur: %d", dataProp.MaxOccur());
+ TBool OptionNoTruncate = dataProp.IsSupported(CSmlDataProperty::EOptionNoTruncate);
+ LOGGER_WRITE_1( " EOptionNoTruncate: %d", (TInt)OptionNoTruncate);
+ LOGGER_WRITE8_1(" DataType(): %S", &dataField.DataType().DesC());
+ LOGGER_WRITE_1( " EnumValueCount(): %d", dataField.EnumValueCount());
+ for ( TInt k=0; k<dataField.EnumValueCount(); k++)
+ {
+ LOGGER_WRITE8_1(" EnumValue(): %S", &dataField.EnumValue(k).DesC());
+ }
+ LOGGER_WRITE_1(" ParamCount: %d", dataProp.ParamCount());
+ for ( TInt k=0; k<dataProp.ParamCount(); k++)
+ {
+ LOGGER_WRITE_1( " dataParamField(%d)", k);
+ const CSmlDataPropertyParam& param = dataProp.Param(k);
+ const CSmlDataField& field = param.Field();
+ LOGGER_WRITE8_1(" dataParamField: %S", &field.Name().DesC());
+ LOGGER_WRITE_1( " dataParamDisplayName: %S", &field.DisplayName());
+ LOGGER_WRITE8_1(" dataParamDataType(): %S", &field.DataType().DesC());
+ LOGGER_WRITE_1( " dataParamEnumValueCount(): %d", field.EnumValueCount());
+ for ( TInt l=0; l<field.EnumValueCount(); l++)
+ {
+ LOGGER_WRITE8_1(" dataParamEnumValue(): %S", &field.EnumValue(l).DesC());
+ }
+
+ LOGGER_WRITE(" ---------------");
+ }
+ LOGGER_WRITE( " -----------------");
+ }
+
+ LOGGER_WRITE( " -----------------");
+ }
+ }
+#endif
+ };
+
+
+#endif /* LOGDATASTOREFORMAT_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/sconasynchandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconAsyncHandler header
+*
+*/
+
+
+#ifndef SCONASYNCHANDLER_H_
+#define SCONASYNCHANDLER_H_
+
+#include <e32base.h>
+#include <f32file.h>
+
+#include <syncml/SmlDataSyncDefs.h>
+#include <stringpool.h>
+
+#include "cscontimeout.h"
+
+class CSmlDataStore;
+class CSconSyncRelationship;
+class CSmlDataProvider;
+class CNSmlDataItemUidSet;
+class CSmlDataStoreFormat;
+
+NONSHARABLE_CLASS ( CSconAsyncHandler ): public CActive, MTimeOutObserver
+{
+public:
+ static CSconAsyncHandler* NewL();
+ ~CSconAsyncHandler();
+ void HandleServiceL( const RMessage2& aMessage );
+
+private: // From CActive
+ void RunL();
+ TInt RunError(TInt aError);
+ void DoCancel();
+
+private: // From MTimeOutObserver
+ void TimeOut();
+
+private:
+
+ CSconAsyncHandler();
+ void ConstructL();
+
+ void HandleChunkMessage();
+ void ListAllImplementationsL();
+ void OpenStoreL();
+
+ void OpenItemL();
+ void OpenItemCompletedL( TInt aError );
+
+ void CreateItemL();
+ void CreateItemCompletedL( TInt aError );
+ void ReplaceItemL();
+ void ReplaceItemCompletedL( TInt aError );
+ void MoveItemL();
+ void DeleteItemL();
+ void SoftDeleteItemL();
+ void DeleteAllItemsL();
+ void ReadParentL();
+ void ReadParentCompletedL( TInt aError );
+
+ void HasHistoryL();
+ void AddedItemsL();
+ void DeletedItemsL();
+ void SoftDeletedItemsL();
+ void ModifiedItemsL();
+ void MovedItemsL();
+ //void ListChangesL();
+ void ResetChangeInfoL();
+ void CommitChangeInfoL();
+ void CloseStore();
+
+ void SetSyncTimeStampL();
+ void GetSyncTimeStampL();
+
+ void ExportStoreFormatL();
+ void SetRemoteStoreFormatL();
+
+ void LeaveIfNoInstanceL();
+
+ void DoCloseStore();
+
+ void CleanOldStoresL();
+ void CompleteRequest( TInt aError );
+private:
+ RChunk iChunk;
+
+ RStringPool iStringPool;
+ CSmlDataStoreFormat* iStoreFormat;
+ CSmlDataProvider* iDataProvider;
+ CSmlDataStore* iDataStore;
+ CSconSyncRelationship* iContext;
+ RFs iFs;
+ RMessage2 iMessage;
+
+ // for committing changes
+ CNSmlDataItemUidSet* iItems;
+
+ // for opening item
+ TBool iFieldChange;
+ TInt iSize;
+ TInt iParent;
+ TBuf8<64> iMimeType;
+ TBuf8<64> iMimeVer;
+
+ // for creating item
+ TSmlDbItemUid iNewItem;
+ HBufC8* iWriteData;
+ TBool iCommitInProgress;
+
+ CCSconTimeOut* iTimeOut;
+ TBool iForceCancel;
+};
+
+#endif /*SCONASYNCHANDLER_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/sconsyncclientserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Sync Client-Server header
+*
+*/
+
+
+#ifndef SCONSYNCCLIENTSERVER_H
+#define SCONSYNCCLIENTSERVER_H
+
+#include <e32base.h>
+
+_LIT(KSconSyncServerName, "sconsyncserver");
+_LIT(KSconSyncServerExe, "sconsyncserver.exe");
+
+
+enum TService
+{
+ ESendChunkHandle,
+ ECancelRequest,
+ EListImplementations,
+
+ EOpenStore,
+ EOpenItem,
+ ECreateItem,
+ EReplaceItem,
+ EMoveItem,
+ EDeleteItem,
+ ESoftDeleteItem,
+ EDeleteAllItems,
+ EReadParent,
+
+ EHasHistory,
+ EAddedItems,
+ EDeletedItems,
+ ESoftDeletedItems,
+ EModifiedItems,
+ EMovedItems,
+
+ //EListChanges,
+ EResetChangeInfo,
+ ECommitChangeInfo,
+
+ ECloseStore,
+ ESetSyncTimeStamp,
+ EGetSyncTimeStamp,
+ EExportStoreFormat,
+ ESetRemoteStoreFormat,
+
+ EMaxService // Not an actual service
+};
+
+#endif // SCONSYNCCLIENTSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/sconsyncrelationship.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncRelationship header
+*
+*/
+
+
+#ifndef SCONSYNCRELATIONSHIP_H_
+#define SCONSYNCRELATIONSHIP_H_
+
+#include <e32base.h>
+#include <f32file.h>
+#include <s32file.h>
+#include <syncml/smldatasyncdefs.h>
+#include <syncmldef.h>
+
+class CDictionaryFileStore;
+
+NONSHARABLE_CLASS ( CSconSyncRelationship ) : public CBase, public MSmlSyncRelationship
+ {
+public:
+ /**
+ * Creates CSconSyncRelationship object.
+ * @param aFs reference to open RFs connection
+ * @param aRelationUid uniqueID for each server-client pair
+ * @return new CSconSyncRelationship object
+ */
+ static CSconSyncRelationship* NewL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId );
+ ~CSconSyncRelationship();
+
+ static void SetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId );
+ static void GetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId, TDateTime& aTimeStamp );
+
+public: // From MSmlSyncRelationship
+
+ /**
+ * Returns the unique identifier for the synchronisation relationship.
+ *
+ * @return A unique identifier for the sync relationship.
+ */
+ TSmlSyncTaskKey SyncTaskKey() const;
+
+ /**
+ * Opens a specified stream for reading, and places an item on the cleanup stack to close it.
+ *
+ * @param aReadStream On return, an open read stream
+ * @param aStreamUid The UID of the stream to open for reading.
+ */
+ void OpenReadStreamLC(RReadStream& aReadStream, TUid aStreamUid);
+
+ /**
+ * Opens the specified stream, or creates a new one if it does not exist, and places an item on the cleanup stack to close it.
+ *
+ * @param aWriteStream On return, an open write stream
+ * @param aStreamUid The UID of the stream to open or create
+ */
+ void OpenWriteStreamLC(RWriteStream& aWriteStream, TUid aStreamUid);
+
+ /**
+ * Tests if the specified stream identified exists in the store.
+ *
+ * @param aStreamUid The stream UID
+ * @return Non-zero if the stream exists, otherwise EFalse.
+ */
+ TBool IsStreamPresentL(TUid aStreamUid) const;
+
+private:
+ CSconSyncRelationship( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId );
+ void ConstructL();
+
+private:
+
+ CDictionaryFileStore* iDictionaryStore;
+ RFs& iFs;
+ TUid iID;
+ TSmlDataProviderId iProviderId;
+ };
+
+#endif /*SCONSYNCRELATIONSHIP_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/sconsyncserver.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncServer header
+*
+*/
+
+
+#ifndef __SCONSYNCSERVER_H__
+#define __SCONSYNCSERVER_H__
+
+#include <e32base.h>
+
+class CSconSyncServer : public CPolicyServer
+{
+public:
+ static CSconSyncServer* NewL();
+ static CSconSyncServer* NewLC();
+ virtual ~CSconSyncServer();
+
+ void AddSession();
+ void RemoveSession();
+
+private:
+ CSconSyncServer();
+ void ConstructL();
+
+ CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const;
+ TInt RunError(TInt aError);
+
+private:
+ TInt iSessionCount;
+
+};
+
+#endif // __SCONSYNCSERVER_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/inc/sconsyncsession.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncSession header
+*
+*/
+
+
+#ifndef __SCONSYNCSESSION_H__
+#define __SCONSYNCSESSION_H__
+
+#include <e32base.h>
+
+
+class CSconSyncServer;
+class CSconAsyncHandler;
+
+class CSconSyncSession : public CSession2
+ {
+public:
+ static CSconSyncSession* NewL();
+
+ void CreateL();
+
+private:
+ CSconSyncSession();
+ ~CSconSyncSession();
+ void ConstructL();
+
+ CSconSyncServer& Server();
+ void ServiceL(const RMessage2& aMessage);
+
+private:
+ CSconAsyncHandler* iAsyncHandler;
+ };
+
+#endif // __SCONSYNCSESSION_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/rom/sconsyncserver.iby Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: IBY file for SconSyncServer
+*
+*/
+
+#ifndef _SCONSYNCSERVER_IBY_
+#define _SCONSYNCSERVER_IBY_
+
+#include <data_caging_paths_for_iby.hrh>
+
+//file content
+file=ABI_DIR\BUILD_DIR\sconsyncserver.exe PROGRAMS_DIR\sconsyncserver.exe
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/src/cscontimeout.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCSconTimeOut implementation
+*
+*/
+
+#include "cscontimeout.h"
+
+CCSconTimeOut::CCSconTimeOut( MTimeOutObserver& aTimeOutObserver ) :
+ CActive(EPriorityStandard), // Standard priority
+ iTimeOutObserver(aTimeOutObserver)
+ {
+ }
+
+
+CCSconTimeOut* CCSconTimeOut::NewL( MTimeOutObserver& aTimeOutObserver )
+ {
+ CCSconTimeOut* self = new (ELeave) CCSconTimeOut( aTimeOutObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+void CCSconTimeOut::ConstructL()
+ {
+ User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
+ CActiveScheduler::Add(this); // Add to scheduler
+ }
+
+CCSconTimeOut::~CCSconTimeOut()
+ {
+ Cancel(); // Cancel any request, if outstanding
+ iTimer.Close(); // Destroy the RTimer object
+ // Delete instance variables if any
+ }
+
+void CCSconTimeOut::DoCancel()
+ {
+ iTimer.Cancel();
+ }
+
+void CCSconTimeOut::Start(TTimeIntervalMicroSeconds32 aDelay)
+ {
+ Cancel(); // Cancel any request, just to be sure
+ iState = EUninitialized;
+ iTimer.After(iStatus, aDelay); // Set for later
+ SetActive(); // Tell scheduler a request is active
+ }
+
+void CCSconTimeOut::RunL()
+ {
+ /*if (iState == EUninitialized)
+ {
+ // Do something the first time RunL() is called
+ iState = EInitialized;
+ }
+ else if (iState != EError)
+ {
+ // Do something
+ }
+ iTimer.After(iStatus, 1000000); // Set for 1 sec later
+ SetActive(); // Tell scheduler a request is active*/
+ if ( iState == KErrNone )
+ {
+ iTimeOutObserver.TimeOut();
+ }
+
+ }
+
+TInt CCSconTimeOut::RunError(TInt aError)
+ {
+ return aError;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/src/sconasynchandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1179 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconAsyncHandler implementation
+*
+*/
+
+
+#include "sconasynchandler.h"
+
+#include <ecom/ecom.h>
+#include <SmlDataProvider.h>
+#include <s32mem.h>
+#include <nsmlchangefinder.h>
+#include <e32cmn.h>
+#include <ecom/ImplementationInformation.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "sconsyncclientserver.h"
+#include "sconsyncrelationship.h"
+#include "scondataproviderinfo.h"
+#include "debug.h"
+#include "logdatastoreformat.h"
+
+// Data Store interface implementation Uid.
+// Load all plugins with this uid.
+const TUid KDSEcomIFUid = {0x101F4D3A};
+
+const TInt KDefaultExpandSize = 1024;
+
+// one store per computer, max store count.
+const TInt KMaxStoresCount = 10;
+
+const TInt KDefaultTimeOutInMicroSeconds = 30 * 1000000; // 30 seconds
+const TInt KDeleteAllTimeOutInMicroSeconds = 300 * 1000000; // 5 minutes
+const TInt KOpenStoreTimeOutInMicroSeconds = 180 * 1000000; // 180 seconds
+
+CSconAsyncHandler::~CSconAsyncHandler()
+ {
+ TRACE_FUNC_ENTRY;
+ Cancel();
+ DoCloseStore();
+ delete iItems;
+ delete iWriteData;
+ delete iDataStore;
+ delete iDataProvider;
+ delete iContext;
+ delete iStoreFormat;
+ iStringPool.Close();
+ iFs.Close();
+ REComSession::FinalClose();
+ iChunk.Close();
+ delete iTimeOut;
+ TRACE_FUNC_EXIT;
+ }
+
+CSconAsyncHandler::CSconAsyncHandler(): CActive( EPriorityStandard )
+ {
+ TRACE_FUNC;
+ CActiveScheduler::Add( this );
+ }
+
+CSconAsyncHandler* CSconAsyncHandler::NewL()
+ {
+ TRACE_FUNC;
+ CSconAsyncHandler* self = new(ELeave) CSconAsyncHandler();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+void CSconAsyncHandler::ConstructL()
+ {
+ TRACE_FUNC;
+ User::LeaveIfError( iFs.Connect() );
+ TInt err = iFs.CreatePrivatePath( EDriveC );
+ LOGGER_WRITE_1("CreatePrivatePath err: %d", err);
+ iStringPool.OpenL();
+ iTimeOut = CCSconTimeOut::NewL( *this );
+ }
+
+// -----------------------------------------------------------------------------
+// CSconAsyncHandler::HandleServiceL()
+// Handles the client request
+// -----------------------------------------------------------------------------
+//
+void CSconAsyncHandler::HandleServiceL( const RMessage2& aMessage )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aMessage.Function() == ECancelRequest )
+ {
+ LOGGER_WRITE("ECancelRequest");
+ if ( IsActive() )
+ {
+ Cancel();
+ LOGGER_WRITE("iMessage.Complete( KErrCancel )");
+ CompleteRequest( KErrCancel );
+ }
+
+ LOGGER_WRITE("aMessage.Complete( KErrNone )");
+ aMessage.Complete( KErrNone );
+ TRACE_FUNC_EXIT;
+ return;
+ }
+
+ iTimeOut->Start( KDefaultTimeOutInMicroSeconds );
+
+ iMessage = aMessage;
+ switch ( aMessage.Function() )
+ {
+ case ESendChunkHandle:
+ LOGGER_WRITE( "CSconSyncSession::ServiceL() : ESendChunkHandle" );
+ HandleChunkMessage();
+ break;
+
+ case EListImplementations:
+ LOGGER_WRITE( "CSconSyncSession::ServiceL() : EListImplementations" );
+ ListAllImplementationsL();
+ break;
+
+ case EOpenStore:
+ LOGGER_WRITE( "CSconSyncSession::ServiceL() : EOpenStore" );
+ iTimeOut->Start( KOpenStoreTimeOutInMicroSeconds );
+ OpenStoreL();
+ break;
+
+ case EOpenItem:
+ OpenItemL();
+ break;
+ case ECreateItem:
+ CreateItemL();
+ break;
+ case EReplaceItem:
+ ReplaceItemL();
+ break;
+ case EMoveItem:
+ MoveItemL();
+ break;
+ case EDeleteItem:
+ DeleteItemL();
+ break;
+ case ESoftDeleteItem:
+ SoftDeleteItemL();
+ break;
+ case EDeleteAllItems:
+ iTimeOut->Start( KDeleteAllTimeOutInMicroSeconds );
+ DeleteAllItemsL();
+ break;
+ case EReadParent:
+ ReadParentL();
+ break;
+
+ case EHasHistory:
+ HasHistoryL();
+ break;
+ case EAddedItems:
+ AddedItemsL();
+ break;
+ case EDeletedItems:
+ DeletedItemsL();
+ break;
+ case ESoftDeletedItems:
+ SoftDeletedItemsL();
+ break;
+ case EModifiedItems:
+ ModifiedItemsL();
+ break;
+ case EMovedItems:
+ MovedItemsL();
+ break;
+ case EResetChangeInfo:
+ ResetChangeInfoL();
+ break;
+ case ECommitChangeInfo:
+ CommitChangeInfoL();
+ break;
+ case ECloseStore:
+ CloseStore();
+ break;
+ case ESetSyncTimeStamp:
+ SetSyncTimeStampL();
+ break;
+ case EGetSyncTimeStamp:
+ GetSyncTimeStampL();
+ break;
+ case EExportStoreFormat:
+ ExportStoreFormatL();
+ break;
+ case ESetRemoteStoreFormat:
+ SetRemoteStoreFormatL();
+ break;
+
+ default:
+ aMessage.Complete(KErrNotSupported);
+ break;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconAsyncHandler::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("iStatus.Int(): %d", iStatus.Int());
+ switch ( iMessage.Function() )
+ {
+ case EOpenStore:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EOpenStore" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case EOpenItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EOpenItem" );
+ OpenItemCompletedL( iStatus.Int() );
+ break;
+
+ case ECreateItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : ECreateItem" );
+ if (!iCommitInProgress)
+ {
+ // Write data to item
+ CreateItemCompletedL( iStatus.Int() );
+ }
+ else
+ {
+ // commit is done, all ready
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : ECreateItem, commit done" );
+ TPckg<TSmlDbItemUid> pckg(iNewItem);
+ iMessage.WriteL( 0, pckg, 0);
+ CompleteRequest( iStatus.Int() );
+ }
+ break;
+
+ case EReplaceItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EReplaceItem" );
+ if (!iCommitInProgress)
+ {
+ // Write data to item
+ ReplaceItemCompletedL( iStatus.Int() );
+ }
+ else
+ {
+ // commit is done, all ready
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EReplaceItem, commit done" );
+ CompleteRequest( iStatus.Int() );
+ }
+ break;
+
+ case EMoveItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EMoveItem" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case EDeleteItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EDeleteItem" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case ESoftDeleteItem:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : ESoftDeleteItem" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case EDeleteAllItems:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EDeleteAllItems" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case EReadParent:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EReadParent" );
+ ReadParentCompletedL( iStatus.Int() );
+ break;
+
+ case EResetChangeInfo:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : EResetChangeInfo" );
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ case ECommitChangeInfo:
+ LOGGER_WRITE( "CSconAsyncHandler::RunL() : ECommitChangeInfo" );
+ delete iItems;
+ iItems = NULL;
+ CompleteRequest( iStatus.Int() );
+ break;
+
+ default:
+ LOGGER_WRITE("Not asynchronous function")
+ CompleteRequest( KErrNotSupported );
+ break;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+TInt CSconAsyncHandler::RunError(TInt aError)
+ {
+ LOGGER_WRITE_1("CSconAsyncHandler::RunError() aError: %d", aError);
+ delete iItems;
+ iItems = NULL;
+ delete iWriteData;
+ iWriteData = NULL;
+
+ if ( IsActive() )
+ {
+ LOGGER_WRITE("IsActive");
+ //iDataStore->CancelRequest();
+ Cancel();
+ }
+
+ if ( iDataStore && iMessage.Function() == EOpenItem )
+ {
+ LOGGER_WRITE( "CSconAsyncHandler::RunError() : EOpenItem" );
+ iDataStore->CloseItem();
+ }
+
+ CompleteRequest( aError );
+ aError = KErrNone;
+ LOGGER_WRITE_1("CSconAsyncHandler::RunError() : Return %d", aError);
+ return aError;
+ //return KErrNone;//aError;
+ }
+
+void CSconAsyncHandler::DoCancel()
+ {
+ TRACE_FUNC_ENTRY;
+ iDataStore->CancelRequest();
+ iTimeOut->Cancel();
+
+ if ( iStatus == KRequestPending )
+ {
+ LOGGER_WRITE( "iStatus == KRequestPending" );
+ }
+
+ if ( iDataStore && iMessage.Function() == EOpenItem )
+ {
+ LOGGER_WRITE( "CSconAsyncHandler::RunError() : EOpenItem" );
+ iDataStore->CloseItem();
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::TimeOut()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( IsActive() )
+ {
+ Cancel();
+ CompleteRequest( KErrCancel );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconAsyncHandler::HandleChunkMessage()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret ( KErrNone );
+
+ ret = iChunk.Open( iMessage, 0, EFalse );
+
+ LOGGER_WRITE_1( "CSconAsyncHandler::HandleChunkMessageL() : ret %d", ret );
+ CompleteRequest( ret );
+ }
+
+
+
+void CSconAsyncHandler::ListAllImplementationsL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ RImplInfoPtrArray implInfoArray;
+ CleanupResetAndDestroyPushL( implInfoArray );
+ REComSession::ListImplementationsL( KDSEcomIFUid, implInfoArray );
+
+ const TInt KDataproviderInfoSize = 250; // 250 bytes should be enought
+ TInt requiredSize = implInfoArray.Count() * KDataproviderInfoSize;
+ if ( iChunk.Size() < requiredSize )
+ {
+ User::LeaveIfError( iChunk.Adjust( requiredSize ) );
+ }
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+
+ RSconDataProviderInfoArray dpInfoArray;
+ CleanupResetAndDestroyPushL( dpInfoArray );
+
+ // Collect information from dataproviders
+ for ( TInt i=0; i < implInfoArray.Count(); i++ )
+ {
+ LOGGER_WRITE_1("implInfoArray: %d",i);
+ CImplementationInformation& implInfo = *implInfoArray[i];
+
+ CSmlDataProvider* dp(NULL);
+ TRAPD( err, dp = CSmlDataProvider::NewL( implInfo.ImplementationUid().iUid ) );
+ LOGGER_WRITE_2("CSmlDataProvider::NewL, uid(0x%08x) err: %d",implInfo.ImplementationUid().iUid, err );
+ if ( !err )
+ {
+ CleanupStack::PushL( dp );
+
+ CSconDataproviderInfo *dpInfo = CSconDataproviderInfo::NewL();
+ CleanupStack::PushL( dpInfo );
+
+ dpInfo->SetImplementationUid( implInfo.ImplementationUid() );
+ LOGGER_WRITE_1("ImplementationUid: 0x%08x", implInfo.ImplementationUid().iUid );
+ dpInfo->SetDisplayNameL( implInfo.DisplayName() );
+ LOGGER_WRITE_1("DisplayName: %S", &implInfo.DisplayName() );
+
+ dpInfo->SetDefaultStoreL( dp->DefaultStoreL() );
+ LOGGER_WRITE_1("DefaultStoreL: %S", &dp->DefaultStoreL() );
+ CDesCArray* stores = dp->ListStoresLC();
+ dpInfo->SetStoresL( *stores );
+ CleanupStack::PopAndDestroy( stores );
+
+ dpInfoArray.AppendL( dpInfo );
+ CleanupStack::Pop( dpInfo );
+
+ CleanupStack::PopAndDestroy( dp );
+ }
+ }
+
+ // Wrtie to stream
+ stream.WriteUint16L( dpInfoArray.Count() );
+ for ( TInt i = 0; i < dpInfoArray.Count(); i++ )
+ {
+ CSconDataproviderInfo& dpInfo = *dpInfoArray[i];
+ dpInfo.ExternalizeL( stream );
+ }
+
+ stream.CommitL();
+
+ CleanupStack::PopAndDestroy( &dpInfoArray );
+ CleanupStack::PopAndDestroy( &stream );
+ CleanupStack::PopAndDestroy( &implInfoArray );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::OpenStoreL()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iDataStore )
+ {
+ LOGGER_WRITE("Warning: Previous DataStore was not closed properly.");
+ DoCloseStore();
+ }
+
+ // copy data from the chunk
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ TSmlDataProviderId providerId = readStream.ReadUint32L();
+ LOGGER_WRITE_1("providerId: 0x%08x", providerId);
+
+ TInt len = readStream.ReadUint32L();
+ HBufC* storeName = HBufC::NewLC(len);
+ TPtr storeNamePtr = storeName->Des();
+ readStream.ReadL(storeNamePtr, len);
+ LOGGER_WRITE_1("storeName: %S", &storeNamePtr);
+
+ TInt contextUid = readStream.ReadUint32L();
+
+ LOGGER_WRITE_1("contextIdentifier: 0x%08x", contextUid);
+
+ LOGGER_WRITE("Open provider");
+ delete iDataProvider;
+ iDataProvider = NULL;
+ iDataProvider = CSmlDataProvider::NewL( providerId );
+
+ delete iContext;
+ iContext = NULL;
+
+ delete iStoreFormat;
+ iStoreFormat = NULL;
+
+ LOGGER_WRITE("Create context");
+ iContext = CSconSyncRelationship::NewL( iFs, TUid::Uid(contextUid), providerId );
+
+
+ LOGGER_WRITE("Create NewStoreInstanceLC");
+ iDataStore = iDataProvider->NewStoreInstanceLC();
+ CleanupStack::Pop( iDataStore );
+
+ SetActive();
+ iStatus = KRequestPending;
+ LOGGER_WRITE("OpenL");
+ TRAPD(err, iDataStore->OpenL(storeNamePtr,*iContext, iStatus));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->OpenL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+
+ CleanupStack::PopAndDestroy( storeName );
+ CleanupStack::PopAndDestroy( &readStream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconAsyncHandler::OpenItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ if ( IsActive() )
+ {
+ LOGGER_WRITE("Was still in Active");
+ Cancel();
+ }
+
+ TSmlDbItemUid itemUid = iMessage.Int0();
+ LOGGER_WRITE_1("Open item: %d", itemUid);
+
+ // set default values
+ iFieldChange = EFalse;
+ iSize = 0;
+ iParent = 0;
+ iMimeType.Copy(KNullDesC);
+ iMimeVer.Copy(KNullDesC);
+
+ SetActive();
+ LOGGER_WRITE("iDataStore->OpenItemL");
+ iStatus = KRequestPending;
+ TRAPD( err, iDataStore->OpenItemL(itemUid,iFieldChange,iSize,iParent,iMimeType,iMimeVer,iStatus));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->OpenItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::OpenItemCompletedL( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ // item opened, now read it
+ if ( aError )
+ {
+ CompleteRequest( aError );
+ return;
+ }
+ LeaveIfNoInstanceL();
+
+ LOGGER_WRITE_1("item size: %d", iSize);
+
+ TInt totalObjectSize( 0 );
+ totalObjectSize+= sizeof(TInt32); // data length
+ totalObjectSize+= iSize; // data
+ totalObjectSize+= sizeof(TInt8); // iFieldChange
+ totalObjectSize+= sizeof(TInt32); // iParent
+ totalObjectSize+= sizeof(TInt32); // iMimeType
+ totalObjectSize+= iMimeType.Length(); // iMimeType
+ totalObjectSize+= sizeof(TInt32); // iMimeVer
+ totalObjectSize+= iMimeVer.Length(); // iMimeType
+
+ LOGGER_WRITE_1("iChunk.Size(): %d", iChunk.Size());
+ LOGGER_WRITE_1("iChunk.MaxSize(): %d", iChunk.MaxSize());
+ LOGGER_WRITE_1("totalObjectSize: %d", totalObjectSize);
+
+ if ( iChunk.Size() < totalObjectSize )
+ {
+ LOGGER_WRITE("adjust chunk");
+ TInt err = iChunk.Adjust( totalObjectSize );
+ LOGGER_WRITE_1("Chunk.Adjust err: %d", err);
+ User::LeaveIfError( err );
+ }
+ LOGGER_WRITE_1("new Chunk size: %d", iChunk.Size());
+ LOGGER_WRITE_1("new ChunkMaxSize(): %d", iChunk.MaxSize());
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+
+ LOGGER_WRITE("ReadItemL");
+ HBufC8* tempBuf = HBufC8::NewLC(iSize);
+ TPtr8 tempPtr = tempBuf->Des();
+
+ TUint8* ptr = (TUint8*) tempPtr.Ptr();
+
+ TPtr8 tempPtr2( ptr, 0, iSize );
+ LOGGER_WRITE_1( "tempPtr2.Size(): %d", tempPtr2.Size());
+ iDataStore->ReadItemL( tempPtr2 );
+ LOGGER_WRITE("ReadItemL -ok");
+
+ LOGGER_WRITE_1("readed Length: %d", tempPtr2.Length() );
+ LOGGER_WRITE_1("readed Size: %d", tempPtr2.Size() );
+
+ LOGGER_WRITE8_1("iMimeType: %S", &iMimeType );
+ LOGGER_WRITE_1("iMimeType.Length(): %d", iMimeType.Length() );
+ LOGGER_WRITE_1("iMimeType Size: %d", iMimeType.Size() );
+
+ LOGGER_WRITE8_1("iMimeVer: %S", &iMimeVer );
+ LOGGER_WRITE_1("iMimeVer.Length(): %d", iMimeVer.Length() );
+ LOGGER_WRITE_1("iMimeVer Size: %d", iMimeVer.Size() );
+
+ iDataStore->CloseItem();
+ LOGGER_WRITE("Write to chunk");
+ stream.WriteInt32L( tempPtr2.Length() );
+ stream.WriteL( tempPtr2 );
+ CleanupStack::PopAndDestroy( tempBuf );
+
+ stream.WriteInt8L( (TInt)iFieldChange );
+ stream.WriteInt32L( iParent );
+ stream.WriteInt32L( iMimeType.Length() );
+ stream.WriteL( iMimeType );
+ stream.WriteInt32L( iMimeVer.Length() );
+ stream.WriteL( iMimeVer );
+
+ stream.CommitL();
+ LOGGER_WRITE("Writed ok");
+ CleanupStack::PopAndDestroy( &stream );
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CreateItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ iCommitInProgress = EFalse;
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ TSmlDbItemUid parent = readStream.ReadUint32L();
+ TInt len = readStream.ReadUint32L();
+ readStream.ReadL(iMimeType, len);
+ len = readStream.ReadUint32L();
+ readStream.ReadL(iMimeVer, len);
+ len = readStream.ReadUint32L();
+ delete iWriteData;
+ iWriteData = NULL;
+ iWriteData = HBufC8::New(len);
+ TPtr8 dataPtr = iWriteData->Des();
+ readStream.ReadL(dataPtr, len);
+ CleanupStack::PopAndDestroy( &readStream );
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->CreateItemL( iNewItem, dataPtr.Size(), parent, iMimeType, iMimeVer, iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->CreateItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CreateItemCompletedL( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( aError );
+ LeaveIfNoInstanceL();
+ // CreateItem completed, now we must write the data to the created item and commit it.
+
+ iDataStore->WriteItemL( iWriteData->Des() );
+ delete iWriteData;
+ iWriteData = NULL;
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->CommitItemL( iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->CommitItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ iCommitInProgress = ETrue;
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ReplaceItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+
+ iCommitInProgress = EFalse;
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ TSmlDbItemUid uid = readStream.ReadUint32L();
+ TSmlDbItemUid parent = readStream.ReadUint32L();
+ TBool fieldChange = readStream.ReadUint8L();
+ TInt len = readStream.ReadUint32L();
+ delete iWriteData;
+ iWriteData = NULL;
+ iWriteData = HBufC8::New(len);
+ TPtr8 dataPtr = iWriteData->Des();
+ readStream.ReadL(dataPtr, len);
+
+ CleanupStack::PopAndDestroy( &readStream );
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err,iDataStore->ReplaceItemL( uid,dataPtr.Size(),parent,fieldChange, iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->CommitItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ReplaceItemCompletedL( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( aError );
+ LeaveIfNoInstanceL();
+ // CreateItem completed, now we must write the data to the created item and commit it.
+
+ iDataStore->WriteItemL( iWriteData->Des() );
+ delete iWriteData;
+ iWriteData = NULL;
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->CommitItemL( iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->CommitItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ iCommitInProgress = ETrue;
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::MoveItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ TSmlDbItemUid uid = iMessage.Int0();
+ TSmlDbItemUid newParent = iMessage.Int1();
+ LOGGER_WRITE_1( "uid: %d", uid );
+ LOGGER_WRITE_1( "newParent: %d", newParent );
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->MoveItemL( uid, newParent, iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->MoveItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::DeleteItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+
+ TSmlDbItemUid uid = iMessage.Int0();
+ LOGGER_WRITE_1( "uid: %d", uid );
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->DeleteItemL( uid, iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->DeleteItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::SoftDeleteItemL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+
+ TSmlDbItemUid uid = iMessage.Int0();
+ LOGGER_WRITE_1( "uid: %d", uid );
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->SoftDeleteItemL( uid, iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->SoftDeleteItemL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::DeleteAllItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->DeleteAllItemsL( iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->DeleteAllItemsL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ReadParentL()
+ {
+ TRACE_FUNC_ENTRY;
+ OpenItemL();
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ReadParentCompletedL( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ // item opened, now read it
+ if ( aError )
+ {
+ CompleteRequest( aError );
+ return;
+ }
+ LeaveIfNoInstanceL();
+
+ iDataStore->CloseItem();
+
+ TPckg<TSmlDbItemUid> pckg(iParent);
+ iMessage.WriteL( 1, pckg, 0);
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::HasHistoryL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ TBool hasHistory = iDataStore->HasSyncHistory();
+
+ TPckgC<TBool> pckg(hasHistory);
+ iMessage.WriteL( 0, pckg, 0);
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::AddedItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ const MSmlDataItemUidSet& items = iDataStore->AddedItems();
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ items.ExternalizeL( stream );
+ CleanupStack::PopAndDestroy( &stream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::DeletedItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ const MSmlDataItemUidSet& items = iDataStore->DeletedItems();
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ items.ExternalizeL( stream );
+ CleanupStack::PopAndDestroy( &stream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::SoftDeletedItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ const MSmlDataItemUidSet& items = iDataStore->SoftDeletedItems();
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ items.ExternalizeL( stream );
+ CleanupStack::PopAndDestroy( &stream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ModifiedItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ const MSmlDataItemUidSet& items = iDataStore->ModifiedItems();
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ items.ExternalizeL( stream );
+ CleanupStack::PopAndDestroy( &stream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::MovedItemsL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ const MSmlDataItemUidSet& items = iDataStore->MovedItems();
+
+ RMemWriteStream stream ( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( stream );
+ items.ExternalizeL( stream );
+ CleanupStack::PopAndDestroy( &stream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ResetChangeInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->ResetChangeInfoL( iStatus ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->ResetChangeInfoL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CommitChangeInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ if ( iItems )
+ {
+ delete iItems;
+ iItems = NULL;
+ }
+ iItems = new (ELeave) CNSmlDataItemUidSet();
+ iItems->InternalizeL( readStream );
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ SetActive();
+ iStatus = KRequestPending;
+ TRAPD(err, iDataStore->CommitChangeInfoL( iStatus, *iItems ));
+ if ( err )
+ {
+ // we are on active state, call request completed (RunL)
+ LOGGER_WRITE_1("iDataStore->CommitChangeInfoL leaved with err: %d", err);
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CloseStore()
+ {
+ TRACE_FUNC_ENTRY;
+ DoCloseStore();
+ REComSession::FinalClose();
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::SetSyncTimeStampL()
+ {
+ TRACE_FUNC_ENTRY;
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+ TInt relationId = readStream.ReadInt32L();
+ TInt providerId = readStream.ReadInt32L();
+ CleanupStack::PopAndDestroy( &readStream );
+
+ CSconSyncRelationship::SetTimeStampL( iFs, TUid::Uid(relationId), providerId);
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::GetSyncTimeStampL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt providerId = iMessage.Int0();
+ TInt relationId = iMessage.Int1();
+
+ TDateTime time;
+ CSconSyncRelationship::GetTimeStampL( iFs, TUid::Uid(relationId), providerId, time);
+
+ // write timestamp
+ TPckgC<TDateTime> timeBuf(time);
+ iMessage.WriteL( 2, timeBuf, 0);
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::ExportStoreFormatL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+ if ( !iDataProvider )
+ {
+ User::Leave( KErrNotReady );
+ }
+ CBufFlat* buffer = CBufFlat::NewL( KDefaultExpandSize );
+ CleanupStack::PushL( buffer );
+ RBufWriteStream stream( *buffer );
+ CleanupClosePushL( stream );
+
+ const CSmlDataStoreFormat& storeFormat = iDataProvider->StoreFormatL();
+ TRAP_IGNORE( TLogDataStoreFormat::LogDataStoreFormatL( _L("iDataProvider->StoreFormatL()"), storeFormat ));
+
+ storeFormat.ExternalizeL( stream );
+
+ stream.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ buffer->Compress();
+
+ RMemWriteStream chunkStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( chunkStream );
+
+ chunkStream.WriteInt32L( buffer->Size() );
+ chunkStream.WriteL( buffer->Ptr(0), buffer->Size());
+ chunkStream.CommitL();
+ CleanupStack::PopAndDestroy( &chunkStream );
+
+ CleanupStack::PopAndDestroy( buffer );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::SetRemoteStoreFormatL()
+ {
+ TRACE_FUNC_ENTRY;
+ LeaveIfNoInstanceL();
+
+ RMemReadStream readStream( iChunk.Base(), iChunk.Size() );
+ CleanupClosePushL( readStream );
+
+ if ( iStoreFormat )
+ {
+ delete iStoreFormat;
+ iStoreFormat = NULL;
+ }
+ iStoreFormat = CSmlDataStoreFormat::NewLC( iStringPool, readStream);
+ CleanupStack::Pop( iStoreFormat );
+ TRAP_IGNORE( TLogDataStoreFormat::LogDataStoreFormatL( _L("iDataProvider->SetRemoteStoreFormatL()"), *iStoreFormat ));
+ iDataStore->SetRemoteStoreFormatL( *iStoreFormat );
+
+ CleanupStack::PopAndDestroy( &readStream );
+
+ CompleteRequest( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::LeaveIfNoInstanceL()
+ {
+ if ( !iDataStore )
+ {
+ LOGGER_WRITE("DataStore instance was not ready, leaving KErrNotReady");
+ User::Leave( KErrNotReady );
+ }
+ }
+
+void CSconAsyncHandler::DoCloseStore()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iItems;
+ iItems = NULL;
+ delete iWriteData;
+ iWriteData = NULL;
+ if ( iDataProvider && iContext )
+ {
+ TInt providerId = iDataProvider->Identifier();
+ TInt contextId = iContext->SyncTaskKey();
+ TRAP_IGNORE( CSconSyncRelationship::SetTimeStampL( iFs, TUid::Uid(contextId), providerId) );
+ }
+ delete iDataStore;
+ iDataStore = NULL;
+ delete iDataProvider;
+ iDataProvider = NULL;
+ delete iContext;
+ iContext = NULL;
+ delete iStoreFormat;
+ iStoreFormat = NULL;
+
+ CleanOldStoresL();
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CleanOldStoresL()
+ {
+ TRACE_FUNC_ENTRY;
+ TFileName path;
+ User::LeaveIfError( iFs.PrivatePath( path ) );
+ CDir* dir;
+ iFs.GetDir( path, KEntryAttNormal, ESortByDate, dir );
+ CleanupStack::PushL( dir );
+ TInt storesCount(0);
+ LOGGER_WRITE_1("count: %d", dir->Count() );
+ for ( TInt i=dir->Count()-1; i >= 0; i-- )
+ {
+ LOGGER_WRITE_1("dir[%d]", i);
+ TEntry entry = (*dir)[i];
+ LOGGER_WRITE_1("file: %S", &entry.iName);
+ _LIT(KContextStoreName, "contextstore");
+ _LIT(KTimeStoreName, "timestore");
+ if ( entry.iName.Find(KContextStoreName) == 0 )
+ {
+ storesCount++;
+ LOGGER_WRITE_1("storeNro: %d", storesCount);
+#ifdef _DEBUG
+ TTime time = entry.iModified;
+ TDateTime dt = time.DateTime();
+ _LIT(KFormat, "%d.%d %02d:%02d");
+ TFileName mod;
+ mod.Format(KFormat, dt.Day()+1, dt.Month()+1, dt.Hour()+1,dt.Minute() );
+ LOGGER_WRITE_1("time: %S", &mod);
+#endif
+ if ( storesCount > KMaxStoresCount )
+ {
+ LOGGER_WRITE_1("delete contextstore: '%S'", &entry.iName );
+ iFs.Delete( entry.iName );
+ TFileName timeStoreFile;
+ timeStoreFile = entry.iName.Right(15);
+ timeStoreFile.Insert(0, KTimeStoreName);
+ LOGGER_WRITE_1("delete timeStoreFile: %S", &timeStoreFile);
+ iFs.Delete( timeStoreFile );
+ }
+ }
+
+ }
+ CleanupStack::PopAndDestroy( dir );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconAsyncHandler::CompleteRequest( TInt aError )
+ {
+ TRACE_FUNC;
+ iTimeOut->Cancel();
+ LOGGER_WRITE_1("iMessage.Complete( %d )", aError);
+ iMessage.Complete( aError );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/src/sconsyncrelationship.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncRelationship implementation
+*
+*/
+
+
+#include "sconsyncrelationship.h"
+#include <s32file.h>
+#include <nsmlchangefinder.h>
+
+#include "debug.h"
+
+_LIT(KContextStore, "contextstore_0x%08x.dat");
+_LIT(KTimeStore, "timestore_0x%08x.dat");
+
+CSconSyncRelationship::~CSconSyncRelationship()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iDictionaryStore )
+ {
+ iDictionaryStore->Commit();
+ delete iDictionaryStore;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+CSconSyncRelationship::CSconSyncRelationship( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId )
+ : iFs(aFs), iID(aRelationUid), iProviderId(aProviderId)
+ {
+ TRACE_FUNC;
+
+ }
+
+CSconSyncRelationship* CSconSyncRelationship::NewL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aProviderId )
+ {
+ TRACE_FUNC_ENTRY;
+ CSconSyncRelationship* self = new (ELeave) CSconSyncRelationship( aFs, aRelationUid, aProviderId );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+void CSconSyncRelationship::SetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aRelationUid: 0x%08x", aRelationUid.iUid );
+ LOGGER_WRITE_1("aId: 0x%08x", aId );
+ aFs.SetSessionToPrivate( EDriveC );
+ TFileName file;
+ file.Format(KTimeStore, aRelationUid.iUid);
+ CDictionaryFileStore* dictionaryStore = CDictionaryFileStore::OpenLC(aFs, file, TUid::Uid(0x0001));
+
+ RDictionaryWriteStream stream;
+ stream.AssignLC( *dictionaryStore, TUid::Uid(aId) );
+
+ TTime time;
+ time.UniversalTime();
+
+ TDateTime dateTime = time.DateTime();
+ TPckgBuf<TDateTime> timeBuf(dateTime);
+
+ stream.WriteL( timeBuf );
+ stream.CommitL();
+
+ CleanupStack::PopAndDestroy( &stream ); //AssingLC
+ dictionaryStore->Commit();
+ CleanupStack::PopAndDestroy( dictionaryStore );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncRelationship::GetTimeStampL( RFs& aFs, TUid aRelationUid, TSmlDataProviderId aId, TDateTime& aTimeStamp )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aRelationUid: 0x%08x", aRelationUid.iUid );
+ LOGGER_WRITE_1("aId: 0x%08x", aId );
+ User::LeaveIfError( aFs.SetSessionToPrivate( EDriveC ) );
+ TFileName file;
+ file.Format(KTimeStore, aRelationUid.iUid);
+ CDictionaryFileStore* dictionaryStore = CDictionaryFileStore::OpenLC(aFs, file, TUid::Uid(0x0001));
+ TBool present = dictionaryStore->IsPresentL( TUid::Uid(aId) );
+ if ( !present )
+ {
+ LOGGER_WRITE("Stream was not present");
+ User::Leave(KErrNotFound);
+ }
+ RDictionaryReadStream stream;
+ stream.OpenLC( *dictionaryStore, TUid::Uid(aId) );
+ TPckgBuf<TDateTime> timeBuf;
+ stream.ReadL( timeBuf );
+ aTimeStamp = timeBuf();
+ CleanupStack::PopAndDestroy(); //OpenLC
+ CleanupStack::PopAndDestroy( dictionaryStore );
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncRelationship::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iFs.SetSessionToPrivate( EDriveC );
+ TFileName file;
+ file.Format(KContextStore, iID.iUid);
+ iDictionaryStore = CDictionaryFileStore::OpenL(
+ iFs, file, TUid::Uid(0x0001));
+
+ TRACE_FUNC_EXIT;
+ }
+
+
+TSmlSyncTaskKey CSconSyncRelationship::SyncTaskKey() const
+ {
+ TRACE_FUNC;
+ return static_cast<TSmlSyncTaskKey>(iID.iUid);
+ }
+
+void CSconSyncRelationship::OpenReadStreamLC(RReadStream& aReadStream, TUid aStreamUid)
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid);
+ TUid streamUid(aStreamUid);
+ if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
+ {
+ LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
+ streamUid.iUid = iProviderId;
+ }
+ if ( !IsStreamPresentL( streamUid ) )
+ {
+ LOGGER_WRITE("Stream was not present");
+ User::Leave(KErrNotFound);
+ }
+
+
+ static_cast<RDictionaryReadStream&>(aReadStream).OpenLC(
+ *iDictionaryStore, streamUid );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncRelationship::OpenWriteStreamLC(RWriteStream& aWriteStream, TUid aStreamUid)
+ {
+ TRACE_FUNC_ENTRY;
+
+ LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid);
+ TUid streamUid(aStreamUid);
+ if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
+ {
+ LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
+ streamUid.iUid = iProviderId;
+ }
+ static_cast<RDictionaryWriteStream&>(aWriteStream).AssignLC(
+ *iDictionaryStore, streamUid );
+ TRACE_FUNC_EXIT;
+ }
+
+TBool CSconSyncRelationship::IsStreamPresentL(TUid aStreamUid) const
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aStreamUid: 0x%08x", aStreamUid.iUid );
+ TUid streamUid(aStreamUid);
+ if ( aStreamUid.iUid == KNSmlDefaultSnapshotStreamUID )
+ {
+ LOGGER_WRITE_1(" Default stream uid was used, use provider uid (0x%08x) as stream uid", iProviderId);
+ streamUid.iUid = iProviderId;
+ }
+ TBool present = iDictionaryStore->IsPresentL( streamUid );
+ LOGGER_WRITE_1("CSconSyncRelationship::IsStreamPresentL() return: %d",(TInt)present);
+ return present;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/src/sconsyncserver.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncServer implementation
+*
+*/
+
+
+#include "sconsyncserver.h"
+#include "sconsyncclientserver.h"
+
+#include "sconsyncsession.h"
+#include "debug.h"
+
+const TInt KSConPCConnServerUid = 0x101F99F6;
+
+// Security policy
+const TUint KServerPolicyRangeCount = 2;
+
+const TInt KServerPolicyRanges[KServerPolicyRangeCount] =
+ {
+ 0, // range is 0 inclusive
+ EMaxService // range is 1-KMaxTInt inclusive
+ };
+
+const TUint8 KServerPolicyElementsIndex[KServerPolicyRangeCount] =
+ {
+ 0, // applies to 0th range
+ CPolicyServer::ENotSupported // applies to 1st range
+ };
+
+const CPolicyServer::TPolicyElement KServerPolicyElements[] =
+ {
+ { _INIT_SECURITY_POLICY_S0(KSConPCConnServerUid) /*_INIT_SECURITY_POLICY_C1(ECapabilityReadDeviceData)*/, CPolicyServer::EFailClient }
+ };
+
+const CPolicyServer::TPolicy KServerPolicy =
+ {
+ 0 /*CPolicyServer::EAlwaysPass*/, // specifies all connect attempts should pass
+ KServerPolicyRangeCount,
+ KServerPolicyRanges,
+ KServerPolicyElementsIndex,
+ KServerPolicyElements
+ };
+
+
+CSconSyncServer* CSconSyncServer::NewL()
+ {
+ CSconSyncServer* self = NewLC();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+CSconSyncServer* CSconSyncServer::NewLC()
+ {
+ CSconSyncServer* self = new(ELeave) CSconSyncServer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CSconSyncServer::CSconSyncServer() :
+ CPolicyServer(EPriorityStandard, KServerPolicy, ESharableSessions)
+ {
+ }
+
+void CSconSyncServer::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt error = Start(KSconSyncServerName);
+
+ if (error != KErrNone)
+ {
+ User::Panic(KSconSyncServerName, error);
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+CSconSyncServer::~CSconSyncServer()
+ {
+ TRACE_FUNC;
+ }
+
+CSession2* CSconSyncServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const
+ {
+ TRACE_FUNC;
+ TVersion v(1,0,0);
+ if ( !User::QueryVersionSupported(v,aVersion) )
+ {
+ TVersionName vname = aVersion.Name();
+ LOGGER_WRITE_1("Client has wrong version: %S", &vname);
+ User::Leave( KErrNotSupported );
+ }
+
+ return CSconSyncSession::NewL();
+ }
+
+TInt CSconSyncServer::RunError(TInt aError)
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aError: %d", aError);
+ // Bad descriptor implies bad client
+ if (aError == KErrBadDescriptor)
+ {
+ Message().Panic(KSconSyncServerName, aError);
+ }
+ else
+ {
+ Message().Complete(aError);
+ }
+
+ // Continue handling requests
+ ReStart();
+ TRACE_FUNC_EXIT;
+ return KErrNone;
+ }
+
+void CSconSyncServer::AddSession()
+ {
+ ++iSessionCount;
+ LOGGER_WRITE_1("CSconSyncServer::AddSession(), iSessionCount: %d", iSessionCount);
+ }
+
+void CSconSyncServer::RemoveSession()
+ {
+ --iSessionCount;
+ LOGGER_WRITE_1("CSconSyncServer::RemoveSession(), iSessionCount: %d", iSessionCount);
+ if (iSessionCount == 0)
+ {
+ CActiveScheduler::Stop();
+ }
+ }
+
+LOCAL_C void ExeMainL()
+ {
+ TRACE_FUNC_ENTRY;
+ // Install active scheduler
+ CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
+ CleanupStack::PushL(scheduler);
+ CActiveScheduler::Install(scheduler);
+
+ CSconSyncServer::NewLC();
+
+ User::LeaveIfError(User::RenameThread(KSconSyncServerName));
+ RProcess::Rendezvous(KErrNone);
+
+ CActiveScheduler::Start();
+
+ CleanupStack::PopAndDestroy(); // CSconSyncServer
+ CleanupStack::PopAndDestroy(); // CActiveScheduler
+ TRACE_FUNC_EXIT;
+ }
+
+GLDEF_C TInt E32Main()
+ {
+ TRACE_FUNC_ENTRY;
+ __UHEAP_MARK;
+ CTrapCleanup* cleanup = CTrapCleanup::New();
+
+ TRAPD(error, ExeMainL());
+ __ASSERT_ALWAYS(!error, User::Panic(KSconSyncServerName, error));
+
+ delete cleanup;
+ __UHEAP_MARKEND;
+ TRACE_FUNC_EXIT;
+ return 0;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/servers/syncserver/src/sconsyncsession.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncSession implementation
+*
+*/
+
+
+#include "sconsyncsession.h"
+
+#include "sconsyncserver.h"
+#include "sconsyncclientserver.h"
+#include "sconasynchandler.h"
+#include "debug.h"
+
+
+CSconSyncSession::CSconSyncSession()
+ {
+ TRACE_FUNC;
+ }
+
+CSconSyncSession* CSconSyncSession::NewL()
+ {
+ TRACE_FUNC;
+ CSconSyncSession* self = new(ELeave) CSconSyncSession();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+void CSconSyncSession::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iAsyncHandler = CSconAsyncHandler::NewL();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncSession::CreateL()
+ {
+ TRACE_FUNC;
+ Server().AddSession();
+ }
+
+CSconSyncSession::~CSconSyncSession()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iAsyncHandler;
+
+ Server().RemoveSession();
+
+ TRACE_FUNC_EXIT;
+ }
+
+CSconSyncServer& CSconSyncSession::Server()
+ {
+ return *static_cast<CSconSyncServer*>(const_cast<CServer2*>(CSession2::Server()));
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSconSyncSession::ServiceL()
+// Handles the client request
+// -----------------------------------------------------------------------------
+//
+void CSconSyncSession::ServiceL(const RMessage2& aMessage)
+ {
+ TRACE_FUNC_ENTRY;
+
+ TRAPD( err, iAsyncHandler->HandleServiceL( aMessage ));
+ if ( err )
+ {
+ LOGGER_WRITE_1("iAsyncHandler->HandleServiceL leaved: %d", err);
+ if ( iAsyncHandler->IsActive() )
+ {
+ LOGGER_WRITE(" and it was active -> Cancel it");
+ iAsyncHandler->Cancel();
+ }
+ // do server error processing
+ User::Leave( err );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+
Binary file connectivitymodules/SeCon/services/csc/bld/101F9698.xml has changed
Binary file connectivitymodules/SeCon/services/csc/bld/101F99F6.xml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Capability Object Module bld.inf file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+./101F9698.xml Z:/private/101F99F6/capability/101F9698.xml
+./fwdcomp.xml Z:/private/101F99F6/capability/fwdcomp.xml
+./101F99F6.xml Z:/private/101F99F6/capability/101F99F6.xml
+
+PRJ_MMPFILES
+sconcsc.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateCSConCSCL@@YAPAVCSConCSC@@XZ @ 1 NONAME ; class CSConCSC * CreateCSConCSCL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/bld/def/eabiuu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z15CreateCSConCSCLv @ 1 NONAME
+ _ZTI8CSConCSC @ 2 NONAME ; #<TI>#
+ _ZTV8CSConCSC @ 3 NONAME ; #<VT>#
+
Binary file connectivitymodules/SeCon/services/csc/bld/fwdcomp.xml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/bld/sconcsc.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Capability Object Module mmp file
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH sys/bin
+
+TARGET sconcsc.dll
+TARGETTYPE DLL
+UID 0x10009D8D 0x101F9698
+
+#if defined(ARMCC)
+DEFFILE ./def/eabiu
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+SOURCEPATH ../src
+SOURCE sconcsc.cpp
+SOURCE capinfo.cpp
+SOURCE caputils.cpp
+SOURCE caplist.cpp
+SOURCE stringlist.cpp
+SOURCE capparser.cpp
+SOURCE sconsyncservice.cpp
+SOURCE sconversioninfo.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+// Default system include paths for middleware layer modules.
+//MW_LAYER_SYSTEMINCLUDE
+APP_LAYER_SYSTEMINCLUDE
+
+DEBUGLIBRARY flogger.lib
+LIBRARY euser.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
+LIBRARY sysutil.lib
+LIBRARY etel.lib
+LIBRARY etelmm.lib
+LIBRARY hal.lib
+LIBRARY platformenv.lib
+LIBRARY charconv.lib
+LIBRARY centralrepository.lib
+LIBRARY apgrfx.lib
+LIBRARY apparc.lib
+LIBRARY sisregistryclient.lib
+LIBRARY SyncMLClientAPI.lib
+LIBRARY javaregistryclient.lib
+LIBRARY sysversioninfo.lib
+LIBRARY Etel3rdParty.lib
+LIBRARY platformver.lib
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/capability.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,483 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Capability service controller
+*
+*/
+
+
+#ifndef _CAPABILITY_H_
+#define _CAPABILITY_H_
+
+#include <e32std.h>
+
+//
+// string sizes
+//
+const TInt KBufSize(128);
+const TInt KTagSize(64);
+const TInt KMaxSize(512);
+
+const TInt KNestingLimit(10);
+
+//
+// this directory contains xml-format files for
+// Service-elements
+//
+_LIT(KCapabilityDirC, "c:\\private\\101F99F6\\capability\\");
+_LIT(KCapabilityDirCImport, "c:\\private\\101F99F6\\import\\");
+_LIT(KCapabilityDirZ, "z:\\private\\101F99F6\\capability\\");
+
+//
+// folder service constants
+//
+_LIT(KFolderServiceName, "Folder-Browsing");
+_LIT(KFolderServiceUid, "F9EC7BC4-953c-11d2-984E-525400DC9E09");
+_LIT(KFolderServiceVersion, "1.0");
+_LIT(KFolderServiceType, "x-obex/folder-listing");
+_LIT(KFolderMemoryTypeTag, "MemType");
+_LIT(KFolderNameTag, "Folder");
+
+_LIT(KFolderImages, "Images");
+_LIT(KFolderGraphics, "Graphics");
+_LIT(KFolderTones, "Tones");
+_LIT(KFolderMusic, "Music");
+_LIT(KFolderVideos, "Videos");
+_LIT(KFolderInstalls, "Installs");
+
+_LIT( KSyncSolutionsServiceName, "SyncSolutions" );
+_LIT( KSyncSolutionsServiceVersion, "1.0" );
+_LIT( KSyncCalendar, "Calendar" );
+_LIT( KSyncContacts, "Contacts" );
+_LIT( KSyncSms, "Sms" );
+_LIT( KSyncBookmark, "Bookmark" );
+
+_LIT( KDesktopSync, "DesktopSync" );
+
+enum TFolderTypes
+ {
+ EFolderImages,
+ EFolderGraphics,
+ EFolderTones,
+ EFolderMusic,
+ EFolderVideos,
+ EFolderInstalls
+ };
+
+
+//
+// misc capabily document strings
+//
+_LIT(KServiceHeader, "<!-- Capability Object Service -->");
+_LIT(KXmlVersion, "<?xml version=\"1.0\" ?>");
+_LIT(KComment1, "<!-- OBEX Capability Object -->");
+_LIT(KDocType, "<!DOCTYPE Capability SYSTEM \"obex-capability.dtd\">");
+_LIT(KRootBegin, "<Capability Version=\"1.0\">");
+_LIT(KRootEnd, "</Capability>");
+_LIT(KCommentBegin, "<!--");
+_LIT(KCommentEnd, "-->");
+_LIT(KFormatText, " ");
+_LIT(KXmlExtension, ".xml");
+
+
+//
+// manufacturers
+//
+_LIT(KManufacturerNokia, "Nokia");
+_LIT(KManufacturerEricsson, "Ericsson");
+_LIT(KManufacturerMotorola, "Motorola");
+_LIT(KManufacturerPanasonic, "Panasonic");
+_LIT(KManufacturerPsion, "Psion");
+_LIT(KManufacturerIntel, "Intel");
+_LIT(KManufacturerCogent, "Cogent");
+_LIT(KManufacturerCirrus, "Cirrus");
+_LIT(KManufacturerLinkup, "Linkup");
+_LIT(KManufacturerTexasInstruments, "TexasInstruments");
+
+
+//
+// media types (TMediaType in e32std.h)
+//
+_LIT(KMediaMMC, "MMC"); // memory card
+_LIT(KMediaFlash, "DEV"); // device memory
+
+//
+// TElementType contains all element types used in
+// capabilty xml document
+//
+//
+enum TElementType
+ {
+ ECapability,
+ EGeneral,
+ EManufacturer,
+ EModel,
+ ESN,
+ EOEM,
+ ESW,
+ EFW,
+ EHW,
+ ELanguage,
+ EMemory,
+ EMemType,
+ ELocation,
+ EFree,
+ EUsed,
+ EShared,
+ EFileSize,
+ EFolderSize,
+ EFileNLen,
+ EFolderNLen,
+ ECaseSenN,
+
+ EExt,
+ EXNam,
+ EXVal,
+
+ EObject,
+ EType,
+ EName_Ext,
+ ESize,
+
+ EAccess,
+ EProtocol,
+ EEndpoint,
+ ETarget,
+
+ EInbox,
+ EService,
+ EName,
+ EUUID,
+ EVersion,
+
+ EAttVersion,
+ EAttDate,
+
+ EAttCurrentNetwork,
+ EAttHomeNetwork,
+ EAttCountryCode
+ };
+
+
+
+
+//
+// KXmlTokens contains all tokens (=tags) used in
+// capabilty xml document
+//
+//
+
+typedef const TText* TTag;
+NONSHARABLE_STRUCT( TXmlToken )
+ {
+ TInt id;
+ TTag tag;
+ };
+
+const TXmlToken KXmlTokens[] =
+ {
+ {ECapability, _S("Capability")},
+ {EGeneral, _S("General")},
+ {EManufacturer, _S("Manufacturer")},
+ {EModel, _S("Model")},
+ {ESN, _S("SN")},
+ {EOEM, _S("OEM")},
+ {ESW, _S("SW")},
+ {EFW, _S("FW")},
+ {EHW, _S("HW")},
+ {ELanguage, _S("Language")},
+ {EMemory, _S("Memory")},
+ {EMemType, _S("MemType")},
+ {ELocation, _S("Location")},
+ {EFree, _S("Free")},
+ {EUsed, _S("Used")},
+ {EShared, _S("Shared")},
+ {EFileSize, _S("FileSize")},
+ {EFolderSize, _S("FolderSize")},
+ {EFileNLen, _S("FileNLen")},
+ {EFolderNLen, _S("FolderNLen")},
+ {ECaseSenN, _S("CaseSenN")},
+ {EExt, _S("Ext")},
+ {EXNam, _S("XNam")},
+ {EXVal, _S("XVal")},
+ {EObject, _S("Object")},
+ {EType, _S("Type")},
+ {EName_Ext, _S("Name_Ext")},
+ {ESize, _S("Size")},
+ {EAccess, _S("Access")},
+ {EProtocol, _S("Protocol")},
+ {EEndpoint, _S("Endpoint")},
+ {ETarget, _S("Target")},
+ {EInbox, _S("Inbox")},
+ {EService, _S("Service")},
+ {EName, _S("Name")},
+ {EUUID, _S("UUID")},
+ {EVersion, _S("Version")},
+ {EXNam, _S("XNam")},
+ {EXVal, _S("XVal")},
+ {EAttVersion, _S("Version")},
+ {EAttDate, _S("Date")},
+ {EAttCurrentNetwork,_S("CurrentNetwork")},
+ {EAttHomeNetwork, _S("HomeNetwork")},
+ {EAttCountryCode, _S("CountryCode")}
+ };
+
+#define NUMXMLTOKENS (sizeof(KXmlTokens)/sizeof(TXmlToken))
+
+
+
+
+//
+// string array to convert symbian TLanguage enums to
+// ISO 639 language codes
+//
+// See "http://www.sil.org/iso639-3/default.asp"
+//
+
+typedef const TText* TLangString;
+NONSHARABLE_STRUCT( TLangStringStruct )
+ {
+ TInt id;
+ TLangString lang;
+ };
+
+/**
+ * Language mapping table.
+ */
+const TLangStringStruct KLangStrings[] =
+ {
+ {ELangEnglish, _S("en")},
+ {ELangFrench, _S("fr")},
+ {ELangGerman, _S("de")},
+ {ELangSpanish, _S("es")},
+ {ELangItalian, _S("it")},
+ {ELangSwedish, _S("sv")},
+ {ELangDanish, _S("da")},
+ {ELangNorwegian, _S("no")},
+ {ELangFinnish, _S("fi")},
+
+ {ELangAmerican, _S("en_US")},
+ {ELangSwissFrench, _S("fr_CH")},
+ {ELangSwissGerman, _S("de_CH")},
+ {ELangPortuguese, _S("pt")},
+ {ELangTurkish, _S("tr")},
+ {ELangIcelandic, _S("is")},
+ {ELangRussian, _S("ru")},
+ {ELangHungarian, _S("hu")},
+ {ELangDutch, _S("nl")},
+
+ {ELangBelgianFlemish, _S("nl_BE")},
+ {ELangAustralian, _S("aus")},
+ {ELangBelgianFrench, _S("fr_BE")},
+ {ELangAustrian, _S("de_AT")},
+ {ELangNewZealand, _S("en_NZ")},
+ {ELangInternationalFrench, _S("fr")},
+ {ELangCzech, _S("cs")},
+ {ELangSlovak, _S("sk")},
+ {ELangPolish, _S("pl")},
+
+ {ELangSlovenian, _S("sl")},
+ {ELangTaiwanChinese, _S("zh_TW")},
+ {ELangHongKongChinese, _S("zh_HK")},
+ {ELangPrcChinese, _S("zh_CN")},
+ {ELangJapanese, _S("ja")},
+ {ELangThai, _S("th")},
+ {ELangAfrikaans, _S("af")},
+ {ELangAlbanian, _S("sq")},
+ {ELangAmharic, _S("am")},
+
+ {ELangArabic, _S("ar")},
+ {ELangArmenian, _S("hy")},
+ {ELangTagalog, _S("tl")},
+ {ELangBelarussian, _S("be")},
+ {ELangBengali, _S("bn")},
+ {ELangBulgarian, _S("bg")},
+ {ELangBurmese, _S("my")},
+ {ELangCatalan, _S("ca")},
+ {ELangCroatian, _S("hr")},
+
+ {ELangCanadianEnglish, _S("en_CA")},
+ {ELangInternationalEnglish, _S("en")},
+ {ELangSouthAfricanEnglish, _S("en_ZA")},
+ {ELangEstonian, _S("et")},
+ {ELangFarsi, _S("fa")},
+ {ELangCanadianFrench, _S("fr_CA")},
+ {ELangScotsGaelic, _S("gd")},
+ {ELangGeorgian, _S("ka")},
+ {ELangGreek, _S("el")},
+
+ {ELangCyprusGreek, _S("el_CY")},
+ {ELangGujarati, _S("gu")},
+ {ELangHebrew, _S("he")},
+ {ELangHindi, _S("hi")},
+ {ELangIndonesian, _S("id")},
+ {ELangIrish, _S("ga")},
+ {ELangSwissItalian, _S("it_CH")},
+ {ELangKannada, _S("kn")},
+ {ELangKazakh, _S("kk")},
+
+ {ELangKhmer, _S("km")},
+ {ELangKorean, _S("ko")},
+ {ELangLao, _S("lo")},
+ {ELangLatvian, _S("lv")},
+ {ELangLithuanian, _S("lt")},
+ {ELangMacedonian, _S("mk")},
+ {ELangMalay, _S("ms")},
+ {ELangMalayalam, _S("ml")},
+ {ELangMarathi, _S("mr")},
+
+ {ELangMoldavian, _S("mo")},
+ {ELangMongolian, _S("mn")},
+ {ELangNorwegianNynorsk, _S("nn")},
+ {ELangBrazilianPortuguese, _S("pt_BR")},
+ {ELangPunjabi, _S("pa")},
+ {ELangRomanian, _S("ro")},
+ {ELangSerbian, _S("sr")},
+ {ELangSinhalese, _S("si")},
+ {ELangSomali, _S("so")},
+
+ {ELangInternationalSpanish, _S("es")},
+ {ELangLatinAmericanSpanish, _S("es_US")},
+ {ELangSwahili, _S("sw")},
+ {ELangFinlandSwedish, _S("sv_FI")},
+ {ELangReserved1, _S("en")},
+ {ELangTamil, _S("ta")},
+ {ELangTelugu, _S("te")},
+ {ELangTibetan, _S("bo")},
+ {ELangTigrinya, _S("ti")},
+
+ {ELangCyprusTurkish, _S("tr_CY")},
+ {ELangTurkmen, _S("tk")},
+ {ELangUkrainian, _S("uk")},
+ {ELangUrdu, _S("ur")},
+ {ELangReserved2, _S("en")},
+ {ELangVietnamese, _S("vi")},
+ {ELangWelsh, _S("cy")},
+ {ELangZulu, _S("zu")},
+ {ELangOther, _S("other")},
+
+ {ELangManufacturerEnglish, _S("en")},
+ {ELangSouthSotho, _S("st")},
+ {ELangBasque, _S("eu")},
+ {ELangGalician, _S("gl")},
+ {ELangJavanese, _S("jv")},
+ {ELangMaithili, _S("bh")},
+ {ELangAzerbaijani_Latin, _S("az")},
+ {ELangAzerbaijani_Cyrillic, _S("az")},
+ {ELangOriya, _S("or")},
+ {ELangBhojpuri, _S("bh")},
+ {ELangSundanese, _S("su")},
+ {ELangKurdish_Latin, _S("ku")},
+ {ELangKurdish_Arabic, _S("ku")},
+ {ELangPashto, _S("ps")},
+ {ELangHausa, _S("ha")},
+ {ELangOromo, _S("om")},
+ {ELangUzbek_Latin, _S("uz")},
+ {ELangUzbek_Cyrillic, _S("uz")},
+ {ELangSindhi_Arabic, _S("sd")},
+ {ELangSindhi_Devanagari, _S("sd")},
+ {ELangYoruba, _S("yo")},
+ {ELangCebuano, _S("ceb")},
+ {ELangIgbo, _S("ig")},
+ {ELangMalagasy, _S("mg")},
+ {ELangNepali, _S("ne")},
+ {ELangAssamese, _S("as")},
+ {ELangShona, _S("sn")},
+ {ELangZhuang, _S("za")},
+ {ELangMadurese, _S("mad")},
+
+ {ELangEnglish_Apac, _S("en")},
+ {ELangEnglish_Taiwan, _S("en")},
+ {ELangEnglish_HongKong, _S("en")},
+ {ELangEnglish_Prc, _S("en")},
+ {ELangEnglish_Japan, _S("en")},
+ {ELangEnglish_Thailand, _S("en")},
+
+ {ELangFulfulde, _S("ff")},
+ {ELangTamazight, _S("ber")},
+ {ELangBolivianQuechua, _S("qu")},
+ {ELangPeruQuechua, _S("qu")},
+ {ELangEcuadorQuechua, _S("qu")},
+ {ELangTajik_Cyrillic, _S("tg")},
+ {ELangTajik_PersoArabic, _S("tg")},
+ {ELangNyanja, _S("ny")},
+ {ELangHaitianCreole, _S("ht")},
+ {ELangLombard, _S("lmo")},
+ {ELangKoongo, _S("kg")},
+ {ELangAkan, _S("ak")},
+ {ELangHmong, _S("hmn")},
+ {ELangYi, _S("ii")},
+ {ELangTshiluba, _S("lu")},
+ {ELangIlocano, _S("ilo")},
+ {ELangUyghur, _S("ug")},
+ {ELangNeapolitan, _S("nap")},
+ {ELangRwanda, _S("rw")},
+ {ELangXhosa, _S("xh")},
+ {ELangBalochi, _S("bal")},
+ {ElangHiligaynon, _S("hil")},
+ {ELangMinangkabau, _S("min")},
+ {ELangMakhuwa, _S("vmw")},
+ {ELangSantali, _S("sat")},
+ {ELangGikuyu, _S("ki")},
+ {ELangMoore, _S("mos")},
+ {ELangGuarani, _S("gnHI")},
+ {ELangRundi, _S("ru")},
+ {ELangRomani_Latin, _S("rom")},
+ {ELangRomani_Cyrillic, _S("rom")},
+ {ELangTswana, _S("tn")},
+ {ELangKanuri, _S("kr")},
+ {ELangKashmiri_Devanagari, _S("ks")},
+ {ELangKashmiri_PersoArabic, _S("ks")},
+ {ELangUmbundu, _S("umb")},
+ {ELangKonkani, _S("kok")},
+ {ELangBalinese, _S("ban")},
+ {ELangNorthernSotho, _S("nso")},
+ {ELangWolof, _S("wo")},
+ {ELangBemba, _S("bmy")},
+ {ELangTsonga, _S("ts")},
+ {ELangYiddish, _S("yi")},
+ {ELangKirghiz, _S("ky")},
+ {ELangGanda, _S("lg")},
+ {ELangSoga, _S("xog")},
+ {ELangMbundu, _S("kmb")},
+ {ELangBambara, _S("bm")},
+ {ELangCentralAymara, _S("ay")},
+ {ELangZarma, _S("dje")},
+ {ELangLingala, _S("ln")},
+ {ELangBashkir, _S("ba")},
+ {ELangChuvash, _S("cv")},
+ {ELangSwati, _S("ss")},
+ {ELangTatar, _S("tt")},
+ {ELangSouthernNdebele, _S("nr")},
+ {ELangSardinian, _S("sc")},
+ {ELangScots, _S("sco")},
+ {ELangMeitei, _S("mni")},
+ {ELangWalloon, _S("wa")},
+ {ELangKabardian, _S("kbd")},
+ {ELangMazanderani, _S("mzn")},
+ {ELangGilaki, _S("glk")},
+ {ELangShan, _S("shn")},
+ {ELangLuyia, _S("luy")},
+ {ELanguageLuo, _S("luo")},
+ {ELangSukuma, _S(" suk")},
+ {ELangAceh, _S("ace")},
+ {ELangMalay_Apac, _S("ms")}
+ };
+
+#define NUMLANGSTRINGS (sizeof(KLangStrings)/sizeof(TLangStringStruct))
+
+
+
+
+#endif // capability.h
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/capinfo.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Capability service controller
+*
+*/
+
+
+#ifndef _CAPINFO_H_
+#define _CAPINFO_H_
+
+#include <e32base.h>
+#include <f32file.h>
+
+#include "caputils.h"
+
+//
+// CCapInfo creates capability document
+//
+//
+
+class CCapList;
+class CStringList;
+class TSConSolutionInfo;
+class CSconVersionInfo;
+
+NONSHARABLE_CLASS( CCapInfo ) : public CBase
+{
+public:
+ static CCapInfo* NewL();
+ ~CCapInfo();
+private:
+ CCapInfo();
+ void ConstructL();
+
+public:
+ void CapabilityDocumentL( CBufFlat* aBuf );
+
+private:
+ CCapList* CapList();
+ void SetCapabilityBuf( CBufFlat* aBuf );
+
+ void GeneralInfoL();
+ void MemoryInfoL();
+ void WriteMemoryInfoL( TMemoryInfo& aInfo );
+ void ServiceInfoL( const TDesC& aDir, const RArray<TFileName>& aExcludeList,
+ RArray<TFileName>& aFilesAdded );
+ void FolderServiceL();
+
+ void SyncSolutionsServiceL();
+ void WriteSyncSolutionsServiceL( const TSConSolutionInfo& aCalendar,
+ const TSConSolutionInfo& aContact,
+ const TSConSolutionInfo& aSms,
+ const TSConSolutionInfo& aBookmark );
+ void WriteSolutionTagL( const TDesC& aContentName, const TSConSolutionInfo& aSolution );
+
+ void WriteFolderL( const TDesC& aType, const TDesC& aFullName, const TDesC& aMemory );
+
+ void WriteValueL( TInt aId, const TDesC& aValue );
+ void WriteBigValueL( TInt aId, const TDesC& aValue );
+ void WriteValueL( TInt aId, TInt64 aValue );
+ void WriteTagL( TInt aId, TInt aType );
+ void WriteAttributeL( TInt aId, const TDesC& aVersion, const TDesC& aDate );
+ void WriteL( const TDesC& aText );
+
+ void WriteFromListL( CStringList* aList );
+ void WriteNewLineL();
+
+ void FormatElement( TDes& aText );
+ void AddFormatText( TDes& aText, TInt aNum ) const;
+
+private:
+ RFs iFsSession; // has
+ CCapList* iCapList; // has
+ HBufC8* iHeapBuf; // has
+ TBuf<KMaxSize> iBuf;
+ TIdStack iIdStack;
+
+ CBufFlat* iCapabilityBuf; // uses
+ CSconVersionInfo* iSconInfo;
+};
+
+#endif // CCapability
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/caplist.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCapList header file.
+*
+*/
+
+
+#ifndef _CAPLIST_H_
+#define _CAPLIST_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <badesca.h>
+#include "stringlist.h"
+
+//
+// Class CCapList
+//
+NONSHARABLE_CLASS( CCapList ) : public CBase
+{
+public:
+ /**
+ * Two-phase constructor.
+ * @return CCapList instance
+ */
+ static CCapList* NewL();
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CCapList();
+
+private:
+ /**
+ * Constructor
+ * @return none
+ */
+ CCapList();
+ /**
+ * Initializes the member data
+ * @return none
+ */
+ void ConstructL();
+ /**
+ * Operator =
+ * @param aList The data to be copied
+ * @return none
+ */
+ void operator=(const CCapList& aList); // not allowed
+
+public:
+ /**
+ * Returns the list
+ * @return The CStringList object
+ */
+ CStringList* List();
+
+public:
+ /**
+ * Find element
+ * @param aId
+ * @param aType
+ * @param aIndex (Default=0)
+ * @return position
+ */
+ TInt Find(TInt aId, TInt aType, TInt aIndex=0);
+ /**
+ * Find from mark
+ * @param aId
+ * @param aType
+ * @return position
+ */
+ TInt FindFromMark(TInt aId, TInt aType);
+ /**
+ * Finds service xml-file identification header. This header must be the first
+ * line in every service file.
+ * @return ETrue if service header found
+ */
+ TBool FindServiceHeader();
+ /**
+ * Find service
+ * @param aList The source list
+ * @return ETrue if Service is found
+ */
+ TBool FindServiceL(CStringList* aList);
+
+private:
+ CStringList* iList; // has
+};
+
+#endif
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/capparser.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,296 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CapParser header file
+*
+*/
+
+
+
+#ifndef _CAPPARSER_H_
+#define _CAPPARSER_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <badesca.h>
+
+//
+// Class CapParser
+//
+NONSHARABLE_CLASS( CapParser )
+ {
+
+public:
+ /**
+ * Parses element's id and type (eg. "<Memory>" -> EMemory, EElementBegin)
+ * @param aText
+ * @param aId
+ * @param aType
+ * @return none
+ */
+ static void ParseElement(const TDesC& aText, TInt& aId, TInt& aType);
+
+public:
+ /**
+ * Constructs element with value (eg. "<Free>23456</Free>").
+ * @param aText
+ * @param aId
+ * @param aValue
+ * @return none
+ */
+ static void MakeElementL(TDes& aText, TInt aId, const TDesC& aValue);
+ /**
+ * Constructs element without value (eg. "<Memory>" or "</Memory>").
+ * @param aText
+ * @param aId
+ * @param aType
+ * @return none
+ */
+ static void MakeElementL(TDes& aText, TInt aId, TInt aType);
+ /**
+ * Constructs element with attributes "Version" and "Date"(eg.
+ * "<FW Version="2.2"/>").
+ * @param aText
+ * @param aId
+ * @param aVersion
+ * @param aDate
+ * @return none
+ */
+ static void MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
+ const TDesC& aDate);
+ /**
+ * Constructs element with attributes
+ * @param aText
+ * @param aId
+ * @param aAttributes
+ * @return none
+ */
+ static void MakeElementL(TDes& aText, TInt aId, CDesCArrayFlat* aAttributes);
+
+public:
+ /**
+ * Returns capability element id (eg. EMemory).
+ * @param aText
+ * @return none
+ */
+ static TInt ElementId(const TDesC& aText);
+ /**
+ * Returns capability element tag (eg. "Memory").
+ * @param aText
+ * @param aId
+ * @return none
+ */
+ static void GetTagL(TDes& aText, TInt aId);
+
+private:
+ /**
+ * Replaces special characters to xml compliant.
+ * @param aText
+ * @param aValue
+ * @return none
+ */
+ static void ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue );
+ };
+
+
+//
+// Class TXmlParser
+//
+NONSHARABLE_CLASS( TXmlParser )
+ {
+
+public:
+ enum TElementType
+ {
+ EElementValue,
+ EElementBegin,
+ EElementEnd,
+ EElementEmpty,
+ EElementAtt,
+ EElementComment,
+ EElementVersion,
+ EElementDocType,
+ EElementUnknown
+ };
+
+
+public:
+ /**
+ * Sets a tag
+ * @param aText The tag
+ * @return none
+ */
+ void Set(const TDesC& aText);
+ /**
+ * Returns type
+ * @return type
+ */
+ TInt Type() const;
+ /**
+ * Returns a pointer to a tag
+ * @return The tag pointer
+ */
+ TPtrC Tag() const;
+ /**
+ * Gets the tag
+ * @param aText The tag buffer
+ * @return none
+ */
+ void GetTag(TDes& aText) const;
+
+private:
+ /**
+ * Parses value (eg. <Language>en</Language>)
+ * @return Operation success
+ */
+ TBool ElementValue();
+ /**
+ * Parses beginning tag (eg. <General>)
+ * @return Operation success
+ */
+ TBool ElementBegin();
+ /**
+ * Parses ending tag (eg. </General>)
+ * @return Operation success
+ */
+ TBool ElementEnd();
+ /**
+ * Parses empty element (eg. <CaseSenN/>)
+ * @return Operation success
+ */
+ TBool ElementEmpty();
+ /**
+ * Parses attribute element (eg. <HW Version="1.5"/>)
+ * Note: Attribute values cannot contain equals (=) or quotations (")
+ * @return Operation success
+ */
+ TBool ElementAtt();
+ /**
+ * Identifies comment element ("<!-- OBEX Capability Object -->").
+ * @return Operation success
+ */
+ TBool ElementComment();
+ /**
+ * Parses unknown elements
+ * @return Operation success
+ */
+ TBool ElementUnknown();
+ /**
+ * Identifies version element ("<?xml version="1.0" ?>")
+ * @return Operation success
+ */
+ TBool ElementVersion();
+ /**
+ * Identifies document type element
+ * ("<!DOCTYPE Capability SYSTEM "obex-capability.dtd">").
+ * @return Operation success
+ */
+ TBool ElementDocType();
+
+private:
+ /**
+ * Inits the parser
+ * @return none
+ */
+ void Init();
+ /**
+ * Parses xml-element.
+ * @return none
+ */
+ void Parse();
+
+public:
+ /**
+ * Validates the character
+ * @param aChar The char to be validated.
+ * @return ETrue if the char is valid
+ */
+ static TBool ValidChar(const TChar aChar);
+ /**
+ * Validates the tag
+ * @param aText The tag to be validated.
+ * @return ETrue if the tag is valid
+ */
+ static TBool ValidTag(const TDesC& aText);
+ /**
+ * Returns the number of characters (aChar)
+ * @param aText The buffer
+ * @param aChar The character
+ * @return The number of characters
+ */
+ static TInt Count(const TDesC& aText, const TChar aChar);
+ /**
+ * Returns the position of the first non space character
+ * @param aText The buffer
+ * @return The position
+ */
+ static TInt FirstNonSpace(const TDesC& aText);
+ /**
+ * Returns the position of the last non space character
+ * @param aText The buffer
+ * @return The position
+ */
+ static TInt LastNonSpace(const TDesC& aText);
+ /**
+ * Function returns a sub-string between aPos1 and aPos2
+ * @param aText The buffer
+ * @param aText Start position
+ * @param aText End position
+ * @return The pointer to the substring
+ */
+ static TPtrC SubStr(const TDesC& aText, TInt aPos1, TInt aPos2);
+ /**
+ * Function performs string copy with length checking.
+ * @param aTarget Target buffer
+ * @param aSource Source buffer
+ * @return none
+ */
+ static void StrCopy(TDes& aTarget, const TDesC& aSource);
+
+private:
+ /**
+ * Returns a string
+ * @return A pointer to a string
+ */
+ TPtrC Str() const;
+ /**
+ * Trimmer function
+ * @return none
+ */
+ void TrimOriginal();
+ /**
+ * Function returns sub string between aPos1 and aPos2
+ * @param aPos1 Start position
+ * @param aPos2 End posiotion
+ * @return none
+ */
+ TPtrC SubStr(TInt pos1, TInt pos2);
+
+private:
+ TPtrC iOriginal;
+ TPtrC iText;
+ TPtrC iTag;
+ TPtrC iValue;
+ TInt iType;
+
+ TInt iSlash;
+ TInt iFirst;
+ TInt iLast;
+ };
+
+#endif
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/caputils.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,252 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CapUtil header file
+*
+*/
+
+
+// INCLUDES
+
+#ifndef _CAPUTILS_H_
+#define _CAPUTILS_H_
+
+#include "capability.h"
+
+class RFs;
+
+//
+// TMemoryInfo
+//
+NONSHARABLE_CLASS( TMemoryInfo )
+ {
+public:
+ TChar iDriveLetter;
+ TInt iDriveNum;
+ TBuf<16> iLocation;
+ TInt64 iFree;
+ TInt64 iUsed;
+ TBool iShared;
+ TInt64 iFileSize;
+ TInt64 iFolderSize;
+ TInt iFileNameSize;
+ TInt iFolderNameSize;
+ TBool iCaseSensitivity;
+ TUint iDriveStatus;
+ TInt iMemNr;
+ };
+
+//
+// CapUtil
+//
+NONSHARABLE_CLASS( CapUtil )
+ {
+public:
+ /**
+ * Gets default root path from pathinfo.
+ * @param aText
+ * @param aType
+ * @return none
+ */
+ static void GetDefaultRootPathL( RFs& aFs, TDes& aRootPath );
+
+ /**
+ * Gets memory type.
+ * @param aFs
+ * @param aMemoryType
+ * @param aDrive
+ * @return none
+ */
+ static void GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive );
+
+ /**
+ * Gets language
+ * @param aText
+ * @return none
+ */
+ static void GetLanguage( TDes& aText );
+
+ /**
+ * Gets SW version, SW version date and device model from SysUtil.
+ * @param aVersion SW version
+ * @param aDate SW date
+ * @param aModel Device model
+ * @return none
+ */
+ static void GetSWVersionL( TDes& aVersion, TDes& aDate, TDes& aModel );
+
+ /**
+ * Gets phone manufacturer from HAL. In case manufacturer is not known,
+ * empty value is used.
+ * @param aText Manufacturer
+ * @return none
+ */
+ static void GetManufacturer( TDes& aText );
+
+ /**
+ * Get memory information for one drive.
+ * @param aFs RFs handle
+ * @param aDriveNumber drive number
+ * @param aInfo Memory information
+ * @return none
+ */
+ static void GetMemoryInfoL( const RFs& aFs, const TInt aDriveNumber, TMemoryInfo& aInfo );
+
+ /**
+ * Initializes TMemoryInfo.
+ * @param aInfo TMemoryInfo to be initialized
+ * @return none
+ */
+ static void InitMemoryInfo( TMemoryInfo& aInfo );
+
+ /**
+ * Get language string for aId.
+ * @param aId Language id
+ * @param aText Language text
+ * @return none
+ */
+ static void GetLanguageString( TLanguage aId, TDes& aText );
+
+ /**
+ * Finds all files in aDir.
+ * @param aFs RFs handle
+ * @param aDir Directory
+ * @param aList List of files in directory
+ * @return none
+ */
+ static void GetFileListL( const RFs& aFs, const TDesC& aDir,
+ RArray<TFileName>& aList );
+
+
+ /**
+ * Gets operator name, country code, network ID
+ * @param aLongName
+ * @param aCountryCode
+ * @param aNetworkID
+ * @return none
+ */
+ static void GetOperatorNameL( TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID );
+
+ /**
+ * Creates a panic
+ * @param aReason Panic code
+ * @return none
+ */
+ static void Panic( TInt aReason );
+
+ /**
+ * String copy with lenght check.
+ * @param aTarget Target string
+ * @param aSource Source string
+ * @return none
+ */
+ static void StrCopy( TDes& aTarget, const TDesC& aSource );
+
+ /**
+ * Function converts ínteger to string.
+ * @param aText string
+ * @param aNum integer
+ * @return none
+ */
+ static void IntToStr( TDes& aText, TInt64 aNum );
+
+ /**
+ * Function converts string to integer. If string cannot be converted,
+ * error code is returned.
+ * @param aText string
+ * @param aNum integer
+ * @return error code
+ */
+ static TInt StrToInt( const TDesC& aText, TInt& aNum );
+
+ /**
+ * Function splits string (eg "name1, name2, name3") into substrings.
+ * @param aText string
+ * @param aSeparator separator character
+ * @param aArray substrings
+ * @return none
+ */
+ static void SplitL( const TDesC& aText, const TChar aSeparator,
+ RArray<TPtrC>& aArray );
+
+ /**
+ * Constructs capability date as string
+ * @param aText string
+ * @param aTime time object
+ * @return none
+ */
+ static void CapabilityDate( TDes& aText, const TTime aTime );
+
+ /**
+ * Function parses date string of the format "dd-mm-yy".
+ * @param aText string
+ * @return time object
+ */
+ static TTime ParseDateL( const TDesC& aText );
+
+ /**
+ * Function return TMonth presentation of integer
+ * @param aNum
+ * @return TMonth object
+ */
+ static TMonth Month( TInt aNum );
+
+ /**
+ * Function checks file extension.
+ * @param aFile File name
+ * @param aExt extension
+ * @return boolean
+ */
+ static TBool CheckFileType( const TDesC& aFile, const TDesC& aExt );
+ };
+
+//
+// TIdStack
+//
+NONSHARABLE_CLASS( TIdStack )
+ {
+public:
+
+ /**
+ * Push id to the stack
+ * @param aId Id number
+ * @return none
+ */
+ void Push( TInt aId );
+
+ /**
+ * Pop id from the stack
+ * @return id
+ */
+ TInt Pop();
+
+ /**
+ * Size of the stack
+ * @return size
+ */
+ TInt Size() const;
+
+ /**
+ * Reset the stack.
+ * @return none
+ */
+ void Reset();
+
+private:
+ TInt iPos;
+ TFixedArray<TInt, KNestingLimit> iArray;
+ };
+
+#endif // CapUtils.h
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/sconcsc.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConCSC header file
+*
+*/
+
+
+// INCLUDES
+
+#ifndef _SCONCSC_H_
+#define _SCONCSC_H_
+
+#include <e32base.h>
+
+class CCapInfo;
+
+//============================================================
+// Class CSConCSC declaration
+//============================================================
+class CSConCSC : public CBase
+{
+public:
+ static CSConCSC* NewL();
+ ~CSConCSC();
+
+public:
+ // Creates capability object and places it into aBuf.
+ // Returns system error code
+ virtual TInt CapabilityObject( CBufFlat& aBuf );
+
+private:
+ void CapabilityObjectL( CBufFlat& aBuf );
+
+ CSConCSC();
+ virtual void ConstructL();
+
+private: // data
+ CCapInfo* iCapInfo;
+
+};
+
+IMPORT_C CSConCSC* CreateCSConCSCL();
+typedef CSConCSC* (*TSConCreateCSConCSCFunc) ();
+
+
+#endif // SCONCSC
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/sconsyncservice.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConSyncService header file.
+*
+*/
+
+
+#ifndef _SCONSYNCSERVICE_H_
+#define _SCONSYNCSERVICE_H_
+
+#include <e32base.h>
+#include <apgcli.h> // RApaLsSession
+#include <SyncMLClientDS.h>
+
+
+class TApaAppInfo;
+class RApaLsSession;
+class CRepository;
+
+
+class TSConSolutionInfo
+ {
+ public:
+ TSConSolutionInfo():iTime(0){}
+ public:
+ TFileName iSolutionName;
+ TUint iUid;
+ TTime iTime;
+ };
+
+/**
+ * This class provides information about active sync solutions.
+ *
+ * @code
+ * CSConSyncService *syncService = CSConSyncService::NewLC();
+ * SConSolutionInfo solutionInfo;
+ * syncService->GetSolutionL( KSeconCalendarUid, solutionInfo );
+ * CleanupStack::PopAndDestroy( syncService );
+ * @endcode
+ *
+ * @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CSConSyncService ) : public CBase
+ {
+ public:
+ static CSConSyncService* NewLC();
+ ~CSConSyncService();
+
+ /**
+ * Populate SolutionInfo according to content type.
+ *
+ * @since S60 v5.0
+ * @param aSeconContentType Contenttype to be readed
+ * @param aSolutionInfo contains founded solution info,
+ * solution info is empty if not found
+ * @return none
+ */
+ void GetSolutionL( const TUint aSeconContentType, TSConSolutionInfo& aSolutionInfo );
+
+ private:
+
+ CSConSyncService();
+ void ConstructL();
+
+ // Return correct providerId according to content type.
+ TSmlDataProviderId ProviderId( const TUint32 aSeconContentType ) const;
+
+ // Parse time from text
+ TInt ParseTimestamp( TTime& aTime, const TDesC& aTimestamp ) const;
+
+ // Get application caption.
+ void GetApplicationCaptionL( TDes& aCaption, const TUid aAppUid );
+
+ // Search UID from installed applications, return app caption
+ void GetInstPackageCaptionL( TDes& aCaption, const TUid aPackageUid );
+
+ // Gets last used profile for selected provider
+ void GetLastUsedProfileNameL( TDes& aProfileName, TTime& aTime,
+ const TSmlDataProviderId& aDataProviderId );
+
+ // Gets last sync time for certain profile and provider.
+ void GetLastSyncTimeL( TTime& aTime, const TSmlProfileId aSyncProfileId,
+ const TSmlDataProviderId aDataProviderId );
+
+ // Gets provider task id from profile
+ void GetProviderTaskL( TSmlTaskId& aProviderTask,
+ RSyncMLDataSyncProfile& aSyncProfile,
+ const TSmlDataProviderId aDataProviderId ) const;
+
+ // Gets latest historyJob where task is correct.
+ const CSyncMLHistoryJob* LatestHistoryJob( RSyncMLHistoryLog& aHistoryLog,
+ TInt aTaskId ) const;
+
+ // Returns ETrue if task exists in HistoryJob.
+ TBool TaskExist( const CSyncMLHistoryJob* aHistoryJob, TInt aTaskId ) const;
+
+ private: // data
+ TBool iApaSessionConnected;
+ RApaLsSession iApaSession;
+ TBool iSyncSessionOpened;
+ RSyncMLSession iSyncSession;
+ CRepository* iRepository;
+ };
+
+#endif // _SCONSYNCSERVICE_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/sconversioninfo.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Handles version fetching
+*
+*/
+
+
+#ifndef SCONVERSIONINFO_H_
+#define SCONVERSIONINFO_H_
+
+#include <e32base.h>
+#include <sysversioninfo.h>
+#include <versioninfo.h>
+#include <etelmm.h>
+#include <sysutil.h>
+
+const TInt KSconSWVersionSize = 50;
+const TInt KSconDateSize = 16;
+const TInt KMaxLangSize = 5;
+
+NONSHARABLE_CLASS( CSconVersionInfo ) : public CBase
+{
+public:
+ CSconVersionInfo();
+ ~CSconVersionInfo();
+
+ static CSconVersionInfo* NewL();
+
+ /**
+ *
+ * @param aFs RFs session
+ * @return none.
+ */
+ void FetchInfoL( RFs& aFs );
+
+ /**
+ * Is all data ready.
+ * @return ETrue if FetchInfoL has been called succesfully.
+ */
+ TBool IsReady();
+
+ /**
+ * Get symbian version. FetchInfoL must be called first
+ * @param aSymbianVersion symbian version
+ * @return error code.
+ */
+ TInt GetSymbianVersion( SysVersionInfo::TSymbianOSVersion& aSymbianVersion );
+
+ /**
+ * Get S60 platform version. FetchInfoL must be called first
+ * @param aS60Version S60 platform version
+ * @return error code.
+ */
+ TInt GetS60Version( VersionInfo::TPlatformVersion& aS60Version );
+
+public: // data
+
+ /** Contains the manufacturer name. For example "Nokia". */
+ HBufC* iManufacturer;
+
+ /** Contains the phone model sales name. For example "N01". */
+ HBufC* iModel;
+
+ /** Contains the product code name. For example "RM-1". */
+ HBufC* iProduct;
+
+ /** Contains the product revision. For example "01". */
+ HBufC* iRevision;
+
+ TBuf< KSconDateSize > iDate;
+
+ HBufC* iSWVersion;
+
+ /** Phone serial number (IMEI or ESN), in character string format. */
+ HBufC* iSerialNumber;
+
+ TBuf<KMaxLangSize> iLanguage;
+
+ HBufC* iSysVersionInfo;
+
+ HBufC* iLangVersion;
+
+ HBufC* iLangSWVersion;
+
+ HBufC* iOPVersion;
+
+ TSize iScreenSize;
+
+ HBufC* iProductCode;
+
+ TInt iDesktopSyncError;
+ TInt iDesktopSync;
+
+private:
+ TBool iInfoFetched; // ETrue if FetchInfoL has been called succesfully.
+
+ TInt iSymbianVersionError;
+ SysVersionInfo::TSymbianOSVersion iSymbianVersion;
+
+ TInt iS60VersionError;
+ VersionInfo::TPlatformVersion iS60Version;
+
+};
+
+#endif /*SCONVERSIONINFO_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/inc/stringlist.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CStringList header file
+*
+*/
+
+
+#ifndef _STRINGLIST_H_
+#define _STRINGLIST_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <badesca.h> // for CDesCArrayFlat
+#include <f32file.h>
+
+//
+// CStringList is used for storing lines of text.
+//
+NONSHARABLE_CLASS( CStringList ) : public CBase
+{
+public:
+ /**
+ * Two-phase constructor. The created instance is placed to cleanup stack
+ * @param aFileName Default KNullDesC
+ * @return CStringList instance
+ */
+ static CStringList* NewLC();
+ /**
+ * Two-phase constructor.
+ * @param aFileName Default KNullDesC
+ * @return CStringList instance
+ */
+ static CStringList* NewL();
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CStringList();
+
+public:
+ /**
+ * Returns the count of lines
+ * @return The count
+ */
+ TInt Count() const;
+ /**
+ * Returns pointer to the string
+ * @param aIndex The position
+ * @return String pointer
+ */
+ TPtrC16 ReadPtr(TInt aIndex);
+ /**
+ * Copies a string / strings
+ * @param aSource Source buffer
+ * @param aStart A start position
+ * @param aStop A stop position
+ * @return none
+ */
+ void CopyL(CStringList* aSource, TInt aStart, TInt aStop);
+ /**
+ * Resets iLines
+ * @return none
+ */
+ void Reset();
+ /**
+ * Returns the mark
+ * @return Mark value
+ */
+ TInt Mark() const;
+ /**
+ * Sets mark
+ * @param aMark The mark value
+ * @return none
+ */
+ void SetMark(TInt aMark);
+ /**
+ * Read strings from file.
+ * @param aText The tag buffer
+ * @return none
+ */
+ void ReadFromFileL( RFs& aFs, const TDesC& aName );
+
+private:
+ /**
+ * Default constuctor
+ * @return none
+ */
+ CStringList();
+ /**
+ * Initializes member data
+ * @param aFileName The file name
+ * @return none
+ */
+ void ConstructL();
+ /**
+ * Creates a panic
+ * @param aPanic Panic code
+ * @return none
+ */
+ void Panic(TInt aPanic) const;
+ /**
+ * Copies the string
+ * @param aTarget Target string
+ * @param aSource Source string
+ * @return ETrue if successful
+ */
+ TBool StrCopy(TDes& aTarget, const TDesC& aSource) const;
+ /**
+ * Writes a string
+ * @param aText The string
+ * @return none
+ */
+ void WriteL(const TDesC& aText);
+ /**
+ * Internalizes from file
+ * @param aFileName The name of the file
+ * @return none
+ */
+ void InternalizeL( RFs& aFs, const TDesC& aFileName );
+
+private:
+ TInt iMark;
+ CDesCArrayFlat* iLines;
+};
+
+#endif
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/capinfo.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1031 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCapInfo implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <utf.h>
+#include <driveinfo.h>
+#include <pathinfo.h> // for PathInfo::SoundsPath
+#include <seconsdkcrkeys.h>
+#include "sconsyncservice.h"
+#include "capinfo.h"
+#include "caplist.h"
+#include "capparser.h"
+#include "caputils.h"
+#include "stringlist.h"
+#include "sconversioninfo.h"
+#include "debug.h"
+
+
+_LIT8( KLineFeed, "\r\n" );
+
+const TInt KDefaultArrayGranularity = 5;
+
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCapInfo::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CCapInfo* CCapInfo::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CCapInfo* self = new (ELeave) CCapInfo();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::~CCapInfo()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CCapInfo::~CCapInfo()
+ {
+ TRACE_FUNC_ENTRY;
+ iFsSession.Close();
+ delete iHeapBuf;
+ delete iCapList;
+ delete iSconInfo;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::CapabilityDocumentL(CBufFlat* aBuf)
+// Creates capability xml document end places it in aBuf
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::CapabilityDocumentL(CBufFlat* aBuf)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+
+ // set buffer where capability document is written
+ SetCapabilityBuf( aBuf );
+
+ WriteL( KXmlVersion );
+ WriteL( KComment1 );
+ WriteL( KDocType );
+ WriteL( KRootBegin );
+
+
+ //
+ // general
+ //
+ TRAP( err, GeneralInfoL() );
+ if ( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "GeneralInfoL failed : %d", err );
+ User::Leave( err );
+ }
+
+
+ //
+ // services
+ //
+ // Search service files first from C-drive, and then from Z
+ // Do not add same files twice.
+
+ RArray<TFileName> excludeList( KDefaultArrayGranularity );
+ CleanupClosePushL( excludeList );
+ RArray<TFileName> filesAdded( KDefaultArrayGranularity );
+ CleanupClosePushL( filesAdded );
+
+ //read service files from C Import folder
+ TRAP( err, ServiceInfoL( KCapabilityDirCImport, excludeList, filesAdded ) );
+ LOGGER_WRITE_1( "ServiceInfoL(KCapabilityDirCImport) returned : %d", err );
+ for ( TInt i=0; i<filesAdded.Count(); i++ )
+ {
+ excludeList.Append( filesAdded[i] );
+ }
+ filesAdded.Reset();
+
+ // read service files from C Capability folder
+ TRAP( err, ServiceInfoL( KCapabilityDirC, excludeList, filesAdded ) );
+ LOGGER_WRITE_1( "ServiceInfoL(KCapabilityDirC) returned : %d", err );
+ for ( TInt i=0; i<filesAdded.Count(); i++ )
+ {
+ excludeList.Append( filesAdded[i] );
+ }
+ filesAdded.Reset();
+
+ // read service files from Z Capability folder
+ TRAP( err, ServiceInfoL( KCapabilityDirZ, excludeList, filesAdded ) );
+ LOGGER_WRITE_1( "ServiceInfoL(KCapabilityDirZ) returned : %d", err );
+
+ CleanupStack::PopAndDestroy( &filesAdded );
+ CleanupStack::PopAndDestroy( &excludeList );
+
+
+ // this service does not come from file
+ TRAP( err, FolderServiceL() );
+ LOGGER_WRITE_1( "FolderServiceL() returned : %d", err );
+
+ TRAP( err, SyncSolutionsServiceL() );
+ LOGGER_WRITE_1( "SyncSolutionsServiceL() returned: %d", err );
+
+ WriteL( KRootEnd );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iFsSession.Connect() );
+
+ iHeapBuf = HBufC8::NewL( KMaxSize*2 );
+ iCapList = CCapList::NewL();
+ iIdStack.Reset();
+
+ iSconInfo = CSconVersionInfo::NewL();
+ TInt err(KErrNone);
+ TRAP(err, iSconInfo->FetchInfoL( iFsSession ));
+ LOGGER_WRITE_1("sconInfo->FetchInfoL() Leaved: %d", err);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::CCapInfo()
+// Constuctor
+// -----------------------------------------------------------------------------
+//
+CCapInfo::CCapInfo()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::CapList()
+// Returns caplist
+// -----------------------------------------------------------------------------
+//
+CCapList* CCapInfo::CapList()
+ {
+ TRACE_FUNC;
+ __ASSERT_DEBUG(iCapList, CapUtil::Panic(KErrGeneral));
+ return iCapList;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::SetCapabilityBuf( CBufFlat* aBuf )
+// Set capability buffer
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::SetCapabilityBuf( CBufFlat* aBuf )
+ {
+ TRACE_FUNC;
+ iCapabilityBuf=aBuf;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::GeneralInfoL()
+// Write general device capability information.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::GeneralInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+ TBuf<KBufSize> buf;
+ TBuf<KBufSize> longName;
+ TBuf<KBufSize> coutryCode;
+ TBuf<KBufSize> networkID;
+
+ WriteTagL(EGeneral, TXmlParser::EElementBegin);
+
+ if ( !iSconInfo->IsReady() )
+ {
+ LOGGER_WRITE("iSconInfo wasn't ready, call iSconInfo->FetchInfoL");
+ iSconInfo->FetchInfoL( iFsSession );
+ }
+
+ if ( iSconInfo->iManufacturer )
+ {
+ WriteValueL( EManufacturer, *iSconInfo->iManufacturer );
+ }
+
+ if ( iSconInfo->iProduct )
+ {
+ WriteValueL( EModel, *iSconInfo->iProduct );
+ }
+
+ // serial number
+ if ( iSconInfo->iSerialNumber )
+ {
+ WriteValueL( ESN, *iSconInfo->iSerialNumber );
+ }
+
+ // software version
+ if ( iSconInfo->iSWVersion )
+ {
+ WriteAttributeL( ESW, *iSconInfo->iSWVersion, iSconInfo->iDate );
+ }
+
+ // language
+ WriteValueL( ELanguage, iSconInfo->iLanguage );
+
+ // this must succeed - do not trap
+ MemoryInfoL();
+
+ // Operator
+ TRAP( err, CapUtil::GetOperatorNameL( longName, coutryCode, networkID ) );
+ LOGGER_WRITE_1( "CapUtil::GGetOperatorNameL returned : %d", err );
+ if( err == KErrNone )
+ {
+ LOGGER_WRITE_3( "CSConFsHandler::GetOperatorNameL longName = %S coutryCode = %S networkID = %S", &longName, &coutryCode, &networkID );
+ _LIT( KNetworkInfo, "NetworkInfo" );
+ _LIT( KCurrentNetwork, "CurrentNetwork=" );
+ _LIT( KCountryCode, "CountryCode=" );
+ _LIT( KNetworkID, "NetworkID=" );
+
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ WriteValueL( EXNam, KNetworkInfo );
+
+ // write CurrentNetwork
+ buf.Copy( KCurrentNetwork );
+ buf.Append( longName );
+ WriteValueL( EXVal, buf );
+
+ // write CountryCode
+ buf.Copy( KCountryCode );
+ buf.Append( coutryCode );
+ WriteValueL( EXVal, buf );
+
+ // write NetworkID
+ buf.Copy( KNetworkID );
+ buf.Append( networkID );
+ WriteValueL( EXVal, buf );
+
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ }
+
+ if ( iSconInfo->iModel )
+ {
+ // print modelname (phone model sales name. For example "N01".)
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ _LIT(KModelName, "ModelName");
+ WriteValueL( EXNam, KModelName );
+ WriteValueL( EXVal, *iSconInfo->iModel );
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ }
+
+ if ( iSconInfo->iProductCode )
+ {
+ // print productcode
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ _LIT( KProductCode, "ProductCode" );
+ WriteValueL( EXNam, KProductCode );
+ WriteValueL( EXVal, *iSconInfo->iProductCode );
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ }
+
+
+ // print advanced info
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ _LIT(KAdvancedDeviceInfo, "AdvancedDeviceInfo");
+ WriteValueL( EXNam, KAdvancedDeviceInfo );
+
+ TBuf<KSysVersionInfoTextLength> temp;
+
+ if ( iSconInfo->iRevision )
+ {
+ // product revision. For example "01"
+ _LIT( KRevision, "Revision=" );
+ temp.Copy( KRevision );
+ temp.Append( *iSconInfo->iRevision );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+
+ if ( iSconInfo->iSysVersionInfo )
+ {
+ _LIT( KFWVersion, "FWVersion=" );
+ temp.Copy( KFWVersion );
+ temp.Append( *iSconInfo->iSysVersionInfo );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+ SysVersionInfo::TSymbianOSVersion osVersion;
+ err = iSconInfo->GetSymbianVersion( osVersion );
+ LOGGER_WRITE_1("TSymbianOSVersion info error: %d", err)
+ if ( !err )
+ {
+ // Now osVersion contains the Symbian OS version information
+ _LIT( KSymbianOSVersion, "SymbianOSVersion=%d.%d" );
+ temp.Format( KSymbianOSVersion,
+ osVersion.iMajorVersion,
+ osVersion.iMinorVersion );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+
+ WriteValueL( EXVal, temp );
+ }
+
+ VersionInfo::TPlatformVersion platformVersion;
+ err = iSconInfo->GetS60Version( platformVersion );
+ if ( !err )
+ {
+ _LIT( KS60Version, "S60PlatformVersion=%d.%d" );
+ temp.Format( KS60Version,
+ platformVersion.iMajorVersion,
+ platformVersion.iMinorVersion );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+
+ if ( iSconInfo->iLangVersion )
+ {
+ _LIT( KLangVersion, "LangVersion=" );
+ temp.Copy( KLangVersion );
+ temp.Append( *iSconInfo->iLangVersion );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+ if ( iSconInfo->iLangSWVersion )
+ {
+ _LIT( KLangSWVersion, "LangSWVersion=" );
+ temp.Copy( KLangSWVersion );
+ temp.Append( *iSconInfo->iLangSWVersion );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+ if ( iSconInfo->iOPVersion )
+ {
+ // CustomerVersion
+ _LIT( KOPVersion, "OPVersion=" );
+ temp.Copy( KOPVersion );
+ temp.Append( *iSconInfo->iOPVersion );
+ LOGGER_WRITE_1( "CCapInfo::GeneralInfoL() : %S ", &temp );
+ WriteValueL( EXVal, temp );
+ }
+
+ // screen size
+ LOGGER_WRITE_2("Size, width: %d, height: %d",
+ iSconInfo->iScreenSize.iWidth,
+ iSconInfo->iScreenSize.iHeight );
+ _LIT( KWidth, "ScreenWidth=%d" );
+ _LIT( KHeight, "ScreenHeight=%d" );
+
+ temp.Format( KWidth, iSconInfo->iScreenSize.iWidth );
+ WriteValueL( EXVal, temp );
+
+ temp.Format( KHeight, iSconInfo->iScreenSize.iHeight );
+ WriteValueL( EXVal, temp );
+
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ // end of advanced info
+
+ WriteTagL(EGeneral, TXmlParser::EElementEnd);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::MemoryInfoL()
+// Create memory info for all drives (RAM excluded).
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::MemoryInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ TMemoryInfo info;
+ TInt devDriveCount = 0;
+ TInt mmcDriveCount = 0;
+
+ //Write all drivers to folderlisting object
+ TDriveList driveList;
+ // Get all drives that are visible to the user.
+ TInt driveCount;
+ User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFsSession, driveList, driveCount ) );
+
+ for( TInt i = EDriveA; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ TInt err = DriveInfo::GetDriveStatus( iFsSession, i, driveStatus );
+ if( err )
+ {
+ LOGGER_WRITE_1( "CCapInfo::MemoryInfoL() : DriveInfo::GetDriveStatus: %d", i);
+ continue;
+ }
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt
+ || (driveStatus & DriveInfo::EDriveRemote) )
+ {
+ LOGGER_WRITE_1( "skip drive %d", i);
+ continue;
+ }
+
+ TRAP( err, CapUtil::GetMemoryInfoL( iFsSession, i, info ));
+ if ( err )
+ {
+ LOGGER_WRITE_1( "CapUtil::GetMemoryInfoL() : Leaved with: %d", err);
+ continue;
+ }
+
+ info.iDriveStatus = driveStatus;
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ // if internal (DEV) drive, save drive number
+ devDriveCount++;
+ info.iMemNr = devDriveCount;
+ }
+ else if ( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ // if removable (MMC) drive, save drive number
+ mmcDriveCount++;
+ info.iMemNr = mmcDriveCount;
+ }
+ else
+ {
+ // was not internal or removable, skip.
+ LOGGER_WRITE( "CCapInfo::MemoryInfoL() : not internal or removable, skip." );
+ continue;
+ }
+
+ WriteMemoryInfoL(info);
+
+ }
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::MemoryInfoL(TMemoryInfo& aInfo)
+// Create memory info for all drives (RAM excluded).
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteMemoryInfoL(TMemoryInfo& aInfo)
+ {
+ TRACE_FUNC_ENTRY;
+ TBuf<KBufSize> buf;
+
+ WriteTagL(EMemory, TXmlParser::EElementBegin);
+
+ if( aInfo.iDriveStatus & DriveInfo::EDriveInternal )
+ {
+ buf = KMediaFlash;
+ }
+ else
+ {
+ buf = KMediaMMC; // memory card (MMC)
+ }
+
+ if( aInfo.iMemNr > 1 )
+ {
+ // append memory number DEV2, MMC2..
+ buf.AppendNum( aInfo.iMemNr );
+ }
+
+ WriteValueL(EMemType, buf);
+ WriteValueL(ELocation, aInfo.iLocation);
+ WriteValueL(EFree, aInfo.iFree);
+ WriteValueL(EUsed, aInfo.iUsed);
+
+ WriteValueL(EFileNLen, aInfo.iFileNameSize);
+
+ WriteTagL(EMemory, TXmlParser::EElementEnd);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::ServiceInfoL(const TDesC& aDir)
+// Reads service xml-files from directory and writes them into capability
+// document.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::ServiceInfoL(const TDesC& aDir, const RArray<TFileName>& aExcludeList,
+ RArray<TFileName>& aFilesAdded)
+ {
+ TRACE_FUNC_ENTRY;
+ CCapList* capList=CapList();
+
+ RArray<TFileName> array( KDefaultArrayGranularity );
+ CleanupClosePushL(array);
+
+ CStringList* stringList=CStringList::NewLC();
+
+ CapUtil::GetFileListL(iFsSession, aDir, array);
+
+ _LIT(KFormat, "%S%S");
+ TFileName name;
+ TInt count=array.Count();
+ for (TInt i=0; i<count; i++)
+ {
+ TBool exludeFromList(EFalse);
+
+ // Check if file is already added to list
+ for ( TInt j=0; j<aExcludeList.Count() && !exludeFromList; j++ )
+ {
+ if ( array[i].CompareF(aExcludeList[j]) == 0 )
+ {
+ LOGGER_WRITE_1( "match found at pos %d", j);
+ exludeFromList = ETrue;
+ }
+ }
+
+ if ( !exludeFromList )
+ {
+ name.Format(KFormat, &aDir, &array[i]);
+ if (!CapUtil::CheckFileType(name, KXmlExtension))
+ {
+ continue; // only accept .xml files
+ }
+
+ capList->List()->Reset();
+ capList->List()->ReadFromFileL( iFsSession, name );
+ if (capList->FindServiceL(stringList))
+ {
+ WriteNewLineL();
+ WriteFromListL(stringList);
+
+ User::LeaveIfError( aFilesAdded.Append(array[i]) );
+ LOGGER_WRITE_1( "File '%S' added to list", &array[i] );
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy(stringList);
+ CleanupStack::PopAndDestroy(&array);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::FolderServiceL()
+// Writes folder service. Notice that this service is created in code because
+// pathinfo component is used to get folder names.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::FolderServiceL()
+ {
+ TRACE_FUNC_ENTRY;
+ TBuf<KBufSize> rootPath;
+ TBuf<KBufSize> memoryType(KNullDesC);
+ TFileName folderName;
+ _LIT( KFormat, "%S%S" );
+
+ WriteNewLineL();
+ WriteTagL(EService, TXmlParser::EElementBegin);
+
+ WriteValueL(EName, KFolderServiceName);
+ WriteValueL(EUUID, KFolderServiceUid);
+ WriteValueL(EVersion, KFolderServiceVersion);
+
+ WriteTagL(EObject, TXmlParser::EElementBegin);
+ WriteValueL(EType, KFolderServiceType);
+ WriteTagL(EObject, TXmlParser::EElementEnd);
+ TInt drive;
+ TInt err;
+
+ CapUtil::GetDefaultRootPathL( iFsSession, rootPath );
+ if( rootPath.Length() > 0 )
+ {
+ err = iFsSession.CharToDrive( rootPath[0], drive );
+ if( err == KErrNone )
+ {
+ CapUtil::GetMemoryType( iFsSession, memoryType, drive );
+ }
+ }
+
+ // EFolderImages
+ folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() );
+ WriteFolderL( KFolderImages, folderName, memoryType );
+
+ // EFolderGraphics
+ folderName.Format( KFormat, &rootPath, &PathInfo::ImagesPath() );
+ WriteFolderL(KFolderGraphics, folderName, memoryType);
+
+ // EFolderTones
+ folderName.Format( KFormat, &rootPath, &PathInfo::DigitalSoundsPath() );
+ WriteFolderL(KFolderTones, folderName, memoryType);
+
+ // EFolderMusic
+ folderName.Format( KFormat, &rootPath, &PathInfo::SoundsPath() );
+ WriteFolderL(KFolderMusic, folderName, memoryType);
+
+ // EFolderVideos
+ folderName.Format( KFormat, &rootPath, &PathInfo::VideosPath() );
+ WriteFolderL(KFolderVideos, folderName, memoryType);
+
+ // EFolderInstalls
+ folderName.Format( KFormat, &rootPath, &PathInfo::InstallsPath() );
+ WriteFolderL(KFolderInstalls, folderName, memoryType);
+
+
+ WriteTagL(EService, TXmlParser::EElementEnd);
+ WriteNewLineL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::SyncSolutionsServiceL()
+// Reads last used syncSolutions from cenrep and writes to capability object
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::SyncSolutionsServiceL()
+ {
+ TRACE_FUNC_ENTRY;
+ TSConSolutionInfo calendar;
+ TSConSolutionInfo contact;
+ TSConSolutionInfo sms;
+ TSConSolutionInfo bookmark;
+
+ CSConSyncService *syncService = CSConSyncService::NewLC();
+ syncService->GetSolutionL( KSeconCalendarUid, calendar );
+ syncService->GetSolutionL( KSeconContactsUid, contact );
+ syncService->GetSolutionL( KSeconSmsUid, sms );
+ syncService->GetSolutionL( KSeconBookmarkUid, bookmark );
+ CleanupStack::PopAndDestroy( syncService );
+
+ WriteSyncSolutionsServiceL( calendar, contact, sms, bookmark );
+
+ TRACE_FUNC_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteSyncSolutionsServiceL()
+// Writes SyncSolutionsService data to capability object.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteSyncSolutionsServiceL( const TSConSolutionInfo& aCalendar,
+ const TSConSolutionInfo& aContact,
+ const TSConSolutionInfo& aSms,
+ const TSConSolutionInfo& aBookmark)
+ {
+ TRACE_FUNC_ENTRY;
+
+ WriteTagL( EService, TXmlParser::EElementBegin );
+
+ WriteValueL( EName, KSyncSolutionsServiceName );
+ WriteValueL( EVersion, KSyncSolutionsServiceVersion );
+
+ if ( aCalendar.iUid != 0 )
+ {
+ WriteSolutionTagL( KSyncCalendar, aCalendar );
+ }
+
+ if ( aContact.iUid != 0 )
+ {
+ WriteSolutionTagL( KSyncContacts, aContact );
+ }
+
+ if ( aSms.iUid != 0 )
+ {
+ WriteSolutionTagL( KSyncSms, aSms );
+ }
+
+ if ( aBookmark.iUid != 0 )
+ {
+ WriteSolutionTagL( KSyncBookmark, aBookmark );
+ }
+
+ /*
+ * <Ext>
+ * <XNam>DesktopSync</XNam>
+ * <XVal></XVal>
+ * </Ext>
+ *
+ */
+ if ( !iSconInfo->iDesktopSyncError )
+ {
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ WriteValueL( EXNam, KDesktopSync );
+
+ TBuf<KBufSize> buffer;
+ buffer.AppendNum( iSconInfo->iDesktopSync );
+
+ WriteValueL( EXVal, buffer );
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ }
+
+
+
+ WriteTagL( EService, TXmlParser::EElementEnd );
+ TRACE_FUNC_EXIT;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteSolutionTagL()
+// Writes SyncSolutionsService solution data to capability object.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteSolutionTagL( const TDesC& aContentName,
+ const TSConSolutionInfo& aSolution )
+ {
+ TRACE_FUNC_ENTRY;
+ _LIT( KFormatUID, "UID=0x%08x" );
+ _LIT( KFormatName, "Name=%S" );
+ _LIT( KFormatDate, "Timestamp=%04d%02d%02dT%02d%02d%02dZ" );
+
+ WriteTagL( EExt, TXmlParser::EElementBegin );
+ WriteValueL( EXNam, aContentName );
+
+ TFileName temp;
+ temp.Format( KFormatUID, aSolution.iUid );
+ WriteValueL( EXVal, temp );
+
+ temp.Format( KFormatName, &aSolution.iSolutionName );
+ WriteValueL( EXVal, temp );
+
+ if ( aSolution.iTime.Int64() != 0 )
+ {
+ // write time
+ TDateTime time = aSolution.iTime.DateTime();
+ temp.Format( KFormatDate, time.Year(), time.Month() + 1,
+ time.Day() + 1, time.Hour(), time.Minute(), time.Second() );
+ WriteValueL( EXVal, temp );
+
+ }
+
+
+ WriteTagL( EExt, TXmlParser::EElementEnd );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteFolderL(const TDesC& aType, const TDesC& aFullName,
+// const TDesC& aMemory)
+// Writes one folder name element.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteFolderL(const TDesC& aType, const TDesC& aFullName,
+ const TDesC& aMemory)
+ {
+ TRACE_FUNC_ENTRY;
+ _LIT(KFormat, "%S=%S");
+
+ TBuf<KBufSize> buf;
+ const TInt KReservedSize = 10;
+ if ( aFullName.Length() + KReservedSize > KBufSize )
+ {
+ return;
+ }
+ buf.Format(KFormat, &KFolderNameTag, &aFullName);
+
+
+ WriteTagL(EExt, TXmlParser::EElementBegin);
+
+ WriteValueL(EXNam, aType);
+ WriteValueL(EXVal, buf);
+
+ buf.Format(KFormat, &KFolderMemoryTypeTag, &aMemory);
+ WriteValueL(EXVal, buf);
+
+
+ WriteTagL(EExt, TXmlParser::EElementEnd);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteL(const TDesC& aText)
+// Writes one element to capability buffer.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteL(const TDesC& aText)
+ {
+ if (aText.Length() > iBuf.MaxLength())
+ {
+ User::Leave(KErrTooBig);
+ }
+
+
+ iBuf=aText;
+ iBuf.Trim();
+ FormatElement(iBuf);
+ TPtr8 ptr = iHeapBuf->Des();
+
+ if ( iBuf.Length()+2 > ptr.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+
+ //unicode conversion
+ HBufC8* convBuf = HBufC8::NewLC( iBuf.Size() );
+ TPtr8 convPtr = convBuf->Des();
+
+ CnvUtfConverter::ConvertFromUnicodeToUtf8(convPtr, iBuf);
+
+ ptr.Copy(convPtr);
+ ptr.Append( KLineFeed ); // linefeed
+
+ CleanupStack::PopAndDestroy( convBuf );
+
+ TInt pos=iCapabilityBuf->Size();
+ iCapabilityBuf->InsertL(pos, ptr);
+
+ iBuf=KNullDesC;
+ }
+
+void CCapInfo::WriteNewLineL()
+ {
+ TInt pos=iCapabilityBuf->Size();
+ iCapabilityBuf->InsertL(pos, KLineFeed );
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteValueL(TInt aId, const TDesC& aValue)
+// Constructs element with value (eg <Language>en</Language>)
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteValueL(TInt aId, const TDesC& aValue)
+ {
+ // empty values not written to capability object
+ if (aValue.Length()<1)
+ {
+ LOGGER_WRITE( "WriteValueL: value is empty" );
+ return;
+ }
+
+ TBuf<KBufSize> buf;
+
+ TRAPD(err, CapParser::MakeElementL(buf, aId, aValue));
+ if (err==KErrNone)
+ {
+ WriteL(buf);
+ }
+ else if (err==KErrTooBig)
+ {
+ WriteBigValueL(aId, aValue);
+ }
+ else
+ {
+ User::Leave(err);
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteBigValueL(TInt aId, const TDesC& aValue)
+// Constructs element with value
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteBigValueL(TInt aId, const TDesC& aValue)
+ {
+ HBufC* hBuf=HBufC::NewL(aValue.Length()+KBufSize);
+ CleanupStack::PushL(hBuf);
+
+ TPtr pBuf(hBuf->Des());
+ CapParser::MakeElementL(pBuf, aId, aValue);
+ WriteL(*hBuf);
+
+ CleanupStack::PopAndDestroy(hBuf);
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteValueL(TInt aId, TInt64 aValue)
+// Constructs element with integer value
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteValueL(TInt aId, TInt64 aValue)
+ {
+ TBuf<KBufSize> buf;
+ TBuf<KTagSize> value;
+ CapUtil::IntToStr(value, aValue);
+ CapParser::MakeElementL(buf, aId, value);
+ WriteL(buf);
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteTagL(TInt aId, TInt aType)
+// Constructs element without value (eg <Memory>)
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteTagL(TInt aId, TInt aType)
+ {
+ TBuf<KBufSize> buf;
+ CapParser::MakeElementL(buf, aId, aType);
+ WriteL(buf);
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteAttributeL(TInt aId, const TDesC& aVersion, const TDesC& aDate)
+// Constructs element with attributes "Version" and "Date"
+// (eg <HW Version="1.5"/>)
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteAttributeL(TInt aId, const TDesC& aVersion,
+ const TDesC& aDate)
+ {
+ // empty values not written to capability object
+ if (aVersion.Length()<1 && aDate.Length()<1)
+ {
+ LOGGER_WRITE( "WriteAttributeL: attributes are empty" );
+ return;
+ }
+
+ TBuf<KBufSize> buf;
+ CapParser::MakeElementL(buf, aId, aVersion, aDate);
+ WriteL(buf);
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::WriteFromListL(CStringList* aList)
+// Writes elements from list to capability buffer.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::WriteFromListL(CStringList* aList)
+ {
+ TInt count=aList->Count();
+
+ for (TInt i=0; i<count; i++)
+ {
+ WriteL(aList->ReadPtr(i));
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::FormatElement(TDes& aText)
+// Function adds indentation spaces to capability elements to improve
+// readability.
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::FormatElement(TDes& aText)
+ {
+ TXmlParser parser;
+
+ parser.Set(aText);
+ TInt type=parser.Type();
+ TBuf<KTagSize> tag;
+ parser.GetTag(tag);
+
+ if (type==TXmlParser::EElementEnd)
+ {
+ TInt id1=CapParser::ElementId(tag);
+ TInt id2=iIdStack.Pop();
+
+ __ASSERT_DEBUG(id1==id2, CapUtil::Panic(KErrGeneral));
+ id1=0;
+ id2=0;
+ }
+
+ AddFormatText(aText, iIdStack.Size());
+
+ if (type==TXmlParser::EElementBegin)
+ {
+ TInt id1=CapParser::ElementId(tag);
+ iIdStack.Push(id1);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CCapInfo::AddFormatText( TDes& aText, TInt aNum ) const
+// Adds format text
+// -----------------------------------------------------------------------------
+//
+void CCapInfo::AddFormatText( TDes& aText, TInt aNum ) const
+ {
+ TBuf<KBufSize> buf;
+ buf = KNullDesC;
+
+ if ( aNum > KNestingLimit )
+ {
+ aNum = KNestingLimit;
+ }
+
+ for ( TInt i=0; i<aNum; i++ )
+ {
+ buf.Append( KFormatText );
+ }
+ if ( aText.MaxLength()-aText.Length()>buf.Length() )
+ {
+ aText.Insert( 0, buf );
+ }
+ }
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/caplist.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CCapList implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "caplist.h"
+#include "caputils.h"
+#include "capparser.h"
+#include "capability.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCapList::NewL()
+// Two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CCapList* CCapList::NewL()
+ {
+ CCapList* self = new(ELeave) CCapList();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::~CCapList()
+// Gets phone serial number from etel.
+// -----------------------------------------------------------------------------
+//
+CCapList::~CCapList()
+ {
+ delete iList;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::CCapList()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CCapList::CCapList()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::ConstructL()
+// Initializes the member data
+// -----------------------------------------------------------------------------
+//
+void CCapList::ConstructL()
+ {
+ iList = CStringList::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::List()
+// Returns the list
+// -----------------------------------------------------------------------------
+//
+CStringList* CCapList::List()
+ {
+ __ASSERT_DEBUG(iList, CapUtil::Panic(KErrGeneral));
+ return iList;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::FindFromMark(TInt aId, TInt aType)
+// Find from mark
+// -----------------------------------------------------------------------------
+//
+TInt CCapList::FindFromMark(TInt aId, TInt aType)
+ {
+ TInt mark = List()->Mark();
+ TInt count= List()->Count();
+
+ if ( mark >= count )
+ {
+ return KErrNotFound;
+ }
+
+ TInt index=Find(aId, aType, mark);
+ if ( index == KErrNotFound )
+ {
+ return KErrNotFound;
+ }
+
+
+ __ASSERT_DEBUG(index>=mark, CapUtil::Panic(KErrGeneral));
+
+ List()->SetMark(index+1);
+ return index;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::FindServiceHeader()
+// Finds service xml-file identification header. This header must be the first
+// line in every service file.
+// -----------------------------------------------------------------------------
+//
+TBool CCapList::FindServiceHeader()
+ {
+ TRACE_FUNC_ENTRY;
+ if (List()->Count()<1)
+ {
+ LOGGER_WRITE( "CCapList::FindServiceHeader() : returned EFalse" );
+ return EFalse;
+ }
+
+ TBuf<KBufSize> buf;
+ TPtrC ptr=List()->ReadPtr(0);
+ CapUtil::StrCopy(buf, ptr);
+ buf.Trim();
+ if (buf.Compare(KServiceHeader)==0)
+ {
+ LOGGER_WRITE( "CCapList::FindServiceHeader() : returned ETrue" );
+ return ETrue;
+ }
+ else
+ {
+ LOGGER_WRITE( "CCapList::FindServiceHeader() : returned EFalse" );
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::FindServiceL(CStringList* aList)
+// Find service
+// -----------------------------------------------------------------------------
+//
+TBool CCapList::FindServiceL(CStringList* aList)
+ {
+ TRACE_FUNC_ENTRY;
+ aList->Reset();
+ List()->SetMark(0);
+
+ if (!FindServiceHeader())
+ {
+ LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned EFalse" );
+ return EFalse;
+ }
+
+
+ for (;;)
+ {
+ TInt start=FindFromMark(EService, TXmlParser::EElementBegin);
+ TInt stop=FindFromMark(EService, TXmlParser::EElementEnd);
+
+ if (start==KErrNotFound || stop==KErrNotFound || start>=stop)
+ {
+ break;
+ }
+
+ aList->CopyL(List(), start, stop);
+ }
+
+ if (aList->Count()>0)
+ {
+ LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned ETrue" );
+ return ETrue;
+ }
+
+ LOGGER_WRITE( "CCapList::FindServiceL(CStringList* aList) : returned EFalse" );
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CCapList::Find(TInt aId, TInt aType, TInt aIndex)
+// Find element
+// -----------------------------------------------------------------------------
+//
+TInt CCapList::Find(TInt aId, TInt aType, TInt aIndex)
+ {
+ TInt count=List()->Count();
+ if (aIndex<0 || aIndex>=count)
+ {
+ CapUtil::Panic(KErrArgument);
+ }
+
+ for (TInt i=aIndex; i<count; i++)
+ {
+ TPtrC ptr=List()->ReadPtr(i);
+
+ TInt id=0;
+ TInt type=0;
+
+ CapParser::ParseElement(ptr, id, type);
+ if (type==TXmlParser::EElementUnknown)
+ {
+ continue; // invalid capability element
+ }
+
+ if (id==aId && aType==type)
+ {
+ return i;
+ }
+ }
+ return KErrNotFound;
+ }
+
+
+// End of files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/capparser.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,766 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CapParser implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "capparser.h"
+#include "caputils.h"
+
+const char KFind1 = '&';
+const char KFind2 = '<';
+const char KFind3 = '>';
+const char KFind4 = '"';
+const char KFind5 = '\'';
+
+_LIT( KReplace1, "&" );
+_LIT( KReplace2, "<" );
+_LIT( KReplace3, ">" );
+_LIT( KReplace4, """ );
+_LIT( KReplace5, "'" );
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CapParser::GetTagL(TDes& aText, TInt aId)
+// Returns capability element tag (eg. "Memory")
+// -----------------------------------------------------------------------------
+//
+void CapParser::GetTagL(TDes& aText, TInt aId)
+ {
+ aText=KNullDesC;
+
+ TInt count=NUMXMLTOKENS;
+ for (TInt i=0; i<count; i++)
+ {
+ TXmlToken t=KXmlTokens[i];
+ if (t.id==aId)
+ {
+ aText=t.tag;
+ return;
+ }
+ }
+ User::Leave(KErrNotFound);
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::ElementId(const TDesC& aText)
+// Returns capability element id (eg. EMemory).
+// -----------------------------------------------------------------------------
+//
+TInt CapParser::ElementId(const TDesC& aText)
+ {
+ TBuf<KTagSize>buf;
+ TInt count=NUMXMLTOKENS;
+ for (TInt i=0; i<count; i++)
+ {
+ TXmlToken t=KXmlTokens[i];
+ buf=t.tag;
+ if (buf.Compare(aText)==0)
+ {
+ return t.id;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::ParseElement(const TDesC& aText, TInt& aId, TInt& aType)
+// Parses element's id and type (eg. "<Memory>" -> EMemory, EElementBegin)
+// -----------------------------------------------------------------------------
+//
+void CapParser::ParseElement(const TDesC& aText, TInt& aId, TInt& aType)
+ {
+ TXmlParser parse;
+ aId=KErrNotFound;
+
+ parse.Set(aText);
+ aType=parse.Type();
+ if (aType==TXmlParser::EElementUnknown)
+ {
+ return;
+ }
+
+ TPtrC ptr=parse.Tag();
+ aId=ElementId(ptr);
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aValue)
+// Constructs element with value (eg. "<Free>23456</Free>").
+// -----------------------------------------------------------------------------
+//
+void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aValue)
+ {
+ aText=KNullDesC;
+ ReplaceSpecialCharsL( aText, aValue );
+
+ TBuf<KTagSize> buf;
+ MakeElementL( buf, aId, TXmlParser::EElementBegin );
+
+ TInt len = aText.Length() + buf.Length() + buf.Length() + 1;
+ if ( len > aText.MaxLength())
+ {
+ User::Leave(KErrTooBig);
+ }
+
+ aText.Insert( 0, buf );
+ MakeElementL( buf, aId, TXmlParser::EElementEnd );
+ aText.Append( buf );
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType)
+// Constructs element without value (eg. "<Memory>" or "</Memory>").
+// -----------------------------------------------------------------------------
+//
+void CapParser::MakeElementL(TDes& aText, TInt aId, TInt aType)
+ {
+ _LIT(KFormat1, "<%S>");
+ _LIT(KFormat2, "</%S>");
+ _LIT(KFormat3, "<%S/>");
+
+ aText=KNullDesC;
+ TBuf<KTagSize> buf;
+ GetTagL(buf, aId);
+
+ switch(aType)
+ {
+ case TXmlParser::EElementBegin:
+ aText.Format(KFormat1, &buf);
+ break;
+ case TXmlParser::EElementEnd:
+ aText.Format(KFormat2, &buf);
+ break;
+ case TXmlParser::EElementEmpty:
+ aText.Format(KFormat3, &buf);
+ break;
+ default:
+ CapUtil::Panic(KErrArgument);
+ break;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
+// const TDesC& aDate)
+// Constructs element with attributes "Version" and "Date"(eg.
+// "<FW Version="2.2"/>").
+// -----------------------------------------------------------------------------
+//
+void CapParser::MakeElementL(TDes& aText, TInt aId, const TDesC& aVersion,
+ const TDesC& aDate)
+ {
+ _LIT(KFormat1, "<%S %S=\"%S\" %S=\"%S\"/>");
+ _LIT(KFormat2, "<%S %S=\"%S\"/>");
+
+ aText=KNullDesC;
+
+ TBuf<KTagSize> element;
+ TBuf<KTagSize> versionTag;
+ TBuf<KTagSize> dateTag;
+
+ GetTagL(element, aId);
+ GetTagL(versionTag, EAttVersion);
+ GetTagL(dateTag, EAttDate);
+
+ if (aDate.Length()>0)
+ {
+ aText.Format(KFormat1, &element, &versionTag, &aVersion, &dateTag,
+ &aDate);
+ }
+ else
+ {
+ aText.Format(KFormat2, &element, &versionTag, &aVersion);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CapParser::ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue )
+// Replaces special characters to xml compliant.
+// -----------------------------------------------------------------------------
+//
+void CapParser::ReplaceSpecialCharsL( TDes& aText, const TDesC& aValue )
+ {
+ if ( aValue.Length() > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Copy( aValue );
+
+ //Replace special characters
+ for( TInt i = 0; i < aText.Length(); i++ )
+ {
+ switch( aText[i] )
+ {
+ case KFind1:
+ if ( aText.Length()+KReplace1().Length()-1 > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Replace( i, 1, KReplace1 );
+ i+=KReplace1().Length()-1;
+ break;
+ case KFind2:
+ if ( aText.Length()+KReplace2().Length()-1 > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Replace( i, 1, KReplace2 );
+ i+=KReplace2().Length()-1;
+ break;
+ case KFind3:
+ if ( aText.Length()+KReplace3().Length()-1 > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Replace( i, 1, KReplace3 );
+ i+=KReplace3().Length()-1;
+ break;
+ case KFind4:
+ if ( aText.Length()+KReplace4().Length()-1 > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Replace( i, 1, KReplace4 );
+ i+=KReplace4().Length()-1;
+ break;
+ case KFind5:
+ if ( aText.Length()+KReplace5().Length()-1 > aText.MaxLength() )
+ {
+ User::Leave(KErrTooBig);
+ }
+ aText.Replace( i, 1, KReplace5 );
+ i+=KReplace5().Length()-1;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Set(const TDesC& aText)
+// Sets a tag
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::Set(const TDesC& aText)
+ {
+ iOriginal.Set(aText);
+ TrimOriginal();
+ Init();
+ Parse();
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Init()
+// Inits the parser
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::Init()
+ {
+ iType=EElementUnknown;
+ iTag.Set(KNullDesC);
+ iValue.Set(KNullDesC);
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::GetTag(TDes& aText) const
+// Gets the tag
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::GetTag(TDes& aText) const
+ {
+ StrCopy(aText, iTag);
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Tag() const
+// Returns a pointer to a tag
+// -----------------------------------------------------------------------------
+//
+TPtrC TXmlParser::Tag() const
+ {
+ return iTag;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Type() const
+// Returns type
+// -----------------------------------------------------------------------------
+//
+TInt TXmlParser::Type() const
+ {
+ return iType;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Parse()
+// Parses xml-element.
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::Parse()
+ {
+ iType=EElementUnknown;
+
+ // this must be the first check
+ if (ElementUnknown())
+ {
+ return;
+ }
+
+ if (ElementBegin())
+ {
+ return;
+ }
+
+ if (ElementEnd())
+ {
+ return;
+ }
+
+ if (ElementValue())
+ {
+ return;
+ }
+
+ if (ElementComment())
+ {
+ return;
+ }
+
+ if (ElementDocType())
+ {
+ return;
+ }
+
+ if (ElementVersion())
+ {
+ return;
+ }
+
+ if (ElementEmpty())
+ {
+ return;
+ }
+
+ if (ElementAtt())
+ {
+ return;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementUnknown()
+// Parses unknown elements
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementUnknown()
+ {
+ TPtrC str=Str();
+ TInt len=str.Length();
+ const TInt KXmlElementMinLength = 3;
+ if ( len < KXmlElementMinLength )
+ {
+ return ETrue; // too short to be xml element
+ }
+
+
+ iFirst=str.Locate('<');
+ iLast=str.LocateReverse('>');
+ iSlash=str.LocateReverse('/');
+
+ if (iFirst!=0 || iLast!=len-1)
+ {
+ return ETrue; // first char must be "<" and last ">"
+ }
+
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementBegin()
+// Parses beginning tag (eg. <General>)
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementBegin()
+ {
+ TPtrC str=Str();
+
+ if (iSlash!=KErrNotFound)
+ {
+ return EFalse;
+ }
+
+ // remove possible attributes
+ TInt pos=str.Locate(' ');
+ if (pos==KErrNotFound)
+ {
+ pos=iLast;
+ }
+
+ TPtrC ptr=SubStr(iFirst, pos);
+
+ if (!ValidTag(ptr))
+ {
+ return EFalse;
+ }
+
+ iType=EElementBegin;
+ iTag.Set(ptr);
+
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementEnd()
+// Parses ending tag (eg. </General>)
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementEnd()
+ {
+ if (iSlash!=iFirst+1)
+ {
+ return EFalse;
+ }
+
+ TPtrC ptr=SubStr(iSlash, iLast);
+ if (!ValidTag(ptr))
+ {
+ return EFalse;
+ }
+
+ iType=EElementEnd;
+ iTag.Set(ptr);
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementValue()
+// Parses value (eg. <Language>en</Language>)
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementValue()
+ {
+ TPtrC str=Str();
+
+ TInt pos1=str.Locate('>');
+ TInt pos2=str.LocateReverse('<');
+
+ if (pos1<pos2 && iSlash==pos2+1)
+ {
+ TPtrC ptr1=SubStr(iFirst, pos1);
+ TPtrC ptr2=SubStr(iSlash, iLast);
+ if (!ValidTag(ptr1) || ptr1.Compare(ptr2)!=0)
+ {
+ return EFalse;
+ }
+
+ iType=EElementValue;
+ iTag.Set(ptr1);
+ iValue.Set(SubStr(pos1, pos2));
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementEmpty()
+// Parses empty element (eg. <CaseSenN/>)
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementEmpty()
+ {
+ if (iSlash!=iLast-1)
+ {
+ return EFalse;
+ }
+
+ TPtrC ptr=SubStr(iFirst, iSlash);
+ if (!ValidTag(ptr))
+ {
+ return EFalse;
+ }
+
+ iType=EElementEmpty;
+ iTag.Set(ptr);
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementVersion()
+// Identifies version element ("<?xml version="1.0" ?>")
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementVersion()
+ {
+ TPtrC str=Str();
+
+ if ( str.Length()>=3 && str[1]=='?' && str[2]=='x')
+ {
+ iType=EElementVersion;
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementDocType()
+// Identifies document type element
+// ("<!DOCTYPE Capability SYSTEM "obex-capability.dtd">").
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementDocType()
+ {
+ TPtrC str=Str();
+ const TInt KElementMinLength = 10;
+ if ( str.Length() < KElementMinLength )
+ {
+ return EFalse;
+ }
+
+ if (str[1]=='!' && str[2]=='D' && str[3]=='O' && str[4]=='C')
+ {
+ iType=EElementDocType;
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementComment()
+// Identifies comment element ("<!-- OBEX Capability Object -->").
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementComment()
+ {
+ TPtrC str=Str();
+
+ if (str.Length()<7)
+ {
+ return EFalse;
+ }
+
+ if (str[1]=='!' && str[2]=='-' && str[3]=='-')
+ {
+ iType=EElementComment;
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ElementAtt()
+// Parses attribute element (eg. <HW Version="1.5"/>)
+// Note: Attribute values cannot contain equals (=) or quotations (")
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ElementAtt()
+ {
+ TPtrC str=Str();
+ TInt num1=Count(str, '=');
+ TInt num2=Count(str, '"');
+ TInt pos=str.Locate(' '); // find end of tag
+
+ if (iSlash==iLast-1 && num1>0 && num2==(2*num1) && pos!=KErrNotFound)
+ {
+ TPtrC ptr1=SubStr(iFirst, pos);
+ if (!ValidTag(ptr1))
+ {
+ return EFalse;
+ }
+
+ iType=EElementAtt;
+ iTag.Set(ptr1);
+ TPtrC ptr2=SubStr(pos, iSlash);
+ iValue.Set(ptr2);
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Str() const
+// Locates the position of the given character
+// -----------------------------------------------------------------------------
+//
+TPtrC TXmlParser::Str() const
+ {
+ return iText;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::FirstNonSpace(const TDesC& aText)
+// Returns the position of the first non space character
+// -----------------------------------------------------------------------------
+//
+TInt TXmlParser::FirstNonSpace(const TDesC& aText)
+ {
+ TInt len=aText.Length();
+ for (TInt i=0; i<len; i++)
+ {
+ TChar c=aText[i];
+ if (!c.IsSpace())
+ {
+ return i;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::LastNonSpace(const TDesC& aText)
+// Returns the position of the last non space character
+// -----------------------------------------------------------------------------
+//
+TInt TXmlParser::LastNonSpace(const TDesC& aText)
+ {
+ TInt last=aText.Length()-1;
+ for (TInt i=last; i>=0; i--)
+ {
+ TChar c=aText[i];
+ if (!c.IsSpace())
+ {
+ return i;
+ }
+ }
+ return KErrNotFound;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2)
+// Function returns a sub-string between aPos1 and aPos2
+// -----------------------------------------------------------------------------
+//
+TPtrC TXmlParser::SubStr(const TDesC& aText, TInt pos1, TInt pos2)
+ {
+ if (pos1<0 || pos2>=aText.Length() || pos1>=pos2)
+ {
+ return TPtrC(); // return empty descriptor
+ }
+
+ TInt len=pos2-pos1;
+ return aText.Mid(pos1+1, len-1);
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::SubStr(TInt pos1, TInt pos2)
+// Function returns a sub-string between aPos1 and aPos2
+// -----------------------------------------------------------------------------
+//
+TPtrC TXmlParser::SubStr(TInt pos1, TInt pos2)
+ {
+ TPtrC str=Str();
+ return SubStr(str, pos1, pos2);
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource)
+// Function performs string copy with length checking.
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::StrCopy(TDes& aTarget, const TDesC& aSource)
+ {
+ TInt len=aTarget.MaxLength();
+ if(len<aSource.Length())
+ {
+ aTarget.Copy(aSource.Left(len));
+ }
+ else
+ {
+ aTarget.Copy(aSource);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::Count(const TDesC& aText, const TChar aChar)
+// Returns the number of characters (aChar)
+// -----------------------------------------------------------------------------
+//
+TInt TXmlParser::Count(const TDesC& aText, const TChar aChar)
+ {
+ TInt count=0;
+ TInt len=aText.Length();
+
+ for (TInt i=0; i<len; i++)
+ {
+ TChar ch=aText[i];
+ if (ch == aChar)
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::TrimOriginal()
+// Trimmer function
+// -----------------------------------------------------------------------------
+//
+void TXmlParser::TrimOriginal()
+ {
+ // trim iOriginal and place into iText
+ iText.Set(KNullDesC);
+ TInt first=FirstNonSpace(iOriginal);
+ TInt last=LastNonSpace(iOriginal);
+ if(first!=KErrNotFound && last!=KErrNotFound && last>first+1)
+ {
+ TPtrC ptr=iOriginal.Mid(first, last-first+1);
+ iText.Set(ptr);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ValidChar(const TChar aChar)
+// Validates the character
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ValidChar(const TChar aChar)
+ {
+ if (aChar >= 'A' && aChar <= 'Z')
+ {
+ return ETrue;
+ }
+ if (aChar >= 'a' && aChar <= 'z')
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// TXmlParser::ValidTag(const TDesC& aText)
+// Validates the tag
+// -----------------------------------------------------------------------------
+//
+TBool TXmlParser::ValidTag(const TDesC& aText)
+ {
+ TInt len=aText.Length();
+ for (TInt i=0; i<len; i++)
+ {
+ if (!ValidChar(aText[i]))
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/caputils.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,730 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CapUtil implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <pathinfo.h>
+#include <sysutil.h>
+#include <hal.h>
+#include <hal_data.h>
+#include <etelmm.h> // for etel
+#include <mmtsy_names.h> // for etel
+#include <utf.h>
+#include <eikenv.h>
+#include <driveinfo.h>
+#include <centralrepository.h>
+#include <sysutildomaincrkeys.h>
+
+#include "caputils.h"
+#include "capability.h"
+#include "debug.h"
+
+const TInt KPackageSize = 65536;
+const TInt KDefaultArrayGranularity = 5;
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetDefaultRootPathL( RFs& aFs, TDes& aRootPath )
+// Gets default root path
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetDefaultRootPathL( RFs& aFs, TDes& aRootPath )
+ {
+ TRACE_FUNC_ENTRY;
+ // Use the default mass storage if it is internal drive
+ TInt msDrive;
+ User::LeaveIfError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, msDrive ) );
+ LOGGER_WRITE_1("drive: %d", msDrive);
+
+ TUint msStatus( 0 );
+ TInt err = DriveInfo::GetDriveStatus( aFs, msDrive, msStatus );
+ LOGGER_WRITE_1("DriveInfo::GetDriveStatus err: %d", err);
+
+ // if no errors, also check drive status
+ if( !err && !( msStatus & DriveInfo::EDrivePresent )
+ || msStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "Internal mass storage not present or corrupted" );
+ err = KErrNotFound;
+ }
+
+ if ( !err && ( msStatus & DriveInfo::EDriveInternal ) )
+ {
+ // Use internal mass storage
+ LOGGER_WRITE( "Use internal mass storage" );
+ User::LeaveIfError( PathInfo::GetRootPath( aRootPath, msDrive ) );
+ }
+ else
+ {
+ // Use phone memory
+ LOGGER_WRITE( "Use phone memory" );
+ StrCopy( aRootPath, PathInfo::PhoneMemoryRootPath() );
+ }
+ LOGGER_WRITE_1( "rootPath: %S", &aRootPath );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive )
+// Gets drive memory type
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aDrive: %d", aDrive);
+ aMemoryType = KNullDesC;
+ TUint driveStatus;
+ TInt err = DriveInfo::GetDriveStatus( aFs, aDrive, driveStatus );
+ if( err )
+ {
+ LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetDriveStatus err: %d", err );
+ return;
+ }
+ // search internal or removable drives
+ TBool searchInternalDrives;
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ aMemoryType = KMediaFlash;
+ searchInternalDrives = ETrue;
+ }
+ else
+ {
+ aMemoryType = KMediaMMC;
+ searchInternalDrives = EFalse;
+ }
+
+ TInt typeNumber(0);
+ TInt driveCount;
+ TDriveList driveList;
+
+ err = DriveInfo::GetUserVisibleDrives( aFs, driveList, driveCount );
+ if( err )
+ {
+ LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetUserVisibleDrives err: %d", err );
+ return;
+ }
+
+ for( TInt i = EDriveA; i <= aDrive; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ err = DriveInfo::GetDriveStatus( aFs, i, driveStatus );
+ if( err )
+ {
+ LOGGER_WRITE_1( "CapUtil::GetMemoryType() : DriveInfo::GetDriveStatus err: %d", err );
+ continue;
+ }
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "not present or corrupted" );
+ continue;
+ }
+
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ if( searchInternalDrives )
+ {
+ typeNumber++;
+ }
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ if( !searchInternalDrives )
+ {
+ typeNumber++;
+ }
+ }
+ }
+ }
+
+ if( typeNumber > 1 )
+ {
+ aMemoryType.AppendNum( typeNumber );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetOperatornameL(TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID)
+// Gets phone operator name, country code, networkID.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetOperatorNameL(TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID)
+ {
+ TRACE_FUNC_ENTRY;
+ TUint32 networkCaps;
+ RTelServer::TPhoneInfo phoneInfo;
+
+ RTelServer server;
+ RMobilePhone mobilePhone;
+ User::LeaveIfError( server.Connect() );
+ CleanupClosePushL( server );
+
+ TInt numPhones;
+ User::LeaveIfError( server.EnumeratePhones( numPhones ) );
+ server.GetPhoneInfo( 0, phoneInfo );
+
+ User::LeaveIfError( mobilePhone.Open( server, phoneInfo.iName ) );
+ CleanupClosePushL( mobilePhone );
+ User::LeaveIfError( mobilePhone.GetNetworkCaps( networkCaps ) );
+
+ RMobilePhone::TMobilePhoneNetworkInfoV1 mobilePhoneNetworkInfo;
+ RMobilePhone::TMobilePhoneNetworkInfoV1Pckg mobilePhoneNetworkInfoPckg(
+ mobilePhoneNetworkInfo );
+ RMobilePhone::TMobilePhoneLocationAreaV1 mobilePhoneLocationArea;
+
+ if (networkCaps & RMobilePhone::KCapsGetCurrentNetwork)
+ {
+ TRequestStatus status;
+ mobilePhone.GetCurrentNetwork(
+ status, mobilePhoneNetworkInfoPckg, mobilePhoneLocationArea );
+ User::WaitForRequest( status );
+ User::LeaveIfError( status.Int() );
+ }
+
+ CleanupStack::PopAndDestroy( &mobilePhone );
+ CleanupStack::PopAndDestroy( &server );
+ if ( mobilePhoneNetworkInfo.iLongName.Length() > 0 )
+ {
+ StrCopy( aLongName, mobilePhoneNetworkInfo.iLongName );
+ }
+ else if ( mobilePhoneNetworkInfo.iShortName.Length() > 0 )
+ {
+ StrCopy( aLongName, mobilePhoneNetworkInfo.iShortName );
+ }
+ else
+ {
+ StrCopy( aLongName, mobilePhoneNetworkInfo.iDisplayTag );
+ }
+ StrCopy( aCountryCode, mobilePhoneNetworkInfo.iCountryCode );
+ StrCopy( aNetworkID, mobilePhoneNetworkInfo.iNetworkId );
+
+ TRACE_FUNC_EXIT;
+ }
+// -----------------------------------------------------------------------------
+// CapUtil::GetManufacturer(TDes& aText)
+// Gets phone manufacturer from HAL. In case manufacturer is not known,
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetManufacturer(TDes& aText)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt num(KErrNotFound);
+
+ HAL::Get(HALData::EManufacturer, num);
+
+ switch (num)
+ {
+ case HALData::EManufacturer_Ericsson:
+ aText=KManufacturerEricsson;
+ break;
+ case HALData::EManufacturer_Motorola:
+ aText=KManufacturerMotorola;
+ break;
+ case HALData::EManufacturer_Nokia:
+ aText=KManufacturerNokia;
+ break;
+ case HALData::EManufacturer_Panasonic:
+ aText=KManufacturerPanasonic;
+ break;
+ case HALData::EManufacturer_Psion:
+ aText=KManufacturerPsion;
+ break;
+ case HALData::EManufacturer_Intel:
+ aText=KManufacturerIntel;
+ break;
+ case HALData::EManufacturer_Cogent:
+ aText=KManufacturerCogent;
+ break;
+ case HALData::EManufacturer_Cirrus:
+ aText=KManufacturerCirrus;
+ break;
+ case HALData::EManufacturer_Linkup:
+ aText=KManufacturerLinkup;
+ break;
+ case HALData::EManufacturer_TexasInstruments:
+ aText=KManufacturerTexasInstruments;
+ break;
+ default:
+ aText=KNullDesC;
+ break;
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetLanguage(TDes& aText)
+// Gets language
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetLanguage(TDes& aText)
+ {
+ TRACE_FUNC_ENTRY;
+ TLanguage lang=User::Language();
+ GetLanguageString(lang, aText);
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetSWVersionL(TDes& aVersion, TDes& aDate, TDes& aModel)
+// Gets SW version, SW version date and device model from SysUtil.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetSWVersionL(TDes& aVersion, TDes& aDate, TDes& aModel)
+ {
+ TRACE_FUNC_ENTRY;
+ TBuf<KBufSize> buf;
+ aVersion=KNullDesC;
+ aDate=KNullDesC;
+ aModel=KNullDesC;
+
+ User::LeaveIfError( SysUtil::GetSWVersion( buf ) );
+ RArray<TPtrC> arr(KDefaultArrayGranularity);
+ CleanupClosePushL( arr );
+
+ CapUtil::SplitL(buf, '\n', arr);
+ const TInt KFieldsToFind = 3;
+ if ( arr.Count() < KFieldsToFind )
+ {
+ User::Leave( KErrNotFound );
+ }
+
+ StrCopy( aVersion, arr[0] );
+ aVersion.Trim();
+
+ StrCopy(aModel,arr[2]);
+ aModel.Trim();
+
+ TBuf<KTagSize> date;
+ StrCopy(date, arr[1]);
+ TTime t;
+ t.UniversalTime(); // this is to avoid warnings
+ TRAPD( err, t = ParseDateL( date ) );
+ if ( err == KErrNone )
+ {
+ CapabilityDate( aDate, t );
+ }
+
+ CleanupStack::PopAndDestroy( &arr );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::InitMemoryInfo(TMemoryInfo& aInfo)
+// Initializes TMemoryInfo.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::InitMemoryInfo(TMemoryInfo& aInfo)
+ {
+ aInfo.iDriveNum = KErrNotFound;
+ aInfo.iDriveLetter = KNoChar;
+ aInfo.iLocation = KNullDesC;
+ aInfo.iFree = KErrNotFound;
+ aInfo.iUsed = KErrNotFound;
+ aInfo.iShared = EFalse;
+ aInfo.iFileSize = KErrNotFound;
+ aInfo.iFolderSize = KErrNotFound;
+ aInfo.iFileNameSize = KMaxFileName; // TFileName 256
+ aInfo.iFolderNameSize = KMaxFileName; // TFileName 256
+ aInfo.iCaseSensitivity = EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetMemoryInfoL( const RFs& aFs, TInt aDriveNumber, TMemoryInfo& aInfo )
+// Get memory information for one drive.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetMemoryInfoL( const RFs& aFs, const TInt aDriveNumber, TMemoryInfo& aInfo )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1(" aDriveNumber: %d", aDriveNumber);
+
+ TVolumeInfo volumeInfo;
+ TDriveInfo driveInfo;
+
+ InitMemoryInfo( aInfo );
+
+ User::LeaveIfError( aFs.Drive(driveInfo, aDriveNumber) );
+ if ( driveInfo.iDriveAtt == (TUint)KDriveAbsent )
+ {
+ LOGGER_WRITE(" iDriveAtt == (TUint)KDriveAbsent, Leave KErrNotFound");
+ User::Leave( KErrNotFound );
+ }
+
+ User::LeaveIfError( aFs.Volume(volumeInfo, aDriveNumber) );
+
+ User::LeaveIfError( aFs.DriveToChar(aDriveNumber, aInfo.iDriveLetter) );
+ aInfo.iDriveNum = aDriveNumber;
+ aInfo.iLocation.Append( aInfo.iDriveLetter );
+ aInfo.iLocation.Append( KDriveDelimiter );
+ aInfo.iLocation.Append( KPathDelimiter );
+ aInfo.iFree = volumeInfo.iFree;
+ aInfo.iUsed = volumeInfo.iSize - volumeInfo.iFree;
+
+ // set free memory up to critical level for all drives
+ CRepository* repository = CRepository::NewLC( KCRUidDiskLevel );
+ TInt criticalLevel(0);
+ User::LeaveIfError( repository->Get( KDiskCriticalThreshold, criticalLevel ) );
+ CleanupStack::PopAndDestroy( repository );
+ criticalLevel += KPackageSize; // add obex package size to critical level
+ LOGGER_WRITE_1( "CapUtil::GetMemoryInfoL() criticalLevel: %d", criticalLevel ) ;
+ if ( aInfo.iFree > criticalLevel )
+ {
+ aInfo.iFree = aInfo.iFree - criticalLevel;
+ }
+ else
+ {
+ aInfo.iFree = 0;
+ }
+
+ aInfo.iFileSize = aInfo.iFree;
+ aInfo.iFolderSize = aInfo.iFree;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetFileListL( RFs& aFs, const TDesC& aDir,
+// RArray<TFileName>& aList)
+// Finds all files in aDir.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetFileListL( const RFs& aFs, const TDesC& aDir,
+ RArray<TFileName>& aList)
+ {
+ TRACE_FUNC_ENTRY;
+
+ aList.Reset();
+
+ CDir* dir( NULL );
+ User::LeaveIfError( aFs.GetDir( aDir, KEntryAttMatchMask, ESortByName, dir ) );
+ CleanupStack::PushL( dir );
+
+ for ( TInt i=0; i < dir->Count(); ++i )
+ {
+ TEntry entry = (*dir)[i];
+ if ( !entry.IsDir() )
+ {
+ User::LeaveIfError( aList.Append( entry.iName ) );
+ }
+ }
+ CleanupStack::PopAndDestroy( dir );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt)
+// Function checks file extension.
+// -----------------------------------------------------------------------------
+//
+TBool CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt)
+ {
+ TRACE_FUNC_ENTRY;
+ TParse parse;
+ parse.Set(aFile, NULL, NULL);
+ TPtrC ptr=parse.Ext();
+
+ TBuf<KTagSize> buf1;
+ TBuf<KTagSize> buf2;
+
+ buf1=ptr;
+ buf2=aExt;
+
+ buf1.LowerCase();
+ buf2.LowerCase();
+
+ if (buf1.Compare(buf2)==0)
+ {
+ LOGGER_WRITE( "CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) : returned ETrue" );
+ return ETrue;
+ }
+
+ else
+ {
+ LOGGER_WRITE( "CapUtil::CheckFileType(const TDesC& aFile, const TDesC& aExt) : returned EFalse" );
+ return EFalse;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::GetLanguageString(TLanguage aId, TDes& aText)
+// Get language string for aId.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::GetLanguageString(TLanguage aId, TDes& aText)
+ {
+ TRACE_FUNC_ENTRY;
+ aText=KNullDesC;
+
+ TInt count=NUMLANGSTRINGS;
+ for (TInt i=0; i<count; i++)
+ {
+ TLangStringStruct t=KLangStrings[i];
+ if (t.id == (TInt)aId)
+ {
+ aText=t.lang;
+ return;
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::Panic(TInt aReason)
+// Panic.
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CapUtil::Panic(TInt aReason)
+#else
+void CapUtil::Panic(TInt /*aReason*/)
+#endif
+ {
+ TRACE_FUNC_ENTRY;
+#ifdef _DEBUG
+ _LIT(KPanicCategory,"CapabilitySC");
+
+ User::Panic(KPanicCategory, aReason);
+#endif
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::StrCopy(TDes& aTarget, const TDesC& aSource)
+// String copy with lenght check.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::StrCopy(TDes& aTarget, const TDesC& aSource)
+ {
+ TInt len=aTarget.MaxLength();
+ if(len<aSource.Length())
+ {
+ aTarget.Copy(aSource.Left(len));
+ return;
+ }
+ aTarget.Copy(aSource);
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::IntToStr(TDes& aText, TInt64 aNum)
+// Function converts ínteger to string.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::IntToStr(TDes& aText, TInt64 aNum)
+ {
+ aText.Num(aNum);
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::StrToInt(const TDesC& aText, TInt& aNum)
+// Function converts string to integer. If string cannot be converted,
+// error code is returned.
+// -----------------------------------------------------------------------------
+//
+TInt CapUtil::StrToInt(const TDesC& aText, TInt& aNum)
+ {
+ TLex lex(aText);
+
+ TInt err=lex.Val(aNum);
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::SplitL(const TDesC& aText, const TChar aSeparator,
+// RArray<TPtrC>& aArray)
+// Function splits string (eg "name1, name2, name3") into substrings.
+// -----------------------------------------------------------------------------
+//
+void CapUtil::SplitL(const TDesC& aText, const TChar aSeparator,
+ RArray<TPtrC>& aArray)
+ {
+ TRACE_FUNC_ENTRY;
+ TPtrC ptr;
+ ptr.Set(aText);
+
+ for (;;)
+ {
+ TInt pos=ptr.Locate(aSeparator);
+ if (pos==KErrNotFound)
+ {
+ aArray.AppendL(ptr);
+ break;
+ }
+
+ TPtrC subStr=ptr.Left(pos); // get pos characters starting from position 0
+ aArray.AppendL(subStr);
+
+ if (!(ptr.Length()>pos+1))
+ {
+ break;
+ }
+
+ ptr.Set(ptr.Mid(pos+1));// get all characters starting from position pos+1
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::ParseDateL(const TDesC& aText)
+// Function parses date string of the format "dd-mm-yy".
+// -----------------------------------------------------------------------------
+//
+TTime CapUtil::ParseDateL(const TDesC& aText)
+ {
+ TRACE_FUNC_ENTRY;
+ RArray<TPtrC> arr(KDefaultArrayGranularity);
+ CleanupClosePushL( arr );
+
+ CapUtil::SplitL( aText, '-', arr );
+ if ( arr.Count() != 3 )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ TInt day;
+ TInt month;
+ TInt year;
+
+ User::LeaveIfError( StrToInt(arr[0], day) );
+ User::LeaveIfError( StrToInt(arr[1], month) );
+ User::LeaveIfError( StrToInt(arr[2], year) );
+
+ TDateTime td;
+ TMonth month2 = Month( month );
+ // if year is defined as two digit, add currect millenium for it
+ const TInt KDefaultMillenium = 2000;
+ if ( year < KDefaultMillenium )
+ {
+ year = year + KDefaultMillenium;
+ }
+
+
+ User::LeaveIfError( td.Set(year, month2, day-1, 0, 0, 0, 0) );
+
+ CleanupStack::PopAndDestroy( &arr );
+
+ TTime t(td);
+ TRACE_FUNC_EXIT;
+ return t;
+}
+
+// -----------------------------------------------------------------------------
+// CapUtil::Month(TInt aNum)
+// Function return TMonth presentation of integer
+// -----------------------------------------------------------------------------
+//
+TMonth CapUtil::Month(TInt aNum)
+ {
+ TRACE_FUNC_ENTRY;
+ __ASSERT_DEBUG(aNum>=1 && aNum<=12, Panic(KErrArgument));
+
+ switch (aNum)
+ {
+ case 1: return EJanuary;
+ case 2: return EFebruary;
+ case 3: return EMarch;
+ case 4: return EApril;
+ case 5: return EMay;
+ case 6: return EJune;
+ case 7: return EJuly;
+ case 8: return EAugust;
+ case 9: return ESeptember;
+ case 10: return EOctober;
+ case 11: return ENovember;
+ case 12: return EDecember;
+ default: return EJanuary;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CapUtil::CapabilityDate(TDes& aText, const TTime aTime)
+// Constructs capability date as string
+// -----------------------------------------------------------------------------
+//
+void CapUtil::CapabilityDate(TDes& aText, const TTime aTime)
+ {
+ TRACE_FUNC_ENTRY;
+ _LIT(KFormat,"%04d%02d%02dT%02d%02d%02dZ");
+
+ TDateTime dt=aTime.DateTime();
+ aText.Format(KFormat, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(),
+ dt.Minute(), dt.Second());
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// TIdStack::Pop()
+// Pop id from the stack
+// -----------------------------------------------------------------------------
+//
+TInt TIdStack::Pop()
+ {
+ if (iPos<0)
+ {
+ LOGGER_WRITE( "TIdStack::Pop() returned KErrNotFound" );
+ return KErrNotFound;
+ }
+
+ TInt id=iArray[iPos];
+ iPos--;
+ return id;
+ }
+
+// -----------------------------------------------------------------------------
+// TIdStack::Push( TInt aId )
+// Push id to the stack
+// -----------------------------------------------------------------------------
+//
+void TIdStack::Push( TInt aId )
+ {
+ if ( Size() >= KNestingLimit )
+ {
+ return;
+ }
+
+ iPos++;
+ iArray[iPos] = aId;
+ }
+
+// -----------------------------------------------------------------------------
+// TIdStack::Size() const
+// Size of the stack
+// -----------------------------------------------------------------------------
+//
+TInt TIdStack::Size() const
+ {
+ return iPos+1;
+ }
+
+// -----------------------------------------------------------------------------
+// TIdStack::Reset()
+// Reset the stack.
+// -----------------------------------------------------------------------------
+//
+void TIdStack::Reset()
+ {
+ iArray.Reset();
+ iPos=-1;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/sconcsc.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConCSC implementation
+*
+*/
+
+
+//
+// This program creates a polymorphic interface DLL that is used
+// to create capability object
+//
+
+// INCLUDE FILES
+
+#include <e32def.h>
+#include <e32uid.h>
+
+#include "sconcsc.h"
+#include "capinfo.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CreateCSConCSCL()
+// Function to construct CSConCSC object. Note that this function
+// is exported at ordinal 1 and is not a member of any class.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConCSC* CreateCSConCSCL()
+ {
+ TRACE_FUNC;
+ return CSConCSC::NewL();
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConCSC::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConCSC* CSConCSC::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConCSC* self = new (ELeave) CSConCSC();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConCSC::~CSConCSC()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConCSC::~CSConCSC()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iCapInfo;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConCSC::CapabilityObject(CBufFlat& aBuf)
+// Creates a capability object data and sets data into aBuf.
+// -----------------------------------------------------------------------------
+//
+TInt CSConCSC::CapabilityObject(CBufFlat& aBuf)
+ {
+ TRACE_FUNC_ENTRY;
+ TRAPD(err, CSConCSC::CapabilityObjectL(aBuf));
+ LOGGER_WRITE_1( "CSConCSC::CapabilityObject(CBufFlat& aBuf) : returned %d", err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConCSC::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConCSC::ConstructL()
+ {
+ iCapInfo = CCapInfo::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConCSC::CSConCSC()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConCSC::CSConCSC()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConCSC::CapabilityObjectL(CBufFlat& aBuf)
+// Creates a capability object data and sets data into aBuf.
+// -----------------------------------------------------------------------------
+//
+void CSConCSC::CapabilityObjectL(CBufFlat& aBuf)
+ {
+ TRACE_FUNC_ENTRY;
+ iCapInfo->CapabilityDocumentL( &aBuf );
+ TRACE_FUNC_EXIT;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/sconsyncservice.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,505 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConSyncService implementation.
+*
+*/
+
+
+// Includes
+#include <centralrepository.h>
+#include <seconsdkcrkeys.h>
+
+#include <swi/sisregistryentry.h> // for searching app name from installer
+#include <swi/sisregistrypackage.h>
+#include <swi/sisregistrysession.h>
+#include <javaregistryincludes.h>
+using namespace Java;
+
+#include "sconsyncservice.h"
+#include "capability.h"
+#include "debug.h"
+
+// Constants
+const TInt KDsAppUi = 0x101F6DE4; // NSmlDSSync.exe
+const TSmlDataProviderId KCalendarId = 0x101f6dde;
+const TSmlDataProviderId KContactsId = 0x101f6ddd;
+const TSmlDataProviderId KSmsId = 0x10206b5c;
+const TSmlDataProviderId KBookmarkId = 0x102751ba;
+
+const TInt KDateFormatLength(16);
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::NewLC()
+// -----------------------------------------------------------------------------
+//
+CSConSyncService* CSConSyncService::NewLC()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConSyncService* self = new (ELeave) CSConSyncService();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::CSConSyncService()
+// -----------------------------------------------------------------------------
+//
+CSConSyncService::CSConSyncService()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::~CSConSyncService()
+// -----------------------------------------------------------------------------
+//
+CSConSyncService::~CSConSyncService()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iApaSessionConnected )
+ {
+ iApaSession.Close();
+ }
+ if ( iSyncSessionOpened )
+ {
+ iSyncSession.Close();
+ }
+ delete iRepository;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::ConstructL()
+ {
+ iRepository = CRepository::NewL( KCRUidSecon );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetSolutionL()
+// Populate SolutionInfo according to content type.
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetSolutionL( const TUint aSeconContentType,
+ TSConSolutionInfo& aSolutionInfo )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt appUid;
+ User::LeaveIfError( iRepository->Get( aSeconContentType, appUid ));
+ LOGGER_WRITE_2( "repository readed ok, uid: %d, hex:%x", appUid, appUid );
+
+ aSolutionInfo.iUid = appUid;
+ if ( aSolutionInfo.iUid == KDsAppUi )
+ {
+ // read profile name
+ LOGGER_WRITE( "Search correct profile" );
+ GetLastUsedProfileNameL( aSolutionInfo.iSolutionName,
+ aSolutionInfo.iTime, ProviderId( aSeconContentType ) );
+ }
+ else if ( aSolutionInfo.iUid != 0 )
+ {
+ LOGGER_WRITE( "Search correct application name" );
+ TUid appUid = {aSolutionInfo.iUid};
+ GetApplicationCaptionL( aSolutionInfo.iSolutionName, appUid );
+
+ // get solution timestamp
+ TBuf<KDateFormatLength> timeBuffer;
+ // Timestamp is stored always in next to Uid value on cenrep
+ TInt err = iRepository->Get( aSeconContentType+1, timeBuffer );
+
+ LOGGER_WRITE_1( "iRepository->Get(time) err: %d", err );
+ if ( err == KErrNone )
+ {
+ err = ParseTimestamp( aSolutionInfo.iTime, timeBuffer );
+ LOGGER_WRITE_1( "ParseTimestamp err: %d", err );
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::ProviderId()
+// Return correct providerId according to content type.
+// -----------------------------------------------------------------------------
+//
+TSmlDataProviderId CSConSyncService::ProviderId( const TUint32 aSeconContentType ) const
+ {
+ TSmlDataProviderId providerId(KErrNotFound);
+ switch (aSeconContentType)
+ {
+ case KSeconCalendarUid:
+ providerId = KCalendarId;
+ break;
+ case KSeconContactsUid:
+ providerId = KContactsId;
+ break;
+ case KSeconSmsUid:
+ providerId = KSmsId;
+ break;
+ case KSeconBookmarkUid:
+ providerId = KBookmarkId;
+ break;
+ default:
+ LOGGER_WRITE_1( "Invalid content type: %d", aSeconContentType );
+ }
+ return providerId;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::ParseTimestamp()
+// Parses timestamp to TTime format
+// -----------------------------------------------------------------------------
+//
+TInt CSConSyncService::ParseTimestamp( TTime& aTime, const TDesC& aTimestamp ) const
+ {
+ // timestamp must be in following format:
+ // YYYYMMDDTHHMMSSZ
+ // MM=1..12, DD=1..number of days in month, HH=0..23, MM;SS=0..59
+ // Example 20071224T162215Z = 24.12.2007, 16:22:15 UTC time
+
+ if ( aTimestamp.Length() != KDateFormatLength )
+ {
+ LOGGER_WRITE_1( "aTimestamp.Length(): %d", aTimestamp.Length() );
+ return KErrArgument;
+ }
+
+ TPtrC temp;
+ temp.Set(aTimestamp.Ptr());
+
+ TLex lex(temp.Mid(0,4));
+ TInt year;
+ TInt month;
+ TInt day;
+ TInt hour;
+ TInt minute;
+ TInt second;
+ TInt err = lex.Val( year );
+ if (err != KErrNone) return err;
+
+ lex = temp.Mid(4,2);
+ err = lex.Val( month );
+ if ( err != KErrNone) return err;
+ month--;
+
+ lex = temp.Mid(6,2);
+ err = lex.Val( day );
+ if (err != KErrNone) return err;
+ day--;
+
+ lex = temp.Mid(9,2);
+ err = lex.Val( hour );
+ if (err != KErrNone) return err;
+
+ lex = temp.Mid(11,2);
+ err = lex.Val( minute );
+ if (err != KErrNone) return err;
+
+ lex = temp.Mid(13,2);
+ err = lex.Val( second );
+ if (err != KErrNone) return err;
+
+ TDateTime parsedTime;
+ err = parsedTime.Set(year, (TMonth)month, day, hour, minute, second, 0);
+ if (err != KErrNone) return err;
+
+ aTime = parsedTime;
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetApplicationCaptionL()
+// Get application caption.
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetApplicationCaptionL( TDes& aCaption, const TUid aAppUid )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt err(KErrNotReady);
+ // connect to RApaLsSession, if not yet ready
+ if ( !iApaSessionConnected )
+ {
+ err = iApaSession.Connect();
+ if ( err == KErrNone )
+ {
+ iApaSessionConnected = ETrue;
+ }
+ }
+
+ // Get application caption using RApaLsSession::GetAppInfo
+ TApaAppInfo appInfo;
+ if ( iApaSessionConnected )
+ {
+ err = iApaSession.GetAppInfo( appInfo ,aAppUid );
+ }
+
+ LOGGER_WRITE_1( "GetAppInfo err: %d", err );
+ if ( err == KErrNone )
+ {
+ aCaption = appInfo.iCaption;
+ }
+ else
+ {
+ // Caption does not exist, search application name from installer
+ GetInstPackageCaptionL( aCaption, aAppUid );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetInstPackageCaptionL()
+// Search UID from installed applications, return app caption
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetInstPackageCaptionL( TDes& aCaption, const TUid aPackageUid )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE("Name not found, search from installer");
+ // Search application name from Installer.
+ Swi::RSisRegistrySession sisRegistry;
+ User::LeaveIfError( sisRegistry.Connect() );
+ CleanupClosePushL( sisRegistry );
+
+ //Check if uid belongs to SIS package
+ if( sisRegistry.IsInstalledL( aPackageUid ) )
+ {
+ LOGGER_WRITE("SIS package found");
+ Swi::RSisRegistryEntry entry;
+ CleanupClosePushL(entry);
+ User::LeaveIfError( entry.Open( sisRegistry, aPackageUid ) );
+ aCaption.Copy( *entry.PackageNameL() );
+ CleanupStack::PopAndDestroy( &entry );
+ }
+ else
+ {
+ // not sis app, might be java app.
+ LOGGER_WRITE("SIS package not found");
+ CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( );
+ TBool entryExist = javaRegistry->RegistryEntryExistsL( aPackageUid );
+ if ( entryExist )
+ {
+ CJavaRegistryEntry* entry = javaRegistry->RegistryEntryL( aPackageUid );
+ if ( entry )
+ {
+ aCaption.Copy( entry->Name() );
+ delete entry;
+ }
+ }
+
+ CleanupStack::PopAndDestroy( javaRegistry );
+ }
+
+ CleanupStack::PopAndDestroy( &sisRegistry );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetLastUsedProfileNameL()
+// Gets last used profile for selected provider
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetLastUsedProfileNameL( TDes& aProfileName, TTime& aTime,
+ const TSmlDataProviderId& aDataProviderId )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( !iSyncSessionOpened )
+ {
+ iSyncSession.OpenL();
+ iSyncSessionOpened = ETrue;
+ }
+ RArray<TSmlProfileId> profiles;
+ CleanupClosePushL( profiles );
+ iSyncSession.ListProfilesL(profiles, ESmlDataSync );
+ TSmlProfileId lastSyncProfile(KErrNotFound);
+ TTime lastSyncTime(0);
+ LOGGER_WRITE_1( "Profiles count: %d", profiles.Count() );
+ for (TInt i=0; i<profiles.Count(); i++)
+ {
+ TTime syncTime(0);
+ GetLastSyncTimeL( syncTime, profiles[i], aDataProviderId );
+ if ( syncTime.Int64() != 0 && syncTime > lastSyncTime )
+ {
+ LOGGER_WRITE_1( "New record, profile: %d",profiles[i]);
+ lastSyncTime = syncTime;
+ lastSyncProfile = profiles[i];
+ }
+ }
+ CleanupStack::PopAndDestroy( &profiles );
+ LOGGER_WRITE_1( "lastSyncProfile: %d", lastSyncProfile );
+ if ( lastSyncProfile != KErrNotFound )
+ {
+ aTime = lastSyncTime;
+ RSyncMLDataSyncProfile syncProfile;
+ syncProfile.OpenL( iSyncSession, lastSyncProfile, ESmlOpenRead );
+ TPtrC displayName = syncProfile.DisplayName();
+ aProfileName.Copy( displayName );
+ syncProfile.Close();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetLastSyncTimeL()
+// Gets last sync time for certain profile and provider.
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetLastSyncTimeL( TTime& aTime, const TSmlProfileId aSyncProfileId,
+ const TSmlDataProviderId aDataProviderId )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aSyncProfileId: %d", aSyncProfileId );
+ LOGGER_WRITE_1( "aDataProviderId: 0x%08x", aDataProviderId );
+ if ( !iSyncSessionOpened )
+ {
+ LOGGER_WRITE("iSyncSession is not opened, Leave!");
+ User::Leave( KErrNotReady );
+ }
+
+ RSyncMLDataSyncProfile syncProfile;
+ syncProfile.OpenL( iSyncSession, aSyncProfileId, ESmlOpenRead );
+ CleanupClosePushL( syncProfile );
+ LOGGER_WRITE( "syncProfile opened OK" );
+
+ TSmlTaskId providerTask;
+ GetProviderTaskL( providerTask, syncProfile, aDataProviderId );
+ if ( providerTask != KErrNone )
+ {
+ RSyncMLHistoryLog historyLog;
+ historyLog.OpenL( iSyncSession, aSyncProfileId );
+ CleanupClosePushL( historyLog );
+ historyLog.SortEntries(CSyncMLHistoryEntry::ESortByTime);
+ LOGGER_WRITE_1( "historyLog.Count: %d", historyLog.Count() );
+ const CSyncMLHistoryJob* historyJob = LatestHistoryJob( historyLog, providerTask );
+ if ( historyJob )
+ {
+ aTime = historyJob->TimeStamp();
+#ifdef _DEBUG
+ TDateTime timeStamp = historyJob->TimeStamp().DateTime();
+ _LIT(KDateFormat, " (%04d%02d%02dT%02d%02d%02d)");
+ const TInt KDateFormatLength(20);
+ TBuf<KDateFormatLength> tempdate;
+ tempdate.Format(KDateFormat, timeStamp.Year(), timeStamp.Month()+1, timeStamp.Day()+1,
+ timeStamp.Hour(), timeStamp.Minute(), timeStamp.Second());
+ LOGGER_WRITE_1("history found, TimeStamp: %S", &tempdate);
+#endif
+ }
+
+ CleanupStack::PopAndDestroy( &historyLog );
+ }
+ CleanupStack::PopAndDestroy( &syncProfile );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::GetProviderTaskL()
+// Gets provider task id from profile
+// -----------------------------------------------------------------------------
+//
+void CSConSyncService::GetProviderTaskL( TSmlTaskId& aProviderTask,
+ RSyncMLDataSyncProfile& aSyncProfile,
+ const TSmlDataProviderId aDataProviderId ) const
+ {
+ TRACE_FUNC_ENTRY;
+ aProviderTask = KErrNotFound;
+
+ RArray<TSmlTaskId> tasks;
+ CleanupClosePushL( tasks );
+
+ aSyncProfile.ListTasksL( tasks );
+ LOGGER_WRITE_1( "tasks.Count: %d", tasks.Count() );
+
+ for ( TInt i=0; i<tasks.Count() && aProviderTask==KErrNotFound; i++ )
+ {
+ RSyncMLTask syncTask;
+ syncTask.OpenL( aSyncProfile, tasks[i] );
+ if ( syncTask.DataProvider() == aDataProviderId )
+ {
+ LOGGER_WRITE_1( "dataprovider task found, taskId: %d", tasks[i] );
+ aProviderTask = tasks[i];
+ }
+ syncTask.Close();
+ }
+
+ CleanupStack::PopAndDestroy( &tasks );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSyncService::LatestHistoryJob()
+// Gets latest historyJob where task is correct.
+// -----------------------------------------------------------------------------
+//
+ const CSyncMLHistoryJob* CSConSyncService::LatestHistoryJob(
+ RSyncMLHistoryLog& aHistoryLog, TInt aTaskId ) const
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt count = aHistoryLog.Count();
+ if ( count == 0 )
+ {
+ LOGGER_WRITE( "profile has no history job" );
+ TRACE_FUNC_EXIT;
+ return NULL; // profile has no history job
+ }
+
+ aHistoryLog.SortEntries(CSyncMLHistoryEntry::ESortByTime);
+
+ // try to find latest sync job (start from last array entry)
+
+ for ( TInt i=count-1; i>=0; i-- )
+ {
+ const CSyncMLHistoryEntry& entry = aHistoryLog[i];
+ const CSyncMLHistoryJob* jobEntry = CSyncMLHistoryJob::DynamicCast(&entry);
+ if ( jobEntry )
+ {
+ if ( TaskExist(jobEntry, aTaskId) )
+ {
+ LOGGER_WRITE( "history job found" );
+ TRACE_FUNC_EXIT;
+ return jobEntry;
+ }
+ }
+ }
+ LOGGER_WRITE( "history job not found" );
+ TRACE_FUNC_EXIT;
+ return NULL;
+ }
+
+ // -----------------------------------------------------------------------------
+ // CSConSyncService::TaskExist()
+ // Returns ETrue if task exists in HistoryJob.
+ // -----------------------------------------------------------------------------
+ //
+TBool CSConSyncService::TaskExist( const CSyncMLHistoryJob* aHistoryJob, TInt aTaskId ) const
+ {
+ TRACE_FUNC_ENTRY;
+ TInt taskCount = aHistoryJob->TaskCount();
+ for ( TInt i=0; i<taskCount; i++ )
+ {
+ const CSyncMLHistoryJob::TTaskInfo& taskInfo = aHistoryJob->TaskAt(i);
+
+ if ( taskInfo.iTaskId == aTaskId )
+ {
+ LOGGER_WRITE( "task exists." );
+ TRACE_FUNC_EXIT;
+ return ETrue;
+ }
+ }
+ TRACE_FUNC_EXIT;
+ return EFalse;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/sconversioninfo.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,270 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconVersionInfo implementation.
+*
+*/
+
+
+#include "sconversioninfo.h"
+
+#include <centralrepository.h>
+#include <DSCapabilityManagementCRKeys.h>
+#include <etel3rdparty.h> // read imsi
+#include <etel.h>
+#include <etelmm.h>
+#include <hal.h>
+
+#include "caputils.h"
+#include "debug.h"
+
+CSconVersionInfo::CSconVersionInfo()
+ {
+ iSymbianVersionError = KErrNotReady;
+ iS60VersionError = KErrNotReady;
+ }
+
+CSconVersionInfo::~CSconVersionInfo()
+ {
+ delete iManufacturer;
+ delete iModel;
+ delete iProduct;
+ delete iRevision;
+ delete iSWVersion;
+ delete iSerialNumber;
+ delete iSysVersionInfo;
+ delete iLangVersion;
+ delete iLangSWVersion;
+ delete iOPVersion;
+ delete iProductCode;
+ }
+
+CSconVersionInfo* CSconVersionInfo::NewL()
+ {
+ CSconVersionInfo* self = new (ELeave) CSconVersionInfo;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSconVersionInfo::FetchInfoL()
+// fetch device info
+// -----------------------------------------------------------------------------
+//
+void CSconVersionInfo::FetchInfoL( RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+
+ iSymbianVersionError = SysVersionInfo::GetVersionInfo( iSymbianVersion, aFs );
+ iS60VersionError = VersionInfo::GetVersion( iS60Version, aFs );
+
+ TBuf<KSysVersionInfoTextLength> info;
+ TBuf<KSysVersionInfoTextLength> productBuf;
+ TInt err(KErrNone);
+ delete iSWVersion;
+ iSWVersion = NULL;
+ delete iProduct;
+ iProduct = NULL;
+ // get SW version, SW version date and model
+ TRAP( err, CapUtil::GetSWVersionL( info, iDate, productBuf ) );
+ iSWVersion = info.AllocL();
+ iProduct = productBuf.AllocL();
+ LOGGER_WRITE_1("CapUtil::GetSWVersionL err: %d", err);
+
+
+ SysVersionInfo::TProductVersion productVersion;
+ TInt sysVersionError = SysVersionInfo::GetVersionInfo( productVersion, aFs );
+ LOGGER_WRITE_1( "SysVersionInfo::GetVersionInfo returned : %d", sysVersionError );
+
+ // Use TelServer to get IMEI and also other info if SysVersionInfo is not supported
+ RTelServer telServer;
+ User::LeaveIfError( telServer.Connect() );
+ CleanupClosePushL( telServer );
+ RTelServer::TPhoneInfo teleinfo;
+ User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) );
+ RMobilePhone phone;
+ User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) );
+ CleanupClosePushL( phone );
+ User::LeaveIfError(phone.Initialise());
+ TUint32 teleidentityCaps;
+ phone.GetIdentityCaps( teleidentityCaps );
+ RMobilePhone::TMobilePhoneIdentityV1 telid;
+ TRequestStatus status;
+ phone.GetPhoneId( status, telid );
+ User::WaitForRequest( status );
+ if ( status == KErrNone )
+ {
+ if ( sysVersionError )
+ {
+ LOGGER_WRITE("Use info from TMobilePhoneIdentityV1");
+ delete iModel;
+ iModel = NULL;
+ delete iRevision;
+ iRevision = NULL;
+
+ // phone model sales name. For example "N01".
+ iModel = telid.iModel.AllocL();
+ // product revision. For example "01"
+ iRevision = telid.iRevision.AllocL();
+ }
+ delete iSerialNumber;
+ iSerialNumber = NULL;
+ // Phone serial number (IMEI or ESN), in character string format.
+ iSerialNumber = telid.iSerialNumber.AllocL();
+ }
+
+ CleanupStack::PopAndDestroy( &phone );
+ CleanupStack::PopAndDestroy( &telServer );
+
+ if ( sysVersionError == KErrNone )
+ {
+ // use information from SysVersionInfo instead of previous APIs.
+ LOGGER_WRITE("Using SysVersionInfo");
+
+ // phone model sales name. For example "N01".
+ delete iModel;
+ iModel = NULL;
+ iModel = productVersion.iModel.AllocL();
+ // product revision. For example "01"
+ delete iRevision;
+ iRevision = NULL;
+ iRevision = productVersion.iRevision.AllocL();
+ // manufacturer name. For example "Nokia"
+ delete iManufacturer;
+ iManufacturer = NULL;
+ iManufacturer = productVersion.iManufacturer.AllocL();
+ // product code name. For example "RM-1"
+ delete iProduct;
+ iProduct = NULL;
+ iProduct = productVersion.iProduct.AllocL();
+ }
+ else
+ {
+ CapUtil::GetManufacturer( info );
+ delete iManufacturer;
+ iManufacturer = NULL;
+ iManufacturer = info.AllocL();
+ }
+
+ CapUtil::GetLanguage( iLanguage );
+
+
+ err = SysVersionInfo::GetVersionInfo( SysVersionInfo::EFWVersion, info, aFs );
+ delete iSysVersionInfo;
+ iSysVersionInfo = NULL;
+ if ( !err )
+ {
+ iSysVersionInfo = info.AllocL();
+ }
+
+ err = SysUtil::GetLangVersion( info );
+ delete iLangVersion;
+ iLangVersion = NULL;
+ if ( !err )
+ {
+ iLangVersion = info.AllocL();
+ }
+
+ sysVersionError = SysUtil::GetLangSWVersion( info );
+ delete iLangSWVersion;
+ iLangSWVersion = NULL;
+ if ( !sysVersionError )
+ {
+ iLangSWVersion = info.AllocL();
+ }
+
+ sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EOPVersion, info, aFs );
+ delete iOPVersion;
+ iOPVersion = NULL;
+ if ( !sysVersionError )
+ {
+ iOPVersion = info.AllocL();
+ }
+
+
+ sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EProductCode, info, aFs );
+ delete iProductCode;
+ iProductCode = NULL;
+ if ( !sysVersionError )
+ {
+ iProductCode = info.AllocL();
+ }
+
+ // read DesktopSync key value
+ CRepository* repository(NULL);
+ TRAP( iDesktopSyncError, repository = CRepository::NewL( KCRUidDSDCMOConfig ));
+ if ( !iDesktopSyncError )
+ {
+ iDesktopSyncError = repository->Get( KNsmlDesktopSync, iDesktopSync );
+ LOGGER_WRITE_1("iDesktopSyncError: %d", iDesktopSyncError );
+ LOGGER_WRITE_1("iDesktopSync: %d", iDesktopSync );
+ delete repository;
+ }
+ else
+ {
+ LOGGER_WRITE_1("Could not create CRepository, err: %d", iDesktopSyncError );
+ }
+
+ // screen size
+ HAL::Get(HAL::EDisplayXPixels, iScreenSize.iWidth);
+ HAL::Get(HAL::EDisplayYPixels, iScreenSize.iHeight);
+
+ iInfoFetched = ETrue;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSconVersionInfo::IsReady()
+//
+// -----------------------------------------------------------------------------
+//
+TBool CSconVersionInfo::IsReady()
+ {
+ return iInfoFetched;
+ }
+
+// -----------------------------------------------------------------------------
+// CSconVersionInfo::GetSymbianVersion()
+// Get Symbian OS version
+// -----------------------------------------------------------------------------
+//
+TInt CSconVersionInfo::GetSymbianVersion( SysVersionInfo::TSymbianOSVersion& aSymbianVersion )
+ {
+ if ( iSymbianVersionError )
+ {
+ return iSymbianVersionError;
+ }
+ else
+ {
+ aSymbianVersion = iSymbianVersion;
+ return KErrNone;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSconVersionInfo::GetS60Version()
+// Get S60 platform version
+// -----------------------------------------------------------------------------
+//
+TInt CSconVersionInfo::GetS60Version( VersionInfo::TPlatformVersion& aS60Version )
+ {
+ if ( iS60VersionError )
+ {
+ return iS60VersionError;
+ }
+ else
+ {
+ aS60Version = iS60Version;
+ return KErrNone;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/csc/src/stringlist.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CStringList implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "stringlist.h"
+#include "capability.h"
+#include "debug.h"
+
+const TInt KMaxStringlistSize( 1000 );
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CStringList::NewL()
+// Two-phase constructor.
+// -----------------------------------------------------------------------------
+//
+CStringList* CStringList::NewL()
+ {
+ CStringList* self = CStringList::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::NewLC()
+// Two-phase constructor. The created instance is placed to cleanup stack
+// -----------------------------------------------------------------------------
+//
+CStringList* CStringList::NewLC()
+ {
+ CStringList* self = new ( ELeave ) CStringList();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::CStringList()
+// Default constuctor
+// -----------------------------------------------------------------------------
+//
+CStringList::CStringList()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::~CStringList()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CStringList::~CStringList()
+ {
+ delete iLines;
+ iLines = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CStringList::ConstructL()
+ {
+ const TInt KDefaultArrayGranularity = 10;
+ iLines = new (ELeave) CDesCArrayFlat(KDefaultArrayGranularity);
+ SetMark(0);
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::Count() const
+// Returns the count of lines
+// -----------------------------------------------------------------------------
+//
+TInt CStringList::Count() const
+ {
+ return iLines->Count();
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::Panic(TInt aPanic) const
+// Creates a panic
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CStringList::Panic(TInt aPanic) const
+#else
+void CStringList::Panic(TInt /*aPanic*/) const
+#endif
+ {
+ TRACE_FUNC_ENTRY;
+#ifdef _DEBUG
+ _LIT(KPanicCategory,"CStringList");
+
+ User::Panic(KPanicCategory, aPanic);
+#endif
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::Reset()
+// Resets iLines
+// -----------------------------------------------------------------------------
+//
+void CStringList::Reset()
+ {
+ iLines->Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::WriteL(const TDesC& aText)
+// Writes a string
+// -----------------------------------------------------------------------------
+//
+void CStringList::WriteL(const TDesC& aText)
+ {
+ iLines->AppendL(aText);
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::ReadPtr(TInt aIndex)
+// Returns pointer to the string
+// -----------------------------------------------------------------------------
+//
+TPtrC16 CStringList::ReadPtr(TInt aIndex)
+ {
+ if (aIndex<0 || aIndex>=Count())
+ {
+ Panic(KErrArgument);
+ }
+
+ return iLines->MdcaPoint(aIndex);
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::CopyL(CStringList* aSource, TInt aStart, TInt aStop)
+// Copies a string / strings
+// -----------------------------------------------------------------------------
+//
+void CStringList::CopyL(CStringList* aSource, TInt aStart, TInt aStop)
+ {
+ if (aStart<0 || aStop>=aSource->Count() || aStart>aStop)
+ {
+ Panic(KErrArgument);
+ }
+
+ for (TInt i=aStart; i<=aStop; i++)
+ {
+ WriteL(aSource->ReadPtr(i));
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::StrCopy(TDes& aTarget, const TDesC& aSource) const
+// Copies the string
+// -----------------------------------------------------------------------------
+//
+TBool CStringList::StrCopy(TDes& aTarget, const TDesC& aSource) const
+ {
+ TInt len=aTarget.MaxLength();
+ if(len<aSource.Length())
+ {
+ aTarget.Copy(aSource.Left(len));
+ return EFalse;
+ }
+ aTarget.Copy(aSource);
+ return ETrue;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::ReadFromFileL(const TDesC& aFileName)
+// Read strings from file.
+// -----------------------------------------------------------------------------
+//
+
+void CStringList::ReadFromFileL( RFs& aFs, const TDesC& aFileName )
+ {
+ InternalizeL( aFs, aFileName );
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::InternalizeL(const TDesC& aFileName)
+// Internalizes from file
+// -----------------------------------------------------------------------------
+//
+void CStringList::InternalizeL( RFs& aFs, const TDesC& aFileName )
+ {
+
+ RFile file;
+ User::LeaveIfError( file.Open( aFs, aFileName, EFileRead ) );
+ CleanupClosePushL( file );
+
+
+ TFileText textFile;
+ textFile.Set( file );
+ textFile.Seek( ESeekStart );
+ TBuf<KMaxSize> buffer;
+ TInt count(0);
+ for (;;)
+ {
+ count++;
+ if ( count > KMaxStringlistSize )
+ {
+ break;
+ }
+
+ buffer = KNullDesC;
+
+ //
+ // Read seems to read chars until newline is reached or
+ // the descriptor is full. In case descriptor becomes full,
+ // err is KErrTooBig and next read starts from the next line.
+ //
+ TInt err = textFile.Read( buffer );
+ if ( err == KErrEof )
+ {
+ break;
+ }
+
+ if ( err != KErrNone )
+ {
+ User::Leave( err );
+ }
+
+ iLines->AppendL( buffer );
+ }
+
+ CleanupStack::PopAndDestroy( &file ); // file
+ }
+
+
+// -----------------------------------------------------------------------------
+// CStringList::Mark() const
+// Returns the mark
+// -----------------------------------------------------------------------------
+//
+TInt CStringList::Mark() const
+ {
+ return iMark;
+ }
+
+// -----------------------------------------------------------------------------
+// CStringList::SetMark(TInt aMark)
+// Sets mark
+// -----------------------------------------------------------------------------
+//
+void CStringList::SetMark(TInt aMark)
+ {
+ iMark=aMark;
+ }
+
+// End of files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Controller build file.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/sconftp.loc MW_LAYER_LOC_EXPORT_PATH(sconftp.loc)
+
+PRJ_MMPFILES
+../bld/sconftp.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateCSConFTPL@@YAPAVCSConFTP@@XZ @ 1 NONAME ; class CSConFTP * CreateCSConFTPL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/bld/def/eabiuu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z15CreateCSConFTPLv @ 1 NONAME
+ _ZTI8CSConFTP @ 2 NONAME ; #<TI>#
+ _ZTV8CSConFTP @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/bld/sconftp.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Controller mmp file
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGET sconftp.dll
+TARGETTYPE DLL
+
+UID 0x10009D8D 0x101F968A
+
+#if defined(ARMCC)
+DEFFILE ./def/eabiu
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+SOURCEPATH ../src
+SOURCE sconfshandler.cpp
+SOURCE sconftp.cpp
+SOURCE sconinboxhandler.cpp
+
+USERINCLUDE ../../../inc
+USERINCLUDE ../inc
+USERINCLUDE ../../../cntparser/inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+START RESOURCE ../src/sconftp.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+LIBRARY efsrv.lib // For File server
+LIBRARY euser.lib // Base library
+LIBRARY IrObex.lib // For Object exchange
+LIBRARY obexutils.lib
+LIBRARY msgs.lib // For Inbox entry
+LIBRARY charconv.lib // For Unicode conversion
+LIBRARY bafl.lib // Basic Application Framework Library
+LIBRARY commonengine.lib // For resource reader
+LIBRARY platformenv.lib // For pathinfo
+LIBRARY CntParserServer.lib // for contacts
+LIBRARY directorylocalizer.lib // For localizing directories
+LIBRARY sysutil.lib
+LIBRARY centralrepository.lib
+DEBUGLIBRARY flogger.lib // For debug logging
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconconstants.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Common constants for PC Connectivity
+*
+*/
+
+
+#ifndef __SCONCONSTANTS_H
+#define __SCONCONSTANTS_H
+
+enum TSConProfile
+ {
+ EStandard = 0,
+ EProprietary,
+ EOther
+ };
+
+enum TSConUsedMedia
+ {
+ ESConNoMedia = 0,
+ ESConIRMedia,
+ ESConBTMedia,
+ ESConUSBMedia
+ };
+
+#endif // __SCONCONSTANTS_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconconsts.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Constant definitions for File Transfer Controller
+*
+*/
+
+
+#ifndef _SCONCONSTS_H_
+#define _SCONCONSTS_H_
+
+_LIT( K_C_ROOT, "C:\\" );
+
+// Following folders on MMC are exluded from folder listing
+_LIT( KSConResource, "resource\\" ); // resource folder on MMC
+_LIT( KSConSys, "sys\\" ); // sys folder on MMC
+_LIT( KSConPrivate, "private\\" ); // private folder on MMC
+_LIT( KSConSystem, "system\\" ); // system folder on MMC
+
+// Suite needs access to SuiteConf.xml file
+_LIT( KSConAllowedPath, "Z:\\Private\\101F7C87" );
+
+// For folder listing
+_LIT8( KSConXmlDocBegin,
+ "<?xml version=\"1.0\"?>\n<!DOCTYPE folder-listing SYSTEM \"obex-folder-listing.dtd\"\n [ <!ATTLIST folder mem-type CDATA #IMPLIED>\n <!ATTLIST folder label CDATA #IMPLIED> ]>\n<folder-listing version=\"1.0\">\n" );
+_LIT8( KSConXmlParentFolder, " <parent-folder />\n" );
+_LIT8( KSConXmlFileNameBegin," <file name=\"" );
+_LIT8( KSConXmlFolderNameBegin," <folder name=\"" );
+_LIT8( KSConXmlDriveNameBegin," <drive name=\"" );
+_LIT8( KSConXmlType,"\" type=\"" );
+_LIT8( KSConXmlModified,"\" modified=\"" );
+_LIT8( KSConXmlSize,"\" size=\"" );
+_LIT8( KSConXmlUserAttributes,"\" user-perm=\"" );
+_LIT8( KSConXmlMemoryType,"\" mem-type=\"" );
+_LIT8( KSConXmlMemoryLabel,"\" label=\"" );
+
+_LIT8( KSConXmlTypeWord, "x-epoc/x-app268450404" );
+_LIT8( KSConXmlTypeSheet, "x-epoc/x-app268450429" );
+
+_LIT8( KSConXmlUserEntryArchive,"RWD" );
+_LIT8( KSConXmlUserEntryReadOnly,"R" );
+_LIT8( KSConXmlUserEntryDrive, "RW" );
+
+_LIT8( KSConXmlFileEnd,"\"/>\n" );
+_LIT8( KSConXmlFolderListEnd,"</folder-listing>" );
+_LIT8( KSConDriveCName,"C:" );
+_LIT8( KSConDriveZName,"Z:" );
+_LIT8( KSConFolderListType, "x-obex/folder-listing" );
+
+const TInt KSConMemTypeMaxLength = 5;
+_LIT8( KSConMemoryTypeDev, "DEV" ); // prefix for device memory
+_LIT8( KSConMemoryTypeMmc, "MMC" ); // prefix for MMC memory
+
+// Date field format
+_LIT( KSConXmlDate, "%F%Y%M%DT%H%T%SZ" );
+const TInt KSConDateMaxLength = 16;
+
+//File extensions
+_LIT( KSConEpocWordExt, ".ewd" );
+_LIT( KSConEpocSheetExt, ".sht" );
+
+_LIT8( KFind1,"&" );
+_LIT8( KReplace1, "&" );
+_LIT8( KReplace2, "<" );
+_LIT8( KReplace3, ">" );
+_LIT8( KReplace4, """ );
+_LIT8( KReplace5, "'" );
+
+_LIT( KSConResourceName, "z:\\Resource\\sconftp.rsc" );
+
+const TInt KSConBufSize = 1024;
+const TInt KSConSetPathDontCreate = 0x01; // Flags used to indicate SetPath commands
+const TInt KSConSetPathRoot = 0x02; // Flags used to indicate SetPath commands
+const TInt KSConSetPathForward = 0x02; // Flags used to indicate SetPath commands
+const TInt KSConSetPathBack = 0x03; // Flags used to indicate SetPath commands
+const TInt KSConXmlBufSize = 30;
+const TInt KSConDriveNameLength = 2;
+const TInt KSConMaxMimeTypeLength = 25;
+const TInt KSConBufferSize = 262144; // 256KB
+
+const TUid KSConSheetUid = { 0x10003a7d }; // Sheet document uid
+const TUid KSConWordUid = { 0x10003a64 }; // Word document uid
+
+const TInt KDriveLength = 3;
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconfshandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConFSHandler header file
+*
+*/
+
+
+#ifndef _SCONFSHANDLER_H_
+#define _SCONFSHANDLER_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <obexobjects.h>
+
+
+// FORWARD DECLARATIONS
+class CDirectoryLocalizer;
+
+
+//============================================================
+// Class CSConFsHandler declaration
+//============================================================
+NONSHARABLE_CLASS( CSConFsHandler ) : public CBase
+ {
+ public:
+ static CSConFsHandler* NewL( RFs& aFs );
+ ~CSConFsHandler();
+ /**
+ * Parses folder and file listing from specified directory
+ * @param aBuffer Buffer to store the folder list
+ * @param aPathName Folder path
+ * @param aMemNumber memory number (1= DEV or MMC, 2= DEV2 or MMC2..)
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName,
+ const TInt aMemNumber );
+ /**
+ * Gets a file object
+ * @param aBuffer CObexFileObject object where the file will be stored
+ * @param aPathName The path of the file
+ * @param aFileName The name of the file
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt GetFileObjectL( CObexFileObject*& aBuffer, const TPtrC aPathName,
+ const TPtrC aFileName );
+ /**
+ * Stores a file object
+ * @param aFullPathName The full path and name of the file
+ * @param aTime The time stamp of the file
+ * @param aTempFileName Data temp file
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt SaveFileObjectL( const TPtrC aFullPathName, const TTime aTime,
+ const TPtrC aTempFileName );
+ /**
+ * Validates the file name
+ * @param aName File name to be validated
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt ValidateFileName( const TPtrC aName );
+ /**
+ * Creates a folder
+ * @param aFolderPath The name and the path of the folder
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt CreateFolderL( const TPtrC aFolderPath );
+ /**
+ * Removes a folder or a file
+ * @param aFullPath The path and name of the object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt DeleteObjectL( const TPtrC aFullPath );
+
+ /**
+ * Copy or Move file/folder
+ * @param aSource
+ * @param aTarget
+ * @param aUseCopyCommand if ETrue does copy, else does move.
+ * @return none.
+ */
+ void DoCopyOrMoveFileL( const TDesC& aSource, const TDesC& aTarget,
+ const TBool aUseCopyCommand );
+
+ /**
+ * Check if folder can be showed
+ * @param aFullPath The path of the object
+ * @return ETrue if folder exists and can be showed.
+ */
+ TBool IsFolderVisible( const TDesC& aFullPath );
+
+ private:
+ CSConFsHandler( RFs& aFs );
+ void ConstructL();
+ /**
+ * Updates the name of the data folder from a localized string
+ * @param none
+ * @return none
+ */
+ void GetDataPathNameL();
+
+ /**
+ * Check if folder is read only
+ * @param aFullPath The path of the object
+ * @return ETrue if folder is read only, or if folder does not exist
+ */
+ TBool IsFolderReadOnly( const TDesC& aFullPath ) const;
+ /**
+ * Check if folder can be deleted
+ * @param aFullPath The path of the object
+ * @return ETrue if folder can be deleted
+ */
+ TBool IsFolderDeletable( const TDesC& aFullPath ) const;
+ /**
+ * Get parent folder
+ * @param aFullPath The folder full path with or without backlash ending
+ * @param aParent The founded parent folder with backlash
+ * @return KErrNone if parent folder founded
+ */
+ TInt GetParentFolder( const TDesC& aFullPath, TDes& aParent);
+
+ /**
+ * Get folder (and subfolders) size
+ * @param aFullPath The folder full path with backlash ending
+ * @return folder total size
+ */
+ TInt64 GetFolderSizeL( const TDesC& aFullPath );
+
+ /**
+ * Replaces all special characters to xml compliant ones
+ * @param aDes characters to be checked and replaced
+ */
+ void ReplaceSpecialChars( TDes8& aDes );
+
+ /**
+ * Check if folder is exluded and cannot be shown to user
+ * @param aFullPath The full path with backlash ending
+ * @return ETrue if folder is exluded
+ */
+ TBool IsExludedPath( const TDesC& aFullPath ) const;
+
+ /**
+ * Prints folder information to obex-folder-list
+ */
+ void PrintFolderL( CBufFlat* aBuffer, TInt& aOffset, const TDesC& aParentPath,
+ const TDesC8& aMemType, const TEntry& aFolderEntry );
+ /**
+ * Prints file information to obex-folder-list
+ */
+ void PrintFileL( CBufFlat* aBuffer, TInt& aOffset, const TEntry& aFileEntry );
+
+ private:
+ RFs& iFs; // not own
+ CDirectoryLocalizer* iLocalizer;
+ TBuf8<KMaxFileName> iDataPathName; // Localized data path
+ };
+
+#endif
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconftp.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConFTP header file
+*
+*/
+
+
+#ifndef _SCONFTP_H_
+#define _SCONFTP_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <obexobjects.h>
+
+#include "sconconstants.h"
+
+class CSConInboxHandler;
+class CSConFsHandler;
+
+//============================================================
+// Class CSConFTP declaration
+//============================================================
+class CSConFTP : public CBase
+ {
+ public:
+ // construct / destruct
+ static CSConFTP* NewL();
+ ~CSConFTP();
+
+ // methods
+ /**
+ * Gets object that contains folder listing from inbox or file system
+ * @param aObject CObexBufObject object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ virtual TInt GetFolderObjectL( CObexBufObject*& aObject );
+
+ /**
+ * Gets object that contains a file from file system
+ * @param aFileObject CObexFileObject object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ virtual TInt GetFileObjectL( CObexFileObject*& aFileObject );
+
+ /**
+ * Initializes the receiving from the client.
+ * @param aObject CObexBufObject object
+ * @param aObject CBufFlat object
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt PutFileObjectInitL( CObexBufObject*& aObject,
+ CBufFlat*& aBuffer );
+
+ /**
+ * Stores the relayed file object to inbox or file system.
+ * @param aObject CObexBufObject object
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt PutFileObjectFinalizeL( CObexBufObject*& aObject );
+
+ /**
+ * Changes the current path. The path can point to inbox or file system
+ * @param aPathName The name of the new path
+ * @param aFlags Flag value of OBEX Setpath operation
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt SetPathL( const TPtrC aPathName, const TUint8 aFlags );
+
+ /**
+ * Creates a new folder to file system
+ * @param aFolderName The name of the folder to be created
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt CreateFolderL( const TPtrC aFolderName );
+
+ /**
+ * Deletes file/folder from inbox or file system
+ * @param aObjectName The name of the object (file or folder) to be created
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt DeleteObjectL( const TPtrC aObjectName );
+
+ /**
+ * Gets the current path
+ * @param aPath The name of the current path
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt GetPath( TDes& aPath );
+
+ /**
+ * Abort file transfer
+ * @param aObject The OBEX stack object which will reseted
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt AbortFileTransfer( CObexBufObject*& aObject );
+
+ /**
+ * Set used transfer profile
+ * @param aProfile The profile id
+ * @return none
+ */
+ virtual void SetProfile( TSConProfile aProfile );
+
+ /**
+ * Set backup status
+ * @param aValue Is backup started or not
+ * @return none
+ */
+ virtual void SetBackupStarted( TBool aValue );
+
+ /**
+ * Set the used media information
+ * @param aMedia The media which is currently used
+ * @return none
+ */
+ virtual void SetUsedMedia( TSConUsedMedia aMedia );
+
+ /**
+ * Check is current drive space below critical level
+ * @param aFilesize, additional free space needed
+ * @return ETrue if below critical
+ */
+ virtual TBool IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize = 0 );
+
+ /**
+ * Read received ConML protocol packet
+ * @param aBuffer The buffer for the data
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt ReadWBXMLDataL( CBufFlat*& aBuffer );
+
+ /**
+ * Delete OBEX stack's temp file
+ * @param none
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual void DeleteTempFile();
+
+ /**
+ * Move or rename file/folder
+ * @param aSource
+ * @param aTarget
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt MoveFile( const TDesC& aSource, const TDesC& aTarget );
+
+ /**
+ * Copy file/folder
+ * @param aSource
+ * @param aTarget
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt CopyFile( const TDesC& aSource, const TDesC& aTarget );
+
+ /**
+ * Set read-only attribute to file or folder
+ * @param aTarget file or folder fullname
+ * @param aReadOnly set read-only permission to ETrue or EFalse
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt SetReadOnly( const TDesC& aTarget, const TBool aReadOnly );
+
+ /**
+ * Set hidden attribute to file or folder
+ * @param aTarget file or folder fullname
+ * @param aHidden set read-only permission to ETrue or EFalse
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt SetHidden( const TDesC& aTarget, const TBool aHidden );
+
+ private:
+ // methods
+ /**
+ * Get absolute path from given relative foldername
+ * @param aFolderName relative or absolute filename
+ * @param aFullPath return absolete path of file/folder
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ virtual TInt GetAbsolutePath( const TDesC& aFolderName, TDes& aFullPath );
+
+ /**
+ * Checks if user can see/access to the drive
+ * @param aDriveNumber drive to be tested
+ * @return ETrue if user can see drive.
+ */
+ TBool IsDriveVisible( const TInt aDriveNumber );
+
+ /**
+ * Checks if user access to the current volume
+ * @param none
+ * @return ETrue if volume is ok.
+ */
+ TBool IsCurrentVolumeOK();
+
+ /**
+ * Go to (sub)directory
+ * @param aPath (sub)directory
+ * @param aFlags used to check if new folder(s) should be created
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ TInt SetPathForwardL( const TPtrC aPath, const TUint8 aFlags );
+
+ /**
+ * Go to parent directory
+ * @param aPath subdirectory under parent (additional)
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ TInt SetPathBackwardL( const TPtrC aPath );
+
+ /**
+ * Get volume name (Memory card name)
+ * @param aDriveNumber drive where to read
+ * @param aVolumeName if name found return volume name, else localised string
+ * @return KErrNone if no error, else system wide error codes.
+ */
+ TInt GetVolumeNameL(const TInt aDriveNumber, TDes8& aVolumeName);
+
+ /**
+ * Updates drive information (iCurrentDrive and iCurrentDriveTypeNumber)
+ * @param none
+ * @return none, leaves if error occurs.
+ */
+ void UpdateDriveTypeInfoL();
+
+ void CreateObexBufObjectL( CObexBufObject*& aObject, CBufFlat*& aBuffer );
+
+ CSConFTP();
+ virtual void ConstructL();
+
+ private:
+ CSConInboxHandler* iSConInboxHandler; // Object saving-fetching
+ CBufFlat* iBuffer; // Temporary buffer
+ CSConFsHandler* iSConFsHandler; // Object saving-fetching
+ TBuf<KObexObjectDescriptionSize> iPathName; // Path
+ TFileName iTempFileName; // Temp file name
+ RFs iFs;
+ TSConProfile iProfile; // Used profile
+ TBool iBackupStarted;
+ TSConUsedMedia iMedia;
+ TInt iCurrentDrive;
+ TInt iCurrentDriveTypeNumber; // DEV=1, DEV2=2, MMC=1, MMC2=2.
+ TInt iCriticalDiskLevel;
+ };
+
+ IMPORT_C CSConFTP* CreateCSConFTPL();
+ typedef CSConFTP* (*TSConCreateCSConFTPFunc) ();
+
+
+#endif // SCONFTP
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconinboxhandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConInboxHandler header file
+*
+*/
+
+
+#ifndef _SCONINBOXHANDLER_H_
+#define _SCONINBOXHANDLER_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <msvapi.h>
+
+
+//============================================================
+// Class CSConInboxHandler declaration
+//============================================================
+NONSHARABLE_CLASS( CSConInboxHandler ) : public CBase, MMsvSessionObserver
+ {
+ public:
+ static CSConInboxHandler* NewL();
+ virtual ~CSConInboxHandler();
+
+ /**
+ * Creates an attachment to device's Inbox
+ * @param aObject CObexBufObject object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt CreateInboxAttachmentL( CObexBufObject*& aObject,
+ CBufFlat*& aBuffer );
+ /**
+ * Saves the object to the Inbox
+ * @param aObject CObexBufObject object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt SaveObjToInboxL( CObexBufObject*& aObject );
+ /**
+ * Aborts the storing operation
+ * @param aObject CObexBufObject object
+ * @return KErrNone if no errors, else system wide error codes.
+ */
+ TInt AbortInboxOperation( CObexBufObject*& aObject );
+ /**
+ * Implementation of MMsvSessionObserver::HandleSessionEventL
+ * @param aEvent Indicates the event type.
+ * @param aArg1 Event type-specific argument value
+ * @param aArg2 Event type-specific argument value
+ * @param aArg3 Event type-specific argument value
+ * @return none
+ */
+ void HandleSessionEventL( TMsvSessionEvent aEvent,
+ TAny* aArg1,
+ TAny* aArg2,
+ TAny* aArg3 );
+
+ private:
+ CSConInboxHandler();
+
+ TInt GetMessageCenterDriveL();
+
+ private:
+ TInt iDrive;
+ TMsvId iMsvIdParent;
+ TMsvId iMsvIdAttach;
+ RFile iFile;
+};
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/loc/sconftp.loc Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Localization file for csconftp
+*
+*/
+
+
+//d:Default name for device
+//l:list_double_pane_t2_cp2
+#define qtn_secon_device "Phone"
+
+//d:Default name for memory card
+//l:list_double_pane_t2_cp2
+#define qtn_secon_mmc "Memory card"
+
+//d:Default name for mass storage
+//l:None
+//r:3.2
+#define qtn_secon_mass_storage "Mass memory"
+
+//d:Default name for data folder
+//l:None
+//r:3.2
+#define qtn_secon_data_folder "Personal files"
+
+// d: Value in a PC Suite dialog showing program details
+// l: None
+// r: 3.2
+#define qtn_secon_unknown_supplier "Unknown"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/src/sconfshandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1497 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Controller implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <stringresourcereader.h>
+#include <sconftp.rsg>
+#include <pathinfo.h>
+#include <connect/sbdefs.h> // to get backup/restore mode
+#include <driveinfo.h>
+#include <bautils.h>
+#include <sysutil.h>
+#include <CDirectoryLocalizer.h>
+
+#include "sconfshandler.h"
+#include "sconconsts.h"
+#include "irmcconsts.h"
+#include "cntparserclient.h"
+#include "cntparserinfolog.h"
+#include "debug.h"
+
+_LIT(KPhoneBookIrMCL2Request,"telecom/pb.vcf");
+_LIT(KInfoLogIrMCL2Request,"telecom/pb/info.log");
+_LIT(KInfoLogIrMCL2File,"IrMC\\info.log");
+_LIT(KInfoLogPathAndFileName,"c:\\IrMC\\info.log");
+_LIT(KPbPathAndFileName,"c:\\IrMC\\pb.vcf");
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConFsHandler* CSConFsHandler::NewL( RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ CSConFsHandler* self = new (ELeave) CSConFsHandler( aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::~CSConFsHandler()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConFsHandler::~CSConFsHandler()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iLocalizer;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName
+// , const TInt aMemNumber )
+// Parses folder and file listing from specified directory
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName,
+ const TInt aMemNumber )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL aPathName = %S", &aPathName );
+ if( aPathName.Length() == 0 )
+ {
+ LOGGER_WRITE( "CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName ) : No path" );
+ return KErrArgument;
+ }
+
+ if( aPathName.Length() > KDriveLength && !BaflUtils::FolderExists( iFs, aPathName ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::ParseFolderListL( CBufFlat* aBuffer, const TPtrC aPathName ) : Current folder doesn't exist any more" );
+ return KErrNotFound;
+ }
+
+ TInt driveNumber;
+ TInt err = iFs.CharToDrive(aPathName[0], driveNumber);
+ if( err )
+ {
+ LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL : CharToDrive err: %d", err );
+ return KErrNotFound;
+ }
+ TUint driveStatus;
+ err = DriveInfo::GetDriveStatus( iFs, driveNumber, driveStatus);
+ if( err )
+ {
+ LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL : DriveInfo::GetDriveStatus err: %d", err );
+ return KErrNotFound;
+ }
+
+ // check mem type (DEV, DEV2, MMC, MMC2..)
+ TBuf8<KSConMemTypeMaxLength> memType;
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ memType.Copy( KSConMemoryTypeDev );
+ if( aMemNumber > 1 )
+ {
+ memType.AppendNum(aMemNumber);
+ }
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ memType.Copy( KSConMemoryTypeMmc );
+ if( aMemNumber > 1 )
+ {
+ memType.AppendNum(aMemNumber);
+ }
+ }
+
+ CDir *entryList = 0;
+ CDir *dirList = 0;
+
+ // show only normal files and folders
+ TUint entryAttMask = KEntryAttNormal;
+
+
+ // get folders and files
+ err = iFs.GetDir( aPathName, entryAttMask, ESortByName,
+ entryList, dirList );
+
+ if ( err )
+ {
+ LOGGER_WRITE_1( "ParseFolderListL GetDir returned: %d", err );
+ return err;
+ }
+
+ CleanupStack::PushL( entryList );
+ CleanupStack::PushL( dirList );
+
+ TInt offset = 0;
+
+ LOGGER_WRITE( "CSConFsHandler::ParseFolderList XML creation" );
+ //Create folder XML
+ aBuffer->ResizeL( KSConXmlDocBegin().Length() );
+ aBuffer->Write( offset, KSConXmlDocBegin );
+ offset += KSConXmlDocBegin().Length();
+
+ aBuffer->ExpandL( offset, KSConXmlParentFolder().Length() );
+ aBuffer->Write( offset, KSConXmlParentFolder );
+ offset += KSConXmlParentFolder().Length();
+
+ HBufC* fullNameBuf = HBufC::NewLC( KMaxPath );
+ TPtr fullName = fullNameBuf->Des();
+
+ // Print folders to folder listing object
+ for( TInt i = 0; i < dirList->Count(); i++ )
+ {
+ const TEntry entry = ( *dirList )[i];
+
+ fullName.Copy( aPathName );
+ fullName.Append( entry.iName );
+ fullName.Append( KPathDelimiter );
+
+ // show path if not exluded
+ TBool proceed = !IsExludedPath( fullName );
+ if ( proceed )
+ {
+ PrintFolderL( aBuffer, offset, fullName, memType, entry );
+ }
+ }
+ CleanupStack::PopAndDestroy( fullNameBuf );
+ CleanupStack::PopAndDestroy( dirList );
+
+ LOGGER_WRITE("Print files");
+ // Print files to folder listing object
+ for( TInt j = 0; j < entryList->Count(); j++ )
+ {
+ const TEntry entry = ( *entryList )[j];
+ PrintFileL( aBuffer, offset, entry );
+ }
+ LOGGER_WRITE("files printed");
+ //Write the end of XML
+ aBuffer->ExpandL( offset, KSConXmlFolderListEnd().Length() );
+ aBuffer->Write( offset, KSConXmlFolderListEnd );
+ aBuffer->Compress();
+
+ CleanupStack::PopAndDestroy( entryList );
+
+ LOGGER_WRITE_1( "CSConFsHandler::ParseFolderListL() : returned %d", err );
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::PrintFolderL
+// Prints folder entry to folder listing object
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::PrintFolderL( CBufFlat* aBuffer, TInt& aOffset, const TDesC& aFullPath,
+ const TDesC8& aMemType, const TEntry& aFolderEntry )
+ {
+ TRACE_FUNC_ENTRY;
+ // initialize Localizer
+ iLocalizer->SetFullPath( aFullPath );
+
+ TBool dataPath( EFalse );
+ if ( aFullPath.CompareF( PathInfo::PhoneMemoryRootPath() ) == 0 ) // datapath
+ {
+ // printable folder is C:\Data (Localized)
+ dataPath = ETrue;
+ }
+
+ // print foldername
+ aBuffer->ExpandL( aOffset, KSConXmlFolderNameBegin().Length() );
+ aBuffer->Write( aOffset, KSConXmlFolderNameBegin );
+ aOffset += KSConXmlFolderNameBegin().Length();
+
+ HBufC8* folderBuf = HBufC8::NewLC( KMaxFileName );
+ TPtr8 folderName = folderBuf->Des();
+ User::LeaveIfError(
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( folderName, aFolderEntry.iName ) );
+
+ //Replace special characters
+ ReplaceSpecialChars( folderName );
+
+ aBuffer->ExpandL( aOffset, folderName.Length() );
+ aBuffer->Write( aOffset, folderName );
+ aOffset += folderName.Length();
+
+ CleanupStack::PopAndDestroy( folderBuf );
+
+ // print modified time
+ TBuf<KSConDateMaxLength> modifiedTime;
+ TTime time = aFolderEntry.iModified;
+ time.FormatL( modifiedTime, KSConXmlDate );
+
+ TBuf8<KSConDateMaxLength> modifiedTime8;
+ User::LeaveIfError(
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( modifiedTime8, modifiedTime ) );
+
+ aBuffer->ExpandL( aOffset, KSConXmlModified().Length() );
+ aBuffer->Write( aOffset, KSConXmlModified );
+ aOffset += KSConXmlModified().Length();
+
+ aBuffer->ExpandL( aOffset, modifiedTime8.Length() );
+ aBuffer->Write( aOffset, modifiedTime8 );
+ aOffset += modifiedTime8.Length();
+
+ // print attributes
+ aBuffer->ExpandL( aOffset, KSConXmlUserAttributes().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserAttributes );
+ aOffset += KSConXmlUserAttributes().Length();
+
+ // Add user-perm info
+ if( aFolderEntry.IsReadOnly() )
+ {
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryReadOnly().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly );
+ aOffset += KSConXmlUserEntryReadOnly().Length();
+ }
+ else if( iLocalizer->IsLocalized() || dataPath ) // delete disabled
+ {
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryDrive().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryDrive );
+ aOffset += KSConXmlUserEntryDrive().Length();
+ }
+ else
+ {
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryArchive().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryArchive );
+ aOffset += KSConXmlUserEntryArchive().Length();
+ }
+
+
+ // print memory type
+ aBuffer->ExpandL( aOffset, KSConXmlMemoryType().Length() );
+ aBuffer->Write( aOffset, KSConXmlMemoryType );
+ aOffset += KSConXmlMemoryType().Length();
+
+ aBuffer->ExpandL( aOffset, aMemType.Length() );
+ aBuffer->Write( aOffset, aMemType );
+ aOffset += aMemType.Length();
+
+ // print label if exists
+ if( iLocalizer->IsLocalized() )
+ {
+ //get localized folder name
+ HBufC8* labelBuf =
+ CnvUtfConverter::ConvertFromUnicodeToUtf8L( iLocalizer->LocalizedName() );
+ CleanupStack::PushL( labelBuf );
+ TPtrC8 label = labelBuf->Des();
+ //memory label
+ aBuffer->ExpandL( aOffset,
+ KSConXmlMemoryLabel().Length() );
+ aBuffer->Write( aOffset, KSConXmlMemoryLabel );
+ aOffset += KSConXmlMemoryLabel().Length();
+
+ aBuffer->ExpandL( aOffset, label.Length() );
+ aBuffer->Write( aOffset, label );
+ aOffset += label.Length();
+
+ CleanupStack::PopAndDestroy( labelBuf );
+ }
+ if ( dataPath ) // datapath
+ {
+ //memory label
+ aBuffer->ExpandL( aOffset,
+ KSConXmlMemoryLabel().Length() );
+ aBuffer->Write( aOffset, KSConXmlMemoryLabel );
+ aOffset += KSConXmlMemoryLabel().Length();
+
+ aBuffer->ExpandL( aOffset, iDataPathName.Length() );
+ aBuffer->Write( aOffset, iDataPathName );
+ aOffset += iDataPathName.Length();
+ }
+ // print ending
+ aBuffer->ExpandL( aOffset, KSConXmlFileEnd().Length() );
+ aBuffer->Write( aOffset, KSConXmlFileEnd );
+ aOffset += KSConXmlFileEnd().Length();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::PrintFileL
+// Prints file entry to folder listing object
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::PrintFileL( CBufFlat* aBuffer, TInt& aOffset, const TEntry& aFileEntry )
+ {
+ LOGGER_WRITE_1("CSConFsHandler::PrintFileL, filename: %S", &aFileEntry.iName );
+ HBufC8* fileBuf = HBufC8::NewLC( KMaxFileName );
+ TPtr8 fileName = fileBuf->Des();
+
+ User::LeaveIfError(
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( fileName, aFileEntry.iName ) );
+
+ //Replace special characters
+ ReplaceSpecialChars( fileName );
+
+ // print filename
+ aBuffer->ExpandL( aOffset, KSConXmlFileNameBegin().Length() );
+ aBuffer->Write( aOffset, KSConXmlFileNameBegin );
+ aOffset += KSConXmlFileNameBegin().Length();
+
+ aBuffer->ExpandL( aOffset, fileName.Length() );
+ aBuffer->Write( aOffset, fileName );
+ aOffset += fileName.Length();
+
+ // print size
+ aBuffer->ExpandL( aOffset, KSConXmlSize().Length() );
+ aBuffer->Write( aOffset, KSConXmlSize );
+ aOffset += KSConXmlSize().Length();
+
+ fileName.Delete( 0, fileName.Length() ); // re-use fileName descriptor
+ fileName.AppendNum( aFileEntry.iSize );
+ aBuffer->ExpandL( aOffset, fileName.Length() );
+ aBuffer->Write( aOffset, fileName );
+ aOffset += fileName.Length();
+
+ CleanupStack::PopAndDestroy( fileBuf );
+
+ // print modified
+ TBuf<KSConDateMaxLength> modifiedTime;
+ TTime time = aFileEntry.iModified;
+ time.FormatL( modifiedTime, KSConXmlDate );
+
+ TBuf8<KSConDateMaxLength> modifiedTime8;
+ User::LeaveIfError(
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( modifiedTime8, modifiedTime ) );
+
+
+ aBuffer->ExpandL( aOffset, KSConXmlModified().Length() );
+ aBuffer->Write( aOffset, KSConXmlModified );
+ aOffset += KSConXmlModified().Length();
+
+ aBuffer->ExpandL( aOffset, modifiedTime8.Length() );
+ aBuffer->Write( aOffset, modifiedTime8 );
+ aOffset += modifiedTime8.Length();
+
+ // attributes
+ aBuffer->ExpandL( aOffset, KSConXmlUserAttributes().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserAttributes );
+ aOffset += KSConXmlUserAttributes().Length();
+
+ if( aFileEntry.IsSystem() )
+ {
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryReadOnly().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly );
+ aOffset += KSConXmlUserEntryReadOnly().Length();
+ }
+ else if( aFileEntry.IsReadOnly() )
+ {
+ LOGGER_WRITE("was readonly" );
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryReadOnly().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryReadOnly );
+ aOffset += KSConXmlUserEntryReadOnly().Length();
+ }
+ else
+ {
+ aBuffer->ExpandL( aOffset,
+ KSConXmlUserEntryArchive().Length() );
+ aBuffer->Write( aOffset, KSConXmlUserEntryArchive );
+ aOffset += KSConXmlUserEntryArchive().Length();
+ }
+
+
+ //Word document
+ if ( aFileEntry.iType.IsPresent( KSConWordUid ) ||
+ aFileEntry.iName.Find( KSConEpocWordExt ) == aFileEntry.iName.Length() - 4 )
+ {
+ aBuffer->ExpandL( aOffset, KSConXmlType().Length() );
+ aBuffer->Write( aOffset, KSConXmlType );
+ aOffset += KSConXmlType().Length();
+
+ aBuffer->ExpandL( aOffset, KSConXmlTypeWord().Length() );
+ aBuffer->Write( aOffset, KSConXmlTypeWord );
+ aOffset += KSConXmlTypeWord().Length();
+ }
+ //Sheet document
+ else if ( aFileEntry.iType.IsPresent( KSConSheetUid ) ||
+ aFileEntry.iName.Find( KSConEpocSheetExt ) == aFileEntry.iName.Length() - 4 )
+ {
+ aBuffer->ExpandL( aOffset, KSConXmlType().Length() );
+ aBuffer->Write( aOffset, KSConXmlType );
+ aOffset += KSConXmlType().Length();
+
+ aBuffer->ExpandL( aOffset, KSConXmlTypeSheet().Length() );
+ aBuffer->Write( aOffset, KSConXmlTypeSheet );
+ aOffset += KSConXmlTypeSheet().Length();
+ }
+
+ aBuffer->ExpandL( aOffset, KSConXmlFileEnd().Length() );
+ aBuffer->Write( aOffset, KSConXmlFileEnd );
+ aOffset += KSConXmlFileEnd().Length();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject,
+// const TPtrC aPathName, const TPtrC aFileName )
+// Gets a file object
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject,
+ const TPtrC aPathName, const TPtrC aFileName )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_2( "CSConFsHandler::GetFileObjectL aFileName = %S aPathName = %S", &aFileName, &aPathName );
+
+ TInt ret( KErrNone );
+
+ if( ( aPathName.Length() == 0 || aFileName.Length() == 0 ) &&
+ !( aFileName==KPhoneBookIrMCL2Request ||
+ aFileName==KInfoLogIrMCL2Request ) )
+ {
+ return KErrArgument;
+ }
+
+ if( aPathName.Length() + aFileName.Length() > KMaxFileName )
+ {
+ return KErrAbort;
+ }
+
+ HBufC* pathBuf = HBufC::NewLC( KMaxFileName );
+ TPtr pathBufPtr = pathBuf->Des();
+
+ /*These modifiactions are mean to catch an IrMC L2 request.
+ If the request is made, then the requested phonebook file and
+ info log -file are created. Path and filename is also changed
+ to point to these created files.*/
+ if( aFileName == KPhoneBookIrMCL2Request ||
+ aFileName == KInfoLogIrMCL2Request )
+ {
+ LOGGER_WRITE( "CSConFsHandler: IrMC L2 request!" );
+ TInt err;
+ TInt status;
+ TInt contactsSaved = 0;
+ RCntParserServer cntParserServer;
+
+ err = cntParserServer.Connect();
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE( "CSConFsHandler: Cannot connect to the cntparserserver, ABORT!" );
+
+ CleanupStack::PopAndDestroy( pathBuf );
+ return KErrAbort;
+ }
+
+ LOGGER_WRITE( "CSConFsHandler: Time to call CreateIrMCL2PhoneBook" );
+ TBool force = ( aFileName == KInfoLogIrMCL2Request );
+ status=cntParserServer.CreateIrMCL2PhoneBook( KMaximumNumberOfContacts,
+ force );
+ LOGGER_WRITE_1( "CntParserServer.CreateIrMCL2PhoneBook returned %d", status );
+
+ //Check how many vcards were saved
+ contactsSaved = cntParserServer.ContactsSaved();
+ LOGGER_WRITE_1( "CntParserServer.ContactsSaved returned %d", contactsSaved );
+
+ err = cntParserServer.Disconnect();
+ LOGGER_WRITE_1( "CntParserServer.Disconnect() %d", err );
+ if( err != KErrNone )
+ {
+ CleanupStack::PopAndDestroy( pathBuf );
+ return KErrAbort;
+ }
+ //save info.log, if pb.vcf has changed (Note: KPBNotUpdated is returned
+ // if no changes made to pb.vcf)
+ if( status == KErrNone )
+ {
+ LOGGER_WRITE( "CSConFsHandler: Create info.log" );
+
+ CCntParserInfoLog* infoLog=CCntParserInfoLog::NewL();
+ CleanupStack::PushL( infoLog );
+ //see KMaximumNumberOfContacts for more details
+ infoLog->SetMaximumRecords( contactsSaved );
+ infoLog->SetTotalRecords( contactsSaved );
+ TFileName privatepath( K_C_ROOT );
+ privatepath.Append( KInfoLogIrMCL2File );
+ infoLog->SaveToFileL( privatepath );
+ CleanupStack::PopAndDestroy( infoLog );
+ }
+
+ if( aFileName == KInfoLogIrMCL2Request )
+ {
+ //Changes filename and path to info.log
+ pathBufPtr.Copy( KInfoLogPathAndFileName );
+ }
+ else
+ {
+ //Changes filename and path to pb.vcf
+ pathBufPtr.Copy( KPbPathAndFileName );
+ }
+ }
+ else
+ {
+ pathBufPtr.Copy( aPathName );
+ pathBufPtr.Append( aFileName );
+ }
+
+ LOGGER_WRITE( "CSConFsHandler::GetFileObjectL() : aFileObject->InitFromFileL( pathBufPtr )" );
+ TRAP( ret, aFileObject->InitFromFileL( pathBufPtr ) );
+ LOGGER_WRITE( "CSConFsHandler::GetFileObjectL() : aFileObject->InitFromFileL( pathBufPtr ) ok" );
+
+ CleanupStack::PopAndDestroy( pathBuf );
+
+ LOGGER_WRITE_1( "CSConFsHandler::GetFileObjectL( CObexFileObject*& aFileObject, const TPtrC aPathName, const TPtrC aFileName ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::SaveFileObjectL( const TPtrC aFullPathName, const TTime aTime,
+// const TPtrC aTempFileName )
+// Stores a file object
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::SaveFileObjectL( const TPtrC aFullPathName,
+ const TTime aTime, const TPtrC aTempFileName )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_2( "CSConFsHandler::SaveFileObjectL aFullPathName = %S aTempFileName = %S", &aFullPathName, &aTempFileName );
+
+ TInt ret( KErrNone );
+
+ if( aFullPathName.Length() == 0 )
+ {
+ iFs.Delete( aTempFileName );
+ return KErrPathNotFound;
+ }
+
+ ret = ValidateFileName( aFullPathName );
+
+ if( ret == KErrNone )
+ {
+ TUint attr;
+ TInt err = iFs.Att( BaflUtils::DriveAndPathFromFullName(aFullPathName), attr );
+ if ( err == KErrNone && attr & KEntryAttReadOnly )
+ {
+ // folder is read only, permission denied
+ iFs.Delete( aTempFileName );
+ ret = KErrAccessDenied;
+ }
+ else if( !BaflUtils::FileExists( iFs, aFullPathName ) )
+ {
+ // file does not exist, rename.
+ ret = iFs.Rename( aTempFileName, aFullPathName );
+
+ if( ret == KErrNone )
+ {
+ ret = iFs.SetModified( aFullPathName, aTime );
+ ret = KErrNone;
+ }
+ else
+ {
+ iFs.Delete( aTempFileName );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConFsHandler::SaveFileObjectL() file exists. replace" );
+ // file exists. Replace if not read-only file.
+ TUint attr;
+ ret = iFs.Att( aFullPathName, attr );
+ // Check permissions
+ if( ret == KErrNone && ( attr == KEntryAttNormal ||
+ attr == KEntryAttArchive ) && !(attr & KEntryAttReadOnly) )
+ {
+ ret = iFs.Replace( aTempFileName, aFullPathName );
+ LOGGER_WRITE_1( "CSConFsHandler::SaveFileObjectL() iFs.Replace ret %d", ret);
+ //Set correct time stamp
+ if( ret == KErrNone )
+ {
+ ret = iFs.SetModified( aFullPathName, aTime );
+ ret = KErrNone;
+ }
+ else
+ {
+ iFs.Delete( aTempFileName );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConFsHandler::SaveFileObjectL() no permissions" );
+ iFs.Delete( aTempFileName );
+ ret = KErrAccessDenied;
+ }
+ }
+ }
+ else
+ {
+ iFs.Delete( aTempFileName );
+ }
+
+ LOGGER_WRITE_1( "CSConFsHandler::SaveFileObjectL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::ValidateFileName( const TPtrC aName )
+// Validates the file name
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::ValidateFileName( const TPtrC aName )
+ {
+ TInt ret( KErrNone );
+
+ if( !iFs.IsValidName( aName ) )
+ {
+ ret = KErrBadName;
+ }
+
+ LOGGER_WRITE_1( "CSConFsHandler::ValidateFileName( const TPtrC aName ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::CreateFolderL( const TPtrC aFolderPath )
+// Creates a folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::CreateFolderL( const TPtrC aFolderPath )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret( KErrNone );
+
+ if( aFolderPath.Length() == 0 )
+ {
+ return KErrArgument;
+ }
+ if( aFolderPath.Length() > KMaxPath )
+ {
+ return KErrAbort;
+ }
+ if( BaflUtils::PathExists( iFs, aFolderPath ) )
+ {
+ return KErrAlreadyExists;
+ }
+ // get restore mode
+ TBool restoreInProgress( EFalse );
+ RProperty backupProperty;
+ TInt burState( 0 );
+ TInt burErr = backupProperty.Get( KUidSystemCategory, conn::KUidBackupRestoreKey, burState );
+ const conn::TBURPartType partType =
+ static_cast< conn::TBURPartType >( burState & conn::KBURPartTypeMask );
+ if( burErr == KErrNone &&
+ ( partType == conn::EBURRestorePartial || partType == conn::EBURRestoreFull ) )
+ {
+ // restore mode
+ LOGGER_WRITE( "CSConFsHandler::CreateFolderL() restore mode" );
+ restoreInProgress = ETrue;
+ }
+
+ // check permissions if not restore mode
+ if ( !restoreInProgress )
+ {
+ if ( IsExludedPath( aFolderPath ) )
+ {
+ // user has no access to this folder
+ LOGGER_WRITE( "CSConFsHandler::CreateFolderL() KErrAccessDenied" );
+ return KErrAccessDenied;
+ }
+
+ // user can create whole folder path at once and we need to check that
+ // user has permission to create folders. We need to find first folder that
+ // should be created, and see if parent folder has read-only permission.
+
+ HBufC* fullPath = HBufC::NewLC( KMaxFileName );
+ TPtr fullPathPtr = fullPath->Des();
+
+ fullPathPtr.Copy(aFolderPath);
+ TBool parentFound(EFalse);
+ LOGGER_WRITE( "CSConFsHandler::CreateFolder() start loop" );
+ TInt err(KErrNone);
+ while (!parentFound && err==KErrNone)
+ {
+ err = GetParentFolder( fullPathPtr, fullPathPtr );
+ if( err == KErrNone )
+ {
+ if (BaflUtils::PathExists( iFs, fullPathPtr ))
+ {
+ parentFound = ETrue;
+ TUint attr;
+ ret = iFs.Att( fullPathPtr, attr );
+ if ( ret == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem) )
+ {
+ // parent folder is read-only
+ LOGGER_WRITE( "CSConFsHandler::CreateFolderL() KErrAccessDenied" );
+ err = KErrAccessDenied;
+ }
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( fullPath );
+ if ( err == KErrAccessDenied )
+ {
+ return KErrAccessDenied;
+ }
+ }
+
+ ret = iFs.MkDirAll( aFolderPath );
+ LOGGER_WRITE_1( "CSConFsHandler::CreateFolderL( const TPtrC aFolderPath ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::DeleteObjectL( const TPtrC aFullPath )
+// Removes a folder or a file
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::DeleteObjectL( const TPtrC aFullPath )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aFullPath: %S", &aFullPath);
+ TInt ret( KErrNone );
+
+ if( aFullPath.Length() == 0 )
+ {
+ return KErrArgument;
+ }
+
+ if( aFullPath.Length() > KMaxFileName )
+ {
+ return KErrAbort;
+ }
+
+ TUint attr;
+ // get source folder permissions.
+ ret = iFs.Att( BaflUtils::DriveAndPathFromFullName(aFullPath), attr );
+ if ( ret == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) )
+ {
+ return KErrAccessDenied;
+ }
+
+
+ // Check file/folder permissions
+ ret = iFs.Att( aFullPath, attr );
+ if ( ret == KErrNone && ( attr & KEntryAttReadOnly || attr & KEntryAttSystem ) )
+ {
+ return KErrAccessDenied;
+ }
+
+ TBool isFolder(EFalse);
+ ret = BaflUtils::IsFolder( iFs, aFullPath, isFolder );
+
+ if( isFolder && ret == KErrNone )
+ {
+ HBufC* fullPath = HBufC::NewLC( KMaxFileName );
+ TPtr fullPathPtr = fullPath->Des();
+
+ fullPathPtr.Copy( aFullPath );
+ //check if there is a slash at the end
+ if( fullPathPtr.LocateReverse( KPathDelimiter ) != fullPathPtr.Length()-1 )
+ {
+ fullPathPtr.Append( KPathDelimiter );
+ }
+
+ if ( !IsFolderVisible( fullPathPtr ) )
+ {
+ LOGGER_WRITE("folder was not visible");
+ CleanupStack::PopAndDestroy( fullPath );
+ return KErrNotFound;
+ }
+ else if ( !IsFolderDeletable( fullPathPtr ) )
+ {
+ LOGGER_WRITE("folder was not deletable");
+ CleanupStack::PopAndDestroy( fullPath );
+ return KErrAccessDenied;
+ }
+
+ ret = iFs.RmDir( fullPathPtr );
+ LOGGER_WRITE_1("iFs.RmDir err: %d", ret);
+ //delete non-empty folder
+ if( ret != KErrNone )
+ {
+ CFileMan* fileMan = CFileMan::NewL( iFs );
+ CleanupStack::PushL( fileMan );
+ // if directory contains read-only files, those files are not deleted
+ // and KErrAccessDenied is returned.
+ ret = fileMan->RmDir( fullPathPtr );
+ LOGGER_WRITE_1("fileMan->RmDir err: %d", ret);
+ CleanupStack::PopAndDestroy( fileMan ); //fileman
+ }
+ if( ret == KErrNone )
+ {
+ // check is delete operation really succesfully completed
+ if( BaflUtils::PathExists( iFs, fullPathPtr ) )
+ {
+ // Folder still exist, return error
+ // KErrBadName mapped to precondition failed error.
+ ret = KErrBadName;
+ }
+ }
+ CleanupStack::PopAndDestroy( fullPath ); //fullPath
+ }
+ else if (ret == KErrNone)
+ {
+ // deleting file
+ if ( IsExludedPath( aFullPath ) )
+ {
+ LOGGER_WRITE("Cannot delete from specified folder, return KErrAccessDenied");
+ ret = KErrAccessDenied;
+ }
+ else
+ {
+ ret = iFs.Delete( aFullPath );
+ }
+ }
+
+
+
+ LOGGER_WRITE_1( "CSConFsHandler::DeleteObjectL() : returned %d", ret );
+ return ret;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::CopyOrMoveFile()
+// Copy or Move file/folder.
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::DoCopyOrMoveFileL( const TDesC& aSource, const TDesC& aTarget,
+ const TBool aUseCopyCommand)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt lastError(KErrNone);
+ TBool isFolder;
+
+ if( !iFs.IsValidName( aSource ) || !iFs.IsValidName( aTarget ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Not valid name" );
+ User::Leave( KErrBadName );
+ }
+
+ // will leave if source (file/folder) does not exists.
+ User::LeaveIfError( BaflUtils::IsFolder(iFs, aSource, isFolder ) );
+
+ // Check source file/folder permissions
+ TUint attr;
+ User::LeaveIfError( iFs.Att( aSource, attr ) );
+ if ( !aUseCopyCommand && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : no permissions, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+
+ HBufC* sourceFolderBuf = HBufC::NewLC( KMaxFileName );
+ TPtr sourceFolder = sourceFolderBuf->Des();
+ HBufC* targetFolderBuf = HBufC::NewLC( KMaxFileName );
+ TPtr targetFolder = targetFolderBuf->Des();
+
+ sourceFolder.Copy( BaflUtils::DriveAndPathFromFullName(aSource) );
+ targetFolder.Copy( BaflUtils::DriveAndPathFromFullName(aTarget) );
+
+
+ // check disk space
+ TInt driveNumber;
+
+ User::LeaveIfError( iFs.CharToDrive(targetFolder[0], driveNumber) );
+
+ TVolumeInfo volumeInfo;
+ TInt err = iFs.Volume(volumeInfo, driveNumber);
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : iFs.Volume err %d", err );
+ User::Leave( KErrNotFound );
+ }
+
+ if( !isFolder )
+ {
+ // file handling routines
+ if( !IsFolderVisible( aSource ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current folder doesn't exist" );
+ User::Leave( KErrNotFound );
+ }
+ else if( !aUseCopyCommand && IsFolderReadOnly( sourceFolder ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : folder read only, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+
+ // source file is ok, check target
+
+ if( !IsFolderVisible( targetFolder ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current target file/folder doesn't exist" );
+ User::Leave( KErrNotFound );
+ }
+ else if( IsFolderReadOnly( targetFolder ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : folder read only, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+ else
+ {
+ TBool diskFull( EFalse );
+ TEntry fileEntry;
+ User::LeaveIfError( iFs.Entry( aSource, fileEntry ) );
+ if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, fileEntry.iSize, driveNumber ) )
+ {
+ diskFull = ETrue;
+ }
+
+ // target ok, ready to copy or move
+ CFileMan* fileMan=CFileMan::NewL(iFs);
+ CleanupStack::PushL(fileMan);
+
+ if( aUseCopyCommand )
+ {
+ if( diskFull )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" );
+ User::Leave( KErrDiskFull );
+ }
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy file" );
+ User::LeaveIfError( fileMan->Copy( aSource, aTarget, 0 ) );
+ }
+ else
+ {
+ if( aSource.Find( aTarget.Left(2) ) == KErrNone)
+ {
+ // same drive
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Rename file" );
+ User::LeaveIfError( fileMan->Rename( aSource, aTarget, 0 ) );
+ }
+ else
+ {
+ // different drive
+ if( diskFull )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" );
+ User::Leave( KErrDiskFull );
+ }
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : copy file" );
+ User::LeaveIfError( fileMan->Copy( aSource, aTarget, 0 ) );
+
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : delete original" );
+ User::LeaveIfError( fileMan->Delete( aSource, 0 ) );
+ }
+ }
+ CleanupStack::PopAndDestroy( fileMan ); // fileMan
+ }
+ }
+ else
+ {
+ // set trailing backslash after the final directory name
+ HBufC* tmpSourceBuf = HBufC::NewLC( KMaxFileName );
+ TPtr tmpSourcePtr = tmpSourceBuf->Des();
+ HBufC* tmpTargetBuf = HBufC::NewLC( KMaxFileName );
+ TPtr tmpTargetPtr = tmpTargetBuf->Des();
+
+ tmpSourcePtr.Copy( aSource );
+ if( tmpSourcePtr.LocateReverse( KPathDelimiter ) != tmpSourcePtr.Length()-1 )
+ {
+ tmpSourcePtr.Append( KPathDelimiter );
+ }
+
+ tmpTargetPtr.Copy( aTarget );
+ if( tmpTargetPtr.LocateReverse( KPathDelimiter ) != tmpTargetPtr.Length()-1 )
+ {
+ tmpTargetPtr.Append( KPathDelimiter );
+ }
+
+ if( !IsFolderVisible( tmpSourcePtr ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current folder doesn't exist" );
+ User::Leave( KErrNotFound );
+ }
+ else if( !aUseCopyCommand && IsFolderReadOnly( sourceFolder ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : sourcefolder read only, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+ else if( !aUseCopyCommand && !IsFolderDeletable( tmpSourcePtr ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : source folder read only, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+ else if( !IsFolderVisible( targetFolder ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Current target base-folder doesn't exist" );
+ User::Leave( KErrNotFound );
+ }
+ else if( IsFolderReadOnly( targetFolder) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : target folder read only, abort" );
+ User::Leave( KErrAccessDenied );
+ }
+ else if( BaflUtils::FolderExists(iFs, tmpTargetPtr ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : target folder exist, abort" );
+ User::Leave( KErrAlreadyExists );
+ }
+ else if ( tmpTargetPtr.Find( tmpSourcePtr ) == KErrNone )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : conflict, abort" );
+ User::Leave( KErrInUse );
+ }
+ else
+ {
+ // is folder empty
+ TBool emptyFolder( ETrue );
+ CDir *entryList = 0;
+ CDir *dirList = 0;
+
+ User::LeaveIfError( iFs.GetDir( tmpSourcePtr, KEntryAttNormal, EDirsAnyOrder,
+ entryList, dirList ) );
+ if( entryList->Count() > 0 || dirList->Count() > 0 )
+ {
+ emptyFolder = EFalse;
+ }
+
+ delete entryList;
+ delete dirList;
+
+ // get folder size
+ TBool diskFull( EFalse );
+ if( !emptyFolder )
+ {
+ TInt64 folderSize = GetFolderSizeL(tmpSourcePtr);
+ LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : folderSize: %d", folderSize );
+ if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iFs, folderSize, driveNumber ) )
+ {
+ diskFull = ETrue;
+ }
+ }
+
+
+ CFileMan* fileMan = CFileMan::NewL(iFs);
+ CleanupStack::PushL(fileMan);
+
+ // ready to copy or move
+ if( aUseCopyCommand )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy folder" );
+ if( emptyFolder )
+ {
+ // folder is empty, can't copy folder. Create new empty folder.
+ User::LeaveIfError( iFs.MkDir( tmpTargetPtr ) );
+ }
+ else
+ {
+ // folder not empty
+ if( diskFull )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" );
+ User::Leave( KErrDiskFull );
+ }
+
+ User::LeaveIfError(
+ fileMan->Copy( aSource, aTarget, CFileMan::ERecurse ) );
+ if( lastError == KErrNone )
+ {
+ lastError = fileMan->GetLastError();
+ }
+ }
+
+ TUint attr;
+ TInt err = iFs.Att( tmpSourcePtr, attr );
+ if ( err == KErrNone && (attr & KEntryAttReadOnly ) )
+ {
+ //set read only attribute
+ err = iFs.SetAtt( tmpTargetPtr, KEntryAttReadOnly, KEntryAttArchive );
+ if (err != KErrNone)
+ {
+ // can't set attribute
+ LOGGER_WRITE_1( "CSConFsHandler::DoCopyOrMoveFileL : iFs.SetAtt err: %d",err );
+ }
+ }
+ }
+ else
+ {
+ if( aSource.FindF( aTarget.Left(2) ) == KErrNone)
+ {
+ // same drive
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Rename folder" );
+ User::LeaveIfError( fileMan->Rename( aSource, aTarget, 0 ) );
+ }
+ else
+ {
+ // different drive
+ if( diskFull )
+ {
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : disk full" );
+ User::Leave( KErrDiskFull );
+ }
+
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : Copy folder" );
+ if( emptyFolder )
+ {
+ // folder is empty, can't copy empty folder. Create empty folder.
+ User::LeaveIfError( iFs.MkDir( tmpTargetPtr ) );
+ }
+ else
+ {
+ User::LeaveIfError(
+ fileMan->Copy( aSource, aTarget, CFileMan::ERecurse ) );
+ }
+ // copy completed, delete original folder.
+ LOGGER_WRITE( "CSConFsHandler::DoCopyOrMoveFileL : delete original" );
+ User::LeaveIfError( fileMan->RmDir( tmpSourcePtr ) );
+ // check was delete operation succesfully completed
+ if( BaflUtils::PathExists( iFs, tmpSourcePtr ) )
+ {
+ // Folder still exist, return error
+ lastError = KErrAccessDenied;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(fileMan); // fileMan
+ }
+ CleanupStack::PopAndDestroy(tmpTargetBuf); // tmpTargetBuf
+ CleanupStack::PopAndDestroy(tmpSourceBuf); // tmpSourceBuf
+ }
+
+ CleanupStack::PopAndDestroy( targetFolderBuf );
+ CleanupStack::PopAndDestroy( sourceFolderBuf );
+
+ if( lastError != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConFTP::DoCopyOrMoveFileL() : lastError: %d", lastError );
+ User::Leave( lastError );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::IsFolderVisible()
+// Check if folder can be showed
+// -----------------------------------------------------------------------------
+//
+TBool CSConFsHandler::IsFolderVisible( const TDesC& aFullPath )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFullPath: %S", &aFullPath );
+ TBool visible(EFalse);
+
+ if( !BaflUtils::FolderExists( iFs, aFullPath ) )
+ {
+ LOGGER_WRITE( "CSConFsHandler::IsFolderVisible() notExist ret EFalse" );
+ return EFalse;
+ }
+
+ // don't show if folder is exluded
+ visible = !IsExludedPath( aFullPath );
+ LOGGER_WRITE_1( "CSConFsHandler::IsFolderVisible() : end, ret %d", (TInt)visible );
+ return visible;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::IsFolderReadOnly()
+// Check if folder is read only (system folder)
+// -----------------------------------------------------------------------------
+//
+TBool CSConFsHandler::IsFolderReadOnly( const TDesC& aFullPath ) const
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFullPath: %S", &aFullPath );
+ TBool readOnly(EFalse);
+
+ // C-drive root is read only, but there are some exceptions
+
+ readOnly = IsExludedPath( aFullPath );
+
+ if ( aFullPath.CompareF( K_C_ROOT ) == 0 )
+ {
+ // Root of C-drive is read-only
+ LOGGER_WRITE("Root of C-Drive is read only");
+ readOnly = ETrue;
+ }
+
+ // Check folder permissions
+ TUint attr;
+ TInt err = iFs.Att( aFullPath, attr );
+ LOGGER_WRITE_1("iFs.Att err: %d", err);
+ if ( err == KErrNone && (attr & KEntryAttReadOnly || attr & KEntryAttSystem ) )
+ {
+ LOGGER_WRITE("Folder is readonly");
+ readOnly = ETrue;
+ }
+
+ LOGGER_WRITE_1( "CSConFsHandler::IsFolderReadOnly() : end, ret %d", (TInt)readOnly );
+ return readOnly;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::IsFolderDeletable()
+// Check if folder can be deleted. Localized folders cannot delete.
+// In C-drive folders can be deleted only from under C:\\Data\\
+// -----------------------------------------------------------------------------
+//
+TBool CSConFsHandler::IsFolderDeletable( const TDesC& aFullPath ) const
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFullPath: %S", &aFullPath );
+ TBool deleteAllowed(ETrue);
+ TPath PhoneMem( PathInfo::PhoneMemoryRootPath() ); // "C:\\Data\\"
+
+ if ( aFullPath.CompareF( PhoneMem ) == 0 )
+ {
+ // C:\\Data\\
+ LOGGER_WRITE( "CSConFsHandler::IsFolderDeletable() datapath, ret EFalse" );
+ deleteAllowed = EFalse;
+ }
+ else if ( IsExludedPath( aFullPath ) )
+ {
+ deleteAllowed = EFalse;
+ }
+
+ iLocalizer->SetFullPath( aFullPath );
+ if ( iLocalizer->IsLocalized() ) // delete disabled
+ {
+ // Cannot delete localized paths (default paths)
+ deleteAllowed = EFalse;
+ }
+
+ LOGGER_WRITE_1( "CSConFsHandler::IsFolderDeletable() : end, ret %d", (TInt)deleteAllowed );
+ return deleteAllowed;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::GetParentFolder( const TPtrC aFullPath, TDes& aParent)
+// Get parent folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFsHandler::GetParentFolder( const TDesC& aFullPath, TDes& aParent)
+ {
+ TRACE_FUNC_ENTRY;
+ if (aFullPath.LocateReverse(KPathDelimiter) == aFullPath.Length()-1 )
+ {
+ // remove backlash
+ aParent.Copy(aFullPath.Left(aFullPath.Length()-1));
+ }
+ else
+ {
+ aParent.Copy(aFullPath);
+ }
+
+ TInt pos = aParent.LocateReverse(KPathDelimiter);
+ if (pos != KErrNotFound)
+ {
+ aParent.Copy(aParent.Left(pos+1));
+ LOGGER_WRITE( "CSConFsHandler::GetParentFolder : end KErrNone" );
+ return KErrNone;
+ }
+ else
+ {
+ LOGGER_WRITE_1( "CSConFsHandler::GetParentFolder : end err %d", pos);
+ return pos;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::CSConFsHandler()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConFsHandler::CSConFsHandler( RFs& aFs ) : iFs(aFs)
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iLocalizer = CDirectoryLocalizer::NewL();
+
+ GetDataPathNameL();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::GetDataPathNameL()
+// Updates the name of the data folder from a localized string
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::GetDataPathNameL()
+ {
+ TRACE_FUNC_ENTRY;
+ //Read memory string and convert it
+ TFileName file( KSConResourceName );
+
+ BaflUtils::NearestLanguageFile( iFs, file );
+
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+ CleanupStack::PushL( reader );
+
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( iDataPathName,
+ reader->ReadResourceString( R_SECON_DATA_FOLDER ) );
+
+ CleanupStack::PopAndDestroy( reader );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::GetFolderSizeL()
+// Get folder (and subfolders) size
+// -----------------------------------------------------------------------------
+//
+TInt64 CSConFsHandler::GetFolderSizeL( const TDesC& aFullPath )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFullPath: %S", &aFullPath );
+ TInt64 totalSize(0);
+ CDir* dir( NULL );
+
+ User::LeaveIfError( iFs.GetDir(aFullPath, KEntryAttMatchMask, ESortByName, dir) );
+ CleanupStack::PushL(dir);
+ for( TInt i=0; i<dir->Count(); ++i )
+ {
+ TEntry entry = (*dir)[i];
+ if( !entry.IsDir() )
+ {
+ // file
+ totalSize += entry.iSize;
+ }
+ else
+ {
+ // folder
+ HBufC* subfolderBuf = HBufC::NewLC( KMaxPath );
+ TPtr subfolderPtr = subfolderBuf->Des();
+
+ subfolderPtr.Copy(aFullPath);
+ subfolderPtr.Append(entry.iName);
+ subfolderPtr.Append( KPathDelimiter );
+
+ LOGGER_WRITE( "CSConFsHandler::GetFolderSizeL() : get subfolder size" );
+ totalSize += GetFolderSizeL( subfolderPtr );
+ CleanupStack::PopAndDestroy( subfolderBuf );
+ }
+ }
+ CleanupStack::PopAndDestroy(dir);
+ TRACE_FUNC_EXIT;
+ return totalSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::ReplaceSpecialChars()
+// Replace special characters to xml compliant
+// -----------------------------------------------------------------------------
+//
+void CSConFsHandler::ReplaceSpecialChars( TDes8& aDes )
+ {
+ for( TInt i = 0; i < aDes.Length(); i++ )
+ {
+ switch( aDes[i] )
+ {
+ case '&':
+ aDes.Delete( i, 1 );
+ aDes.Insert( i, KReplace1 );
+ break;
+ case '<':
+ aDes.Delete( i, 1 );
+ aDes.Insert( i, KReplace2 );
+ break;
+ case '>':
+ aDes.Delete( i, 1 );
+ aDes.Insert( i, KReplace3 );
+ break;
+ case '"':
+ aDes.Delete( i, 1 );
+ aDes.Insert( i, KReplace4 );
+ break;
+ case '\'':
+ aDes.Delete( i, 1 );
+ aDes.Insert( i, KReplace5 );
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFsHandler::IsExludedPath()
+// Some folders are exluded from user access
+// -----------------------------------------------------------------------------
+//
+TBool CSConFsHandler::IsExludedPath( const TDesC& aFullPath ) const
+ {
+ TInt exluded(ETrue);
+ LOGGER_WRITE_1( "aFullPath: %S", &aFullPath );
+ TPath mmcRoot( PathInfo::MemoryCardRootPath() );
+ if ( aFullPath.Length() == KDriveLength )
+ {
+ // root paths not exluded
+ exluded = EFalse;
+ }
+ else if ( aFullPath.FindF( K_C_ROOT ) == 0 )
+ {
+ if ( aFullPath.FindF( PathInfo::PhoneMemoryRootPath() ) == 0 )
+ {
+ // C:\\Data is visible, not exluded
+ exluded = EFalse;
+ }
+ else {
+ // other paths on C-drive are exluded
+ LOGGER_WRITE_1("CSConFsHandler::IsExludedPath() Path '%S' is not visible to user", &aFullPath);
+ exluded = ETrue;
+ }
+ }
+ // hide undesired folders from E: root level
+ else if( aFullPath.CompareF( mmcRoot ) == 0 )
+ {
+ if ( aFullPath.FindF( KSConSys ) == KDriveLength )
+ {
+ LOGGER_WRITE( "hiding mmcRoot KSConSys" );
+ exluded = ETrue;
+ }
+ else if( aFullPath.FindF( KSConResource ) == KDriveLength )
+ {
+ LOGGER_WRITE( "hiding mmcRoot KSConResource" );
+ exluded = ETrue;
+ }
+ else if( aFullPath.FindF( KSConPrivate ) == KDriveLength )
+ {
+ LOGGER_WRITE( "mmcRoot KSConPrivate" );
+ exluded = ETrue;
+ }
+ else if( aFullPath.FindF( KSConSystem ) == KDriveLength )
+ {
+ LOGGER_WRITE( "hiding mmcRoot KSConSystem" );
+ exluded = ETrue;
+ }
+ }
+ // end of E: root level handling
+ else
+ {
+ // don't exlude paths from other drives
+ exluded = EFalse;
+ }
+ return exluded;
+ }
+
+// End of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/src/sconftp.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1588 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Controller implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <pathinfo.h>
+#include <stringresourcereader.h>
+#include <bautils.h>
+#include <driveinfo.h>
+#include <sconftp.rsg>
+#include <centralrepository.h>
+#include <sysutildomaincrkeys.h>
+
+#include "debug.h"
+#include "sconftp.h"
+#include "sconfshandler.h"
+#include "sconinboxhandler.h"
+#include "sconconsts.h"
+
+const TInt KPackageSize = 65536;
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CreateCSConFTPL()
+// Entry to CSConFTP
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConFTP* CreateCSConFTPL()
+ {
+ TRACE_FUNC;
+ return CSConFTP::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConFTP* CSConFTP::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConFTP* self = new (ELeave) CSConFTP();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::~CSConFTP()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConFTP::~CSConFTP()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iSConInboxHandler;
+ iSConInboxHandler = NULL;
+ delete iSConFsHandler;
+ iSConFsHandler = NULL;
+ delete iBuffer;
+ iBuffer = NULL;
+
+ iFs.Delete( iTempFileName );
+ iFs.Close();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList )
+// Gets object that contains folder listing from inbox or file system
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret( KErrNone );
+ TInt offset = 0;
+ TChar driveLetter;
+ TBuf8<KSConDriveNameLength> tmpBuf8;
+
+ iBuffer->Reset();
+
+ //default folder list - lists all available drives, inbox
+ if( iPathName.Length() == 0 )
+ {
+ TInt devDriveCount = 0;
+ TInt mmcDriveCount = 0;
+
+ iBuffer->ResizeL( KSConXmlDocBegin().Length() );
+ iBuffer->Write( offset, KSConXmlDocBegin );
+ offset += KSConXmlDocBegin().Length();
+
+ //Write all drivers to folderlisting object
+ TDriveList driveList;
+ // Get all drives that are visible to the user.
+ TInt driveCount;
+ User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) );
+
+ for( TInt i = EDriveA; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) );
+ LOGGER_WRITE_1( "DriveInfo for drive: %d", i);
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt
+ || (driveStatus & DriveInfo::EDriveRemote) )
+ {
+ LOGGER_WRITE_1( "skip drive %d", i);
+ continue;
+ }
+
+ User::LeaveIfError( iFs.DriveToChar( i, driveLetter ) );
+
+ //Letter to uppercase form.
+ driveLetter.UpperCase();
+
+ //Folder begin
+ iBuffer->ExpandL( offset,
+ KSConXmlFolderNameBegin().Length() );
+ iBuffer->Write( offset, KSConXmlFolderNameBegin );
+ offset += KSConXmlFolderNameBegin().Length();
+
+ iBuffer->ExpandL( offset, KSConDriveCName().Length() );
+
+ tmpBuf8.Delete( 0, tmpBuf8.Length() );
+ tmpBuf8.Append( driveLetter );
+ tmpBuf8.Append( KDriveDelimiter );
+
+ iBuffer->Write( offset, tmpBuf8 );
+ offset += KSConDriveNameLength;
+
+ //permission
+ iBuffer->ExpandL( offset,
+ KSConXmlUserAttributes().Length() );
+ iBuffer->Write( offset, KSConXmlUserAttributes );
+ offset += KSConXmlUserAttributes().Length();
+ if( driveStatus & DriveInfo::EDriveInternal && devDriveCount==0 )
+ {
+ //permission always R for first internal drive
+ iBuffer->ExpandL( offset,
+ KSConXmlUserEntryReadOnly().Length() );
+ iBuffer->Write( offset, KSConXmlUserEntryReadOnly );
+ offset += KSConXmlUserEntryReadOnly().Length();
+ }
+ else
+ {
+ //permission always RW
+ iBuffer->ExpandL( offset,
+ KSConXmlUserEntryDrive().Length() );
+ iBuffer->Write( offset, KSConXmlUserEntryDrive );
+ offset += KSConXmlUserEntryDrive().Length();
+ }
+
+ //memory type
+ iBuffer->ExpandL( offset,
+ KSConXmlMemoryType().Length() );
+ iBuffer->Write( offset, KSConXmlMemoryType );
+ offset += KSConXmlMemoryType().Length();
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ LOGGER_WRITE( "DriveInfo::EDriveInternal" );
+ // DEV type
+ devDriveCount++;
+ if( devDriveCount > 1 )
+ {
+ // DEV2
+ TBuf8<KSConMemTypeMaxLength> memType;
+ memType.Copy( KSConMemoryTypeDev );
+ memType.AppendNum(devDriveCount);
+ iBuffer->ExpandL( offset, memType.Length() );
+ iBuffer->Write( offset, memType );
+ offset += memType.Length();
+ }
+ else
+ {
+ // DEV
+ iBuffer->ExpandL( offset,
+ KSConMemoryTypeDev().Length() );
+ iBuffer->Write( offset, KSConMemoryTypeDev );
+ offset += KSConMemoryTypeDev().Length();
+ }
+ }
+ if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ LOGGER_WRITE( "DriveInfo::EDriveRemovable" );
+ // MMC type
+ mmcDriveCount++;
+ if( mmcDriveCount > 1 )
+ {
+ // MMC2
+ TBuf8<KSConMemTypeMaxLength> memType;
+ memType.Copy( KSConMemoryTypeMmc );
+ memType.AppendNum(mmcDriveCount);
+ iBuffer->ExpandL( offset, memType.Length() );
+ iBuffer->Write( offset, memType );
+ offset += memType.Length();
+ }
+ else
+ {
+ // MMC
+ iBuffer->ExpandL( offset,
+ KSConMemoryTypeMmc().Length() );
+ iBuffer->Write( offset, KSConMemoryTypeMmc );
+ offset += KSConMemoryTypeMmc().Length();
+ }
+ }
+
+ //memory label
+ iBuffer->ExpandL( offset,
+ KSConXmlMemoryLabel().Length() );
+ iBuffer->Write( offset, KSConXmlMemoryLabel );
+ offset += KSConXmlMemoryLabel().Length();
+
+ TInt err( KErrNotFound );
+ TBuf8<KMaxFileName> volumeName;
+ if( driveStatus & DriveInfo::EDriveRemovable || devDriveCount == 1 )
+ {
+ // get Volume name for C-drive(Phone) and E-drive(MMC)
+ err = GetVolumeNameL( i, volumeName );
+ }
+ else
+ {
+ // Get localized name for DEV2 (Mass memory)
+ //Read memory string and convert it
+ TFileName file( KSConResourceName );
+
+ BaflUtils::NearestLanguageFile( iFs, file );
+
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( volumeName,
+ reader->ReadResourceString( R_SECON_VALUE_MASS_STORAGE ) );
+
+ delete reader;
+ err = KErrNone;
+ }
+
+ if ( err == KErrNone )
+ {
+ iBuffer->ExpandL( offset,
+ volumeName.Length() );
+ iBuffer->Write( offset, volumeName );
+ offset += volumeName.Length();
+ }
+
+ //Write the end of filelist to folderlisting object
+ iBuffer->ExpandL( offset, KSConXmlFileEnd().Length() );
+ iBuffer->Write( offset, KSConXmlFileEnd );
+ offset += KSConXmlFileEnd().Length();
+ }
+ }
+ //Write the end of folderlist to folderlisting object
+ iBuffer->ExpandL( offset, KSConXmlFolderListEnd().Length() );
+ iBuffer->Write( offset, KSConXmlFolderListEnd );
+ iBuffer->Compress();
+ }
+ else
+ {
+ if( IsCurrentVolumeOK() )
+ {
+ ret = iSConFsHandler->ParseFolderListL( iBuffer, iPathName, iCurrentDriveTypeNumber );
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+ }
+
+ //Put data to aObjectList
+ delete aObjectList;
+ aObjectList = NULL;
+
+ aObjectList = CObexBufObject::NewL( iBuffer );
+ aObjectList->SetTypeL( KSConFolderListType );
+ aObjectList->SetLengthL( iBuffer->Size() );
+
+ LOGGER_WRITE_1( "CSConFTP::GetFolderObjectL( CObexBufObject*& aObjectList ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::GetFileObjectL( CObexFileObject*& aFileObject )
+// Gets object that contains a file from file system
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::GetFileObjectL( CObexFileObject*& aFileObject )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret( KErrNone );
+
+ if( aFileObject->Name().Length() == 0 )
+ {
+ return KErrBadName;
+ }
+
+ // check is current drive ok
+ if( iPathName.Length() > 0 )
+ {
+ TPath path( KSConAllowedPath );
+ path.Append( KPathDelimiter );
+ if( iPathName.CompareF( path ) != 0 )
+ {
+ // was normal path (not KSConAllowedPath)
+ if( !IsCurrentVolumeOK() )
+ {
+ return KErrNotFound;
+ }
+ }
+ }
+
+ HBufC* nameBuf = HBufC::NewLC( KMaxFileName );
+ TPtr namePtr = nameBuf->Des();
+ namePtr.Append( aFileObject->Name() );
+
+ if( namePtr.LocateReverse( KPathDelimiter ) == namePtr.Length()-1 )
+ {
+ namePtr.Delete( namePtr.Length()-1, 1 );
+ }
+
+ ret = iSConFsHandler->GetFileObjectL( aFileObject, iPathName, namePtr );
+
+ CleanupStack::PopAndDestroy( nameBuf );
+
+ LOGGER_WRITE_1( "CSConFTP::GetFileObjectL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject,
+// CBufFlat*& aBuffer )
+// Initializes the receiving from the client.
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject,
+ CBufFlat*& aBuffer )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ RFile file;
+
+ TBool lowMemory = IsCurrentDiskSpaceBelowCritical();
+
+ //if Inbox then save temp file to default drive
+ if( iPathName.Length() == 0 )
+ {
+ //When proprietary profile (PC Suite), doesn't allow to use Inbox
+ if( iProfile == EProprietary )
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : iProfile EProprietary" );
+ ret = file.Temp( iFs, PathInfo::PhoneMemoryRootPath(), iTempFileName,
+ EFileWrite | EFileShareExclusive );
+ file.Close();
+
+ if( ret == KErrNone )
+ {
+ CreateObexBufObjectL( aObject, aBuffer );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : not EProprietary" );
+ if( lowMemory )
+ {
+ // do not even try to save
+ LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : disk full" );
+ ret = KErrNoMemory;
+ }
+ else
+ {
+ ret = iSConInboxHandler->CreateInboxAttachmentL( aObject, aBuffer );
+ }
+ }
+
+ return ret;
+ }
+ else
+ {
+ LOGGER_WRITE_1("iPathName: %S", &iPathName);
+ // check is current drive ok
+ if( !IsCurrentVolumeOK() )
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : drive not visible" );
+ ret = KErrNotFound;
+ }
+ else
+ {
+ ret = file.Temp( iFs, iPathName, iTempFileName, EFileWrite |
+ EFileShareExclusive );
+ }
+ }
+
+ file.Close();
+
+ if( ret == KErrNone )
+ {
+ CreateObexBufObjectL( aObject, aBuffer );
+
+ if( lowMemory )
+ {
+ // return error. it's up to pccon/ftp plugin howto handle it..
+ LOGGER_WRITE( "CSConFTP::PutFileObjectInitL() : low memory" );
+ ret = KErrNoMemory;
+ }
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::PutFileObjectInitL( CObexBufObject*& aObject, CBufFlat*& aBuffer ) : returned %d", ret );
+ return ret;
+ }
+
+void CSConFTP::CreateObexBufObjectL( CObexBufObject*& aObject, CBufFlat*& aBuffer )
+ {
+ delete aObject;
+ aObject = NULL;
+ aObject = CObexBufObject::NewL( NULL );
+
+ delete aBuffer;
+ aBuffer = NULL;
+
+ aBuffer = CBufFlat::NewL( KSConBufferSize );
+ aBuffer->ResizeL( KSConBufferSize );
+
+ TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName,
+ CObexBufObject::EDoubleBuffering );
+ TRAPD( err, aObject->SetDataBufL( bufferdetails ));
+ if ( err == KErrNoMemory )
+ {
+ LOGGER_WRITE( "KErrNoMemory, Using singe buffer strategy");
+ // If fails, use singe buffer strategy to save RAM
+ TObexFilenameBackedBuffer lowMemBufferdetails( *aBuffer, iTempFileName,
+ CObexBufObject::ESingleBuffering );
+ aObject->SetDataBufL( lowMemBufferdetails );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject )
+// Stores the relayed file object to inbox or file system.
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ // if iPathName is not defined trying to save to inbox, no need to call IsCurrentVolumeOK()
+ if( iPathName.Length() > 0 && !IsCurrentVolumeOK() )
+ {
+ // Memory card removed
+ LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : disk err, return KErrNotFound" );
+ return KErrNotFound;
+ }
+ else if ( iPathName.Length() + aObject->Name().Length() > KMaxFileName )
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : Too long filename, return KErrBadName");
+ return KErrBadName;
+ }
+
+ TBool lowMemory = IsCurrentDiskSpaceBelowCritical();
+ if ( lowMemory )
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL() : Low memory, return KErrNoMemory");
+ return KErrNoMemory;
+ }
+
+ HBufC* fullPathBuf = HBufC::NewLC( KMaxFileName );
+ TPtr fullPathPtr = fullPathBuf->Des();
+ fullPathPtr.Copy( iPathName );
+ fullPathPtr.Append( aObject->Name() );
+
+ // Save to inbox if path is not set.
+ if( iPathName.Length() == 0 )
+ {
+ LOGGER_WRITE( "CSConFTP::PutFileObjectFinalizeL before SaveObjectToInbox" );
+ ret = iSConInboxHandler->SaveObjToInboxL( aObject );
+ LOGGER_WRITE_1( "CSConFTP::PutFileObjectFinalize SaveObjectToInbox returned %d", ret );
+ }
+ else if( iPathName.CompareF( K_C_ROOT ) == 0 )
+ {
+ // Saving to root of C:\ is not allowed
+ ret = KErrAccessDenied;
+ }
+ //Save to file system
+ else
+ {
+ TTime time = aObject->Time();
+
+ // UTC offset
+ time -= User::UTCOffset();
+
+ delete aObject;
+ aObject = NULL;
+
+ ret = iSConFsHandler->SaveFileObjectL( fullPathPtr, time,
+ iTempFileName );
+ }
+
+ CleanupStack::PopAndDestroy( fullPathBuf );
+
+ LOGGER_WRITE_1( "CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject ) : returned %d", ret );
+
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags )
+// Changes the current path. The path can point to inbox or file system
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aPath: %S", &aPath );
+ TInt ret( KErrNone );
+
+ if( ( aPath.Length() > 0 && aFlags != KSConSetPathRoot )
+ || ( iPathName.Length() == KDriveLength && aFlags == KSConSetPathBack) )
+ {
+ // check is current drive ok
+ if( !IsCurrentVolumeOK() )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathL() : drive not found" );
+ return KErrNotFound;
+ }
+ }
+
+ ret = KErrNotFound;
+
+ //path forward, deny access to forbidden directories and drives
+ if( aPath.Length() > 0
+ && ( iPathName.Length() + aPath.Length() < KMaxFileName )
+ && ( aFlags == KSConSetPathForward || aFlags == KSConSetPathDontCreate ) )
+ {
+ ret = SetPathForwardL( aPath, aFlags );
+ }
+ //path backward
+ else if( aFlags == KSConSetPathBack )
+ {
+ ret = SetPathBackwardL( aPath );
+ }
+ //path root
+ else if( aPath.Length() == 0 && aFlags == KSConSetPathRoot )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathL() : KSConSetPathRoot" );
+ if( iPathName.Length() > 0 )
+ {
+ iPathName.Delete( 0, iPathName.Length() );
+ }
+ iCurrentDrive = KErrNotFound;
+ ret = KErrNone;
+ }
+
+ if( ret == KErrNone )
+ {
+ // drive may have changed, update info
+ UpdateDriveTypeInfoL();
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::CSConFTP::SetPathL( const TPtrC aPath, const TUint8 aFlags ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetPathForwardL( const TPtrC aPath, const TUint8 aFlags )
+// Set path forward
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::SetPathForwardL( const TPtrC aPath, const TUint8 aFlags )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret(KErrNone);
+ HBufC* fullPath = HBufC::NewLC( KMaxFileName );
+ TPtr fullPathPtr = fullPath->Des();
+
+ if( iPathName.Length() == 0 )
+ {
+ fullPathPtr.Copy( aPath );
+ }
+ else
+ {
+ fullPathPtr.Copy( iPathName );
+ fullPathPtr.Append( aPath );
+ }
+ LOGGER_WRITE_1( "fullPathPtr: %S", &fullPathPtr );
+ // now fullpath is new path
+ // check validity
+ if( fullPathPtr.Length() < 2 || fullPathPtr[1] != KDriveDelimiter )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathForwardL() : not valid name" );
+ CleanupStack::PopAndDestroy( fullPath );
+ return KErrNotFound;
+ }
+
+ if( fullPathPtr.CompareF( KSConAllowedPath ) == 0 )
+ {
+ // Always access to PC Suite configuration file on ROM
+ LOGGER_WRITE( "CSConFTP::SetPathForwardL() : KSConAllowedPath" );
+ iPathName.Copy( fullPathPtr );
+ if( iPathName[iPathName.Length()-1] != KPathDelimiter )
+ {
+ iPathName.Append( KPathDelimiter );
+ }
+
+ CleanupStack::PopAndDestroy( fullPath );
+ return KErrNone;
+ }
+
+ // check drive
+ TInt driveNumber;
+ TInt err = iFs.CharToDrive( fullPathPtr[0], driveNumber );
+ if( err != KErrNone || !IsDriveVisible( driveNumber ) )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" );
+ CleanupStack::PopAndDestroy( fullPath );
+ return KErrNotFound;
+ }
+
+ // check folder and create it if needed
+ if( fullPathPtr.Length() > 2 )
+ {
+ TBool isFolder = EFalse;
+ err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder );
+ if( err != KErrNone )
+ {
+ isFolder = EFalse;
+ }
+ LOGGER_WRITE_1( "CSConFTP::SetPathForwardL() IsFolder: %d", (TInt)isFolder );
+
+ if( !isFolder )
+ {
+ //if "Don't create" is 1
+ if( aFlags & 2 )
+ {
+ ret = KErrNotFound;
+ }
+ else
+ {
+ CreateFolderL( fullPathPtr );
+ ret = KErrNone;
+ }
+ }
+ else
+ {
+ ret = KErrNone;
+ }
+ }
+ else
+ {
+ ret = KErrNone;
+ }
+
+ if( ret == KErrNone )
+ {
+ iPathName.Copy( fullPathPtr );
+
+ if( iPathName[iPathName.Length()-1] != KPathDelimiter )
+ {
+ iPathName.Append( KPathDelimiter );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( fullPath );
+ LOGGER_WRITE_1( "CSConFTP::SetPathForwardL() : end, ret: %d", ret );
+ return ret;
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetPathBackwardL( const TPtrC aPath )
+// Set path backward
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::SetPathBackwardL( const TPtrC aPath )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret(KErrNotFound);
+ if( iPathName.Length() == 0 )
+ {
+ // already in root, exit
+ LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : already in root" );
+ LOGGER_WRITE_1( "CSConFTP::SetPathBackwardL() : end, ret: %d", ret );
+ return ret;
+ }
+ TInt pos;
+ TBool isFolder(EFalse);
+ HBufC* fullPath = HBufC::NewLC( KMaxFileName );
+ TPtr fullPathPtr = fullPath->Des();
+
+ //no directory/folder name
+ if( aPath.Length() == 0 )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : no new path, goto parent" );
+ iPathName.Delete( iPathName.Length()-1, 1 );
+ pos = iPathName.LocateReverse( KPathDelimiter );
+ iPathName.Delete( pos+1, iPathName.Length()-pos );
+ ret = KErrNone;
+ }
+ //if folder name
+ else if( aPath.Locate( KDriveDelimiter ) != 1 && iPathName.Length() > KDriveLength )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathBackwardL() : goto parent and new path" );
+ fullPathPtr.Copy( iPathName );
+ fullPathPtr.Delete( fullPathPtr.Length()-1, 1 );
+ pos = fullPathPtr.LocateReverse( KPathDelimiter );
+ fullPathPtr.Delete( pos+1, fullPathPtr.Length()-pos );
+ fullPathPtr.Append( aPath );
+
+ if( fullPathPtr.CompareF( KSConAllowedPath ) == 0 )
+ {
+ // Always access to PC Suite configuration file on ROM
+ isFolder = ETrue;
+ }
+ else
+ {
+ TInt driveNumber;
+ TInt err = iFs.CharToDrive(fullPathPtr[0], driveNumber);
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" );
+ isFolder = EFalse;
+ }
+ else if( !IsDriveVisible(driveNumber) )
+ {
+ isFolder = EFalse;
+ }
+ else
+ {
+ // drive ok, check folder.
+ err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder );
+ if( err != KErrNone )
+ {
+ isFolder = EFalse;
+ }
+ }
+ }
+
+ if( isFolder )
+ {
+ iPathName.Copy( fullPathPtr );
+
+ if( aPath.LocateReverse( KPathDelimiter ) != aPath.Length()-1 )
+ {
+ iPathName.Append( KPathDelimiter );
+ }
+
+ ret = KErrNone;
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+
+ }
+ //drive
+ else if( aPath.Locate( KDriveDelimiter ) == 1 )
+ {
+ fullPathPtr.Copy( aPath );
+ if( fullPathPtr.LocateReverse( KPathDelimiter )
+ != fullPathPtr.Length()-1 )
+ {
+ fullPathPtr.Append( KPathDelimiter );
+ }
+
+ TFileName tempPath( KSConAllowedPath );
+ tempPath.Append(KPathDelimiter);
+ if( fullPathPtr.CompareF( tempPath ) == 0 )
+ {
+ // Always access to PC Suite configuration file on ROM
+ isFolder = ETrue;
+ }
+ else
+ {
+ TInt driveNumber;
+ TInt err = iFs.CharToDrive(fullPathPtr[0], driveNumber);
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE( "CSConFTP::SetPathForwardL() : drive err" );
+ isFolder = EFalse;
+ }
+ else if( !IsDriveVisible(driveNumber) )
+ {
+ isFolder = EFalse;
+ }
+ else
+ {
+ // drive ok, check folder.
+ err = BaflUtils::IsFolder( iFs, fullPathPtr, isFolder );
+ if( err != KErrNone )
+ {
+ isFolder = EFalse;
+ }
+ }
+ }
+
+ if( isFolder )
+ {
+ iPathName.Copy( fullPathPtr );
+
+ if( aPath.LocateReverse( KPathDelimiter ) != aPath.Length()-1 )
+ {
+ iPathName.Append( KPathDelimiter );
+ }
+
+ ret = KErrNone;
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+ }
+ CleanupStack::PopAndDestroy( fullPath );
+ LOGGER_WRITE_1( "CSConFTP::SetPathBackwardL() : end, ret: %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::CreateFolderL( const TPtrC aFolderName )
+// Creates a new folder to file system
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::CreateFolderL( const TPtrC aFolderName )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFolderName: %S", &aFolderName );
+ TInt ret( KErrNone );
+ if( aFolderName.Length() == 0 )
+ {
+ return KErrArgument;
+ }
+
+ HBufC* pathBuf = HBufC::NewLC( KMaxFileName );
+ TPtr pathBufPtr = pathBuf->Des();
+ //absolute folder path
+ if( aFolderName.Length() > 1 && aFolderName[1] == KDriveDelimiter )
+ {
+ if ( iPathName.Length()>0 )
+ {
+ LOGGER_WRITE( "CSConFTP::CreateFolderL() : KErrBadName" );
+ CleanupStack::PopAndDestroy( pathBuf );
+ return KErrBadName;
+ }
+ pathBufPtr.Copy( aFolderName );
+ }
+ else
+ {
+ pathBufPtr.Copy( iPathName );
+ pathBufPtr.Append( aFolderName );
+ }
+
+ if( !iFs.IsValidName( pathBufPtr ) )
+ {
+ ret = KErrBadName;
+ }
+ else
+ {
+ // check drive
+ TInt driveNumber;
+ ret = iFs.CharToDrive(pathBufPtr[0], driveNumber);
+ if( ret != KErrNone || !IsDriveVisible(driveNumber) )
+ {
+ LOGGER_WRITE( "CSConFTP::CreateFolderL() : drive err" );
+ ret = KErrNotFound;
+ }
+ }
+
+ if ( ret == KErrNone )
+ {
+ if( pathBufPtr.LocateReverse( KPathDelimiter ) != pathBufPtr.Length()-1 )
+ {
+ pathBufPtr.Append( KPathDelimiter );
+ }
+ ret = iSConFsHandler->CreateFolderL( pathBufPtr );
+ }
+
+ if( ret == KErrNone || ret == KErrAlreadyExists )
+ {
+ ret = SetPathL( aFolderName, KSConSetPathForward );
+ }
+
+ CleanupStack::PopAndDestroy( pathBuf );
+
+ LOGGER_WRITE_1( "CSConFTP::CreateFolderL( const TPtrC aFolderName ) : returned %d", ret );
+
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::DeleteObjectL( const TPtrC aObjectName )
+// Deletes file/folder from inbox or file system
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::DeleteObjectL( const TPtrC aObjectName )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aObjectName: %S", &aObjectName );
+ TInt ret( KErrNone );
+ TFileName tmpTarget;
+ HBufC* targetBuf = HBufC::NewLC( KMaxFileName );
+ TPtr target = targetBuf->Des();
+
+ //absolute folder path
+ if( aObjectName.Length() > 1 && aObjectName[1] == KDriveDelimiter )
+ {
+ if ( iPathName.Length()>0 )
+ {
+ LOGGER_WRITE( "CSConFTP::DeleteObjectL() : KErrBadName" );
+ CleanupStack::PopAndDestroy( targetBuf );
+ return KErrBadName;
+ }
+ target.Copy( aObjectName );
+ }
+ else
+ {
+ target.Copy( iPathName );
+ target.Append( aObjectName );
+ }
+
+ if( !iFs.IsValidName( target ) )
+ {
+ ret = KErrBadName;
+ }
+ else
+ {
+ TInt driveNumber;
+ ret = iFs.CharToDrive(target[0], driveNumber);
+ if( ret != KErrNone || !IsDriveVisible(driveNumber) )
+ {
+ LOGGER_WRITE( "CSConFTP::DeleteObjectL() : drive err" );
+ ret = KErrNotFound;
+ }
+ }
+
+
+ if ( ret == KErrNone )
+ {
+ ret = iSConFsHandler->DeleteObjectL( target );
+ }
+
+ CleanupStack::PopAndDestroy( targetBuf );
+
+ LOGGER_WRITE_1( "CSConFTP::DeleteObjectL( const TPtrC aObjectName ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::GetPath( TDes& aPath )
+// Gets the current path
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::GetPath( TDes& aPath )
+ {
+ TRACE_FUNC;
+ aPath.Copy( iPathName );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::AbortFileTransfer( CObexBufObject*& aObject )
+// Abort file transfer
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::AbortFileTransfer( CObexBufObject*& aObject )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+
+ if( iPathName.Length() == 0 )
+ {
+ iSConInboxHandler->AbortInboxOperation( aObject );
+ }
+
+ //aObject has to be deleted, otherwise the temp file is locked
+ delete aObject;
+ aObject = NULL;
+
+ err = iFs.Delete( iTempFileName );
+
+ LOGGER_WRITE_1( "CSConFTP::AbortFileTransfer( CObexBufObject*& aObject ) : iFs.Delete() err: %d", err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetProfile( TInt aProfile )
+// Set used transfer profile
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::SetProfile( TSConProfile aProfile )
+ {
+ TRACE_FUNC;
+ iProfile = aProfile;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetBackupStarted( TBool aValue )
+// Set backup status
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::SetBackupStarted( TBool aValue )
+ {
+ TRACE_FUNC;
+ iBackupStarted = aValue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetUsedMedia( TSConUsedMedia aMedia )
+// Set the used media information
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::SetUsedMedia( TSConUsedMedia aMedia )
+ {
+ TRACE_FUNC;
+ iMedia = aMedia;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize )
+// Check is current disk space below critical level.
+// -----------------------------------------------------------------------------
+//
+TBool CSConFTP::IsCurrentDiskSpaceBelowCritical( TUint32 aFilesize )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFilesize: %d", aFilesize );
+ TInt drive;
+ TInt err;
+
+ if( iCurrentDrive != KErrNotFound )
+ {
+ drive = iCurrentDrive;
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : drive not specified, use default drive" );
+ err = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive );
+ if( err )
+ {
+ LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCriticaL() : DriveInfo::GetDefaultDrive err %d", err );
+ return ETrue; //exit
+ }
+ }
+
+ // check disk space
+ LOGGER_WRITE_1( "drive: %d", drive );
+ TVolumeInfo volumeInfo;
+ err = iFs.Volume(volumeInfo, drive);
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : iFs.Volume err %d", err );
+ LOGGER_WRITE( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : End" );
+ return ETrue; //exit
+ }
+ LOGGER_WRITE_1( "volumeInfo.iFree: %Ld", volumeInfo.iFree );
+ TBool diskLevelCritical( EFalse );
+ if ( volumeInfo.iFree - aFilesize <= iCriticalDiskLevel )
+ {
+ // Can not write the data, there's not enough free space on disk.
+ diskLevelCritical = ETrue;
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::IsCurrentDiskSpaceBelowCritical() : ret %d",
+ (TInt)diskLevelCritical );
+ return diskLevelCritical;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::ReadWBXMLDataL( CBufFlat*& aBuffer )
+// Read received ConML protocol packet
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::ReadWBXMLDataL( CBufFlat*& aBuffer )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ RFile file;
+ TInt fileSize;
+
+ ret = file.Open( iFs, iTempFileName, EFileRead|EFileShareAny );
+ CleanupClosePushL( file );
+ if( ret == KErrNone )
+ {
+ file.Size( fileSize );
+
+ delete aBuffer;
+ aBuffer = NULL;
+
+ HBufC8* wbxmlDataBuf = HBufC8::NewLC( fileSize );
+ TPtr8 wbxmlDataPtr = wbxmlDataBuf->Des();
+
+ file.Read( wbxmlDataPtr );
+
+ aBuffer = CBufFlat::NewL( KSConBufSize );
+ aBuffer->ExpandL( 0, fileSize );
+ aBuffer->Write( 0, wbxmlDataPtr );
+
+ CleanupStack::PopAndDestroy( wbxmlDataBuf );
+ }
+ CleanupStack::PopAndDestroy( &file );
+ LOGGER_WRITE_1( "CSConFTP::ReadWBXMLData( CBufFlat*& aBuffer ) : WBXML packet size: %d", fileSize );
+
+ LOGGER_WRITE_1( "CSConFTP::ReadWBXMLData( CBufFlat*& aBuffer ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::DeleteTempFile()
+// Delete OBEX stack's temp file
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::DeleteTempFile()
+ {
+ TRACE_FUNC_ENTRY;
+ iFs.Delete( iTempFileName );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::MoveFile()
+// Move file/folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::MoveFile(const TDesC& aSource, const TDesC& aTarget)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err;
+ TFileName tmpSource;
+ TFileName tmpTarget;
+ err = GetAbsolutePath( aSource, tmpSource );
+ if( err == KErrNone )
+ {
+ err = GetAbsolutePath( aTarget, tmpTarget );
+ }
+
+ if( err == KErrNone )
+ {
+ TInt sourceDrive;
+ TInt targetDrive;
+
+ err = iFs.CharToDrive( tmpSource[0], sourceDrive );
+ TInt err2 = iFs.CharToDrive( tmpTarget[0], targetDrive );
+
+ if( err != KErrNone || err2 != KErrNone
+ || !IsDriveVisible( sourceDrive )
+ || !IsDriveVisible( targetDrive ) )
+ {
+ // drive not visible to user
+ err = KErrNotFound;
+ }
+ }
+
+ if( err == KErrNone )
+ {
+ TRAP( err,
+ iSConFsHandler->DoCopyOrMoveFileL( tmpSource, tmpTarget, EFalse ) );
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::MoveFile() : end, err: %d", err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::CopyFile()
+// Copy file/folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::CopyFile(const TDesC& aSource, const TDesC& aTarget)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err;
+ TFileName tmpSource;
+ TFileName tmpTarget;
+ err = GetAbsolutePath( aSource, tmpSource );
+ if (err == KErrNone)
+ {
+ err = GetAbsolutePath( aTarget, tmpTarget );
+ }
+
+ if( err == KErrNone )
+ {
+ TInt sourceDrive;
+ TInt targetDrive;
+
+ err = iFs.CharToDrive( tmpSource[0], sourceDrive );
+ TInt err2 = iFs.CharToDrive( tmpTarget[0], targetDrive );
+
+ if( err != KErrNone || err2 != KErrNone
+ || !IsDriveVisible( sourceDrive )
+ || !IsDriveVisible( targetDrive ) )
+ {
+ // drive not visible to user
+ err = KErrNotFound;
+ }
+ }
+
+ if (err == KErrNone)
+ {
+ TRAP( err,
+ iSConFsHandler->DoCopyOrMoveFileL( tmpSource, tmpTarget, ETrue ) );
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::CopyFile() : end, ret: %d", err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetReadOnly()
+// Set read-only permissions to file or folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::SetReadOnly(const TDesC& aTarget, const TBool aReadOnly)
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err;
+ TFileName tmpTarget;
+ err = GetAbsolutePath( aTarget, tmpTarget );
+ if( err != KErrNone )
+ {
+ return err;
+ }
+ else
+ {
+ TInt targetDrive;
+ err = iFs.CharToDrive( tmpTarget[0], targetDrive );
+
+ if( err != KErrNone
+ || !IsDriveVisible( targetDrive ) )
+ {
+ // drive not visible to user
+ return KErrNotFound;
+ }
+ }
+
+ TBool isFolder(EFalse);
+ err = BaflUtils::IsFolder( iFs, tmpTarget, isFolder );
+ if ( err == KErrNone && isFolder )
+ {
+ tmpTarget.Append(KPathDelimiter);
+ }
+ if ( !iSConFsHandler->IsFolderVisible( tmpTarget ) )
+ {
+ // folder is not visible to user
+ err = KErrAccessDenied;
+ }
+ else
+ {
+ if( aReadOnly )
+ {
+ err = iFs.SetAtt( tmpTarget, KEntryAttReadOnly, KEntryAttArchive );
+ }
+ else
+ {
+ err = iFs.SetAtt( tmpTarget, KEntryAttNormal, KEntryAttReadOnly );
+ }
+ }
+
+ LOGGER_WRITE_1( "CSConFTP::SetReadOnly() : ret: %d", err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::SetHidden()
+// Set hidden permissions to file or folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::SetHidden( const TDesC& /*aTarget*/, const TBool /*aHidden*/ )
+ {
+ // This is currently not supported.
+ LOGGER_WRITE("CSConFTP::SetHidden return KErrNotSupported");
+ return KErrNotSupported;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::GetAbsolutePath()
+// Get absolute path from relative file/folder
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::GetAbsolutePath( const TDesC& aFolderName, TDes &aFullPath )
+ {
+ if (aFolderName.Length() == 0)
+ {
+ return KErrBadName;
+ }
+ //absolute folder path
+ if( aFolderName.Length() > 1 && aFolderName[1] == KDriveDelimiter )
+ {
+ aFullPath.Copy( aFolderName );
+ }
+ // relative to the root folder
+ else if( aFolderName[0] == KPathDelimiter )
+ {
+ if( iPathName.Length() < 2 )
+ {
+ return KErrBadName;
+ }
+ aFullPath.Copy( iPathName.Left(2) );
+ aFullPath.Append( aFolderName );
+ }
+ // relative to the current folder
+ else
+ {
+ aFullPath.Copy( iPathName );
+ if( aFullPath.LocateReverse( KPathDelimiter ) != aFullPath.Length()-1 )
+ {
+ aFullPath.Append( KPathDelimiter );
+ }
+ aFullPath.Append( aFolderName );
+ // no need to check internal root, because iPathName is real target.
+ }
+
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::CSConFTP()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConFTP::CSConFTP() : iProfile( EStandard ), iCurrentDrive( KErrNotFound )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iBuffer = CBufFlat::NewL( KSConBufSize );
+ User::LeaveIfError( iFs.Connect() );
+ iSConFsHandler = CSConFsHandler::NewL( iFs );
+ iSConInboxHandler = CSConInboxHandler::NewL();
+
+ CRepository* repository = CRepository::NewLC( KCRUidDiskLevel );
+ User::LeaveIfError( repository->Get( KDiskCriticalThreshold, iCriticalDiskLevel ) );
+ CleanupStack::PopAndDestroy( repository );
+ // inlcude package size
+ iCriticalDiskLevel += KPackageSize;
+ LOGGER_WRITE_1( "criticalLevel: %d", iCriticalDiskLevel );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::GetVolumeNameL()
+// Get volume name
+// -----------------------------------------------------------------------------
+//
+TInt CSConFTP::GetVolumeNameL(const TInt aDriveNumber, TDes8& aVolumeName)
+ {
+ TRACE_FUNC_ENTRY;
+ TVolumeInfo volumeInfo;
+ TInt ret = iFs.Volume( volumeInfo, aDriveNumber );
+
+ if ( ret == KErrNone)
+ {
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName,
+ volumeInfo.iName );
+ //Replace special characters
+ for( TInt i = 0; i < aVolumeName.Length(); i++ )
+ {
+ switch( aVolumeName[i] )
+ {
+ case '&':
+ aVolumeName.Delete( i, 1 );
+ aVolumeName.Insert( i, KReplace1 );
+ break;
+ case '<':
+ aVolumeName.Delete( i, 1 );
+ aVolumeName.Insert( i, KReplace2 );
+ break;
+ case '>':
+ aVolumeName.Delete( i, 1 );
+ aVolumeName.Insert( i, KReplace3 );
+ break;
+ case '"':
+ aVolumeName.Delete( i, 1 );
+ aVolumeName.Insert( i, KReplace4 );
+ break;
+ case '\'':
+ aVolumeName.Delete( i, 1 );
+ aVolumeName.Insert( i, KReplace5 );
+ break;
+ default:
+ break;
+ }
+ }
+
+ //No name
+ if( aVolumeName.Length() == 0 )
+ {
+ LOGGER_WRITE( "Volume has no name, use default localized name" );
+ //Read memory string and convert it
+ TFileName file( KSConResourceName );
+
+ BaflUtils::NearestLanguageFile( iFs, file );
+
+ CStringResourceReader* reader = CStringResourceReader::NewL( file );
+ CleanupStack::PushL( reader );
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, aDriveNumber, driveStatus ) );
+ if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ // read default MMC name
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName,
+ reader->ReadResourceString( R_SECON_VALUE_MMC ) );
+ }
+ else
+ {
+ // read default DEV name
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( aVolumeName,
+ reader->ReadResourceString( R_SECON_VALUE_DEVICE ) );
+ }
+ CleanupStack::PopAndDestroy( reader );
+ }
+ }
+ LOGGER_WRITE_1("GetVolumeNameL returned: %d", ret);
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::IsDriveVisible()
+// Check is drive visible for user
+// -----------------------------------------------------------------------------
+//
+TBool CSConFTP::IsDriveVisible( const TInt aDriveNumber )
+ {
+ TUint driveStatus;
+ TInt err = DriveInfo::GetDriveStatus( iFs, aDriveNumber, driveStatus);
+ if( err )
+ {
+ LOGGER_WRITE_1( "CSConFTP::IsDriveVisible() : DriveInfo::GetDriveStatus err: %d", err );
+ return EFalse;
+ }
+ if( driveStatus & DriveInfo::EDriveRemote )
+ {
+ LOGGER_WRITE( "CSConFTP::IsDriveVisible() : remote drive" );
+ return EFalse;
+ }
+ if( !(driveStatus & DriveInfo::EDriveUserVisible) )
+ {
+ LOGGER_WRITE( "CSConFTP::IsDriveVisible() : not visible" );
+ return EFalse;
+ }
+ if( !(driveStatus & DriveInfo::EDrivePresent ) )
+ {
+ LOGGER_WRITE( "CSConFTP::IsDriveVisible() : not present" );
+ return EFalse;
+ }
+ if( driveStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "CSConFTP::IsDriveVisible() : corrupted" );
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::UpdateDriveTypeInfoL()
+// Test is current volume still ok.
+// -----------------------------------------------------------------------------
+//
+TBool CSConFTP::IsCurrentVolumeOK()
+ {
+ if( iCurrentDrive == KErrNotFound )
+ {
+ LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : not set" );
+ return EFalse;
+ }
+
+ TUint driveStatus;
+ TInt err = DriveInfo::GetDriveStatus( iFs, iCurrentDrive, driveStatus);
+ if( err )
+ {
+ LOGGER_WRITE_1( "CSConFTP::IsCurrentVolumeOK() : DriveInfo::GetDriveStatus err: %d", err );
+ return EFalse;
+ }
+ if( !(driveStatus & DriveInfo::EDrivePresent ))
+ {
+ LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : not present" );
+ return EFalse;
+ }
+ if( driveStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "CSConFTP::IsCurrentVolumeOK() : corrupted" );
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConFTP::UpdateDriveTypeInfoL()
+// Updates drive information (iCurrentDrive and iCurrentDriveTypeNumber)
+// -----------------------------------------------------------------------------
+//
+void CSConFTP::UpdateDriveTypeInfoL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt driveNumber;
+ iCurrentDriveTypeNumber = 0;
+
+ if( iPathName.Length() == 0 )
+ {
+ LOGGER_WRITE( "CSConFTP::UpdateDriveTypeInfoL() : drive not specified" );
+ iCurrentDrive = KErrNotFound;
+ return;
+ }
+
+ User::LeaveIfError( iFs.CharToDrive(iPathName[0], driveNumber) );
+ iCurrentDrive = driveNumber;
+
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, iCurrentDrive, driveStatus ) );
+ // if true, search internal drives, else search removable drives
+ TBool searchInternalDrives = (driveStatus & DriveInfo::EDriveInternal);
+
+ TInt driveCount;
+ TDriveList driveList;
+
+ User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveList, driveCount ) );
+
+ for( TInt i = EDriveA; i <= iCurrentDrive; i++ )
+ {
+ if( driveList[i] )
+ {
+ TUint driveStatus;
+ User::LeaveIfError( DriveInfo::GetDriveStatus( iFs, i, driveStatus ) );
+
+ if( !(driveStatus & DriveInfo::EDrivePresent )
+ || driveStatus & DriveInfo::EDriveCorrupt )
+ {
+ LOGGER_WRITE( "not present or corrupted" );
+ continue;
+ }
+
+ if( driveStatus & DriveInfo::EDriveInternal )
+ {
+ if( searchInternalDrives )
+ {
+ iCurrentDriveTypeNumber++;
+ }
+ }
+ else if( driveStatus & DriveInfo::EDriveRemovable )
+ {
+ if( !searchInternalDrives )
+ {
+ iCurrentDriveTypeNumber++;
+ }
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/src/sconftp.rss Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource file for sconftp.dll
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// RESOURCE IDENTIFIER
+// -----------------------------------------------------------------------------
+//
+NAME SFTP
+
+// -----------------------------------------------------------------------------
+// INCLUDE FILES
+// -----------------------------------------------------------------------------
+//
+#include <eikon.rh>
+#include <eikon.rsg>
+
+#include <sconftp.loc>
+
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF r_secon_value_device { buf = qtn_secon_device; }
+RESOURCE TBUF r_secon_value_mmc { buf = qtn_secon_mmc; }
+RESOURCE TBUF r_secon_value_mass_storage { buf = qtn_secon_mass_storage; }
+RESOURCE TBUF r_secon_data_folder { buf = qtn_secon_data_folder; }
+RESOURCE TBUF r_secon_unknown_supplier { buf = qtn_secon_unknown_supplier; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/ftp/src/sconinboxhandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: File Transfer Controller implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <obexutilsmessagehandler.h>
+#include <btmsgtypeuid.h> // BT Message Uid
+
+#include "sconinboxhandler.h"
+#include "debug.h"
+#include "sconconsts.h"
+
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConInboxHandler* CSConInboxHandler::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConInboxHandler* self = new (ELeave) CSConInboxHandler();
+
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::~CSConInboxHandler()
+// Default destructor
+// -----------------------------------------------------------------------------
+//
+CSConInboxHandler::~CSConInboxHandler()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::CreateInboxAttachmentL( CObexBufObject*& aObject,
+// CBufFlat*& aBuffer )
+// Creates an attachment to device's Inbox
+// -----------------------------------------------------------------------------
+//
+TInt CSConInboxHandler::CreateInboxAttachmentL( CObexBufObject*& aObject,
+ CBufFlat*& aBuffer )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ iDrive = GetMessageCenterDriveL();
+
+ delete aObject;
+ aObject = CObexBufObject::NewL( NULL );
+
+ iFile = RFile();
+
+ TRAP( ret, TObexUtilsMessageHandler::CreateInboxAttachmentL( aObject,
+ KUidMsgTypeBt, iMsvIdParent, iFile ) );
+
+ if( aBuffer )
+ {
+ aBuffer->Reset();
+ delete aBuffer;
+ }
+
+ aBuffer = CBufFlat::NewL( KSConBufferSize );
+ aBuffer->ResizeL( KSConBufferSize );
+
+ TObexRFileBackedBuffer bufferdetails( *aBuffer, iFile,
+ CObexBufObject::EDoubleBuffering );
+ aObject->SetDataBufL( bufferdetails );
+ LOGGER_WRITE_1( "CSConInboxHandler::CreateInboxAttachmentL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::SaveObjToInboxL( CObexBufObject*& aObject )
+// Saves the object to the Inbox
+// -----------------------------------------------------------------------------
+//
+TInt CSConInboxHandler::SaveObjToInboxL( CObexBufObject*& aObject )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ if( iDrive == EDriveE )
+ {
+ ret = TObexUtilsMessageHandler::GetMmcFileSystemStatus();
+ LOGGER_WRITE_1( "GetMmcFileSystemStatus returned %d", ret );
+ }
+ else
+ {
+ ret = TObexUtilsMessageHandler::GetFileSystemStatus();
+ LOGGER_WRITE_1( "GetFileSystemStatus returned %d", ret );
+ }
+
+ if( ret == KErrNone )
+ {
+ TInt tempDrive = GetMessageCenterDriveL();
+
+ if( tempDrive == iDrive )
+ {
+ LOGGER_WRITE_1( "before SaveObjToInboxL in SaveObjToInboxL %d", ret );
+ TRAP( ret, TObexUtilsMessageHandler::SaveObjToInboxL( aObject,
+ iFile, iMsvIdParent ) );
+ LOGGER_WRITE_1( "after SaveObjToInboxL in SaveObjToInboxL %d", ret );
+ }
+ else
+ {
+ ret = KErrGeneral;
+ }
+
+ if( ret != KErrNone )
+ {
+ LOGGER_WRITE_1( "before RemoveInboxEntriesL in SaveObjToInboxL %d", ret );
+ TObexUtilsMessageHandler::RemoveInboxEntriesL( aObject,
+ iMsvIdParent );
+ LOGGER_WRITE_1( "after RemoveInboxEntriesL in SaveObjToInboxL %d", ret );
+ }
+ }
+
+ LOGGER_WRITE_1( "CSConInboxHandler::SaveObjToInboxL( CObexBufObject* aObject ) : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::AbortInboxOperation( CObexBufObject*& aObject )
+// Aborts the storing operation
+// -----------------------------------------------------------------------------
+//
+TInt CSConInboxHandler::AbortInboxOperation( CObexBufObject*& aObject )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TRAP( ret, TObexUtilsMessageHandler::RemoveInboxEntriesL( aObject,
+ iMsvIdParent ) );
+ LOGGER_WRITE_1( "CSConInboxHandler::AbortInboxOperation() returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::GetMessageCenterDriveL()
+// Returns the current message center drive
+// -----------------------------------------------------------------------------
+//
+TInt CSConInboxHandler::GetMessageCenterDriveL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt drive;
+ CMsvSession* msvSession = CMsvSession::OpenSyncL( *this );
+ CleanupStack::PushL( msvSession );
+ TDriveUnit driveUnit = msvSession->CurrentDriveL();
+ drive = driveUnit.operator TInt();
+ CleanupStack::PopAndDestroy( msvSession );
+ LOGGER_WRITE_1( "CSConInboxHandler::GetMessageCenterDriveL() returned %d", drive );
+ return drive;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::HandleSessionEventL( TMsvSessionEvent aEvent,
+// TAny* aArg1,
+// TAny* aArg2,
+// TAny* aArg3 )
+// Implementation of MMsvSessionObserver::HandleSessionEventL
+// -----------------------------------------------------------------------------
+//
+void CSConInboxHandler::HandleSessionEventL( TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInboxHandler::CSConInboxHandler()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConInboxHandler::CSConInboxHandler()
+ {
+ }
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/oviaccounthandler/inc/sconoviaccounthandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconOviAccountHandler header file
+*
+*/
+
+
+#ifndef _SCONOVIACCOUNTHANDLER_H_
+#define _SCONOVIACCOUNTHANDLER_H_
+
+#include <e32base.h>
+#include <s32strm.h>
+
+_LIT(KSconOviAccountHandlerDllName, "sconoviaccounthandler.dll");
+const TUid KSconOviAccountHandlerDllUid={0x10009D8D};
+
+class CWSOviAccountManager;
+
+/**
+ * CSconOviAccountHandler provides Ovi account information.
+ * Dynamically loadable dll.
+ */
+class CSconOviAccountHandler : public CBase
+{
+ public:
+ static CSconOviAccountHandler* NewL();
+ ~CSconOviAccountHandler();
+
+ /**
+ * Reads account information from device
+ * @param aAccountInfoStream stream where to export account details.
+ * @leave KErrNotFound if account information does not exist.
+ */
+ virtual void GetOviAccountDetailsL( RWriteStream& aAccountInfoStream );
+
+ private:
+ void ConstructL();
+
+ private: // Data
+ CWSOviAccountManager* iOviAccountManager;
+
+};
+
+IMPORT_C CSconOviAccountHandler* CreateCSconOviAccountHandlerL();
+typedef CSconOviAccountHandler* (*TSConCreateCSconOviAccountHandlerFunc) ();
+
+#endif // _SCONOVIACCOUNTHANDLER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* This file provides the information required for building the
+* whole of a SConPCD
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+./sbeconfig.xml Z:/private/10202D56/sbeconfig.xml
+
+PRJ_MMPFILES
+sconpcd.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateCSConPCDL@@YAPAVCSConPCD@@XZ @ 1 NONAME ; class CSConPCD * CreateCSConPCDL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/bld/def/eabiuu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z15CreateCSConPCDLv @ 1 NONAME
+ _ZTI8CSConPCD @ 2 NONAME ; #<TI>#
+ _ZTV8CSConPCD @ 3 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/bld/sbeconfig.xml Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+<sbe_config>
+ <heap size = "131072" max_retries = "5" reduction_factor = "2"/>
+ <central_repository uid = "0x10202BE9"/>
+ <exclude_drives list = "z"/>
+ <app_close_delay delay = "4000000"/>
+</sbe_config>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/bld/sconpcd.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: PC Connectivity Signaling Module
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+VENDORID VID_DEFAULT
+
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH sys/bin
+
+TARGET sconpcd.dll
+TARGETTYPE DLL
+UID 0x10009D8D 0x101F968B
+
+#if defined(ARMCC)
+DEFFILE ./def/eabiu
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+SOURCEPATH ../src
+SOURCE sconpcd.cpp
+SOURCE sconqueue.cpp
+SOURCE sconinstqueue.cpp
+SOURCE sconbrqueue.cpp
+SOURCE sconinstaller.cpp
+SOURCE sconbackuprestore.cpp
+SOURCE sconsbeclient.cpp
+SOURCE sconpcdutility.cpp
+SOURCE sconmetadata.cpp
+SOURCE sconvideoparser.cpp
+SOURCE sconsynchandler.cpp
+SOURCE cscontimeout.cpp
+
+SOURCEPATH ../../../common/conmltask/src
+SOURCE sconconmltask.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+USERINCLUDE ../../../common/conmltask/inc
+USERINCLUDE ../../../clients/syncclient/inc
+
+// Default system include paths
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY euser.lib
+LIBRARY swinstcli.lib
+LIBRARY sbeclient.lib
+LIBRARY sisregistryclient.lib
+LIBRARY javaregistryclient.lib
+LIBRARY platformenv.lib
+LIBRARY efsrv.lib
+LIBRARY sysutil.lib
+LIBRARY commonengine.lib // For resource reader
+LIBRARY WidgetRegistryClient.lib
+LIBRARY metadatautility.lib
+LIBRARY exiflib.lib
+LIBRARY charconv.lib
+LIBRARY caf.lib // for Content Access
+LIBRARY MediaClientVideo.lib // for CVideoPlayerUtility
+LIBRARY ws32.lib // for RWsSession
+LIBRARY TNEEngine.lib // for CTNEVideoClipInfo
+LIBRARY ImageConversion.lib // for CImageEncoder
+LIBRARY MMFControllerFramework.lib // for CMMFMetaDataEntry
+LIBRARY bafl.lib // for BaflUtils
+LIBRARY ecom.lib
+LIBRARY estor.lib // CDictionaryFileStore
+LIBRARY sconsyncclient.lib
+LIBRARY smlstoreformat.lib
+LIBRARY centralrepository.lib
+DEBUGLIBRARY flogger.lib
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/cscontimeout.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconTimeOut declaration
+*
+*/
+
+
+#ifndef CSCONTIMEOUT_H
+#define CSCONTIMEOUT_H
+
+#include <e32base.h> // For CActive, link against: euser.lib
+#include <e32std.h> // For RTimer, link against: euser.lib
+
+class MTimeOutObserver
+ {
+public:
+ virtual void TimeOut() = 0;
+ };
+
+NONSHARABLE_CLASS( CSconTimeOut ) : public CActive
+ {
+public:
+ // Cancel and destroy
+ ~CSconTimeOut();
+ static CSconTimeOut* NewL( MTimeOutObserver& aTimeOutObserver );
+
+public:
+ // Function for making the timeout request
+ void Start(TTimeIntervalMicroSeconds32 aDelay);
+
+private:
+ CSconTimeOut( MTimeOutObserver& aTimeOutObserver );
+ void ConstructL();
+
+private: // From CActive
+ void RunL();
+ void DoCancel();
+ TInt RunError(TInt aError);
+
+private:
+ RTimer iTimer; // Provides async timing service
+ MTimeOutObserver& iTimeOutObserver;
+ };
+
+#endif // CSCONTIMEOUT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconbackuprestore.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConBackupRestore header file
+*
+*/
+
+
+#ifndef _SCONBACKUPRESTORE_H_
+#define _SCONBACKUPRESTORE_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32cons.h>
+
+class CSConSBEClient;
+class CSConBackupRestoreQueue;
+class RFs;
+
+//============================================================
+// Class CSConBackupRestore declaration
+//============================================================
+NONSHARABLE_CLASS( CSConBackupRestore ): public CActive
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @param aQueue The address of CSConBackupRestoreQueue
+ * @param aMaxObjectSize Max object size
+ * @param aFs aReference to RFs connection.
+ * @return CSConBackupRestore instance
+ */
+ static CSConBackupRestore* NewL(
+ CSConBackupRestoreQueue* aQueue,
+ const TInt aMaxObjectSize, RFs& aFs );
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CSConBackupRestore();
+
+ /**
+ * Starts backup-restore task
+ * @param aTaskId The task number
+ * @return none
+ */
+ void StartBackupRestore( TInt aTaskId );
+ /**
+ * Stops executing backup-restore task
+ * @param aTaskId
+ * @return none
+ */
+ void StopBackupRestore( TInt aTaskId );
+ /**
+ * Resets backup
+ * @return none
+ */
+ void Reset();
+
+ /**
+ * Returns the active status of the backup-restore
+ * @return ETrue if backup-restore is active, else EFalse
+ */
+ TBool BackupRestoreActive() const;
+
+ private:
+ /**
+ * Constructor
+ * @param aQueue The address of CSConBackupRestoreQueue
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ CSConBackupRestore( CSConBackupRestoreQueue* aQueue, RFs& aFs );
+ /**
+ * Initializes member data
+ * @param aMaxObjectSize Max object size
+ * @return none
+ */
+ void ConstructL( const TInt aMaxObjectSize );
+ /**
+ * Implementation of CActive::DoCancel()
+ * @return none
+ */
+ void DoCancel();
+ /**
+ * Implementation of CActive::RunL()
+ * @return none
+ */
+ void RunL();
+
+ private:
+ CSConBackupRestoreQueue* iQueue;
+ CSConSBEClient* iSBEClient;
+ TInt iCurrentTask;
+ TInt iMaxObjectSize;
+ TBool iBackupRestoreActive;
+ RFs& iFs;
+ };
+
+#endif // _SCONBACKUPRESTORE_H_
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconbrqueue.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Backup-Restore Queue header file
+*
+*/
+
+
+#ifndef _SCONBRQUEUE_H_
+#define _SCONBRQUEUE_H_
+
+#include "sconqueue.h"
+
+class CSConTaskQueue;
+
+//============================================================
+// Class CSConBackupRestoreQueue declaration
+//============================================================
+NONSHARABLE_CLASS ( CSConBackupRestoreQueue ) : public CActive, public CSConTaskQueue
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @param aMaxObjectSize Max object size
+ * @param aFs aReference to RFs connection.
+ * @return CSConBackupRestoreQueue instance
+ */
+ static CSConBackupRestoreQueue* NewL( const TInt aMaxObjectSize, RFs& aFs );
+ /**
+ * Destructor
+ * @return CSConBackupRestoreQueue instance
+ */
+ ~CSConBackupRestoreQueue();
+ /**
+ * Adds a new task to queue
+ * @param aNewTask A new task to be added
+ * @param aTaskId The task number
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt AddNewTask( CSConTask*& aNewTask, TInt aTaskId );
+ /**
+ * Cancels a task
+ * @param aTask The task number
+ * @param aAllTasks If ETrue => cancel all tasks
+ * @param aStatus The reply
+ * @return none
+ */
+ void CancelTask( TInt aTask, TBool aAllTasks );
+ /**
+ * Resets the queue
+ * @return none
+ */
+ void Reset();
+ /**
+ * An address pointer to another queue
+ * @param aTaskQueue The address to another queue
+ * @return none
+ */
+ virtual void QueueAddress( CSConInstallerQueue*& aTaskQueue );
+ /**
+ * Returns the task type
+ * @param aTaskId The task number
+ * @return task type
+ */
+ TSConMethodName GetTaskMethodL( TInt aTaskId );
+
+ private:
+ /**
+ * Constructor
+ * @return none
+ */
+ CSConBackupRestoreQueue();
+ /**
+ * Initializes member data
+ * @param aMaxObjectSize Max object size
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ void ConstructL( const TInt aMaxObjectSize, RFs& aFs );
+ /**
+ * Polls queue
+ * @return none
+ */
+ void PollQueue();
+ /**
+ * Starts queue polling
+ * @return none
+ */
+ void StartQueue();
+ /**
+ * Stops queue polling
+ * @return none
+ */
+ void StopQueue();
+ /**
+ * Implementation of CActive::DoCancel()
+ * @return none
+ */
+ void DoCancel();
+ /**
+ * Implementation of CActive::RunL()
+ * @return none
+ */
+ void RunL();
+
+ private:
+ CSConBackupRestore* iBackupRestore;
+ CSConInstallerQueue* iInstQueueAddress;
+ };
+
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconinstaller.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConAppInstaller header file
+*
+*/
+
+
+#ifndef _SCONINSTALLER_H_
+#define _SCONINSTALLER_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <SWInstApi.h>
+
+#include "sconinstqueue.h"
+
+class CSConUninstall;
+
+//============================================================
+// Class CSConAppInstaller declaration
+//============================================================
+NONSHARABLE_CLASS ( CSConAppInstaller ): public CActive
+ {
+ public:
+ /**
+ * Constructor
+ * @param aQueue The address of CSConInstallerQueu
+ * @return none
+ */
+ CSConAppInstaller( CSConInstallerQueue* aQueue, RFs& aFs );
+
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CSConAppInstaller();
+
+ /**
+ * Starts the installer task
+ * @param aTaskId Task number
+ * @return none
+ */
+ void StartInstaller( TInt& aTaskId );
+ /**
+ * Stops the installer task
+ * @return none
+ */
+ void StopInstaller( TInt& aTaskId );
+
+ /**
+ * Returns the active status of the installer
+ * @return ETrue if installer is active, else EFalse
+ */
+ TBool InstallerActive() const;
+
+ private:
+ /**
+ * Implementation of CActive::DoCancel()
+ * @return none
+ */
+ void DoCancel();
+ /**
+ * Implementation of CActive::RunL()
+ * @return none
+ */
+ void RunL();
+ /**
+ * Executes ListInstalledApps task
+ * @return none
+ */
+ void ProcessListInstalledAppsL();
+ /**
+ * Execures UnInstall task
+ * @param CSConUninstall uninstall params
+ * @return none
+ */
+ void ProcessUninstallL( const CSConUninstall& aUninstallParams );
+
+ void UninstallSisL( const CSConUninstall& aUninstallParams );
+ void UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode );
+ void UninstallWidget( const TUid& aUid, const TSConInstallMode aMode );
+ void DeleteFile( const TDesC& aPath );
+
+ private:
+ enum TInstallerState
+ {
+ EIdle = 0,
+ EInstalling,
+ ESilentInstalling,
+ EUninstalling,
+ ESilentUninstalling,
+ ECustomUninstalling,
+ ESilentCustomUnistalling,
+ EListingInstalledApps
+ };
+ TInstallerState iInstallerState;
+ CSConInstallerQueue* iQueue; // Not owned
+ SwiUI::RSWInstLauncher iSWInst;
+ SwiUI::TInstallOptions iOptions;
+ SwiUI::TInstallOptionsPckg iOptionsPckg;
+ TInt iCurrentTask;
+ RFs& iFs;
+ };
+
+#endif // _SCONINSTALLER_H_
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconinstqueue.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Installer Queue header file
+*
+*/
+
+
+#ifndef _SCONINSTQUEUE_H_
+#define _SCONINSTQUEUE_H_
+
+#include "sconqueue.h"
+
+
+//============================================================
+// Class CSConInstallerQueue declaration
+//============================================================
+NONSHARABLE_CLASS ( CSConInstallerQueue ): public CActive, public CSConTaskQueue
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @return CSConInstallerQueue instance
+ */
+ static CSConInstallerQueue* NewL( RFs& aFs );
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CSConInstallerQueue();
+
+ /**
+ * Cancels a task
+ * @param aTask The task number
+ * @param aAllTasks If ETrue => cancel all tasks
+ * @param aStatus The reply
+ * @return none
+ */
+ void CancelTask( TInt aTask, TBool aAllTasks );
+
+ /**
+ * An address pointer to another queue
+ * @param aTaskQueue The address to another queue
+ * @return none
+ */
+ void QueueAddress( CSConBackupRestoreQueue*& aTaskQueue );
+
+ private:
+ /**
+ * Constructor
+ * @return none
+ */
+ CSConInstallerQueue( RFs& aFs );
+ /**
+ * Initializes member data
+ * @return none
+ */
+ void ConstructL();
+ /**
+ * Polls queue
+ * @return none
+ */
+ void PollQueue();
+ /**
+ * Starts queue polling
+ * @return none
+ */
+ void StartQueue();
+ /**
+ * Stops queue polling
+ * @return none
+ */
+ void StopQueue();
+ /**
+ * Implementation of CActive::DoCancel()
+ * @return none
+ */
+ void DoCancel();
+ /**
+ * Implementation of CActive::RunL()
+ * @return none
+ */
+ void RunL();
+
+ private:
+ CSConAppInstaller* iInstaller;
+ CSConBackupRestoreQueue* iBRQueueAddress;
+ RFs& iFs;
+ };
+
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconmetadata.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SConMetadata header file
+*
+*/
+
+
+#ifndef _SCONMETADATA_H_
+#define _SCONMETADATA_H_
+
+#include <MetaDataField.hrh>
+
+class CSConTask;
+class CExifRead;
+class CExifTag;
+//============================================================
+// Class CSConMetadata declaration
+//============================================================
+NONSHARABLE_CLASS( SConMetadata )
+ {
+ public:
+
+ /**
+ * Start processing metadata task
+ * @param aTask used task
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ static void ProcessTask( CSConTask& aTask, RFs& aFs );
+
+ private:
+
+ /**
+ * Get audio metadata to task
+ * @return none
+ */
+ static void GetAudioMetadataL( CSConTask& aTask );
+
+ /**
+ * Get video metadata to task
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ static void GetVideoMetadataL( CSConTask& aTask, RFs& aFs );
+
+ /**
+ * parse exif field
+ * @return HBufC8* parsed data. Leaves if not found
+ */
+ static HBufC8* GetExifTagL( CExifRead* aReader, const TUint8 aTagID ) ;
+
+ /**
+ * Parse TUint32 value from aData
+ * @return TUint32 value
+ */
+ static TUint32 ReadTUint32( const TDesC8& aData );
+
+ /**
+ * Read data from file
+ * @param aFs aReference to RFs connection.
+ * @return file data
+ */
+ static HBufC8* GetFileDataLC( const TDesC& aFilename, RFs& aFs );
+
+ /**
+ * Get exif metadata to task
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ static void ReadExifDataL( CSConTask& aTask, RFs& aFs );
+
+ /**
+ * Convert latidute/longitude tag to TReal64 value
+ * @return KErrNone if successfully converted
+ */
+ static TInt ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees );
+
+ /**
+ * Get latidute value from Exif
+ * @param aExifRead ExifReader used to read
+ * @param aLatitude readed latidute
+ * @return KErrNone if found
+ */
+ static TInt GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude );
+
+ /**
+ * Get longitude value from Exif
+ * @param aExifRead ExifReader used to read
+ * @param aLongitude readed longitude
+ * @return KErrNone if found
+ */
+ static TInt GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude );
+
+ /**
+ * Get altidute value from Exif
+ * @param aExifRead ExifReader used to read
+ * @param aAltidute readed altidute
+ * @return KErrNone if found
+ */
+ static TInt GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute );
+
+ /**
+ * Appends data field to buffer
+ * @return none
+ */
+ static void AppendUtf8DataFieldL( CBufFlat* aBuffer, const TPtrC aAppendData,
+ const TUint8 aFieldId );
+
+ /**
+ * Appends data field to buffer
+ * @return none
+ */
+ static void AppendByteDataFieldL( CBufFlat* aBuffer, const TPtrC8 aAppendData,
+ const TUint8 aFieldId );
+
+ /**
+ * Writes TUint32 value to buffer
+ * @return none
+ */
+ static void WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue );
+
+ /**
+ * Appends data field to buffer
+ * @return none
+ */
+ static void AppendTUintDataFieldL( CBufFlat* aBuffer, TUint32 aValue,
+ const TUint8 aFieldId );
+
+ /**
+ * Get AudioFieldId
+ * @return TUint8
+ */
+ static TUint8 AudioFieldId( const TMetaDataFieldId fieldId );
+
+ };
+
+#endif // _SCONMETADATA_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconmetadatafielddefs.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Metadata field definitions
+*
+*/
+
+
+#ifndef _SCONMETADATAFIELDDEFS_H_
+#define _SCONMETADATAFIELDDEFS_H_
+
+// Content type header
+const TUint8 KSconMetadataHeaderAudio( 0x01 );
+const TUint8 KSconMetadataHeaderExif ( 0x02 );
+const TUint8 KSconMetadataHeaderVideo( 0x03 );
+
+const TUint8 KSconMetadataHeaderVersion ( 0x02 ); // format version = 2
+
+// fields for audio
+const TUint8 KSconAudioID3Version ( 0x01 );
+const TUint8 KSconAudioTitle ( 0x02 );
+const TUint8 KSconAudioArtist ( 0x03 );
+const TUint8 KSconAudioAlbum ( 0x04 );
+const TUint8 KSconAudioYear ( 0x05 );
+const TUint8 KSconAudioComment ( 0x06 );
+const TUint8 KSconAudioAlbumTrack ( 0x07 );
+const TUint8 KSconAudioGenre ( 0x08 );
+const TUint8 KSconAudioComposer ( 0x09 );
+const TUint8 KSconAudioCopyright ( 0x0a );
+const TUint8 KSconAudioOriginalArtist( 0x0b );
+const TUint8 KSconAudioUrl ( 0x0c );
+const TUint8 KSconAudioUserUrl ( 0x0d );
+const TUint8 KSconAudioJpeg ( 0x0e );
+const TUint8 KSconAudioVendor ( 0x0f );
+const TUint8 KSconAudioRating ( 0x10 );
+const TUint8 KSconAudioUniqueFileIdentifier( 0x11 );
+const TUint8 KSconAudioDuration ( 0x12 );
+const TUint8 KSconAudioDate ( 0x13 );
+const TUint8 KSconAudioUnsyncLyrics ( 0x14 );
+const TUint8 KSconAudioProtected ( 0x15 );
+
+// fields for exif
+const TUint8 KSconExifThumbnail ( 0x01 );
+const TUint8 KSconExifDescription ( 0x02 );
+const TUint8 KSconExifMake ( 0x03 );
+const TUint8 KSconExifModel ( 0x04 );
+const TUint8 KSconExifDateTime ( 0x05 );
+const TUint8 KSconExifSoftware ( 0x06 );
+const TUint8 KSconExifCopyright ( 0x07 );
+const TUint8 KSconExifOrientation ( 0x08 );
+const TUint8 KSconExifXResolution1 ( 0x09 );
+const TUint8 KSconExifXResolution2 ( 0x0a );
+const TUint8 KSconExifYResolution1 ( 0x0b );
+const TUint8 KSconExifYResolution2 ( 0x0c );
+const TUint8 KSconExifResolutionUnit ( 0x0d );
+const TUint8 KSconExifYCbCrPositioning ( 0x0e );
+const TUint8 KSconExifIsoSpeedRatings ( 0x0f );
+const TUint8 KSconExifDateTimeOriginal ( 0x10 );
+const TUint8 KSconExifDateTimeDigitized ( 0x11 );
+const TUint8 KSconExifMakerNote ( 0x12 );
+const TUint8 KSconExifUserComment ( 0x13 );
+const TUint8 KSconExifRelatedSoundFile ( 0x14 );
+const TUint8 KSconExifExposureTime1 ( 0x15 );
+const TUint8 KSconExifExposureTime2 ( 0x16 );
+const TUint8 KSconExifComponentsConfiguration ( 0x17 );
+const TUint8 KSconExifFlash ( 0x18 );
+const TUint8 KSconExifColorSpace ( 0x19 );
+const TUint8 KSconExifPixelXDimension ( 0x1a );
+const TUint8 KSconExifPixelYDimension ( 0x1b );
+const TUint8 KSconExifExposureMode ( 0x1c );
+const TUint8 KSconExifWhiteBalance ( 0x1d );
+const TUint8 KSconExifSceneCaptureType ( 0x1e );
+const TUint8 KSconExifExposureProgram ( 0x1f );
+const TUint8 KSconExifApertureValue1 ( 0x20 );
+const TUint8 KSconExifApertureValue2 ( 0x21 );
+const TUint8 KSconExifExposureBiasValue1 ( 0x22 );
+const TUint8 KSconExifExposureBiasValue2 ( 0x23 );
+const TUint8 KSconExifMeteringMode ( 0x24 );
+const TUint8 KSconExifLightSource ( 0x25 );
+const TUint8 KSconExifFileSource ( 0x26 );
+const TUint8 KSconExifDigitalZoomRatio1 ( 0x27 );
+const TUint8 KSconExifDigitalZoomRatio2 ( 0x28 );
+const TUint8 KSconExifContrast ( 0x29 );
+const TUint8 KSconExifSaturation ( 0x2a );
+const TUint8 KSconExifSharpness ( 0x2b );
+const TUint8 KSconExifExifVersion ( 0x2c );
+const TUint8 KSconExifFlashPixVersion ( 0x2d );
+const TUint8 KSconExifThumbXResolution1 ( 0x2e );
+const TUint8 KSconExifThumbXResolution2 ( 0x2f );
+const TUint8 KSconExifThumbYResolution1 ( 0x30 );
+const TUint8 KSconExifThumbYResolution2 ( 0x31 );
+const TUint8 KSconExifThumbResolutionUnit ( 0x32 );
+const TUint8 KSconExifThumbCompression ( 0x33 );
+const TUint8 KSconExifThumbJpegInterchangeFormat ( 0x34 );
+const TUint8 KSconExifThumbJpegInterchangeFormatLength ( 0x35 );
+const TUint8 KSconExifShutterSpeedValue1 ( 0x36 );
+const TUint8 KSconExifShutterSpeedValue2 ( 0x37 );
+const TUint8 KSconExifBrightnessValue1 ( 0x38 );
+const TUint8 KSconExifBrightnessValue2 ( 0x39 );
+const TUint8 KSconExifCustomRendered ( 0x3a );
+const TUint8 KSconExifGainControl ( 0x3b );
+const TUint8 KSconExifGpsVersion ( 0x3c );
+const TUint8 KSconExifGPSLatitude ( 0x3d );
+const TUint8 KSconExifGPSLongitude ( 0x3e );
+const TUint8 KSconExifGPSAltitude ( 0x3f );
+const TUint8 KSconExifBitDepth ( 0x40 );
+
+// fields for video
+const TUint8 KSconVideoFormat ( 0x01 );
+const TUint8 KSconVideoFrameRate ( 0x02 );
+const TUint8 KSconVideoFrameSizeWidth ( 0x03 );
+const TUint8 KSconVideoFrameSizeHeight ( 0x04 );
+const TUint8 KSconVideoVideoBitRate ( 0x05 );
+const TUint8 KSconVideoAudioBitRate ( 0x06 );
+const TUint8 KSconVideoDuration ( 0x07 );
+const TUint8 KSconVideoThumbnail ( 0x08 );
+const TUint8 KSconVideoAudioStreamMimetype ( 0x09 );
+const TUint8 KSconVideoVideoStreamMimetype ( 0x0a );
+
+#endif // _SCONMETADATAFIELDDEFS_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconpcd.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,169 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConPCD service header
+*
+*/
+
+
+#ifndef _SCONPCD_H_
+#define _SCONPCD_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32cons.h>
+#include <s32strm.h>
+
+#include "sconconmltask.h"
+
+class CSConInstallerQueue;
+class CSConBackupRestoreQueue;
+class CSconSyncHandler;
+
+enum TSConLastConMLOperation
+ {
+ ENoTask = 0,
+ EPutTask,
+ EGetReply
+ };
+
+//============================================================
+// Class CSConPCD declaration
+//============================================================
+class CSConPCD : public CBase
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @return CSConPCD instance
+ */
+ static CSConPCD* NewL();
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CSConPCD();
+ /**
+ * Receives a new task
+ * @param aTask A new task
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ virtual TInt PutTaskL( CSConTask*& aTask );
+ /**
+ * Returns a reply to previous PutTaskL operation
+ * @return CSConStatusReply if reply exists, else return NULL
+ */
+ virtual CSConStatusReply* GetReply();
+ /**
+ * Resets the module to the initial state
+ * @return none
+ */
+ virtual void ResetPCD();
+
+ virtual void HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize );
+ virtual void HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aResult );
+
+ private:
+ /**
+ * Collects a status of a specified task / all tasks
+ * @param aTask The number of the specified task
+ * @param aAll If ETrue => receive status of all tasks
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt GetStatusL( TInt aTask, TBool aAll );
+
+ /**
+ * Cancels a specified task / all tasks
+ * @param aTask The number of the specified task
+ * @param aAll If ETrue => receive status of all tasks
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt CancelL( TInt aTask, TBool aAll );
+
+ /**
+ * Fills a reply with predefined supported task -information
+ * @param aTask The task
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt SupportedInstTaskL( CSConTask* aTask );
+
+ /**
+ * Fills a reply with predefined supported task -information
+ * @param aTask The task
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt SupportedBRTaskL( CSConTask* aTask );
+
+ /**
+ * Fills a reply with predefined Reboot task -information
+ * @param aTask The task
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ TInt RebootTaskL( const CSConTask* aTask );
+
+ /**
+ * Fills a reply with predefined GetMetadata task -information
+ * @param aTask The task
+ * @return none
+ */
+ void GetMetadataTaskL( CSConTask& aTask );
+
+ /**
+ * Creates a reply for UpdateDeviceInfo task
+ * @param aMaxObjectSize A max object size to be used
+ * @return none
+ */
+ TInt UpdateDeviceInfoL( TInt aMaxObjectSize );
+ /**
+ * Gets the current max object size
+ * @param aClientObjectSize The object size of the client
+ * @return the max object size
+ */
+ TInt GetMaxObjectSize( TInt aClientObjectSize ) const;
+
+ /**
+ * Stores a reply
+ * @param aReply The reply to be stored
+ * @return none
+ */
+ void StoreReply( CSConStatusReply*& aReply );
+
+ /**
+ * Constructor
+ * @return none
+ */
+ CSConPCD();
+ /**
+ * Initializes member data
+ * @return none
+ */
+ virtual void ConstructL();
+
+ private:
+ CSConInstallerQueue* iInstallerQueue;
+ CSConBackupRestoreQueue* iBackupRestoreQueue;
+ CSConStatusReply* iLatestReply;
+ TInt iTaskNumber;
+ TInt iMaxObjectSize;
+ TSConLastConMLOperation iLastOperation;
+ RFs iFs;
+ CSconSyncHandler* iSyncHandler;
+ };
+
+ IMPORT_C CSConPCD* CreateCSConPCDL();
+ typedef CSConPCD* (*TSConCreateCSConPCDFunc) ();
+
+#endif // SCONPCD
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconpcdconsts.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConPCD constants
+*
+*/
+
+
+#ifndef _SCONPCDCONSTS_H
+#define _SCONPCDCONSTS_H
+
+// Timer value used for queue polling
+const TInt KSConTimerValue( 20000 );
+// ConML Status code: Task completed
+const TInt KSConCodeTaskCompleted( 200 );
+// ConML Status code: Task created
+const TInt KSConCodeTaskCreated( 201 );
+// ConML Status code: Task prcosessing started
+const TInt KSConCodeProcessingStarted( 202 );
+// ConML Status code: Task partially completed
+const TInt KSConCodeTaskPartiallyCompleted( 206 );
+// ConML Status code: Not found
+const TInt KSConCodeNotFound( 404 );
+// ConML Status code: Conflict
+const TInt KSConCodeConflict( 409 );
+// ConML Status code: Not supported
+const TInt KSConCodeNotSupported( 501 );
+// ConML Status code: Incompatible version
+const TInt KSConCodeIncompatible( 507 );
+// ConML Status code: Cancelled
+const TInt KSConCodeCancelled( 514 );
+// ConML Status code: No memory
+const TInt KSConCodeNoMemory( 420 );
+
+
+// ConML Status codes in installer errorcases
+const TInt KSConCodeInstErrUserCancel = KSConCodeCancelled; // User cancelled the operation
+const TInt KSConCodeInstErrFileCorrupted = 600; // File is corrupted
+const TInt KSConCodeInstErrInsufficientMemory = KSConCodeNoMemory; // Insufficient free memory in the drive to perform the operation
+const TInt KSConCodeInstErrPackageNotSupported = KSConCodeIncompatible; // Installation of the package is not supported
+const TInt KSConCodeInstErrSecurityFailure = 601; // Package cannot be installed due to security error
+const TInt KSConCodeInstErrMissingDependency = 602; // Package cannot be installed due to missing dependency
+const TInt KSConCodeInstErrFileInUse = 603; // Mandatory file is in use and prevents the operation
+const TInt KSConCodeInstErrGeneralError = 604; // Unknown error
+const TInt KSConCodeInstErrNoRights = 605; // The package has no rights to perform the operation
+const TInt KSConCodeInstErrNetworkFailure = 606; // Indicates that network failure aborted the operation
+const TInt KSConCodeInstErrBusy = 607; // Installer is busy doing some other operation
+const TInt KSConCodeInstErrAccessDenied = 608; // Target location of package is not accessible
+const TInt KSConCodeInstUpgradeError = 609; // The package is an invalid upgrade
+
+// ConML Status code: 1001...1050 System wide error code
+const TInt KSConCodeFirstSymbianErr( 1000 );
+
+struct SDeviceInfo
+ {
+ TSConMethodName method;
+ TBool support;
+ };
+
+// Supported Backup/Restore and Install methods
+const SDeviceInfo KSupportedMethods[] =
+ {
+ { EInstall, ETrue },
+ { EUninstall, ETrue },
+ { EListInstalledApps, ETrue },
+ { EListDataOwners, ETrue },
+ { ESetBURMode, ETrue },
+ { ESetInstParams, ETrue },
+ { EGetDataSize, ETrue },
+ { ERequestData, ETrue },
+ { ESupplyData, ETrue },
+ { EReboot, EFalse } // reboot not supported anymore (3.2 ->)
+ };
+
+// Supported ConML version
+_LIT8( KCONMLVERSION, "2.0" );
+// SIS mime type for installer
+_LIT8( KSISMIMEType, "x-epoc/x-sisx-app" );
+// Java mime type for installer
+_LIT8( KMidletMIMEType, "application/java-archive" );
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconpcdutility.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SConPcdUtility header file
+*
+*/
+
+
+#ifndef __CSCONPCDUTILITY_H__
+#define __CSCONPCDUTILITY_H__
+
+
+class CSConTask;
+class CSConInstApp;
+class CSConListInstApps;
+//============================================================
+// Class TSConPcdUtility declaration
+//============================================================
+NONSHARABLE_CLASS ( SConPcdUtility )
+ {
+ public: // Methods
+
+ static void ProcessListInstalledAppsL( CSConTask*& aTask );
+
+ private: // Methods
+ static void AppendInstalledSisL( CSConListInstApps& aListInstApps );
+ static void AppendInstalledJavaL( CSConListInstApps& aListInstApps );
+ static void AppendInstalledWidgetsL( CSConListInstApps& aListInstApps );
+
+ /**
+ * Checks if package is installed to selected drive
+ * @param aSelectedDriveList selected drives
+ * @param aInstalledDrives package drivemask
+ * @return ETrue if package is installed to one of the drives on aDriveList
+ */
+ static TBool IsInstalledToSelectedDrive( const TDriveList& aSelectedDriveList, TUint aInstalledDrives );
+
+ };
+
+#endif // __CSCONPCDUTILITY_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconqueue.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Queue header file
+*
+*/
+
+
+#ifndef _SCONQUEUE_H_
+#define _SCONQUEUE_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32cons.h>
+
+#include "sconconmltask.h"
+
+class CSConAppInstaller;
+class CSConBackupRestore;
+class CSConInstallerQueue;
+class CSConBackupRestoreQueue;
+
+//============================================================
+// Class CSConTaskQueue declaration
+//============================================================
+NONSHARABLE_CLASS ( CSConTaskQueue )
+ {
+ public:
+ /**
+ * Destructor
+ * @return none
+ */
+ virtual ~CSConTaskQueue();
+ /**
+ * Returns the status of a specified task / all tasks
+ * @param aTask The task number
+ * @param aAllTasks If ETrue => Receive status of all tasks
+ * @param aStatus The reply
+ * @return none
+ */
+ virtual void GetQueueStatusL( TInt aTask, TBool aAllTasks,
+ CSConStatusReply*& aStatus );
+ /**
+ * Adds a new task to queue
+ * @param aNewTask A new task to be added
+ * @param aTaskId The task number
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ virtual TInt AddNewTask( CSConTask*& aNewTask, TInt aTaskId );
+ /**
+ * Set the task to completed -mode
+ * @param aTask The task number
+ * @param aError The task error code
+ * @return none
+ */
+ virtual void CompleteTask( TInt aTask, TInt aError );
+ /**
+ * Set the task progress value
+ * @param aTask The task number
+ * @param aProgressValue The progress value
+ * @return none
+ */
+ virtual void SetTaskProgress( TInt aTask, TInt aProgressValue );
+ /**
+ * Receives a specified task
+ * @param aTaskId The task number
+ * @param aTask The address to the task
+ * @return KErrNone if no errors, else system wide error codes
+ */
+ virtual TInt GetTask( TInt aTaskId, CSConTask*& aTask );
+ /**
+ * Removes a task from the queue
+ * @param aTask The task number
+ * @return none
+ */
+ virtual void RemoveTask( TInt aTask );
+ /**
+ * Cancels a task
+ * @param aTask The task number
+ * @param aAllTasks If ETrue => cancel all tasks
+ * @return none
+ */
+ virtual void CancelTask( TInt aTask, TBool aAllTasks );
+ /**
+ * The status of the process
+ * @return ETrue if process active, else EFalse
+ */
+ virtual TBool QueueProcessActive() const;
+ /**
+ * Changes the status of the queue process
+ * @return none
+ */
+ virtual void ChangeQueueProcessStatus();
+ /**
+ * Resets the queue
+ * @return none
+ */
+ virtual void Reset();
+ /**
+ * Compares task numbers
+ * @param aFirst The first task
+ * @param aSecon The second task
+ * @return -1 if the first task number is smaller than the second,
+ * 1 the first task number is greater than the second, 0 if task
+ * numbers are equal
+ */
+ static TInt Compare( const CSConTask& aFirst,
+ const CSConTask& aSecond );
+ /**
+ * Matches the task numbers
+ * @param aFirst The first task
+ * @param aSecon The second task
+ * @return ETrue if task numbers match, else EFalse
+ */
+ static TBool Match( const CSConTask& aFirst,
+ const CSConTask& aSecond );
+
+ private:
+ /**
+ * Pure virtual function for starting the queue observation
+ * @return none
+ */
+ virtual void StartQueue() = 0;
+ /**
+ * Pure virtual function for stoping the queue observation
+ * @return none
+ */
+ virtual void StopQueue() = 0;
+ /**
+ * Pure virtual function for polling the queue
+ * @return none
+ */
+ virtual void PollQueue() = 0;
+
+ protected:
+ RPointerArray<CSConTask> iQueue;
+ RTimer iTimer;
+ TBool iQueueProcessActive;
+ };
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconsbeclient.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConSBEClient header file
+*
+*/
+
+
+#ifndef _SCONSBECLIENT_H_
+#define _SCONSBECLIENT_H_
+
+// INCLUDES
+#include <connect/sbeclient.h>
+#include "sconconmltask.h"
+
+using namespace conn;
+
+//============================================================
+// Class CSConSBEClient declaration
+//============================================================
+NONSHARABLE_CLASS ( CSConSBEClient ) : public CActive
+ {
+ public:
+ /**
+ * Two-phase constructor
+ * @param aMaxObjectSize Max object size
+ * @param aFs aReference to RFs connection.
+ * @return CSConSBEClient instance
+ */
+ static CSConSBEClient* NewL( const TInt aMaxObjectSize, RFs& aFs );
+ /**
+ * Destructor
+ * @return none
+ */
+ ~CSConSBEClient();
+ /**
+ * Set backup/restore mode
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Lists public files from data owners
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void ListPublicFiles( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Lists participant data owners
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Lists data sizes from data owners
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Request a data from a data owner
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void RequestData( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Lists the status of data owners
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void GetDataOwnerStatus( TRequestStatus& aStatus, CSConTask*& aTask );
+ /**
+ * Supplies a data to a data owner
+ * @param aStatus TRequestStatus of the request
+ * @param aTask Task parameters
+ * @return none
+ */
+ void SupplyData( TRequestStatus& aStatus, CSConTask*& aTask );
+
+ private:
+ /**
+ * Constructor
+ * @paran aMaxObjectSize Max object size
+ * @param aFs aReference to RFs connection.
+ * @return none
+ */
+ CSConSBEClient( const TInt aMaxObjectSize, RFs& aFs );
+
+ /**
+ * Implementation of CActive::DoCancel()
+ * @return none
+ */
+ void DoCancel();
+ /**
+ * Implementation of CActive::RunL()
+ * @return none
+ */
+ void RunL();
+
+ /**
+ * Executes SetBURMode task
+ * @return none
+ */
+ void ProcessSetBURModeL();
+ /**
+ * Executes ListPublicFiles task
+ * @return none
+ */
+ void ProcessListPublicFilesL();
+ /**
+ * Executes ListDataOwners task
+ * @return none
+ */
+ void ProcessListDataOwnersL();
+ /**
+ * Executes GetDataSize task
+ * @return none
+ */
+ void ProcessGetDataSizeL();
+ /**
+ * Executes RequestData task
+ * @return KErrNone if no erros. Else system wide error codes.
+ */
+ TInt ProcessRequestDataL();
+ /**
+ * Request data to iDataBuffer
+ * @return none
+ */
+ void RequestDataL( CSBGenericTransferType& aGenericTransferType );
+ /**
+ * Executes GetDataOwnerStatus task
+ * @return none
+ */
+ void ProcessGetDataOwnerStatusL();
+ /**
+ * Executes SupplyData task
+ * @return KErrNone if no errors. Else system wide error codes.
+ */
+ TInt ProcessSupplyDataL();
+ /**
+ * Maps TInt drive number to TDriveNumber
+ * @param aDrive Drive number as TInt
+ * @return drive number as TDriveNumber
+ */
+ TDriveNumber GetDriveNumber( const TInt& aDrive ) const;
+ /**
+ * Filters the drive list
+ * @param aDriveList Drive list to be filtered
+ * @return none
+ */
+ void FilterDriveList( TDriveList& aDriveList ) const;
+ /**
+ * Matches the uids
+ * @param aFirst The first uid
+ * @param aSecon The second uid
+ * @return ETrue if uids match, else EFalse
+ */
+ static TBool Match( const TUid& aFirst,
+ const TUid& aSecond );
+ /**
+ * Handle error received from Secure Backup Engine
+ * @param aErr Error code from Secure Backup Engine
+ * @return none
+ */
+ void HandleSBEErrorL( TInt& aErr );
+
+ /**
+ * Appends public files to CSConFile array.
+ * @param aFiles source files to append
+ * @param aSconFiles dataowner list where to add
+ * @return none
+ */
+ void AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray<CSConFile>& aSconFiles );
+
+ /**
+ * Gets Package dataowner size
+ * @param aPackageId dataowner
+ * @param TDriveList drives to include
+ * @param TPackageDataType package data type
+ * @return dataowner data size in specified drives
+ */
+ TUint PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList,
+ TPackageDataType aPackageDataType ) const;
+
+ /**
+ * Gets Sid dataowner size
+ * @param aSid dataowner
+ * @param TDriveList drives to include
+ * @param TTransferDataType transfer data type
+ * @return dataowner data size in specified drives
+ */
+ TUint SidDataSizeL( TUid aSid, const TDriveList& aDriveList,
+ TTransferDataType aTransferDataType ) const;
+
+ /**
+ * Gets Java dataowner size
+ * @param aJavaHash Java hash value
+ * @param TDriveList drives to include
+ * @return dataowner data size in specified drives
+ */
+ TUint JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const;
+
+ private:
+ CSBEClient* iSBEClient;
+ TRequestStatus* iCallerStatus;
+ CSConTask* iCurrentTask;
+ TBool iBURModeNormal;
+ TBool iRestoreMode;
+ RFs& iFs;
+ TBool iAllSnapshotsSuppliedCalled;
+ TBool iLastChunk;
+ CBufFlat* iDataBuffer;
+ TInt iDataBufferSize;
+ };
+
+#endif
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconsynchandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncHandler header
+*
+*/
+
+
+#ifndef SCONSYNCHANDLER_H_
+#define SCONSYNCHANDLER_H_
+
+#include <e32base.h>
+#include <s32file.h>
+#include "sconsyncclient.h"
+
+class RFs;
+class RWriteStream;
+class RReadStream;
+class RFileReadStream;
+
+NONSHARABLE_CLASS( TCreatedItem )
+ {
+public:
+ TInt iTemporaryId;
+ TInt iErrorCode;
+ TSmlDbItemUid iNewUid;
+ };
+
+NONSHARABLE_CLASS( TReplacedItem )
+ {
+public:
+ TSmlDbItemUid iItemUid;
+ TInt iErrorCode;
+ };
+
+NONSHARABLE_CLASS( CSconSyncHandler ) : public CActive
+{
+public:
+ static CSconSyncHandler* NewL( RFs& aFs );
+ ~CSconSyncHandler();
+
+ void HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize );
+ void HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aData );
+private:
+ CSconSyncHandler( RFs& aFs );
+ void ConstructL();
+
+ void ListStoresL( RWriteStream& aResult );
+ void OpenStoreL( const TDesC8& aParams, RWriteStream& aResult );
+ void CloseStoreL( RWriteStream& aResult );
+
+ void ListChangesL( RWriteStream& aResult );
+ void ResetChangeInfoL( RWriteStream& aResult );
+ void CommitChangesL( const TDesC8& aParams, RWriteStream& aResult );
+ void ReadItemsL( const TDesC8& aParams, RWriteStream& aResult );
+ void GetParentsL( const TDesC8& aParams, RWriteStream& aResult );
+ void CreateItemsL( RReadStream& aData );
+ void GetCreateItemsResponseL( const TDesC8& aParams, RWriteStream& aResult );
+ void ReplaceItemsL( RReadStream& aData );
+ void GetReplaceItemsResponseL( const TDesC8& aParams, RWriteStream& aResult );
+ void MoveItemsL( const TDesC8& aParams, RWriteStream& aResult );
+ void DeleteItemsL( const TDesC8& aParams, RWriteStream& aResult );
+ void SoftDeleteItemsL( const TDesC8& aParams, RWriteStream& aResult );
+ void DeleteAllItemsL( RWriteStream& aResult );
+ void GetDeleteAllItemsStatusL( RWriteStream& aResult );
+ void GetStoreFormatL( RWriteStream& aResult );
+ void SetRemoteStoreFormatL( RReadStream& aData );
+
+ void CreateNextItemOnStreamL();
+ void ReplaceNextItemOnStreamL();
+
+ void ReadNextDataBlockL( RWriteStream& aResult );
+ void ReadItemL( TSmlDbItemUid aUid, CBufFlat& aItemData );
+
+ void LoadRemoteStoreFormatL( TInt aContextId, TInt aProviderId );
+ void SaveRemoteStoreFormatL( CSmlDataStoreFormat& aStoreFormat, TInt aContextId, TInt aProviderId );
+
+ void CancelOperationsL( RWriteStream& aResult );
+
+ void Reset();
+
+ void SetCalendarCenrepL( TInt aProfileId, const TDesC& aServerId );
+ void ClearCalendarCenrepL();
+
+private: // from CActive
+ void DoCancel();
+ void RunL();
+ TInt RunError( TInt aError );
+
+private:
+ RFs& iFs; // Not owned
+ RSconSyncSession iSyncSession;
+ TBool iConnected;
+
+ TInt iCurrentDataProviderUid;
+ TInt iCurrentContextUid;
+
+ CBufFlat* iResponseData;
+
+ enum TSyncStatus
+ {
+ EReady,
+ ECreatingItemsFromFile,
+ EItemsCreated,
+ EReplacingItemsFromFile,
+ EItemsReplaced,
+ EDeletingAllItems
+ };
+ TSyncStatus iSyncStatus;
+
+ TInt iMaxObjectSize;
+ TInt iBytesWrited;
+ TBool iHasFileStream;
+ RFileReadStream iFileStream;
+ TSmlDbItemUid iCreatedItemUid;
+ TPckg<TSmlDbItemUid> iCreatedItemUidPckg;
+ TSmlDbItemUid iTemporaryItemUid;
+ TInt iItemsLeftInStream;
+ TInt iItemInProgress; // =1 if item is in progress
+ RArray<TCreatedItem> iCreatedItems;
+ RArray<TReplacedItem> iReplacedItems;
+ RArray<TSmlDbItemUid> iItemsToRead;
+ TReplacedItem iReplacedItem;
+ TFileName iFileInProgress;
+ TBool iCalendarCenrepUsed;
+};
+
+#endif /*SCONSYNCHANDLER_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/inc/sconvideoparser.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConVideoParser header file
+*
+*/
+
+
+#ifndef SCONVIDEOPARSER_H
+#define SCONVIDEOPARSER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <videoplayer.h>
+#include <TNEVideoClipInfo.h>
+#include "cscontimeout.h"
+
+// FORWARD DECLARATIONS
+class CVideoOperationObserver;
+class CVideoPlayerUtility;
+
+// CLASS DECLARATION
+
+//============================================================
+// Class CSConVideoParser declaration
+//============================================================
+NONSHARABLE_CLASS( CSConVideoParser ) : public CBase,
+ public MVideoPlayerUtilityObserver,
+ public MTNEVideoClipInfoObserver,
+ public MTNEVideoClipThumbObserver,
+ private MTimeOutObserver
+{
+public: // Constructors and destructor
+
+ ~CSConVideoParser();
+ static CSConVideoParser* NewLC();
+
+ /**
+ * Opens file
+ * @return none
+ */
+ void OpenFileL( const RFs& aFs, const TDesC& aFilename );
+
+ /**
+ * Get video thumbnail
+ * @return video thumbnail in jpeg format,
+ * return KNullDesC8 if thumbain could not found
+ */
+ const TDesC8& Thumbnail() const;
+
+ /**
+ * Get video frame rate
+ * @return video frame rate frames/sec
+ */
+ TReal32 VideoFrameRateL() const;
+
+ /**
+ * Get video frame size
+ * @return none
+ */
+ void VideoFrameSizeL(TSize& aSize) const;
+
+ /**
+ * Get video format
+ * @return video format mimetype (example: video/mp4v-es)
+ */
+ const TDesC8& VideoFormatMimeTypeL() const;
+
+ /**
+ * Get videostream bitrate
+ * @return video bitrate bits/sec
+ */
+ TInt VideoBitRateL() const;
+
+ /**
+ * Get audiostream bitrate
+ * @return audio bitrate bits/sec
+ */
+ TInt AudioBitRateL() const;
+
+ /**
+ * Get video duration
+ * @return video duration in milliseconds.
+ */
+ TInt DurationL() const;
+
+ /**
+ * Get videostream bitrate
+ * @return videostream mimetype
+ */
+ const TDesC& VideoMimeTypeL();
+
+ /**
+ * Get audiostream mimetype
+ * @return audiostream mimetype
+ */
+ const TDesC& AudioMimeTypeL();
+
+protected: // from base classes
+ /** @see MVideoPlayerUtilityObserver::MvpuoOpenComplete */
+ void MvpuoOpenComplete(TInt aError);
+
+ /** @see MVideoPlayerUtilityObserver::MvpuoPrepareComplete */
+ void MvpuoPrepareComplete(TInt aError);
+
+ /** @see MVideoPlayerUtilityObserver::MvpuoFrameReady */
+ void MvpuoFrameReady(CFbsBitmap& aFrame,TInt aError);
+
+ /** @see MVideoPlayerUtilityObserver::MvpuoPlayComplete */
+ void MvpuoPlayComplete(TInt aError);
+
+ /** @see MVideoPlayerUtilityObserver::MvpuoEvent */
+ void MvpuoEvent(const TMMFEvent& aEvent);
+
+ /** @see MTNEVideoClipInfoObserver::NotifyVideoClipInfoReady */
+ void NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError);
+
+ void NotifyVideoClipThumbCompleted(CTNEVideoClipInfo& aInfo,
+ TInt aError,
+ CFbsBitmap* aThumb);
+
+ /** @see MTimeOutObserver::TimeOut */
+ void TimeOut();
+
+private:
+
+ CSConVideoParser();
+ void ConstructL();
+
+private: // data
+ CVideoPlayerUtility* iVideoUtil;
+ CTNEVideoClipInfo* iVideoClip;
+
+ RWsSession iWsSession;
+ CWsScreenDevice* iScreen;
+ RWindow* iWindow;
+ RWindowGroup iRootWindow;
+
+ TRequestStatus* iCallerStatus;
+ CActiveSchedulerWait iWait;
+ CSconTimeOut* iTimeOut;
+
+ HBufC8* iThumbnail;
+ HBufC* iVideoMimeType;
+ HBufC* iAudioMimeType;
+
+ TBool iVideoUtilReady;
+ TBool iVideoClipReady;
+ TInt iVideoUtilErr;
+ TInt iVideoClipErr;
+ TBool iAsyncStopCalled;
+};
+
+#endif // SCONVIDEOPARSER_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/cscontimeout.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconTimeOut implementation
+*
+*/
+
+
+#include "cscontimeout.h"
+
+CSconTimeOut::CSconTimeOut( MTimeOutObserver& aTimeOutObserver ) :
+ CActive(EPriorityStandard), // Standard priority
+ iTimeOutObserver(aTimeOutObserver)
+ {
+ }
+
+
+CSconTimeOut* CSconTimeOut::NewL( MTimeOutObserver& aTimeOutObserver )
+ {
+ CSconTimeOut* self = new (ELeave) CSconTimeOut( aTimeOutObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+void CSconTimeOut::ConstructL()
+ {
+ User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer
+ CActiveScheduler::Add(this); // Add to scheduler
+ }
+
+CSconTimeOut::~CSconTimeOut()
+ {
+ Cancel(); // Cancel any request, if outstanding
+ iTimer.Close(); // Destroy the RTimer object
+ }
+
+void CSconTimeOut::DoCancel()
+ {
+ iTimer.Cancel();
+ }
+
+void CSconTimeOut::Start(TTimeIntervalMicroSeconds32 aDelay)
+ {
+ Cancel(); // Cancel any request, just to be sure
+ iTimer.After(iStatus, aDelay); // Set for later
+ SetActive(); // Tell scheduler a request is active
+ }
+
+void CSconTimeOut::RunL()
+ {
+ iTimeOutObserver.TimeOut();
+ }
+
+TInt CSconTimeOut::RunError(TInt aError)
+ {
+ return aError;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconbackuprestore.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConBackupRestore implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <pathinfo.h>
+
+#include "sconbackuprestore.h"
+#include "sconsbeclient.h"
+#include "sconbrqueue.h"
+#include "sconpcdconsts.h"
+
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore* CSConBackupRestore::NewL( CSConBackupRestoreQueue* aQueue,
+// cost TInt& aMaxObjectSize )
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestore* CSConBackupRestore::NewL( CSConBackupRestoreQueue* aQueue,
+ const TInt aMaxObjectSize, RFs& aFs )
+ {
+ CSConBackupRestore* self = new (ELeave) CSConBackupRestore( aQueue, aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL( aMaxObjectSize );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::CSConBackupRestore( CSConBackupRestoreQueue* aQueue )
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestore::CSConBackupRestore( CSConBackupRestoreQueue* aQueue, RFs& aFs ) :
+ CActive( EPriorityStandard ), iQueue( aQueue ), iFs( aFs )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::ConstructL( const TInt aMaxObjectSize )
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::ConstructL( const TInt aMaxObjectSize )
+ {
+ iMaxObjectSize = aMaxObjectSize;
+ iSBEClient = CSConSBEClient::NewL( aMaxObjectSize, iFs );
+ CActiveScheduler::Add( iSBEClient );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::~CSConBackupRestore()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestore::~CSConBackupRestore()
+ {
+ if( iSBEClient )
+ {
+ iSBEClient->Cancel();
+ delete iSBEClient;
+ iSBEClient = NULL;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::StartBackupRestore( TInt aTaskId )
+// Starts backup-restore task
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::StartBackupRestore( TInt aTaskId )
+ {
+ iBackupRestoreActive = ETrue;
+ CSConTask* task = NULL;
+
+ TInt ret = iQueue->GetTask( aTaskId, task );
+
+ if( aTaskId > 0 && ret != KErrNotFound )
+ {
+ iCurrentTask = aTaskId;
+ iQueue->SetTaskProgress( aTaskId, KSConCodeProcessingStarted );
+ }
+
+ switch( task->GetServiceId() )
+ {
+ case ESetBURMode :
+ iQueue->ChangeQueueProcessStatus();
+ iSBEClient->SetBURMode( iStatus, task );
+ break;
+ case EListPublicFiles :
+ iSBEClient->ListPublicFiles( iStatus, task );
+ break;
+ case EListDataOwners :
+ iSBEClient->ListDataOwners( iStatus, task );
+ break;
+ case EGetDataSize :
+ iSBEClient->GetDataSize( iStatus, task );
+ break;
+ case ERequestData :
+ iSBEClient->RequestData( iStatus, task );
+ break;
+ case EGetDataOwnerStatus :
+ iSBEClient->GetDataOwnerStatus( iStatus, task );
+ break;
+ case ESupplyData :
+ iSBEClient->SupplyData( iStatus, task );
+ break;
+ default :
+ break;
+ }
+
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::StopBackupRestore( TInt aTaskId )
+// Stops executing backup-restore task
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::StopBackupRestore( TInt aTaskId )
+ {
+ TRACE_FUNC_ENTRY;
+ //if the task is active, do cancel
+ if( iCurrentTask == aTaskId )
+ {
+ iBackupRestoreActive = EFalse;
+ iSBEClient->Cancel();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::Reset()
+// Resets backup
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::Reset()
+ {
+ TRACE_FUNC_ENTRY;
+ if( iSBEClient )
+ {
+ iSBEClient->Cancel();
+ delete iSBEClient;
+ iSBEClient = NULL;
+ }
+
+ TRAPD( err, iSBEClient = CSConSBEClient::NewL( iMaxObjectSize, iFs ) );
+
+ if( err == KErrNone )
+ {
+ CActiveScheduler::Add( iSBEClient );
+ }
+
+ iBackupRestoreActive = EFalse;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::BackupRestoreActive()
+// returns backup-restore activity status
+// -----------------------------------------------------------------------------
+//
+TBool CSConBackupRestore::BackupRestoreActive() const
+ {
+ return iBackupRestoreActive;
+ }
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::DoCancel()
+// Implementation of CActive::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::DoCancel()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestore::RunL()
+// Implementation of CActive::RunL()
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestore::RunL()
+ {
+ TRACE_FUNC;
+ iQueue->CompleteTask( iCurrentTask, iStatus.Int() );
+ iBackupRestoreActive = EFalse;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconbrqueue.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Backup-Restore Queue implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "sconbrqueue.h"
+#include "sconbackuprestore.h"
+#include "sconpcdconsts.h"
+#include "sconinstqueue.h"
+#include "debug.h"
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize )
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestoreQueue* CSConBackupRestoreQueue::NewL( const TInt aMaxObjectSize, RFs& aFs )
+ {
+ CSConBackupRestoreQueue* self = new (ELeave) CSConBackupRestoreQueue();
+ CleanupStack::PushL( self );
+ self->ConstructL( aMaxObjectSize, aFs );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::CSConBackupRestoreQueue()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestoreQueue::CSConBackupRestoreQueue() :
+ CActive( EPriorityStandard )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize )
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::ConstructL( const TInt aMaxObjectSize, RFs& aFs )
+ {
+ iBackupRestore = CSConBackupRestore::NewL( this, aMaxObjectSize, aFs );
+ CActiveScheduler::Add( iBackupRestore );
+ User::LeaveIfError( iTimer.CreateLocal() );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::~CSConBackupRestoreQueue()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConBackupRestoreQueue::~CSConBackupRestoreQueue()
+ {
+ TRACE_FUNC_ENTRY;
+ Cancel();
+ if( iBackupRestore )
+ {
+ delete iBackupRestore;
+ iBackupRestore = NULL;
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::StartQueue()
+// Starts queue polling
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::StartQueue()
+ {
+ if( IsActive() )
+ {
+ Cancel();
+ }
+
+ iTimer.After( iStatus, KSConTimerValue );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::StopQueue()
+// Stops queue polling
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::StopQueue()
+ {
+ iTimer.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
+// Adds a new task to queue
+// -----------------------------------------------------------------------------
+//
+TInt CSConBackupRestoreQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
+ {
+ LOGGER_WRITE_1( "CSConBackupRestoreQueue::AddNewTask aTaskId: %d", aTaskId );
+ TInt ret( KErrNone );
+
+ aNewTask->iTaskId = aTaskId;
+
+ //Set progress value "task accepted for execution"
+ aNewTask->SetProgressValue( KSConCodeTaskCreated );
+ aNewTask->SetCompleteValue( EFalse );
+
+ //For RequestData and SupplyData
+ if( iQueue.Find( aNewTask, CSConTaskQueue::Match ) != KErrNotFound )
+ {
+ RemoveTask( aTaskId );
+ }
+
+ if( iQueue.Count() == 0 )
+ {
+ StartQueue();
+ }
+
+ ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks )
+// Cancels a task
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::CancelTask( TInt aTask, TBool aAllTasks )
+ {
+ TRACE_FUNC_ENTRY;
+ //Stop backup/restore
+ if( aTask && !aAllTasks )
+ {
+ LOGGER_WRITE_1("CSConBackupRestoreQueue::CancelTask - Cancel task: %d", aTask);
+ iBackupRestore->StopBackupRestore( aTask );
+ }
+
+ if( aAllTasks )
+ {
+ LOGGER_WRITE("CSConBackupRestoreQueue::CancelTask - Cancel All");
+ iBackupRestore->Cancel();
+ iBackupRestore->Reset();
+ }
+
+ CSConTaskQueue::CancelTask( aTask, aAllTasks );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::Reset()
+// Resets the queue
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::Reset()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConTaskQueue::Reset();
+ iBackupRestore->Reset();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue )
+// An address pointer to another queue
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::QueueAddress( CSConInstallerQueue*& aTaskQueue )
+ {
+ iInstQueueAddress = aTaskQueue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::GetTaskMethod( TInt& aTaskId )
+// Returns the task type
+// -----------------------------------------------------------------------------
+//
+TSConMethodName CSConBackupRestoreQueue::GetTaskMethodL( TInt aTaskId )
+ {
+ TRACE_FUNC_ENTRY;
+ CSConTask* task = NULL;
+ CSConTaskQueue::GetTask( aTaskId, task );
+ LOGGER_WRITE_1( "CSConBackupRestoreQueue::GetTaskMethodL( TInt aTaskId ) : returned %d",
+ task->GetServiceId() );
+ return task->GetServiceId();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConBackupRestoreQueue::PollQueue()
+// Polls queue
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::PollQueue()
+ {
+ // find and start next task if BR and installer is inactive
+ if( !iBackupRestore->BackupRestoreActive()
+ && !iInstQueueAddress->QueueProcessActive() )
+ {
+ //find next task
+ for( TInt i = 0; i < iQueue.Count(); i++ )
+ {
+ TBool complete = iQueue[i]->GetCompleteValue();
+
+ if( complete == EFalse )
+ {
+ iBackupRestore->StartBackupRestore(
+ iQueue[i]->iTaskId );
+ i = iQueue.Count() + 1; // jump out from loop
+ }
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// Implementation of CActive::DoCancel()
+// Entry to CSConPCD
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::DoCancel()
+ {
+ TRACE_FUNC_ENTRY;
+ iTimer.Cancel();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// Implementation of CActive::RunL()
+// Entry to CSConPCD
+// -----------------------------------------------------------------------------
+//
+void CSConBackupRestoreQueue::RunL()
+ {
+ if( iQueue.Count() > 0 )
+ {
+ PollQueue();
+ StartQueue();
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconinstaller.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,528 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConAppInstaller implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <pathinfo.h>
+#include <swi/sisregistryentry.h>
+#include <swi/sisregistrypackage.h>
+#include <swi/sisregistrysession.h>
+#include <SWInstDefs.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <javaregistry.h>
+
+using namespace Java;
+
+#include "debug.h"
+#include "sconinstaller.h"
+#include "sconpcdconsts.h"
+#include "sconpcdutility.h"
+
+_LIT8( KWidgetMimeType, "application/x-nokia-widget");
+
+const TInt KSConSeConUidValue = 0x101f99f6;
+const TUid KSConSeConUid = {KSConSeConUidValue};
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::CSConAppInstaller( CSConInstallerQueue* aQueue )
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConAppInstaller::CSConAppInstaller( CSConInstallerQueue* aQueue, RFs& aFs ) :
+ CActive( EPriorityStandard ), iQueue( aQueue ), iFs( aFs )
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::~CSConAppInstaller()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConAppInstaller::~CSConAppInstaller()
+ {
+ TRACE_FUNC;
+ iSWInst.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::StartInstaller( TInt& aTaskId )
+// Starts the installer task
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::StartInstaller( TInt& aTaskId )
+ {
+ TRACE_FUNC_ENTRY;
+ CSConTask* task = NULL;
+ TRequestStatus* status = NULL;
+ TInt err( KErrNone );
+
+ TInt ret = iQueue->GetTask( aTaskId, task );
+
+ if( aTaskId > 0 && ret != KErrNotFound )
+ {
+ if ( iInstallerState != EIdle || IsActive() )
+ {
+ LOGGER_WRITE("WARNING! SConAppInstaller was not on idle state!");
+ iQueue->CompleteTask( aTaskId, KErrInUse );
+ TRACE_FUNC_EXIT;
+ return;
+ }
+
+
+ iCurrentTask = aTaskId;
+ iQueue->SetTaskProgress( aTaskId, KSConCodeProcessingStarted );
+
+ switch( task->GetServiceId() )
+ {
+ case EInstall :
+ iQueue->ChangeQueueProcessStatus();
+ err = iSWInst.Connect();
+
+ if( err == KErrNone )
+ {
+ if ( task->iInstallParams->iMode == ESilentInstall )
+ {
+ LOGGER_WRITE( "Begin silent installation.. " );
+ iOptions.iUntrusted = SwiUI::EPolicyNotAllowed;
+ iOptions.iOCSP = SwiUI::EPolicyNotAllowed;
+ iOptionsPckg = iOptions;
+ iInstallerState = ESilentInstalling;
+ iSWInst.SilentInstall( iStatus, task->iInstallParams->iPath, iOptionsPckg );
+ }
+ else
+ {
+ LOGGER_WRITE( "Begin to install.. " );
+ iInstallerState = EInstalling;
+ iSWInst.Install( iStatus, task->iInstallParams->iPath );
+ }
+ }
+
+ break;
+ case EUninstall :
+ iQueue->ChangeQueueProcessStatus();
+ err = iSWInst.Connect();
+
+ if( err == KErrNone )
+ {
+ LOGGER_WRITE( "Begin to uninstall.. " );
+
+ TRAP( err, ProcessUninstallL( *task->iUninstallParams ) );
+ if( err != KErrNone )
+ {
+ LOGGER_WRITE_1( "StartInstaller ProcessUninstallL err: %d", err );
+ status = &iStatus;
+ User::RequestComplete( status, err );
+ }
+ }
+
+ break;
+ case EListInstalledApps :
+ iQueue->ChangeQueueProcessStatus();
+ iInstallerState = EListingInstalledApps;
+ TRAP( err, ProcessListInstalledAppsL() );
+ status = &iStatus;
+ User::RequestComplete( status, err );
+ break;
+ default :
+ break;
+ }
+
+ SetActive();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::StopInstaller( TInt& aTaskId )
+// Stops the installer task
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::StopInstaller( TInt& aTaskId )
+ {
+ TRACE_FUNC_ENTRY;
+ //If the task is the current task, cancel it first
+ if( iCurrentTask == aTaskId )
+ {
+ Cancel();
+ iSWInst.Close();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// TBool CSConAppInstaller::InstallerActive()
+// returns installer activity status
+// -----------------------------------------------------------------------------
+//
+TBool CSConAppInstaller::InstallerActive() const
+ {
+ if ( iInstallerState == EIdle )
+ {
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::DoCancel()
+// Implementation of CActive::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::DoCancel()
+ {
+ TRACE_FUNC_ENTRY;
+
+ switch (iInstallerState)
+ {
+ case EInstalling:
+ LOGGER_WRITE("Cancel normal install");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestInstall );
+ break;
+ case ESilentInstalling:
+ LOGGER_WRITE("Cancel silent install");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentInstall );
+ break;
+ case EUninstalling:
+ LOGGER_WRITE("Cancel normal uninstall");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestUninstall );
+ break;
+ case ESilentUninstalling:
+ LOGGER_WRITE("Cancel silent uninstall");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentUninstall );
+ break;
+ case ECustomUninstalling:
+ LOGGER_WRITE("Cancel custom uninstall");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestCustomUninstall );
+ break;
+ case ESilentCustomUnistalling:
+ LOGGER_WRITE("Cancel silent custom uninstall");
+ iSWInst.CancelAsyncRequest( SwiUI::ERequestSilentCustomUninstall );
+ break;
+ default:
+ LOGGER_WRITE("WARNING! Unknown state");
+ break;
+ }
+ iInstallerState = EIdle;
+
+ // find and complete current task
+ CSConTask* task = NULL;
+ TInt ret = iQueue->GetTask( iCurrentTask, task );
+
+ if ( iCurrentTask > 0 && ret != KErrNotFound )
+ {
+
+ switch( task->GetServiceId() )
+ {
+ case EInstall :
+ iQueue->CompleteTask( iCurrentTask, KErrCancel );
+ break;
+ case EUninstall :
+ iQueue->CompleteTask( iCurrentTask, KErrCancel );
+ break;
+ default :
+ break;
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::RunL()
+// Implementation of CActive::RunL()
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ iInstallerState = EIdle;
+ iSWInst.Close();
+ iQueue->ChangeQueueProcessStatus();
+ TInt err( iStatus.Int() );
+ LOGGER_WRITE_1( "CSConAppInstaller::RunL() iStatus.Int() : returned %d", err );
+
+ CSConTask* task = NULL;
+ TInt taskErr = iQueue->GetTask( iCurrentTask, task );
+
+ LOGGER_WRITE_1( "CSConAppInstaller::RunL() GetTask %d", taskErr );
+
+ if( taskErr == KErrNone )
+ {
+ if( task->GetServiceId() == EInstall && err == KErrNone )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::RunL() : before DeleteFile" );
+ //delete sis after succesfull install
+ DeleteFile( task->iInstallParams->iPath );
+ }
+ }
+
+ iQueue->CompleteTask( iCurrentTask, err );
+ TRACE_FUNC_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::ProcessUninstallL( const CSConUninstall& aUninstallParams )
+// Execures UnInstall task
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::ProcessUninstallL( const CSConUninstall& aUninstallParams )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aUid: 0x%08x", aUninstallParams.iUid.iUid );
+ LOGGER_WRITE_1( "aName: %S", &aUninstallParams.iName );
+ LOGGER_WRITE_1( "aVendor: %S", &aUninstallParams.iVendor );
+ LOGGER_WRITE_1( "aType: %d", aUninstallParams.iType );
+ LOGGER_WRITE_1( "aMode: %d", aUninstallParams.iMode );
+ switch ( aUninstallParams.iType )
+ {
+ case ESisApplication:
+ case ESisAugmentation:
+ UninstallSisL( aUninstallParams );
+ break;
+ case EJavaApplication:
+ UninstallJavaL( aUninstallParams.iUid,
+ aUninstallParams.iMode);
+ break;
+ case EWidgetApplication:
+ UninstallWidget( aUninstallParams.iUid,
+ aUninstallParams.iMode );
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::UninstallSisL( const CSConUninstall& aUninstallParams )
+// Uninstall sis package or augmentation
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::UninstallSisL( const CSConUninstall& aUninstallParams )
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( aUninstallParams.iUid == KSConSeConUid )
+ {
+ LOGGER_WRITE("Cannot uninstall itself, leave");
+ // cannot uninstall itself
+ User::Leave( SwiUI::KSWInstErrFileInUse );
+ }
+
+ Swi::RSisRegistrySession sisRegistry;
+ User::LeaveIfError( sisRegistry.Connect() );
+ CleanupClosePushL( sisRegistry );
+ //Check if uid belongs to SIS package
+ if( !sisRegistry.IsInstalledL( aUninstallParams.iUid ) )
+ {
+ CleanupStack::PopAndDestroy( &sisRegistry );
+ User::Leave( KErrNotFound );
+ }
+
+ Swi::RSisRegistryEntry entry;
+ CleanupClosePushL(entry);
+ User::LeaveIfError( entry.Open( sisRegistry, aUninstallParams.iUid ) );
+ if ( aUninstallParams.iType == ESisAugmentation )
+ {
+ // augmentation pkg
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL ESisAugmentation" );
+
+ TBool augmentationFound(EFalse);
+ // Get possible augmentations
+ RPointerArray<Swi::CSisRegistryPackage> augPackages;
+ CleanupResetAndDestroyPushL( augPackages );
+ entry.AugmentationsL( augPackages );
+ for ( TInt j( 0 ); j < augPackages.Count() && !augmentationFound; j++ )
+ {
+ Swi::RSisRegistryEntry augmentationEntry;
+ CleanupClosePushL( augmentationEntry );
+ augmentationEntry.OpenL( sisRegistry, *augPackages[j] );
+
+ HBufC* augPackageName = augmentationEntry.PackageNameL();
+ CleanupStack::PushL( augPackageName );
+ HBufC* augUniqueVendorName = augmentationEntry.UniqueVendorNameL();
+ CleanupStack::PushL( augUniqueVendorName );
+
+ if ( !augmentationEntry.IsInRomL()
+ && augmentationEntry.IsPresentL()
+ && aUninstallParams.iName.Compare( *augPackageName ) == 0
+ && aUninstallParams.iVendor.Compare( *augUniqueVendorName ) == 0 )
+ {
+ // Correct augmentation found, uninstall it.
+ augmentationFound = ETrue;
+ TInt augmentationIndex = augPackages[j]->Index();
+ LOGGER_WRITE_1( "CSConAppInstaller::ProcessUninstallL augmentationIndex %d", augmentationIndex );
+
+ SwiUI::TOpUninstallIndexParam params;
+ params.iUid = aUninstallParams.iUid;
+ params.iIndex = augmentationIndex;
+ SwiUI::TOpUninstallIndexParamPckg pckg( params );
+ SwiUI::TOperation operation( SwiUI::EOperationUninstallIndex );
+ if( aUninstallParams.iMode == ESilentInstall )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : silent aug-sis-uninstall" );
+ SwiUI::TUninstallOptionsPckg options;
+ iInstallerState = ESilentCustomUnistalling;
+ iSWInst.SilentCustomUninstall( iStatus, operation, options, pckg, KSISMIMEType );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : unsilent aug-sis-uninstall" )
+ iInstallerState = ECustomUninstalling;
+ iSWInst.CustomUninstall( iStatus, operation, pckg, KSISMIMEType );
+ }
+ }
+ CleanupStack::PopAndDestroy( augUniqueVendorName );
+ CleanupStack::PopAndDestroy( augPackageName );
+ CleanupStack::PopAndDestroy( &augmentationEntry );
+ }
+ CleanupStack::PopAndDestroy( &augPackages );
+
+ if ( !augmentationFound )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL augmentation not found -> Leave" );
+ User::Leave( KErrNotFound );
+ }
+ }
+ else
+ {
+ // Only uninstall if not in rom and is present
+ if ( !entry.IsInRomL() && entry.IsPresentL() )
+ {
+ if ( aUninstallParams.iMode == ESilentInstall )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : silent sis-uninstall" );
+ SwiUI::TUninstallOptionsPckg options;
+ iInstallerState = ESilentUninstalling;
+ iSWInst.SilentUninstall( iStatus, aUninstallParams.iUid, options, KSISMIMEType );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL : unsilent sis-uninstall" )
+ iInstallerState = EUninstalling;
+ iSWInst.Uninstall( iStatus, aUninstallParams.iUid, KSISMIMEType );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::ProcessUninstallL sis not present -> Leave" );
+ User::Leave( KErrNotFound );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &entry );
+ CleanupStack::PopAndDestroy( &sisRegistry );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode )
+// Uninstall java package
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::UninstallJavaL( const TUid& aUid, const TSConInstallMode aMode )
+ {
+ TRACE_FUNC_ENTRY;
+ CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( );
+ TBool entryExist = javaRegistry->RegistryEntryExistsL( aUid );
+ CleanupStack::PopAndDestroy( javaRegistry );
+
+ if( entryExist )
+ {
+ if( aMode == ESilentInstall )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL : silent midlet-uninstall" )
+ SwiUI::TUninstallOptionsPckg options;
+ iInstallerState = ESilentUninstalling;
+ iSWInst.SilentUninstall( iStatus, aUid, options, KMidletMIMEType );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL : unsilent midlet-uninstall" )
+ iInstallerState = EUninstalling;
+ iSWInst.Uninstall( iStatus, aUid, KMidletMIMEType );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::UninstallJavaL java entry does not exist -> Leave" )
+ User::Leave( KErrNotFound );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::UninstallWidget( const TUid& aUid, const TSConInstallMode aMode )
+// Uninstall widget
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::UninstallWidget( const TUid& aUid, const TSConInstallMode aMode )
+ {
+ TRACE_FUNC_ENTRY;
+ if( aMode == ESilentInstall )
+ {
+ LOGGER_WRITE( "CSConAppInstaller::UninstallWidget : silent uninstall" )
+ SwiUI::TUninstallOptionsPckg options;
+ iInstallerState = ESilentUninstalling;
+ iSWInst.SilentUninstall( iStatus, aUid, options, KWidgetMimeType );
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConAppInstaller::UninstallWidget : unsilent uninstall" )
+ iInstallerState = EUninstalling;
+ iSWInst.Uninstall( iStatus, aUid, KWidgetMimeType );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+//--------------------------------------------------------------------------------
+//void CSConAppInstaller::ProcessListInstalledAppsL()
+//--------------------------------------------------------------------------------
+//
+void CSConAppInstaller::ProcessListInstalledAppsL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ CSConTask* task = NULL;
+ User::LeaveIfError( iQueue->GetTask( iCurrentTask, task ) );
+
+ SConPcdUtility::ProcessListInstalledAppsL( task );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConAppInstaller::DeleteFile( const TDesC& aPath )
+// Deletes a file
+// -----------------------------------------------------------------------------
+//
+void CSConAppInstaller::DeleteFile( const TDesC& aPath )
+ {
+ TRACE_FUNC;
+ iFs.Delete( aPath );
+ }
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconinstqueue.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Installer Queue implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "sconinstqueue.h"
+#include "sconbrqueue.h"
+#include "sconinstaller.h"
+#include "sconpcdconsts.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCSConInstallerQueue* CSConInstallerQueue::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConInstallerQueue* CSConInstallerQueue::NewL( RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ CSConInstallerQueue* self = new (ELeave) CSConInstallerQueue( aFs );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::CSConInstallerQueue()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConInstallerQueue::CSConInstallerQueue( RFs& aFs ) : CActive( EPriorityStandard ), iFs( aFs )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ iInstaller = new (ELeave) CSConAppInstaller( this, iFs );
+ CActiveScheduler::Add( iInstaller );
+ User::LeaveIfError( iTimer.CreateLocal() );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::~CSConInstallerQueue()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConInstallerQueue::~CSConInstallerQueue()
+ {
+ TRACE_FUNC_ENTRY;
+ Cancel();
+ if( iInstaller )
+ {
+ iInstaller->Cancel();
+ delete iInstaller;
+ iInstaller = NULL;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::StartQueue()
+// Starts queue polling
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::StartQueue()
+ {
+ TRACE_FUNC;
+ if( IsActive() )
+ {
+ Cancel();
+ }
+
+ iTimer.After( iStatus, KSConTimerValue );
+ SetActive();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::StartQueue()
+// Stops queue polling
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::StopQueue()
+ {
+ TRACE_FUNC_ENTRY;
+ iTimer.Cancel();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::CancelTask( TInt aTask, TBool aAllTasks )
+// Cancels a task
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::CancelTask( TInt aTask, TBool aAllTasks )
+ {
+ TRACE_FUNC_ENTRY;
+ //Stop the installer
+ if( aTask && !aAllTasks )
+ {
+ iInstaller->StopInstaller( aTask );
+ }
+
+ if( aAllTasks )
+ {
+ iInstaller->Cancel();
+ }
+ CSConTaskQueue::CancelTask( aTask, aAllTasks );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::QueueAddress( CSConBackupRestoreQueue*& aTaskQueue )
+// An address pointer to another queue
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::QueueAddress( CSConBackupRestoreQueue*& aTaskQueue )
+ {
+ TRACE_FUNC;
+ iBRQueueAddress = aTaskQueue;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::PollQueue()
+// Polls queue
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::PollQueue()
+ {
+ TRACE_FUNC_ENTRY;
+ // find and start next task if installer and BR is inactive
+ if( !iInstaller->InstallerActive()
+ && !iBRQueueAddress->QueueProcessActive() )
+ {
+ //find next task
+ for( TInt i = 0; i < iQueue.Count(); i++ )
+ {
+ TBool complete = iQueue[i]->GetCompleteValue();
+
+ if( complete == EFalse )
+ {
+ iInstaller->StartInstaller( iQueue[i]->iTaskId );
+ i = iQueue.Count() + 1; // jump out from loop
+ }
+ }
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::DoCancel()
+// Implementation of CActive::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::DoCancel()
+ {
+ TRACE_FUNC;
+ iTimer.Cancel();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConInstallerQueue::RunL()
+// Implementation of CActive::RunL()
+// -----------------------------------------------------------------------------
+//
+void CSConInstallerQueue::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "There are still %d tasks in this queue", iQueue.Count() );
+ if( iQueue.Count() > 0 )
+ {
+ PollQueue();
+ StartQueue();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconmetadata.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1362 @@
+/*
+* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SConMetadata implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <utf.h> // for CnvUtfConverter
+#include <MetaDataUtility.h>
+#include <MetaDataFieldContainer.h>
+#include <MetaDataField.hrh>
+#include <caf/content.h>
+#include <caf/data.h>
+#include <ExifRead.h>
+#include <ExifTag.h>
+
+#include "sconmetadata.h"
+#include "sconconmltask.h"
+#include "sconpcdconsts.h"
+#include "sconvideoparser.h"
+#include "debug.h"
+#include "sconmetadatafielddefs.h"
+
+
+
+const TInt KBufferSize(1024);
+// Size of buffer to load from file start to get EXIF thumbnail
+const TInt KJpegLoadBufferSize = 65536; // 64k
+
+
+const TUint32 KFieldMaxLength = 0xFFFFFFFF; // four bytes reserved for "length" information
+
+// GPS related Exif IDs
+const TUint16 KGPSLatitudeRef = 0x01;
+const TUint16 KGPSLatitude = 0x02;
+const TUint16 KGPSLongitudeRef = 0x03;
+const TUint16 KGPSLongitude = 0x04;
+const TUint16 KGPSAltitudeRef = 0x05;
+const TUint16 KGPSAltitude = 0x06;
+
+
+// extensions for exif parser
+_LIT(KJpgExt, ".jpg");
+_LIT(KJpegExt, ".jpeg");
+// extensions for audio metadata parser
+_LIT(KAacExt, ".aac");
+_LIT(KMp3Ext, ".mp3");
+_LIT(KMp4Ext, ".mp4");
+_LIT(KWmaExt, ".wma");
+// extensions for video metadata parser
+_LIT(KM4aExt, ".m4a");
+_LIT(K3gpExt, ".3gp");
+
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// SConMetadata::ProcessTask()
+// ProcessTask
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::ProcessTask( CSConTask& aTask, RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err(KErrNone);
+ if ( aTask.GetServiceId() == EGetMetadata )
+ {
+ LOGGER_WRITE_1( "SConMetadata::ProcessTask() : file %S",
+ &aTask.iGetMetadataParams->iFilename );
+
+#ifdef _DEBUG
+ LOGGER_WRITE( "start.. " );
+ TTimeIntervalMicroSeconds sec;
+ TTime start;
+ TTime end;
+ start.HomeTime();
+#endif
+
+ TParsePtrC filename( aTask.iGetMetadataParams->iFilename );
+
+ if ( filename.Ext().CompareF( KJpgExt ) == 0
+ || filename.Ext().CompareF( KJpegExt ) == 0 )
+ {
+ // jpg file, try to read exif
+ LOGGER_WRITE( "jpg file, Try to read exif" );
+ TRAP( err, ReadExifDataL( aTask, aFs ) );
+ }
+ else if ( filename.Ext().CompareF( KMp4Ext ) == 0
+ || filename.Ext().CompareF( K3gpExt ) == 0 )
+ {
+ LOGGER_WRITE( "Try to read video" );
+ TRAP( err, GetVideoMetadataL( aTask, aFs ) );
+ }
+ else if ( filename.Ext().CompareF( KAacExt ) == 0
+ || filename.Ext().CompareF( KM4aExt ) == 0
+ || filename.Ext().CompareF( KMp3Ext ) == 0
+ || filename.Ext().CompareF( KWmaExt ) == 0 )
+ {
+
+ // audio file, try to read audio
+ LOGGER_WRITE( "Try to read audio" );
+ TRAP( err, GetAudioMetadataL( aTask ) );
+ }
+ else
+ {
+ LOGGER_WRITE( "File extension not supported" );
+ err = KErrNotSupported;
+ }
+
+#ifdef _DEBUG
+ end.HomeTime();
+ sec = end.MicroSecondsFrom( start );
+
+ LOGGER_WRITE_1( "trapErr %d", err );
+ LOGGER_WRITE_1( "duration: %Ld", sec.Int64() );
+#endif
+ }
+ else
+ {
+ LOGGER_WRITE( "SConMetadata::ProcessTask() : not supported" );
+ err = KErrNotSupported;
+ }
+
+ LOGGER_WRITE( "SConMetadata::ProcessTask() : CompleteTask" );
+
+ TInt progress( KSConCodeTaskCompleted );
+ TBool complete ( ETrue );
+ switch( err )
+ {
+ case KErrNone :
+ progress = KSConCodeTaskCompleted;
+ break;
+ case KErrNotFound :
+ case KErrBadName :
+ progress = KSConCodeNotFound;
+ break;
+ default :
+ progress = KSConCodeConflict;
+ break;
+ }
+
+ aTask.SetCompleteValue( complete );
+ aTask.SetProgressValue( progress );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::GetAudioMetadataL()
+// Read audio metadata
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::GetAudioMetadataL( CSConTask& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ CMetaDataUtility* metadataUtil = CMetaDataUtility::NewL();
+ CleanupStack::PushL( metadataUtil );
+
+ LOGGER_WRITE( "SConMetadata::GetAudioMetadataL() : OpenFileL" );
+ metadataUtil->OpenFileL( aTask.iGetMetadataParams->iFilename );
+
+ TInt count = metadataUtil->MetaDataCount();
+ LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() : MetaDataCount %d", count );
+ if ( count > 0 )
+ {
+ const CMetaDataFieldContainer& fields = metadataUtil->MetaDataFieldsL();
+ count = fields.Count();
+
+ CBufFlat* buffer = CBufFlat::NewL( KBufferSize );
+ CleanupStack::PushL( buffer );
+ buffer->Reset();
+
+
+ TInt offset(0);
+ // write object header
+ // Item type (1 byte) + Version (1 byte) = 2 bytes
+ buffer->ExpandL( offset, 2 );
+
+ // header id
+ TUint8 value( KSconMetadataHeaderAudio );
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+ // header version
+ value = KSconMetadataHeaderVersion;
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+ // Add ID3 field
+ value = metadataUtil->ID3Version();
+ AppendTUintDataFieldL( buffer, value, KSconAudioID3Version );
+
+ TMetaDataFieldId fieldId;
+ TPtrC fieldData;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ // get field id
+ fields.FieldIdAt( i , fieldId );
+ LOGGER_WRITE_2( "AudioFieldId( %d ): 0x%02x", i, fieldId );
+ TUint8 sconFieldId = AudioFieldId( fieldId );
+ if ( sconFieldId == KSconAudioJpeg )
+ {
+ TPtrC8 field8( fields.Field8( fieldId ) );
+ AppendByteDataFieldL(
+ buffer,
+ field8,
+ AudioFieldId( fieldId ) );
+ }
+ else if ( sconFieldId > 0 )
+ {
+ // get field data and add UTF-8 formatted text to buffer
+ fieldData.Set( fields.At( i , fieldId ) );
+ AppendUtf8DataFieldL( buffer, fieldData, sconFieldId );
+ }
+ else
+ {
+ LOGGER_WRITE("Unknown field skipped");
+ }
+ }
+
+ if ( buffer->Size() > 0 )
+ {
+ LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() : buffer->Size() %d", buffer->Size() );
+ if ( aTask.iGetMetadataParams->iData )
+ {
+ delete aTask.iGetMetadataParams->iData;
+ aTask.iGetMetadataParams->iData = NULL;
+ }
+ //Initialize the task data buffer
+ aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() );
+ TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des();
+
+ buffer->Read( 0, dataPtr, buffer->Size() );
+ LOGGER_WRITE_1( "SConMetadata::GetAudioMetadataL() dataPtr len: %d", dataPtr.Length());
+ }
+ CleanupStack::PopAndDestroy( buffer );
+ }
+
+ CleanupStack::PopAndDestroy( metadataUtil );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::GetVideoMetadataL()
+// Read video metadata
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::GetVideoMetadataL( CSConTask& aTask, RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ CBufFlat* buffer = CBufFlat::NewL( KBufferSize );
+ CleanupStack::PushL( buffer );
+ buffer->Reset();
+
+ TInt offset(0);
+ // write object header
+ // Item type (1 byte) + Version (1 byte) = 2 bytes
+ buffer->ExpandL( offset, 2 );
+
+ // header id
+ TUint8 value( KSconMetadataHeaderVideo );
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+ // header version
+ value = KSconMetadataHeaderVersion;
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+
+ CSConVideoParser* videoParser = CSConVideoParser::NewLC();
+
+ videoParser->OpenFileL( aFs, aTask.iGetMetadataParams->iFilename );
+ LOGGER_WRITE( "Open completed" );
+
+ const TUint KFormatMaxLength = 100;
+ TBuf<KFormatMaxLength> formatMimeType;
+ formatMimeType.Copy( videoParser->VideoFormatMimeTypeL() );
+ LOGGER_WRITE_1( "formatMimeType: %S", &formatMimeType);
+ AppendUtf8DataFieldL( buffer, formatMimeType, KSconVideoFormat );
+
+ // we can't use TReal format, so convert frame rate to frames/ms (or 1000 frames/s)
+ TReal32 frameRate = videoParser->VideoFrameRateL();
+ const TUint KFrameRateMultiplier = 1000;
+ TInt frm = frameRate * KFrameRateMultiplier;
+ LOGGER_WRITE_1( "frameRate: %f", frameRate );
+ LOGGER_WRITE_1( "frm: %d", frm );
+ AppendTUintDataFieldL( buffer, frm, KSconVideoFrameRate );
+
+ TSize size;
+ videoParser->VideoFrameSizeL( size );
+ LOGGER_WRITE_2( "VideoFrameSizeL: %d, %d", size.iWidth, size.iHeight);
+ AppendTUintDataFieldL( buffer, size.iWidth, KSconVideoFrameSizeWidth );
+ AppendTUintDataFieldL( buffer, size.iHeight, KSconVideoFrameSizeHeight );
+
+
+
+ const TUint8 KSconVideoAudioStreamMimetype ( 0x09 );
+ const TUint8 KSconVideoVideoStreamMimetype ( 0x0a );
+
+ TInt videoBitRate = videoParser->VideoBitRateL();
+ LOGGER_WRITE_1( "videoBitRate: %d", videoBitRate);
+ AppendTUintDataFieldL( buffer, videoBitRate, KSconVideoVideoBitRate );
+
+ TInt audioBitRate = videoParser->AudioBitRateL();
+ LOGGER_WRITE_1( "audioBitRate: %d", audioBitRate);
+ AppendTUintDataFieldL( buffer, audioBitRate, KSconVideoAudioBitRate );
+
+ TInt durationMs = videoParser->DurationL();
+ LOGGER_WRITE_1( "duration ms: %d", durationMs);
+ AppendTUintDataFieldL( buffer, durationMs, KSconVideoDuration );
+
+ TPtrC8 thumbnail = videoParser->Thumbnail();
+ if ( thumbnail.Length() > 0 )
+ {
+ AppendByteDataFieldL( buffer, thumbnail, KSconVideoThumbnail );
+ }
+
+ TPtrC audioMimeType = videoParser->AudioMimeTypeL();
+ if ( audioMimeType.Length() > 0 )
+ {
+ AppendUtf8DataFieldL( buffer, audioMimeType, KSconVideoAudioStreamMimetype );
+ }
+
+ TPtrC videoMimeType = videoParser->VideoMimeTypeL();
+ if ( videoMimeType.Length() > 0 )
+ {
+ AppendUtf8DataFieldL( buffer, formatMimeType, KSconVideoVideoStreamMimetype );
+ }
+
+ CleanupStack::PopAndDestroy( videoParser );
+ LOGGER_WRITE( "videoParser deleted" );
+
+
+ if ( buffer->Size() > 0 )
+ {
+ if ( aTask.iGetMetadataParams->iData )
+ {
+ delete aTask.iGetMetadataParams->iData;
+ aTask.iGetMetadataParams->iData = NULL;
+ }
+ //Initialize the task data buffer
+ aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() );
+ TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des();
+
+ buffer->Read( 0, dataPtr, buffer->Size() );
+ }
+ CleanupStack::PopAndDestroy( buffer );
+
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::AudioFieldId()
+// Map TMetaDataFieldId to KSconAudio field id
+// -----------------------------------------------------------------------------
+//
+TUint8 SConMetadata::AudioFieldId( const TMetaDataFieldId fieldId )
+ {
+ TUint8 ret(NULL);
+ switch( fieldId )
+ {
+ case EMetaDataSongTitle :
+ ret = KSconAudioTitle;
+ break;
+ case EMetaDataArtist :
+ ret = KSconAudioArtist;
+ break;
+ case EMetaDataAlbum :
+ ret = KSconAudioAlbum;
+ break;
+ case EMetaDataYear :
+ ret = KSconAudioYear;
+ break;
+ case EMetaDataComment :
+ ret = KSconAudioComment;
+ break;
+ case EMetaDataAlbumTrack :
+ ret = KSconAudioAlbumTrack;
+ break;
+ case EMetaDataGenre :
+ ret = KSconAudioGenre;
+ break;
+ case EMetaDataComposer :
+ ret = KSconAudioComposer;
+ break;
+ case EMetaDataCopyright :
+ ret = KSconAudioCopyright;
+ break;
+ case EMetaDataOriginalArtist :
+ ret = KSconAudioOriginalArtist;
+ break;
+ case EMetaDataUrl :
+ ret = KSconAudioUrl;
+ break;
+ case EMetaDataUserUrl :
+ ret = KSconAudioUserUrl;
+ break;
+ case EMetaDataJpeg :
+ ret = KSconAudioJpeg;
+ break;
+ case EMetaDataVendor :
+ ret = KSconAudioVendor;
+ break;
+ case EMetaDataRating :
+ ret = KSconAudioRating;
+ break;
+ case EMetaDataUniqueFileIdentifier :
+ ret = KSconAudioUniqueFileIdentifier;
+ break;
+ case EMetaDataDuration :
+ ret = KSconAudioDuration;
+ break;
+ case EMetaDataDate :
+ ret = KSconAudioDate;
+ break;
+ case EMetaDataUnsyncLyrics:
+ ret = KSconAudioUnsyncLyrics;
+ break;
+ case EMetaDataProtected:
+ ret = KSconAudioProtected;
+ break;
+ default :
+ LOGGER_WRITE( "SConMetadata::AudioFieldId : ERR field not defined!" );
+ break;
+ }
+ return ret;
+ }
+
+
+// -----------------------------------------------------------------------------
+// SConMetadata::GetExifTagL( CExifRead* aReader, const TUint8 aTagID )
+// This function is used to read exif data that might leave.
+// -----------------------------------------------------------------------------
+//
+HBufC8* SConMetadata::GetExifTagL( CExifRead* aReader, const TUint8 aTagID )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( " aTagID: 0x%02x", aTagID );
+ HBufC8* tempBuf( NULL );
+
+ switch( aTagID )
+ {
+ case KSconExifThumbnail:
+ tempBuf = aReader->GetThumbnailL();
+ break;
+ case KSconExifDescription:
+ tempBuf = aReader->GetImageDescriptionL();
+ break;
+ case KSconExifMake:
+ tempBuf = aReader->GetMakeL();
+ break;
+ case KSconExifModel:
+ tempBuf = aReader->GetModelL();
+ break;
+ case KSconExifDateTime:
+ tempBuf = aReader->GetDateTimeL();
+ break;
+ case KSconExifSoftware:
+ tempBuf = aReader->GetSoftwareL();
+ break;
+ case KSconExifCopyright:
+ tempBuf = aReader->GetCopyrightL();
+ break;
+ case KSconExifIsoSpeedRatings:
+ tempBuf = aReader->GetIsoSpeedRatingsL();
+ if ( tempBuf )
+ {
+ TInt isoSpeed = ReadTUint32( tempBuf->Des() );
+ LOGGER_WRITE_1(" isoSpeed: %d", isoSpeed);
+ delete tempBuf;
+
+ const TInt maxLength(5);
+ // no need to push on cleanupstack as leave cannot
+ // happen before returning tempBuf.
+ tempBuf = HBufC8::NewL(maxLength);
+ TPtr8 temp = tempBuf->Des();
+ temp.Num( isoSpeed );
+ }
+ break;
+ case KSconExifDateTimeOriginal:
+ tempBuf = aReader->GetDateTimeOriginalL();
+ break;
+ case KSconExifDateTimeDigitized:
+ tempBuf = aReader->GetDateTimeDigitizedL();
+ break;
+ case KSconExifMakerNote:
+ // makernote contents are up to the manufacturer
+ // not needed.
+ User::Leave( KErrNotSupported );
+ break;
+ case KSconExifUserComment:
+ tempBuf = aReader->GetUserCommentL();
+ break;
+ case KSconExifRelatedSoundFile:
+ tempBuf = aReader->GetRelatedSoundFileL();
+ break;
+ default:
+ User::Leave( KErrNotSupported );
+ }
+ TRACE_FUNC_EXIT;
+ return tempBuf;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::ReadTUint32()
+// Convert 8-bit binary data to unsigned integer
+// -----------------------------------------------------------------------------
+//
+TUint32 SConMetadata::ReadTUint32( const TDesC8& aData )
+ {
+ TRACE_FUNC_ENTRY;
+ TUint32 result = 0;
+ TUint8 c;
+
+ for (TInt i=aData.Length()-1; i>=0; i--)
+ {
+ c = aData[i];
+ result = (result << 8) | c;
+ }
+
+ LOGGER_WRITE_1( "SConMetadata::ReadTUint32() : returned %d ", result );
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::GetFileDataLC()
+// Read data from file
+// -----------------------------------------------------------------------------
+//
+HBufC8* SConMetadata::GetFileDataLC( const TDesC& aFilename, RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+ RFile file;
+
+ User::LeaveIfError( file.Open( aFs, aFilename,
+ EFileRead | EFileShareReadersOnly ) );
+ CleanupClosePushL( file );
+
+ LOGGER_WRITE( "SConMetadata::GetFileDataLC() : file opened" );
+
+ TInt dataSize(0);
+ ContentAccess::CContent* content;
+ content = ContentAccess::CContent::NewLC( file );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+ data->DataSizeL(dataSize);
+
+ LOGGER_WRITE( "SConMetadata::GetFileDataLC() : content opened" );
+ // Read 64k from the beginning of the file
+ if ( dataSize > KJpegLoadBufferSize )
+ {
+ dataSize = KJpegLoadBufferSize;
+ }
+ HBufC8* readBuffer = HBufC8::NewLC( dataSize );
+ TPtr8 readPtr = readBuffer->Des();
+ User::LeaveIfError( data->Read( readPtr, dataSize ) );
+
+ LOGGER_WRITE( "SConMetadata::GetFileDataLC() : data readed" );
+ CleanupStack::Pop( readBuffer );
+ CleanupStack::PopAndDestroy( data );
+ CleanupStack::PopAndDestroy( content );
+ CleanupStack::PopAndDestroy( &file );
+
+ CleanupStack::PushL( readBuffer );
+ TRACE_FUNC_EXIT;
+ return readBuffer;
+ }
+
+// -----------------------------------------------------------------------------
+// SConMetadata::ReadExifDataL()
+// Read Exif data
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::ReadExifDataL( CSConTask& aTask, RFs& aFs )
+ {
+ TRACE_FUNC_ENTRY;
+
+ // read data from file
+ HBufC8* jpegReadBuffer = GetFileDataLC( aTask.iGetMetadataParams->iFilename, aFs );
+
+ CExifRead* reader = CExifRead::NewL(
+ *jpegReadBuffer, CExifRead::ENoJpeg | CExifRead::ENoTagChecking );
+
+ LOGGER_WRITE( "SConMetadata::ReadExifDataL() : reader created" );
+ CleanupStack::PopAndDestroy( jpegReadBuffer );
+ CleanupStack::PushL( reader );
+
+
+ CBufFlat* buffer = CBufFlat::NewL( KBufferSize );
+ CleanupStack::PushL( buffer );
+ buffer->Reset();
+
+
+ TInt offset(0);
+ // header id (1 byte) + head.version (1 byte) = 2 bytes
+
+ buffer->ExpandL( offset, 2 );
+
+ // header id
+ TUint8 value( KSconMetadataHeaderExif );
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+ // header version
+ value = KSconMetadataHeaderVersion;
+ buffer->Write( offset, TPtrC8(&value, 1) );
+ offset++;
+
+
+ HBufC8* tempBuf(NULL);
+
+ TInt err;
+
+ for ( TInt tagID = KSconExifThumbnail; tagID < KSconExifGpsVersion; tagID++ )
+ {
+ // GetExifTagL function is used only to tags that leaves if data is not found
+ TRAP( err, tempBuf = GetExifTagL( reader, tagID ) );
+ if ( !err )
+ {
+ LOGGER_WRITE("write to buffer");
+ CleanupStack::PushL( tempBuf );
+ AppendByteDataFieldL( buffer, tempBuf->Des(), tagID );
+ CleanupStack::PopAndDestroy( tempBuf );
+ tempBuf = NULL;
+ }
+ else
+ {
+ LOGGER_WRITE_1( "GetExifTagL Leave code %d", err );
+ }
+ }
+
+
+ TUint16 value16a;
+ TUint32 value32a;
+ TUint32 value32b;
+ TInt32 val32a;
+ TInt32 val32b;
+
+ // Orientation
+ err = reader->GetOrientation( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifOrientation );
+ }
+
+ // XResolution
+ err = reader->GetXResolution( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifXResolution1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifXResolution2 );
+ }
+
+ // YResolution
+ err = reader->GetYResolution( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifYResolution1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifYResolution2 );
+ }
+
+ // ResolutionUnit
+ err = reader->GetResolutionUnit( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifResolutionUnit );
+ }
+
+ // YCbCrPositioning
+ err = reader->GetYCbCrPositioning( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifYCbCrPositioning );
+ }
+
+ // YCbCrPositioning
+ err = reader->GetYCbCrPositioning( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifYCbCrPositioning );
+ }
+
+
+ // ExposureTime
+ err = reader->GetExposureTime( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifExposureTime1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifExposureTime2 );
+ }
+
+ // ComponentsConfiguration
+ TUint8 value8a;
+ TUint8 value8b;
+ TUint8 value8c;
+ TUint8 value8d;
+ err = reader->GetComponentsConfiguration( value8a, value8b, value8c, value8d );
+ if ( !err )
+ {
+ TInt offset;
+ offset = buffer->Size();
+
+ // field ID (1 byte) + field lenght (4 bytes) + field data (4bytes) = 9 bytes
+ buffer->ExpandL( offset, 9 );
+
+ // field id (one byte)
+ TUint8 fieldId( KSconExifComponentsConfiguration );
+ buffer->Write( offset, TPtrC8( &fieldId, 1 ) );
+ offset++;
+
+ // field lenght
+ WriteTUint32( buffer, offset, 4);
+ offset += 4;
+
+ buffer->Write( offset, TPtrC8(&value8a, 1) );
+ offset++;
+ buffer->Write( offset, TPtrC8(&value8b, 1) );
+ offset++;
+ buffer->Write( offset, TPtrC8(&value8c, 1) );
+ offset++;
+ buffer->Write( offset, TPtrC8(&value8d, 1) );
+ offset++;
+ }
+
+ // Flash
+ err = reader->GetFlash( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifFlash );
+ }
+
+ // ColorSpace
+ err = reader->GetColorSpace( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifColorSpace );
+ }
+
+ // PixelXDimension
+ err = reader->GetPixelXDimension( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifPixelXDimension );
+ }
+
+ // PixelYDimension
+ err = reader->GetPixelYDimension( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifPixelYDimension );
+ }
+
+ // ExposureMode
+ err = reader->GetExposureMode( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifExposureMode );
+ }
+
+ // WhiteBalance
+ err = reader->GetWhiteBalance( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifWhiteBalance );
+ }
+
+ // SceneCaptureType
+ err = reader->GetSceneCaptureType( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifSceneCaptureType );
+ }
+
+ // ExposureProgram
+ err = reader->GetExposureProgram( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifExposureProgram );
+ }
+
+ // GetApertureValue
+ err = reader->GetApertureValue( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifApertureValue1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifApertureValue2 );
+ }
+
+ // GetExposureBiasValue
+ err = reader->GetExposureBiasValue( val32a, val32b );
+ if ( !err )
+ {
+ value32a = val32a;
+ value32b = val32b;
+ AppendTUintDataFieldL( buffer, value32a, KSconExifExposureBiasValue1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifExposureBiasValue2 );
+ }
+
+ // GetMeteringMode
+ err = reader->GetMeteringMode( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifMeteringMode );
+ }
+
+ // GetLightSource
+ err = reader->GetLightSource( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifLightSource );
+ }
+
+ // GetFileSource
+ TInt8 val8;
+ err = reader->GetFileSource( val8 );
+ if ( !err )
+ {
+ value8a = val8;
+ AppendTUintDataFieldL( buffer, value8a, KSconExifFileSource );
+ }
+
+ // GetDigitalZoomRatio
+ err = reader->GetDigitalZoomRatio( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifDigitalZoomRatio1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifDigitalZoomRatio2 );
+ }
+
+ // GetContrast
+ err = reader->GetContrast( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifContrast );
+ }
+
+ // GetSaturation
+ err = reader->GetSaturation( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifSaturation );
+ }
+
+ // GetSharpness
+ err = reader->GetSharpness( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifSharpness );
+ }
+
+ // GetExifVersion
+ err = reader->GetExifVersion( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifExifVersion );
+ }
+
+ // GetFlashPixVersion
+ err = reader->GetFlashPixVersion( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifFlashPixVersion );
+ }
+
+ // GetThumbnailXResolution
+ err = reader->GetThumbnailXResolution( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifThumbXResolution1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifThumbXResolution2 );
+ }
+
+ // GetThumbnailYResolution
+ err = reader->GetThumbnailYResolution( value32a, value32b );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifThumbYResolution1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifThumbYResolution2 );
+ }
+
+ // GetThumbnailResolutionUnit
+ err = reader->GetThumbnailResolutionUnit( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifThumbResolutionUnit );
+ }
+
+ // GetThumbnailCompression
+ err = reader->GetThumbnailCompression( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifThumbCompression );
+ }
+
+ // GetJpegInterchangeFormat
+ err = reader->GetJpegInterchangeFormat( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifThumbJpegInterchangeFormat );
+ }
+
+ // GetJpegInterchangeFormatLength
+ err = reader->GetJpegInterchangeFormatLength( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifThumbJpegInterchangeFormatLength );
+ }
+
+ // GetShutterSpeedValue
+ err = reader->GetShutterSpeedValue( val32a, val32b );
+ if ( !err )
+ {
+ value32a = val32a;
+ value32b = val32b;
+ AppendTUintDataFieldL( buffer, value32a, KSconExifShutterSpeedValue1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifShutterSpeedValue2 );
+ }
+
+ // GetBrightnessValue
+ err = reader->GetBrightnessValue( val32a, val32b );
+ if ( !err )
+ {
+ value32a = val32a;
+ value32b = val32b;
+ AppendTUintDataFieldL( buffer, value32a, KSconExifBrightnessValue1 );
+ AppendTUintDataFieldL( buffer, value32b, KSconExifBrightnessValue2 );
+ }
+
+ // GetCustomRendered
+ err = reader->GetCustomRendered( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifCustomRendered );
+ }
+
+ // GetGainControl
+ err = reader->GetGainControl( value16a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value16a, KSconExifGainControl );
+ }
+
+ // GetGpsVersion
+ err = reader->GetGpsVersion( value32a );
+ if ( !err )
+ {
+ AppendTUintDataFieldL( buffer, value32a, KSconExifGpsVersion );
+ }
+
+ // Get GPS coordinates
+ const TUint KCoordinatesMaxLength = 50;
+ TBuf<KCoordinatesMaxLength> gpsInfo;
+ // Latidute
+ err = GetExifGPSLatitudeL( *reader, gpsInfo );
+ if ( !err )
+ {
+ AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSLatitude );
+ }
+
+ // Longitude
+ err = GetExifGPSLongitudeL( *reader, gpsInfo );
+ if ( !err )
+ {
+ AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSLongitude );
+ }
+
+ // Altidute
+ err = GetExifGPSAltiduteL( *reader, gpsInfo );
+ if ( !err )
+ {
+ AppendUtf8DataFieldL( buffer, gpsInfo ,KSconExifGPSAltitude );
+ }
+
+ LOGGER_WRITE( "SConMetadata::ReadExifDataL() : All data collected" );
+
+ if ( buffer->Size() > 0 )
+ {
+ LOGGER_WRITE_1( "SConMetadata::ReadExifDataL() : buffer->Size() %d", buffer->Size() );
+ if ( aTask.iGetMetadataParams->iData )
+ {
+ delete aTask.iGetMetadataParams->iData;
+ aTask.iGetMetadataParams->iData = NULL;
+ }
+ //Initialize the task data buffer
+ aTask.iGetMetadataParams->iData = HBufC8::NewL( buffer->Size() );
+ TPtr8 dataPtr = aTask.iGetMetadataParams->iData->Des();
+
+ buffer->Read( 0, dataPtr, buffer->Size() );
+ LOGGER_WRITE_1( "SConMetadata::ReadExifDataL() dataPtr len: %d", dataPtr.Length());
+ }
+ CleanupStack::PopAndDestroy( buffer );
+
+ LOGGER_WRITE( "SConMetadata::ReadExifDataL() : task updated" );
+
+ CleanupStack::PopAndDestroy( reader );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees )
+// parses degrees, minutes and seconds from CExifTag and converts it to string format
+// -----------------------------------------------------------------------------
+//
+TInt SConMetadata::ConvertRationalTag( const CExifTag& aTag, TDes& aPosDegrees )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt numer(0);
+ TInt denom(0);
+ TReal64 degrees(0);
+ TReal64 minutes(0);
+ TReal64 seconds(0);
+
+ const TUint8* ratData = aTag.Data().Ptr();
+ for ( TUint y=0; y < aTag.TagInfo().iDataCount; y++ )
+ {
+ numer = 0;
+ denom = 0;
+ Mem::Copy(&numer, ratData + ((y * 2) * sizeof(numer)), sizeof(numer));
+ Mem::Copy(&denom, ratData + (((y * 2) + 1) * sizeof(numer)), sizeof(denom));
+ if (denom != 0)
+ {
+ if ( y == 0 )// degrees
+ {
+ degrees = numer/denom;
+ }
+ else if ( y == 1 )// minutes
+ {
+ minutes = numer/denom;
+ }
+ else if ( y == 2 )// seconds
+ {
+ seconds = numer/denom;
+ }
+ }
+ }
+ _LIT(KFormat, "%.0f°%.0f'%.2f\"" );
+ aPosDegrees.Format( KFormat, degrees, minutes, seconds );
+ TRACE_FUNC_EXIT;
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude )
+// Read latidute from ExifReader
+// -----------------------------------------------------------------------------
+//
+TInt SConMetadata::GetExifGPSLatitudeL( CExifRead& aExifRead, TDes& aLatitude )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret(KErrNone);
+ if ( aExifRead.TagExists( KGPSLatitudeRef, EIfdGps )
+ && aExifRead.TagExists( KGPSLatitude, EIfdGps) )
+ {
+ // get latidute
+ const CExifTag* lat = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSLatitude );
+ User::LeaveIfError( ConvertRationalTag( *lat, aLatitude ) );
+ if ( aLatitude.Length()+2 > aLatitude.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+
+ // south or north
+ const CExifTag* latRef = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSLatitudeRef );
+ _LIT8( KNorthTagDef8, "N" );
+ _LIT( KNorth, "N " );
+ _LIT( KSouth, "S " );
+ if ( latRef->Data().Find( KNorthTagDef8 ) != KErrNotFound )
+ {
+ aLatitude.Insert( 0, KNorth );
+ }
+ else
+ {
+ aLatitude.Insert( 0, KSouth );
+ }
+ }
+ else
+ {
+ ret=KErrNotFound;
+ }
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude )
+// Read longitude from ExifReader
+// -----------------------------------------------------------------------------
+//
+TInt SConMetadata::GetExifGPSLongitudeL( CExifRead& aExifRead, TDes& aLongitude )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret(KErrNone);
+ if ( aExifRead.TagExists( KGPSLongitudeRef, EIfdGps )
+ && aExifRead.TagExists( KGPSLongitude, EIfdGps) )
+ {
+ // get longitude
+ const CExifTag* lon = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSLongitude );
+ User::LeaveIfError( ConvertRationalTag( *lon, aLongitude ) );
+ if ( aLongitude.Length()+2 > aLongitude.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+
+ // east or west
+ const CExifTag* lonref = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSLongitudeRef );
+ _LIT8( KEastTagDef8, "E" );
+ _LIT( KEast, "E " );
+ _LIT( KWest, "W " );
+ if ( lonref->Data().Find( KEastTagDef8 ) != KErrNotFound )
+ {
+ aLongitude.Insert( 0, KEast );
+ }
+ else
+ {
+ aLongitude.Insert( 0, KWest );
+ }
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute )
+// Read altidute from ExifReader
+// -----------------------------------------------------------------------------
+//
+TInt SConMetadata::GetExifGPSAltiduteL( CExifRead& aExifRead, TDes& aAltidute )
+ {
+ TRACE_FUNC_ENTRY;
+
+ TInt ret(KErrNone);
+ if ( aExifRead.TagExists( KGPSAltitudeRef, EIfdGps )
+ && aExifRead.TagExists( KGPSAltitude, EIfdGps) )
+ {
+ if ( aAltidute.MaxLength() < 5 )
+ {
+ User::Leave( KErrTooBig );
+ }
+
+ // get altidute
+ const CExifTag* alt = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSAltitude );
+ const TUint8* ratData = alt->Data().Ptr();
+
+ TInt numer;
+ TInt denom;
+ Mem::Copy(&numer, ratData , sizeof(numer));
+ Mem::Copy(&denom, ratData + (sizeof(numer)), sizeof(denom));
+
+ TReal32 tmp = numer / denom;
+
+ // sea level
+ const CExifTag* altref = aExifRead.GetTagL(
+ EIfdGps,
+ KGPSAltitudeRef );
+ _LIT8( KAltSealevelDef8, "1" );
+ if ( altref->Data().Find( KAltSealevelDef8 ) != KErrNotFound )
+ {
+ // seaLevelReference -> negative value
+ tmp *= -1;
+ }
+ TRealFormat format;
+ format.iType = KRealFormatFixed;
+ format.iPlaces=1;
+ User::LeaveIfError( aAltidute.Num( tmp, format ) );
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::AppendUtf8DataFieldL( CBufFlat* aBuffer,
+// const TPtrC aAppendData, const TUint8 aFieldId )
+// Write 8bit field id value, data length (32bit) and UTF8 data to buffer
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::AppendUtf8DataFieldL( CBufFlat* aBuffer,
+ const TPtrC aAppendData, const TUint8 aFieldId )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId);
+ HBufC8* tempBuf = HBufC8::NewLC( aAppendData.Size() );
+ TPtr8 temp = tempBuf->Des();
+
+ CnvUtfConverter::ConvertFromUnicodeToUtf8( temp, aAppendData );
+ LOGGER_WRITE_1( "lenght: %d", temp.Length() );
+
+ if ( temp.Length() > KFieldMaxLength )
+ {
+ LOGGER_WRITE("Data length is too big, field skipped");
+ CleanupStack::PopAndDestroy( tempBuf );
+ return;
+ }
+
+ TInt offset;
+ offset = aBuffer->Size();
+ // field ID (1 byte) + field lenght (4 bytes) + field data
+ aBuffer->ExpandL( offset, temp.Length() + 5 );
+
+ // field id (one byte)
+ aBuffer->Write( offset, TPtrC8(&aFieldId, 1) );
+ offset++;
+
+ WriteTUint32( aBuffer, offset, temp.Length());
+ offset += 4;
+
+ // field data
+ aBuffer->Write( offset, temp, temp.Length() );
+ offset += temp.Length();
+
+ CleanupStack::PopAndDestroy( tempBuf );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::AppendByteDataFieldL( CBufFlat* aBuffer,
+// const TPtrC8 aAppendData, const TUint8 aFieldId )
+// Write 8bit field id value, data length (32bit) and n*8bit data to buffer
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::AppendByteDataFieldL( CBufFlat* aBuffer,
+ const TPtrC8 aAppendData, const TUint8 aFieldId )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId);
+ LOGGER_WRITE_1( "lenght: %d", aAppendData.Length() );
+ if ( aAppendData.Length() > KFieldMaxLength )
+ {
+ LOGGER_WRITE("Data length is too big, field skipped");
+ return;
+ }
+ TInt offset;
+ offset = aBuffer->Size();
+
+ // field id (1) + field len (4) + datalen = 5 + datalen
+ aBuffer->ExpandL( offset, aAppendData.Length() + 5 );
+
+ // field id (one byte)
+ aBuffer->Write( offset, TPtrC8(&aFieldId, 1) );
+ offset++;
+
+ // field data length (32bit unsigned integer, two byte)
+ WriteTUint32( aBuffer, offset, aAppendData.Length() );
+ offset += 4;
+
+ // field data
+ aBuffer->Write( offset, aAppendData );
+ offset += aAppendData.Length();
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::AppendTUintDataFieldL( CBufFlat* aBuffer,
+// const TUint32 aValue, const TUint8 aFieldId )
+// Write 8bit field id value, data length (16bit) and n*8bit data to buffer
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::AppendTUintDataFieldL( CBufFlat* aBuffer,
+ TUint32 aValue, const TUint8 aFieldId )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( "aFieldId: 0x%02x", aFieldId);
+ LOGGER_WRITE_1( "aValue dec: %u", aValue);
+ TInt offset;
+ offset = aBuffer->Size();
+ TInt dataLen(1);
+ TUint8 temp[4];
+ TInt i(0);
+
+ temp[i] = aValue & 0xFF;
+
+ aValue >>= 8;
+ while( aValue > 0 )
+ {
+ i++;
+ temp[i] = aValue & 0xFF;
+ aValue >>= 8;
+ dataLen++;
+ }
+ // field id (1) + field len (4) + datalen = 5 + datalen
+ aBuffer->ExpandL( offset, 5 + dataLen );
+
+ // field id (one byte)
+ aBuffer->Write( offset, TPtrC8(&aFieldId, 1) );
+ offset++;
+
+ // field data length (32bit unsigned integer, two byte)
+ WriteTUint32( aBuffer, offset, dataLen );
+ offset += 4;
+
+ // field data
+ for( TInt i = dataLen-1; i>=0; i-- )
+ {
+ aBuffer->Write( offset, TPtrC8(&temp[i], 1) );
+ offset++;
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// void SConMetadata::WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue )
+// Write 32bit unsigned integer value to buffer.
+// -----------------------------------------------------------------------------
+//
+void SConMetadata::WriteTUint32( CBufFlat* aBuffer, TInt offset, TUint32 aValue )
+ {
+ TUint8 temp[4];
+ TInt i(0);
+
+ temp[i] = aValue & 0xFF;
+
+ aValue >>= 8;
+ for ( TInt i=1; i<4; i++ )
+ {
+ temp[i] = aValue & 0xFF;
+ aValue >>= 8;
+ }
+
+ // high to low
+ for ( TInt i=3; i>=0; i-- )
+ {
+ aBuffer->Write( offset, TPtrC8(&temp[i], 1) );
+ offset++;
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconpcd.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,626 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConPCD implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconpcd.h"
+#include "sconpcdconsts.h"
+#include "sconinstqueue.h"
+#include "sconbrqueue.h"
+#include "sconmetadata.h"
+#include "sconsynchandler.h"
+#include "debug.h"
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CreateCSConPCDL()
+// Entry to CSConPCD
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConPCD* CreateCSConPCDL()
+ {
+ TRACE_FUNC;
+ return CSConPCD::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::NewL()
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConPCD* CSConPCD::NewL()
+ {
+ TRACE_FUNC_ENTRY;
+ CSConPCD* self = new (ELeave) CSConPCD();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::CSConPCD()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConPCD::CSConPCD() : iInstallerQueue( NULL ), iBackupRestoreQueue( NULL ),
+ iLatestReply(NULL), iTaskNumber( 0 ), iMaxObjectSize( 65536 ),
+ iLastOperation( ENoTask )
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::ConstructL()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+ User::LeaveIfError( iFs.Connect() );
+ iInstallerQueue = CSConInstallerQueue::NewL( iFs );
+ iBackupRestoreQueue = CSConBackupRestoreQueue::NewL( iMaxObjectSize, iFs );
+ iInstallerQueue->QueueAddress( iBackupRestoreQueue );
+ iBackupRestoreQueue->QueueAddress( iInstallerQueue );
+
+ if ( !CActiveScheduler::Current() )
+ {
+ CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
+ CActiveScheduler::Install( scheduler );
+ }
+ CActiveScheduler::Add( iInstallerQueue );
+ CActiveScheduler::Add( iBackupRestoreQueue );
+ iSyncHandler = CSconSyncHandler::NewL( iFs );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::~CSConPCD()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConPCD::~CSConPCD()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iInstallerQueue )
+ {
+ iInstallerQueue->Cancel();
+ delete iInstallerQueue;
+ iInstallerQueue = NULL;
+ }
+
+ if ( iBackupRestoreQueue )
+ {
+ iBackupRestoreQueue->Cancel();
+ delete iBackupRestoreQueue;
+ iBackupRestoreQueue = NULL;
+ }
+
+ if ( iLatestReply )
+ {
+ delete iLatestReply;
+ iLatestReply = NULL;
+ }
+
+ if ( iSyncHandler )
+ {
+ iSyncHandler->Cancel();
+ delete iSyncHandler;
+ iSyncHandler = NULL;
+ }
+ iFs.Close();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::PutTaskL( CSConTask* aTask )
+// Receives a new task
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::PutTaskL( CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TInt maxObjectSize( 0 );
+
+ if ( iLastOperation == EPutTask )
+ {
+ LOGGER_WRITE( "CSConPCD::PutTaskL() : Two Puts in a row -> Reset()" );
+ ResetPCD();
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCD::PutTaskL() : Protocol procedure ok" );
+ iLastOperation = EPutTask;
+ }
+
+ switch( aTask->GetServiceId() )
+ {
+ case ECancel :
+ ret = CancelL( aTask->iCancelTaskId, aTask->iCancelTaskAll );
+ delete aTask;
+ break;
+ case EGetDataOwnerStatus :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case EGetDataSize :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case EGetStatus :
+ ret = GetStatusL( aTask->iGetStatusParams->iTaskId,
+ aTask->iGetStatusParams->iAll );
+ delete aTask;
+ break;
+ case EInstall :
+ ret = SupportedInstTaskL( aTask );
+ break;
+ case EListDataOwners :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case EListInstalledApps :
+ ret = SupportedInstTaskL( aTask );
+ break;
+ case EListPublicFiles :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case ERequestData :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case ESetBURMode :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case ESetInstParams :
+ ret = SupportedInstTaskL( aTask );
+ break;
+ case ESupplyData :
+ ret = SupportedBRTaskL( aTask );
+ break;
+ case EUninstall :
+ ret = SupportedInstTaskL( aTask );
+ break;
+ case EUpdateDeviceInfo :
+ maxObjectSize = aTask->iDevInfoParams->iMaxObjectSize;
+ ret = UpdateDeviceInfoL( maxObjectSize );
+ iTaskNumber++;
+ delete aTask;
+ break;
+ case EReboot :
+ RebootTaskL( aTask );
+ delete aTask;
+ break;
+ case EGetMetadata :
+ ret = KErrNone;
+ GetMetadataTaskL( *aTask );
+ delete aTask;
+ break;
+ default :
+ break;
+ }
+ LOGGER_WRITE_1( "CSConPCD::PutTaskL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::GetReply()
+// Returns a reply to previous PutTaskL operation
+// -----------------------------------------------------------------------------
+//
+CSConStatusReply* CSConPCD::GetReply()
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( iLastOperation == EGetReply )
+ {
+ LOGGER_WRITE( "CSConPCD::GetReply() : Two Gets in a row -> Reset()" );
+ ResetPCD();
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConPCD::GetReply() : Protocol procedure ok" );
+ iLastOperation = EGetReply;
+ }
+ CSConStatusReply* reply = iLatestReply;
+ iLatestReply = NULL;
+ TRACE_FUNC_EXIT;
+ return reply;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::ResetPCD()
+// Resets the module to the initial state
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::ResetPCD()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iInstallerQueue )
+ {
+ LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting installer queue" );
+ iInstallerQueue->Reset();
+ }
+
+ if ( iBackupRestoreQueue )
+ {
+ LOGGER_WRITE( "CSConPCD::ResetPCD() : Reseting backup queue" );
+ iBackupRestoreQueue->Reset();
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::HandleGetSyncRequestL()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize )
+ {
+ TRACE_FUNC_ENTRY;
+ iSyncHandler->HandleGetSyncRequestL( aRequest, aResult, aMaxObjectSize );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::HandlePutSyncRequestL()
+//
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ iSyncHandler->HandlePutSyncRequestL( aRequest, aResult );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::SupportedInstTaskL( CSConTask* aTask )
+// Fills a reply with predefined supported task -information
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::SupportedInstTaskL( CSConTask* aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ iTaskNumber++;
+ ret = iInstallerQueue->AddNewTask( aTask, iTaskNumber );
+
+ //Get status for this task
+ TBool all( EFalse );
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( reply );
+ iInstallerQueue->GetQueueStatusL( iTaskNumber, all, reply );
+ CleanupStack::Pop( reply );
+
+ StoreReply( reply );
+
+ LOGGER_WRITE_1( "CSConPCD::SupportedInstTaskL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::SupportedBRTask( CSConTask* aTask )
+// Fills a reply with predefined supported task -information
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::SupportedBRTaskL( CSConTask* aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ TInt taskId;
+
+ taskId = ++iTaskNumber;
+
+ ret = iBackupRestoreQueue->AddNewTask( aTask, taskId );
+ LOGGER_WRITE_1( "iBackupRestoreQueue->AddNewTask : ret %d", ret );
+ //Get status for this task
+ TBool all( EFalse );
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( reply );
+ iBackupRestoreQueue->GetQueueStatusL( iTaskNumber, all, reply );
+ CleanupStack::Pop( reply );
+
+ StoreReply( reply );
+
+ TRACE_FUNC_EXIT;
+ return ret;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConPCD::RebootTask( const CSConTask* aTask )
+// Fills a reply with predefined unsupported task -information
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::RebootTaskL( const CSConTask* aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNotSupported );
+ iTaskNumber++;
+ TSConMethodName method( aTask->GetServiceId() );
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( reply );
+ CSConTaskReply* taskReply = new (ELeave) CSConTaskReply();
+ CleanupStack::PushL( taskReply );
+
+ TBool complete( ETrue );
+ taskReply->InitializeL( method, KSConCodeNotSupported, complete );
+ taskReply->iTaskId = iTaskNumber;
+
+ reply->iNoTasks = EFalse;
+ User::LeaveIfError( reply->iTasks.Append( taskReply ) );
+ CleanupStack::Pop( taskReply );
+
+ StoreReply( reply );
+ CleanupStack::Pop( reply );
+
+ LOGGER_WRITE_1( "CSConPCD::RebootTask() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::GetMetadataTask( const CSConTask* aTask )
+// Fills a reply with predefined GetMetadata task -information
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::GetMetadataTaskL( CSConTask& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+
+ aTask.iTaskId = ++iTaskNumber;
+
+ //Set progress value "task accepted for execution"
+ aTask.SetProgressValue( KSConCodeTaskCreated );
+ aTask.SetCompleteValue( EFalse );
+
+ SConMetadata::ProcessTask( aTask, iFs );
+
+ //Get status for this task
+
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( reply );
+ CSConTaskReply* taskReply = new (ELeave) CSConTaskReply();
+ CleanupStack::PushL( taskReply );
+ taskReply->InitializeL( aTask );
+ User::LeaveIfError( reply->iTasks.Append( taskReply ) );
+ CleanupStack::Pop( taskReply );
+
+ if ( !aTask.GetComplete() )
+ {
+ // clean all unneccessary data from the reply packet
+ taskReply->CleanTaskData();
+ }
+
+
+ StoreReply( reply );
+ CleanupStack::Pop( reply );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::GetStatus( TInt aTask, TBool aAll )
+// Collects a status of a specified task / all tasks
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::GetStatusL( TInt aTask, TBool aAll )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ // create mergeReply object. Store installer and br replys here.
+ CSConStatusReply* mergeReply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( mergeReply );
+
+
+ CSConStatusReply* brReply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( brReply );
+ iBackupRestoreQueue->GetQueueStatusL( aTask, aAll, brReply );
+
+
+ // Create installerReply and populate it
+ CSConStatusReply* installerReply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( installerReply );
+ iInstallerQueue->GetQueueStatusL( aTask, aAll, installerReply );
+
+ if ( !installerReply->iNoTasks || !brReply->iNoTasks )
+ {
+ mergeReply->iNoTasks = EFalse;
+ }
+ else
+ {
+ mergeReply->iNoTasks = ETrue;
+ }
+
+ for ( TInt i = 0; i < installerReply->iTasks.Count(); i++ )
+ {
+ CSConTaskReply* temp = installerReply->iTasks[i]->CopyAndFreeL();
+ CleanupStack::PushL( temp );
+ mergeReply->iTasks.AppendL( temp );
+ CleanupStack::Pop( temp );
+ }
+
+ // installer replys are copied to mergereply, delete installerReply
+ CleanupStack::PopAndDestroy( installerReply );
+
+ // do same for br reply
+ for ( TInt i = 0; i < brReply->iTasks.Count(); i++ )
+ {
+ CSConTaskReply* temp = brReply->iTasks[i]->CopyAndFreeL();
+ CleanupStack::PushL( temp );
+ mergeReply->iTasks.AppendL( temp );
+ CleanupStack::Pop( temp );
+ }
+
+ CleanupStack::PopAndDestroy( brReply );
+
+ CleanupStack::Pop( mergeReply );
+ // store reply
+ StoreReply( mergeReply );
+
+ LOGGER_WRITE_1( "CSConPCD::GetStatus() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::Cancel( TInt aTask, TBool aAll )
+// Cancels a specified task / all tasks
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::CancelL( TInt aTask, TBool aAll )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ iInstallerQueue->CancelTask( aTask, aAll );
+ iBackupRestoreQueue->CancelTask( aTask, aAll );
+
+ reply->iNoTasks = ETrue;
+
+ StoreReply( reply );
+
+ LOGGER_WRITE_1( "CSConPCD::CancelL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::StoreReply( CSConStatusReply*& aReply )
+// Stores a reply
+// -----------------------------------------------------------------------------
+//
+void CSConPCD::StoreReply( CSConStatusReply*& aReply )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iLatestReply )
+ {
+ delete iLatestReply;
+ iLatestReply = NULL;
+ }
+
+ iLatestReply = aReply;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::UpdateDeviceInfo( TInt aMaxObjectSize )
+// Creates a reply for UpdateDeviceInfo task
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::UpdateDeviceInfoL( TInt aMaxObjectSize )
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+ TSConMethodName method( EUpdateDeviceInfo );
+
+ CSConStatusReply* reply = new (ELeave) CSConStatusReply();
+ CleanupStack::PushL( reply );
+ CSConTaskReply* taskReply = new (ELeave) CSConTaskReply();
+ CleanupStack::PushL( taskReply );
+
+
+ TBool complete( ETrue );
+ TInt progress( KSConCodeTaskCompleted );
+
+ taskReply->InitializeL( method, progress, complete );
+ taskReply->iTaskId = iTaskNumber;
+
+ TInt arrayLength = sizeof KSupportedMethods / sizeof KSupportedMethods[0];
+
+ for ( TInt i = 0; i < arrayLength; i++ )
+ {
+ switch( KSupportedMethods[i].method )
+ {
+ case EGetDataSize :
+ taskReply->iDevInfoParams->iGetSizeSupp =
+ KSupportedMethods[i].support;
+ break;
+ case EInstall :
+ taskReply->iDevInfoParams->iInstallSupp =
+ KSupportedMethods[i].support;
+ break;
+ case EListDataOwners :
+ taskReply->iDevInfoParams->iDataOwnersSupp =
+ KSupportedMethods[i].support;
+ break;
+ case EListInstalledApps :
+ taskReply->iDevInfoParams->iInstAppsSupp =
+ KSupportedMethods[i].support;
+ break;
+ case ERequestData :
+ taskReply->iDevInfoParams->iReqDataSupp =
+ KSupportedMethods[i].support;
+ break;
+ case ESetBURMode :
+ taskReply->iDevInfoParams->iSetBURModeSupp =
+ KSupportedMethods[i].support;
+ break;
+ case ESetInstParams :
+ taskReply->iDevInfoParams->iInstParamsSupp =
+ KSupportedMethods[i].support;
+ break;
+ case ESupplyData :
+ taskReply->iDevInfoParams->iSupplyDataSupp =
+ KSupportedMethods[i].support;
+ break;
+ case EUninstall :
+ taskReply->iDevInfoParams->iUninstallSupp =
+ KSupportedMethods[i].support;
+ break;
+ case EReboot :
+ taskReply->iDevInfoParams->iRebootSupp =
+ KSupportedMethods[i].support;
+ break;
+ default :
+ break;
+ }
+ }
+
+ taskReply->iDevInfoParams->iVersion.Copy( KCONMLVERSION );
+ taskReply->iDevInfoParams->iMaxObjectSize =
+ GetMaxObjectSize( aMaxObjectSize );
+
+ reply->iNoTasks = EFalse;
+
+ User::LeaveIfError( reply->iTasks.Append( taskReply ) );
+ StoreReply( reply );
+
+ CleanupStack::Pop( taskReply );
+ CleanupStack::Pop( reply );
+ LOGGER_WRITE_1( "CSConPCD::UpdateDeviceInfo() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const
+// Gets the current max object size
+// -----------------------------------------------------------------------------
+//
+TInt CSConPCD::GetMaxObjectSize( TInt /*aClientObjectSize*/ ) const
+ {
+ LOGGER_WRITE_1( "CSConPCD::GetMaxObjectSize() : returned %d", iMaxObjectSize );
+ return iMaxObjectSize;
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconpcdutility.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,414 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SConPcdUtility implementation
+*
+*/
+
+
+// CLASS HEADER
+#include <swi/sisregistryentry.h>
+#include <swi/sisregistrysession.h>
+#include <swi/sisregistrypackage.h>
+#include <stringresourcereader.h>
+#include <widgetregistryclient.h>
+#include <javaregistryincludes.h>
+#include <appversion.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <sconftp.rsg> // Resource to be read header
+
+using namespace Java;
+
+#include "debug.h"
+#include "sconpcdutility.h"
+#include "sconconmltask.h"
+
+// localized "unknown vendor".
+_LIT( KSConResourceName, "z:\\Resource\\sconftp.rsc" );
+
+
+
+// METHODS
+//----------------------------------------------------------------------------
+// void SConPcdUtility::ProcessListInstalledAppsL( CSConTask*& aTask )
+//----------------------------------------------------------------------------
+//
+void SConPcdUtility::ProcessListInstalledAppsL( CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+
+ LOGGER_WRITE_1("iAllApps: %d",(TInt)aTask->iListAppsParams->iAllApps);
+ LOGGER_WRITE8_1("driveList: %S", &aTask->iListAppsParams->iDriveList);
+
+ AppendInstalledSisL( *aTask->iListAppsParams );
+ AppendInstalledJavaL( *aTask->iListAppsParams );
+ AppendInstalledWidgetsL( *aTask->iListAppsParams );
+
+ TRACE_FUNC_EXIT;
+ }
+
+//----------------------------------------------------------------------------
+// void SConPcdUtility::AppendInstalledSisL( RPointerArray<CSConInstApp> &aApps )
+// Appends installed sis packages and augmentations to aApps array.
+//----------------------------------------------------------------------------
+//
+void SConPcdUtility::AppendInstalledSisL( CSConListInstApps& aListInstApps )
+ {
+ TRACE_FUNC_ENTRY;
+ // Get installed applications from sis registry
+ Swi::RSisRegistrySession sisRegistry;
+ CleanupClosePushL( sisRegistry );
+ User::LeaveIfError( sisRegistry.Connect() );
+
+ RArray<TUid> uids;
+ CleanupClosePushL(uids);
+ sisRegistry.InstalledUidsL( uids );
+
+
+ //Read package information
+ for( TInt i = 0; i < uids.Count(); i++ )
+ {
+ Swi::RSisRegistryEntry entry;
+ CleanupClosePushL(entry);
+ User::LeaveIfError( entry.Open( sisRegistry, uids[i] ) );
+
+ TBool showIt( EFalse );
+ if ( aListInstApps.iAllApps )
+ {
+ // show all apps -param defined, exlude stubs on ROM
+ if ( !entry.IsInRomL() )
+ {
+ showIt = ETrue;
+ }
+ }
+ else
+ {
+ // show if installed one of the specified drives
+ // don't exlude stubs on ROM
+ showIt = IsInstalledToSelectedDrive( aListInstApps.iDriveList,
+ entry.InstalledDrivesL() );
+ }
+
+ // Only show if not in rom
+ if ( showIt && entry.IsPresentL() )
+ {
+ // Add the created object to the list
+ LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add pkg, index %d", i );
+ CSConInstApp* app = new (ELeave) CSConInstApp();
+ CleanupStack::PushL( app );
+
+ HBufC* temp = entry.PackageNameL();
+ TPtrC tempPtr = temp->Des();
+ LOGGER_WRITE_1("PackageNameL: %S", &tempPtr);
+ CleanupStack::PushL( temp );
+ if ( temp->Length() > app->iName.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+ app->iName.Copy( *temp );
+ CleanupStack::PopAndDestroy( temp );
+ temp = NULL;
+
+ temp = entry.UniqueVendorNameL();
+ CleanupStack::PushL( temp );
+ if ( temp->Length() > app->iVendor.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+ app->iVendor.Copy( *temp );
+ CleanupStack::PopAndDestroy( temp );
+ temp = NULL;
+
+ app->iVersion.Copy( entry.VersionL().Name() );
+ app->iType = ESisApplication;
+ app->iSize = entry.SizeL();
+ app->iUid = entry.UidL();
+
+ User::LeaveIfError( aListInstApps.iApps.Append( app ) );
+ CleanupStack::Pop( app );
+ }
+
+ // Get possible augmentations
+ RPointerArray<Swi::CSisRegistryPackage> augPackages;
+ CleanupResetAndDestroyPushL( augPackages );
+ entry.AugmentationsL( augPackages );
+ for ( TInt j( 0 ); j < augPackages.Count(); j++ )
+ {
+ Swi::RSisRegistryEntry augmentationEntry;
+ CleanupClosePushL( augmentationEntry );
+ augmentationEntry.OpenL( sisRegistry, *augPackages[j] );
+
+ TBool showIt( EFalse );
+ if ( aListInstApps.iAllApps )
+ {
+ // show all apps -param defined, exlude stubs on ROM
+ if ( !augmentationEntry.IsInRomL() )
+ {
+ showIt = ETrue;
+ }
+ }
+ else
+ {
+ // show if installed one of the specified drives
+ // don't exlude stubs on ROM
+ showIt = IsInstalledToSelectedDrive( aListInstApps.iDriveList,
+ augmentationEntry.InstalledDrivesL() );
+ }
+
+ // Only show if not in rom
+ if ( showIt && augmentationEntry.IsPresentL() )
+ {
+ CSConInstApp* augApp = new (ELeave) CSConInstApp();
+ CleanupStack::PushL( augApp );
+ augApp->iName.Copy( augPackages[j]->Name() );
+
+ HBufC* temp = entry.PackageNameL();
+ CleanupStack::PushL( temp );
+ if ( temp->Length() > augApp->iParentName.MaxLength() )
+ {
+ User::Leave( KErrTooBig );
+ }
+ augApp->iParentName.Copy( *temp );
+ CleanupStack::PopAndDestroy( temp );
+ temp = NULL;
+
+ augApp->iVendor.Copy( augPackages[j]->Vendor() );
+ augApp->iVersion.Copy( augmentationEntry.VersionL().Name() );
+ augApp->iType = ESisAugmentation;
+ augApp->iSize = augmentationEntry.SizeL();
+ augApp->iUid = augmentationEntry.UidL();
+
+ LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add augmentation, index: %d", j );
+ LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : add augmentation, basepkg: %d", i );
+ TInt augindex = augPackages[j]->Index();
+ LOGGER_WRITE_1( "SConPcdUtility::ProcessListInstalledAppsL : augindex: %d",augindex );
+ User::LeaveIfError( aListInstApps.iApps.Append( augApp ) );
+ CleanupStack::Pop( augApp );
+ }
+ CleanupStack::PopAndDestroy( &augmentationEntry );
+ }
+ CleanupStack::PopAndDestroy( &augPackages );
+ CleanupStack::PopAndDestroy( &entry );
+ }
+
+ CleanupStack::PopAndDestroy(&uids);
+ CleanupStack::PopAndDestroy(&sisRegistry);
+ TRACE_FUNC_EXIT;
+ }
+
+//----------------------------------------------------------------------------
+// void SConPcdUtility::AppendInstalledJavaL( RPointerArray<CSConInstApp> &aApps )
+// Appends installed java packages to aApps array.
+//----------------------------------------------------------------------------
+//
+void SConPcdUtility::AppendInstalledJavaL( CSConListInstApps& aListInstApps )
+ {
+ TRACE_FUNC_ENTRY;
+ CJavaRegistry* javaRegistry = CJavaRegistry::NewLC( );
+ RArray<TUid> packageUids;
+ CleanupClosePushL( packageUids );
+ javaRegistry->GetRegistryEntryUidsL( packageUids );
+ LOGGER_WRITE_1("packageUids.Count(): %d", packageUids.Count());
+ for (TInt i=0; i<packageUids.Count(); i++ )
+ {
+ LOGGER_WRITE_1("RegistryEntryL: %d",i);
+ LOGGER_WRITE_1("handle entry uid: 0x%08X",packageUids[i].iUid);
+ CJavaRegistryEntry* entry = javaRegistry->RegistryEntryL( packageUids[i] );
+ if ( entry )
+ {
+ CleanupStack::PushL( entry );
+ if ( entry->Type() >= EGeneralPackage && entry->Type() < EGeneralApplication )
+ {
+ // entry was correct type
+ CJavaRegistryPackageEntry* packageEntry = ( CJavaRegistryPackageEntry* ) entry;
+
+ // check do we need to filter it out
+ TBool showIt( EFalse );
+ if ( aListInstApps.iAllApps )
+ {
+ showIt = ETrue;
+ }
+ else
+ {
+ TDriveNumber drive = packageEntry->Drive();
+ if ( aListInstApps.iDriveList.Length() > drive
+ && aListInstApps.iDriveList[ drive ] )
+ {
+ showIt = ETrue;
+ }
+ }
+
+ if ( showIt )
+ {
+ CSConInstApp* app = new (ELeave) CSConInstApp();
+ CleanupStack::PushL( app );
+ // Get Uid, name, type, vendor
+ app->iUid = packageEntry->Uid();
+ app->iName.Copy ( packageEntry->Name() );
+ LOGGER_WRITE_1( "Name: %S", &app->iName );
+ app->iType = EJavaApplication;
+
+ // Get version
+ TAppVersion midletVersion( packageEntry->Version() );
+ TVersion verType(midletVersion.iMajor, midletVersion.iMinor, midletVersion.iBuild);
+ app->iVersion.Copy( verType.Name() );
+
+ // Get vendor
+ if ( entry->NumberOfCertificateChains() > 0 && packageEntry->Vendor().Length() > 0 )
+ {
+ app->iVendor.Copy( packageEntry->Vendor() );
+ }
+ else
+ {
+ // untrusted applications do not have certificates.
+ // if the application has a certificate, it is installed either as
+ // trusted or not installed at all.
+
+ // unknown vendor
+ TFileName myFileName( KSConResourceName );
+ CStringResourceReader* resReader = CStringResourceReader::NewL( myFileName );
+ TPtrC bufUnknownSuplier;
+ bufUnknownSuplier.Set( resReader->ReadResourceString( R_SECON_UNKNOWN_SUPPLIER ) );
+
+ app->iVendor.Copy( bufUnknownSuplier );
+
+ delete resReader;
+ }
+
+ // Get size
+ app->iSize = packageEntry->UsedUserDiskSpace();
+
+ User::LeaveIfError( aListInstApps.iApps.Append( app ) );
+ CleanupStack::Pop( app );
+ }
+ }
+ CleanupStack::PopAndDestroy( entry );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &packageUids );
+ CleanupStack::PopAndDestroy( javaRegistry );
+ TRACE_FUNC_EXIT;
+ }
+
+//----------------------------------------------------------------------------
+// void SConPcdUtility::AppendInstalledWidgetsL( RPointerArray<CSConInstApp> &aApps )
+// Appends installed widgets to aApps array.
+//----------------------------------------------------------------------------
+//
+void SConPcdUtility::AppendInstalledWidgetsL( CSConListInstApps& aListInstApps )
+ {
+ TRACE_FUNC_ENTRY;
+ RWidgetRegistryClientSession widgetSession;
+ CleanupClosePushL( widgetSession );
+ User::LeaveIfError( widgetSession.Connect() );
+
+ // Get the list of installed widgets
+ RWidgetInfoArray widgetInfoArr;
+ CleanupClosePushL( widgetInfoArr );
+ widgetSession.InstalledWidgetsL( widgetInfoArr );
+ TFileName bundleId;
+ for ( TInt i = 0; i < widgetInfoArr.Count(); i++ )
+ {
+ CWidgetInfo *item = widgetInfoArr[i];
+ CleanupStack::PushL( item );
+
+
+ TBool showIt( EFalse );
+ if ( aListInstApps.iAllApps )
+ {
+ // show all apps -param defined
+ showIt = ETrue;
+ }
+ else
+ {
+ TDriveUnit locationDrive = item->iDriveName->Des();
+ // show if installed one of the specified drives
+ if ( aListInstApps.iDriveList.Length() > locationDrive
+ && aListInstApps.iDriveList[locationDrive] )
+ {
+ showIt = ETrue;
+ }
+ }
+
+ if ( showIt )
+ {
+
+ CSConInstApp* app = new (ELeave) CSConInstApp();
+ CleanupStack::PushL( app );
+ app->iName.Copy( *(item->iBundleName) );
+ app->iType = EWidgetApplication;
+ app->iSize = item->iFileSize;
+ app->iUid = item->iUid;
+
+ CWidgetPropertyValue* propValue = widgetSession.GetWidgetPropertyValueL(
+ item->iUid, EBundleVersion );
+ if ( propValue && propValue->iType == EWidgetPropTypeString )
+ {
+ app->iVersion.Copy( *(propValue->iValue.s) );
+ }
+ delete propValue;
+ propValue = NULL;
+ bundleId.Zero();
+ widgetSession.GetWidgetBundleId( item->iUid, bundleId );
+ app->iWidgetBundleId = bundleId.AllocL();
+
+ User::LeaveIfError( aListInstApps.iApps.Append( app ) );
+ CleanupStack::Pop( app ); // ownership transferred, do not delete
+ }
+ CleanupStack::PopAndDestroy( item );
+ }
+ User::LeaveIfError( widgetSession.Disconnect() );
+
+ CleanupStack::PopAndDestroy( &widgetInfoArr );
+ CleanupStack::PopAndDestroy( &widgetSession );
+ TRACE_FUNC_EXIT;
+ }
+
+// ---------------------------------------------------------
+// SConPcdUtility::IsInstalledToSelectedDrive
+// Solve highest drive from aInstalledDrives and check
+// if that drive is selected
+// ---------------------------------------------------------
+//
+TBool SConPcdUtility::IsInstalledToSelectedDrive( const TDriveList& aSelectedDriveList, TUint aInstalledDrives )
+ {
+ TInt locationDrive;
+ if( aInstalledDrives )
+ {
+ // Select the highest drive as location drive
+ TInt drive = EDriveA;
+ while( aInstalledDrives >>= 1 )
+ {
+ drive++;
+ }
+ locationDrive = drive;
+ }
+ else
+ {
+ // No installed files, select C: as location drive
+ locationDrive = EDriveC;
+ }
+
+ if ( aSelectedDriveList.Length() > locationDrive && aSelectedDriveList[locationDrive] )
+ {
+ LOGGER_WRITE("SConPcdUtility::IsInstalledToSelectedDrive : return ETrue");
+ return ETrue;
+ }
+ else
+ {
+ LOGGER_WRITE("SConPcdUtility::IsInstalledToSelectedDrive : return EFalse");
+ return EFalse;
+ }
+ }
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconqueue.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,452 @@
+/*
+* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Queue implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "sconqueue.h"
+#include "sconpcdconsts.h"
+#include "debug.h"
+#include <SWInstDefs.h> // installer errors
+
+// ============================= MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::~CSConTaskQueue()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConTaskQueue::~CSConTaskQueue()
+ {
+ TRACE_FUNC;
+ iQueue.ResetAndDestroy();
+ iQueue.Close();
+ iTimer.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::GetQueueStatus( TInt aTask, TBool aAllTasks,
+// CSConStatusReply*& aStatus )
+// Returns the status of a specified task / all tasks
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::GetQueueStatusL( TInt aTask, TBool aAllTasks,
+ CSConStatusReply*& aStatus )
+ {
+ RArray<TInt> completedTasks;
+ CleanupClosePushL( completedTasks );
+ if ( aAllTasks )
+ {
+ //if there are tasks
+ if ( iQueue.Count() > 0 )
+ {
+ //set iNoTasks as EFalse
+ aStatus->iNoTasks = EFalse;
+ for ( TInt i = 0; i < iQueue.Count(); i++ )
+ {
+ //Fill reply object
+ CSConTaskReply* taskReply = new (ELeave) CSConTaskReply();
+ CleanupStack::PushL( taskReply );
+ taskReply->InitializeL( *iQueue[i] );
+ User::LeaveIfError( aStatus->iTasks.Append( taskReply ) );
+ CleanupStack::Pop( taskReply );
+ TBool complete = iQueue[i]->GetComplete();
+
+ //Collect completed task numbers to array for deleting
+ if ( complete )
+ {
+ completedTasks.Append( iQueue[i]->iTaskId );
+ }
+ //Otherwise clean all unneccessary data from the reply packet
+ else
+ {
+ taskReply->CleanTaskData();
+ }
+ }
+ }
+ else
+ {
+ //no task in the queue
+ aStatus->iNoTasks = ETrue;
+ }
+
+ //Remove completed tasks from queue
+ for ( TInt j = 0; j < completedTasks.Count(); j++ )
+ {
+ RemoveTask( completedTasks[j] );
+ }
+ }
+ else if ( aTask > 0 )
+ {
+ CSConTask* temp = new (ELeave) CSConTask();
+ temp->iTaskId = aTask;
+ TInt index = iQueue.Find( temp, CSConTaskQueue::Match );
+ delete temp;
+
+ TBool complete = EFalse;
+ CSConTaskReply* taskReply(NULL);
+
+ if ( index != KErrNotFound )
+ {
+ aStatus->iNoTasks = EFalse;
+ //Fill reply object
+ taskReply = new (ELeave) CSConTaskReply();
+ CleanupStack::PushL( taskReply );
+ taskReply->InitializeL( *iQueue[index] );
+ User::LeaveIfError( aStatus->iTasks.Append( taskReply ) );
+ CleanupStack::Pop( taskReply );
+ complete = iQueue[index]->GetComplete();
+ }
+ else
+ {
+ //no task in the queue
+ aStatus->iNoTasks = ETrue;
+ }
+
+ //Delete completed tasks from queue
+ if ( complete )
+ {
+ RemoveTask( aTask );
+ }
+ //Otherwise clean all unneccessary data from the reply packet
+ else if ( taskReply )
+ {
+ taskReply->CleanTaskData();
+ }
+ }
+ else
+ {
+ //no task in the queue
+ aStatus->iNoTasks = ETrue;
+ }
+ CleanupStack::PopAndDestroy( &completedTasks ); // close
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
+// Adds a new task to queue
+// -----------------------------------------------------------------------------
+//
+TInt CSConTaskQueue::AddNewTask( CSConTask*& aNewTask, TInt aTaskId )
+ {
+ TInt ret( KErrNone );
+
+ aNewTask->iTaskId = aTaskId;
+
+ //Set progress value "task accepted for execution"
+ aNewTask->SetProgressValue( KSConCodeTaskCreated );
+ aNewTask->SetCompleteValue( EFalse );
+
+ if ( iQueue.Count() == 0 )
+ {
+ StartQueue();
+ }
+ ret = iQueue.InsertInOrder( aNewTask, CSConTaskQueue::Compare );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::CompleteTask( TInt aTask, TInt aError )
+// Set the task to completed -mode
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::CompleteTask( TInt aTask, TInt aError )
+ {
+ LOGGER_WRITE_1( "CSConTaskQueue::CompleteTask aError: %d", aError );
+ TInt index( KErrNotFound );
+
+ CSConTask* temp = new CSConTask();
+ temp->iTaskId = aTask;
+ index = iQueue.Find( temp, CSConTaskQueue::Match );
+ delete temp;
+
+ if ( index != KErrNotFound )
+ {
+ TBool complete( ETrue );
+ TBool notComplete( EFalse );
+ TInt progress( KSConCodeTaskCompleted );
+
+ switch( aError )
+ {
+ case KErrNone :
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeTaskCompleted;
+ break;
+ case KErrNotFound :
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeNotFound;
+ break;
+ case KErrCompletion :
+ iQueue[index]->SetCompleteValue( notComplete );
+ progress = KSConCodeTaskPartiallyCompleted;
+ break;
+
+ // installer specific errors
+ case SwiUI::KSWInstErrUserCancel:
+ LOGGER_WRITE("User cancelled the operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrUserCancel;
+ break;
+ case SwiUI::KSWInstErrFileCorrupted:
+ LOGGER_WRITE("File is corrupted");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrFileCorrupted;
+ break;
+ case SwiUI::KSWInstErrInsufficientMemory:
+ LOGGER_WRITE("Insufficient free memory in the drive to perform the operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrInsufficientMemory;
+ break;
+ case SwiUI::KSWInstErrPackageNotSupported:
+ LOGGER_WRITE("Installation of the package is not supported");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrPackageNotSupported;
+ break;
+ case SwiUI::KSWInstErrSecurityFailure:
+ LOGGER_WRITE("Package cannot be installed due to security error");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrSecurityFailure;
+ break;
+ case SwiUI::KSWInstErrMissingDependency:
+ LOGGER_WRITE("Package cannot be installed due to missing dependency");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrMissingDependency;
+ break;
+ case SwiUI::KSWInstErrFileInUse:
+ LOGGER_WRITE("Mandatory file is in use and prevents the operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrFileInUse;
+ break;
+ case SwiUI::KSWInstErrGeneralError:
+ LOGGER_WRITE("Unknown error");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrGeneralError;
+ break;
+ case SwiUI::KSWInstErrNoRights:
+ LOGGER_WRITE("The package has no rights to perform the operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrNoRights;
+ break;
+ case SwiUI::KSWInstErrNetworkFailure:
+ LOGGER_WRITE("Indicates that network failure aborted the operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrNetworkFailure;
+ break;
+ case SwiUI::KSWInstErrBusy:
+ LOGGER_WRITE("Installer is busy doing some other operation");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrBusy;
+ break;
+ case SwiUI::KSWInstErrAccessDenied:
+ LOGGER_WRITE("Target location of package is not accessible");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstErrAccessDenied;
+ break;
+ case SwiUI::KSWInstUpgradeError:
+ LOGGER_WRITE("The package is an invalid upgrade");
+ iQueue[index]->SetCompleteValue( complete );
+ progress = KSConCodeInstUpgradeError;
+ break;
+
+ default :
+ iQueue[index]->SetCompleteValue( complete );
+ if ( aError < KErrNone && aError >= KErrCorruptSurrogateFound )
+ {
+ // aError is always negative
+ // -> returned errorcode is from KSConCodeFirstSymbianErr...n
+ progress = KSConCodeFirstSymbianErr - aError;
+ }
+ else
+ {
+ progress = KSConCodeConflict;
+ }
+
+ break;
+ }
+
+ iQueue[index]->SetProgressValue( progress );
+ }
+ StartQueue();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::SetTaskProgress( TInt aTask, TInt aProgressValue )
+// Set the task progress value
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::SetTaskProgress( TInt aTask, TInt aProgressValue )
+ {
+ TInt index( KErrNotFound );
+
+ CSConTask* temp = new CSConTask();
+ temp->iTaskId = aTask;
+ index = iQueue.Find( temp, CSConTaskQueue::Match );
+ delete temp;
+
+ if ( index != KErrNotFound )
+ {
+ iQueue[index]->SetProgressValue( aProgressValue );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::GetTask( TInt aTaskId, CSConTask*& aTask )
+// Receives a specified task
+// -----------------------------------------------------------------------------
+//
+TInt CSConTaskQueue::GetTask( TInt aTaskId, CSConTask*& aTask )
+ {
+ TInt ret( KErrNone );
+ TInt index;
+
+ CSConTask* temp = new CSConTask();
+ temp->iTaskId = aTaskId;
+ index = iQueue.Find( temp, CSConTaskQueue::Match );
+ delete temp;
+
+ if ( index != KErrNotFound )
+ {
+ aTask = iQueue[index];
+ }
+ else
+ {
+ ret = KErrNotFound;
+ }
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::RemoveTask( TInt aTask )
+// Removes a task from the queue
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::RemoveTask( TInt aTask )
+ {
+ TInt index( KErrNotFound );
+
+ CSConTask* temp = new CSConTask();
+ temp->iTaskId = aTask;
+ index = iQueue.Find( temp, CSConTaskQueue::Match );
+ delete temp;
+
+ if ( index != KErrNotFound )
+ {
+ delete iQueue[index];
+ iQueue.Remove( index );
+ iQueue.Compress();
+ }
+
+ if ( iQueue.Count() == 0 )
+ {
+ StopQueue();
+ iQueue.Reset();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::CancelTask( TInt aTask, TBool aAllTasks )
+// Cancels a task
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::CancelTask( TInt aTask, TBool aAllTasks )
+ {
+ TRACE_FUNC_ENTRY;
+
+ //Remove the task from the queue
+ if ( aTask > 0 && !aAllTasks )
+ {
+ RemoveTask( aTask );
+ }
+
+ //Remove all tasks from the queue
+ if ( aAllTasks )
+ {
+ iQueue.ResetAndDestroy();
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::QueueProcessActive()
+// The status of the process
+// -----------------------------------------------------------------------------
+//
+TBool CSConTaskQueue::QueueProcessActive() const
+ {
+ return iQueueProcessActive;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::ChangeQueueProcessStatus()
+// Changes the status of the queue process
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::ChangeQueueProcessStatus()
+ {
+ iQueueProcessActive = !iQueueProcessActive;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::Reset()
+// Resets the queue
+// -----------------------------------------------------------------------------
+//
+void CSConTaskQueue::Reset()
+ {
+ TRACE_FUNC_ENTRY;
+ iTimer.Cancel();
+ iQueue.ResetAndDestroy();
+ TRACE_FUNC_EXIT;
+ }
+
+// ---------------------------------------------------------
+// CSConTaskQueue::Compare( const CSConTask& aFirst,
+// const CSConTask& aSecond )
+// Compares task numbers
+// ---------------------------------------------------------
+TInt CSConTaskQueue::Compare( const CSConTask& aFirst,
+ const CSConTask& aSecond )
+ {
+ if ( aFirst.iTaskId < aSecond.iTaskId )
+ {
+ return -1;
+ }
+ else if ( aFirst.iTaskId > aSecond.iTaskId )
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConTaskQueue::Match( const CSConTask& aFirst, const CSConTask& aSecond )
+// Matches the task numbers
+// -----------------------------------------------------------------------------
+//
+TInt CSConTaskQueue::Match( const CSConTask& aFirst, const CSConTask& aSecond )
+ {
+ if ( aFirst.iTaskId == aSecond.iTaskId )
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconsbeclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1668 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConSBEClient implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <pathinfo.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "sconsbeclient.h"
+#include "debug.h"
+
+const TInt KDataBufExpandSize( 1024 );
+const TInt KMaxObjectSize( 1048576 - 1024 ); // Max chunk size is 1MB, but give some space for ConML wbxml
+_LIT( KSConNoDrive, "\x0" );
+_LIT( KSConDriveExists, "\x1" );
+// ============================= MEMBER FUNCTIONS ==============================
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::NewL( cosnt TInt aMaxObjectSize )
+// Two-phase constructor
+// -----------------------------------------------------------------------------
+//
+CSConSBEClient* CSConSBEClient::NewL( const TInt aMaxObjectSize, RFs& aFs )
+ {
+ TRACE_FUNC;
+ CSConSBEClient* self = new (ELeave) CSConSBEClient( aMaxObjectSize, aFs );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::CSConSBEClient( const TInt aMaxObjectSize )
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CSConSBEClient::CSConSBEClient( const TInt /*aMaxObjectSize*/, RFs& aFs ) :
+ CActive( EPriorityStandard ), iBURModeNormal( ETrue ), iFs( aFs )
+ {
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::~CSConSBEClient()
+// Initializes member data
+// -----------------------------------------------------------------------------
+//
+CSConSBEClient::~CSConSBEClient()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+
+ if( !iBURModeNormal && iSBEClient )
+ {
+ TDriveList driveList;
+
+ for( TInt i = 0; i<KMaxDrives; i++ )
+ {
+ if( i == EDriveC || i == EDriveE )
+ {
+ driveList.Append( KSConDriveExists );
+ }
+ else
+ {
+ driveList.Append( KSConNoDrive );
+ }
+ }
+
+ TRAP( err, iSBEClient->SetBURModeL( driveList, EBURNormal, ENoBackup ) );
+ }
+
+ if( iSBEClient )
+ {
+ delete iSBEClient;
+ iSBEClient = NULL;
+ }
+
+ delete iDataBuffer;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask )
+// Set backup/restore mode
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::SetBURMode( TRequestStatus& aStatus, CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus,
+// CSConTask*& aTask )
+// Lists public files from data owners
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ListPublicFiles( TRequestStatus& aStatus,
+ CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask )
+// Lists participant data owners
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ListDataOwners( TRequestStatus& aStatus, CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask )
+// Lists data sizes from data owners
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::GetDataSize( TRequestStatus& aStatus, CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask )
+// Request a data from a data owner
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::RequestData( TRequestStatus& aStatus, CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus,
+// CSConTask*& aTask )
+// Lists the status of data owners
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::GetDataOwnerStatus( TRequestStatus& aStatus,
+ CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask )
+// Supplies a data to a data owner
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::SupplyData( TRequestStatus& aStatus, CSConTask*& aTask )
+ {
+ TRACE_FUNC_ENTRY;
+ iCallerStatus = &aStatus;
+ *iCallerStatus = KRequestPending;
+
+ iCurrentTask = aTask;
+
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ SetActive();
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::DoCancel()
+// Implementation of CActive::DoCancel()
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::DoCancel()
+ {
+ TRACE_FUNC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::RunL()
+// Implementation of CActive::RunL()
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt err( KErrNone );
+ TInt ret( KErrNone );
+
+ //Initialize a connection to the backup server
+ if( !iSBEClient )
+ {
+ iSBEClient = CSBEClient::NewL();
+ }
+
+ switch( iCurrentTask->GetServiceId() )
+ {
+ case ESetBURMode :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : ESetBURMode" );
+ TRAP( err, ProcessSetBURModeL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessSetBURModeL() : returned %d", err );
+ break;
+ case EListPublicFiles :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : EListPublicFiles" );
+ TRAP( err, ProcessListPublicFilesL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListPublicFilesL() : returned %d", err );
+ break;
+ case EListDataOwners :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : EListDataOwners" );
+ TRAP( err, ProcessListDataOwnersL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessListDataOwnersL() : returned %d", err );
+ break;
+ case EGetDataSize :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataSize" );
+ TRAP( err, ProcessGetDataSizeL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataSizeL() : returned %d", err );
+ break;
+ case ERequestData :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : ERequestData" );
+ TRAP( err, ret = ProcessRequestDataL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessRequestDataL() : returned %d", err );
+ break;
+ case EGetDataOwnerStatus :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : EGetDataOwnerStatus" );
+ TRAP( err, ProcessGetDataOwnerStatusL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : ProcessGetDataOwnerStatusL() : returned %d", err );
+ break;
+ case ESupplyData :
+ LOGGER_WRITE( "CSConSBEClient::RunL() : ESupplyData" );
+ TRAP( err, ret = ProcessSupplyDataL() );
+ LOGGER_WRITE_1( "CSConSBEClient::RunL() : SupplyDataL() : returned %d", err );
+ break;
+ default :
+ err = KErrNotSupported;
+ LOGGER_WRITE( "CSConSBEClient::RunL() : ERROR! Unknown!" );
+ break;
+ }
+
+ if ( err )
+ {
+ HandleSBEErrorL( err );
+ }
+ else
+ {
+ err = ret;
+ }
+ User::RequestComplete( iCallerStatus, err );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessSetBURModeL()
+// Executes SetBURMode task
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ProcessSetBURModeL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ iAllSnapshotsSuppliedCalled = EFalse;
+ iLastChunk = EFalse;
+
+ TDriveList driveList = iCurrentTask->iBURModeParams->iDriveList;
+
+ TBURPartType partialType = EBURUnset;
+ iRestoreMode = EFalse;
+
+ switch( iCurrentTask->iBURModeParams->iPartialType )
+ {
+ case ESConBurNormal :
+ partialType = EBURNormal;
+ break;
+ case ESConBurBackupFull :
+ partialType = EBURBackupFull;
+ break;
+ case ESConBurBackupPartial :
+ partialType = EBURBackupPartial;
+ break;
+ case ESConBurRestoreFull :
+ partialType = EBURRestoreFull;
+ iRestoreMode = ETrue;
+ break;
+ case ESConBurRestorePartial :
+ partialType = EBURRestorePartial;
+ iRestoreMode = ETrue;
+ break;
+ default :
+ partialType = EBURUnset;
+ break;
+ }
+
+ if ( partialType == EBURBackupFull || partialType == ESConBurBackupPartial )
+ {
+ // initialize buffer
+ if ( !iDataBuffer )
+ iDataBuffer = CBufFlat::NewL( KDataBufExpandSize );
+ else
+ iDataBuffer->Reset();
+ iDataBufferSize=0;
+ }
+ else
+ {
+ delete iDataBuffer;
+ iDataBuffer = 0;
+ }
+
+ TBackupIncType incType = ENoBackup;
+
+ switch( iCurrentTask->iBURModeParams->iIncType )
+ {
+ case ESConNoBackup :
+ incType = ENoBackup;
+ break;
+ case ESConBackupBase :
+ incType = EBackupBase;
+ break;
+ case ESConBackupIncrement :
+ incType = EBackupIncrement;
+ break;
+ default :
+ incType = ENoBackup;
+ break;
+ }
+
+ iSBEClient->SetBURModeL( driveList, partialType, incType );
+
+ if( partialType != EBURNormal )
+ {
+ iBURModeNormal = EFalse;
+ }
+ else
+ {
+ iBURModeNormal = ETrue;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessListPublicFilesL()
+// Executes ListPublicFiles task
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ProcessListPublicFilesL()
+ {
+ TRACE_FUNC_ENTRY;
+ //Get the secure id
+ TSecureId sid = iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid;
+ TSecureId packageSid;
+ LOGGER_WRITE_1("DO: 0x%08x", sid.iId);
+ TPtrC packageName(KNullDesC);
+ const TUint KSConUidLength = 8; // 8 digits (hex)
+ const TUint KSConUidPrefixLength = 3; // prefix is '#0x'
+
+ TInt packageNameLength = iCurrentTask->iPubFilesParams->iDataOwners[0]->iPackageName.Length();
+
+ if ( packageNameLength > KSConUidLength )
+ {
+ // remove uid from package name
+ packageName.Set(
+ iCurrentTask->iPubFilesParams->iDataOwners[0]->
+ iPackageName.Left( packageNameLength - (KSConUidLength + KSConUidPrefixLength) ) );
+ LOGGER_WRITE_1("PackageName: %S", &packageName );
+
+ TPtrC sidPtr( iCurrentTask->iPubFilesParams->iDataOwners[0]->
+ iPackageName.Right( KSConUidLength ) );
+ TLex lex(sidPtr);
+ TInt err = lex.Val( packageSid.iId, EHex );
+ if ( err )
+ {
+ LOGGER_WRITE_1("lex.Val error: %d", err);
+ packageName.Set( KNullDesC );
+ packageSid.iId = 0;
+ }
+ LOGGER_WRITE_1("packageSid: 0x%08x", packageSid.iId );
+ }
+
+ //Get the drive list
+ TDriveList driveList =
+ iCurrentTask->iPubFilesParams->iDataOwners[0]->iDriveList;
+
+ RFileArray files;
+ CleanupClosePushL( files );
+ //Go through all the drives in the list
+ for( TInt i = 0; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ //Get files from the drive
+ TDriveNumber driveNumber = GetDriveNumber( i );
+ LOGGER_WRITE_1("driveNumber: %d", driveNumber);
+
+ LOGGER_WRITE("List public files using CSBSecureId");
+ CSBSecureId* secureId = CSBSecureId::NewL( sid );
+ CleanupStack::PushL( secureId );
+
+ TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *secureId, files ) );
+
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err);
+ User::LeaveIfError( err );
+ }
+
+ CleanupStack::PopAndDestroy( secureId );
+ LOGGER_WRITE_1("public files: %d", files.Count());
+ AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ;
+
+ if ( packageName.Length() > 0 )
+ {
+ LOGGER_WRITE("Append files registered to packages. Using CSBPackageId");
+
+ CSBPackageId* packageId = CSBPackageId::NewL(
+ iCurrentTask->iPubFilesParams->iDataOwners[0]->iUid,
+ packageSid,
+ packageName );
+ CleanupStack::PushL( packageId );
+
+ TRAPD( err, iSBEClient->PublicFileListL( driveNumber, *packageId, files ) );
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1("iSBEClient->PublicFileListL leaved: %d", err);
+ User::LeaveIfError( err );
+ }
+ CleanupStack::PopAndDestroy( packageId );
+
+ LOGGER_WRITE_1("public files: %d", files.Count());
+ AppendFilesToFilelistL( files, iCurrentTask->iPubFilesParams->iFiles) ;
+ }
+
+ files.Reset();
+ }
+ }
+ CleanupStack::PopAndDestroy( &files );
+ TRACE_FUNC_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessListDataOwnersL()
+// Executes ListDataOwners task
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ProcessListDataOwnersL()
+ {
+ TRACE_FUNC_ENTRY;
+ TBool includeToList( ETrue );
+ RPointerArray<CDataOwnerInfo> dataOwners;
+ RArray<TUid> packageArray;
+ CleanupResetAndDestroyPushL( dataOwners );
+ CleanupClosePushL( packageArray );
+
+ iSBEClient->ListOfDataOwnersL( dataOwners );
+ LOGGER_WRITE_1( "dataOwners count: %d", dataOwners.Count() );
+
+
+ for( TInt i = 0; i < dataOwners.Count(); i++ )
+ {
+ LOGGER_WRITE_2("handling do: %d, count: %d", i, dataOwners.Count());
+ CSConDataOwner* dataOwner = new (ELeave) CSConDataOwner();
+ CleanupStack::PushL( dataOwner );
+ // default values
+ TSecureId sid( 0 );
+ includeToList = ETrue;
+
+ TCommonBURSettings commonOptions = dataOwners[i]->CommonSettings();
+ TPassiveBURSettings passiveOptions = dataOwners[i]->PassiveSettings();
+ TActiveBURSettings activeOptions = dataOwners[i]->ActiveSettings();
+
+ //active, passive or hybrid? (common)
+ if( commonOptions & EActiveBUR && commonOptions & EPassiveBUR )
+ {
+ dataOwner->iType = EHybridDataOwner;
+ }
+ else if( commonOptions & EActiveBUR )
+ {
+ dataOwner->iType = EActiveDataOwner;
+ }
+ else if( commonOptions & EPassiveBUR )
+ {
+ dataOwner->iType = EPassiveDataOwner;
+ }
+
+ //requires reboot? (common)
+ if( commonOptions & ERequiresReboot )
+ {
+ dataOwner->iReqReboot = ETrue;
+ }
+ else
+ {
+ dataOwner->iReqReboot = EFalse;
+ }
+
+ //has system files? (common)
+ if( commonOptions & EHasSystemFiles )
+ {
+ dataOwner->iHasFiles = ESystemFiles;
+ }
+
+ //supports selective? (common)
+ if( commonOptions & ESupportsSelective )
+ {
+ dataOwner->iSupportsSel = ETrue;
+ }
+ else
+ {
+ dataOwner->iSupportsSel = EFalse;
+ }
+
+ //has public files? (passive)
+ if( passiveOptions & EHasPublicFiles )
+ {
+ if( dataOwner->iHasFiles == ESystemFiles )
+ {
+ dataOwner->iHasFiles = EPublicSystemFiles;
+ }
+ else
+ {
+ dataOwner->iHasFiles = EPublicFiles;
+ }
+ }
+
+ //supports incremental? (active and passive)
+ if( activeOptions & EActiveSupportsInc ||
+ passiveOptions & EPassiveSupportsInc )
+ {
+ dataOwner->iSupportsInc = ETrue;
+ }
+ else
+ {
+ dataOwner->iSupportsInc = EFalse;
+ }
+
+ //delay to prepare data? (active)
+ if( activeOptions & EDelayToPrepareData )
+ {
+ dataOwner->iDelayToPrep = ETrue;
+ }
+ else
+ {
+ dataOwner->iDelayToPrep = EFalse;
+ }
+
+ //fill drivelist
+ dataOwner->iDriveList = dataOwners[i]->DriveList();
+ //filter the drive list
+ FilterDriveList( dataOwner->iDriveList );
+
+ CSBGenericDataType* genericData = &( dataOwners[i]->Identifier() );
+ TSBDerivedType derived = genericData->DerivedTypeL();
+
+ if( derived == ESIDDerivedType )
+ {
+ //Uif of the data owner
+ CSBSecureId* secureId = CSBSecureId::NewL( genericData );
+ CleanupStack::PushL( secureId );
+ sid = secureId->SecureIdL();
+
+ dataOwner->iUid.iUid = (TInt32)sid.iId;
+ LOGGER_WRITE_1("ESIDDerivedType, sid: 0x%08x", dataOwner->iUid.iUid );
+
+ CleanupStack::PopAndDestroy( secureId );
+ }
+ else if( derived == EPackageDerivedType )
+ {
+ //Package name and uid of the data owner
+ CSBPackageId* packageId = CSBPackageId::NewL( genericData );
+ CleanupStack::PushL( packageId );
+
+ dataOwner->iPackageName = packageId->PackageNameL();
+ dataOwner->iUid.iUid = packageId->PackageIdL().iUid;
+ LOGGER_WRITE_1("EPackageDerivedType, uid: 0x%08x", dataOwner->iUid.iUid );
+ sid = packageId->SecureIdL();
+ LOGGER_WRITE_1("sid: 0x%08x", sid.iId );
+
+ // owerload the package name, also add sid information.
+ _LIT(KSidFormat, "#0x%08x");
+ const TInt KSidFormatLength = 11;
+ TBuf<KSidFormatLength> sidFormat;
+ sidFormat.Format( KSidFormat, sid.iId );
+ if ( dataOwner->iPackageName.Length() + sidFormat.Length()
+ <= dataOwner->iPackageName.MaxLength() )
+ {
+ dataOwner->iPackageName.Append( sidFormat );
+ }
+ else
+ {
+ LOGGER_WRITE("WARNING: Package name too long, sid not included.");
+ }
+
+ LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName );
+ if( sid )
+ {
+ //Find if the package is already included to dataowner list
+ if( packageArray.Find( packageId->PackageIdL(),
+ CSConSBEClient::Match ) != KErrNotFound )
+ {
+ LOGGER_WRITE("dataowner was already included to list");
+ //Don't include dataowner to list again
+ includeToList = EFalse;
+ }
+ else
+ {
+ //Store package's id for filtering
+ LOGGER_WRITE_1( "Storing package id for filtering, uid: 0x%08x", dataOwner->iUid.iUid );
+ packageArray.Append( dataOwner->iUid );
+ }
+ }
+
+ CleanupStack::PopAndDestroy( packageId );
+ }
+ else if( derived == EJavaDerivedType )
+ {
+ //Hash
+ CSBJavaId* javaId = CSBJavaId::NewL( genericData );
+ CleanupStack::PushL( javaId );
+
+ //Initialize with hash data length and copy hash
+ dataOwner->iJavaHash = HBufC::NewL( javaId->SuiteHashL().Length() );
+ dataOwner->iJavaHash->Des().Copy( javaId->SuiteHashL() );
+
+ //For ConML: set as passive package
+ dataOwner->iType = EPassiveDataOwner;
+ dataOwner->iPackageName.Copy( javaId->SuiteNameL() );
+
+#ifdef _DEBUG
+ LOGGER_WRITE("EJavaDerivedType" );
+ LOGGER_WRITE_1("Package name: %S", &dataOwner->iPackageName );
+ TPtrC hash( dataOwner->iJavaHash->Des() );
+ LOGGER_WRITE_1("JavaHash: %S", &hash );
+#endif
+
+ CleanupStack::PopAndDestroy( javaId );
+ }
+ else
+ {
+ LOGGER_WRITE("Unknown type, ignored from list" );
+ //Unknown type => ignore from list
+ includeToList = EFalse;
+ }
+
+ if( includeToList )
+ {
+ LOGGER_WRITE_1( "Appending to list, uid: 0x%08x", dataOwner->iUid.iUid );
+ iCurrentTask->iListDataOwnersParams->iDataOwners.AppendL( dataOwner );
+ CleanupStack::Pop( dataOwner );
+ }
+
+ if( sid )
+ {
+ LOGGER_WRITE_1( "Appending package sid to list, sid: 0x%08x", sid.iId );
+ CSConDataOwner* packageDataOwner = dataOwner->CopyL();
+ CleanupStack::PushL( packageDataOwner );
+ //Clear package name
+ packageDataOwner->iPackageName = KNullDesC();
+ //Add sid
+ packageDataOwner->iUid.iUid = sid.iId;
+ iCurrentTask->iListDataOwnersParams->iDataOwners.AppendL( packageDataOwner );
+ CleanupStack::Pop( packageDataOwner );
+ }
+
+ if( !includeToList )
+ {
+ //Not included to list => delete memory allocation
+ CleanupStack::PopAndDestroy( dataOwner );
+ }
+ }
+
+ packageArray.Reset();
+ CleanupStack::PopAndDestroy( &packageArray );
+ CleanupStack::PopAndDestroy( &dataOwners );
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessGetDataSizeL()
+// Executes GetDataSize task
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ProcessGetDataSizeL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ if ( !iAllSnapshotsSuppliedCalled )
+ {
+ TInt err(KErrNone);
+ // we have to call AllSnapshotsSupplied() to inform active
+ // data owners to start prepare their base data.
+ TRAP( err, iSBEClient->AllSnapshotsSuppliedL() );
+ LOGGER_WRITE_1( "AllSnapshotsSuppliedL() leaved: %d", err );
+ iAllSnapshotsSuppliedCalled = ETrue;
+ }
+
+
+ TBool packageData( EFalse );
+
+ //Calculate data size for every data owner received from the task
+ for( TInt i = 0; i < iCurrentTask->iGetDataSizeParams->iDataOwners.Count();
+ i++ )
+ {
+ packageData = EFalse;
+ CSConDataOwner* dataOwner =
+ iCurrentTask->iGetDataSizeParams->iDataOwners[i];
+
+ TTransferDataType tdt( ERegistrationData );
+ TPackageDataType pdt( ESystemData );
+
+ LOGGER_WRITE_2( "ProcessGetDataSizeL DO %d of %d", i, iCurrentTask->iGetDataSizeParams->iDataOwners.Count() );
+ LOGGER_WRITE_1( "ProcessGetDataSizeL SID 0x%08x", dataOwner->iUid );
+ switch( dataOwner->iTransDataType )
+ {
+ case ESConRegistrationData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ERegistrationData" );
+ tdt = ERegistrationData;
+ break;
+ case ESConPassiveSnapshotData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveSnapshotData" );
+ tdt = EPassiveSnapshotData;
+ break;
+ case ESConPassiveBaseData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveBaseData" );
+ tdt = EPassiveBaseData;
+ break;
+ case ESConPassiveIncrementalData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EPassiveIncrementalData" );
+ tdt = EPassiveIncrementalData;
+ break;
+ case ESConActiveSnapshotData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveSnapshotData" );
+ tdt = EActiveSnapshotData;
+ break;
+ case ESConActiveBaseData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveBaseData" );
+ tdt = EActiveBaseData;
+ break;
+ case ESConActiveIncrementalData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : EActiveIncrementalData" );
+ tdt = EActiveIncrementalData;
+ break;
+ case ESConSystemData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemData" );
+ pdt = ESystemData;
+ packageData = ETrue;
+ break;
+ case ESConSystemSnapshotData :
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataSize() : ESystemSnapshotData" );
+ pdt = ESystemSnapshotData;
+ packageData = ETrue;
+ break;
+ default :
+ break;
+ }
+
+ if( packageData && !dataOwner->iJavaHash )
+ {
+ dataOwner->iSize = PackageDataSizeL( dataOwner->iUid, dataOwner->iDriveList, pdt );
+ }
+ else if( !dataOwner->iJavaHash )
+ {
+ dataOwner->iSize = SidDataSizeL( dataOwner->iUid, dataOwner->iDriveList, tdt );
+ }
+ else
+ {
+ dataOwner->iSize = JavaDataSizeL( dataOwner->iJavaHash->Des(),
+ dataOwner->iDriveList );
+ }
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessRequestDataL()
+// Executes RequestData task
+// -----------------------------------------------------------------------------
+//
+TInt CSConSBEClient::ProcessRequestDataL()
+ {
+ TRACE_FUNC_ENTRY;
+ TInt ret( KErrNone );
+
+ TBool packageData = EFalse;
+ TTransferDataType transferDataType( ERegistrationData );
+ TPackageDataType packageDataType( ESystemSnapshotData );
+ LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() iTransDataType: %d",
+ (TInt)iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType);
+
+ switch( iCurrentTask->iRequestDataParams->iDataOwner->iTransDataType )
+ {
+ case ESConRegistrationData :
+ transferDataType = ERegistrationData;
+ break;
+ case ESConPassiveSnapshotData :
+ transferDataType = EPassiveSnapshotData;
+ break;
+ case ESConPassiveBaseData :
+ transferDataType = EPassiveBaseData;
+ break;
+ case ESConPassiveIncrementalData :
+ transferDataType = EPassiveIncrementalData;
+ break;
+ case ESConActiveSnapshotData :
+ transferDataType = EActiveSnapshotData;
+ break;
+ case ESConActiveBaseData :
+ transferDataType = EActiveBaseData;
+ break;
+ case ESConActiveIncrementalData :
+ transferDataType = EActiveIncrementalData;
+ break;
+ case ESConSystemData :
+ packageDataType = ESystemData;
+ packageData = ETrue;
+ break;
+ case ESConSystemSnapshotData:
+ packageDataType = ESystemSnapshotData;
+ packageData = ETrue;
+ break;
+ default :
+ break;
+ }
+
+
+ //Get the drive number
+ TDriveNumber driveNumber = EDriveC;
+ TDriveList driveList = iCurrentTask->iRequestDataParams->
+ iDataOwner->iDriveList;
+
+ for( TInt i = 0; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ driveNumber = GetDriveNumber( i );
+ break;
+ }
+ }
+
+ //Get UID, SID or Java hash
+ TUid uid;
+ TSecureId sid;
+
+ uid.iUid = 0;
+ sid.iId = 0;
+
+ if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
+ {
+ uid = iCurrentTask->iRequestDataParams->iDataOwner->iUid;
+ LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() uid: 0x%08x", uid.iUid);
+ }
+ else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
+ {
+ sid = iCurrentTask->iRequestDataParams->iDataOwner->iUid;
+ LOGGER_WRITE_1("CSConSBEClient::ProcessRequestDataL() sid: 0x%08x", sid.iId);
+ }
+
+
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : \
+ Begin - Package data: %d", packageData );
+
+ LOGGER_WRITE_1("iLastChunk: %d", (TInt) iLastChunk );
+ LOGGER_WRITE_1("iDataBufferSize: %d", iDataBufferSize );
+
+ // if was't last chunk and there are free space left on our packet
+ if( !iLastChunk && iDataBufferSize < KMaxObjectSize )
+ {
+ //No data left, request more from the server
+ if( packageData && !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
+ {
+ CSBPackageTransferType* ptt = CSBPackageTransferType::NewL(
+ uid, driveNumber, packageDataType );
+ CleanupStack::PushL( ptt );
+
+ RequestDataL( *ptt );
+
+ CleanupStack::PopAndDestroy( ptt );
+ }
+ else if( !iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash )
+ {
+ CSBSIDTransferType* stt = CSBSIDTransferType::NewL(
+ sid, driveNumber, transferDataType );
+ CleanupStack::PushL( stt );
+
+ RequestDataL( *stt );
+
+ CleanupStack::PopAndDestroy( stt );
+ }
+ else
+ {
+ TPtr javaHashPtr = iCurrentTask->iRequestDataParams->iDataOwner->iJavaHash->Des();
+ CSBJavaTransferType* jtt( NULL );
+ //When ESystemData is requested, request EJavaMIDlet
+ if( packageDataType == ESystemData )
+ {
+ jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet );
+ }
+ //When EPassiveBaseData is requested, request EJavaMIDletData
+ else if( transferDataType == EPassiveBaseData )
+ {
+ jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData );
+ }
+
+ if( packageDataType == ESystemData || transferDataType == EPassiveBaseData )
+ {
+ CleanupStack::PushL( jtt );
+
+ RequestDataL( *jtt );
+
+ CleanupStack::PopAndDestroy( jtt );
+ }
+ else
+ {
+ //No data
+ iDataBuffer->Reset();
+ iDataBufferSize = 0;
+ iLastChunk = ETrue;
+ }
+ }
+ }
+
+ LOGGER_WRITE_1("readed iLastChunk: %d", (TInt) iLastChunk );
+ LOGGER_WRITE_1("readed iDataBufferSize: %d", iDataBufferSize );
+
+
+
+ if( iCurrentTask->iRequestDataParams->iBackupData )
+ {
+ delete iCurrentTask->iRequestDataParams->iBackupData;
+ iCurrentTask->iRequestDataParams->iBackupData = NULL;
+ }
+
+ TInt dataToRead = KMaxObjectSize;
+ if ( dataToRead > iDataBufferSize )
+ dataToRead = iDataBufferSize;
+
+ //Initialize the task data buffer
+ iCurrentTask->iRequestDataParams->iBackupData = HBufC8::NewL( dataToRead );
+ //Get descriptor task's buffer
+ TPtr8 backupDataPtr = iCurrentTask->iRequestDataParams->iBackupData->Des();
+
+
+ iDataBuffer->Read(0, backupDataPtr, dataToRead );
+ iDataBuffer->Delete(0, dataToRead);
+ iDataBufferSize -= dataToRead;
+
+ if ( !iLastChunk || iDataBufferSize>0 )
+ {
+ LOGGER_WRITE( "CSConSBEClient::ProcessRequestDataL() : There are more data available" );
+ iCurrentTask->iRequestDataParams->iMoreData = ETrue;
+ //Another task is needed to transfer the data to the client
+ ret = KErrCompletion;
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConSBEClient::ProcessRequestDataL() : All data readed" );
+ iDataBuffer->Reset();
+ iDataBufferSize = 0;
+ // task will be completed, initialize iLastChunk value for next operation
+ iLastChunk = EFalse;
+ }
+
+
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessRequestDataL() : returned %d", ret );
+ return ret;
+ }
+
+void CSConSBEClient::RequestDataL( CSBGenericTransferType& aGenericTransferType )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( !iDataBuffer )
+ User::Leave( KErrArgument );
+
+ do
+ {
+ LOGGER_WRITE( "iSBEClient->RequestDataL() : start" );
+ TRequestStatus status;
+ iSBEClient->RequestDataL( aGenericTransferType, status );
+ User::WaitForRequest( status );
+ LOGGER_WRITE_1( "iSBEClient->RequestDataL() : status.Int() %d", status.Int() );
+ User::LeaveIfError( status.Int() );
+
+ //Get the data and store the handle
+ CSBGenericTransferType* gtt = NULL;
+ const TPtrC8& dataPtr = iSBEClient->TransferDataInfoL( gtt, iLastChunk );
+ LOGGER_WRITE_1("data size: %d", dataPtr.Length());
+ delete gtt;
+ iDataBuffer->ExpandL( iDataBufferSize, dataPtr.Length() );
+ iDataBuffer->Write(iDataBufferSize, dataPtr);
+ iDataBufferSize += dataPtr.Length();
+ LOGGER_WRITE_1("total buffer size: %d", iDataBufferSize);
+ }
+ // Continue if there are more data, and our packet is not full
+ while ( !iLastChunk && iDataBufferSize < KMaxObjectSize );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessGetDataOwnerStatusL()
+// Executes GetDataOwnerStatus task
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::ProcessGetDataOwnerStatusL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ //If restore-mode, call AllSystemFilesRestored()
+ if( iRestoreMode )
+ {
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() start" );
+ iSBEClient->AllSystemFilesRestored();
+ LOGGER_WRITE( "CSConSBEClient::ProcessGetDataOwnerStatusL() : iSBEClient->AllSystemFilesRestored() end" );
+ }
+
+ RSIDStatusArray sidStatus;
+ CleanupClosePushL(sidStatus);
+
+ for( TInt i = 0; i < iCurrentTask->iGetDataOwnerParams->iDataOwners.Count();
+ i++ )
+ {
+ CSConDataOwner* dataOwner =
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[i];
+ TSecureId sid( dataOwner->iUid );
+ TDataOwnerStatus dataOwnerStatus = EUnset;
+ TInt dataOwnerError = 0;
+
+ TDataOwnerAndStatus dataOwnerAndStatus( sid, dataOwnerStatus,
+ dataOwnerError );
+
+ sidStatus.Append( dataOwnerAndStatus );
+ }
+
+ iSBEClient->SIDStatusL( sidStatus );
+
+ for( TInt j = 0; j < sidStatus.Count(); j++ )
+ {
+ switch( sidStatus[j].iStatus )
+ {
+ case EUnset :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConUnset;
+ break;
+ case EDataOwnerNotFound :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConNotFound;
+ break;
+ case EDataOwnerReady :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConReady;
+ break;
+ case EDataOwnerNotReady :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConNotReady;
+ break;
+ case EDataOwnerFailed :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConFailed;
+ break;
+ case EDataOwnerNotConnected :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConNotConnected;
+ break;
+ case EDataOwnerReadyNoImpl :
+ iCurrentTask->iGetDataOwnerParams->iDataOwners[j]->
+ iDataOwnStatus = ESConNotImplemented;
+ break;
+ default :
+ break;
+ }
+ }
+ sidStatus.Reset();
+ CleanupStack::PopAndDestroy( &sidStatus );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::ProcessSupplyDataL()
+// Executes SupplyData task
+// -----------------------------------------------------------------------------
+//
+TInt CSConSBEClient::ProcessSupplyDataL()
+ {
+ TRACE_FUNC_ENTRY;
+ TBool packageData = EFalse;
+ TBool lastChunk = ETrue;
+ TTransferDataType transferDataType( ERegistrationData );
+ TPackageDataType packageDataType( ESystemSnapshotData );
+ LOGGER_WRITE_1("CSConSBEClient::ProcessSupplyDataL() iTransDataType: %d",
+ (TInt)iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType);
+ switch( iCurrentTask->iSupplyDataParams->iDataOwner->iTransDataType )
+ {
+ case ESConRegistrationData :
+ transferDataType = ERegistrationData;
+ break;
+ case ESConPassiveSnapshotData :
+ transferDataType = EPassiveSnapshotData;
+ break;
+ case ESConPassiveBaseData :
+ transferDataType = EPassiveBaseData;
+ break;
+ case ESConPassiveIncrementalData :
+ transferDataType = EPassiveIncrementalData;
+ break;
+ case ESConActiveSnapshotData :
+ transferDataType = EActiveSnapshotData;
+ break;
+ case ESConActiveBaseData :
+ transferDataType = EActiveBaseData;
+ break;
+ case ESConActiveIncrementalData :
+ transferDataType = EActiveIncrementalData;
+ break;
+ case ESConSystemData :
+ packageDataType = ESystemData;
+ packageData = ETrue;
+ break;
+ case ESConSystemSnapshotData:
+ packageDataType = ESystemSnapshotData;
+ packageData = ETrue;
+ break;
+ default :
+ break;
+ }
+
+ //Get the drive number
+ TDriveNumber driveNumber = EDriveC;
+ TDriveList driveList = iCurrentTask->iSupplyDataParams->iDataOwner->
+ iDriveList;
+
+ for( TInt i = 0; i < KMaxDrives; i++ )
+ {
+ if( driveList[i] )
+ {
+ driveNumber = GetDriveNumber( i );
+ break;
+ }
+ }
+
+ //Get UID or SID
+ TUid uid;
+ TSecureId sid;
+
+ uid.iUid = 0;
+ sid.iId = 0;
+
+ if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
+ {
+ uid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid;
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() uid: 0x%08x", uid.iUid );
+ }
+ else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
+ {
+ sid = iCurrentTask->iSupplyDataParams->iDataOwner->iUid;
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() sid: 0x%08x", sid.iId );
+ }
+
+
+ if( packageData && !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
+ {
+ CSBPackageTransferType* ptt = CSBPackageTransferType::NewL( uid, driveNumber,
+ packageDataType );
+ CleanupStack::PushL( ptt );
+
+ //Write restore data to chunk
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() :\
+ Received data length: %d", iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
+ iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
+ iSupplyDataParams->iRestoreData->Des() );
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
+
+ delete iCurrentTask->iSupplyDataParams->iRestoreData;
+ iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
+
+ //Supply data
+ lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : start" );
+ TRequestStatus status;
+ iSBEClient->SupplyDataL( *ptt, lastChunk, status );
+ User::WaitForRequest( status );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( ptt, lastChunk ) : stop" );
+
+ User::LeaveIfError( status.Int() );
+
+ CleanupStack::PopAndDestroy( ptt );
+ }
+ else if( !iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash )
+ {
+ CSBSIDTransferType* stt = CSBSIDTransferType::NewL( sid, driveNumber, transferDataType );
+ CleanupStack::PushL( stt );
+
+ //Write restore data to chunk
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d",
+ iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
+ iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
+ iSupplyDataParams->iRestoreData->Des() );
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
+
+ delete iCurrentTask->iSupplyDataParams->iRestoreData;
+ iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
+
+ //Supply data
+ lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : start" );
+ TRequestStatus status;
+ iSBEClient->SupplyDataL( *stt, lastChunk, status );
+ User::WaitForRequest( status );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( stt, lastChunk ) : stop" );
+
+ User::LeaveIfError( status.Int() );
+
+ CleanupStack::PopAndDestroy( stt );
+ }
+ else
+ {
+ TPtr javaHashPtr = iCurrentTask->iSupplyDataParams->iDataOwner->iJavaHash->Des();
+ CSBJavaTransferType* jtt( NULL );
+ if( packageDataType == ESystemData )
+ {
+ LOGGER_WRITE( "iSBEClient->SupplyDataL java ESystemData" );
+ jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDlet );
+ }
+ else if( transferDataType == EPassiveBaseData )
+ {
+ LOGGER_WRITE( "iSBEClient->SupplyDataL java EPassiveBaseData" );
+ jtt = CSBJavaTransferType::NewL( javaHashPtr, driveNumber, EJavaMIDletData );
+ }
+
+ if( packageDataType == ESystemData || transferDataType == EPassiveBaseData )
+ {
+ CleanupStack::PushL( jtt );
+ //Write restore data to chunk
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy() : start" );
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : Received data length: %d",
+ iCurrentTask->iSupplyDataParams->iRestoreData->Length() );
+ iSBEClient->TransferDataAddressL().Copy( iCurrentTask->
+ iSupplyDataParams->iRestoreData->Des() );
+ LOGGER_WRITE( "iSBEClient->TransferDataAddressL().Copy()" );
+
+ delete iCurrentTask->iSupplyDataParams->iRestoreData;
+ iCurrentTask->iSupplyDataParams->iRestoreData = NULL;
+
+ //Supply data
+ lastChunk = !( iCurrentTask->iSupplyDataParams->iMoreData );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : start" );
+ TRequestStatus status;
+ iSBEClient->SupplyDataL( *jtt, lastChunk, status );
+ User::WaitForRequest( status );
+ LOGGER_WRITE( "iSBEClient->SupplyDataL( jtt, lastChunk ) : stop" );
+
+ User::LeaveIfError( status.Int() );
+
+ CleanupStack::PopAndDestroy( jtt );
+ }
+ }
+
+ TInt ret( KErrNone );
+
+ if( !lastChunk )
+ {
+ ret = KErrCompletion;
+ }
+
+ LOGGER_WRITE_1( "CSConSBEClient::ProcessSupplyDataL() : returned %d", ret );
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const
+// Maps TInt drive number to TDriveNumber
+// -----------------------------------------------------------------------------
+//
+TDriveNumber CSConSBEClient::GetDriveNumber( const TInt& aDrive ) const
+ {
+ TDriveNumber driveNumber;
+ switch( aDrive )
+ {
+ case 0 :
+ driveNumber = EDriveA;
+ break;
+ case 1 :
+ driveNumber = EDriveB;
+ break;
+ case 2 :
+ driveNumber = EDriveC;
+ break;
+ case 3 :
+ driveNumber = EDriveD;
+ break;
+ case 4 :
+ driveNumber = EDriveE;
+ break;
+ case 5 :
+ driveNumber = EDriveF;
+ break;
+ case 6 :
+ driveNumber = EDriveG;
+ break;
+ case 7 :
+ driveNumber = EDriveH;
+ break;
+ case 8 :
+ driveNumber = EDriveI;
+ break;
+ case 9 :
+ driveNumber = EDriveJ;
+ break;
+ case 10 :
+ driveNumber = EDriveK;
+ break;
+ case 11 :
+ driveNumber = EDriveL;
+ break;
+ case 12 :
+ driveNumber = EDriveM;
+ break;
+ case 13 :
+ driveNumber = EDriveN;
+ break;
+ case 14 :
+ driveNumber = EDriveO;
+ break;
+ case 15 :
+ driveNumber = EDriveP;
+ break;
+ case 16 :
+ driveNumber = EDriveQ;
+ break;
+ case 17 :
+ driveNumber = EDriveR;
+ break;
+ case 18 :
+ driveNumber = EDriveS;
+ break;
+ case 19 :
+ driveNumber = EDriveT;
+ break;
+ case 20 :
+ driveNumber = EDriveU;
+ break;
+ case 21 :
+ driveNumber = EDriveV;
+ break;
+ case 22 :
+ driveNumber = EDriveW;
+ break;
+ case 23 :
+ driveNumber = EDriveX;
+ break;
+ case 24 :
+ driveNumber = EDriveY;
+ break;
+ case 25 :
+ driveNumber = EDriveZ;
+ break;
+ default :
+ driveNumber = EDriveC;
+ break;
+ }
+
+ return driveNumber;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const
+// Filters the drive list
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::FilterDriveList( TDriveList& aDriveList ) const
+ {
+ TDriveInfo info;
+
+ for ( TInt i = 0; i < aDriveList.Length(); i++ )
+ {
+ if ( aDriveList[i] )
+ {
+ iFs.Drive( info, i );
+#ifdef __WINS__
+ if ( i == EDriveD )
+ {
+ LOGGER_WRITE( "EDriveD skipped on WINS build" );
+ aDriveList[i] = '\x0';
+ }
+#else
+ if ( info.iType == EMediaRam )
+ {
+ aDriveList[i] = '\x0';
+ }
+#endif
+ }
+ }
+
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::Match( const CSConTask& aFirst, const CSConTask& aSecond )
+// Matches the uids
+// -----------------------------------------------------------------------------
+//
+TInt CSConSBEClient::Match( const TUid& aFirst, const TUid& aSecond )
+ {
+ if( aFirst == aSecond )
+ {
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::HandleSBEErrorL( TInt& aErr )
+// Handle error received from Secure Backup Engine
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::HandleSBEErrorL( TInt& aErr )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1( " aErr: %d", aErr );
+ if( aErr == KErrServerTerminated )
+ {
+ LOGGER_WRITE( "Re-connecting to SBE..." );
+ //Session has been terminated, recreate it..
+ delete iSBEClient;
+ iSBEClient = NULL;
+ iSBEClient = CSBEClient::NewL();
+ }
+ else if ( aErr ) // error
+ {
+ if ( iDataBuffer )
+ {
+ iDataBuffer->Reset();
+ iDataBufferSize = 0;
+ }
+ iLastChunk = EFalse;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::AppendFilesToFilelistL()
+// Appends files from RFileArray to RPointerArray<CSConFile>
+// -----------------------------------------------------------------------------
+//
+void CSConSBEClient::AppendFilesToFilelistL( const RFileArray& aFiles, RPointerArray<CSConFile>& aSconFiles )
+ {
+ TRACE_FUNC_ENTRY;
+ _LIT( KSConXmlDate, "%F%Y%M%DT%H%T%SZ" );
+ for( TInt j = 0; j < aFiles.Count(); j++ )
+ {
+ CSConFile* fileInfo = new (ELeave) CSConFile();
+ CleanupStack::PushL( fileInfo );
+ fileInfo->iPath = aFiles[j].iName;
+ LOGGER_WRITE_1("file: %S", &fileInfo->iPath );
+
+ fileInfo->iSize = aFiles[j].iSize;
+
+ switch( aFiles[j].iAtt )
+ {
+ case KEntryAttNormal :
+ fileInfo->iUserPerm = EPermNormal;
+ break;
+ case KEntryAttReadOnly :
+ fileInfo->iUserPerm = EPermReadOnly;
+ break;
+ default :
+ fileInfo->iUserPerm = EPermNormal;
+ break;
+ }
+
+ TTime time( aFiles[j].iModified );
+ HBufC* timeBuf = HBufC::NewLC( KMaxTimeFormatSpec );
+ TPtr timePtr = timeBuf->Des();
+ time.FormatL( timePtr, KSConXmlDate );
+
+ fileInfo->iModified.Copy( timePtr );
+
+ CleanupStack::PopAndDestroy( timeBuf );
+
+ aSconFiles.Append( fileInfo );
+ CleanupStack::Pop( fileInfo );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::PackageDataSizeL()
+// Gets Package dataowner size
+// -----------------------------------------------------------------------------
+//
+TUint CSConSBEClient::PackageDataSizeL( TUid aPackageId, const TDriveList& aDriveList,
+ TPackageDataType aPackageDataType ) const
+ {
+ TUint dataSize(0);
+ //Ask data size from every drive
+ for( TInt j = 0; j < KMaxDrives; j++ )
+ {
+ if( aDriveList[j] )
+ {
+ CSBPackageTransferType* ptt( NULL );
+ TDriveNumber driveNumber = GetDriveNumber( j );
+ LOGGER_WRITE_1( "Drive %d", driveNumber );
+ ptt = CSBPackageTransferType::NewL( aPackageId, driveNumber, aPackageDataType );
+ CleanupStack::PushL( ptt );
+ //Get the size and store it to a variable
+ TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *ptt ) );
+ CleanupStack::PopAndDestroy( ptt );
+ LOGGER_WRITE_1( "ExpectedDataSizeL returned for package %d", err );
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
+ User::Leave( err );
+ }
+ }
+ }
+ return dataSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::SidDataSizeL()
+// Gets Sid (SecureId) dataowner size
+// -----------------------------------------------------------------------------
+//
+TUint CSConSBEClient::SidDataSizeL( TUid aSid, const TDriveList& aDriveList,
+ TTransferDataType aTransferDataType ) const
+ {
+ TUint dataSize(0);
+ //Ask data size from every drive
+ for( TInt j = 0; j < KMaxDrives; j++ )
+ {
+ if( aDriveList[j] )
+ {
+ CSBSIDTransferType* stt( NULL );
+ TDriveNumber driveNumber = GetDriveNumber( j );
+ LOGGER_WRITE_1( "Drive %d", driveNumber );
+ stt = CSBSIDTransferType::NewL( aSid, driveNumber, aTransferDataType );
+ CleanupStack::PushL( stt );
+ //Get the size and store it to a variable
+ TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *stt ) );
+ CleanupStack::PopAndDestroy( stt );
+ LOGGER_WRITE_1( "ExpectedDataSizeL returned for DO %d", err );
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
+ User::Leave( err );
+ }
+ }
+ }
+ return dataSize;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConSBEClient::JavaDataSizeL()
+// Gets Java dataowner size
+// -----------------------------------------------------------------------------
+//
+TUint CSConSBEClient::JavaDataSizeL( const TDesC& aJavaHash, const TDriveList& aDriveList ) const
+ {
+ TUint dataSize(0);
+ //Ask data size from every drive
+ for( TInt j = 0; j < KMaxDrives; j++ )
+ {
+ if( aDriveList[j] )
+ {
+ CSBJavaTransferType* jtt( NULL );
+
+ TDriveNumber driveNumber = GetDriveNumber( j );
+ LOGGER_WRITE_1( "Drive %d", driveNumber );
+ jtt = CSBJavaTransferType::NewL( aJavaHash,
+ driveNumber,
+ EJavaMIDlet );
+ CleanupStack::PushL( jtt );
+ //Get the size and store it to a variable
+ TRAPD( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) );
+ CleanupStack::PopAndDestroy( jtt );
+ LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDlet) DO %d", err );
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
+ User::Leave( err );
+ }
+
+ jtt = NULL;
+ jtt = CSBJavaTransferType::NewL( aJavaHash,
+ driveNumber,
+ EJavaMIDletData );
+ CleanupStack::PushL( jtt );
+ //Get the size and store it to a variable
+ TRAP( err, dataSize += iSBEClient->ExpectedDataSizeL( *jtt ) );
+ CleanupStack::PopAndDestroy( jtt );
+ LOGGER_WRITE_1( "ExpectedDataSizeL returned for Java(EJavaMIDletData) DO %d", err );
+ if( err != KErrNone && err != KErrNotFound )
+ {
+ LOGGER_WRITE_1( "ExpectedDataSizeL LEAVE %d", err );
+ User::Leave( err );
+ }
+ }
+ }
+
+ return dataSize;
+ }
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconsynchandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1460 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSconSyncHandler implementation
+*
+*/
+
+
+#include "sconsynchandler.h"
+#include <f32file.h>
+#include <S32MEM.H>
+#include <UTF.H>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+#include <bautils.h>
+#include <nsmlconstants.h>
+#include <centralrepository.h>
+
+#include "debug.h"
+
+// versions up to 5 must be backward compatible
+const TUint16 KFormatVersionNumber ( 1 );
+
+_LIT8(KCommandListStores, "SYNC: ListStores");
+_LIT8(KCommandOpenStore, "SYNC: OpenStore: ");
+_LIT8(KCommandCloseStore, "SYNC: CloseStore");
+_LIT8(KCommandListChanges, "SYNC: ListChanges");
+_LIT8(KCommandResetChangeInfo, "SYNC: ResetChangeInfo");
+_LIT8(KCommandCommitChanges, "SYNC: CommitChanges: ");
+_LIT8(KCommandReadItems, "SYNC: ReadItems: ");
+_LIT8(KCommandGetParents, "SYNC: GetParents: ");
+_LIT8(KCommandCreateItems, "SYNC: CreateItems");
+_LIT8(KCommandGetCreateItemsResponse, "SYNC: GetCreateItemsResponse");
+_LIT8(KCommandGetCreateItems, "SYNC: GetCreateItems: ");
+_LIT8(KCommandReplaceItems, "SYNC: ReplaceItems");
+_LIT8(KCommandGetReplaceItemsResponse, "SYNC: GetReplaceItemsResponse");
+_LIT8(KCommandGetReplaceItems, "SYNC: GetReplaceItems: ");
+_LIT8(KCommandMoveItems, "SYNC: MoveItems");
+_LIT8(KCommandDeleteItems, "SYNC: DeleteItems: ");
+_LIT8(KCommandSoftDeleteItems, "SYNC: SoftDeleteItems: ");
+_LIT8(KCommandDeleteAllItems, "SYNC: DeleteAllItems");
+_LIT8(KCommandDeleteAllItemsStatus, "SYNC: GetDeleteAllItemsStatus");
+_LIT8(KCommandGetStoreFormat, "SYNC: GetStoreFormat");
+_LIT8(KCommandSetRemoteStoreFormat, "SYNC: SetRemoteStoreFormat");
+_LIT8(KCommandGetRestOfData, "SYNC: GetRestOfData");
+_LIT8(KCommandCancel, "SYNC: Cancel");
+
+
+_LIT(KRemoteFormatStore, "remoteformatstore_0x%08x.dat");
+_LIT(KDataFileExtension, ".tmp");
+
+const TInt KTimeStampLength = 16;
+_LIT8(KTimeStampFormat, "%02d%02d%04dT%02d%02d%02dZ");
+
+const TInt KDefaultExpandSize = 1024;
+
+// Calendar sync specific constants
+const TInt KCalendarDsUid = 0x101F6DDE;
+
+CSconSyncHandler::~CSconSyncHandler()
+ {
+ TRACE_FUNC_ENTRY;
+ Cancel();
+ iSyncSession.Close();
+ delete iResponseData;
+ iFileStream.Close();
+ iCreatedItems.Close();
+ iReplacedItems.Close();
+ iItemsToRead.Close();
+ iFs.Delete( iFileInProgress );
+ ClearCalendarCenrepL();
+ TRACE_FUNC_EXIT;
+ }
+
+CSconSyncHandler::CSconSyncHandler( RFs& aFs )
+ : CActive( EPriorityStandard ), iFs(aFs), iCreatedItemUidPckg(iCreatedItemUid)
+ {
+ CActiveScheduler::Add( this );
+ }
+
+CSconSyncHandler* CSconSyncHandler::NewL( RFs& aFs)
+ {
+ TRACE_FUNC_ENTRY;
+ CSconSyncHandler* self = new (ELeave) CSconSyncHandler(aFs);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ TRACE_FUNC_EXIT;
+ return self;
+ }
+
+void CSconSyncHandler::ConstructL()
+ {
+ TInt err = iFs.CreatePrivatePath( EDriveC );
+ LOGGER_WRITE_1("CreatePrivatePath err: %d", err);
+ iFs.SetSessionToPrivate( EDriveC );
+ }
+
+void CSconSyncHandler::HandleGetSyncRequestL( const TDesC8& aRequest, RWriteStream& aResult, TInt aMaxObjectSize )
+ {
+ TRACE_FUNC_ENTRY;
+ iMaxObjectSize = aMaxObjectSize;
+ iBytesWrited = 0;
+ LOGGER_WRITE_1("iMaxObjectSize: %d", iMaxObjectSize);
+ if ( !iConnected )
+ {
+ LOGGER_WRITE("Try to connect")
+ User::LeaveIfError( iSyncSession.Connect() );
+ iConnected = ETrue;
+ }
+
+ if ( aRequest.Compare( KCommandListStores ) == KErrNone )
+ {
+ ListStoresL( aResult );
+ }
+ else if ( aRequest.Find( KCommandOpenStore ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandOpenStore().Length() );
+ OpenStoreL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandCloseStore ) == 0 )
+ {
+ CloseStoreL( aResult );
+ }
+ else if ( aRequest.Find( KCommandListChanges ) == 0 )
+ {
+ ListChangesL( aResult );
+ }
+ else if ( aRequest.Find( KCommandResetChangeInfo ) == 0 )
+ {
+ ResetChangeInfoL( aResult );
+ }
+ else if ( aRequest.Find( KCommandCommitChanges ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandCommitChanges().Length() );
+ CommitChangesL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandReadItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandReadItems().Length() );
+ ReadItemsL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandGetParents ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandGetParents().Length() );
+ GetParentsL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandGetRestOfData ) == 0 )
+ {
+ // Get rest of data
+ ReadNextDataBlockL( aResult );
+ }
+ else if ( aRequest.Find( KCommandGetCreateItemsResponse ) == 0 )
+ {
+ GetCreateItemsResponseL( KNullDesC8(), aResult );
+ }
+ else if ( aRequest.Find( KCommandGetCreateItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandGetCreateItems().Length() );
+ GetCreateItemsResponseL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandGetReplaceItemsResponse ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandGetReplaceItemsResponse().Length() );
+ GetReplaceItemsResponseL( KNullDesC8(), aResult );
+ }
+ else if ( aRequest.Find( KCommandGetReplaceItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandGetReplaceItems().Length() );
+ GetReplaceItemsResponseL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandMoveItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandMoveItems().Length() );
+ MoveItemsL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandDeleteItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandDeleteItems().Length() );
+ DeleteItemsL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandSoftDeleteItems ) == 0 )
+ {
+ TPtrC8 params = aRequest.Mid( KCommandSoftDeleteItems().Length() );
+ SoftDeleteItemsL( params, aResult );
+ }
+ else if ( aRequest.Find( KCommandDeleteAllItems ) == 0 )
+ {
+ DeleteAllItemsL( aResult );
+ }
+ else if ( aRequest.Find( KCommandDeleteAllItemsStatus ) == 0 )
+ {
+ GetDeleteAllItemsStatusL( aResult );
+ }
+ else if ( aRequest.Find( KCommandGetStoreFormat ) == 0 )
+ {
+ GetStoreFormatL( aResult );
+ }
+ else if ( aRequest.Find( KCommandCancel ) == 0 )
+ {
+ CancelOperationsL( aResult );
+ }
+ else
+ {
+ LOGGER_WRITE("Unknown command");
+ User::Leave( KErrNotSupported );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconSyncHandler::HandlePutSyncRequestL( const TDesC8& aRequest, RReadStream& aData )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( !iConnected )
+ {
+ LOGGER_WRITE("Try to connect")
+ User::LeaveIfError( iSyncSession.Connect() );
+ iConnected = ETrue;
+ }
+ if ( aRequest.Find( KCommandCreateItems ) == KErrNone )
+ {
+ CreateItemsL( aData );
+ }
+ else if ( aRequest.Find( KCommandReplaceItems ) == 0 )
+ {
+ ReplaceItemsL( aData );
+ }
+ else if ( aRequest.Find( KCommandSetRemoteStoreFormat ) == 0 )
+ {
+ SetRemoteStoreFormatL( aData );
+ }
+ else
+ {
+ LOGGER_WRITE("Unknown command");
+ User::Leave( KErrNotSupported );
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ListStoresL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ RSconDataProviderInfoArray infoArray(5);
+ CleanupResetAndDestroyPushL( infoArray );
+ iSyncSession.ListAllImplementationsL( infoArray );
+ LOGGER_WRITE_1("infoArray.Count(): %d", infoArray.Count());
+ aResult.WriteInt32L( infoArray.Count() );
+ for (TInt i=0; i<infoArray.Count(); i++ )
+ {
+ CSconDataproviderInfo& info = (*infoArray[i]);
+ info.ExternalizeL( aResult );
+ }
+ CleanupStack::PopAndDestroy( &infoArray );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::OpenStoreL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE8_1("Params:'%S'", &aParams);
+
+ const TUint8* ptr = aParams.Ptr();
+ LOGGER_WRITE_1("Params size: %d", aParams.Size())
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ TInt providerId = stream.ReadInt32L();
+ LOGGER_WRITE_1("Provider Id: 0x%08x", providerId);
+ TInt contextId = stream.ReadInt32L();
+ LOGGER_WRITE_1("Context Id: 0x%08x", contextId);
+
+ // read utf8 formatted text
+ TInt len = stream.ReadUint16L();
+
+ LOGGER_WRITE_1("storeName length: %d", len);
+ HBufC8* buf8 = HBufC8::NewLC( len );
+ TPtr8 bufPtr8 = buf8->Des();
+ stream.ReadL( bufPtr8, len );
+
+ LOGGER_WRITE8_1("storeName8: %S", &bufPtr8);
+
+ // and convert it to unicode
+ HBufC* storeName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( bufPtr8 );
+ CleanupStack::PopAndDestroy( buf8 );
+ CleanupStack::PushL( storeName );
+
+ TPtr storeNamePtr = storeName->Des();
+ LOGGER_WRITE_1("storeName: %S", &storeNamePtr);
+
+ if ( providerId == KCalendarDsUid && aParams.Size() >
+ sizeof(TInt32) // providerId
+ + sizeof(TInt32) // contextId
+ + sizeof(TUint16)// storeName len
+ + len ) // storeName
+ {
+ TInt profileId = stream.ReadInt32L();
+ len = stream.ReadUint16L();
+ HBufC8* buffer = HBufC8::NewLC( len );
+ TPtr8 bufferPtr8 = buffer->Des();
+ stream.ReadL( bufferPtr8, len );
+ HBufC* serverId = CnvUtfConverter::ConvertToUnicodeFromUtf8L( bufferPtr8 );
+ CleanupStack::PopAndDestroy( buffer );
+ CleanupStack::PushL( serverId );
+ SetCalendarCenrepL( profileId, serverId->Des() );
+ CleanupStack::PopAndDestroy(serverId);
+ }
+
+ aResult.WriteUint16L( KFormatVersionNumber );
+ TRAPD( err, iSyncSession.OpenDataStoreL( providerId, storeName->Des(), contextId));
+ if ( err == KErrServerTerminated )
+ {
+ // server terminated, try to reconnect
+ iConnected = EFalse;
+ LOGGER_WRITE("Try to re-connect");
+ err = iSyncSession.Connect();
+ LOGGER_WRITE_1("iSyncSession.Connect() err: %d", err);
+ if ( !err )
+ {
+ iConnected = ETrue;
+ TRAP( err, iSyncSession.OpenDataStoreL( providerId, storeName->Des(), contextId));
+ }
+ }
+
+ CleanupStack::PopAndDestroy( storeName );
+ CleanupStack::PopAndDestroy( &stream );
+
+ aResult.WriteInt32L( err );
+
+ if ( err )
+ {
+ LOGGER_WRITE_1("Error: %d", err);
+ LOGGER_WRITE("iSyncSession.CloseDataStore()");
+ iSyncSession.CloseDataStore();
+ ClearCalendarCenrepL();
+ return;
+ }
+ iCurrentDataProviderUid = providerId;
+ iCurrentContextUid = contextId;
+
+
+ // Now the store is opened
+ TRAP(err, LoadRemoteStoreFormatL( contextId, providerId ));
+ if ( err )
+ {
+ aResult.WriteUint8L( 1 ); // Remote store format needed
+ }
+ else
+ {
+ aResult.WriteUint8L( 0 ); // Remote store format not needed
+ }
+
+ // return last sync timestamp, if has synced before.
+ TBool hasHistory = iSyncSession.HasSyncHistoryL();
+ TUint8 historyFlag(0);
+ if ( hasHistory )
+ {
+ historyFlag = 1;
+ }
+ aResult.WriteUint8L( historyFlag );
+
+ if ( hasHistory )
+ {
+ TDateTime timeStamp;
+ TInt err(KErrNone);
+ TRAP(err, iSyncSession.GetSyncTimeStampL( providerId, contextId, timeStamp));
+ LOGGER_WRITE_1("GetSyncTimeStampL err: %d", err);
+
+ TBuf8<KTimeStampLength> timeStampBuf;
+
+ timeStampBuf.Format( KTimeStampFormat,
+ timeStamp.Day()+1,timeStamp.Month()+1, timeStamp.Year(),
+ timeStamp.Hour(), timeStamp.Minute(), timeStamp.Second() );
+ LOGGER_WRITE8_1("timeStamp: %S", &timeStampBuf);
+ aResult.WriteL( timeStampBuf );
+ }
+
+
+ // for testin purposes only
+ /*
+ if (!remoteStoreSetted)
+ {
+ RStringPool pool;
+ pool.OpenL();
+ CleanupClosePushL( pool );
+ CSmlDataStoreFormat* storeFormat(NULL);
+ TRAPD( err, storeFormat = iSyncSession.StoreFormatL( pool ) );
+ CleanupStack::PushL( storeFormat );
+
+ iSyncSession.SetRemoteStoreFormatL( *storeFormat );
+ SaveRemoteStoreFormatL( *storeFormat, contextId, providerId );
+
+ CleanupStack::PopAndDestroy( storeFormat );
+ CleanupStack::PopAndDestroy( &pool );
+ }
+ */
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::LoadRemoteStoreFormatL( TInt aContextId, TInt aProviderId )
+ {
+ TRACE_FUNC_ENTRY;
+ TFileName remoteFormatStore;
+ iFs.SetSessionToPrivate( EDriveC );
+ remoteFormatStore.Format( KRemoteFormatStore, aContextId );
+
+ CDictionaryFileStore* dictionaryStore =
+ CDictionaryFileStore::OpenLC(iFs, remoteFormatStore, TUid::Uid(0x0001));
+ TBool present = dictionaryStore->IsPresentL( TUid::Uid(aProviderId) );
+ if ( !present )
+ {
+ LOGGER_WRITE("Remote store was not saved");
+ User::Leave( KErrNotFound );
+ }
+ else
+ {
+ RDictionaryReadStream stream;
+ stream.OpenLC( *dictionaryStore, TUid::Uid(aProviderId) );
+ RStringPool stringPool;
+ stringPool.OpenL();
+ CleanupClosePushL( stringPool );
+ CSmlDataStoreFormat* storeFormat = CSmlDataStoreFormat::NewLC(stringPool, stream);
+ iSyncSession.SetRemoteStoreFormatL( *storeFormat );
+ CleanupStack::PopAndDestroy( storeFormat );
+ CleanupStack::PopAndDestroy( &stringPool );
+ CleanupStack::PopAndDestroy(); //OpenLC
+ }
+ CleanupStack::PopAndDestroy( dictionaryStore );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::SaveRemoteStoreFormatL( CSmlDataStoreFormat& aStoreFormat, TInt aContextId, TInt aProviderId)
+ {
+ TRACE_FUNC_ENTRY;
+ iFs.SetSessionToPrivate( EDriveC );
+ TFileName remoteFormatStore;
+ remoteFormatStore.Format( KRemoteFormatStore, aContextId );
+ CDictionaryFileStore* dictionaryStore =
+ CDictionaryFileStore::OpenLC(iFs, remoteFormatStore, TUid::Uid(0x0001));
+
+ RDictionaryWriteStream stream;
+ stream.AssignLC( *dictionaryStore, TUid::Uid(aProviderId) );
+
+ aStoreFormat.ExternalizeL( stream );
+ stream.CommitL();
+ CleanupStack::PopAndDestroy(); //AssignLC
+ dictionaryStore->CommitL();
+
+ CleanupStack::PopAndDestroy( dictionaryStore );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::CloseStoreL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ iSyncSession.CloseDataStore();
+ ClearCalendarCenrepL();
+
+ // Get last used timestamp if provider was open
+ if ( iCurrentDataProviderUid != 0 )
+ {
+ TDateTime timeStamp;
+ iSyncSession.GetSyncTimeStampL(iCurrentDataProviderUid, iCurrentContextUid, timeStamp );
+
+ iCurrentDataProviderUid = 0;
+ iCurrentContextUid = 0;
+
+ const TInt KTimeStampLength = 16;
+ TBuf8<KTimeStampLength> timeStampBuf;
+
+
+ timeStampBuf.Format( KTimeStampFormat,
+ timeStamp.Day()+1,timeStamp.Month()+1, timeStamp.Year(),
+ timeStamp.Hour(), timeStamp.Minute(), timeStamp.Second() );
+ aResult.WriteL( timeStampBuf );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ListChangesL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ RArray<TSmlDbItemUid> items;
+ CleanupClosePushL( items );
+
+ iSyncSession.AddedItemsL( items );
+ LOGGER_WRITE_1("Added items count: %d", items.Count());
+ aResult.WriteInt32L( items.Count() );
+ for (TInt i=0; i<items.Count(); i++ )
+ {
+ aResult.WriteInt32L( items[i] );
+ }
+
+ items.Reset();
+ iSyncSession.ModifiedItemsL( items );
+ LOGGER_WRITE_1("Modified items count: %d", items.Count());
+ aResult.WriteInt32L( items.Count() );
+ for (TInt i=0; i<items.Count(); i++ )
+ {
+ aResult.WriteInt32L( items[i] );
+ }
+
+ items.Reset();
+ iSyncSession.MovedItemsL( items );
+ LOGGER_WRITE_1("Moved items count: %d", items.Count());
+ aResult.WriteInt32L( items.Count() );
+ for (TInt i=0; i<items.Count(); i++ )
+ {
+ aResult.WriteInt32L( items[i] );
+ }
+
+ items.Reset();
+ iSyncSession.DeletedItemsL( items );
+ LOGGER_WRITE_1("Deleted items count: %d", items.Count());
+ aResult.WriteInt32L( items.Count() );
+ for (TInt i=0; i<items.Count(); i++ )
+ {
+ aResult.WriteInt32L( items[i] );
+ }
+
+ items.Reset();
+ iSyncSession.SoftDeletedItemsL( items );
+ LOGGER_WRITE_1("SoftDeleted items count: %d", items.Count());
+ aResult.WriteInt32L( items.Count() );
+ for (TInt i=0; i<items.Count(); i++ )
+ {
+ aResult.WriteInt32L( items[i] );
+ }
+ CleanupStack::PopAndDestroy( &items );
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ResetChangeInfoL( RWriteStream& /*aResult*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ iSyncSession.ResetChangeInfoL();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::CommitChangesL( const TDesC8& aParams, RWriteStream& /*aResult*/ )
+ {
+ TRACE_FUNC_ENTRY;
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ TInt itemCount = stream.ReadInt32L();
+ RArray<TSmlDbItemUid> items;
+ CleanupClosePushL( items );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ items.AppendL( stream.ReadInt32L() );
+ }
+
+ if ( items.Count() > 0 )
+ {
+ iSyncSession.CommitChangeInfoL( items );
+ }
+
+ CleanupStack::PopAndDestroy( &items );
+ CleanupStack::PopAndDestroy( &stream );
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ReadItemsL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ iItemsToRead.Reset();
+ LOGGER_WRITE_1("aParams length: %d", aParams.Length());
+
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // Read item uids from parameter
+ TInt itemCount = stream.ReadInt32L();
+ LOGGER_WRITE_1("Item count: %d", itemCount);
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ iItemsToRead.AppendL( stream.ReadInt32L() );
+ LOGGER_WRITE_2("Item[%d] = %d", i, iItemsToRead[i] );
+ }
+ CleanupStack::PopAndDestroy( &stream );
+ LOGGER_WRITE( "Items readed ok" );
+
+ aResult.WriteInt32L( iItemsToRead.Count() );
+ iBytesWrited += sizeof(TInt32);
+
+ ReadNextDataBlockL( aResult );
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::GetParentsL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // Read item uids from parameter
+ TInt itemCount = stream.ReadInt32L();
+ aResult.WriteInt32L( itemCount );
+ LOGGER_WRITE_1("Item count: %d", itemCount);
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ TSmlDbItemUid itemUid = stream.ReadInt32L();
+ TSmlDbItemUid parent(KErrNotFound);
+ aResult.WriteInt32L( itemUid );
+ TInt err = iSyncSession.GetParent( itemUid, parent);
+ LOGGER_WRITE_1("itemUid: %d", itemUid);
+ LOGGER_WRITE_1("err: %d", err);
+ aResult.WriteInt32L( err );
+ if ( err == KErrNone )
+ {
+ LOGGER_WRITE_1("parent: %d", parent);
+ aResult.WriteInt32L( parent );
+ }
+ }
+ CleanupStack::PopAndDestroy( &stream );
+ aResult.CommitL();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ReadNextDataBlockL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( (!iResponseData || iResponseData->Size() == 0 ) && iItemsToRead.Count() == 0 )
+ {
+ // no data
+ LOGGER_WRITE("no more data or items");
+ User::Leave(KErrEof);
+ }
+
+ if ( iResponseData )
+ {
+ // write data from tempbuffer to response buffer
+ TInt writeLength = iResponseData->Size();
+ if ( writeLength > iMaxObjectSize-iBytesWrited )
+ {
+ writeLength = iMaxObjectSize-iBytesWrited;
+ }
+ aResult.WriteL( iResponseData->Ptr(0), writeLength );
+ iBytesWrited += writeLength;
+
+ if ( iResponseData->Size() > writeLength )
+ {
+ iResponseData->Delete(0, writeLength);
+ }
+ else
+ {
+ iResponseData->Reset();
+ }
+ }
+ if ( iBytesWrited == iMaxObjectSize )
+ {
+ // responce buffer is full, return it.
+ LOGGER_WRITE("Stream is full, return it");
+ return;
+ }
+
+ TBool streamIsFull( EFalse );
+ // Read items from server
+ CBufFlat* dataBuffer = CBufFlat::NewL(KDefaultExpandSize);
+ CleanupStack::PushL( dataBuffer );
+ while ( iItemsToRead.Count() > 0 && !streamIsFull )
+ {
+ if ( iMaxObjectSize-iBytesWrited < sizeof(TUint32) )
+ {
+ streamIsFull = ETrue;
+ LOGGER_WRITE("Stream is full, don't read next item");
+ continue;
+ }
+ ReadItemL( iItemsToRead[0], *dataBuffer );
+ aResult.WriteUint32L( dataBuffer->Size() );
+ iBytesWrited += sizeof( TUint32 );
+
+ TInt writeLength = dataBuffer->Size();
+ if ( writeLength > iMaxObjectSize-iBytesWrited )
+ {
+ writeLength = iMaxObjectSize-iBytesWrited;
+ LOGGER_WRITE_1("Write only %d bytes", writeLength);
+ }
+ aResult.WriteL( dataBuffer->Ptr(0), writeLength );
+ iBytesWrited += writeLength;
+
+ if ( dataBuffer->Size() > writeLength )
+ {
+ // write rest to next data block
+ if ( !iResponseData )
+ {
+ iResponseData = CBufFlat::NewL(KDefaultExpandSize);
+ }
+ iResponseData->Reset();
+ LOGGER_WRITE_1("Save %d bytes for next request", dataBuffer->Size() - writeLength);
+ iResponseData->ResizeL( dataBuffer->Size() - writeLength );
+ iResponseData->Write(0, dataBuffer->Ptr( writeLength ));
+ streamIsFull = ETrue;
+ }
+
+ iItemsToRead.Remove(0);
+
+ if ( iBytesWrited == iMaxObjectSize )
+ {
+ // writestream is full
+ LOGGER_WRITE("Stream is full");
+ streamIsFull = ETrue;
+ }
+
+ }
+ aResult.CommitL();
+
+ CleanupStack::PopAndDestroy( dataBuffer );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ReadItemL( TSmlDbItemUid aUid, CBufFlat& aItemData )
+ {
+ TRACE_FUNC_ENTRY;
+ aItemData.Reset();
+ CBufFlat* dataBuffer = CBufFlat::NewL(KDefaultExpandSize);
+ CleanupStack::PushL( dataBuffer );
+ TSmlDbItemUid parent(-1);
+ TBool fieldChange(EFalse);
+
+ TBuf8<256> mimeType;
+ TBuf8<100> mimeVer;
+ TRAPD( err, iSyncSession.OpenItemL( aUid, fieldChange,
+ parent, mimeType, mimeVer, *dataBuffer ));
+ if ( err )
+ {
+ LOGGER_WRITE_1("Could not read item %d", aUid);
+ // only item uid and errorcode will be writed
+ aItemData.ResizeL(
+ sizeof(TInt32) +
+ sizeof(TInt32));
+
+ }
+ else
+ {
+ // reserve memory for all fields
+ aItemData.ResizeL(
+ sizeof(TInt32) +
+ sizeof(TInt32) +
+ sizeof(TUint8) +
+ sizeof(TInt32) +
+ sizeof(TUint16) +
+ mimeType.Length() +
+ sizeof(TUint16) +
+ mimeVer.Length() +
+ sizeof(TInt32) +
+ dataBuffer->Size()
+ );
+ }
+
+ RBufWriteStream tempStream( aItemData );
+ CleanupClosePushL( tempStream );
+ tempStream.WriteInt32L( aUid );
+ tempStream.WriteInt32L( err );
+ if ( !err )
+ {
+ tempStream.WriteUint8L( fieldChange );
+ tempStream.WriteInt32L( parent );
+ tempStream.WriteUint16L( mimeType.Length() );
+ tempStream.WriteL( mimeType );
+ tempStream.WriteUint16L( mimeVer.Length() );
+ tempStream.WriteL( mimeVer );
+ tempStream.WriteInt32L( dataBuffer->Size() );
+ tempStream.WriteL( dataBuffer->Ptr(0), dataBuffer->Size() );
+ }
+ tempStream.CommitL();
+ CleanupStack::PopAndDestroy( &tempStream );
+ CleanupStack::PopAndDestroy( dataBuffer );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::CreateItemsL( RReadStream& aData )
+ {
+ TRACE_FUNC_ENTRY;
+ delete iResponseData;
+ iResponseData = NULL;
+ iResponseData = CBufFlat::NewL(KDefaultExpandSize);
+ RBufWriteStream responseStream( *iResponseData );
+ CleanupClosePushL( responseStream );
+ // Read item uids from parameter
+ TInt itemCount = aData.ReadInt32L();
+ LOGGER_WRITE_1("itemCount: %d", itemCount);
+ responseStream.WriteInt32L( itemCount );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ LOGGER_WRITE("read from aData stream");
+ TInt tempUid = aData.ReadInt32L();
+
+ TSmlDbItemUid parent = aData.ReadInt32L();
+
+ TInt len = aData.ReadUint16L();
+ HBufC8* mimeTypeBuf = HBufC8::NewLC( len );
+ TPtr8 mimeTypePtr = mimeTypeBuf->Des();
+ aData.ReadL(mimeTypePtr, len);
+
+ len = aData.ReadUint16L();
+ HBufC8* mimeVerBuf = HBufC8::NewLC( len );
+ TPtr8 mimeVerPtr = mimeVerBuf->Des();
+ aData.ReadL(mimeVerPtr, len);
+
+ len = aData.ReadInt32L();
+ HBufC8* dataBuf = HBufC8::NewLC( len );
+ TPtr8 dataPtr = dataBuf->Des();
+ aData.ReadL( dataPtr, len );
+
+ TSmlDbItemUid newUid(-1);
+ LOGGER_WRITE("read from aData stream -readed ok");
+ TRAPD( err, iSyncSession.CreateItemL(newUid,
+ parent, mimeTypePtr,
+ mimeVerPtr, dataPtr));
+
+ CleanupStack::PopAndDestroy( dataBuf );
+ CleanupStack::PopAndDestroy( mimeVerBuf );
+ CleanupStack::PopAndDestroy( mimeTypeBuf );
+ LOGGER_WRITE("Write to responseStream");
+ responseStream.WriteInt32L( tempUid );
+ responseStream.WriteInt32L( err );
+ if ( !err )
+ {
+ responseStream.WriteInt32L( newUid );
+ }
+ LOGGER_WRITE("Write to responseStream -writed ok");
+ }
+
+ responseStream.CommitL();
+ CleanupStack::PopAndDestroy( &responseStream );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::GetCreateItemsResponseL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aParams.Length() > 0 )
+ {
+ LOGGER_WRITE_1("params length: %d", aParams.Length());
+
+ //LOGGER_WRITE8_1("aParams: %S", &aParams);
+ if ( iSyncStatus == EReady )
+ {
+ LOGGER_WRITE("Start creating items from file");
+ iCreatedItems.Reset();
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+ TInt filenameLength = stream.ReadInt32L();
+ LOGGER_WRITE_1("filename length: %d", filenameLength );
+ HBufC8* filenameBuf8 = HBufC8::NewLC( /*stream,*/ filenameLength ); // filename
+ TPtr8 filenamePtr = filenameBuf8->Des();
+ stream.ReadL( filenamePtr, filenameLength);
+ LOGGER_WRITE("filename ok");
+ TInt err = CnvUtfConverter::ConvertToUnicodeFromUtf8(iFileInProgress, filenamePtr );
+ LOGGER_WRITE_1("ConvertToUnicodeFromUtf8 err: %d", err);
+ User::LeaveIfError( err );
+ LOGGER_WRITE_1("iFileInProgress: %S", &iFileInProgress);
+
+ if ( iFileInProgress.RightTPtr(KDataFileExtension().Length()).CompareF(KDataFileExtension) != 0 )
+ {
+ iFileInProgress = KNullDesC();
+ LOGGER_WRITE("File extendion was not correct");
+ User::Leave( KErrAccessDenied );
+ }
+
+ CleanupStack::PopAndDestroy( filenameBuf8 );
+
+ LOGGER_WRITE("open file");
+ err = iFileStream.Open(iFs,iFileInProgress, EFileShareReadersOnly);
+ LOGGER_WRITE_1("iFileStream.Open err: %d", err);
+ User::LeaveIfError( err );
+
+ CleanupStack::PopAndDestroy( &stream );
+
+ iSyncStatus = ECreatingItemsFromFile;
+ iItemsLeftInStream = iFileStream.ReadInt32L();
+ LOGGER_WRITE_1("iItemsLeftInStream: %d", iItemsLeftInStream);
+ aResult.WriteInt32L( iItemsLeftInStream );
+ aResult.WriteInt32L( 0 ); // completed items since last sync
+ CreateNextItemOnStreamL();
+ iItemsLeftInStream--;
+ }
+ else if ( iSyncStatus == ECreatingItemsFromFile || iSyncStatus == EItemsCreated )
+ {
+ LOGGER_WRITE("Read status");
+ TInt temp = 0;
+ if ( iSyncStatus == ECreatingItemsFromFile )
+ {
+ // one item is on progress, add it to to "left" items.
+ temp = 1;
+ }
+ LOGGER_WRITE_1("left items: %d", iItemsLeftInStream + temp);
+ LOGGER_WRITE_1("completed items: %d", iCreatedItems.Count());
+ aResult.WriteInt32L( iItemsLeftInStream + temp ); // items in progress
+ aResult.WriteInt32L( iCreatedItems.Count() ); // completed items since last get
+
+ while ( iCreatedItems.Count() > 0 )
+ {
+ aResult.WriteInt32L( iCreatedItems[0].iTemporaryId );
+ aResult.WriteInt32L( iCreatedItems[0].iErrorCode );
+ if ( !iCreatedItems[0].iErrorCode )
+ {
+ aResult.WriteInt32L( iCreatedItems[0].iNewUid );
+ }
+ iCreatedItems.Remove(0);
+ }
+ if ( iSyncStatus == EItemsCreated )
+ {
+ // all done
+ iSyncStatus = EReady;
+ LOGGER_WRITE("iSyncStatus = EReady");
+ }
+ }
+ else
+ {
+ LOGGER_WRITE_1("Wrong sync status: %d", iSyncStatus);
+ User::Leave( KErrInUse );
+ }
+ }
+ else
+ {
+ LOGGER_WRITE("Read response");
+ if ( !iResponseData )
+ {
+ User::Leave( KErrNotReady );
+ }
+ aResult.WriteL( iResponseData->Ptr(0), iResponseData->Size() );
+ delete iResponseData;
+ iResponseData = NULL;
+ }
+ aResult.CommitL();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ReplaceItemsL( RReadStream& aData )
+ {
+ TRACE_FUNC_ENTRY;
+ delete iResponseData;
+ iResponseData = NULL;
+ iResponseData = CBufFlat::NewL(KDefaultExpandSize);
+ RBufWriteStream responseStream( *iResponseData );
+ CleanupClosePushL( responseStream );
+ // Read item uids from parameter
+ TInt itemCount = aData.ReadInt32L();
+
+ responseStream.WriteInt32L( itemCount );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ TSmlDbItemUid uid = aData.ReadInt32L();
+ TSmlDbItemUid parent = aData.ReadInt32L();
+ TBool fieldChange = aData.ReadUint8L();
+ TInt len = aData.ReadInt32L();
+ HBufC8* dataBuf = HBufC8::NewLC( len );
+ TPtr8 dataPtr = dataBuf->Des();
+ aData.ReadL( dataPtr, len );
+
+ TRAPD( err, iSyncSession.ReplaceItemL(uid,
+ parent,
+ fieldChange, dataPtr));
+ CleanupStack::PopAndDestroy( dataBuf );
+
+ responseStream.WriteInt32L( uid );
+ responseStream.WriteInt32L( err );
+ }
+ responseStream.CommitL();
+ CleanupStack::PopAndDestroy( &responseStream );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::GetReplaceItemsResponseL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( aParams.Length() > 0 )
+ {
+ LOGGER_WRITE8_1("aParams: %S", &aParams);
+ if ( iSyncStatus == EReady )
+ {
+ LOGGER_WRITE("Start replacing items from file");
+ iReplacedItems.Reset();
+
+ // create parameter stream reader
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // read filename
+ TInt filenameLength = stream.ReadInt32L();
+ LOGGER_WRITE_1("filename length: %d", filenameLength );
+ HBufC8* filenameBuf8 = HBufC8::NewLC( filenameLength ); // filename
+ TPtr8 filenamePtr = filenameBuf8->Des();
+ stream.ReadL( filenamePtr, filenameLength);
+ LOGGER_WRITE("filename ok");
+
+ TInt err = CnvUtfConverter::ConvertToUnicodeFromUtf8(iFileInProgress, filenameBuf8->Des() );
+ LOGGER_WRITE_1("ConvertToUnicodeFromUtf8 err: %d", err);
+ User::LeaveIfError( err );
+ if ( iFileInProgress.RightTPtr(KDataFileExtension().Length()).CompareF(KDataFileExtension) != 0 )
+ {
+ iFileInProgress = KNullDesC();
+ LOGGER_WRITE("File extendion was not correct");
+ User::Leave( KErrAccessDenied );
+ }
+
+ // open file
+ err = iFileStream.Open(iFs, iFileInProgress, EFileShareReadersOnly);
+ LOGGER_WRITE_1("iFileStream.Open err: %d", err);
+ User::LeaveIfError( err );
+
+ CleanupStack::PopAndDestroy( filenameBuf8 );
+ CleanupStack::PopAndDestroy( &stream );
+
+ iSyncStatus = EReplacingItemsFromFile;
+ iItemsLeftInStream = iFileStream.ReadInt32L();
+ LOGGER_WRITE_1("iItemsLeftInStream: %d", iItemsLeftInStream);
+ // write results to return stream
+ aResult.WriteInt32L( iItemsLeftInStream );
+ aResult.WriteInt32L( 0 ); // completed items since last sync
+ ReplaceNextItemOnStreamL();
+ iItemsLeftInStream--;
+ }
+ else if ( iSyncStatus == EReplacingItemsFromFile || iSyncStatus == EItemsReplaced )
+ {
+ LOGGER_WRITE("Read status");
+ TInt temp = 0;
+ if ( iSyncStatus == EReplacingItemsFromFile )
+ {
+ // one item is on progress, add it to to "left" items.
+ temp = 1;
+ }
+ LOGGER_WRITE_1("left items: %d", iItemsLeftInStream + temp);
+ LOGGER_WRITE_1("completed items: %d", iReplacedItems.Count());
+ aResult.WriteInt32L( iItemsLeftInStream + temp ); // items in progress
+ aResult.WriteInt32L( iReplacedItems.Count() ); // completed items since last get
+ //for (TInt i=0; i<iCreatedItems.Count(); i++)
+ while ( iReplacedItems.Count() > 0 )
+ {
+ aResult.WriteInt32L( iReplacedItems[0].iItemUid );
+ aResult.WriteInt32L( iReplacedItems[0].iErrorCode );
+ iReplacedItems.Remove(0);
+ }
+ if ( iSyncStatus == EItemsReplaced )
+ {
+ // all done
+ iSyncStatus = EReady;
+ LOGGER_WRITE("iSyncStatus = EReady");
+ }
+ }
+ }
+ else
+ {
+ if ( !iResponseData )
+ {
+ LOGGER_WRITE("No response data, leave KErrNotReady");
+ User::Leave( KErrNotReady );
+ }
+ aResult.WriteL( iResponseData->Ptr(0), iResponseData->Size() );
+ aResult.CommitL();
+ delete iResponseData;
+ iResponseData = NULL;
+ }
+ aResult.CommitL();
+
+
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::MoveItemsL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // Read item uids from parameter
+ TInt itemCount = stream.ReadInt32L();
+ aResult.WriteInt32L( itemCount );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ TSmlDbItemUid uid = stream.ReadInt32L();
+ TSmlDbItemUid newParent = stream.ReadInt32L();
+ TRAPD( err, iSyncSession.MoveItemL( uid,newParent ));
+
+ aResult.WriteInt32L( uid );
+ aResult.WriteInt32L( err );
+ }
+ aResult.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::DeleteItemsL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // Read item uids from parameter
+ TInt itemCount = stream.ReadInt32L();
+ aResult.WriteInt32L( itemCount );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ TSmlDbItemUid uid = stream.ReadInt32L();
+
+ TRAPD( err, iSyncSession.DeleteItemL( uid ));
+
+ aResult.WriteInt32L( uid );
+ aResult.WriteInt32L( err );
+ }
+ aResult.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::SoftDeleteItemsL( const TDesC8& aParams, RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ const TUint8* ptr = aParams.Ptr();
+ RMemReadStream stream( ptr , aParams.Size() );
+ CleanupClosePushL( stream );
+
+ // Read item uids from parameter
+ TInt itemCount = stream.ReadInt32L();
+ aResult.WriteInt32L( itemCount );
+ for ( TInt i=0; i<itemCount; i++ )
+ {
+ TSmlDbItemUid uid = stream.ReadInt32L();
+
+ TRAPD( err, iSyncSession.SoftDeleteItemL( uid ));
+
+ aResult.WriteInt32L( uid );
+ aResult.WriteInt32L( err );
+ }
+ aResult.CommitL();
+ CleanupStack::PopAndDestroy( &stream );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::DeleteAllItemsL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( IsActive() )
+ {
+ LOGGER_WRITE("Warning: Was on active state!");
+ Cancel();
+ }
+ SetActive();
+ iStatus = KRequestPending;
+ iSyncStatus = EDeletingAllItems;
+ iSyncSession.DeleteAllItems( iStatus );
+ aResult.WriteInt32L( KErrNone );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::GetDeleteAllItemsStatusL( RWriteStream& aResult )
+ {
+ if ( iSyncStatus == EDeletingAllItems )
+ {
+ LOGGER_WRITE("CSconSyncHandler::GetDeleteAllItemsStatusL - In progress");
+ aResult.WriteInt8L( 1 ); // 1 = in progress
+ }
+ else
+ {
+ LOGGER_WRITE("CSconSyncHandler::GetDeleteAllItemsStatusL - Ready");
+ aResult.WriteInt8L( 0 ); // 0 = ready
+ aResult.WriteInt32L( iStatus.Int() );
+ }
+ }
+
+void CSconSyncHandler::GetStoreFormatL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ RStringPool pool;
+ pool.OpenL();
+ CleanupClosePushL( pool );
+ CSmlDataStoreFormat* storeFormat(NULL);
+ TRAPD( err, storeFormat = iSyncSession.StoreFormatL( pool ) );
+ CleanupStack::PushL( storeFormat );
+ aResult.WriteInt32L( err );
+ if ( !err )
+ {
+ storeFormat->ExternalizeL( aResult );
+ }
+ CleanupStack::PopAndDestroy( storeFormat );
+ CleanupStack::PopAndDestroy( &pool );
+ TRACE_FUNC_EXIT;
+ }
+
+
+void CSconSyncHandler::SetRemoteStoreFormatL( RReadStream& aData )
+ {
+ TRACE_FUNC_ENTRY;
+ RStringPool pool;
+ pool.OpenL();
+ CleanupClosePushL( pool );
+ CSmlDataStoreFormat* serverDataStoreFormat = CSmlDataStoreFormat::NewLC( pool, aData );
+ iSyncSession.SetRemoteStoreFormatL( *serverDataStoreFormat );
+ // Save format for later use
+ TRAPD(err, SaveRemoteStoreFormatL( *serverDataStoreFormat, iCurrentContextUid, iCurrentDataProviderUid ));
+ if ( err )
+ {
+ LOGGER_WRITE_1("SaveRemoteStoreFormatL err: %d", err);
+ }
+ CleanupStack::PopAndDestroy( serverDataStoreFormat );
+ CleanupStack::PopAndDestroy( &pool );
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::CreateNextItemOnStreamL()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( IsActive() )
+ {
+ LOGGER_WRITE("Warning: Was on active state!");
+ Cancel();
+ }
+ iTemporaryItemUid = iFileStream.ReadInt32L();
+ TSmlDbItemUid parent = iFileStream.ReadInt32L();
+
+ TInt len = iFileStream.ReadUint16L();
+ HBufC8* mimeTypeBuf = HBufC8::NewLC( len );
+ TPtr8 mimeTypePtr = mimeTypeBuf->Des();
+ iFileStream.ReadL(mimeTypePtr, len);
+
+ len = iFileStream.ReadUint16L();
+ HBufC8* mimeVerBuf = HBufC8::NewLC( len );
+ TPtr8 mimeVerPtr = mimeVerBuf->Des();
+ iFileStream.ReadL(mimeVerPtr, len);
+
+ len = iFileStream.ReadInt32L();
+ HBufC8* dataBuf = HBufC8::NewLC( len );
+ TPtr8 dataPtr = dataBuf->Des();
+ iFileStream.ReadL( dataPtr, len );
+
+ SetActive();
+ iStatus = KRequestPending;
+ iSyncSession.CreateItemL(iCreatedItemUidPckg,
+ parent, mimeTypePtr,
+ mimeVerPtr, dataPtr, iStatus);
+
+ CleanupStack::PopAndDestroy( dataBuf );
+ CleanupStack::PopAndDestroy( mimeVerBuf );
+ CleanupStack::PopAndDestroy( mimeTypeBuf );
+
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::ReplaceNextItemOnStreamL()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( IsActive() )
+ {
+ LOGGER_WRITE("Warning: Was on active state!");
+ Cancel();
+ }
+ TSmlDbItemUid uid = iFileStream.ReadInt32L();
+ TSmlDbItemUid parent = iFileStream.ReadInt32L();
+ TBool fieldChange = iFileStream.ReadUint8L();
+ TInt len = iFileStream.ReadInt32L();
+ HBufC8* dataBuf = HBufC8::NewLC( len );
+ TPtr8 dataPtr = dataBuf->Des();
+ iFileStream.ReadL( dataPtr, len );
+
+ iReplacedItem.iItemUid = uid;
+
+ SetActive();
+ iStatus = KRequestPending;
+
+ iSyncSession.ReplaceItemL(uid,
+ parent,
+ fieldChange, dataPtr, iStatus);
+
+ CleanupStack::PopAndDestroy( dataBuf );
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::CancelOperationsL( RWriteStream& aResult )
+ {
+ TRACE_FUNC_ENTRY;
+ Cancel();
+ // all done
+ iFileStream.Close();
+ iTemporaryItemUid = -1;
+ iCreatedItemUid = -1;
+ iSyncStatus = EItemsCreated;
+ iFs.Delete( iFileInProgress );
+ iFileInProgress = KNullDesC();
+ iItemsLeftInStream = 0;
+ _LIT8(KDummyParam, "Cancel");
+ if ( iSyncStatus == EItemsCreated )
+ {
+ GetCreateItemsResponseL( KDummyParam, aResult );
+ }
+ else if ( iSyncStatus == EItemsReplaced )
+ {
+ GetReplaceItemsResponseL( KDummyParam, aResult );
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::DoCancel()
+ {
+ TRACE_FUNC_ENTRY;
+ iSyncSession.CancelRequest();
+ Reset();
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::RunL()
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("iSyncStatus: %d", iSyncStatus);
+ LOGGER_WRITE_1("iStatus: %d", iStatus.Int());
+ if ( iSyncStatus == ECreatingItemsFromFile )
+ {
+ LOGGER_WRITE_1("iTemporaryItemUid: %d", iTemporaryItemUid);
+ LOGGER_WRITE_1("iCreatedItemUid: %d", iCreatedItemUid);
+ TCreatedItem item;
+ item.iTemporaryId = iTemporaryItemUid;
+ item.iErrorCode = iStatus.Int();
+ item.iNewUid = iCreatedItemUid;
+ iCreatedItems.Append( item );
+ if ( iItemsLeftInStream > 0 )
+ {
+ CreateNextItemOnStreamL();
+ iItemsLeftInStream--;
+ LOGGER_WRITE_1("iItemsLeftInStream: %d", iItemsLeftInStream);
+ }
+ else
+ {
+ // all done
+ LOGGER_WRITE("All items added.");
+ iFileStream.Close();
+ iTemporaryItemUid = -1;
+ iCreatedItemUid = -1;
+ iSyncStatus = EItemsCreated;
+ TInt err = iFs.Delete( iFileInProgress );
+ LOGGER_WRITE_2("iFs.Delete( '%S' ) ret: %d", &iFileInProgress, err);
+ iFileInProgress = KNullDesC();
+ }
+ }
+ else if ( iSyncStatus == EReplacingItemsFromFile )
+ {
+ iReplacedItem.iErrorCode = iStatus.Int();
+ iReplacedItems.Append( iReplacedItem );
+ if ( iItemsLeftInStream > 0 )
+ {
+ ReplaceNextItemOnStreamL();
+ iItemsLeftInStream--;
+ LOGGER_WRITE_1("iItemsLeftInStream: %d", iItemsLeftInStream);
+ }
+ else
+ {
+ // all done
+ LOGGER_WRITE("All items replaced.");
+ iFileStream.Close();
+ iSyncStatus = EItemsReplaced;
+ TInt err = iFs.Delete( iFileInProgress );
+ LOGGER_WRITE_2("iFs.Delete( '%S' ) ret: %d", &iFileInProgress, err);
+ iFileInProgress = KNullDesC();
+ }
+ }
+ else if ( iSyncStatus == EDeletingAllItems )
+ {
+ iSyncStatus = EReady;
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+TInt CSconSyncHandler::RunError( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ LOGGER_WRITE_1("aError: %d", aError);
+ LOGGER_WRITE_1("iSyncStatus: %d", iSyncStatus);
+ TInt err( aError );
+ if ( iSyncStatus == ECreatingItemsFromFile )
+ {
+ iSyncStatus = EItemsCreated;
+ iItemsLeftInStream = 0;
+ iFileStream.Close();
+ err = iFs.Delete( iFileInProgress );
+ LOGGER_WRITE_2("iFs.Delete( '%S' ) ret: %d", &iFileInProgress, err);
+ iFileInProgress = KNullDesC();
+ err = KErrNone;
+ }
+ else if ( iSyncStatus == EReplacingItemsFromFile )
+ {
+ iSyncStatus = EItemsReplaced;
+ iItemsLeftInStream = 0;
+ iFileStream.Close();
+ err = iFs.Delete( iFileInProgress );
+ LOGGER_WRITE_2("iFs.Delete( '%S' ) ret: %d", &iFileInProgress, err);
+ iFileInProgress = KNullDesC();
+ err = KErrNone;
+ }
+ else if ( iSyncStatus == EDeletingAllItems )
+ {
+ iSyncStatus = EReady;
+ }
+
+ TRACE_FUNC_EXIT;
+ return err;
+ }
+
+void CSconSyncHandler::Reset()
+ {
+ TRACE_FUNC_ENTRY;
+ iFileStream.Close();
+ TInt err = iFs.Delete( iFileInProgress );
+ LOGGER_WRITE_2("iFs.Delete( '%S' ) ret: %d", &iFileInProgress, err);
+ iFileInProgress = KNullDesC();
+ iSyncStatus = EReady;
+ TRACE_FUNC_EXIT;
+ }
+
+void CSconSyncHandler::SetCalendarCenrepL( TInt aProfileId, const TDesC& aServerId )
+ {
+ LOGGER_WRITE(" Write cenrep values");
+ CRepository* rep = CRepository::NewLC(KNsmlDsSessionInfoKey);
+ User::LeaveIfError( rep->Set(EDSSessionProfileId, aProfileId) );
+ User::LeaveIfError( rep->Set(EDSSessionProfileName, KNullDesC) );
+ User::LeaveIfError( rep->Set(EDSSessionServerId, aServerId) );
+ CleanupStack::PopAndDestroy(rep);
+ iCalendarCenrepUsed = ETrue;
+ }
+
+void CSconSyncHandler::ClearCalendarCenrepL()
+ {
+ if ( iCalendarCenrepUsed )
+ {
+ LOGGER_WRITE("Calendar sync, clear cenrep values");
+
+ CRepository* rep = CRepository::NewLC(KNsmlDsSessionInfoKey);
+ rep->Set(EDSSessionProfileId, KErrNotFound);
+ rep->Set(EDSSessionProfileName, KNullDesC);
+ rep->Set(EDSSessionServerId, KNullDesC);
+ CleanupStack::PopAndDestroy(rep);
+ iCalendarCenrepUsed = EFalse;
+ }
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,568 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CSConVideoParser implementation
+*
+*/
+
+
+#include <coedef.h>
+#include <bautils.h>
+#include <imageconversion.h>
+#include "sconvideoparser.h"
+#include "debug.h"
+
+_LIT( KMimeType, "MimeType" );
+_LIT8( KImageEncoderMimeType, "image/jpeg" );
+_LIT( KMimeTypeAudio, "audio/*" );
+_LIT( KMimeTypeVideo, "video/*" );
+
+const TInt KRequestTimeOut( 20000000 ); // 20 sec.
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::CSConVideoParser()
+// -----------------------------------------------------------------------------
+//
+CSConVideoParser::CSConVideoParser()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::~CSConVideoParser()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSConVideoParser::~CSConVideoParser()
+ {
+ TRACE_FUNC_ENTRY;
+ delete iTimeOut;
+ if ( iVideoClip )
+ {
+ iVideoClip->CancelThumb();
+ }
+ delete iVideoClip;
+
+ if ( iVideoUtil )
+ {
+ iVideoUtil->Close();
+ }
+ delete iVideoUtil;
+
+ if ( iWindow )
+ {
+ iWindow->Close();
+ }
+ delete iWindow;
+ iRootWindow.Close();
+ delete iScreen;
+ iWsSession.Close();
+
+ delete iThumbnail;
+ delete iVideoMimeType;
+ delete iAudioMimeType;
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::NewLC()
+// -----------------------------------------------------------------------------
+//
+CSConVideoParser* CSConVideoParser::NewLC()
+ {
+ CSConVideoParser* self = new (ELeave)CSConVideoParser();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::ConstructL()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::ConstructL()
+ {
+ TRACE_FUNC_ENTRY;
+
+ User::LeaveIfError( iWsSession.Connect() );
+
+ iScreen = new(ELeave) CWsScreenDevice( iWsSession );
+ User::LeaveIfError( iScreen->Construct() );
+
+ iRootWindow = RWindowGroup(iWsSession);
+ User::LeaveIfError( iRootWindow.Construct(reinterpret_cast<TUint32>(&iWsSession), EFalse) );
+
+ iWindow = new(ELeave) RWindow( iWsSession );
+ User::LeaveIfError( iWindow->Construct(iRootWindow, reinterpret_cast<TUint32>(&iRootWindow) + 1) );
+
+ TRect temp(0,0,320,240); // dummy parameter
+ iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *iScreen, *iWindow, temp, temp);
+
+ iTimeOut = CSconTimeOut::NewL( *this );
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::OpenFileL( const RFs& aFs, const TDesC& aFileName )
+// Opens video file
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::OpenFileL( const RFs& aFs, const TDesC& aFileName )
+ {
+ TRACE_FUNC_ENTRY;
+
+ iVideoUtilReady = EFalse;
+ iVideoClipReady = EFalse;
+ iVideoUtilErr = KErrNone;
+ iVideoClipErr = KErrNone;
+
+ delete iThumbnail;
+ iThumbnail = NULL;
+ delete iVideoMimeType;
+ iVideoMimeType=NULL;
+ delete iAudioMimeType;
+ iAudioMimeType=NULL;
+
+ if ( iVideoClip )
+ {
+ iVideoClip->CancelThumb();
+ delete iVideoClip;
+ iVideoClip = NULL;
+ }
+ if ( iVideoUtil )
+ {
+ iVideoUtil->Close();
+ }
+
+ TBool fileExist = BaflUtils::FileExists( aFs, aFileName );
+ if ( !fileExist )
+ {
+ User::Leave( KErrNotFound );
+ }
+ iAsyncStopCalled = EFalse;
+ iVideoClip = CTNEVideoClipInfo::NewL( aFileName, *this );
+
+ iVideoUtil->OpenFileL( aFileName );
+
+ LOGGER_WRITE("Start timeout");
+ iTimeOut->Start( KRequestTimeOut );
+
+ LOGGER_WRITE("iWait.Start()");
+ iWait.Start();
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::Thumbnail()
+// returns video thumbnail in jpg format
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CSConVideoParser::Thumbnail() const
+ {
+ TRACE_FUNC;
+ if ( !iThumbnail )
+ {
+ return KNullDesC8;
+ }
+ return *iThumbnail;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::VideoFrameRateL()
+// returns video frame rate
+// -----------------------------------------------------------------------------
+//
+TReal32 CSConVideoParser::VideoFrameRateL() const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->VideoFrameRateL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::VideoFrameSizeL()
+// returns video frame size
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::VideoFrameSizeL(TSize& aSize) const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->VideoFrameSizeL( aSize );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::VideoFormatMimeTypeL()
+// returns video format
+// -----------------------------------------------------------------------------
+//
+const TDesC8& CSConVideoParser::VideoFormatMimeTypeL() const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->VideoFormatMimeType();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::VideoBitRateL()
+// returns videostream bitrate
+// -----------------------------------------------------------------------------
+//
+TInt CSConVideoParser::VideoBitRateL() const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->VideoBitRateL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::AudioBitRateL()
+// returns audiostream bitrate
+// -----------------------------------------------------------------------------
+//
+TInt CSConVideoParser::AudioBitRateL() const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->AudioBitRateL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::DurationL()
+// returns video duration in milliseconds
+// -----------------------------------------------------------------------------
+//
+TInt CSConVideoParser::DurationL() const
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ return iVideoUtil->DurationL().Int64()/1000;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::VideoMimeTypeL()
+// returns video mime type
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSConVideoParser::VideoMimeTypeL()
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ delete iVideoMimeType;
+ iVideoMimeType = NULL;
+
+ TInt metadataEntries = iVideoUtil->NumberOfMetaDataEntriesL();
+ LOGGER_WRITE_1( "metadataEntries: %d", metadataEntries);
+
+ for (TInt i=0; i < metadataEntries ; i++)
+ {
+ CMMFMetaDataEntry* entry = iVideoUtil->MetaDataEntryL(i);
+ CleanupStack::PushL( entry );
+ if ( entry->Name().Compare( KMimeType ) == 0 )
+ {
+ if ( entry->Value().MatchF( KMimeTypeVideo ) == 0 )
+ {
+ LOGGER_WRITE_1( "video mimetype found: %S", &entry->Value());
+ iVideoMimeType = HBufC::NewL(entry->Value().Length());
+ TPtr videoMimeTypePtr = iVideoMimeType->Des();
+ videoMimeTypePtr.Copy( entry->Value() );
+ CleanupStack::PopAndDestroy( entry );
+ return *iVideoMimeType;
+ }
+ }
+ CleanupStack::PopAndDestroy( entry );
+ }
+ return KNullDesC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::AudioMimeTypeL()
+// returns audio mime type
+// -----------------------------------------------------------------------------
+//
+const TDesC& CSConVideoParser::AudioMimeTypeL()
+ {
+ TRACE_FUNC;
+ if ( !iVideoUtil )
+ {
+ User::Leave( KErrNotReady );
+ }
+ delete iAudioMimeType;
+ iAudioMimeType = NULL;
+ TInt metadataEntries = iVideoUtil->NumberOfMetaDataEntriesL();
+ LOGGER_WRITE_1( "metadataEntries: %d", metadataEntries);
+
+ for (TInt i=0; i < metadataEntries ; i++)
+ {
+ CMMFMetaDataEntry* entry = iVideoUtil->MetaDataEntryL(i);
+ CleanupStack::PushL( entry );
+
+ if ( entry->Name().Compare( KMimeType ) == 0 )
+ {
+ if ( entry->Value().MatchF( KMimeTypeAudio ) == 0 )
+ {
+ LOGGER_WRITE_1( "video mimetype found: %S", &entry->Value());
+ iAudioMimeType = HBufC::NewL(entry->Value().Length());
+ TPtr audioMimeTypePtr = iAudioMimeType->Des();
+ audioMimeTypePtr.Copy( entry->Value() );
+ CleanupStack::PopAndDestroy( entry );
+ return *iAudioMimeType;
+ }
+ }
+ CleanupStack::PopAndDestroy( entry );
+ }
+ return KNullDesC;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::MvpuoOpenComplete( TInt aError )
+// MVideoPlayerUtilityObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::MvpuoOpenComplete( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iVideoUtilReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
+ LOGGER_WRITE_1( "aError: %d", aError );
+ if ( aError == KErrNone )
+ {
+ iVideoUtil->Prepare();
+ }
+ else
+ {
+ iVideoUtilReady = ETrue;
+ iVideoUtilErr = aError;
+ }
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
+ {
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
+ LOGGER_WRITE("AsyncStop");
+ iWait.AsyncStop();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::MvpuoPrepareComplete( TInt aError )
+// MVideoPlayerUtilityObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::MvpuoPrepareComplete( TInt aError )
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iVideoUtilReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
+ LOGGER_WRITE_1( "aError: %d", aError );
+
+ iVideoUtilReady = ETrue;
+ iVideoUtilErr = aError;
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
+ {
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
+ LOGGER_WRITE("AsyncStop");
+ iWait.AsyncStop();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::MvpuoFrameReady()
+// MVideoPlayerUtilityObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::MvpuoFrameReady( CFbsBitmap& /*aFrame*/,TInt /*aError*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::MvpuoPlayComplete()
+// MVideoPlayerUtilityObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::MvpuoPlayComplete( TInt /*aError*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::MvpuoEvent()
+// MVideoPlayerUtilityObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::MvpuoEvent( const TMMFEvent& /*aEvent*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError)
+// MTNEVideoClipInfoObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::NotifyVideoClipInfoReady(CTNEVideoClipInfo& aInfo, TInt aError)
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iVideoClipReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ return;
+ }
+ LOGGER_WRITE_1("aError: %d", aError);
+ if ( aError == KErrNone )
+ {
+ TSize resolution(320,240);
+ TRAPD( err, aInfo.GetThumbL(*this,KBestThumbIndex, &resolution ) );
+
+ if ( err )
+ {
+ LOGGER_WRITE_1("aInfo.GetThumbL err: %d", err);
+ iVideoClipReady = ETrue;
+ iVideoClipErr = err;
+ }
+ }
+ else
+ {
+ iVideoClipReady = ETrue;
+ iVideoClipErr = aError;
+ }
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
+ {
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
+ LOGGER_WRITE("AsyncStop");
+ iWait.AsyncStop();
+ }
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::NotifyVideoClipThumbCompleted()
+// MTNEVideoClipInfoObserver implementation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::NotifyVideoClipThumbCompleted(CTNEVideoClipInfo& /*aInfo*/,
+ TInt aError,
+ CFbsBitmap* aThumb)
+ {
+ TRACE_FUNC_ENTRY;
+ if ( iVideoClipReady )
+ {
+ // already timeout
+ LOGGER_WRITE("Already timeout");
+ delete aThumb;
+ return;
+ }
+ LOGGER_WRITE_1("aError: %d", aError);
+ if ( aError == KErrNone)
+ {
+ delete iThumbnail;
+ iThumbnail = NULL;
+ LOGGER_WRITE("create CImageEncoder");
+ CImageEncoder* encoder = NULL;
+ TRAPD( err, encoder = CImageEncoder::DataNewL( iThumbnail, KImageEncoderMimeType, CImageEncoder::EOptionAlwaysThread ) );
+ LOGGER_WRITE_1("err: %d", err );
+ if ( err == KErrNone )
+ {
+ LOGGER_WRITE("Start Convert");
+ TRequestStatus status;
+ encoder->Convert( &status, *aThumb, NULL );
+
+ User::WaitForRequest( status );
+ LOGGER_WRITE_1("Convert status: %d", status.Int());
+ LOGGER_WRITE_1("buf Length: %d", iThumbnail->Length());
+ err = status.Int();
+ }
+ delete encoder;
+ }
+ delete aThumb;
+ iVideoClipReady = ETrue;
+ iVideoClipErr = aError;
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
+ {
+ iAsyncStopCalled = ETrue;
+ iTimeOut->Cancel();
+ LOGGER_WRITE("AsyncStop");
+ iWait.AsyncStop();
+ }
+
+ TRACE_FUNC_EXIT;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConVideoParser::TimeOut()
+// Called when timeout has occured, cancels videoclip generation
+// -----------------------------------------------------------------------------
+//
+void CSConVideoParser::TimeOut()
+ {
+ TRACE_FUNC_ENTRY;
+ if ( !iVideoClipReady )
+ {
+ iVideoClip->CancelThumb();
+ LOGGER_WRITE("videoclip cancelled");
+ iVideoClipReady = ETrue;
+ iVideoClipErr = KErrCancel;
+ }
+
+ if ( !iVideoUtilReady )
+ {
+ LOGGER_WRITE("videoUtil cancelled");
+ iVideoUtilReady = ETrue;
+ iVideoUtilErr = KErrCancel;
+ }
+
+ if ( iVideoUtilReady && iVideoClipReady && !iAsyncStopCalled )
+ {
+ LOGGER_WRITE("AsyncStop");
+ iAsyncStopCalled = ETrue;
+ iWait.AsyncStop();
+ }
+ TRACE_FUNC_EXIT;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/bld/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser and generator
+* This file provides the information required for building the
+* whole of a SConConMLHandler
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+sconconmlhandler.mmp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/bwinscwu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateCSConConMLHandlerL@@YAPAVCSConConMLHandler@@XZ @ 1 NONAME ; class CSConConMLHandler * CreateCSConConMLHandlerL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/bld/def/eabiu.def Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,7 @@
+EXPORTS
+ _Z24CreateCSConConMLHandlerLv @ 1 NONAME
+ _ZTI13CXMLWorkspace @ 2 NONAME ; #<TI>#
+ _ZTI17CSConConMLHandler @ 3 NONAME ; #<TI>#
+ _ZTV13CXMLWorkspace @ 4 NONAME ; #<VT>#
+ _ZTV17CSConConMLHandler @ 5 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/bld/sconconmlhandler.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML Parser and generator
+*
+*/
+
+
+// To get the MW_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+VENDORID VID_DEFAULT
+CAPABILITY CAP_GENERAL_DLL
+
+TARGETPATH sys/bin
+
+TARGET sconconmlhandler.dll
+TARGETTYPE DLL
+UID 0x10009D8D 0x101F99FA
+
+#if defined(ARMCC)
+DEFFILE ./def/eabi
+#elif defined(WINSCW)
+DEFFILE ./def/bwinscw
+#elif defined(WINS)
+DEFFILE ./def/bwins
+#elif defined(ARM)
+DEFFILE ./def/bmarm
+#endif
+
+SOURCEPATH ../src
+SOURCE sconconmlhandler.cpp
+SOURCE sconxmlelement.cpp
+SOURCE sconconmlgenerator.cpp
+SOURCE sconconmldtd.cpp
+SOURCE sconxmlworkspace.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../inc
+
+// Default system include paths for middleware layer modules.
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/libc
+
+LANG SC
+
+LIBRARY euser.lib
+LIBRARY estor.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmldtd.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,750 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONCONMLDTD_H__
+#define __SCONCONMLDTD_H__
+
+#include "sconxmlelement.h"
+
+typedef void *voidPtr_t;
+typedef long memSize_t;
+
+typedef enum
+ {
+ SML_PCDATA_UNDEFINED = 0,
+ SML_PCDATA_STRING, // String type
+ SML_PCDATA_OPAQUE, // Opaque type
+ SML_PCDATA_EXTENSION, // Extention type
+ SML_PCDATA_CDATA // XML CDATA type
+ } pcdataType_t;
+
+typedef enum
+ {
+ SML_EXT_UNDEFINED = 0,
+ } pcdataExtension_t;
+
+// -----------------------------------------------------------------------------
+// GenericListAddL
+// -----------------------------------------------------------------------------
+template<class T>
+void GenericListAddL( T* aList, T aNewItem )
+ {
+ if( *aList == 0 )
+ {
+ *aList = aNewItem;
+ }
+ else
+ {
+ T c;
+ for( c = *aList; c->next; c = c->next )
+ {};
+ c->next = aNewItem;
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// pcdata_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( pcdata_s ) : public CXMLElement
+ {
+public:
+ pcdataType_t contentType; // The type of data
+ pcdataExtension_t extension; // PCData Extension type
+ memSize_t length; // length of the data
+ voidPtr_t content; // Pointer to the data itself
+public:
+ pcdata_s();
+ ~pcdata_s();
+ pcdata_s( const pcdataType_t aType,
+ const pcdataExtension_t aExt = SML_EXT_UNDEFINED );
+ void FreeContent();
+ void SetDataL( const TDesC8& aData );
+ TPtrC8 Data() const;
+ void TruncateL( TInt aConsumed );
+ } *pcdataPtr_t, pcdata_t;
+
+// -----------------------------------------------------------------------------
+// pcdata_list_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( pcdata_list_s ) : public CBase
+ {
+ pcdataPtr_t data;
+ struct pcdata_list_s *next;
+
+ pcdata_list_s();
+ ~pcdata_list_s();
+ } *pcdataListPtr_t, pcdataList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Param_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Param_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+ pcdataPtr_t value;
+public:
+ ConML_Param_s();
+ ~ConML_Param_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ParamPtr_t, ConML_Param_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ParamList_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_ParamList_s ) : public CBase
+ {
+public:
+ ConML_ParamPtr_t data;
+ struct ConML_ParamList_s *next;
+public:
+ ConML_ParamList_s();
+ ~ConML_ParamList_s();
+ }*ConML_ParamListPtr_t, ConML_ParamList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_InstParams_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_InstParams_s ) : public CXMLElement
+ {
+public:
+ ConML_ParamListPtr_t param;
+public:
+ ConML_InstParams_s();
+ ~ConML_InstParams_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_InstParamsPtr_t, ConML_InstParams_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Progress_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Progress_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t value;
+public:
+ ConML_Progress_s();
+ ~ConML_Progress_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ProgressPtr_t, ConML_Progress_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Application_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Application_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+ pcdataPtr_t uid;
+public:
+ ConML_Application_s();
+ ~ConML_Application_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ApplicationPtr_t, ConML_Application_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ApplicationList_s
+// -----------------------------------------------------------------------------
+
+typedef NONSHARABLE_STRUCT( ConML_ApplicationList_s ) : public CBase
+ {
+public:
+ ConML_ApplicationPtr_t data;
+ struct ConML_ApplicationList_s *next;
+public:
+ ConML_ApplicationList_s();
+ ~ConML_ApplicationList_s();
+ }*ConML_ApplicationListPtr_t, ConML_ApplicationList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Applications_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Applications_s ) : public CXMLElement
+ {
+public:
+ ConML_ApplicationListPtr_t application;
+
+public:
+ ConML_Applications_s();
+ ~ConML_Applications_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ApplicationsPtr_t, ConML_Applications_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Drive_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Drive_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+public:
+ ConML_Drive_s();
+ ~ConML_Drive_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_DrivePtr_t, ConML_Drive_t;
+
+// -----------------------------------------------------------------------------
+// ConML_DriveList_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_DriveList_s ) : public CBase
+ {
+public:
+ ConML_DrivePtr_t data;
+ struct ConML_DriveList_s *next;
+public:
+ ConML_DriveList_s();
+ ~ConML_DriveList_s();
+ }*ConML_DriveListPtr_t, ConML_DriveList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Drives_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Drives_s ) : public CXMLElement
+ {
+public:
+ ConML_DriveListPtr_t drive;
+public:
+ ConML_Drives_s();
+ ~ConML_Drives_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_DrivesPtr_t, ConML_Drives_t;
+
+// -----------------------------------------------------------------------------
+// ConML_BUROptions_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_BUROptions_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t requiresReboot;
+ pcdataPtr_t hasFiles;
+ pcdataPtr_t supportsInc;
+ pcdataPtr_t delayToPrepareData;
+public:
+ ConML_BUROptions_s();
+ ~ConML_BUROptions_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_BUROptionsPtr_t, ConML_BUROptions_t;
+
+// -----------------------------------------------------------------------------
+// ConML_PackageInfo_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_PackageInfo_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+public:
+ ConML_PackageInfo_s();
+ ~ConML_PackageInfo_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_PackageInfoPtr_t, ConML_PackageInfo_t;
+
+// -----------------------------------------------------------------------------
+// ConML_SID_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_SID_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t type;
+ pcdataPtr_t uid;
+ ConML_DrivesPtr_t drives;
+ ConML_PackageInfoPtr_t packageInfo;
+ ConML_BUROptionsPtr_t burOptions;
+ pcdataPtr_t size;
+ pcdataPtr_t transferDataType;
+ pcdataPtr_t data;
+ pcdataPtr_t moreData;
+ pcdataPtr_t dataOwnerStatus;
+
+public:
+ ConML_SID_s();
+ ~ConML_SID_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_SIDPtr_t, ConML_SID_t;
+
+// -----------------------------------------------------------------------------
+// ConML_SIDList_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_SIDList_s ) : public CBase
+ {
+public:
+ ConML_SIDPtr_t data;
+ struct ConML_SIDList_s *next;
+public:
+ ConML_SIDList_s();
+ ~ConML_SIDList_s();
+ }*ConML_SIDListPtr_t, ConML_SIDList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_SupportedMethods_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_SupportedMethods_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t install;
+ pcdataPtr_t unInstall;
+ pcdataPtr_t setInstParams;
+ pcdataPtr_t listInstalledApps;
+ pcdataPtr_t listDataOwners;
+ pcdataPtr_t setBurMode;
+ pcdataPtr_t getDataSize;
+ pcdataPtr_t requestData;
+ pcdataPtr_t supplyData;
+ pcdataPtr_t reboot;
+public:
+ ConML_SupportedMethods_s();
+ ~ConML_SupportedMethods_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_SupportedMethodsPtr_t, ConML_SupportedMethods_t;
+
+// -----------------------------------------------------------------------------
+// ConML_DeviceInfo_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_DeviceInfo_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t version;
+ ConML_SupportedMethodsPtr_t supportedMethods;
+ pcdataPtr_t maxObjectSize;
+public:
+ ConML_DeviceInfo_s();
+ ~ConML_DeviceInfo_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_DeviceInfoPtr_t, ConML_DeviceInfo_t;
+
+// -----------------------------------------------------------------------------
+// ConML_File_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_File_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+ pcdataPtr_t modified;
+ pcdataPtr_t size;
+ pcdataPtr_t userPerm;
+public:
+ ConML_File_s();
+ ~ConML_File_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_FilePtr_t, ConML_File_t;
+
+// -----------------------------------------------------------------------------
+// ConML_FileList_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_FileList_s ) : public CBase
+ {
+public:
+ ConML_FilePtr_t data;
+ struct ConML_FileList_s *next;
+public:
+ ConML_FileList_s();
+ ~ConML_FileList_s();
+ }*ConML_FileListPtr_t, ConML_FileList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Files_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Files_s ) : public CXMLElement
+ {
+public:
+ ConML_FileListPtr_t file;
+public:
+ ConML_Files_s();
+ ~ConML_Files_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_FilesPtr_t, ConML_Files_t;
+
+// -----------------------------------------------------------------------------
+// ConML_DataOwners_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_DataOwners_s ) : public CXMLElement
+ {
+public:
+ ConML_SIDListPtr_t sid;
+public:
+ ConML_DataOwners_s();
+ ~ConML_DataOwners_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_DataOwnersPtr_t, ConML_DataOwners_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Results_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Results_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t complete;
+ ConML_ProgressPtr_t progress;
+ ConML_ApplicationsPtr_t applications;
+ ConML_DataOwnersPtr_t dataOwners;
+ pcdataPtr_t filename;
+ pcdataPtr_t moreData;
+ pcdataPtr_t data;
+ ConML_DeviceInfoPtr_t deviceInfo;
+ ConML_FilesPtr_t files;
+public:
+ ConML_Results_s();
+ ~ConML_Results_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ResultsPtr_t, ConML_Results_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Install_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Install_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t name;
+ ConML_InstParamsPtr_t instParams;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_Install_s();
+ ~ConML_Install_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_InstallPtr_t, ConML_Install_t;
+
+// -----------------------------------------------------------------------------
+// ConML_UnInstall_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_UnInstall_s ) : public CXMLElement
+ {
+public:
+ ConML_ApplicationsPtr_t applications;
+ ConML_InstParamsPtr_t instParams;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_UnInstall_s();
+ ~ConML_UnInstall_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_UnInstallPtr_t, ConML_UnInstall_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ListInstalledApps_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_ListInstalledApps_s ) : public CXMLElement
+ {
+public:
+ ConML_DrivesPtr_t drives;
+ pcdataPtr_t all;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_ListInstalledApps_s();
+ ~ConML_ListInstalledApps_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ListInstalledAppsPtr_t, ConML_ListInstalledApps_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ListDataOwners_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_ListDataOwners_s ) : public CXMLElement
+ {
+public:
+ ConML_ResultsPtr_t results;
+public:
+ ConML_ListDataOwners_s();
+ ~ConML_ListDataOwners_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ListDataOwnersPtr_t, ConML_ListDataOwners_t;
+
+// -----------------------------------------------------------------------------
+// ConML_SetBURMode_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_SetBURMode_s ) : public CXMLElement
+ {
+public:
+ ConML_DrivesPtr_t drives;
+ pcdataPtr_t partialType;
+ pcdataPtr_t incType;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_SetBURMode_s();
+ ~ConML_SetBURMode_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_SetBURModePtr_t, ConML_SetBURMode_t;
+
+// -----------------------------------------------------------------------------
+// ConML_GetDataSize_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_GetDataSize_s ) : public CXMLElement
+ {
+public:
+ ConML_DataOwnersPtr_t dataOwners;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_GetDataSize_s();
+ ~ConML_GetDataSize_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_GetDataSizePtr_t, ConML_GetDataSize_t;
+
+// -----------------------------------------------------------------------------
+// ConML_RequestData_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_RequestData_s ) : public CXMLElement
+ {
+public:
+ ConML_SIDListPtr_t sid;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_RequestData_s();
+ ~ConML_RequestData_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_RequestDataPtr_t, ConML_RequestData_t;
+
+// -----------------------------------------------------------------------------
+// ConML_UpdateDeviceInfo_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_UpdateDeviceInfo_s ) : public CXMLElement
+ {
+public:
+ ConML_DeviceInfoPtr_t deviceInfo;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_UpdateDeviceInfo_s();
+ ~ConML_UpdateDeviceInfo_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_UpdateDeviceInfoPtr_t, ConML_UpdateDeviceInfo_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ListPublicFiles_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_ListPublicFiles_s ) : public CXMLElement
+ {
+public:
+ ConML_ResultsPtr_t results;
+ ConML_SIDListPtr_t sid;
+public:
+ ConML_ListPublicFiles_s();
+ ~ConML_ListPublicFiles_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ListPublicFilesPtr_t, ConML_ListPublicFiles_t;
+
+// -----------------------------------------------------------------------------
+// ConML_SupplyData_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_SupplyData_s ) : public CXMLElement
+ {
+public:
+ ConML_SIDListPtr_t sid;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_SupplyData_s();
+ ~ConML_SupplyData_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_SupplyDataPtr_t, ConML_SupplyData_t;
+
+// -----------------------------------------------------------------------------
+// ConML_GetDataOwnerStatus_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_GetDataOwnerStatus_s ) : public CXMLElement
+ {
+public:
+ ConML_DataOwnersPtr_t dataOwners;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_GetDataOwnerStatus_s();
+ ~ConML_GetDataOwnerStatus_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_GetDataOwnerStatusPtr_t, ConML_GetDataOwnerStatus_t;
+
+// -----------------------------------------------------------------------------
+// ConML_GetMetadata_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_GetMetadata_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t filename;
+ ConML_ResultsPtr_t results;
+public:
+ ConML_GetMetadata_s();
+ ~ConML_GetMetadata_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_GetMetadataPtr_t, ConML_GetMetadata_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Execute_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Execute_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t id;
+ ConML_InstallPtr_t install;
+ ConML_UnInstallPtr_t unInstall;
+ ConML_ListInstalledAppsPtr_t listInstalledApps;
+ ConML_ListDataOwnersPtr_t listDataOwners;
+ ConML_SetBURModePtr_t setBurMode;
+ ConML_GetDataSizePtr_t getDataSize;
+ ConML_RequestDataPtr_t requestData;
+ ConML_UpdateDeviceInfoPtr_t updateDeviceInfo;
+ ConML_ListPublicFilesPtr_t listPublicFiles;
+ ConML_SupplyDataPtr_t supplyData;
+ pcdataPtr_t reboot;
+ ConML_GetDataOwnerStatusPtr_t getDataOwnerStatus;
+ ConML_GetMetadataPtr_t getMetadata;
+public:
+ ConML_Execute_s();
+ ~ConML_Execute_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_ExecutePtr_t, ConML_Execute_t;
+
+// -----------------------------------------------------------------------------
+// ConML_GetStatus_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_GetStatus_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t id;
+ pcdataPtr_t all;
+public:
+ ConML_GetStatus_s();
+ ~ConML_GetStatus_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_GetStatusPtr_t, ConML_GetStatus_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Cancel_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Cancel_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t id;
+ pcdataPtr_t all;
+public:
+ ConML_Cancel_s();
+ ~ConML_Cancel_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_CancelPtr_t, ConML_Cancel_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Reboot_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Reboot_s ) : public CXMLElement
+ {
+public:
+ ConML_ResultsPtr_t results;
+public:
+ ConML_Reboot_s();
+ ~ConML_Reboot_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_RebootPtr_t, ConML_Reboot_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Task_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Task_s ) : public CXMLElement
+ {
+public:
+ pcdataPtr_t id;
+ ConML_InstallPtr_t install;
+ ConML_UnInstallPtr_t unInstall;
+ ConML_ListInstalledAppsPtr_t listInstalledApps;
+ ConML_ListDataOwnersPtr_t listDataOwners;
+ ConML_SetBURModePtr_t setBurMode;
+ ConML_GetDataSizePtr_t getDataSize;
+ ConML_RequestDataPtr_t requestData;
+ ConML_UpdateDeviceInfoPtr_t updateDeviceInfo;
+ ConML_ListPublicFilesPtr_t listPublicFiles;
+ ConML_GetDataOwnerStatusPtr_t getDataOwnerStatus;
+ ConML_SupplyDataPtr_t supplyData;
+ ConML_RebootPtr_t reboot;
+ ConML_GetMetadataPtr_t getMetadata;
+public:
+ ConML_Task_s();
+ ~ConML_Task_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_TaskPtr_t, ConML_Task_t;
+
+// -----------------------------------------------------------------------------
+// ConML_TaskList_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_TaskList_s ) : public CBase
+ {
+public:
+ ConML_TaskPtr_t data;
+ struct ConML_TaskList_s *next;
+public:
+ ConML_TaskList_s();
+ ~ConML_TaskList_s();
+ }*ConML_TaskListPtr_t, ConML_TaskList_t;
+
+// -----------------------------------------------------------------------------
+// ConML_Status_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_Status_s ) : public CXMLElement
+ {
+public:
+ ConML_TaskListPtr_t task;
+public:
+ ConML_Status_s();
+ ~ConML_Status_s();
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ }*ConML_StatusPtr_t, ConML_Status_t;
+
+// -----------------------------------------------------------------------------
+// ConML_ConML_s
+// -----------------------------------------------------------------------------
+typedef NONSHARABLE_STRUCT( ConML_ConML_s ) : public CXMLElement
+ {
+public:
+ ConML_ExecutePtr_t execute;
+ ConML_GetStatusPtr_t getStatus;
+ ConML_CancelPtr_t cancel;
+ ConML_StatusPtr_t status;
+
+public:
+ ConML_ConML_s();
+ ~ConML_ConML_s();
+ TBool NeedsCleanup() const;
+ CXMLElement* BeginElementL
+ ( TUint8 aTag, const TXMLElementParams& aParams = TXMLElementParams() );
+ CXMLElement::TAction EndElementL( TAny* aCallbacks, TUint8 aTag );
+ } *ConML_ConMLPtr_t, ConML_ConML_t;
+
+#endif // __SCONCONMLDTD_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlgenerator.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONCONMLGENERATOR_H__
+#define __SCONCONMLGENERATOR_H__
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include "sconxmlelement.h"
+#include "sconconmldtd.h"
+#include "sconconmltags.h"
+#include "sconwbxmldefs.h"
+#include "sconxmlworkspace.h"
+
+// -----------------------------------------------------------------------------
+// MWBXMLConMLCallback - Call back for parsed data
+// -----------------------------------------------------------------------------
+class MWBXMLConMLCallback
+ {
+public:
+ /**
+ * Call back function for delivering the parsed data
+ * @param aContent contains the parsed data
+ * @return none
+ */
+
+ virtual void ConMLL( ConML_ConMLPtr_t aContent ) = 0;
+ };
+
+// -----------------------------------------------------------------------------
+// TWBXMLContentFormat
+// -----------------------------------------------------------------------------
+enum TWBXMLContentFormat
+ {
+ EWBXMLContentFormatOpaque,
+ EWBXMLContentFormatInlineString
+ };
+
+// -----------------------------------------------------------------------------
+// CSConConMLGenerator - Generates XBXML and XML documents
+// -----------------------------------------------------------------------------
+NONSHARABLE_CLASS( CSConConMLGenerator ) : public CBase
+ {
+public:
+
+ static CSConConMLGenerator* NewL();
+ ~CSConConMLGenerator();
+
+ /**
+ * Returns the generated WBXML document
+ * @param none
+ * @return the document as TPtrC8
+ */
+ TPtrC8 WBXMLDocument();
+
+ /**
+ * Returns the generated XML document
+ * @param none
+ * @return the document as TPtrC8
+ */
+ TPtrC8 XMLDocument();
+
+
+ // WBXML Parser
+
+ /**
+ * Sets the callback function to call after parsing
+ * @param aCallback callback function to call when parsing finished
+ * @return none
+ */
+ void SetCallback ( MWBXMLConMLCallback* aCallbakc );
+
+ /**
+ * Starts the document after header has been parsed
+ * @param aVersion - version of WBXML document
+ * @param aPublicId - public ID of WBXML document as known public ID
+ * @param aCharset - Character set of WBXML document
+ * @return none
+ */
+ void StartDocument( TUint8 aVersion, TInt32 aPublicId, TUint32 aCharset );
+
+ /**
+ * Starts the document after header has been parsed
+ * @param aVersion - version of WBXML document
+ * @param aPublicIdStr - public ID of WBXML document as a inline string
+ * @param aCharset - Character set of WBXML document
+ * @return none
+ */
+ void StartDocument(
+ TUint8 aVersion, const TDesC8& aPublicIdStr, TUint32 aCharset );
+
+ /**
+ * Starts a new element in the document
+ * @param aTag - Tag of the element
+ * @return none
+ */
+ void StartElementL( TWBXMLTag aTag );
+
+ /**
+ * Starts a character data in the document
+ * @param aBuffer - Character data
+ * @return none
+ */
+ void CharactersL( const TDesC8& aBuffer );
+
+ /**
+ * Document has been parsed - the end of document
+ * @param none
+ * @return none
+ */
+ void EndDocument();
+
+ /**
+ * End tag of an element has been found
+ * @param aTag - tag of the element to be closed
+ * @return none
+ */
+ void EndElementL( TWBXMLTag aTag );
+
+ // Generator
+
+ /**
+ * Starts the generation of a document
+ * @param aContent - data for the document
+ * @return none
+ */
+ TInt GenerateConMLDocument ( ConML_ConMLPtr_t aContent );
+
+private:
+
+ // WBXML Generator
+ void WriteMUint32L( TUint32 aValue );
+ void WriteOpaqueDataL( const TDesC8& aData );
+ void WriteInlineStringL( const TDesC8& aData );
+
+ // XML Generator
+ void IndentL();
+ TPtrC8 TranslateElement( TUint8 aElement );
+
+ // WBXML / XML Generator
+ void BeginDocumentL( TUint8 aVersion, TInt32 aPublicId, TUint32 aCharset,
+ const TDesC8& aStringTbl = TPtrC8() );
+ void BeginElementL( TUint8 aElement, TBool aHasContent = EFalse,
+ TBool aHasAttributes = EFalse );
+ void EndElementL();
+ void AddElementL(
+ TUint8 aElement, const TDesC8& aContent,
+ const TWBXMLContentFormat aFormat = EWBXMLContentFormatOpaque );
+ void AppendPCDataL( TUint8 aElement, pcdataPtr_t aContent );
+ void AppendConMLL( ConML_ConMLPtr_t aContent );
+ void AppendExecuteL( ConML_ExecutePtr_t aContent );
+ void AppendSupplyDataL( ConML_SupplyDataPtr_t aContent );
+ void AppendInstallL( ConML_InstallPtr_t aContent );
+ void AppendCancelL ( ConML_CancelPtr_t aContent );
+ void AppendStatusL ( ConML_StatusPtr_t aContent );
+ void AppendGetStatusL( ConML_GetStatusPtr_t aContent );
+ void AppendRebootL( ConML_RebootPtr_t aContent );
+ void AppendTaskL( ConML_TaskPtr_t aContent );
+ void AppendTaskListL( ConML_TaskListPtr_t aContent );
+ void AppendUnInstallL( ConML_UnInstallPtr_t aContent );
+ void AppendListInstalledAppsL ( ConML_ListInstalledAppsPtr_t aContent );
+ void AppendListDataOwnersL ( ConML_ListDataOwnersPtr_t aContent );
+ void AppendBUROptionsL( ConML_BUROptionsPtr_t aContent );
+ void AppendSetBURModeL( ConML_SetBURModePtr_t aContent );
+ void AppendGetDataSizeL( ConML_GetDataSizePtr_t aContent );
+ void AppendRequestDataL( ConML_RequestDataPtr_t aContent );
+ void AppendUpdateDeviceInfoL( ConML_UpdateDeviceInfoPtr_t aContent );
+ void AppendListPublicFilesL( ConML_ListPublicFilesPtr_t aContent );
+ void AppendApplicationL( ConML_ApplicationPtr_t aContent );
+ void AppendApplicationListL( ConML_ApplicationListPtr_t aContent );
+ void AppendApplicationsL( ConML_ApplicationsPtr_t aContent );
+ void AppendParamL( ConML_ParamPtr_t aContent );
+ void AppendParamListL( ConML_ParamListPtr_t aContent );
+ void AppendInstParamsL( ConML_InstParamsPtr_t aContent );
+ void AppendProgressL( ConML_ProgressPtr_t aContent );
+ void AppendResultsL( ConML_ResultsPtr_t aContent );
+ void AppendDriveL( ConML_DrivePtr_t aContent );
+ void AppendDriveListL( ConML_DriveListPtr_t aContent );
+ void AppendDrivesL( ConML_DrivesPtr_t aContent );
+ void AppendDataOwnersL( ConML_DataOwnersPtr_t aContent );
+ void AppendPackageInfoL ( ConML_PackageInfoPtr_t aContent );
+ void AppendSIDL( ConML_SIDPtr_t aContent );
+ void AppendSIDListL( ConML_SIDListPtr_t aContent );
+ void AppendDeviceInfoL( ConML_DeviceInfoPtr_t aContent );
+ void AppendFilesL( ConML_FilesPtr_t aContent );
+ void AppendSupportedMethodsL( ConML_SupportedMethodsPtr_t aContent );
+ void AppendFileListL( ConML_FileListPtr_t aContent );
+ void AppendFileL( ConML_FilePtr_t aContent );
+ void AppendGetDataOwnerStatusL( ConML_GetDataOwnerStatusPtr_t aContent );
+ void AppendGetMetadataL( ConML_GetMetadataPtr_t aContent );
+
+ TInt HandleResult( TInt aResult, TInt aTreshold = 0 );
+
+private:
+ void ConstructL();
+ CSConConMLGenerator();
+ void AddElement( CXMLElement* aElement );
+
+private:
+ // Parser
+ CXMLStack<CXMLElement>* iCmdStack;
+ CXMLStack<CXMLElement>* iCleanupStack;
+ MWBXMLConMLCallback* iCallback;
+
+ // Generator workspaces
+ CXMLWorkspace* iWBXMLWorkspace;
+ CXMLWorkspace* iXMLWorkspace;
+
+ // XML
+ RArray<TUint8> iElemStack;
+ TInt iInitialIndentLevel;
+ TBool iDontNewLine;
+ TBool iDontIndent;
+ };
+
+#endif // __SCONCONMLGENERATOR_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandler.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef _SCONCONMLHANDLER_H
+#define _SCONCONMLHANDLER_H
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include "sconconmlgenerator.h"
+#include "sconwbxmldefs.h"
+#include "sconconmlhandlererror.h"
+#include "sconconmldtd.h"
+
+// -----------------------------------------------------------------------------
+// Definitions and constants
+// -----------------------------------------------------------------------------
+
+_LIT8(KWBXMLNull, "\x00");
+
+const TInt KSConBufferGranularity( 32 );
+const TInt KSConDefaultDocumentSize( 2048 );
+
+// -----------------------------------------------------------------------------
+// TWBXMLStackItem
+// -----------------------------------------------------------------------------
+NONSHARABLE_STRUCT( TWBXMLStackItem )
+ {
+public:
+ inline TWBXMLStackItem( TUint8 aTag );
+ inline TUint8 Tag() const;
+
+private:
+ TUint8 iTag;
+ };
+
+#include "sconwbxmlparser.inl"
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler - WBXML parsing
+// -----------------------------------------------------------------------------
+class CSConConMLHandler : public CBase
+ {
+public:
+ static CSConConMLHandler* NewL();
+ ~CSConConMLHandler();
+
+ /**
+ * Starts the parsing of a WBXML document
+ * @param aInput - the WBXML document to be parsed
+ * @param aCallback - Call back function to call
+ * after the document is parsed
+ * @return An error code
+ */
+ virtual TInt ParseDocumentL( CBufFlat& aInput,
+ MWBXMLConMLCallback* aCallback );
+
+ /**
+ * Starts the generating of a WBXML and XML document
+ * @param aContent - the data to be generated into the document
+ * @return An error code
+ */
+ virtual TInt GenerateDocument( ConML_ConMLPtr_t aContent );
+
+ /**
+ * Returns the generated document in XML -format
+ * @param none
+ * @return The document as TPtrC8
+ */
+ virtual TPtrC8 XMLDocument();
+
+ /**
+ * Returns the generated document in WBXML -format
+ * @param none
+ * @return The document as TPtrC8
+ */
+ virtual TPtrC8 WBXMLDocument();
+
+private:
+ CSConConMLHandler();
+ void ConstructL();
+
+ TInt ParseL();
+ TConMLParserError DoParseDocumentHeaderL();
+ TConMLParserError DoParseDocumentBodyL();
+ TUint8 ReadUint8L();
+ TUint32 ReadMUint32L();
+ TPtrC8 ReadStrIL();
+ TPtrC8 StringTableString( TUint32 aIndex );
+ void ReadStringTableL();
+ TPtrC8 ReadOpaqueL();
+ void HandleElementL( TUint8 aId );
+
+private:
+ CSConConMLGenerator* iGenerator;
+ HBufC8* iStringTable;
+ CBufBase* iBuffer;
+ TBool iHeaderParsed;
+ RArray< TUint > iElemStack;
+ TInt iPos;
+ CBufFlat* iParseBuffer;
+ MWBXMLConMLCallback* iCallback;
+ };
+
+ IMPORT_C CSConConMLHandler* CreateCSConConMLHandlerL();
+ typedef CSConConMLHandler* (*TSConCreateCSConConMLHandlerFunc) ();
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmlhandlererror.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONCONMLHANDLERERROR_H__
+#define __SCONCONMLHANDLERERROR_H__
+
+// -----------------------------------------------------------------------------
+// Parser error base
+// -----------------------------------------------------------------------------
+
+#define PERRBASE 0x2000
+
+enum TConMLParserError
+ {
+ KWBXMLParserErrorOk = 0,
+ KWBXMLParserErrorEof = PERRBASE,
+ KWBXMLParserErrorEofTooEarly,
+ KWBXMLParserErrorInvalidTag,
+ KWBXMLParserErrorWrongWBXMLVersion,
+ KWBXMLParserErrorWrongPublicId,
+ KWBXMLParserErrorinvalidDocument
+ };
+
+#define GERRBASE 0x3000
+
+enum TWBXMLGeneratorError
+ {
+ KWBXMLGeneratorOk = 0,
+ KWBXMLGeneratorBufferFull = GERRBASE
+ };
+
+#endif // __SCONCONMLHANDLERERROR_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconconmltags.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+
+#ifndef __SCONCONMLTAGS_H__
+#define __SCONCONMLTAGS_H__
+
+// -----------------------------------------------------------------------------
+// Constants
+// -----------------------------------------------------------------------------
+const TInt32 KSConConMLPublicId = 0x8F;
+const TUint8 KSConConMLVersion = 0x02;
+const TUint32 KSConConMLUTF8 = 0x6a;
+
+_LIT8(KSConConMLPublicIdStr, "-//CONML//DTD ConML 1.0//EN");
+
+// -----------------------------------------------------------------------------
+// TConMLTags
+// -----------------------------------------------------------------------------
+enum TConMLTags
+ {
+ EConMLAll = 5,
+ EConMLApplication,
+ EConMLApplications,
+ EConMLBUROptions,
+ EConMLCancel,
+ EConMLComplete,
+ EConML,
+ EConMLData,
+ EConMLDataOwners,
+ EConMLDataOwnerStatus,
+ EConMLDelayToPrepareData,
+ EConMLDeviceInfo,
+ EConMLDrive,
+ EConMLDrives,
+ EConMLExecute,
+ EConMLFile,
+ EConMLFiles,
+ EConMLGetDataOwnerStatus,
+ EConMLGetDataSize,
+ EConMLGetStatus,
+ EConMLHasFiles,
+ EConMLID,
+ EConMLIncType,
+ EConMLInstall,
+ EConMLInstParams,
+ EConMLListDataOwners,
+ EConMLListInstalledApps,
+ EConMLListPublicFiles,
+ EConMLMaxObjectSize,
+ EConMLModified,
+ EConMLMoreData,
+ EConMLName,
+ EConMLPackageInfo,
+ EConMLParam,
+ EConMLPartialType,
+ EConMLProgress,
+ EConMLReboot,
+ EConMLRequestData,
+ EConMLRequiresReboot,
+ EConMLResults,
+ EConMLSetBURMode,
+ EConMLSetInstParams,
+ EConMLSID,
+ EConMLSize,
+ EConMLStatus,
+ EConMLSupplyData,
+ EConMLSupportedMethods,
+ EConMLSupportsInc,
+ EConMLTask,
+ EConMLTransferDataType,
+ EConMLType,
+ EConMLUID,
+ EConMLUnInstall,
+ EConMLUpdateDeviceInfo,
+ EConMLUserPerm,
+ EConMLValue,
+ EConMLVersion,
+ EConMLGetMetadata,
+ EConMLFilename
+ };
+// -----------------------------------------------------------------------------
+_LIT8( KConMLElements,
+ "<0>|<1>|<2>|<3>|<4>|All|Application|Applications|BUROptions|Cancel"
+ "|Complete|ConML|Data|DataOwners|DataOwnerStatus|DelayToPrepareData"
+ "|DeviceInfo|Drive|Drives|Execute|File|Files|GetDataOwnerStatus"
+ "|GetDataSize|GetStatus|HasFiles|ID|IncType|Install|InstParams"
+ "|ListDataOwners|ListInstalledApps|ListPublicFiles|MaxObjectSize|"
+ "Modified|MoreData|Name|PackageInfo|Param|PartialType|Progress|"
+ "Reboot|RequestData|RequiresReboot|Results|SetBURMode|SetInstParams|SID|"
+ "Size|Status|SupplyData|SupportedMethods|SupportsInc|Task|"
+ "TransferDataType|Type|UID|UnInstall|UpdateDeviceInfo|UserPerm|"
+ "Value|Version|GetMetadata|Filename" );
+
+_LIT8(KXMLTagStart, "<");
+_LIT8(KXMLTagStartEndTag, "</");
+_LIT8(KXMLTagEndNoContent, "/>");
+_LIT8(KXMLTagEnd, ">");
+_LIT8(KXMLElemenentSeparator, "|");
+_LIT8(KXMLNamespaceBegin, " xmlns='");
+_LIT8(KXMLNamespaceEnd, "'");
+_LIT8(KXMLIndent, " ");
+_LIT8(KXMLNewLine, "\r\n");
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmldefs.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONWBXMLDEFS_H__
+#define __SCONWBXMLDEFS_H__
+
+// -----------------------------------------------------------------------------
+// Typedefs
+// -----------------------------------------------------------------------------
+typedef TUint8 TWBXMLTag;
+
+// -----------------------------------------------------------------------------
+// Constants
+// -----------------------------------------------------------------------------
+const TWBXMLTag SWITCH_PAGE = 0;
+const TWBXMLTag END = 1;
+const TWBXMLTag ENTITY = 2;
+const TWBXMLTag STR_I = 3;
+const TWBXMLTag LITERAL = 4;
+const TWBXMLTag OPAQUE = 0xc3;
+
+const TUint8 KWBXMLHasAttributes = (1<<7);
+const TUint8 KWBXMLHasContent = (1<<6);
+
+
+#endif // __SCONWBXMLDEFS_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconwbxmlparser.inl Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONWBXMLPARSER_INL__
+#define __SCONWBXMLPARSER_INL__
+
+
+inline TWBXMLStackItem::TWBXMLStackItem( TUint8 aTag ) : iTag(aTag)
+ {
+ }
+
+inline TUint8 TWBXMLStackItem::Tag() const
+ {
+ return iTag;
+ }
+
+#endif // __SCONWBXMLPARSER_INL__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONXMLELEMENT_H__
+#define __SCONXMLELEMENT_H__
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+
+#include <e32base.h>
+#include "sconxmlstack.h"
+
+// -----------------------------------------------------------------------------
+// Class forwards
+// -----------------------------------------------------------------------------
+class MWBXMLConMLCallback;
+struct TXMLElementParams;
+
+// -----------------------------------------------------------------------------
+// CXMLElement - Base class for XML -elements
+// -----------------------------------------------------------------------------
+NONSHARABLE_CLASS( CXMLElement ) : public CBase
+ {
+public:
+ enum TAction
+ {
+ ENone,
+ EPop,
+ EPopAndDestroy // Pop from stack, callback, delete
+ };
+
+ /**
+ * Sets the data of an element
+ * @param aData - Data of the element
+ * @return none
+ */
+ virtual void SetDataL( const TDesC8& aData );
+
+ /**
+ * Returns data of an element
+ * @param none
+ * @return Data of the element as TPtrC8
+ */
+ virtual TPtrC8 Data() const;
+
+ /**
+ * Validates an element's instance
+ * @param none
+ * @return ETrue if element current instance is valid,
+ * EFalse if not
+ */
+ virtual TBool Validate();
+
+ /**
+ * Checks if instance needs cleanup
+ * @param none
+ * @return ETrue if instance pushed into
+ * parser's cleanupstack , EFalse if not
+ */
+ virtual TBool NeedsCleanup() const;
+
+ /**
+ * Offers a new element to this element
+ * @param aTag - tag of the element to be started
+ * @param aParams - Element parameters
+ * @return new Element instance as CXMLElement
+ */
+ virtual CXMLElement* BeginElementL(
+ TUint8 aTag, const TXMLElementParams& aParams );
+
+ /**
+ * Offers a new element to this element
+ * @param aTag - tag of the element to be started
+ * @param aParams - Element parameters
+ * @return new Element instance as CXMLElement
+ */
+ virtual TAction EndElementL( TAny* aCallbacks, TUint8 aTag );
+ };
+
+// -----------------------------------------------------------------------------
+// TElementParams
+// -----------------------------------------------------------------------------
+NONSHARABLE_STRUCT( TXMLElementParams )
+ {
+public:
+ inline TXMLElementParams();
+ TXMLElementParams(
+ TAny* aCallbacks,
+ CXMLStack<CXMLElement>* aCmdStack = 0,
+ CXMLStack<CXMLElement>* aCleanupStack = 0 );
+
+ /**
+ * Returns the call back function of parameters
+ * @param nonoe
+ * @return call back function as TAny
+ */
+ inline TAny* Callbacks() const;
+
+ /**
+ * Returns the command stack of the parameters
+ * @param none
+ * @return command stack as CXMLStack
+ */
+ inline CXMLStack<CXMLElement>* CmdStack() const;
+
+ /**
+ * Returns the clean up stack of the parameters
+ * @param none
+ * @return clean up stack as CXMLStack
+ */
+ inline CXMLStack<CXMLElement>* CleanupStack() const;
+
+private:
+ TAny* iCallbacks;
+ CXMLStack<CXMLElement>* iCmdStack;
+ CXMLStack<CXMLElement>* iCleanupStack;
+ };
+
+#include "sconxmlelement.inl"
+
+#endif // __SCONXMLELEMENT_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlelement.inl Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONXMLELEMENT_INL__
+#define __SCONXMLELEMENT_INL__
+
+// ------------------------------------------------------------------------------------------------
+inline TXMLElementParams::TXMLElementParams() : iCallbacks(0), iCmdStack(0), iCleanupStack(0)
+ {
+ }
+
+// ------------------------------------------------------------------------------------------------
+inline TAny* TXMLElementParams::Callbacks() const
+ {
+ return iCallbacks;
+ }
+
+// ------------------------------------------------------------------------------------------------
+inline CXMLStack<CXMLElement>* TXMLElementParams::CmdStack() const
+ {
+ return iCmdStack;
+ }
+
+// ------------------------------------------------------------------------------------------------
+inline CXMLStack<CXMLElement>* TXMLElementParams::CleanupStack() const
+ {
+ return iCleanupStack;
+ }
+
+#endif // __SCONXMLELEMENT_INL__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONXMLSTACK_H__
+#define __SCONXMLSTACK_H__
+
+// -----------------------------------------------------------------------------
+// CNSmlStack - Stack for WBXML / XML elements
+// ----------------------------------------------------------------------------
+
+template <class T>
+class CXMLStack : public CBase
+ {
+public:
+ static inline CXMLStack* NewL();
+ inline ~CXMLStack();
+
+ /**
+ * Removes latest item from the stack
+ * @param none
+ * @return none
+ */
+ inline T* Pop();
+
+ /**
+ * Return the latest item from the stack
+ * @param none
+ * @return the item
+ */
+ inline T* Top();
+
+ /**
+ * Adds an item to the stack
+ * @param none
+ * @return none
+ */
+ inline void Push( T* aItem );
+
+ /**
+ * Returns the number of items in the stack
+ * @param none
+ * @return number of items as TInt
+ */
+ inline TInt Count();
+
+ /**
+ * Resets the stack
+ * @param none
+ * @return none
+ */
+ inline void Reset();
+
+ /**
+ * Resets and destroys the stack
+ * @param none
+ * @return none
+ */
+ inline void ResetAndDestroy();
+
+
+protected:
+ inline CXMLStack<T>();
+
+private:
+ RPointerArray<T>* iStack;
+ };
+
+#include "sconxmlstack.inl"
+
+#endif // __SCONXMLSTACK_H__
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlstack.inl Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONXMLSTACK_INL__
+#define __SCONXMLSTACK_INL__
+
+
+// ------------------------------------------------------------------------------------------------
+// CXMLStack
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline CXMLStack<T>::CXMLStack()
+ {
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline CXMLStack<T>::~CXMLStack()
+ {
+ iStack->ResetAndDestroy();
+ delete iStack;
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline CXMLStack<T>* CXMLStack<T>::NewL()
+ {
+ CXMLStack<T>* self = new (ELeave) CXMLStack<T>();
+ CleanupStack::PushL(self);
+ self->iStack = new (ELeave) RPointerArray<T>();
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline T* CXMLStack<T>::Pop()
+ {
+ T* temp = iStack->operator[](iStack->Count() - 1);
+ iStack->Remove(iStack->Count() - 1);
+ return temp;
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline T* CXMLStack<T>::Top()
+ {
+ if( Count() > 0 )
+ {
+ return iStack->operator[](iStack->Count() - 1);
+ }
+ return 0;
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline void CXMLStack<T>::Push( T* aItem )
+ {
+ iStack->Append(aItem);
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline TInt CXMLStack<T>::Count()
+ {
+ return iStack->Count();
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline void CXMLStack<T>::Reset()
+ {
+ iStack->Reset();
+ }
+
+// ------------------------------------------------------------------------------------------------
+template<class T>
+inline void CXMLStack<T>::ResetAndDestroy()
+ {
+ iStack->ResetAndDestroy();
+ }
+
+#endif // __SCONXMLSTACK_INL__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/inc/sconxmlworkspace.h Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#ifndef __SCONXMLWORKSPACE_H__
+#define __SCONXMLWORKSPACE_H__
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include <e32base.h>
+
+// -----------------------------------------------------------------------------
+// CXMLWorkspace - workspace for WBXML / XML -documents
+// -----------------------------------------------------------------------------
+class CXMLWorkspace : public CBase
+ {
+public:
+ ~CXMLWorkspace();
+ static CXMLWorkspace* NewL();
+
+ // transaction handling
+ /**
+ * Function to Begin transaction
+ * @param none
+ * @return none
+ */
+ void BeginTransaction();
+
+ /**
+ * Commits the transactions done
+ * @param none
+ * @return none
+ */
+ void CommitAll();
+
+ /**
+ * Commits the latest transacion done
+ * @param none
+ * @return KErrNone or an error code
+ */
+ TInt Commit();
+
+ /**
+ * Deletes the latest transacion done
+ * @param none
+ * @return KErrNone or an error code
+ */
+ TInt Rollback();
+
+ /**
+ * Resets the buffer
+ * @param none
+ * @return KErrNone or an error code
+ */
+ void Reset();
+
+ /**
+ * Writes to the buffer
+ * @param none
+ * @return none
+ */
+ void WriteL( const TDesC8& aData );
+ void WriteL( const TUint8 aData );
+
+ /**
+ * Returns the buffer
+ * @param none
+ * @return the buffer
+ */
+ TPtrC8 Buffer();
+
+ /**
+ * Returns the free space left in the buffer
+ * @param none
+ * @return free space of the buffer
+ */
+ TInt FreeSize();
+
+ /**
+ * Returns the maximum size of the buffer
+ * @param none
+ * @return Buffer maximum size
+ */
+ TInt MaxSize();
+
+ /**
+ * Returns the size of the buffer space used
+ * @param none
+ * @return Size of the buffer used
+ */
+ TInt Size();
+
+protected:
+ void ConstructL();
+
+private:
+ void Delete( TInt aPos, TInt aLength );
+ CXMLWorkspace();
+private:
+ CBufFlat* iBuffer;
+ RArray<TUint>* iTransactions;
+ };
+
+#endif // __SCONXMLWORKSPACE_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmldtd.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1783 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+#include "sconconmldtd.h"
+#include "sconconmltags.h"
+#include "sconconmlhandler.h"
+#include "sconconmlhandlererror.h"
+#include "debug.h"
+
+// -----------------------------------------------------------------------------
+// Macros
+// -----------------------------------------------------------------------------
+#define CHECK_NO_DUPLICATE(a) if( a ) { User::Leave( KWBXMLParserErrorinvalidDocument ); }
+
+// -----------------------------------------------------------------------------
+// pcdata_s
+// -----------------------------------------------------------------------------
+pcdata_s::pcdata_s( const pcdataType_t aType, const pcdataExtension_t aExt )
+ : contentType(aType), extension(aExt)
+ {
+ }
+
+pcdata_s::pcdata_s() : contentType(SML_PCDATA_OPAQUE),
+ extension(SML_EXT_UNDEFINED)
+ {
+ }
+
+pcdata_s::~pcdata_s()
+ {
+ FreeContent();
+ }
+
+void pcdata_s::FreeContent()
+ {
+ User::Free(content);
+ content = 0;
+ }
+
+void pcdata_s::SetDataL( const TDesC8& aData )
+ {
+ FreeContent();
+ length = aData.Length();
+ content = User::AllocL(length);
+ Mem::Copy(content, aData.Ptr(), length);
+ }
+
+TPtrC8 pcdata_s::Data() const
+ {
+ return TPtrC8((TUint8*)content, length);
+ }
+
+void pcdata_s::TruncateL( TInt aConsumed )
+ {
+ HBufC8* buffer = TPtrC8((TUint8*)content + aConsumed,
+ length - aConsumed).AllocLC();
+ SetDataL(*buffer);
+ CleanupStack::PopAndDestroy(); // buffer
+ }
+
+pcdata_list_s::pcdata_list_s()
+ {
+ }
+
+pcdata_list_s::~pcdata_list_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// AddDriveL
+// -----------------------------------------------------------------------------
+CXMLElement* AddDriveL( ConML_DriveListPtr_t* aList )
+ {
+ ConML_DriveListPtr_t itemL = new ( ELeave ) ConML_DriveList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_Drive_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// AddSIDL
+// -----------------------------------------------------------------------------
+CXMLElement* AddSIDL( ConML_SIDListPtr_t * aList )
+ {
+ ConML_SIDListPtr_t itemL = new ( ELeave ) ConML_SIDList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_SID_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// AddFileL
+// -----------------------------------------------------------------------------
+CXMLElement* AddFileL( ConML_FileListPtr_t * aList )
+ {
+ ConML_FileListPtr_t itemL = new ( ELeave ) ConML_FileList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_File_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// AddApplicationL
+// -----------------------------------------------------------------------------
+CXMLElement* AddApplicationL( ConML_ApplicationListPtr_t * aList )
+ {
+ ConML_ApplicationListPtr_t itemL = new ( ELeave ) ConML_ApplicationList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_Application_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// AddTaskL
+// -----------------------------------------------------------------------------
+CXMLElement* AddTaskL( ConML_TaskListPtr_t * aList )
+ {
+ ConML_TaskListPtr_t itemL = new ( ELeave ) ConML_TaskList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_Task_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// AddParamL
+// -----------------------------------------------------------------------------
+CXMLElement* AddParamL( ConML_ParamListPtr_t * aList )
+ {
+ ConML_ParamListPtr_t itemL = new ( ELeave ) ConML_ParamList_t();
+ CleanupStack::PushL( itemL );
+ itemL->data = new ( ELeave ) ConML_Param_t();
+ GenericListAddL(aList, itemL);
+ CleanupStack::Pop(); // itemL
+ return itemL->data;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Drive_s
+// -----------------------------------------------------------------------------
+ConML_Drive_s::ConML_Drive_s()
+ {
+ }
+
+ConML_Drive_s::~ConML_Drive_s()
+ {
+ delete name;
+ }
+
+CXMLElement* ConML_Drive_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name );
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Drive_s::BeginElement() : Unknown element %02x", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_DriveList_s
+// -----------------------------------------------------------------------------
+ConML_DriveList_s::ConML_DriveList_s()
+ {
+ }
+
+ConML_DriveList_s::~ConML_DriveList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Drives_s
+// -----------------------------------------------------------------------------
+ConML_Drives_s::ConML_Drives_s()
+ {
+ }
+
+ConML_Drives_s::~ConML_Drives_s()
+ {
+ delete drive;
+ }
+
+CXMLElement* ConML_Drives_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLDrive:
+ return AddDriveL ( &drive );
+
+ default:
+ LOGGER_WRITE_1( "ConML_Drives_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_BUROptions_s
+// -----------------------------------------------------------------------------
+ConML_BUROptions_s::ConML_BUROptions_s()
+ {
+ }
+
+ConML_BUROptions_s::~ConML_BUROptions_s()
+ {
+ delete requiresReboot;
+ delete hasFiles;
+ delete supportsInc;
+ delete delayToPrepareData;
+ }
+
+CXMLElement* ConML_BUROptions_s::BeginElementL (
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLRequiresReboot:
+ CHECK_NO_DUPLICATE ( requiresReboot );
+ requiresReboot = new ( ELeave ) pcdata_t();
+ return requiresReboot;
+
+ case EConMLHasFiles:
+ CHECK_NO_DUPLICATE ( hasFiles );
+ hasFiles = new ( ELeave ) pcdata_t();
+ return hasFiles;
+
+ case EConMLSupportsInc:
+ CHECK_NO_DUPLICATE ( supportsInc );
+ supportsInc = new ( ELeave ) pcdata_t();
+ return supportsInc;
+
+ case EConMLDelayToPrepareData:
+ CHECK_NO_DUPLICATE ( delayToPrepareData );
+ delayToPrepareData = new ( ELeave ) pcdata_t();
+ return delayToPrepareData;
+
+ default:
+ LOGGER_WRITE_1( "ConML_BUROptions_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_PackageInfo_s
+// -----------------------------------------------------------------------------
+ConML_PackageInfo_s::ConML_PackageInfo_s()
+ {
+ }
+
+ConML_PackageInfo_s::~ConML_PackageInfo_s()
+ {
+ delete name;
+ }
+
+CXMLElement* ConML_PackageInfo_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name )
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ default:
+ LOGGER_WRITE_1( "ConML_PackageInfo_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// ConML_SID_s
+// -----------------------------------------------------------------------------
+ConML_SID_s::ConML_SID_s()
+ {
+ }
+
+ConML_SID_s::~ConML_SID_s()
+ {
+ delete type;
+ delete uid;
+ delete drives;
+ delete packageInfo;
+ delete burOptions;
+ delete size;
+ delete transferDataType;
+ delete data;
+ delete moreData;
+ delete dataOwnerStatus;
+ }
+
+CXMLElement* ConML_SID_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLType:
+ CHECK_NO_DUPLICATE ( type );
+ type = new ( ELeave ) pcdata_t();
+ return type;
+
+ case EConMLUID:
+ CHECK_NO_DUPLICATE ( uid )
+ uid = new ( ELeave ) pcdata_t();
+ return uid;
+
+ case EConMLDrives:
+ drives = new ( ELeave ) ConML_Drives_t();
+ return drives;
+
+ case EConMLPackageInfo:
+ CHECK_NO_DUPLICATE ( packageInfo );
+ packageInfo = new ( ELeave ) ConML_PackageInfo_t();
+ return packageInfo;
+
+ case EConMLBUROptions:
+ CHECK_NO_DUPLICATE ( burOptions )
+ burOptions = new ( ELeave ) ConML_BUROptions_t();
+ return burOptions;
+
+ case EConMLSize:
+ CHECK_NO_DUPLICATE ( size );
+ size = new ( ELeave ) pcdata_t();
+ return size;
+
+ case EConMLTransferDataType:
+ CHECK_NO_DUPLICATE ( transferDataType );
+ transferDataType = new ( ELeave ) pcdata_t();
+ return transferDataType;
+
+ case EConMLData:
+ CHECK_NO_DUPLICATE ( data );
+ data = new ( ELeave ) pcdata_t();
+ return data;
+
+ case EConMLMoreData:
+ CHECK_NO_DUPLICATE ( moreData );
+ moreData = new ( ELeave ) pcdata_t();
+ return moreData;
+
+ case EConMLDataOwnerStatus:
+ CHECK_NO_DUPLICATE ( dataOwnerStatus );
+ dataOwnerStatus = new ( ELeave ) pcdata_t();
+ return dataOwnerStatus;
+
+ default:
+ LOGGER_WRITE_1( "ConML_SID_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_SIDList_s
+// -----------------------------------------------------------------------------
+ConML_SIDList_s::ConML_SIDList_s()
+ {
+ }
+
+ConML_SIDList_s::~ConML_SIDList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_DataOwners_s
+// -----------------------------------------------------------------------------
+ConML_DataOwners_s::ConML_DataOwners_s()
+ {
+ }
+
+ConML_DataOwners_s::~ConML_DataOwners_s()
+ {
+ delete sid;
+ }
+
+CXMLElement* ConML_DataOwners_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLSID:
+ return AddSIDL( &sid );
+
+ default:
+ LOGGER_WRITE_1( "ConML_DataOwners_s::BeginElement()\
+ : Unknown element %02x ", aTag);
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Application_s
+// -----------------------------------------------------------------------------
+ConML_Application_s::ConML_Application_s()
+ {
+ }
+
+ConML_Application_s::~ConML_Application_s()
+ {
+ delete name;
+ delete uid;
+ }
+
+CXMLElement* ConML_Application_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name );
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ case EConMLUID:
+ CHECK_NO_DUPLICATE ( uid );
+ uid = new ( ELeave ) pcdata_t();
+ return uid;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Application_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_ApplicationList_s
+// -----------------------------------------------------------------------------
+ConML_ApplicationList_s::ConML_ApplicationList_s()
+ {
+ }
+
+ConML_ApplicationList_s::~ConML_ApplicationList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Applications_s
+// -----------------------------------------------------------------------------
+ConML_Applications_s::ConML_Applications_s()
+ {
+ }
+
+ConML_Applications_s::~ConML_Applications_s()
+ {
+ delete application;
+ }
+
+CXMLElement* ConML_Applications_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLApplication:
+ return AddApplicationL( &application );
+
+ default:
+ LOGGER_WRITE_1( "ConML_DataOwners_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_SupportedMethod_s
+// -----------------------------------------------------------------------------
+ConML_SupportedMethods_s::ConML_SupportedMethods_s()
+ {
+ }
+
+ConML_SupportedMethods_s::~ConML_SupportedMethods_s()
+ {
+ delete install;
+ delete unInstall;
+ delete setInstParams;
+ delete listInstalledApps;
+ delete listDataOwners;
+ delete setBurMode;
+ delete getDataSize;
+ delete requestData;
+ delete supplyData;
+ delete reboot;
+ }
+
+CXMLElement* ConML_SupportedMethods_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLInstall:
+ CHECK_NO_DUPLICATE ( install );
+ install = new ( ELeave ) pcdata_t();
+ return install;
+
+ case EConMLUnInstall:
+ CHECK_NO_DUPLICATE ( unInstall );
+ unInstall = new ( ELeave ) pcdata_t();
+ return unInstall;
+
+ case EConMLListInstalledApps:
+ CHECK_NO_DUPLICATE ( listInstalledApps );
+ listInstalledApps = new ( ELeave ) pcdata_t();
+ return listInstalledApps;
+
+ case EConMLListDataOwners:
+ CHECK_NO_DUPLICATE ( listDataOwners );
+ listDataOwners = new ( ELeave ) pcdata_t();
+ return listDataOwners;
+
+ case EConMLSetBURMode:
+ CHECK_NO_DUPLICATE ( setBurMode );
+ setBurMode = new ( ELeave ) pcdata_t();
+ return setBurMode;
+
+ case EConMLGetDataSize:
+ CHECK_NO_DUPLICATE ( getDataSize );
+ getDataSize = new ( ELeave ) pcdata_t();
+ return getDataSize;
+
+ case EConMLRequestData:
+ CHECK_NO_DUPLICATE ( requestData );
+ requestData = new ( ELeave ) pcdata_t();
+ return requestData;
+
+ case EConMLSupplyData:
+ CHECK_NO_DUPLICATE (supplyData );
+ supplyData = new ( ELeave ) pcdata_t();
+ return supplyData;
+
+ case EConMLReboot:
+ CHECK_NO_DUPLICATE ( reboot );
+ reboot = new ( ELeave ) pcdata_t();
+ return reboot;
+
+ default:
+ LOGGER_WRITE_1( "ConML_SupportedMethods_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_DeviceInfo_s
+// -----------------------------------------------------------------------------
+ConML_DeviceInfo_s::ConML_DeviceInfo_s()
+ {
+ }
+
+ConML_DeviceInfo_s::~ConML_DeviceInfo_s()
+ {
+ delete version;
+ delete supportedMethods;
+ delete maxObjectSize;
+ }
+
+CXMLElement* ConML_DeviceInfo_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLVersion:
+ CHECK_NO_DUPLICATE (version);
+ version = new ( ELeave ) pcdata_t();
+ return version;
+
+ case EConMLSupportedMethods:
+ CHECK_NO_DUPLICATE ( supportedMethods);
+ supportedMethods = new ( ELeave ) ConML_SupportedMethods_t();
+ return supportedMethods;
+
+ case EConMLMaxObjectSize:
+ CHECK_NO_DUPLICATE ( maxObjectSize );
+ maxObjectSize = new ( ELeave ) pcdata_t();
+ return maxObjectSize;
+
+ default:
+ LOGGER_WRITE_1( "ConML_DeviceInfo_s::BeginElement()\
+ : Unknown element %d", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_DeviceInfo_s
+// -----------------------------------------------------------------------------
+ConML_File_s::ConML_File_s()
+ {
+ }
+
+ConML_File_s::~ConML_File_s()
+ {
+ delete name;
+ delete modified;
+ delete size;
+ delete userPerm;
+ }
+
+CXMLElement* ConML_File_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name );
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ case EConMLModified:
+ CHECK_NO_DUPLICATE ( modified );
+ modified = new ( ELeave ) pcdata_t();
+ return modified;
+
+ case EConMLSize:
+ CHECK_NO_DUPLICATE ( size );
+ size = new ( ELeave ) pcdata_t();
+ return size;
+
+ case EConMLUserPerm:
+ CHECK_NO_DUPLICATE ( userPerm );
+ userPerm = new ( ELeave ) pcdata_t();
+ return userPerm;
+
+ default:
+ LOGGER_WRITE_1( "ConML_File_s::BeginElement()\
+ : Unknown element %d", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_FileList_s
+// -----------------------------------------------------------------------------
+ConML_FileList_s::ConML_FileList_s()
+ {
+ }
+
+ConML_FileList_s::~ConML_FileList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Files_s
+// -----------------------------------------------------------------------------
+ConML_Files_s::ConML_Files_s()
+ {
+ }
+
+ConML_Files_s::~ConML_Files_s()
+ {
+ delete file;
+ }
+
+CXMLElement* ConML_Files_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLFile:
+ return AddFileL( &file );
+
+ default:
+ LOGGER_WRITE_1( "ConML_File_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Progress_s
+// -----------------------------------------------------------------------------
+ConML_Progress_s::ConML_Progress_s()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// ~ConML_Progress_s
+// -----------------------------------------------------------------------------
+ConML_Progress_s::~ConML_Progress_s()
+ {
+ delete value;
+ }
+
+CXMLElement* ConML_Progress_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLValue:
+ CHECK_NO_DUPLICATE ( value );
+ value = new ( ELeave ) pcdata_t();
+ return value;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Progress_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Results_s
+// -----------------------------------------------------------------------------
+ConML_Results_s::ConML_Results_s()
+ {
+ }
+
+ConML_Results_s::~ConML_Results_s()
+ {
+ delete complete;
+ delete progress;
+ delete applications;
+ delete dataOwners;
+ delete filename;
+ delete moreData;
+ delete data;
+ delete deviceInfo;
+ delete files;
+ }
+
+CXMLElement* ConML_Results_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLComplete:
+ CHECK_NO_DUPLICATE ( complete );
+ complete = new ( ELeave ) pcdata_t();
+ return complete;
+
+ case EConMLProgress:
+ CHECK_NO_DUPLICATE ( progress );
+ progress = new ( ELeave ) ConML_Progress_t();
+ return progress;
+
+ case EConMLApplications:
+ CHECK_NO_DUPLICATE ( applications );
+ applications = new ( ELeave ) ConML_Applications_t();
+ return applications;
+
+ case EConMLDataOwners:
+ CHECK_NO_DUPLICATE ( dataOwners );
+ dataOwners = new ( ELeave ) ConML_DataOwners_t();
+ return dataOwners;
+
+ case EConMLMoreData:
+ CHECK_NO_DUPLICATE ( moreData );
+ moreData = new ( ELeave ) pcdata_t();
+ return moreData;
+
+ case EConMLData:
+ CHECK_NO_DUPLICATE ( data );
+ data = new ( ELeave ) pcdata_t();
+ return data;
+
+ case EConMLDeviceInfo:
+ CHECK_NO_DUPLICATE ( deviceInfo )
+ deviceInfo = new ( ELeave ) ConML_DeviceInfo_t();
+ return deviceInfo;
+
+ case EConMLFiles:
+ CHECK_NO_DUPLICATE ( files )
+ files = new ( ELeave ) ConML_Files_t();
+ return files;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Results_s::BeginElement()\
+ : Unknown element %02x ", aTag);
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Param_s
+// -----------------------------------------------------------------------------
+ConML_Param_s::ConML_Param_s()
+ {
+ }
+
+ConML_Param_s::~ConML_Param_s()
+ {
+ delete name;
+ delete value;
+ }
+
+CXMLElement* ConML_Param_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name );
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ case EConMLValue:
+ CHECK_NO_DUPLICATE ( value );
+ value = new ( ELeave ) pcdata_t();
+ return value;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Param_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_ParamList_s
+// -----------------------------------------------------------------------------
+ConML_ParamList_s::ConML_ParamList_s()
+ {
+ }
+
+ConML_ParamList_s::~ConML_ParamList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_InstParams_s
+// -----------------------------------------------------------------------------
+ConML_InstParams_s::ConML_InstParams_s()
+ {
+ }
+
+ConML_InstParams_s::~ConML_InstParams_s()
+ {
+ delete param;
+ }
+
+CXMLElement* ConML_InstParams_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLParam:
+ return AddParamL( ¶m );
+
+ default:
+ LOGGER_WRITE_1( "ConML_InstParams_s::BeginElement()\
+ : Unknown element %02x ", aTag);
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_UnInstall_s
+// -----------------------------------------------------------------------------
+ConML_UnInstall_s::ConML_UnInstall_s()
+ {
+ }
+
+ConML_UnInstall_s::~ConML_UnInstall_s()
+ {
+ delete applications;
+ delete instParams;
+ delete results;
+ }
+
+CXMLElement* ConML_UnInstall_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLApplications:
+ CHECK_NO_DUPLICATE ( applications );
+ applications = new ( ELeave ) ConML_Applications_t();
+ return applications;
+
+ case EConMLInstParams:
+ CHECK_NO_DUPLICATE ( instParams );
+ instParams = new ( ELeave ) ConML_InstParams_t();
+ return instParams;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_UnInstall_s::BeginElement()\
+ : Unknown element %02x ", aTag);
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// ConML_ListDataOwners_s
+// -----------------------------------------------------------------------------
+ConML_ListDataOwners_s::ConML_ListDataOwners_s()
+ {
+ }
+
+ConML_ListDataOwners_s::~ConML_ListDataOwners_s()
+ {
+ delete results;
+ }
+
+CXMLElement* ConML_ListDataOwners_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_ListDataOwners_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Install_s
+// -----------------------------------------------------------------------------
+ConML_Install_s::ConML_Install_s()
+ {
+ }
+
+ConML_Install_s::~ConML_Install_s()
+ {
+ delete name;
+ delete instParams;
+ delete results;
+ }
+
+CXMLElement* ConML_Install_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLName:
+ CHECK_NO_DUPLICATE ( name );
+ name = new ( ELeave ) pcdata_t();
+ return name;
+
+ case EConMLInstParams:
+ CHECK_NO_DUPLICATE ( instParams );
+ instParams = new ( ELeave ) ConML_InstParams_t();
+ return instParams;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Install_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_ListInstalledApps
+// -----------------------------------------------------------------------------
+ConML_ListInstalledApps_s::ConML_ListInstalledApps_s()
+ {
+ }
+
+ConML_ListInstalledApps_s::~ConML_ListInstalledApps_s()
+ {
+ delete drives;
+ delete all;
+ delete results;
+ }
+
+CXMLElement* ConML_ListInstalledApps_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLDrives:
+ CHECK_NO_DUPLICATE ( drives );
+ drives = new ( ELeave ) ConML_Drives_t();
+ return drives;
+
+ case EConMLAll:
+ CHECK_NO_DUPLICATE ( all );
+ all = new ( ELeave ) pcdata_t();
+ return all;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_ListInstalledApps_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_SetBURMode_s
+// -----------------------------------------------------------------------------
+ConML_SetBURMode_s::ConML_SetBURMode_s()
+ {
+ }
+
+ConML_SetBURMode_s::~ConML_SetBURMode_s()
+ {
+ delete drives;
+ delete partialType;
+ delete incType;
+ delete results;
+ }
+
+CXMLElement* ConML_SetBURMode_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLDrives:
+ drives = new ( ELeave ) ConML_Drives_t();
+ return drives;
+
+ case EConMLPartialType:
+ CHECK_NO_DUPLICATE ( partialType );
+ partialType = new ( ELeave ) pcdata_t();
+ return partialType;
+
+ case EConMLIncType:
+ CHECK_NO_DUPLICATE ( incType );
+ incType = new ( ELeave ) pcdata_t();
+ return incType;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_SetBURMode_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_GetDataSize_s
+// -----------------------------------------------------------------------------
+ConML_GetDataSize_s::ConML_GetDataSize_s()
+ {
+ }
+
+ConML_GetDataSize_s::~ConML_GetDataSize_s()
+ {
+ delete dataOwners;
+ delete results;
+ }
+
+CXMLElement* ConML_GetDataSize_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLDataOwners:
+ CHECK_NO_DUPLICATE ( dataOwners );
+ dataOwners = new ( ELeave ) ConML_DataOwners_t();
+ return dataOwners;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_GetDataSize_s::BeginElement()\
+ : Unknown element %02x ", aTag);
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_RequestData_s
+// -----------------------------------------------------------------------------
+ConML_RequestData_s::ConML_RequestData_s()
+ {
+ }
+
+ConML_RequestData_s::~ConML_RequestData_s()
+ {
+ delete sid;
+ delete results;
+ }
+
+CXMLElement* ConML_RequestData_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLSID:
+ return AddSIDL( &sid );
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_RequestData_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_UpdateDeviceInfo_s
+// -----------------------------------------------------------------------------
+ConML_UpdateDeviceInfo_s::ConML_UpdateDeviceInfo_s()
+ {
+ }
+
+ConML_UpdateDeviceInfo_s::~ConML_UpdateDeviceInfo_s()
+ {
+ delete deviceInfo;
+ delete results;
+ }
+
+CXMLElement* ConML_UpdateDeviceInfo_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLDeviceInfo:
+ CHECK_NO_DUPLICATE ( deviceInfo )
+ deviceInfo = new ( ELeave ) ConML_DeviceInfo_t();
+ return deviceInfo;
+
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results )
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_UpdateDeviceInfo_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_ListPublicFiles_s
+// -----------------------------------------------------------------------------
+ConML_ListPublicFiles_s::ConML_ListPublicFiles_s()
+ {
+ }
+
+ConML_ListPublicFiles_s::~ConML_ListPublicFiles_s()
+ {
+ delete results;
+ delete sid;
+ }
+
+CXMLElement* ConML_ListPublicFiles_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ case EConMLSID:
+ return AddSIDL ( &sid );
+
+ default:
+ LOGGER_WRITE_1( "ConML_ListPublicFiles_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Task_s
+// -----------------------------------------------------------------------------
+ConML_GetDataOwnerStatus_s::ConML_GetDataOwnerStatus_s()
+ {
+ }
+
+ConML_GetDataOwnerStatus_s::~ConML_GetDataOwnerStatus_s()
+ {
+ delete dataOwners;
+ delete results;
+ }
+
+CXMLElement* ConML_GetDataOwnerStatus_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ case EConMLDataOwners:
+ CHECK_NO_DUPLICATE ( dataOwners );
+ dataOwners = new ( ELeave ) ConML_DataOwners_t();
+ return dataOwners;
+
+ default:
+ LOGGER_WRITE_1( "ConML_GetDataOwnerStatus_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_GetMetadata_s
+// -----------------------------------------------------------------------------
+ConML_GetMetadata_s::ConML_GetMetadata_s()
+ {
+ }
+
+ConML_GetMetadata_s::~ConML_GetMetadata_s()
+ {
+ delete filename;
+ delete results;
+ }
+
+CXMLElement* ConML_GetMetadata_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ case EConMLFilename:
+ CHECK_NO_DUPLICATE ( filename );
+ filename = new ( ELeave ) pcdata_t();
+ return filename;
+
+ default:
+ LOGGER_WRITE_1( "ConML_GetMetadata_s::\
+ BeginElement() : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+
+// -----------------------------------------------------------------------------
+// ConML_Reboot_s
+// -----------------------------------------------------------------------------
+ConML_Reboot_s::ConML_Reboot_s()
+ {
+ }
+
+ConML_Reboot_s::~ConML_Reboot_s()
+ {
+ delete results;
+ }
+
+CXMLElement* ConML_Reboot_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLResults:
+ CHECK_NO_DUPLICATE ( results );
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Reboot_s::BeginElementL()\
+ : Unknown element %d ", aTag );
+ User::Leave ( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Task_s
+// -----------------------------------------------------------------------------
+ConML_Task_s::ConML_Task_s()
+ {
+ }
+
+ConML_Task_s::~ConML_Task_s()
+ {
+ delete id;
+ delete install;
+ delete unInstall;
+ delete listInstalledApps;
+ delete listDataOwners;
+ delete setBurMode;
+ delete getDataSize;
+ delete requestData;
+ delete updateDeviceInfo;
+ delete listPublicFiles;
+ delete getDataOwnerStatus;
+ delete supplyData;
+ delete reboot;
+ delete getMetadata;
+ }
+
+CXMLElement* ConML_Task_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLID:
+ CHECK_NO_DUPLICATE ( id )
+ id = new ( ELeave ) pcdata_t();
+ return id;
+
+ case EConMLInstall:
+ CHECK_NO_DUPLICATE ( install );
+ install = new ( ELeave ) ConML_Install_t();
+ return install;
+
+ case EConMLUnInstall:
+ CHECK_NO_DUPLICATE ( unInstall );
+ unInstall = new ( ELeave ) ConML_UnInstall_t();
+ return unInstall;
+
+ case EConMLListInstalledApps:
+ CHECK_NO_DUPLICATE ( listInstalledApps );
+ listInstalledApps = new ( ELeave ) ConML_ListInstalledApps_t();
+ return listInstalledApps;
+
+ case EConMLListDataOwners:
+ CHECK_NO_DUPLICATE ( listDataOwners );
+ listDataOwners = new ( ELeave ) ConML_ListDataOwners_t();
+ return listDataOwners;
+
+ case EConMLSetBURMode:
+ CHECK_NO_DUPLICATE ( setBurMode );
+ setBurMode = new ( ELeave ) ConML_SetBURMode_t();
+ return setBurMode;
+
+ case EConMLGetDataSize:
+ CHECK_NO_DUPLICATE ( getDataSize );
+ getDataSize = new ( ELeave ) ConML_GetDataSize_t();
+ return getDataSize;
+
+ case EConMLRequestData:
+ CHECK_NO_DUPLICATE ( requestData )
+ requestData = new ( ELeave ) ConML_RequestData_t();
+ return requestData;
+
+ case EConMLUpdateDeviceInfo:
+ CHECK_NO_DUPLICATE ( updateDeviceInfo );
+ updateDeviceInfo = new ( ELeave ) ConML_UpdateDeviceInfo_t();
+ return updateDeviceInfo;
+
+ case EConMLListPublicFiles:
+ CHECK_NO_DUPLICATE ( listPublicFiles );
+ listPublicFiles = new ( ELeave ) ConML_ListPublicFiles_t();
+ return listPublicFiles;
+
+ case EConMLGetDataOwnerStatus:
+ CHECK_NO_DUPLICATE ( getDataOwnerStatus );
+ getDataOwnerStatus = new ( ELeave ) ConML_GetDataOwnerStatus_t();
+ return getDataOwnerStatus;
+
+ case EConMLSupplyData:
+ CHECK_NO_DUPLICATE ( supplyData );
+ supplyData = new ( ELeave ) ConML_SupplyData_t();
+ return supplyData;
+
+ case EConMLReboot:
+ CHECK_NO_DUPLICATE ( reboot );
+ reboot = new ( ELeave ) ConML_Reboot_t();
+ return reboot;
+ case EConMLGetMetadata:
+ CHECK_NO_DUPLICATE ( getMetadata );
+ getMetadata = new ( ELeave ) ConML_GetMetadata_t();
+ return getMetadata;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Task_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_TaskList_s
+// -----------------------------------------------------------------------------
+ConML_TaskList_s::ConML_TaskList_s()
+ {
+ }
+
+ConML_TaskList_s::~ConML_TaskList_s()
+ {
+ delete data;
+ delete next;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Status_s
+// -----------------------------------------------------------------------------
+ConML_Status_s::ConML_Status_s()
+ {
+ }
+
+ConML_Status_s::~ConML_Status_s()
+ {
+ delete task;
+ }
+
+CXMLElement* ConML_Status_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLTask:
+ return AddTaskL( &task );
+
+ default:
+ LOGGER_WRITE_1( "ConML_Status_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Cancel_s
+// -----------------------------------------------------------------------------
+ConML_Cancel_s::ConML_Cancel_s()
+ {
+ }
+
+ConML_Cancel_s::~ConML_Cancel_s()
+ {
+ delete id;
+ delete all;
+ }
+
+CXMLElement* ConML_Cancel_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLID:
+ CHECK_NO_DUPLICATE ( id );
+ id = new ( ELeave ) pcdata_t();
+ return id;
+
+ case EConMLAll:
+ CHECK_NO_DUPLICATE ( all );
+ all = new ( ELeave ) pcdata_t();
+ return all;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Cancel_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_GetStatus_s
+// -----------------------------------------------------------------------------
+ConML_GetStatus_s::ConML_GetStatus_s()
+ {
+ }
+
+ConML_GetStatus_s::~ConML_GetStatus_s()
+ {
+ delete id;
+ delete all;
+ }
+
+CXMLElement* ConML_GetStatus_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLID:
+ CHECK_NO_DUPLICATE ( id );
+ id = new ( ELeave ) pcdata_t();
+ return id;
+
+ case EConMLAll:
+ CHECK_NO_DUPLICATE ( all );
+ all = new ( ELeave ) pcdata_t();
+ return all;
+
+ default:
+ LOGGER_WRITE_1( "ConML_GetStatus_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_SupplyData_s
+// -----------------------------------------------------------------------------
+ConML_SupplyData_s::ConML_SupplyData_s()
+ {
+ }
+
+ConML_SupplyData_s::~ConML_SupplyData_s()
+ {
+ delete sid;
+ delete results;
+ }
+
+CXMLElement* ConML_SupplyData_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch ( aTag )
+ {
+ case EConMLSID:
+ return AddSIDL ( &sid );
+
+ case EConMLResults:
+ results = new ( ELeave ) ConML_Results_t();
+ return results;
+
+ default:
+ LOGGER_WRITE_1( "ConML_SupplyData_s::BeginElement() :\
+ Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_Execute_
+// -----------------------------------------------------------------------------
+ConML_Execute_s::ConML_Execute_s()
+ {
+ }
+
+ConML_Execute_s::~ConML_Execute_s()
+ {
+ delete id;
+ delete install;
+ delete unInstall;
+ delete listInstalledApps;
+ delete listDataOwners;
+ delete setBurMode;
+ delete getDataSize;
+ delete requestData;
+ delete updateDeviceInfo;
+ delete listPublicFiles;
+ delete supplyData;
+ delete reboot;
+ delete getDataOwnerStatus;
+ delete getMetadata;
+ }
+
+CXMLElement* ConML_Execute_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+
+ switch ( aTag )
+ {
+ case EConMLID:
+ CHECK_NO_DUPLICATE ( id );
+ id = new ( ELeave ) pcdata_t();
+ return id;
+
+ case EConMLInstall:
+ CHECK_NO_DUPLICATE ( install );
+ install = new ( ELeave ) ConML_Install_t();
+ return install;
+
+ case EConMLUpdateDeviceInfo:
+ CHECK_NO_DUPLICATE (updateDeviceInfo);
+ updateDeviceInfo = new ( ELeave ) ConML_UpdateDeviceInfo_t();
+ return updateDeviceInfo;
+
+ case EConMLUnInstall:
+ CHECK_NO_DUPLICATE ( unInstall );
+ unInstall = new ( ELeave ) ConML_UnInstall_t();
+ return unInstall;
+
+ case EConMLListInstalledApps:
+ CHECK_NO_DUPLICATE ( listInstalledApps );
+ listInstalledApps = new ( ELeave ) ConML_ListInstalledApps_t();
+ return listInstalledApps;
+
+ case EConMLListDataOwners:
+ CHECK_NO_DUPLICATE ( listDataOwners );
+ listDataOwners = new ( ELeave ) ConML_ListDataOwners_t();
+ return listDataOwners;
+
+ case EConMLSetBURMode:
+ CHECK_NO_DUPLICATE ( setBurMode );
+ setBurMode = new ( ELeave ) ConML_SetBURMode_t();
+ return setBurMode;
+
+ case EConMLGetDataSize:
+ CHECK_NO_DUPLICATE ( getDataSize );
+ getDataSize = new ( ELeave ) ConML_GetDataSize_t();
+ return getDataSize;
+
+ case EConMLRequestData:
+ CHECK_NO_DUPLICATE ( requestData );
+ requestData = new ( ELeave ) ConML_RequestData_t();
+ return requestData;
+
+ case EConMLListPublicFiles:
+ CHECK_NO_DUPLICATE ( listPublicFiles );
+ listPublicFiles = new ( ELeave ) ConML_ListPublicFiles_t();
+ return listPublicFiles;
+
+ case EConMLSupplyData:
+ CHECK_NO_DUPLICATE ( supplyData );
+ supplyData = new ( ELeave ) ConML_SupplyData_t();
+ return supplyData;
+
+ case EConMLReboot:
+ CHECK_NO_DUPLICATE ( reboot );
+ reboot = new ( ELeave ) pcdata_t();
+ return reboot;
+
+ case EConMLGetDataOwnerStatus:
+ CHECK_NO_DUPLICATE ( getDataOwnerStatus );
+ getDataOwnerStatus = new ( ELeave ) ConML_GetDataOwnerStatus_t();
+ return getDataOwnerStatus;
+
+ case EConMLGetMetadata:
+ CHECK_NO_DUPLICATE ( getMetadata );
+ getMetadata = new ( ELeave ) ConML_GetMetadata_t();
+ return getMetadata;
+
+ default:
+ LOGGER_WRITE_1( "ConML_Execute_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// ConML_ConML_s
+// -----------------------------------------------------------------------------
+ConML_ConML_s::ConML_ConML_s()
+ {
+ }
+
+ConML_ConML_s::~ConML_ConML_s()
+ {
+ delete execute;
+ delete getStatus;
+ delete cancel;
+ delete status;
+ }
+
+CXMLElement* ConML_ConML_s::BeginElementL(
+ TUint8 aTag, const TXMLElementParams& /*aParams*/ )
+ {
+ switch( aTag )
+ {
+ case EConMLExecute:
+ CHECK_NO_DUPLICATE( execute );
+ execute = new (ELeave) ConML_Execute_t();
+ return execute;
+
+ case EConMLGetStatus:
+ CHECK_NO_DUPLICATE ( getStatus );
+ getStatus = new ( ELeave) ConML_GetStatus_t();
+ return getStatus;
+
+ case EConMLCancel:
+ CHECK_NO_DUPLICATE ( cancel );
+ cancel = new ( ELeave ) ConML_Cancel_t();
+ return cancel;
+
+ case EConMLStatus:
+ CHECK_NO_DUPLICATE ( status )
+ status = new ( ELeave ) ConML_Status_t();
+ return status;
+
+ default:
+ LOGGER_WRITE_1( "ConML_ConML_s::BeginElement()\
+ : Unknown element %02x ", aTag );
+ User::Leave( KWBXMLParserErrorInvalidTag );
+ }
+ return KErrNone;
+ }
+
+CXMLElement::TAction ConML_ConML_s::EndElementL( TAny* aCallbacks, TUint8 aTag )
+ {
+ switch( aTag)
+ {
+ case EConML:
+ ((MWBXMLConMLCallback*) aCallbacks)->ConMLL(this);
+ return EPopAndDestroy;
+
+ default:
+ return EPop;
+ }
+ }
+
+TBool ConML_ConML_s::NeedsCleanup() const
+ {
+ return ETrue;
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlgenerator.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,1285 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include "sconconmlgenerator.h"
+#include "sconconmlhandlererror.h"
+#include "sconconmldtd.h"
+#include "sconxmlelement.h"
+#include "debug.h"
+
+// -----------------------------------------------------------------------------
+// CSConConMLGenerator
+// -----------------------------------------------------------------------------
+CSConConMLGenerator::CSConConMLGenerator()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// ~CSConConMLGenerator
+// -----------------------------------------------------------------------------
+CSConConMLGenerator::~CSConConMLGenerator()
+ {
+ if (iCmdStack)
+ {
+ iCmdStack->Reset();
+ delete iCmdStack;
+ iCmdStack = NULL;
+ }
+
+ if ( iWBXMLWorkspace )
+ {
+ delete iWBXMLWorkspace;
+ iWBXMLWorkspace = NULL;
+ }
+
+ if ( iXMLWorkspace )
+ {
+ delete iXMLWorkspace;
+ iXMLWorkspace = NULL;
+ }
+
+ if (iCleanupStack)
+ {
+ iCleanupStack->ResetAndDestroy();
+ delete iCleanupStack;
+ iCleanupStack = NULL;
+ }
+
+ iElemStack.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// NewL
+// -----------------------------------------------------------------------------
+CSConConMLGenerator* CSConConMLGenerator::NewL ()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::NewL()" );
+ CSConConMLGenerator* self = new ( ELeave ) CSConConMLGenerator();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ LOGGER_LEAVEFN( "CSConConMLGenerator::NewL()" );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// ConstructL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::ConstructL()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::ConstructL()" );
+ iCmdStack = CXMLStack<CXMLElement>::NewL();
+ iCleanupStack = CXMLStack<CXMLElement>::NewL();
+ iWBXMLWorkspace = CXMLWorkspace::NewL();
+ iXMLWorkspace = CXMLWorkspace::NewL();
+ LOGGER_LEAVEFN( "CSConConMLGenerator::ConstructL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// SetCallbacks
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::SetCallback ( MWBXMLConMLCallback* aCallback )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::SetCallbacks()" );
+ iCallback = aCallback;
+ LOGGER_LEAVEFN( "CSConConMLGenerator::SetCallbacks()" );
+ }
+
+// -----------------------------------------------------------------------------
+// StartDocument
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::StartDocument(
+ TUint8 /*aVersion*/, TInt32 /*aPublicId*/, TUint32 /*aCharset*/ )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" );
+ iCmdStack->Reset();
+ LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// StartDocument
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::StartDocument(
+ TUint8 /*aVersion*/, const TDesC8& /*aPublicIdStr*/, TUint32 /*aCharset*/ )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" );
+ iCmdStack->Reset();
+ LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// StartElementL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::StartElementL( TWBXMLTag aTag )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::StartElementL()" );
+ if( iCmdStack->Top() != 0 )
+ {
+ AddElement(iCmdStack->Top()->BeginElementL(
+ aTag, TXMLElementParams(iCallback, iCmdStack, iCleanupStack ) ) );
+ }
+ else
+ {
+ if( aTag == EConML )
+ {
+ AddElement(new (ELeave) ConML_ConML_t());
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConConMLGenerator::StartElementL() : Leave KWBXMLParserErrorInvalidTag" );
+ User::Leave(KWBXMLParserErrorInvalidTag);
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::StartElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AddElement
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AddElement( CXMLElement* aElement )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AddElement()" );
+ if( aElement )
+ {
+ iCmdStack->Push(aElement);
+ if( aElement->NeedsCleanup() )
+ {
+ iCleanupStack->Push(aElement);
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AddElement()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CharactersL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::CharactersL( const TDesC8& aBuffer )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::CharactersL()" );
+ if( iCmdStack->Top() != 0 )
+ {
+ iCmdStack->Top()->SetDataL(aBuffer);
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConConMLGenerator::CharactersL() : Leave KWBXMLParserErrorInvalidTag" );
+ User::Leave(KWBXMLParserErrorInvalidTag);
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::CharactersL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// EndElementL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::EndElementL( TWBXMLTag aTag )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" );
+ if( iCmdStack->Top() != 0 )
+ {
+ CXMLElement::TAction action = iCmdStack->Top()->EndElementL(
+ iCallback, aTag );
+ if( action != CXMLElement::ENone )
+ {
+ CXMLElement* elem = iCmdStack->Pop();
+ if( iCleanupStack->Top() == elem )
+ {
+ iCleanupStack->Pop();
+ }
+ if( action == CXMLElement::EPopAndDestroy )
+ {
+ delete elem;
+ }
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// WriteMUint32L
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::WriteMUint32L( TUint32 aValue )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::WriteMUint32L()" );
+ TUint8 temp[5];
+ TInt i(4);
+
+ temp[i--] = TUint8(aValue & 0x7F);
+ aValue >>= 7;
+ while( aValue > 0 )
+ {
+ temp[i--] = TUint8((aValue & 0x7F) | 0x80);
+ aValue >>= 7;
+ }
+
+ while( i < 4 )
+ {
+ iWBXMLWorkspace->WriteL(temp[++i]);
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::WriteMUint32L()" );
+ }
+
+// -----------------------------------------------------------------------------
+// WriteOpaqueDataL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::WriteOpaqueDataL( const TDesC8& aData )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::WriteOpaqueDataL()" );
+ iWBXMLWorkspace->WriteL( OPAQUE );
+ WriteMUint32L( aData.Size() );
+ iWBXMLWorkspace->WriteL( aData );
+ iXMLWorkspace->WriteL( aData );
+ LOGGER_LEAVEFN( "CSConConMLGenerator::WriteOpaqueDataL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// WriteInlineStringL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::WriteInlineStringL( const TDesC8& aData )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::WriteInlineStringL()" );
+ iWBXMLWorkspace->WriteL( STR_I );
+ iWBXMLWorkspace->WriteL( aData );
+ iWBXMLWorkspace->WriteL( 0 );
+ iXMLWorkspace->WriteL( aData );
+ LOGGER_LEAVEFN( "CSConConMLGenerator::WriteInlineStringL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// IndentL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::IndentL()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::IndentL()" );
+ for( TInt i = 0; i < iElemStack.Count() + iInitialIndentLevel; i++ )
+ {
+ iXMLWorkspace->WriteL(KXMLIndent());
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::IndentL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// TranslateElement
+// -----------------------------------------------------------------------------
+TPtrC8 CSConConMLGenerator::TranslateElement( TUint8 aElement )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::TranslateElement()" );
+ TPtrC8 buf( KConMLElements );
+ while( aElement-- )
+ {
+ TInt pos = buf.Find(KXMLElemenentSeparator());
+ if( pos == KErrNotFound )
+ {
+ return TPtrC8();
+ }
+ buf.Set(buf.Right(buf.Length() - pos - 1));
+ }
+
+ TInt pos = buf.Find(KXMLElemenentSeparator());
+
+ if( pos != KErrNotFound )
+ {
+ buf.Set(buf.Left(pos));
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::TranslateElement()" );
+ return buf;
+ }
+
+// -----------------------------------------------------------------------------
+// EndDocument
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::EndDocument()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::EndDocument()" );
+ LOGGER_LEAVEFN( "CSConConMLGenerator::EndDocument()" );
+ }
+
+
+// -----------------------------------------------------------------------------
+// GenerateConMLDocument
+// -----------------------------------------------------------------------------
+TInt CSConConMLGenerator::GenerateConMLDocument ( ConML_ConMLPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::GenerateConMLDocument()" );
+ iWBXMLWorkspace->Reset();
+ iWBXMLWorkspace->BeginTransaction();
+ iXMLWorkspace->Reset();
+ iXMLWorkspace->BeginTransaction();
+ TRAPD(result, AppendConMLL(aContent));
+ LOGGER_WRITE_1( "CSConConMLGenerator::GenerateConMLDocument()\
+ : returned %d", result );
+ return HandleResult(result);
+ }
+
+// -----------------------------------------------------------------------------
+// AppendConMLL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendConMLL( ConML_ConMLPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendConMLL()" );
+ BeginDocumentL(KSConConMLVersion, KSConConMLPublicId, KSConConMLUTF8);
+ BeginElementL(EConML, ETrue);
+ AppendExecuteL( aContent->execute );
+ AppendGetStatusL( aContent->getStatus );
+ AppendCancelL( aContent->cancel );
+ AppendStatusL( aContent->status );
+ EndElementL(); // EConML
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendConMLL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendExecuteL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendExecuteL( ConML_ExecutePtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendExecuteL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLExecute, ETrue );
+ AppendPCDataL( EConMLID, aContent->id );
+ AppendInstallL( aContent->install );
+ AppendUnInstallL( aContent->unInstall );
+ AppendListInstalledAppsL( aContent->listInstalledApps );
+ AppendListDataOwnersL( aContent->listDataOwners );
+ AppendSetBURModeL( aContent->setBurMode );
+ AppendGetDataSizeL( aContent->getDataSize );
+ AppendRequestDataL( aContent->requestData );
+ AppendUpdateDeviceInfoL( aContent->updateDeviceInfo );
+ AppendListPublicFilesL( aContent->listPublicFiles );
+ AppendSupplyDataL( aContent->supplyData );
+ AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus );
+ AppendGetMetadataL( aContent->getMetadata );
+
+ if ( aContent->reboot )
+ {
+ BeginElementL( EConMLReboot );
+ }
+ EndElementL(); // EConMLExecute
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendExecuteL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendSupplyDataL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendSupplyDataL( ConML_SupplyDataPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupplyDataL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLSupplyData, ETrue );
+ AppendSIDListL( aContent->sid );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLSupplyData
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupplyDataL()" );
+ }
+// -----------------------------------------------------------------------------
+// AppendInstallL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendInstallL( ConML_InstallPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstallL()" );
+ if ( aContent)
+ {
+ BeginElementL( EConMLInstall, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ if ( aContent->instParams)
+ {
+ if ( aContent->instParams->param )
+ {
+ AppendInstParamsL( aContent->instParams );
+ }
+ else
+ {
+ BeginElementL( EConMLInstParams );
+ }
+ }
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLInstall
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstallL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendCancelL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendCancelL ( ConML_CancelPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendCancelL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLCancel, ETrue );
+ AppendPCDataL ( EConMLID, aContent->id );
+ AppendPCDataL( EConMLAll, aContent->all);
+ EndElementL(); // EConMLCancel
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendCancelL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendStatusL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendStatusL ( ConML_StatusPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendStatusL()" );
+ if ( aContent )
+ {
+ if ( aContent->task )
+ {
+ BeginElementL( EConMLStatus, ETrue );
+ AppendTaskListL( aContent->task );
+ EndElementL(); // EConMLStatus
+ }
+ else
+ {
+ BeginElementL( EConMLStatus );
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendStatusL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendGetStatusL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendGetStatusL( ConML_GetStatusPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLGetStatus, ETrue );
+ AppendPCDataL( EConMLID, aContent->id);
+ if ( aContent->all )
+ {
+ BeginElementL( EConMLAll );
+ }
+ EndElementL(); // EConMLGetStatus
+ }
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendRebootL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendRebootL( ConML_RebootPtr_t aContent )
+ {
+ if ( aContent )
+ {
+ BeginElementL( EConMLReboot, ETrue );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLReboot
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// AppendTaskL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendTaskL( ConML_TaskPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLTask, ETrue );
+ AppendPCDataL( EConMLID, aContent->id );
+ AppendInstallL(aContent->install );
+ AppendUnInstallL( aContent->unInstall );
+ AppendListInstalledAppsL ( aContent->listInstalledApps );
+ AppendListDataOwnersL ( aContent->listDataOwners );
+ AppendSetBURModeL ( aContent->setBurMode );
+ AppendGetDataSizeL ( aContent->getDataSize );
+ AppendRequestDataL ( aContent->requestData );
+ AppendUpdateDeviceInfoL ( aContent->updateDeviceInfo);
+ AppendListPublicFilesL ( aContent->listPublicFiles );
+ AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus );
+ AppendSupplyDataL( aContent->supplyData );
+ AppendRebootL( aContent->reboot );
+ AppendGetMetadataL( aContent->getMetadata );
+ EndElementL();
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendTaskListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendTaskListL( ConML_TaskListPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskListL()" );
+ for ( ConML_TaskListPtr_t p = aContent; p && p->data; p=p->next )
+ {
+ AppendTaskL( p->data );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendListInstalledAppsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendListInstalledAppsL (
+ ConML_ListInstalledAppsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendListInstalledAppsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLListInstalledApps, ETrue );
+ AppendDrivesL( aContent->drives );
+ if ( aContent ->all )
+ {
+ BeginElementL( EConMLAll );
+ }
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLListInstalledApps
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListInstalledAppsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendListDataOwnersL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendListDataOwnersL (
+ ConML_ListDataOwnersPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendListDataOwnersL()" );
+ if ( aContent )
+ {
+ if ( aContent->results )
+ {
+ BeginElementL( EConMLListDataOwners, ETrue );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLListDataOwners
+ }
+ else
+ {
+ BeginElementL( EConMLListDataOwners );
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListDataOwnersL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLGanerator::AppendBUROptionsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendBUROptionsL( ConML_BUROptionsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendBUROptionsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLBUROptions, ETrue );
+ if ( aContent->requiresReboot )
+ {
+ BeginElementL( EConMLRequiresReboot );
+ }
+ if ( aContent->hasFiles )
+ {
+ AppendPCDataL( EConMLHasFiles, aContent->hasFiles );
+ }
+ if ( aContent->supportsInc )
+ {
+ BeginElementL( EConMLSupportsInc );
+ }
+ if ( aContent->delayToPrepareData )
+ {
+ BeginElementL( EConMLDelayToPrepareData );
+ }
+ EndElementL(); // EConMLBUROptions
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendBUROptionsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendSetBURModeL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendSetBURModeL( ConML_SetBURModePtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendSetBURModeL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLSetBURMode, ETrue );
+ AppendDrivesL( aContent->drives );
+ AppendPCDataL( EConMLPartialType, aContent->partialType );
+ AppendPCDataL( EConMLIncType, aContent->incType );
+ AppendResultsL( aContent->results );
+ EndElementL(); //EConMLSetBURMode
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSetBURModeL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendUnInstallL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendUnInstallL( ConML_UnInstallPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendUnInstallL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLUnInstall, ETrue );
+ AppendApplicationsL( aContent->applications );
+ AppendInstParamsL( aContent->instParams );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLUnInstall
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUnInstallL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendGetDataSizeL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendGetDataSizeL( ConML_GetDataSizePtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetDataSizeL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLGetDataSize, ETrue );
+ AppendDataOwnersL( aContent->dataOwners );
+ AppendResultsL( aContent->results );
+ EndElementL(); //EConMLGetDataSize
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendGetDataSizeL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendRequestDataL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendRequestDataL( ConML_RequestDataPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendRequestDataL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLRequestData, ETrue );
+ AppendSIDListL( aContent->sid );
+ AppendResultsL( aContent->results );
+ EndElementL();//EConMLRequestData
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendRequestDataL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendUpdateDeviceInfoL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendUpdateDeviceInfoL(
+ ConML_UpdateDeviceInfoPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" );
+ if ( aContent )
+ {
+ BeginElementL(EConMLUpdateDeviceInfo, ETrue);
+ AppendDeviceInfoL( aContent-> deviceInfo );
+ AppendResultsL( aContent->results );
+ EndElementL();// EConMLUpdateDeviceInfo
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendListPublicFilesL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendListPublicFilesL(
+ ConML_ListPublicFilesPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendListPublicFilesL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLListPublicFiles, ETrue );
+ AppendSIDListL ( aContent->sid );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLListPublicFiles
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListPublicFilesL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendApplicationL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendApplicationL( ConML_ApplicationPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationL()" );
+ if ( aContent )
+ {
+ BeginElementL(EConMLApplication, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ AppendPCDataL( EConMLUID, aContent->uid );
+ EndElementL(); //EConMLApplication
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendApplicationListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendApplicationListL(
+ ConML_ApplicationListPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationListL()" );
+ for ( ConML_ApplicationListPtr_t p = aContent; p && p->data; p = p->next )
+ {
+ AppendApplicationL( p->data );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendApplicationsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendApplicationsL(
+ ConML_ApplicationsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLApplications, ETrue );
+ AppendApplicationListL( aContent->application );
+ EndElementL(); // EConMLApplications
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendParamL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendParamL( ConML_ParamPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLParam, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ AppendPCDataL( EConMLValue, aContent->value );
+ EndElementL(); // EConMLParam
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendParamListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendParamListL( ConML_ParamListPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamListL()" );
+ for ( ConML_ParamListPtr_t p = aContent; p && p->data; p = p->next )
+ {
+ AppendParamL( p-> data );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendInstParamsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendInstParamsL( ConML_InstParamsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstParamsLionsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLInstParams, ETrue );
+ AppendParamListL( aContent->param );
+ EndElementL(); //EConMLInstParams
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstParamsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendProgressL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendProgressL( ConML_ProgressPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendProgressL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLProgress, ETrue );
+ AppendPCDataL( EConMLValue, aContent->value );
+ EndElementL(); // EconMLProgress
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendProgressL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendResultsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendResultsL( ConML_ResultsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendResultsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLResults, ETrue );
+ if ( aContent->complete )
+ {
+ BeginElementL( EConMLComplete );
+ }
+ AppendProgressL( aContent->progress );
+ AppendApplicationsL( aContent->applications );
+ AppendDataOwnersL( aContent->dataOwners );
+ if ( aContent->filename )
+ {
+ AppendPCDataL( EConMLFilename, aContent->filename );
+ }
+ AppendPCDataL( EConMLData, aContent->data );
+ if ( aContent->moreData )
+ {
+ BeginElementL( EConMLMoreData );
+ }
+ AppendDeviceInfoL( aContent->deviceInfo );
+ AppendFilesL( aContent->files );
+ EndElementL(); //EConMLResults
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendResultsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendDriveL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendDriveL( ConML_DrivePtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLDrive, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ EndElementL(); //EConMLDrive
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendDriveListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendDriveListL( ConML_DriveListPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveListL()" );
+ for ( ConML_DriveListPtr_t p = aContent; p && p->data; p=p->next )
+ {
+ AppendDriveL( p->data );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendDrivesL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendDrivesL( ConML_DrivesPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDrivesL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLDrives, ETrue );
+ AppendDriveListL( aContent->drive );
+ EndElementL(); // EConMLDrives
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDrivesL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendDataOwnersL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendDataOwnersL( ConML_DataOwnersPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnersL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLDataOwners, ETrue );
+ AppendSIDListL( aContent->sid );
+ EndElementL(); //EConMLDataOwners
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDataOwnersL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendGetDataOwnerStatusL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendGetDataOwnerStatusL
+ ( ConML_GetDataOwnerStatusPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" );
+ if ( aContent)
+ {
+ BeginElementL( EConMLGetDataOwnerStatus, ETrue );
+ AppendDataOwnersL( aContent->dataOwners );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EconMLGetDataOwnerStatus
+ }
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendGetMetadataL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendGetMetadataL
+ ( ConML_GetMetadataPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" );
+ if ( aContent)
+ {
+ BeginElementL( EConMLGetMetadata, ETrue );
+ AppendPCDataL( EConMLFilename, aContent->filename );
+ AppendResultsL( aContent->results );
+ EndElementL(); // EConMLGetMetadata
+ }
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendPackageInfoL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendPackageInfoL ( ConML_PackageInfoPtr_t aContent )
+ {
+ if ( aContent )
+ {
+ BeginElementL( EConMLPackageInfo, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ EndElementL(); // EConMLPackageInfo
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// AppendSIDL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendSIDL( ConML_SIDPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendSIDL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLSID, ETrue );
+ AppendPCDataL( EConMLType, aContent->type );
+ AppendPCDataL( EConMLUID, aContent->uid );
+ AppendPCDataL( EConMLDataOwnerStatus, aContent->dataOwnerStatus );
+ AppendDrivesL( aContent->drives );
+ if ( aContent->size )
+ {
+ AppendPCDataL( EConMLSize, aContent->size );
+ }
+ AppendPackageInfoL( aContent->packageInfo );
+ AppendBUROptionsL( aContent->burOptions );
+ AppendPCDataL( EConMLTransferDataType, aContent->transferDataType );
+ AppendPCDataL( EConMLData, aContent->data );
+ if ( aContent->moreData)
+ {
+ BeginElementL(EConMLMoreData );
+ }
+ EndElementL(); // EconMLSID
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendSIDListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendSIDListL( ConML_SIDListPtr_t aContent )
+ {
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" );
+ for ( ConML_SIDListPtr_t p = aContent; p && p->data; p=p->next )
+ {
+ AppendSIDL( p->data );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendDeviceInfoL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendDeviceInfoL( ConML_DeviceInfoPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendDeviceInfoL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLDeviceInfo, ETrue );
+ AppendPCDataL( EConMLVersion, aContent->version );
+ AppendSupportedMethodsL ( aContent->supportedMethods );
+ AppendPCDataL(EConMLMaxObjectSize, aContent->maxObjectSize );
+ EndElementL(); // EConMLDeviceInfo
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDeviceInfoL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendFilesL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendFilesL( ConML_FilesPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendFilesL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLFiles, ETrue );
+ AppendFileListL( aContent->file );
+ EndElementL(); // EConMLFiles
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFilesL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendSupportedMethodsL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendSupportedMethodsL
+ ( ConML_SupportedMethodsPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupportedMethodsL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLSupportedMethods, ETrue );
+ if ( aContent->install )
+ {
+ BeginElementL( EConMLInstall );
+ }
+ if ( aContent->unInstall )
+ {
+ BeginElementL( EConMLUnInstall );
+ }
+ if ( aContent->listInstalledApps )
+ {
+ BeginElementL( EConMLListInstalledApps );
+ }
+ if ( aContent->listDataOwners )
+ {
+ BeginElementL( EConMLListDataOwners );
+ }
+ if ( aContent->setBurMode )
+ {
+ BeginElementL( EConMLSetBURMode );
+ }
+ if ( aContent->getDataSize )
+ {
+ BeginElementL( EConMLGetDataSize );
+ }
+ if ( aContent->requestData )
+ {
+ BeginElementL( EConMLRequestData );
+ }
+ if ( aContent->supplyData )
+ {
+ BeginElementL( EConMLSupplyData );
+ }
+ if ( aContent->reboot )
+ {
+ BeginElementL( EConMLReboot );
+ }
+ EndElementL(); // EConMLSupportedMethods
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupportedMethodsL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendFileListL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendFileListL( ConML_FileListPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileListL()" );
+ if ( aContent )
+ {
+ for ( ConML_FileListPtr_t p = aContent; p && p->data; p = p->next )
+ {
+ AppendFileL(p->data );
+ }
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileListL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendFileL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendFileL( ConML_FilePtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileL()" );
+ if ( aContent )
+ {
+ BeginElementL( EConMLFile, ETrue );
+ AppendPCDataL( EConMLName, aContent->name );
+ AppendPCDataL( EConMLModified, aContent->modified );
+ AppendPCDataL( EConMLSize, aContent->size );
+ AppendPCDataL( EConMLUserPerm, aContent->userPerm );
+ EndElementL(); // EConMLFile
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// HandleResult
+// -----------------------------------------------------------------------------
+TInt CSConConMLGenerator::HandleResult( TInt aResult, TInt aTreshold )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::HandleResult()" );
+ switch( aResult )
+ {
+ case KErrNone:
+ if( iWBXMLWorkspace->FreeSize() < aTreshold )
+ {
+ iWBXMLWorkspace->Rollback();
+ return KWBXMLGeneratorBufferFull;
+ }
+ iWBXMLWorkspace->Commit();
+ return KWBXMLGeneratorOk;
+
+ case KErrTooBig:
+ iWBXMLWorkspace->Rollback();
+ return KWBXMLGeneratorBufferFull;
+ }
+ LOGGER_WRITE_1( "CSConConMLGenerator::HandleResult()\
+ : returned %d", aResult);
+ return aResult;
+ }
+
+// -----------------------------------------------------------------------------
+// BeginDocumentL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::BeginDocumentL(
+ TUint8 aVersion,
+ TInt32 aPublicId,
+ TUint32 aCharset,
+ const TDesC8& aStringTbl )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::BeginDocumentL()" );
+ iWBXMLWorkspace->WriteL(aVersion);
+
+ if( aPublicId <= 0 )
+ {
+ iWBXMLWorkspace->WriteL(0);
+ WriteMUint32L(-aPublicId);
+ }
+ else
+ {
+ WriteMUint32L(aPublicId);
+ }
+ WriteMUint32L(aCharset);
+ WriteMUint32L(aStringTbl.Size());
+ iWBXMLWorkspace->WriteL(aStringTbl);
+ LOGGER_LEAVEFN( "CSConConMLGenerator::BeginDocumentL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// BeginElementL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::BeginElementL(
+ TUint8 aElement, TBool aHasContent, TBool aHasAttributes )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::BeginElementL()" );
+ IndentL();
+ iXMLWorkspace->WriteL(KXMLTagStart());
+ iXMLWorkspace->WriteL(TranslateElement(aElement));
+
+ if( aHasAttributes )
+ {
+ aElement |= KWBXMLHasAttributes;
+ }
+
+ if( aHasContent )
+ {
+ iXMLWorkspace->WriteL(KXMLTagEnd());
+ iElemStack.Insert(aElement, 0);
+ aElement |= KWBXMLHasContent;
+ }
+ else
+ {
+ iXMLWorkspace->WriteL(KXMLTagEndNoContent());
+ }
+
+ if( !iDontNewLine )
+ {
+ iXMLWorkspace->WriteL(KXMLNewLine());
+ }
+ iDontNewLine = EFalse;
+
+ WriteMUint32L(aElement);
+ LOGGER_LEAVEFN( "CSConConMLGenerator::BeginElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// EndElementL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::EndElementL()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" );
+ TUint8 elem = iElemStack[0];
+ iElemStack.Remove(0);
+ if( !iDontIndent )
+ {
+ IndentL();
+ }
+ iDontIndent = EFalse;
+ iXMLWorkspace->WriteL(KXMLTagStartEndTag());
+ iXMLWorkspace->WriteL(TranslateElement(elem));
+ iXMLWorkspace->WriteL(KXMLTagEnd());
+ iXMLWorkspace->WriteL(KXMLNewLine());
+
+ iWBXMLWorkspace->WriteL(END);
+
+ LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AddElementL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AddElementL(
+ TUint8 aElement, const TDesC8& aContent, const TWBXMLContentFormat aFormat )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AddElementL()" );
+ iDontNewLine = ETrue;
+ BeginElementL(aElement, ETrue);
+ if( aFormat == EWBXMLContentFormatOpaque )
+ {
+ WriteOpaqueDataL(aContent);
+ }
+ else
+ {
+ WriteInlineStringL(aContent);
+ }
+ iDontIndent = ETrue;
+ EndElementL();
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AddElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// AppendPCDataL
+// -----------------------------------------------------------------------------
+void CSConConMLGenerator::AppendPCDataL( TUint8 aElement, pcdataPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::AppendPCDataL()" );
+ if( !aContent )
+ {
+ return;
+ }
+
+ if( aContent->contentType == SML_PCDATA_OPAQUE )
+ {
+ AddElementL(aElement,
+ TPtrC8((TUint8*)aContent->content,
+ aContent->length));
+ }
+ else
+ {
+ LOGGER_WRITE( "CSConConMLGenerator::AppendPCDataL() : Data type not Opaque - ignoring " );
+ }
+ LOGGER_LEAVEFN( "CSConConMLGenerator::AppendPCDataL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// WBXMLDocument
+// -----------------------------------------------------------------------------
+TPtrC8 CSConConMLGenerator::WBXMLDocument()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::WBXMLDocument()" );
+ LOGGER_LEAVEFN( "CSConConMLGenerator::WBXMLDocument()" );
+ return iWBXMLWorkspace->Buffer();
+ }
+
+// -----------------------------------------------------------------------------
+// XMLDocument
+// -----------------------------------------------------------------------------
+TPtrC8 CSConConMLGenerator::XMLDocument()
+ {
+ LOGGER_ENTERFN( "CSConConMLGenerator::XMLDocument()" );
+ LOGGER_LEAVEFN( "CSConConMLGenerator::XMLDocument()" );
+ return iXMLWorkspace->Buffer();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlhandler.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,474 @@
+/*
+* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include <s32mem.h>
+
+#include "sconconmlhandler.h"
+#include "debug.h"
+
+// -----------------------------------------------------------------------------
+// CreateCSConConMLHandlerL
+// Creates a new instance of CSConConMLHandler
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CSConConMLHandler* CreateCSConConMLHandlerL()
+ {
+ LOGGER_ENTERFN( "CreateCSConConMLHandlerL()" );
+ LOGGER_LEAVEFN( "CreateCSConConMLHandlerL()" );
+ return CSConConMLHandler::NewL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::CSConConMLHandler()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConConMLHandler::CSConConMLHandler()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::CSConConMLHandler()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+CSConConMLHandler::~CSConConMLHandler()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::~CSConConMLHandler()" );
+
+ if ( iParseBuffer )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 1/4 " );
+ delete iParseBuffer;
+ iParseBuffer = NULL;
+ }
+
+ if ( iBuffer )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 2/4 " );
+ delete iBuffer;
+ iBuffer = NULL;
+ }
+
+ if ( iGenerator )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 3/4 " );
+ delete iGenerator;
+ iGenerator = NULL;
+ }
+
+ if ( iStringTable )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::~CSConConMLHandler() : phase 4/4 " );
+ delete iStringTable;
+ iStringTable = NULL;
+ }
+
+ iElemStack.Close();
+
+ LOGGER_LEAVEFN( "CSConConMLHandler::~CSConConMLHandler()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::CSConConMLHaNewL()
+// Creates a new instance of CSConConMLHandler
+// -----------------------------------------------------------------------------
+//
+CSConConMLHandler* CSConConMLHandler::NewL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::NewL()" );
+ CSConConMLHandler* self = new ( ELeave ) CSConConMLHandler();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ LOGGER_LEAVEFN( "CSConConMLHandler::NewL()" );
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ConstructL()
+// 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CSConConMLHandler::ConstructL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ConstructL()" );
+ iGenerator = CSConConMLGenerator::NewL();
+ iBuffer = CBufFlat::NewL( KSConBufferGranularity );
+ iParseBuffer = CBufFlat::NewL( KSConDefaultDocumentSize );
+ LOGGER_LEAVEFN( "CSConConMLHandler::ConstructL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ParseDocumentL()
+// Handles the document parsing, document in aInput
+// -----------------------------------------------------------------------------
+//
+TInt CSConConMLHandler::ParseDocumentL(
+ CBufFlat& aInput, MWBXMLConMLCallback* aCallback )
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ParseDocument()" );
+ TInt ret ( KErrNone );
+
+ iPos = 0;
+ iParseBuffer->Reset();
+ iParseBuffer->ResizeL( aInput.Size() );
+ iParseBuffer->Write( 0, aInput.Ptr(0) );
+ iHeaderParsed = EFalse;
+ iGenerator->SetCallback( aCallback );
+
+ while (ret == KWBXMLParserErrorOk )
+ {
+ ret = ParseL();
+ }
+
+ if ( ret == KWBXMLParserErrorEof )
+ {
+ ret = KErrNone;
+ }
+ LOGGER_WRITE_1( "CSConConMLHandler::ParseDocument()\
+ returned %d", ret );
+ return ( ret );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::GenerateDocument()
+// Starts the generating of a document
+// -----------------------------------------------------------------------------
+//
+TInt CSConConMLHandler::GenerateDocument( ConML_ConMLPtr_t aContent )
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::GenerateDocument()" );
+ iGenerator->GenerateConMLDocument ( aContent );
+ LOGGER_LEAVEFN( "CSConConMLHandler::GenerateDocument()" );
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::WBXMLDocument()
+// Returns the generated WBXML -document
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CSConConMLHandler::WBXMLDocument()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::WBXMLDocument()" );
+ LOGGER_LEAVEFN( "CSConConMLHandler::WBXMLDocument()" );
+ return iGenerator->WBXMLDocument();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::XMLDocument()
+// Returns the generated XML -document
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CSConConMLHandler::XMLDocument()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::XMLDocument()" );
+ LOGGER_LEAVEFN( "CSConConMLHandler::XMLDocument()" );
+ return iGenerator->XMLDocument();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ParseL()
+// Parses the next document tag / header if not parsed yet
+// -----------------------------------------------------------------------------
+//
+TInt CSConConMLHandler::ParseL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ParseL()" );
+ if( !iHeaderParsed )
+ {
+ TConMLParserError result(KWBXMLParserErrorOk);
+ TRAPD(err, result = DoParseDocumentHeaderL());
+ if( err == KErrEof )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::ParseL() : KWBXMLParserErrorEofTooEarly " );
+ return KWBXMLParserErrorEofTooEarly;
+ }
+ return result;
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::ParseL()" );
+ return DoParseDocumentBodyL();
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::DoParseDocumentHeaderL()
+// Parses the document header
+// -----------------------------------------------------------------------------
+//
+TConMLParserError CSConConMLHandler::DoParseDocumentHeaderL()
+ {
+ LOGGER_ENTERFN( "CSConConMLParser::DoParseDocumentHeaderL()" );
+ iHeaderParsed = ETrue;
+
+ // Version
+ TUint8 version = ReadUint8L();
+
+ // PublicId
+ TInt32 publicId = ReadMUint32L();
+
+ if( publicId == 0 )
+ {
+ publicId = ReadMUint32L();
+ }
+ else
+ {
+ publicId = -publicId;
+ }
+
+ // Charset
+ TUint32 charSet = ReadMUint32L();
+
+ // String table
+ ReadStringTableL();
+
+ // Document begins now
+ if( publicId < 0 )
+ {
+ iGenerator->StartDocument(version, -publicId, charSet);
+ }
+ else
+ {
+ iGenerator->StartDocument(version,
+ StringTableString(publicId), charSet);
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::DoParseDocumentHeaderL()" );
+ return KWBXMLParserErrorOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::DoParseDocumentBodyL()
+// Parses the next element of the document
+// -----------------------------------------------------------------------------
+//
+TConMLParserError CSConConMLHandler::DoParseDocumentBodyL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::DoParseDocumentBodyL()" );
+ TUint8 id(0);
+ TRAPD(err, id = ReadUint8L());
+
+ if( err != KErrNone )
+ {
+ if( err == KErrEof )
+ {
+ iGenerator->EndDocument();
+ if( iElemStack.Count() > 0 )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::DoParseDocumentBodyL() : KWBXMLParserErrorEofTooEarly " );
+ return KWBXMLParserErrorEofTooEarly;
+ }
+ return KWBXMLParserErrorEof;
+ }
+ User::Leave(err);
+ }
+
+ switch (id)
+ {
+ case END:
+ {
+ if( !iElemStack.Count() )
+ {
+ LOGGER_WRITE( "CSConConMLHandler::DoParseDocumentBodyL() : KWBXMLParserErrorinvalidDocument " );
+ User::Leave( KWBXMLParserErrorinvalidDocument );
+ }
+ TUint8 tag( iElemStack.operator[](iElemStack.Count() - 1 ));
+ iGenerator->EndElementL( tag );
+ iElemStack.Remove(iElemStack.Count() - 1);
+ }
+ break;
+
+ case STR_I:
+ iGenerator->CharactersL(ReadStrIL());
+ break;
+
+ case OPAQUE:
+ iGenerator->CharactersL(ReadOpaqueL());
+ break;
+
+ default:
+ HandleElementL(id);
+ break;
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::DoParseDocumentBodyL()" );
+ return KWBXMLParserErrorOk;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ReadUint8L()
+// Reads one byte from the document
+// -----------------------------------------------------------------------------
+//
+TUint8 CSConConMLHandler::ReadUint8L()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ReadUint8L()" );
+ if ( iPos == iParseBuffer->Size())
+ {
+ User::Leave ( KErrEof );
+ }
+ TUint8 value;
+ HBufC8* data = HBufC8::NewLC( sizeof(TUint8) );
+ TPtr8 ptr = data->Des();
+ iParseBuffer->Read(iPos, ptr, sizeof(TUint8));
+ iPos+= sizeof(TUint8);
+ value = ptr[0];
+ CleanupStack::PopAndDestroy(1); //data
+ LOGGER_WRITE_1( "CSConConMLHandler::ReadUint8L()\
+ : returned %d ", value );
+ return value;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ReadMUint32L()
+// Reads multibyte coding from the document
+// -----------------------------------------------------------------------------
+//
+TUint32 CSConConMLHandler::ReadMUint32L()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ReadMUint32L()" );
+ TUint32 result = 0;
+ TUint8 c;
+
+ do {
+ c = ReadUint8L();
+ result = (result << 7) | (c & 0x7f);
+ } while ( c & 0x80 );
+
+ LOGGER_WRITE_1( "CSConConMLHandler::ReadMUint32L()\
+ : returned %d ", result );
+ return result;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ReadStrIL()
+// Reads string data from the document
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CSConConMLHandler::ReadStrIL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ReadStrIL()" );
+ iBuffer->Reset();
+ RBufWriteStream bws(*iBuffer);
+ TUint8 c;
+ while( (c = ReadUint8L()) != 0 )
+ {
+ bws.WriteUint8L(c);
+ }
+ bws.CommitL();
+ LOGGER_LEAVEFN( "CSConConMLParser::ReadStrIL()" );
+ return iBuffer->Ptr(0);
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ReadStringTableL()
+// Handles the document's string table
+// -----------------------------------------------------------------------------
+//
+void CSConConMLHandler::ReadStringTableL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ReadStringTableL()" );
+ delete iStringTable;
+ iStringTable = NULL;
+ TUint32 strTblLen = ReadMUint32L();
+
+ if( strTblLen > 0 )
+ {
+ if( iPos+strTblLen > iParseBuffer->Size())
+ {
+ LOGGER_WRITE( "CSConConMLHandler::ReadStringTableL() : LEAVE KErrEof " );
+ User::Leave ( KErrEof );
+ }
+ iStringTable = HBufC8::NewL(strTblLen);
+ TPtr8 ptr = iStringTable->Des();
+ iParseBuffer->Read(iPos, ptr, strTblLen);
+ iPos+=strTblLen;
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::ReadStringTableL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::StringTableString()
+// Returns a value from the string table according to the given index
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CSConConMLHandler::StringTableString( TUint32 aIndex )
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::StringTableString()" );
+ TPtrC8 temp(iStringTable->Mid(aIndex));
+ TInt pos = temp.Find(KWBXMLNull());
+ if( pos != KErrNotFound )
+ {
+ temp.Set(temp.Left(pos));
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::StringTableString()" );
+ return temp;
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::HandleElementL()
+// Starts a new element in the document
+// -----------------------------------------------------------------------------
+//
+void CSConConMLHandler::HandleElementL( TUint8 aId )
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::HandleElementL()" );
+ TUint8 tag(TUint8(aId & 0x3f));
+
+ iGenerator->StartElementL( tag );
+
+ if( aId & 0x40 )
+ {
+ iElemStack.Append( tag );
+ }
+ else
+ {
+ iGenerator->EndElementL(tag);
+ }
+ LOGGER_LEAVEFN( "CSConConMLHandler::HandleElementL()" );
+ }
+
+// -----------------------------------------------------------------------------
+// CSConConMLHandler::ReadOpaqueL()
+// Reads opaque data from the document
+// -----------------------------------------------------------------------------
+//
+TPtrC8 CSConConMLHandler::ReadOpaqueL()
+ {
+ LOGGER_ENTERFN( "CSConConMLHandler::ReadOpaqueL()" );
+ iBuffer->Reset();
+ RBufWriteStream bws(*iBuffer);
+ TUint32 length = ReadMUint32L();
+ if( iPos+length > iParseBuffer->Size())
+ {
+ LOGGER_WRITE( "CSConConMLHandler::ReadOpaqueL() : LEAVE KErrEof " );
+ User::Leave ( KErrEof );
+ }
+ HBufC8* data = HBufC8::NewLC( length );
+ TPtr8 ptr = data->Des();
+ iParseBuffer->Read( iPos, ptr, length );
+ iPos+= length;
+ bws.WriteL(ptr, length);
+ bws.CommitL();
+ CleanupStack::PopAndDestroy(1); // data
+
+ LOGGER_LEAVEFN( "CSConConMLHandler::ReadOpaqueL()" );
+ return iBuffer->Ptr(0);
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlelement.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+
+#include "sconxmlelement.h"
+#include "sconconmldtd.h"
+
+// -----------------------------------------------------------------------------
+// TElementParams
+// -----------------------------------------------------------------------------
+TXMLElementParams::TXMLElementParams(
+ TAny* aCallbacks,
+ CXMLStack<CXMLElement>* aCmdStack,
+ CXMLStack<CXMLElement>* aCleanupStack ) :
+ iCallbacks(aCallbacks),
+ iCmdStack(aCmdStack),
+ iCleanupStack(aCleanupStack)
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CXMLElement
+// -----------------------------------------------------------------------------
+CXMLElement* CXMLElement::BeginElementL(
+ TUint8 /*aTag*/, const TXMLElementParams& /*Params*/ )
+ {
+ return 0;
+ }
+
+// -----------------------------------------------------------------------------
+CXMLElement::TAction CXMLElement::EndElementL( TAny* /*aCallbacks*/,
+ TUint8 /*aTag*/ )
+ {
+ return EPop;
+ }
+
+
+// -----------------------------------------------------------------------------
+TBool CXMLElement::NeedsCleanup() const
+ {
+ return EFalse;
+ }
+
+// -----------------------------------------------------------------------------
+void CXMLElement::SetDataL( const TDesC8& /*aData*/ )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+TPtrC8 CXMLElement::Data() const
+ {
+ return TPtrC8();
+ }
+
+// -----------------------------------------------------------------------------
+TBool CXMLElement::Validate()
+ {
+ return ETrue;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/SeCon/wbxml/conmlhandler/src/sconxmlworkspace.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ConML parser/generator
+*
+*/
+
+
+// -----------------------------------------------------------------------------
+// Includes
+// -----------------------------------------------------------------------------
+#include "sconxmlworkspace.h"
+
+// -----------------------------------------------------------------------------
+// CXMLWorkspace
+// -----------------------------------------------------------------------------
+CXMLWorkspace::CXMLWorkspace()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// NewL
+// -----------------------------------------------------------------------------
+CXMLWorkspace* CXMLWorkspace::NewL()
+ {
+ CXMLWorkspace* self = new (ELeave) CXMLWorkspace();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(); // self
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// ConstructL
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::ConstructL()
+ {
+ iBuffer = CBufFlat::NewL(32);
+ iTransactions = new (ELeave) RArray<TUint>();
+ }
+
+// -----------------------------------------------------------------------------
+// ~CXMLWorkspace
+// -----------------------------------------------------------------------------
+CXMLWorkspace::~CXMLWorkspace()
+ {
+ delete iBuffer;
+ if( iTransactions )
+ {
+ iTransactions->Reset();
+ }
+ delete iTransactions;
+ }
+
+// -----------------------------------------------------------------------------
+// BeginTransaction
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::BeginTransaction()
+ {
+ iTransactions->Append(Size());
+ }
+
+// -----------------------------------------------------------------------------
+// Commit
+// -----------------------------------------------------------------------------
+TInt CXMLWorkspace::Commit()
+ {
+ if( iTransactions->Count() == 0 )
+ {
+ return KErrGeneral;
+ }
+ iTransactions->Remove(iTransactions->Count() - 1);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// CommitAll
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::CommitAll()
+ {
+ iTransactions->Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// Rollback
+// -----------------------------------------------------------------------------
+TInt CXMLWorkspace::Rollback()
+ {
+ if( iTransactions->Count() == 0 )
+ {
+ return KErrGeneral;
+ }
+ TUint begin = iTransactions->operator[](iTransactions->Count() - 1);
+ Delete(begin, Size() - begin);
+ iTransactions->Remove(iTransactions->Count() - 1);
+ return KErrNone;
+ }
+
+// -----------------------------------------------------------------------------
+// Reset
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::Reset()
+ {
+ iBuffer->Reset();
+ }
+
+// -----------------------------------------------------------------------------
+// WriteL
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::WriteL( const TDesC8& aData )
+ {
+ TRAPD(err, iBuffer->InsertL(iBuffer->Size(), aData));
+ if( err != KErrNone )
+ {
+ User::Leave(KErrTooBig);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// WriteL
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::WriteL( const TUint8 aData )
+ {
+ WriteL(TPtrC8(&aData, 1));
+ }
+
+// -----------------------------------------------------------------------------
+// Buffer
+// -----------------------------------------------------------------------------
+TPtrC8 CXMLWorkspace::Buffer()
+ {
+ return iBuffer->Ptr(0);
+ }
+
+// -----------------------------------------------------------------------------
+// FreeSize
+// -----------------------------------------------------------------------------
+TInt CXMLWorkspace::FreeSize()
+ {
+ return (KMaxTInt32 - Size());
+ }
+
+// -----------------------------------------------------------------------------
+// MaxSize
+// -----------------------------------------------------------------------------
+TInt CXMLWorkspace::MaxSize()
+ {
+ return KMaxTInt32;
+ }
+
+// -----------------------------------------------------------------------------
+// Size
+// -----------------------------------------------------------------------------
+TInt CXMLWorkspace::Size()
+ {
+ return iBuffer->Size();
+ }
+
+// -----------------------------------------------------------------------------
+// Delete
+// -----------------------------------------------------------------------------
+void CXMLWorkspace::Delete( TInt aPos, TInt aLength )
+ {
+ iBuffer->Delete(aPos, aLength);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/connectivitymodules/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Build information file
+*
+*/
+
+
+#include "../SeCon/group/bld.inf"
--- a/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -11,30 +11,11 @@
*
* Contributors:
*
-* Description:
+* Description: Build information file
*
*/
-// Local Connectivity Service Component
+
#include "../remoteconn_plat/group/bld.inf"
-#include "../localconnectivityservice/group/bld.inf"
-
-// MTP Component
-#include "../mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/bld.inf"
-#include "../mtpfws/mtpfw/group/bld.inf"
-#include "../mtpdataproviders/mtpfileandfolderdp/group/bld.inf"
-#include "../mtptransports/mtpusbtransport/group/bld.inf"
-//#include "../mtpfws/mtpfw/dataproviders/devdp/devdpextn/group/bld.inf"
-#include "../mtptransports/mtpptpiptransport/group/bld.inf"
-#include "../mtpdataproviders/mtppictbridgedp/group/bld.inf"
-#include "../mtpdataproviders/mtpimagedp/group/bld.inf"
-
-#include "../mtpdataproviders/mtpplaybackcontroldp/group/bld.inf"
-
-#ifdef FF_MTP_CONTROLLER
-#include "../mtptransports/mtpcontroller/group/bld.inf"
-#endif//FF_MTP_CONTROLLER
-
-// SBE Component
-#include "../backupandrestore/backupengine/group/bld.inf"
+#include "../connectivitymodules/group/bld.inf"
--- a/group/dummy.txt Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-test1.
-
-test2.
--- a/layers.sysdef.xml Tue Aug 31 16:03:15 2010 +0300
+++ b/layers.sysdef.xml Wed Sep 01 12:20:56 2010 +0100
@@ -1,86 +1,14 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
<!ENTITY layer_real_source_path "sf/mw/remoteconn" >
]>
-<SystemDefinition name="Remoteconn" schema="1.5.1">
+<SystemDefinition name="remoteconn" schema="1.4.0">
<systemModel>
<layer name="mw_layer">
- <module name="localconnectivityservice">
- <unit unitID="lcdo.localconnectivityservice" mrp="" bldFile="&layer_real_source_path;/localconnectivityservice/group" name="localconnectivityservice" />
- </module>
- <module name="dialup_connection_service_api">
- <unit unitID="lcdo.localconnectivityservice.dialup_connection_status_api" mrp="" bldFile="&layer_real_source_path;/remoteconn_plat/dialup_connection_status_api/group" name="dialup_connection_status_api"/>
- </module>
- <module name="dun_secondary_display_notification_api">
- <unit unitID="lcdo.localconnectivityservice.dun_secondary_display_notification_api" mrp="" bldFile="&layer_real_source_path;/remoteconn_plat/dun_secondary_display_notification_api/group" name="dun_secondary_display_notification_api"/>
- </module>
- <module name="generic_hid_api">
- <unit unitID="lcdo.localconnectivityservice.generic_hid_api" mrp="" bldFile="&layer_real_source_path;/remoteconn_plat/generic_hid_api/group" name="generic_hid_api"/>
- </module>
- <module name="locod_bearer_plugin_api">
- <unit unitID="lcdo.localconnectivityservice.locod_bearer_plugin_api" mrp="" bldFile="&layer_real_source_path;/remoteconn_plat/locod_bearer_plugin_api/group" name="locod_bearer_plugin_api"/>
- </module>
- <module name="locod_service_plugin_api">
- <unit unitID="lcdo.localconnectivityservice.locod_service_plugin_api" mrp="" bldFile="&layer_real_source_path;/remoteconn_plat/locod_service_plugin_api/group" name="locod_service_plugin_api"/>
- </module>
- <module name="mtppictbridgedp">
- <unit unitID="lcdo.localconnectivityservice.mtppictbridgeengine" mrp="" bldFile="&layer_real_source_path;/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group" name="mtppictbridgeengine"/>
- </module>
-
- <module name="MTP Framework">
- <unit name="MTP_Framework" unitID="smw.mtpfws.mtpfw" bldFile="sf\mw\remoteconn\mtpfws\mtpfw\group" mrp="sf\mw\remoteconn\mtpfws\mtpfw\group\mtp_framework.mrp"/>
- </module>
-
- <module name="MTP File and Folder Provider">
- <unit name="MTP_File_Folder" unitID="smw.mtpdps.mtpfilefolder" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpfileandfolderdp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpfileandfolderdp\group\mtp_filedp.mrp"/>
- </module>
-
- <module name="WMP Extension Data Provider">
- <unit name="MTP_ExtDP" unitID="smw.mtpdps.mtpextdp" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpwmpextndp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpwmpextndp\group\mtp_wmpextndp.mrp"/>
- </module>
-
- <module name="MTP USB Transport">
- <unit name="MTP_Usb" unitID="smw.mtptsp.mtpusbtsp" bldFile="sf\mw\remoteconn\mtptransports\mtpusbtransport\group" mrp="sf\mw\remoteconn\mtptransports\mtpusbtransport\group\mtp_usbsic.mrp"/>
- </module>
-
- <module name="MTP Device Provider Extension">
- <unit name="MTP_DPExt" unitID="smw.mtpfws.devdp" bldFile="sf\mw\remoteconn\mtpfws\mtpfw\dataproviders\devdp\devdpextn\group" mrp=""/>
- </module>
-
- <module name="MTP PTP-IP Transport">
- <unit name="MTP_PTP_IP" unitID="smw.mtptsp.mtpptpip" bldFile="sf\mw\remoteconn\mtptransports\mtpptpiptransport\group" mrp="sf\mw\remoteconn\mtptransports\mtpptpiptransport\group\mtp_ptpip.mrp"/>
- </module>
-
- <module name="MTP Bluetooth Transport">
- <unit name="MTP_Bt_Tsp" unitID="smw.mtptsp.mtpbt" bldFile="sf\mw\remoteconn\mtptransports\mtpbttransport\group" mrp="sf\mw\remoteconn\mtptransports\mtpbttransport\group\mtp_bt.mrp"/>
- </module>
-
- <module name="MTP Device Metadata Data Provider">
- <unit name="MTP_MetaDP" unitID="smw.mtpdps.mtpmetadp" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpmetadatadp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpmetadatadp\group\mtp_metadatadp.mrp"/>
- </module>
-
- <module name="MTP Status Data Provider">
- <unit name="MTP_StatDP" unitID="smw.mtpdps.mtpstatdp" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpstatusdp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpstatusdp\group\mtp_statusdp.mrp"/>
- </module>
-
- <module name="MTP PictBridge Data Provider">
- <unit name="MTP_Pic_Bri" unitID="smw.mtpdps.mtppicbri" bldFile="sf\mw\remoteconn\mtpdataproviders\mtppictbridgedp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtppictbridgedp\group\mtp_pictbridgedp.mrp"/>
- </module>
-
- <module name="MTP Playback Control Data Provider">
- <unit name="MTP_PbcDP" unitID="smw.mtpdps.mtpplaybackcontrol" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group\mtp_playbackcontroldp.mrp"/>
- </module>
-
- <module name="MTP Image Data Provider">
- <unit name="MTP_ImageDP" unitID="smw.mtptsp.mtpimagedp" bldFile="sf\mw\remoteconn\mtpdataproviders\mtpimagedp\group" mrp="sf\mw\remoteconn\mtpdataproviders\mtpimagedp\group\mtp_imagedp.mrp"/>
- </module>
-
- <module name="Backup Engine">
- <unit name="backupengine" unitID="smw.br.backupengine" bldFile="sf\mw\remoteconn\backupandrestore\backupengine\group" mrp="sf\mw\remoteconn\backupandrestore\backupengine\group\connectivity_backupengine.mrp"/>
- </module>
-
-
+ <module name="remoteconn">
+ <unit name="remoteconn" unitID="sydo.remoteconn" bldFile="&layer_real_source_path;/group" mrp="" />
+ </module>
</layer>
</systemModel>
-</SystemDefinition>
\ No newline at end of file
+</SystemDefinition>
--- a/localconnectivityservice/dun/atext/bwins/dunatextu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-EXPORTS
- ?AddCmdModeCallback@CDunAtCmdHandler@@QAEHPAVMDunCmdModeMonitor@@@Z @ 1 NONAME ; int CDunAtCmdHandler::AddCmdModeCallback(class MDunCmdModeMonitor *)
- ?AddDataForParsing@CDunAtCmdHandler@@QAEHAAVTDesC8@@AAH@Z @ 2 NONAME ; int CDunAtCmdHandler::AddDataForParsing(class TDesC8 &, int &)
- ?ManageAbortRequest@CDunAtCmdHandler@@QAEHXZ @ 3 NONAME ; int CDunAtCmdHandler::ManageAbortRequest(void)
- ?NewL@CDunAtCmdHandler@@SAPAV1@PAVMDunAtCmdStatusReporter@@PAVMDunStreamManipulator@@PBVTDesC8@@@Z @ 4 NONAME ; class CDunAtCmdHandler * CDunAtCmdHandler::NewL(class MDunAtCmdStatusReporter *, class MDunStreamManipulator *, class TDesC8 const *)
- ?ResetData@CDunAtCmdHandler@@QAEXXZ @ 5 NONAME ; void CDunAtCmdHandler::ResetData(void)
- ?SendEchoCharacter@CDunAtCmdHandler@@QAEHPBVTDesC8@@PAVMDunAtCmdEchoer@@@Z @ 6 NONAME ; int CDunAtCmdHandler::SendEchoCharacter(class TDesC8 const *, class MDunAtCmdEchoer *)
- ?StartUrc@CDunAtCmdHandler@@QAEHXZ @ 7 NONAME ; int CDunAtCmdHandler::StartUrc(void)
- ?Stop@CDunAtCmdHandler@@QAEHXZ @ 8 NONAME ; int CDunAtCmdHandler::Stop(void)
- ?StopUrc@CDunAtCmdHandler@@QAEHXZ @ 9 NONAME ; int CDunAtCmdHandler::StopUrc(void)
-
--- a/localconnectivityservice/dun/atext/eabi/dunatextu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-EXPORTS
- _ZN16CDunAtCmdHandler17AddDataForParsingER6TDesC8Ri @ 1 NONAME
- _ZN16CDunAtCmdHandler17SendEchoCharacterEPK6TDesC8P15MDunAtCmdEchoer @ 2 NONAME
- _ZN16CDunAtCmdHandler18AddCmdModeCallbackEP18MDunCmdModeMonitor @ 3 NONAME
- _ZN16CDunAtCmdHandler18ManageAbortRequestEv @ 4 NONAME
- _ZN16CDunAtCmdHandler4NewLEP23MDunAtCmdStatusReporterP21MDunStreamManipulatorPK6TDesC8 @ 5 NONAME
- _ZN16CDunAtCmdHandler4StopEv @ 6 NONAME
- _ZN16CDunAtCmdHandler7StopUrcEv @ 7 NONAME
- _ZN16CDunAtCmdHandler8StartUrcEv @ 8 NONAME
- _ZN16CDunAtCmdHandler9ResetDataEv @ 9 NONAME
-
--- a/localconnectivityservice/dun/atext/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* This file provides the information required for building the
-* whole of DUN ATEXT
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-../../rom/dunatext.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunatext.iby)
-
-PRJ_MMPFILES
-dunatext.mmp
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/dun/atext/group/dunatext.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN ATEXT
-*
-*/
-
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET dunatext.dll
-TARGETTYPE DLL
-UID 0x1000008d 0x2001CBE6
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE DunAtCmdEchoer.cpp
-SOURCE DunAtCmdHandler.cpp
-SOURCE DunAtCmdPusher.cpp
-SOURCE DunAtUrcHandler.cpp
-SOURCE DunAtModeListen.cpp
-SOURCE DunAtEcomListen.cpp
-SOURCE DunAtNvramListen.cpp
-SOURCE DunAtSpecialCmdHandler.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc ../../utils/inc
-USERINCLUDE ../../../inc
-
-LIBRARY atextclient.lib
-LIBRARY atextcommon.lib
-LIBRARY euser.lib
-LIBRARY bafl.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdEchoer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Echoer for AT commands
-*
-*/
-
-#ifndef C_CDUNATCMDECHOER_H
-#define C_CDUNATCMDECHOER_H
-
-#include "DunDataPusher.h"
-
-class MDunStreamManipulator;
-
-/**
- * Notification interface class for text mode
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunAtCmdEchoer )
- {
-
-public:
-
- /**
- * Notifies about completed echo in text mode
- *
- * @since TB9.2
- * @return None
- */
- virtual void NotifyEchoComplete() = 0;
-
- };
-
-/**
- * Class for AT command echoer
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtCmdEchoer ) : public CBase,
- public MDunCompletionReporter
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aStreamCallback Callback to stream
- * @return Instance of self
- */
- static CDunAtCmdEchoer* NewL( MDunStreamManipulator* aStreamCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtCmdEchoer();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Sends a character to be echoed
- *
- * @since TB9.2
- * @param aInput Input to echo
- * @param aCallback Callback to echo request completions
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SendEchoCharacter( const TDesC8* aInput, MDunAtCmdEchoer* aCallback );
-
-private:
-
- CDunAtCmdEchoer( MDunStreamManipulator* aStreamCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
-// from base class MDunCompletionReporter
-
- /**
- * From MDunCompletionReporter.
- * Gets called when data push is complete
- *
- * @since TB9.2
- * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
- * @return None
- */
- void NotifyDataPushComplete( TBool aAllPushed );
-
-private: // data
-
- /**
- * Notification interface class for echo request completions
- * Not own.
- */
- MDunAtCmdEchoer* iCallback;
-
- /**
- * Callback to call when data to push
- * Not own.
- */
- MDunStreamManipulator* iStreamCallback;
-
- /**
- * Current state of echoing: active or inactive
- */
- TDunState iAtEchoState;
-
- };
-
-#endif // C_CDUNATCMDECHOER_H
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,990 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command handler and notifier
-*
-*/
-
-#ifndef C_CDUNATCMDHANDLER_H
-#define C_CDUNATCMDHANDLER_H
-
-#include <atext.h>
-#include <e32base.h>
-#include <atextcommon.h>
-#include "DunDataPusher.h"
-#include "DunAtCmdPusher.h"
-#include "DunAtCmdEchoer.h"
-#include "DunAtEcomListen.h"
-#include "DunAtModeListen.h"
-#include "DunAtNvramListen.h"
-#include "DunAtSpecialCmdHandler.h"
-
-const TInt KDunChSetMaxCharLen = 1; // Only ASCII supported for now
-const TInt KDunOkBufLength = 1+1+2+1+1; // <CR>+<LF>+"OK"+<CR>+<LF>
-const TInt KDunErrorBufLength = 1+1+5+1+1; // <CR>+<LF>+"ERROR"+<CR>+<LF>
-const TInt KDunLineBufLength = (512 + 1); // 512 chars for command + <CR>
-const TInt KDunEscBufLength = 1; // Escape (0x1B) character
-
-class CDunAtUrcHandler;
-class MDunConnMon;
-class MDunStreamManipulator;
-
-/**
- * Class used for storing information related to string conversion and parsing
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( TDunParseInfo )
- {
-
-public:
-
- /**
- * Buffer for sending to ATEXT (one command)
- * (length is part of KDunLineBufLength)
- */
- TBuf8<KDunLineBufLength> iSendBuffer;
-
- /**
- * Conversion limit for upper case conversion.
- * This is needed to convert the base part of special commands to upper case
- * where the part after the base part should not be converted to upper case.
- */
- TInt iLimit;
-
- };
-
-/**
- * Class used for AT command decoding related functionality
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( TDunDecodeInfo )
- {
-
-public:
-
- /**
- * Flag to indicate if first decode
- */
- TBool iFirstDecode;
-
- /**
- * Index in iLineBuffer for decoding to iSendBuffer
- */
- TInt iDecodeIndex;
-
- /**
- * Index in iLineBuffer for extended character position
- */
- TInt iExtendedIndex;
-
- /**
- * Previous character in parsing
- */
- TChar iPrevChar;
-
- /**
- * Flag to indicate if previous character exists
- */
- TBool iPrevExists;
-
- /**
- * Flag to indicate if assignment mark found
- */
- TBool iAssignFound;
-
- /**
- * Flag to indicate if processing inside quotes
- */
- TBool iInQuotes;
-
- /**
- * Flag to indicate if special subcommand found
- */
- TBool iSpecialFound;
-
- /**
- * Number of commands handled (for debugging purposes)
- */
- TBool iCmdsHandled;
-
- };
-
-/**
- * Class used for AT command editor mode related functionality
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( TDunEditorModeInfo )
- {
-
-public:
-
- /**
- * Flag to indicate if content found (not used if iContentFindStarted is EFalse)
- */
- TBool iContentFound;
-
- /**
- * AT command decoding related information for peeked data
- * (not to be used if HandleNextSubCommand() returns EFalse)
- */
- TDunDecodeInfo iPeekInfo;
-
- };
-
-/**
- * Notification interface class for command mode start/end
- *
- * @lib dunutils.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunCmdModeMonitor )
- {
-
-public:
-
- /**
- * Notifies about command mode start
- *
- * @since TB9.2
- * @return None
- */
- virtual void NotifyCommandModeStart() = 0;
-
- /**
- * Notifies about command mode end
- *
- * @since TB9.2
- * @return None
- */
- virtual void NotifyCommandModeEnd() = 0;
-
- };
-
-/**
- * Notification interface class for status changes in AT command handling
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunAtCmdStatusReporter )
- {
-
-public:
-
- /**
- * Notifies about parser's need to get more data
- *
- * @since TB9.2
- * @return None
- */
- virtual void NotifyParserNeedsMoreData() = 0;
-
- /**
- * Notifies about editor mode reply
- *
- * @since TB9.2
- * @param aStart ETrue if start of editor mode, EFalse otherwise
- * @return None
- */
- virtual void NotifyEditorModeReply( TBool aStart ) = 0;
-
- };
-
-/**
- * Class for AT command handler and notifier
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtCmdHandler ) : public CBase,
- public MDunAtCmdPusher,
- public MDunAtEcomListen,
- public MDunAtModeListen
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aUpstream Callback to upstream
- * @param aDownstream Callback to downstream
- * @param aConnectionName Connection identifier name
- * @return Instance of self
- */
- IMPORT_C static CDunAtCmdHandler* NewL(
- MDunAtCmdStatusReporter* aUpstream,
- MDunStreamManipulator* aDownstream,
- const TDesC8* aConnectionName );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtCmdHandler();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- IMPORT_C void ResetData();
-
- /**
- * Adds callback for command mode notification
- * The callback will be called when command mode starts or ends
- *
- * @since TB9.2
- * @param aCallback Callback to call when command mode starts or ends
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt AddCmdModeCallback( MDunCmdModeMonitor* aCallback );
-
- /**
- * Adds data for parsing and parses if necessary
- *
- * @since TB9.2
- * @param aInput Data to add for parsing
- * @param aMoreNeeded ETrue if more data needed, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt AddDataForParsing( TDesC8& aInput, TBool& aMoreNeeded );
-
- /**
- * Manages request to abort command handling
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt ManageAbortRequest();
-
- /**
- * Sends a character to be echoed
- *
- * @since TB9.2
- * @param aInput Input to echo
- * @param aCallback Callback to echo request completions
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt SendEchoCharacter( const TDesC8* aInput,
- MDunAtCmdEchoer* aCallback );
-
- /**
- * Stops sending of AT command from decode buffer
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt Stop();
-
- /**
- * Starts URC message handling
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt StartUrc();
-
- /**
- * Stops URC message handling
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt StopUrc();
-
-private:
-
- CDunAtCmdHandler( MDunAtCmdStatusReporter* aUpstream,
- MDunStreamManipulator* aDownstream,
- const TDesC8* aConnectionName );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
- /**
- * Creates plugin handlers for this class
- *
- * @since TB9.2
- * @return None
- */
- void CreatePluginHandlersL();
-
- /**
- * Creates the array of special commands
- *
- * @since TB9.2
- * @return None
- */
- void CreateSpecialCommandsL();
-
- /**
- * Recreates special command data.
- * This is done when a plugin is installed or uninstalled.
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt RecreateSpecialCommands();
-
- /**
- * Gets default settings from RATExtCommon and sets them to RATExt
- *
- * @since TB9.2
- * @return None
- */
- void GetAndSetDefaultSettingsL();
-
- /**
- * Regenerates the reply strings based on settings
- *
- * @since TB9.2
- * @return ETrue if quiet mode, EFalse otherwise
- */
- TBool RegenerateReplyStrings();
-
- /**
- * Regenerates the ok reply based on settings
- *
- * @since TB9.2
- * @return ETrue if quiet mode, EFalse otherwise
- */
- TBool RegenerateOkReply();
-
- /**
- * Regenerates the error reply based on settings
- *
- * @since TB9.2
- * @return ETrue if quiet mode, EFalse otherwise
- */
- TBool RegenerateErrorReply();
-
- /**
- * Gets current mode
- *
- * @since TB9.2
- * @param aMask Mask for current mode (only one supported)
- * @return New current mode
- */
- TUint GetCurrentModeL( TUint aMask );
-
- /**
- * Instantiates one URC message handling class instance and adds it to
- * the URC message handler array
- *
- * @since TB9.2
- * @return None
- */
- CDunAtUrcHandler* AddOneUrcHandlerL();
-
- /**
- * Deletes all instantiated URC message handlers
- *
- * @since TB9.2
- * @return None
- */
- void DeletePluginHandlers();
-
- /**
- * Manages partial AT command
- *
- * @since TB9.2
- * @return ETrue if more data needed, EFalse otherwise
- */
- TBool ManagePartialCommand();
-
- /**
- * Echoes a command if echo is on
- *
- * @since TB9.2
- * @return ETrue if echo push started, EFalse otherwise
- */
- TBool EchoCommand();
-
- /**
- * Handles backspace and cancel characters
- *
- * @since TB9.2
- * @return ETrue if special character found, EFalse otherwise
- */
- TBool HandleSpecialCharacters();
-
- /**
- * Extracts line from input buffer to line buffer
- *
- * @since TB9.2
- * @return ETrue if more data needed, EFalse otherwise
- */
- TBool ExtractLineFromInputBuffer();
-
- /**
- * Handles generic buffer management
- * (explanation in ExtractLineFromInputBuffer())
- *
- * @since TB9.2
- * @param aStartIndex Start index for buffer to be copied
- * @param aCopyLength Length for data needed to be copied
- * @param aCopyNeeded ETrue if buffer copy needed
- * @return ETrue if more data needed, EFalse otherwise
- */
- TBool HandleGenericBufferManagement( TInt& aStartIndex,
- TInt& aCopyLength,
- TBool& aCopyNeeded );
-
- /**
- * Handles special buffer management
- * (explanation in ExtractLineFromInputBuffer())
- *
- * @since TB9.2
- * @param aStartIndex Start index for buffer to be copied
- * @param aCopyLength Length for data needed to be copied
- * @param aCopyNeeded ETrue if buffer copy needed
- * @return ETrue if more data needed, EFalse otherwise
- */
- TBool HandleSpecialBufferManagement( TInt aStartIndex,
- TInt& aCopyLength,
- TBool& aCopyNeeded );
-
- /**
- * Skips end-of-line characters
- *
- * @since TB9.2
- * @param aStartIndex Start index
- * @return Index to end of non-end-of-line or Symbian error code on error
- */
- TInt SkipEndOfLineCharacters( TInt aStartIndex );
-
- /**
- * Skips subcommand delimiter characters
- *
- * @since TB9.2
- * @param aStartIndex Start index
- * @return Index to end of delimiter or Symbian error code on error
- */
- TInt SkipSubCommandDelimiterCharacters( TInt aStartIndex );
-
- /**
- * Finds the end of the line
- *
- * @since TB9.2
- * @param aStartIndex Start index
- * @return Index to end of line or Symbian error code on error
- */
- TInt FindEndOfLine( TInt aStartIndex );
-
- /**
- * Handles next subcommand from line buffer
- *
- * @since TB9.2
- * @return ETrue if last command decoded, EFalse otherwise
- */
- TBool HandleNextSubCommand();
-
- /**
- * Manages end of AT command handling
- *
- * @since TB9.2
- * @param aNotifyLocal Notify local parties
- * @param aNotifyExternal Notify external parties
- * @return None
- */
- void ManageEndOfCmdHandling( TBool aNotifyLocal,
- TBool aNotifyExternal );
-
- /**
- * Extracts next subcommand from line buffer to send buffer
- *
- * @since TB9.2
- * @param aPeek Peek for the next command if ETrue, EFalse otherwise
- * @return ETrue if command extracted, EFalse otherwise
- */
- TBool ExtractNextSubCommand( TBool aPeek=EFalse );
-
- /**
- * Finds the start of subcommand from line buffer
- *
- * @since TB9.2
- * @return Index to the next command or Symbian error code on error
- */
- TInt FindStartOfSubCommand();
-
- /**
- * Restores old decode info. For ExtractNextSubCommand() when aPeeks is
- * ETrue.
- *
- * @since TB9.2
- * @param aPeek Peek for the next command if ETrue, EFalse otherwise
- * @param aOldInfo Old information to restore when aPeek is ETrue
- * @return None
- */
- void RestoreOldDecodeInfo( TBool aPeek, TDunDecodeInfo& aOldInfo );
-
- /**
- * Tests for end of AT command line
- *
- * @since TB9.2
- * @param aCharacter Character to test
- * @return ETrue if end of command, EFalse otherwise
- */
- TBool IsEndOfLine( TChar& aCharacter );
-
- /**
- * Checks if character is delimiter character
- *
- * @since TB9.2
- * @param aCharacter Character to test
- * @return ETrue if delimiter character, EFalse otherwise
- */
- TBool IsDelimiterCharacter( TChar aCharacter );
-
- /**
- * Checks if character is of extended group
- *
- * @since TB9.2
- * @param aCharacter Character to test
- * @return ETrue if extended character, EFalse otherwise
- */
- TBool IsExtendedCharacter( TChar aCharacter );
-
- /**
- * Checks special command
- *
- * @since TB9.2
- * @param aEndIndex End index (changes)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TBool CheckSpecialCommand( TInt& aEndIndex );
-
- /**
- * Saves character decode state for a found character
- *
- * @since TB9.2
- * @param aCharacter Character to save a state for
- * @param aAddSpecial ETrue to add character for special command,
- * EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- void SaveFoundCharDecodeState( TChar aCharacter,
- TBool aAddSpecial=ETrue );
-
- /**
- * Saves character decode state for a not found character
- *
- * @since TB9.2
- * @param aStartIndex Start index (doesn't change)
- * @param aEndIndex End index (changes)
- * @return Symbian error code on error, KErrNone otherwise
- */
- void SaveNotFoundCharDecodeState();
-
- /**
- * Find quotes within subcommands
- *
- * @since TB9.2
- * @param aCharacter Character to check
- * @param aStartIndex Start index (doesn't change)
- * @param aEndIndex End index (changes)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TBool FindSubCommandQuotes( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
-
- /**
- * Check if in next subcommand's extended border
- *
- * @since TB9.2
- * @param aCharacter Extended character to check
- * @param aStartIndex Start index (doesn't change)
- * @param aEndIndex End index (changes)
- * @return ETrue if in next command's extended border, EFalse otherwise
- */
- TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
-
- /**
- * Finds subcommand with alphanumeric borders
- *
- * @since TB9.2
- * @param aCharacter Character to check
- * @param aEndIndex End index (changes)
- * @return ETrue if alpha border found, EFalse otherwise
- */
- TBool FindSubCommandAlphaBorder( TChar aCharacter, TInt& aEndIndex );
-
- /**
- * Finds subcommand
- *
- * @since TB9.2
- * @param aEndIndex End index (changes)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt FindSubCommand( TInt& aEndIndex );
-
- /**
- * Check if "A/" command
- *
- * @since TB9.2
- * @return ETrue if "A/" command, EFalse otherwise
- */
- TBool IsASlashCommand();
-
- /**
- * Handles "A/" command
- *
- * @since TB9.2
- * @return ETrue if error reply push started, EFalse otherwise
- */
- TBool HandleASlashCommand();
-
- /**
- * Manages command mode change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return ETrue if command mode change detected, EFalse otherwise
- */
- TBool ManageCommandModeChange( TUint aMode );
-
- /**
- * Reports command mode start/end change
- *
- * @since TB9.2
- * @param aStart Command mode start if ETrue, end otherwise
- * @return None
- */
- void ReportCommandModeChange( TBool aStart );
-
- /**
- * Manages echo mode change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return ETrue if echo mode change detected, EFalse otherwise
- */
- TBool ManageEchoModeChange( TUint aMode );
-
- /**
- * Manages quiet mode change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return ETrue if quiet mode change detected, EFalse otherwise
- */
- TBool ManageQuietModeChange( TUint aMode );
-
- /**
- * Manages verbose mode change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return ETrue if verbose mode change detected, EFalse otherwise
- */
- TBool ManageVerboseModeChange( TUint aMode );
-
- /**
- * Manages character change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return None
- */
- void ManageCharacterChange( TUint aMode );
-
- /**
- * Manages editor mode reply
- *
- * @since TB9.2
- * @param aStart ETrue if start of editor mode, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ManageEditorModeReply( TBool aStart );
-
- /**
- * Finds the next content from the input buffer
- *
- * @since TB9.2
- * @param aStart ETrue if start of editor mode, EFalse otherwise
- * @return ETrue if next content found, EFalse otherwise
- */
- TBool FindNextContent( TBool aStart );
-
-// from base class MDunAtCmdPusher
-
- /**
- * From MDunAtCmdPusher.
- * Notifies about end of AT command processing.
- * This is after all reply data for an AT command is multiplexed to the
- * downstream.
- *
- * @since TB9.2
- * @param aError Error code of command processing completion
- * @return None
- */
- TInt NotifyEndOfProcessing( TInt aError );
-
- /**
- * Notifies about request to stop AT command handling for the rest of the
- * command line data
- *
- * @since TB9.2
- * @return None
- */
- void NotifyEndOfCmdLineProcessing();
-
- /**
- * Notifies about request to peek for the next command
- *
- * @since TB9.2
- * @return ETrue if next command exists, EFalse otherwise
- */
- TBool NotifyNextCommandPeekRequest();
-
- /**
- * Notifies about editor mode reply
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyEditorModeReply();
-
-// from base class MDunAtCmdEchoer
-
- /**
- * Notifies about completed echo in text mode
- *
- * @since TB9.2
- * @return None
- */
- void NotifyEchoComplete();
-
-// from base class MDunAtEcomListen
-
- /**
- * From MDunAtEcomListen.
- * Notifies about new plugin installation
- *
- * @since TB9.2
- * @return None
- */
- TInt NotifyPluginInstallation( TUid& aPluginUid );
-
- /**
- * From MDunAtEcomListen.
- * Notifies about existing plugin uninstallation
- *
- * @since TB9.2
- * @return None
- */
- TInt NotifyPluginUninstallation( TUid& aPluginUid );
-
-// from base class MDunAtModeListen
-
- /**
- * From MDunAtModeListen.
- * Gets called on mode status change
- *
- * @since TB9.2
- * @param aMode Mode to manage
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyModeStatusChange( TUint aMode );
-
-private: // data
-
- /**
- * Callback to call when AT command handling status changes
- * Not own.
- */
- MDunAtCmdStatusReporter* iUpstream;
-
- /**
- * Callback to call when data to push
- * Not own.
- */
- MDunStreamManipulator* iDownstream;
-
- /**
- * Callback(s) to call when command mode starts or ends
- * Usually two needed: one for upstream and second for downstream
- */
- RPointerArray<MDunCmdModeMonitor> iCmdCallbacks;
-
- /**
- * Connection identifier name
- */
- const TDesC8* iConnectionName;
-
- /**
- * Current state of AT command handling: active or inactive
- */
- TDunState iHandleState;
-
- /**
- * Character for carriage return
- */
- TInt8 iCarriageReturn;
-
- /**
- * Character for line feed
- */
- TInt8 iLineFeed;
-
- /**
- * Character for backspace
- */
- TInt8 iBackspace;
-
- /**
- * Current input to AddDataForParsing()
- * Not own.
- */
- TDesC8* iInput;
-
- /**
- * Special commands for parsing
- */
- RPointerArray<HBufC8> iSpecials;
-
- /**
- * Buffer for character echoing
- */
- TBuf8<KDunChSetMaxCharLen> iEchoBuffer;
-
- /**
- * Buffer for ok reply
- */
- TBuf8<KDunOkBufLength> iOkBuffer;
-
- /**
- * Buffer for error reply
- */
- TBuf8<KDunErrorBufLength> iErrorBuffer;
-
- /**
- * Buffer for AT command (one line)
- */
- TBuf8<KDunLineBufLength> iLineBuffer;
-
- /**
- * Buffer for last AT command input (for "A/")
- */
- TBuf8<KDunLineBufLength> iLastBuffer;
-
- /**
- * Buffer for <ESC> command
- */
- TBuf8<KDunEscBufLength> iEscapeBuffer;
-
- /**
- * AT command decoding related information
- */
- TDunDecodeInfo iDecodeInfo;
-
- /**
- * Information for parsing
- */
- TDunParseInfo iParseInfo;
-
- /**
- * Information for editor mode
- */
- TDunEditorModeInfo iEditorModeInfo;
-
- /**
- * AT command reply pusher
- * Own.
- */
- CDunAtCmdPusher* iCmdPusher;
-
- /**
- * AT command reply echoer
- * Own.
- */
- CDunAtCmdEchoer* iCmdEchoer;
-
- /**
- * URC message handlers
- * Own.
- */
- RPointerArray<CDunAtUrcHandler> iUrcHandlers;
-
- /**
- * ECOM plugin interface status change listener
- * Own.
- */
- CDunAtEcomListen* iEcomListen;
-
- /**
- * Modem mode status change listener
- * Own.
- */
- CDunAtModeListen* iModeListen;
-
- /**
- * NVRAM status change listener
- * Own.
- */
- CDunAtNvramListen* iNvramListen;
-
- /**
- * Flag to mark command mode start/end
- */
- TBool iDataMode;
-
- /**
- * Flag to be set on if echo on
- */
- TBool iEchoOn;
-
- /**
- * Flag to be set on if quiet mode on
- */
- TBool iQuietOn;
-
- /**
- * Flag to be set on if verbose mode on
- */
- TBool iVerboseOn;
-
- /**
- * End index for not added data in iCommand
- */
- TInt iEndIndex;
-
- /**
- * AT command extension
- */
- RATExt iAtCmdExt;
-
- /**
- * AT command extension to common functionality
- */
- RATExtCommon iAtCmdExtCommon;
-
- /**
- * Special AT command handler for handling commands like AT&FE0Q0V1&C1&D2+IFC=3,1.
- */
- CDunAtSpecialCmdHandler* iAtSpecialCmdHandler;
- };
-
-#endif // C_CDUNATCMDHANDLER_H
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdPusher.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,372 +0,0 @@
-/*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command pusher for downstream
-*
-*/
-
-#ifndef C_CDUNATCMDPUSHER_H
-#define C_CDUNATCMDPUSHER_H
-
-#include <atext.h>
-#include <e32base.h>
-#include "DunDataPusher.h"
-
-class MDunStreamManipulator;
-
-/**
- * Notification interface class for data pushing status changes
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunAtCmdPusher )
- {
-
-public:
-
- /**
- * Notifies about end of AT command processing.
- * This is after all reply data for an AT command is multiplexed to the
- * downstream.
- *
- * @since TB9.2
- * @param aError Error code of command processing completion
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyEndOfProcessing( TInt aError ) = 0;
-
- /**
- * Notifies about request to stop AT command handling for the rest of the
- * command line data
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual void NotifyEndOfCmdLineProcessing() = 0;
-
- /**
- * Notifies about request to peek for the next command
- *
- * @since TB9.2
- * @return ETrue if next command exists, EFalse otherwise
- */
- virtual TBool NotifyNextCommandPeekRequest() = 0;
-
- /**
- * Notifies about editor mode reply
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyEditorModeReply() = 0;
-
- };
-
-/**
- * Class for AT command URC handler
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtCmdPusher ) : public CActive,
- public MDunCompletionReporter
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aCallback Callback to AT command handler
- * @param aDownstream Callback to downstream,
- * @param aOkBuffer Buffer for ok reply
- * @return Instance of self
- */
- static CDunAtCmdPusher* NewL( RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer );
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aCallback Callback to AT command handler
- * @param aDownstream Callback to downstream
- * @param aOkBuffer Buffer for ok reply
- * @return Instance of self
- */
- static CDunAtCmdPusher* NewLC( RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtCmdPusher();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Starts AT command handling
- *
- * @since TB9.2
- * @param aInput AT command or editor mode input to handle
- * @param aNormalMode ETrue if request issue for normal mode
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest( TDesC8& aInput, TBool aNormalMode=ETrue );
-
- /**
- * Stops AT command handling
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
- /**
- * Manages request to abort command handling
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ManageAbortRequest();
-
- /**
- * Sets end of command line marker on for the possible series of AT
- * commands.
- *
- * @since TB9.2
- * @param aPushLast ETrue to push last reply, EFalse otherwise
- * @return None
- */
- void SetEndOfCmdLine();
-
- /**
- * Gets the editor mode status
- *
- * @since TB9.2
- * @return ETrue if in editor mode, EFalse otherwise
- */
- TBool EditorMode();
-
-private:
-
- CDunAtCmdPusher( RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
- /**
- * Sets state to idle and notifies about subcommand handling completion
- *
- * @since TB9.2
- * @param aError Error code for completion
- * @return None
- */
- void SetToIdleAndNotifyEnd( TInt aError );
-
- /**
- * Checks if "OK" (verbose) or "0" (numeric) string or exists at the end of
- * buffer and removes it
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt CheckAndRemoveOkString();
-
- /**
- * Sends reply data to downstream
- *
- * @since TB9.2
- * @param aRecvBuffer ETrue if using receive buffer
- * EFalse if using "OK" buffer
- * @return None
- */
- void SendReplyData( TBool aRecvBuffer=ETrue );
-
- /**
- * Manages change in reply type to EReplyTypeOther
- *
- * @since TB9.2
- * @return None
- */
- void ManageReplyTypeChangeToOther();
-
- /**
- * Manages change in reply type to EReplyTypeOk
- *
- * @since TB9.2
- * @return None
- */
- void ManageReplyTypeChangeToOk();
-
- /**
- * Manages change in reply type to EReplyTypeError
- *
- * @since TB9.2
- * @return None
- */
- void ManageReplyTypeChangeToError();
-
- /**
- * Manages change in reply type to EReplyTypeEditor
- *
- * @since TB9.2
- * @return None
- */
- void ManageReplyTypeChangeToEditor();
-
- /**
- * Manages change in reply type
- *
- * @since TB9.2
- * @return None
- */
- void ManageReplyTypeChange();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when AT command handled
- *
- * @since TB9.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since TB9.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunCompletionReporter
-
- /**
- * From MDunCompletionReporter.
- * Gets called when data push is complete
- *
- * @since TB9.2
- * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
- * @return None
- */
- void NotifyDataPushComplete( TBool aAllPushed );
-
-private: // data
-
- /**
- * AT command extension
- * Not own.
- */
- RATExt* iAtCmdExt;
-
- /**
- * Notification interface class for data pushing status changes
- * Not own.
- */
- MDunAtCmdPusher* iCallback;
-
- /**
- * Callback to call when data to push
- * Not own.
- */
- MDunStreamManipulator* iDownstream;
-
- /**
- * Buffer for ok reply
- * Not own.
- */
- TDesC8* iOkBuffer;
-
- /**
- * Current state of AT command handling: active or inactive
- */
- TDunState iAtPushState;
-
- /**
- * Buffer for receiving
- */
- TBuf8<KDefaultCmdBufLength> iRecvBuffer;
-
- /**
- * Indicates how many bytes of reply left
- */
- TInt iReplyBytesLeft;
-
- /**
- * Package for reply bytes left
- */
- TPckg<TInt> iReplyLeftPckg;
-
- /**
- * Reply type for the handled AT command
- */
- TATExtensionReplyType iReplyType;
-
- /**
- * Package for reply type for the handled AT command
- */
- TPckg<TATExtensionReplyType> iReplyTypePckg;
-
- /**
- * Flag indicating if other than "ERROR" reply already received in the
- * command line
- */
- TBool iNoErrorReceived;
-
- /**
- * Flag indicating if the last "OK" reply push is started
- */
- TBool iLastOkPush;
-
- /**
- * Flag indicating if abort already tried for one command
- */
- TBool iCmdAbort;
-
- /**
- * Flag indicating if stop needed after the next reply
- */
- TBool iStop;
-
- /**
- * Flag indicating if in editor mode
- */
- TBool iEditorMode;
-
- };
-
-#endif // C_CDUNATCMDPUSHER_H
--- a/localconnectivityservice/dun/atext/inc/DunAtEcomListen.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECom plugin install/uninstall/version listener
-*
-*/
-
-
-#ifndef C_CDUNATECOMLISTEN_H
-#define C_CDUNATECOMLISTEN_H
-
-#include <atext.h>
-#include "DunTransporter.h"
-
-/**
- * Notification interface class for ECOM plugin interface status changes
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunAtEcomListen )
- {
-
-public:
-
- /**
- * Notifies about new plugin installation
- *
- * @since TB9.2
- * @param aPluginUid UID of installed plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginInstallation( TUid& aPluginUid ) = 0;
-
- /**
- * Notifies about existing plugin uninstallation
- *
- * @since TB9.2
- * @param aPluginUid UID of uninstalled plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginUninstallation( TUid& aPluginUid ) = 0;
-
- };
-
-/**
- * Class for ECom plugin install/uninstall/version listener
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtEcomListen ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aCallback Callback to mode status change
- * @return Instance of self
- */
- static CDunAtEcomListen* NewL( RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback );
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aCallback Callback to mode status change
- * @return Instance of self
- */
- static CDunAtEcomListen* NewLC( RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtEcomListen();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Starts waiting for ECom plugin install/uninstall/version status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops waiting for Ecom plugin install/uninstall/version status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunAtEcomListen( RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when plugin installed, uninstalled or changed
- *
- * @since TB9.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since TB9.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * AT command extension
- * Not own.
- */
- RATExt* iAtCmdExt;
-
- /**
- * Callback to call when plugin installed, uninstalled or changed
- * Not own.
- */
- MDunAtEcomListen* iCallback;
-
- /**
- * Current state of ECom interface listening: active or inactive
- */
- TDunState iEcomListenState;
-
- /**
- * UID of the installed, uninstalled or changed plugin
- */
- TUid iPluginUid;
-
- /**
- * Package for plugin UID
- */
- TPckg<TUid> iPluginUidPckg;
-
- /**
- * Package for ECOM type
- */
- TPckg<TATExtensionEcomType> iEcomTypePckg;
-
- };
-
-#endif // C_CDUNATECOMLISTEN_H
--- a/localconnectivityservice/dun/atext/inc/DunAtModeListen.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Modem's mode listener and notifier
-*
-*/
-
-
-#ifndef C_CDUNATMODELISTEN_H
-#define C_CDUNATMODELISTEN_H
-
-#include <e32base.h>
-#include <atextcommon.h>
-#include "DunTransporter.h"
-
-/**
- * Notification interface class for modem's mode listener
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( MDunAtModeListen )
- {
-
-public:
-
- /**
- * Notifies about mode status change
- *
- * @since TB9.2
- * @param aMode Current modem modes
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyModeStatusChange( TUint aMode ) = 0;
-
- };
-
-/**
- * Class for modem's mode listener and notifier
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtModeListen ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * aAtCmdExtCommand AT command extension to common functionality
- * aCallback Callback to mode status change
- * @return Instance of self
- */
- static CDunAtModeListen* NewL( RATExtCommon* aAtCmdExtCommon,
- MDunAtModeListen* aCallback );
-
- /**
- * Two-phased constructor.
- * aAtCmdExtCommand AT command extension to common functionality
- * aCallback Callback to mode status change
- * @return Instance of self
- */
- static CDunAtModeListen* NewLC( RATExtCommon* aAtCmdExtCommon,
- MDunAtModeListen* aCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtModeListen();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Issues request to start monitoring for mode status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops monitoring for mode status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunAtModeListen( RATExtCommon* iAtCmdExtCommon,
- MDunAtModeListen* aCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when mode changes
- *
- * @since TB9.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since TB9.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * AT command extension to common functionality
- * Not own.
- */
- RATExtCommon* iAtCmdExtCommon;
-
- /**
- * Callback to call when mode status changes
- * Not own.
- */
- MDunAtModeListen* iCallback;
-
- /**
- * Current state of mode listening: active or inactive
- */
- TDunState iModeListenState;
-
- /**
- * Stored mode status change
- */
- TUint iMode;
-
- /**
- * Package for mode status changes
- */
- TPckg<TUint> iModePckg;
-
- };
-
-#endif // C_CDUNATMODELISTEN_H
--- a/localconnectivityservice/dun/atext/inc/DunAtNvramListen.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT NVRAM status change listener and notifier
-*
-*/
-
-#ifndef C_CDUNATNVRAMLISTEN_H
-#define C_CDUNATNVRAMLISTEN_H
-
-#include <atext.h>
-#include <atextcommon.h>
-#include "DunTransporter.h"
-
-/**
- * Class for AT NVRAM status change listener
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtNvramListen ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aAtCmdExtCommon Pointer to AT command extension to common
- * functionality
- * @return Instance of self
- */
- static CDunAtNvramListen* NewL( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon );
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aAtCmdExtCommon Pointer to AT command extension to common
- * functionality
- * @return Instance of self
- */
- static CDunAtNvramListen* NewLC( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtNvramListen();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Starts waiting for NVRAM status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops waiting for NVRAM status changes
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunAtNvramListen( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when NVRAM has changed
- *
- * @since TB9.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since TB9.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * AT command extension
- * Not own.
- */
- RATExt* iAtCmdExt;
-
- /**
- * AT command extension to common functionality
- * Not own.
- */
- RATExtCommon* iAtCmdExtCommon;
-
- /**
- * Current state of NVRAM status change listening; active or inactive
- */
- TDunState iNvramHandleState;
-
- /**
- * Buffer for NVRAM
- */
- TBuf8<KDefaultNvramBufLength> iNvramBuffer;
-
- /**
- * Flag to indicate start of receiving
- */
- TBool iStarted;
-
- };
-
-#endif // C_CDUNATNVRAMLISTEN_H
--- a/localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Special AT command handler
-*
-*/
-
-#ifndef C_CDUNATSPECIALCMDHANDLER_H
-#define C_CDUNATSPECIALCMDHANDLER_H
-
-#include <e32base.h>
-#include <badesca.h>
-
-const TInt KLineBufLength = (512 + 1); // Set this the same as in KDunLineBufLength
-
-/**
- * Class for special AT command handler
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtSpecialCmdHandler ) : public CBase
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param None
- * @return Instance of self
- */
- static CDunAtSpecialCmdHandler* NewL();
-
- /**
- * Destructor.
- */
- ~CDunAtSpecialCmdHandler();
-
-public:
-
- /**
- * Checks if the command has to be treated special way.
- * For example in case of MAC, it sends command AT&FE0Q0V1&C1&D2+IFC=3,1.
- * meaning there is no delimiters in the command.
- * In case of MAC we try to search AT&F (sub command) string from the
- * beginning of the command.
- * Search is done string basis.
- *
- * @since TB9.2
- * @param aCharacter Character to add
- * @return ETrue if data is ready for comparison, EFalse otherwise
- */
- TBool IsCompleteSubCommand( TChar aCharacter );
-
- /**
- * Resets the buffer used for comparisons
- *
- * @since TB9.2
- * @return None
- */
- void ResetComparisonBuffer();
-
-private:
-
- CDunAtSpecialCmdHandler();
-
- void ConstructL();
-
- /**
- * Defines when comparison is excecuted, checks if the data lengths are
- * equal.
- *
- * @since TB9.2
- * @return ETrue if data is ready for comparison, EFalse otherwise
- */
- TBool IsDataReadyForComparison( TInt aLength );
-
- /**
- * Defines minimum length of the special commands.
- *
- * @since TB9.2
- * @return Minimum length of the special commands
- */
- TInt MinimumLength();
-
-private: // data
-
- /**
- * Buffer for temporary AT command input
- */
- TBuf8<KLineBufLength> iBuffer;
-
- /**
- * Special commands for parsing
- */
- CDesC8Array *iSpecialCmds;
-
- };
-
-#endif // C_CDUNATSPECIALCMDHANDLER_H
--- a/localconnectivityservice/dun/atext/inc/DunAtUrcHandler.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command URC handler
-*
-*/
-
-
-#ifndef C_CDUNATURCHANDLER_H
-#define C_CDUNATURCHANDLER_H
-
-#include <atext.h>
-#include "DunDataPusher.h"
-
-class MDunStreamManipulator;
-
-/**
- * Class for AT command URC handler
- *
- * @lib dunatext.lib
- * @since TB9.2
- */
-NONSHARABLE_CLASS( CDunAtUrcHandler ) : public CActive,
- public MDunCompletionReporter
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aStreamCallback Callback to stream
- * @return Instance of self
- */
- static CDunAtUrcHandler* NewL( RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback );
-
- /**
- * Two-phased constructor.
- * @param aAtCmdExt Pointer to AT command extension
- * @param aStreamCallback Callback to stream
- * @return Instance of self
- */
- static CDunAtUrcHandler* NewLC( RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunAtUrcHandler();
-
- /**
- * Resets data to initial values
- *
- * @since TB9.2
- * @return None
- */
- void ResetData();
-
- /**
- * Starts waiting for an incoming URC message
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops waiting for an incoming URC message
- *
- * @since TB9.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
- /**
- * UID of the owning plugin
- *
- * @since TB9.2
- * @return UID of the owning plugin
- */
- TUid OwnerUid();
-
-private:
-
- CDunAtUrcHandler( RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since TB9.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when URC command received
- *
- * @since TB9.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since TB9.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunCompletionReporter
-
- /**
- * From MDunCompletionReporter.
- * Gets called when data push is complete
- *
- * @since TB9.2
- * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
- * @return None
- */
- void NotifyDataPushComplete( TBool aAllPushed );
-
-private: // data
-
- /**
- * AT command extension
- * Not own.
- */
- RATExt* iAtCmdExt;
-
- /**
- * Callback to call when data to push
- * Not own.
- */
- MDunStreamManipulator* iStreamCallback;
-
- /**
- * Current state of URC message handling: active or inactive
- */
- TDunState iUrcHandleState;
-
- /**
- * Buffer for receiving
- */
- TBuf8<KDefaultUrcBufLength> iRecvBuffer;
-
- /**
- * UID of the responsible ATEXT plugin
- */
- TUid iOwnerUid;
-
- /**
- * Package for owner UID
- */
- TPckg<TUid> iOwnerUidPckg;
-
- /**
- * Flag to indicate start of receiving (for ownership marking)
- */
- TBool iStarted;
-
- };
-
-#endif // C_CDUNATURCHANDLER_H
--- a/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Echoer for AT commands
-*
-*/
-
-#include "DunAtCmdEchoer.h"
-#include "DunDownstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdEchoer* CDunAtCmdEchoer::NewL(
- MDunStreamManipulator* aStreamCallback )
- {
- CDunAtCmdEchoer* self = new (ELeave) CDunAtCmdEchoer( aStreamCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdEchoer::~CDunAtCmdEchoer()
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::~CDunAtCmdEchoer()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtCmdEchoer::~CDunAtCmdEchoer() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdEchoer::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::ResetData()") ));
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtCmdEchoer::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Sends a character to be echoed
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdEchoer::SendEchoCharacter(
- const TDesC8* aInput,
- MDunAtCmdEchoer* aCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::SendEchoCharacter()") ));
- if ( iAtEchoState!=EDunStateIdle || iCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::SendEchoCharacter() (not ready) complete") ));
- return KErrNotReady;
- }
- iStreamCallback->NotifyDataPushRequest( aInput, this );
- iCallback = aCallback;
- iAtEchoState = EDunStateAtCmdEchoing;
- FTRACE(FPrint( _L("CDunDownstream::SendEchoCharacter() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdEchoer::CDunAtCmdEchoer
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdEchoer::CDunAtCmdEchoer( MDunStreamManipulator* aStreamCallback ) :
- iStreamCallback( aStreamCallback )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdEchoer::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdEchoer::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::ConstructL()") ));
- if ( !iStreamCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::ConstructL() complete") ));
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunAtCmdEchoer::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdEchoer::Initialize()
- {
- // Don't initialize iStreamCallback here (it is set through NewL)
- iCallback = NULL;
- iAtEchoState = EDunStateIdle;
- }
-
-// ---------------------------------------------------------------------------
-// From MDunCompletionReporter.
-// Gets called when data push is complete
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdEchoer::NotifyDataPushComplete( TBool /*aAllPushed*/ )
- {
- FTRACE(FPrint( _L("CDunAtCmdEchoer::NotifyDataPushComplete()") ));
- MDunAtCmdEchoer* callback = iCallback;
- iCallback = NULL;
- iAtEchoState = EDunStateIdle;
- callback->NotifyEchoComplete();
- FTRACE(FPrint( _L("CDunAtCmdEchoer::NotifyDataPushComplete() complete") ));
- }
--- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1991 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command handler and notifier
-*
-*/
-
-/*
- * Points to consider:
- * - Each of the AT commands sent to ATEXT are converted to upper case form.
- * Thus the ATEXT plugins don't need to check for case. The conversion to
- * upper case form stops when carriage return or '=' character is found.
- */
-
-/*
- * This file has the following functionality:
- * 1) Line buffer filler:
- * AddDataForParsing(), ManagePartialCommand(), ExtractLineFromInputBuffer(),
- * etc. This buffer is used for parsing. These functions are used for
- * splitter-combiner logic described below. CDunAtCmdPusher is used
- * separately for each element in the line buffer.
- * 2) Parser and splitter-combiner to handle the separater elements (subcommands)
- * in the line buffer. When end of line is detected, iEndIndex is used to
- * extract the next line in iInput to the line buffer (ManageEndOfCmdHandling()
- * and ExtractLineFromInputBuffer()).
- * 3) When end of iEndIndex is found (ExtractLineFromInputBuffer()), more data
- * is asked from CDunUpstream.
- * Note: There is separate handling for "one character input data" and "A/"
- * command handling which should be supported only for one line based data
- * (ManagePartialCommand()).
- */
-
-/*
- * The AT command handling is splitted to two parts on high level:
- * 1) Splitter: splitting the sub-commands in a command line to multiple ones
- * for ATEXT to process.
- * 2) Combiner: combining the replies coming from ATEXT using a filter
- * (the filter categories are explained in DunAtCmdPusher.cpp)
- */
-
-/*
- * Note1: This file uses AT command parsing based on heuristics.
- * Refer to test specification if planning to change the heuristic.
- * Note2: Input buffer management (ExtractLineFromInputBuffer()) can be tested
- * with non-line based terminals such as HyperTerminal or Realterm.
- */
-
-#include "DunAtCmdHandler.h"
-#include "DunAtUrcHandler.h"
-#include "DunDownstream.h"
-#include "DunDebug.h"
-
-const TInt8 KDunCancel = 24; // Used for line editing, cancel character
-const TInt8 KDunEscape = 27; // Used for editor ending, escape character
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CDunAtCmdHandler* CDunAtCmdHandler::NewL(
- MDunAtCmdStatusReporter* aUpstream,
- MDunStreamManipulator* aDownstream,
- const TDesC8* aConnectionName )
- {
- CDunAtCmdHandler* self = new (ELeave) CDunAtCmdHandler(
- aUpstream,
- aDownstream,
- aConnectionName );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdHandler::~CDunAtCmdHandler()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::~CDunAtCmdHandler()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtCmdHandler::~CDunAtCmdHandler() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunAtCmdHandler::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // NewL()
- DeletePluginHandlers();
- delete iCmdEchoer;
- iCmdEchoer = NULL;
- delete iNvramListen;
- iNvramListen = NULL;
- delete iModeListen;
- iModeListen = NULL;
- delete iEcomListen;
- iEcomListen = NULL;
- delete iAtSpecialCmdHandler;
- iAtSpecialCmdHandler = NULL;
- if ( iAtCmdExtCommon.Handle() )
- {
- iAtCmdExtCommon.SynchronousClose();
- iAtCmdExtCommon.Close();
- }
- if ( iAtCmdExt.Handle() )
- {
- iAtCmdExt.SynchronousClose();
- iAtCmdExt.Close();
- }
- iSpecials.ResetAndDestroy();
- iSpecials.Close();
- // AddCmdModeCallback()
- iCmdCallbacks.Close();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for command mode notification
-// The callback will be called when command mode starts or ends
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::AddCmdModeCallback( MDunCmdModeMonitor* aCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddCmdModeCallback()" ) ));
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddCmdModeCallback() (aCallback) not initialized!" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCmdCallbacks.Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddCmdModeCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCmdCallbacks.Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddCmdModeCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddCmdModeCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Adds data for parsing and parses if necessary
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::AddDataForParsing( TDesC8& aInput,
- TBool& aMoreNeeded )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing()") ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() received (%d bytes):"), aInput.Length() ));
- FTRACE(FPrintRaw(aInput) );
- TBool editorMode = iCmdPusher->EditorMode();
- if ( editorMode )
- {
- // Note: return here with "no more data needed" and some error to fool
- // CDunUpstream into not reissuing the read request.
- iCmdPusher->IssueRequest( aInput, EFalse );
- aMoreNeeded = EFalse;
- return KErrGeneral;
- }
- iInput = &aInput; // iInput only for normal mode
- // Manage partial AT command
- TBool moreNeeded = ManagePartialCommand();
- if ( moreNeeded )
- {
- aMoreNeeded = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (more partial) complete") ));
- return KErrNone;
- }
- if ( iHandleState != EDunStateIdle )
- {
- aMoreNeeded = EFalse;
- ManageEndOfCmdHandling( EFalse, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (not ready) complete") ));
- return KErrNotReady;
- }
- TBool pushStarted = HandleASlashCommand();
- if ( pushStarted )
- {
- // Note: return here with "partial input" status to fool CDunUpstream
- // into reissuing the read request. The AT command has not really
- // started yet so this is necessary.
- aMoreNeeded = ETrue;
- ManageEndOfCmdHandling( EFalse, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() (A/) complete") ));
- return KErrNone;
- }
- iHandleState = EDunStateAtCmdHandling;
- iDecodeInfo.iFirstDecode = ETrue;
- iDecodeInfo.iDecodeIndex = 0;
- iDecodeInfo.iPrevExists = EFalse;
- iParseInfo.iLimit = KErrNotFound;
- iParseInfo.iSendBuffer.Zero();
- iEditorModeInfo.iContentFound = EFalse;
- HandleNextSubCommand();
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddDataForParsing() complete") ));
- aMoreNeeded = EFalse;
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Manages request to abort command handling
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::ManageAbortRequest()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageAbortRequest()") ));
- // Just forward the request, do no other own processing
- TInt retVal = iCmdPusher->ManageAbortRequest();
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageAbortRequest() complete") ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Sends a character to be echoed
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::SendEchoCharacter( const TDesC8* aInput,
- MDunAtCmdEchoer* aCallback )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SendEchoCharacter()") ));
- TInt retVal = iCmdEchoer->SendEchoCharacter( aInput, aCallback );
- FTRACE(FPrint( _L("CDunAtCmdHandler::SendEchoCharacter() complete") ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Stops sending of AT command from parse buffer
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::Stop()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::Stop()") ));
- // Only stop iCmdPusher here, not iUrcHandlers!
- if ( iHandleState != EDunStateAtCmdHandling )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iCmdPusher->Stop();
- // The line below is used in the case when this function is called by
- // CDunUpstream as a result of "data mode ON" change notification.
- // In this case it is possible that HandleNextSubCommand() returns
- // without resetting the iSendBuffer because of the way it checks the
- // iHandleState.
- ManageEndOfCmdHandling( ETrue, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Starts URC message handling
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::StartUrc()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::StartUrc()") ));
- TInt i;
- TInt count = iUrcHandlers.Count();
- for ( i=0; i<count; i++ )
- {
- TInt retTemp = iUrcHandlers[i]->IssueRequest();
- if ( retTemp!=KErrNone && retTemp!=KErrNotReady )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::StartUrc() (ERROR) complete") ));
- return retTemp;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::StartUrc() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops URC message handling
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunAtCmdHandler::StopUrc()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::StopUrc()") ));
- TInt i;
- TInt retVal = KErrNone;
- TInt count = iUrcHandlers.Count();
- for ( i=0; i<count; i++ )
- {
- retVal = iUrcHandlers[i]->Stop();
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::StopUrc() complete") ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdHandler::CDunAtCmdHandler
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdHandler::CDunAtCmdHandler( MDunAtCmdStatusReporter* aUpstream,
- MDunStreamManipulator* aDownstream,
- const TDesC8* aConnectionName ) :
- iUpstream( aUpstream ),
- iDownstream( aDownstream ),
- iConnectionName( aConnectionName )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdHandler::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ConstructL()") ));
- if ( !iUpstream || !iDownstream || !iConnectionName )
- {
- User::Leave( KErrGeneral );
- }
- // Connect to AT command extension (must succeed)
- TInt retTemp = KErrNone;
- CleanupClosePushL( iAtCmdExt );
- retTemp = iAtCmdExt.Connect( EDunATExtension, *iConnectionName );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ConstructL() connect (%d)"), retTemp));
- User::Leave( retTemp );
- }
- CleanupClosePushL( iAtCmdExtCommon );
- retTemp = iAtCmdExtCommon.Connect( *iConnectionName );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ConstructL() common connect (%d)"), retTemp));
- User::Leave( retTemp );
- }
- // Create the array of special commands
- CreateSpecialCommandsL();
- // Create the plugin handlers
- CreatePluginHandlersL();
- // Create the echo handler
- iCmdEchoer = CDunAtCmdEchoer::NewL( iDownstream );
- // Create the listeners
- iEcomListen = CDunAtEcomListen::NewL( &iAtCmdExt, this );
- iModeListen = CDunAtModeListen::NewL( &iAtCmdExtCommon, this );
- iNvramListen = CDunAtNvramListen::NewL( &iAtCmdExt, &iAtCmdExtCommon );
- iAtSpecialCmdHandler = CDunAtSpecialCmdHandler::NewL();
- // Set the default modes (+report) and characters
- GetAndSetDefaultSettingsL();
- // Start listening
- iEcomListen->IssueRequest();
- iModeListen->IssueRequest();
- iNvramListen->IssueRequest();
- CleanupStack::Pop( &iAtCmdExtCommon );
- CleanupStack::Pop( &iAtCmdExt );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::Initialize()
- {
- // Don't initialize iUpstream here (it is set through NewL)
- // Don't initialize iDownstream here (it is set through NewL)
- // Don't initialize iConnectionName here (it is set through NewL)
- iHandleState = EDunStateIdle;
- iCarriageReturn = 0;
- iLineFeed = 0;
- iBackspace = 0;
- iInput = NULL;
- iDecodeInfo.iFirstDecode = ETrue;
- iDecodeInfo.iDecodeIndex = KErrNotFound;
- iDecodeInfo.iExtendedIndex = KErrNotFound;
- iDecodeInfo.iPrevChar = 0;
- iDecodeInfo.iPrevExists = EFalse;
- iDecodeInfo.iAssignFound = EFalse;
- iDecodeInfo.iInQuotes = EFalse;
- iDecodeInfo.iSpecialFound = EFalse;
- iDecodeInfo.iCmdsHandled = 0;
- iEditorModeInfo.iContentFound = EFalse;
- iCmdPusher = NULL;
- iEcomListen = NULL;
- iModeListen = NULL;
- iNvramListen = NULL;
- iDataMode = EFalse;
- iEchoOn = EFalse;
- iQuietOn = EFalse;
- iVerboseOn = EFalse;
- iEndIndex = KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Creates plugin handlers for this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::CreatePluginHandlersL()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::CreatePluginHandlersL()") ));
- if ( !iAtCmdExt.Handle() )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::CreatePluginHandlersL() complete") ));
- User::Leave( KErrGeneral );
- }
- // First create the command reply pusher
- CDunAtCmdPusher* cmdPusher = CDunAtCmdPusher::NewLC( &iAtCmdExt,
- this,
- iDownstream,
- &iOkBuffer );
- // Next create the URC handlers
- TInt i;
- TInt numOfPlugins = iAtCmdExt.NumberOfPlugins();
- for ( i=0; i<numOfPlugins; i++ )
- {
- AddOneUrcHandlerL();
- }
- CleanupStack::Pop( cmdPusher );
- iCmdPusher = cmdPusher;
- FTRACE(FPrint( _L("CDunAtCmdHandler::CreatePluginHandlersL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Creates an array of special commands
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::CreateSpecialCommandsL()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::CreateSpecialCommandsL()") ));
- TInt retTemp = KErrNone;
- TBool firstSearch = ETrue;
- for ( ;; )
- {
- // Let's borrow iLineBuffer for this purpose
- retTemp = iAtCmdExt.GetNextSpecialCommand( iLineBuffer, firstSearch );
- if ( retTemp != KErrNone )
- {
- break;
- }
- TInt lineLength = iLineBuffer.Length();
- HBufC8* specialCmd = HBufC8::NewMaxLC( lineLength );
- *specialCmd = iLineBuffer;
- iSpecials.AppendL( specialCmd );
- CleanupStack::Pop( specialCmd );
- }
- iLineBuffer.Zero();
- FTRACE(FPrint( _L("CDunAtCmdHandler::CreateSpecialCommandsL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Recreates special command data.
-// This is done when a plugin is installed or uninstalled.
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::RecreateSpecialCommands()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RecreateSpecialCommands()") ));
- iSpecials.ResetAndDestroy();
- TRAPD( retTrap, CreateSpecialCommandsL() );
- FTRACE(FPrint( _L("CDunAtCmdHandler::RecreateSpecialCommands() complete") ));
- return retTrap;
- }
-
-// ---------------------------------------------------------------------------
-// Gets default settings from RATExtCommon and sets them to RATExt
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::GetAndSetDefaultSettingsL()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetAndSetDefaultSettingsL()") ));
- // Note: Let's assume command mode is off by default
- TUint modeSet = GetCurrentModeL( KModeEcho | KModeQuiet | KModeVerbose );
- iEchoOn = ( modeSet & KEchoModeBase ) ? ETrue : EFalse;
- iQuietOn = ( modeSet & KQuietModeBase ) ? ETrue : EFalse;
- iVerboseOn = ( modeSet & KVerboseModeBase ) ? ETrue : EFalse;
- iCarriageReturn = GetCurrentModeL( KModeCarriage );
- iLineFeed = GetCurrentModeL( KModeLineFeed );
- iBackspace = GetCurrentModeL( KModeBackspace );
- iAtCmdExt.ReportQuietModeChange( iQuietOn );
- iAtCmdExt.ReportVerboseModeChange( iVerboseOn );
- iAtCmdExt.ReportCharacterChange( ECharTypeCarriage, iCarriageReturn );
- iAtCmdExt.ReportCharacterChange( ECharTypeLineFeed, iLineFeed );
- iAtCmdExt.ReportCharacterChange( ECharTypeBackspace, iBackspace );
- RegenerateReplyStrings();
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetAndSetDefaultSettingsL() settings: E=%d, Q=%d, V=%d"), iEchoOn, iQuietOn, iVerboseOn ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetAndSetDefaultSettingsL() settings: CR=%u, LF=%u, BS=%u"), iCarriageReturn, iLineFeed, iBackspace ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetAndSetDefaultSettingsL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Regenerates the reply strings based on settings
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::RegenerateReplyStrings()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateReplyStrings()") ));
- TBool retVal = EFalse;
- retVal |= RegenerateOkReply();
- retVal |= RegenerateErrorReply();
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateReplyStrings() complete") ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Regenerates the ok reply based on settings
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::RegenerateOkReply()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply()") ));
- if ( iDownstream->IsDataInQueue(&iOkBuffer) )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply() (in queue!) complete") ));
- return iQuietOn;
- }
- iOkBuffer.Zero();
- if ( iQuietOn )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply() (quiet) complete") ));
- return ETrue;
- }
- if ( iVerboseOn )
- {
- _LIT8( KVerboseOk, "OK" );
- iOkBuffer.Append( iCarriageReturn );
- iOkBuffer.Append( iLineFeed );
- iOkBuffer.Append( KVerboseOk );
- iOkBuffer.Append( iCarriageReturn );
- iOkBuffer.Append( iLineFeed );
- }
- else
- {
- _LIT8( KNumericOk, "0" );
- iOkBuffer.Append( KNumericOk );
- iOkBuffer.Append( iCarriageReturn );
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateOkReply() complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Regenerates the error reply based on settings
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::RegenerateErrorReply()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply()") ));
- if ( iDownstream->IsDataInQueue(&iErrorBuffer) )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply() (in queue!) complete") ));
- return iQuietOn;
- }
- iErrorBuffer.Zero();
- if ( iQuietOn )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply() (quiet) complete") ));
- return ETrue;
- }
- if ( iVerboseOn )
- {
- _LIT8( KVerboseError, "ERROR" );
- iErrorBuffer.Append( iCarriageReturn );
- iErrorBuffer.Append( iLineFeed );
- iErrorBuffer.Append( KVerboseError );
- iErrorBuffer.Append( iCarriageReturn );
- iErrorBuffer.Append( iLineFeed );
- }
- else
- {
- _LIT8( KNumericError, "4" );
- iErrorBuffer.Append( KNumericError );
- iErrorBuffer.Append( iCarriageReturn );
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::RegenerateErrorReply() complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Gets current mode
-// ---------------------------------------------------------------------------
-//
-TUint CDunAtCmdHandler::GetCurrentModeL( TUint aMask )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetCurrentModeL()") ));
- TUint maskCheck = aMask & ( ~KSupportedModes );
- if ( maskCheck != 0 )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetCurrentModeL() (not supported) complete") ));
- User::Leave( KErrNotSupported );
- }
- TUint newMode = 0;
- TInt retTemp = iAtCmdExtCommon.GetMode( aMask, newMode );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetCurrentModeL() (ERROR) complete") ));
- User::Leave( retTemp );
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::GetCurrentModeL() complete") ));
- return newMode & (KModeChanged-1);
- }
-
-// ---------------------------------------------------------------------------
-// Instantiates one URC message handling class instance and adds it to the URC
-// message handler array
-// ---------------------------------------------------------------------------
-//
-CDunAtUrcHandler* CDunAtCmdHandler::AddOneUrcHandlerL()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddOneUrcHandlerL()") ));
- CDunAtUrcHandler* urcHandler = CDunAtUrcHandler::NewLC( &iAtCmdExt,
- iDownstream );
- iUrcHandlers.AppendL( urcHandler );
- CleanupStack::Pop( urcHandler );
- FTRACE(FPrint( _L("CDunAtCmdHandler::AddOneUrcHandlerL() complete") ));
- return urcHandler;
- }
-
-// ---------------------------------------------------------------------------
-// Deletes all instantiated URC message handlers
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::DeletePluginHandlers()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::DeletePluginHandlers()") ));
- delete iCmdPusher;
- iCmdPusher = NULL;
- TInt i;
- TInt count = iUrcHandlers.Count();
- for ( i=0; i<count; i++ )
- {
- delete iUrcHandlers[i];
- iUrcHandlers[i] = NULL;
- }
- iUrcHandlers.Reset();
- iUrcHandlers.Close();
- FTRACE(FPrint( _L("CDunAtCmdHandler::DeletePluginHandlers() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages partial AT command
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ManagePartialCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand()") ));
- // Check one character (or unit) based input data
- if ( iInput->Length() == KDunChSetMaxCharLen )
- {
- EchoCommand();
- // Handle backspace and cancel characters
- TBool found = HandleSpecialCharacters();
- if ( found )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (special) complete") ));
- return ETrue;
- }
- }
- TBool moreNeeded = ExtractLineFromInputBuffer();
- if ( moreNeeded )
- {
- // More data is not needed with "A/" (no carriage return), check that
- // special case here, otherwise continue processing
- if ( !IsASlashCommand() )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (more) complete") ));
- return ETrue;
- }
- }
- // If something went wrong, do nothing (return consumed)
- if ( iLineBuffer.Length() <= 0 )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() (length) complete") ));
- return ETrue;
- }
- // For other commands, just return with consumed
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManagePartialCommand() complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Echoes a command if echo is on
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::EchoCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand()") ));
- if ( iInput->Length() > KDunChSetMaxCharLen )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() (wrong length) complete") ));
- return EFalse;
- }
- if ( iEchoOn )
- {
- if ( iDownstream->IsDataInQueue(&iEchoBuffer) )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() (in queue!) complete") ));
- return EFalse;
- }
- iEchoBuffer.Copy( *iInput );
- iDownstream->NotifyDataPushRequest( &iEchoBuffer, NULL );
- FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::EchoCommand() (not started) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Handles backspace and cancel characters
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::HandleSpecialCharacters()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters()") ));
- if ( iInput->Length() != KDunChSetMaxCharLen )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (wrong length) complete") ));
- return EFalse;
- }
- if ( (*iInput)[0] == iBackspace )
- {
- TInt lineLength = iLineBuffer.Length();
- if ( lineLength > 0 )
- {
- iLineBuffer.SetLength( lineLength-1 );
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (backspace) complete") ));
- return ETrue;
- }
- if ( (*iInput)[0] == KDunCancel )
- {
- ManageEndOfCmdHandling( EFalse, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() (cancel) complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialCharacters() complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Extracts line from input buffer to line buffer
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ExtractLineFromInputBuffer()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer()") ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() before (%d bytes):"), iLineBuffer.Length() ));
- FTRACE(FPrintRaw(iLineBuffer) );
- // Case1: If no data in iLineBuffer and end-of-line character in iInputBuffer[start]:
- // - Skip end-of-line characters, find start-of-line condition, find end-of-line character
- // - If partial line found (start-of-line condition and no end-of-line character):
- // - Save partial line to iLineBuffer
- // - Set iEndIndex to end of iInputBuffer
- // - If full line found (start-of-line condition and end-of-line character):
- // - Save full line to iLineBuffer
- // - Skip multiple end-of-line characters until next start-of-line
- // condition or end of iInputBuffer -> save this position to iEndIndex
- // Case2: If no data in iLineBuffer and non-end-of-line character in iInputBuffer[start]:
- // - Find end-of-line character
- // - If partial line found (no end-of-line character):
- // - Save partial line to iLineBuffer
- // - Set iEndIndex to end of iLineBuffer
- // - If full line found (end-of-line character):
- // - Save full line to iLineBuffer
- // - Skip multiple end-of-line characters until next start-of-line
- // condition or end of iInputBuffer -> save this position to iEndIndex
- // Case3: If data in iLineBuffer and end-of-line character in iInputBuffer[start]:
- // - Skip end-of-line characters
- // - Keep string currently in iLineBuffer
- // - Skip end-of-line characters until non-end-of-line or end of
- // iInputBuffer -> save this position to iEndIndex
- // Case4: If data in iLineBuffer and non-end-of-line character in iInputBuffer[start]:
- // - Processed the same way as Case1, however "Skip end-of-line characters" does
- // not have any effect
- if ( iInput->Length() <= 0 )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (wrong length) complete") ));
- return ETrue;
- }
- TBool moreNeeded = ETrue;
- TBool copyNeeded = EFalse;
- TInt copyLength = KErrNotFound;
- TInt lineLength = iLineBuffer.Length();
- TInt lineMaxLength = iLineBuffer.MaxLength();
- TInt freeLineSpace = lineMaxLength - lineLength;
- TInt inputLength = iInput->Length();
- TInt startIndex = ( iEndIndex>=0 ) ? iEndIndex : 0;
- if ( startIndex >= inputLength )
- {
- iEndIndex = KErrNotFound;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (input end) complete") ));
- return ETrue;
- }
- // Cases here:
- // Case1: If no data in iLineBuffer and end-of-line character in iInputBuffer[start]
- // Case2: If no data in iLineBuffer and non-end-of-line character in iInputBuffer[start]
- // Case3: If data in iLineBuffer and end-of-line character in iInputBuffer[start]
- // Case4: If data in iLineBuffer and non-end-of-line character in iInputBuffer[start]
- // Summary: Cases 1, 2 and 4 can be combined. Case 3 needs a separate check.
- TChar character = (*iInput)[startIndex];
- TBool endOfLine = IsEndOfLine(character);
- if ( lineLength>0 && endOfLine )
- {
- moreNeeded = HandleSpecialBufferManagement( startIndex,
- copyLength,
- copyNeeded );
- }
- else
- {
- moreNeeded = HandleGenericBufferManagement( startIndex,
- copyLength,
- copyNeeded );
- }
- if ( copyNeeded && copyLength>0 )
- {
- // Check the case copyLength does not fit to iLineBuffer
- // This case should be handled by returning "more data needed"
- // Also reset the iLineBuffer to ensure the handling doesn't stuck
- // for rest of the commands (usability case)
- if ( copyLength > freeLineSpace )
- {
- iLineBuffer.Zero();
- iEndIndex = KErrNotFound;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
- FTRACE(FPrintRaw(iLineBuffer) );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (overflow) complete") ));
- return ETrue;
- }
- iLineBuffer.Append( &(*iInput)[startIndex], copyLength );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
- FTRACE(FPrintRaw(iLineBuffer) );
- }
- if ( moreNeeded )
- {
- iEndIndex = KErrNotFound;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (more needed) complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (line found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Handles generic buffer management
-// (explanation in ExtractLineFromInputBuffer())
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::HandleGenericBufferManagement( TInt& aStartIndex,
- TInt& aCopyLength,
- TBool& aCopyNeeded )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement()") ));
- TInt inputLength = iInput->Length();
- TInt currentIndex = SkipEndOfLineCharacters( aStartIndex );
- if ( currentIndex >= inputLength )
- {
- // No data in iLineBuffer and only end-of-lines in new buffer
- // return with "need more data"
- iEndIndex = inputLength;
- aCopyLength = 0;
- aCopyNeeded = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (new end for old no data) complete") ));
- return ETrue;
- }
- // No data in iLineBuffer and non-end-of-line character found
- // Try to find the first start-of-line condition
- TInt lineLength = iLineBuffer.Length();
- if ( lineLength == 0 )
- {
- currentIndex = SkipSubCommandDelimiterCharacters( aStartIndex );
- if ( currentIndex >= inputLength )
- {
- // No data in iLineBuffer and only end-of-lines+delimiter in new buffer
- // return with "need more data"
- iEndIndex = inputLength;
- aCopyLength = 0;
- aCopyNeeded = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (new end+delim for old no data) complete") ));
- return ETrue;
- }
- }
- aStartIndex = currentIndex;
- // No data in iLineBuffer and other than end-of-line or delimiter character found
- // Variable currentIndex is now the start of new command
- // Next try to find the end of the command
- TInt endIndex = FindEndOfLine( aStartIndex );
- if ( endIndex >= inputLength )
- {
- // No data in iLineBuffer and start of command found without end
- // return with "need more data"
- iEndIndex = inputLength;
- aCopyLength = inputLength - aStartIndex;
- aCopyNeeded = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (start but no end for old no data) complete") ));
- return ETrue;
- }
- // No data in iLineBuffer and end-of-line character found
- // Try to skip possible multiple end-of-line characters
- currentIndex = SkipEndOfLineCharacters( endIndex );
- // Variable currentIndex is now either start of next command or end of iInput
- // Note that this requires that Case 2 must skip the possible IsDelimiterCharacter()s
- iEndIndex = currentIndex;
- aCopyLength = endIndex - aStartIndex;
- aCopyNeeded = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleGenericBufferManagement() (line found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Handles special buffer management
-// (explanation in ExtractLineFromInputBuffer())
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::HandleSpecialBufferManagement( TInt aStartIndex,
- TInt& aCopyLength,
- TBool& aCopyNeeded )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialBufferManagement()") ));
- TInt currentIndex = SkipEndOfLineCharacters( aStartIndex );
- // Variable currentIndex is now either start of next command or end of iInput
- iEndIndex = currentIndex;
- aCopyLength = 0;
- aCopyNeeded = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleSpecialBufferManagement() complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Skips end-of-line characters
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::SkipEndOfLineCharacters( TInt aStartIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SkipEndOfLineCharacters()") ));
- TInt foundIndex = iInput->Length();
- TInt inputLength = foundIndex;
- for ( TInt i=aStartIndex; i<inputLength; i++ )
- {
- TChar character = (*iInput)[i];
- if ( !IsEndOfLine(character) )
- {
- foundIndex = i;
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::SkipEndOfLineCharacters() complete") ));
- return foundIndex;
- }
-
-// ---------------------------------------------------------------------------
-// Skips subcommand delimiter characters
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::SkipSubCommandDelimiterCharacters( TInt aStartIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SkipSubCommandDelimiterCharacters()") ));
- TInt inputLength = iInput->Length();
- TInt foundIndex = inputLength;
- for ( TInt i=aStartIndex; i<inputLength; i++ )
- {
- TChar character = (*iInput)[i];
- if ( !IsDelimiterCharacter(character) )
- {
- foundIndex = i;
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::SkipSubCommandDelimiterCharacters() complete") ));
- return foundIndex;
- }
-
-// ---------------------------------------------------------------------------
-// Finds the end of the line
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::FindEndOfLine( TInt aStartIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfLine()") ));
- TInt inputLength = iInput->Length();
- TInt foundIndex = inputLength;
- for ( TInt i=aStartIndex; i<inputLength; i++ )
- {
- TChar character = (*iInput)[i];
- // Checking for IsDelimiterCharacter() here needs more logic (a parser).
- // Just check with "IsEndOfLine()"
- if ( IsEndOfLine(character) )
- {
- foundIndex = i;
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindEndOfLine() complete") ));
- return foundIndex;
- }
-
-// ---------------------------------------------------------------------------
-// Handles next subcommand from line buffer
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::HandleNextSubCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand()") ));
- if ( iHandleState != EDunStateAtCmdHandling )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() (not ready) complete") ));
- return EFalse;
- }
- TBool extracted = ExtractNextSubCommand();
- if ( !extracted )
- {
- ManageEndOfCmdHandling( ETrue, ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() (last) complete") ));
- return EFalse;
- }
- // Next convert the decoded AT command to uppercase
- // Don't check for case status -> let mixed cases pass
- TInt oldLength = iParseInfo.iSendBuffer.Length();
- iParseInfo.iSendBuffer.SetLength( iParseInfo.iLimit );
- iParseInfo.iSendBuffer.UpperCase();
- iParseInfo.iSendBuffer.SetLength( oldLength );
- // Next always send the command to ATEXT
- iCmdPusher->IssueRequest( iParseInfo.iSendBuffer );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleNextSubCommand() complete") ));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Manages end of AT command handling
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::ManageEndOfCmdHandling( TBool aNotifyLocal,
- TBool aNotifyExternal )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling()") ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling() (loc=%d, ext=%d)"), aNotifyLocal, aNotifyExternal ));
- // If iEndIndex is (>=0 && <iInput.Length()) it means more data waits in
- // iInput that didn't fit in iInputBuffer.
- TInt cmdLength = iInput->Length();
- TBool subBlock = ( iEndIndex>=0&&iEndIndex<cmdLength ) ? ETrue : EFalse;
- if ( iLineBuffer.Length()>0 && !subBlock )
- {
- // Line buffer set and no partial subblock, copy to lastbuffer
- iLastBuffer.Copy( iLineBuffer );
- }
- iLineBuffer.Zero();
- iDecodeInfo.iFirstDecode = ETrue;
- iDecodeInfo.iDecodeIndex = 0;
- iDecodeInfo.iPrevExists = EFalse;
- iParseInfo.iLimit = KErrNotFound;
- iParseInfo.iSendBuffer.Zero();
- iEditorModeInfo.iContentFound = EFalse;
- iHandleState = EDunStateIdle;
- if ( aNotifyLocal )
- {
- iCmdPusher->SetEndOfCmdLine();
- }
- // iEndIndex must not be reset to KErrNotFound only when
- // ExtractLineFromInputBuffer() found the next line
- // (when moreNeeded is EFalse)
- TBool resetIndex = ETrue;
- if ( aNotifyExternal )
- {
- TBool moreNeeded = ExtractLineFromInputBuffer();
- if ( moreNeeded )
- {
- iUpstream->NotifyParserNeedsMoreData();
- }
- else
- {
- // AppendBlockToInputBuffer() was able to fill with known end, handle next
- iHandleState = EDunStateAtCmdHandling;
- HandleNextSubCommand();
- resetIndex = EFalse;
- }
- }
- if ( resetIndex )
- {
- iEndIndex = KErrNotFound;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEndOfCmdHandling() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Extracts next subcommand from line buffer to send buffer
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ExtractNextSubCommand( TBool aPeek )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand()") ));
- TDunDecodeInfo oldInfo = iDecodeInfo;
- iParseInfo.iLimit = KErrNotFound;
- iParseInfo.iSendBuffer.Zero();
- // Find start of subcommand from line buffer
- TInt startIndex = FindStartOfSubCommand();
- if ( startIndex < 0 )
- {
- RestoreOldDecodeInfo( aPeek, oldInfo );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextDecodedCommand() (no start) complete") ));
- return EFalse;
- }
- iDecodeInfo.iDecodeIndex = startIndex;
- TBool specialCmd = EFalse;
- TInt endIndex = KErrNotFound;
- specialCmd = CheckSpecialCommand( endIndex );
- if ( !specialCmd )
- {
- FindSubCommand( endIndex );
- }
- TInt lineLength = iLineBuffer.Length();
- TBool inStartLimits = ( startIndex >= 0 && startIndex < lineLength ) ? ETrue : EFalse;
- TBool inEndLimits = ( endIndex >= 0 && endIndex < lineLength ) ? ETrue : EFalse;
- if ( !inStartLimits || !inEndLimits )
- {
- RestoreOldDecodeInfo( aPeek, oldInfo );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (no end) complete") ));
- return EFalse;
- }
- TInt cmdLength = endIndex - startIndex + 1;
- // If the limit was not already set then do it now
- if ( iParseInfo.iLimit < 0 )
- {
- iParseInfo.iLimit = cmdLength;
- }
- // Next create a new command
- if ( !iDecodeInfo.iFirstDecode )
- {
- _LIT( KAtPrefix, "AT" );
- iParseInfo.iSendBuffer.Append( KAtPrefix );
- if ( !specialCmd ) // Already added with CheckSpecialCommand()
- {
- iParseInfo.iLimit += 2; // Length of "AT"
- }
- // Note: The length of iDecodeBuffer is not exceeded here because "AT"
- // is added only for the second commands after that.
- }
- iParseInfo.iSendBuffer.Append( &iLineBuffer[startIndex], cmdLength );
- // Change settings for the next decode round
- iDecodeInfo.iFirstDecode = EFalse;
- iDecodeInfo.iDecodeIndex = endIndex + 1;
- RestoreOldDecodeInfo( aPeek, oldInfo );
- if ( !aPeek )
- {
- iDecodeInfo.iCmdsHandled++;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (handled=%d)"), iDecodeInfo.iCmdsHandled ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() complete") ));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Finds the start of subcommand from line buffer
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::FindStartOfSubCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfSubCommand()") ));
- TInt i;
- TInt foundIndex = KErrNotFound;
- TInt lineLength = iLineBuffer.Length();
- for ( i=iDecodeInfo.iDecodeIndex; i<lineLength; i++ )
- {
- TChar character = iLineBuffer[i];
- if ( !IsDelimiterCharacter(character) )
- {
- foundIndex = i;
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindStartOfSubCommand() complete") ));
- return foundIndex;
- }
-
-// ---------------------------------------------------------------------------
-// Restores old decode info. For ExtractNextDecodedCommand() when aPeeks is
-// ETrue.
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::RestoreOldDecodeInfo( TBool aPeek,
- TDunDecodeInfo& aOldInfo )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::RestoreOldDecodeInfo()") ));
- if ( aPeek )
- {
- iEditorModeInfo.iPeekInfo = iDecodeInfo;
- iDecodeInfo = aOldInfo;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::RestoreOldDecodeInfo() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Tests for end of AT command line
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsEndOfLine( TChar& aCharacter )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsEndOfCommand()") ));
- if ( aCharacter==iCarriageReturn || aCharacter==iLineFeed )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsEndOfCommand() (found) complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsEndOfCommand() (not found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Checks if character is delimiter character
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsDelimiterCharacter( TChar aCharacter )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter()") ));
- if ( aCharacter.IsSpace() || aCharacter==';' || aCharacter==0x00 )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() (not delimiter) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Checks if character is of extended group
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsExtendedCharacter( TChar aCharacter )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter()") ));
- if ( aCharacter=='+' || aCharacter=='&' || aCharacter=='%' ||
- aCharacter=='\\' || aCharacter=='*' || aCharacter=='#' ||
- aCharacter=='$' || aCharacter=='^' )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter() complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter() (not extended) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Checks special command
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::CheckSpecialCommand( TInt& aEndIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand()") ));
- TInt atPrefixLen = 0;
- TInt startIndex = iDecodeInfo.iDecodeIndex;
- TInt newLength = iLineBuffer.Length() - startIndex;
- TBuf8<KDunLineBufLength> upperBuf;
- if ( !iDecodeInfo.iFirstDecode )
- {
- // For cases such as "ATM1L3DT*99#" "DT" must have "AT"
- _LIT8( KAtPrefix, "AT" );
- upperBuf.Copy( KAtPrefix );
- atPrefixLen = 2; // "AT"
- newLength += atPrefixLen;
- }
- upperBuf.Append( &iLineBuffer[startIndex], newLength );
- upperBuf.UpperCase();
- TInt i;
- TInt count = iSpecials.Count();
- for ( i=0; i<count; i++ )
- {
- HBufC8* specialCmd = iSpecials[i];
- TInt specialLength = specialCmd->Length();
- if ( newLength < specialLength )
- {
- continue;
- }
- TInt origLength = newLength;
- if ( newLength > specialLength )
- {
- upperBuf.SetLength( specialLength );
- }
- TInt cmpResult = upperBuf.Compare( *specialCmd );
- upperBuf.SetLength( origLength );
- if ( cmpResult == 0 )
- {
- iParseInfo.iLimit = specialLength;
- aEndIndex = (origLength-1) + startIndex - atPrefixLen;
- FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() complete") ));
- return ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::CheckSpecialCommand() (not found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Saves character decode state for a found character
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::SaveFoundCharDecodeState( TChar aCharacter,
- TBool aAddSpecial )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SaveFoundCharDecodeState()") ));
- iDecodeInfo.iPrevExists = ETrue;
- iDecodeInfo.iPrevChar = aCharacter;
- if ( aAddSpecial )
- {
- iDecodeInfo.iSpecialFound =
- iAtSpecialCmdHandler->IsCompleteSubCommand( aCharacter );
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::SaveFoundCharDecodeState() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Saves character decode state for a not found character
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::SaveNotFoundCharDecodeState()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::SaveNotFoundCharDecodeState()") ));
- iDecodeInfo.iPrevExists = EFalse;
- // Note: don't set iAssignFound or iInQuotes here
- iDecodeInfo.iSpecialFound = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::SaveNotFoundCharDecodeState() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Find quotes within subcommands
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::FindSubCommandQuotes( TChar aCharacter,
- TInt aStartIndex,
- TInt& aEndIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandQuotes()") ));
- if ( aCharacter == '"' )
- {
- if ( iParseInfo.iLimit < 0 ) // Only first the first '"'
- {
- iParseInfo.iLimit = aEndIndex - aStartIndex;
- }
- iDecodeInfo.iInQuotes ^= ETrue; // EFalse to ETrue or ETrue to EFalse
- SaveFoundCharDecodeState( aCharacter, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandQuotes() (quote) complete") ));
- return ETrue;
- }
- // The next ones are those that are not in quotes.
- // We still need to save the iParseInfo.iLimit and skip non-delimiter characters.
- if ( aCharacter == '=' )
- {
- if ( iParseInfo.iLimit < 0 ) // Only first the first '"'
- {
- iParseInfo.iLimit = aEndIndex - aStartIndex;
- }
- iDecodeInfo.iAssignFound = ETrue;
- SaveFoundCharDecodeState( aCharacter, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandQuotes() (equals) complete") ));
- return ETrue;
- }
- if ( iDecodeInfo.iInQuotes )
- {
- SaveNotFoundCharDecodeState();
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandQuotes() (in quotes) complete") ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandQuotes() (not found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Check if in next subcommand's extended border
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsExtendedBorder( TChar aCharacter,
- TInt aStartIndex,
- TInt& aEndIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder()") ));
- TInt expectedIndex = 0; // "+CMD" when iDecodeInfo.iFirstDecode is EFalse
- TInt extendedIndex = aEndIndex - aStartIndex; // absolute index to the extended character
- if ( iDecodeInfo.iFirstDecode )
- {
- expectedIndex = 2; // "AT+CMD"
- }
- if ( extendedIndex == expectedIndex )
- {
- iDecodeInfo.iExtendedIndex = aEndIndex;
- SaveFoundCharDecodeState( aCharacter );
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border normal) complete") ));
- return EFalse;
- }
- // Now suspect border found so peek the next character after the suspected
- // extended character. If it is not alphabetical character, return with EFalse.
- // This case is to detect the cases such as "AT+VTS={*,3000}", where '*' would
- // be the start of the next command in normal cases.
- TInt peekIndex = aEndIndex + 1;
- TInt lineLength = iLineBuffer.Length();
- if ( peekIndex < lineLength )
- {
- TChar nextCharacter = iLineBuffer[peekIndex];
- if ( !nextCharacter.IsAlpha() )
- {
- SaveFoundCharDecodeState( aCharacter );
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border special) complete") ));
- return EFalse;
- }
- }
- aEndIndex--;
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (border) complete") ));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Finds subcommand with alphanumeric borders
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::FindSubCommandAlphaBorder( TChar aCharacter,
- TInt& aEndIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder()") ));
- if ( iDecodeInfo.iAssignFound && !iDecodeInfo.iInQuotes )
- {
- // Check the special case when assigning a number with "basic" command
- // and there is no delimiter after it. In this case <Numeric>|<Alpha>
- // border must be detected but only for a "basic" command, not for
- // extended.
- if ( iDecodeInfo.iExtendedIndex<0 && iDecodeInfo.iPrevExists &&
- iDecodeInfo.iPrevChar.IsDigit() && aCharacter.IsAlpha() )
- {
- aEndIndex--;
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (N|A) complete") ));
- return ETrue;
- }
- // The code below is for the following type of cases:
- // (do not check alphanumeric borders if "=" set without quotes):
- // AT+CMD=a
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (skip) complete") ));
- return EFalse;
- }
- if ( !iDecodeInfo.iPrevExists || !aCharacter.IsAlpha() )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (not found) complete") ));
- return EFalse;
- }
- if ( iDecodeInfo.iPrevChar.IsAlpha() )
- {
- // The check below detects the following type of cases
- // (note that special handling is needed to separate the Alpha|Alpha boundary):
- // AT&FE0
- if ( iDecodeInfo.iSpecialFound )
- {
- // Special command was found before and this is Alpha|Alpha boundary -> end
- aEndIndex--;
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (special) complete") ));
- return ETrue;
- }
- // The code below is for the following type of cases
- // (note there is no border between C|M, for example -> continue):
- // ATCMD
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (continue) complete") ));
- return EFalse;
- }
- // The code below is for skipping the following type of cases:
- // AT+CMD [the '+' must be skipped]
- if ( aEndIndex-1 == iDecodeInfo.iExtendedIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (extended) complete") ));
- return EFalse;
- }
- // The code below is for the following type of cases:
- // ATCMD?ATCMD
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommandAlphaBorder() (boundary) complete") ));
- aEndIndex--;
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Finds subcommand
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::FindSubCommand( TInt& aEndIndex )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand()") ));
- TInt startIndex = iDecodeInfo.iDecodeIndex;
- aEndIndex = startIndex;
- TBool found = EFalse;
- TInt lineLength = iLineBuffer.Length();
- iDecodeInfo.iAssignFound = EFalse;
- iDecodeInfo.iInQuotes = EFalse;
- iDecodeInfo.iExtendedIndex = KErrNotFound;
- SaveNotFoundCharDecodeState();
- iAtSpecialCmdHandler->ResetComparisonBuffer(); // just to be sure
- for ( ; aEndIndex<lineLength; aEndIndex++ )
- {
- TChar character = iLineBuffer[aEndIndex];
- found = FindSubCommandQuotes( character, startIndex, aEndIndex );
- if ( found )
- {
- continue;
- }
- if ( character == '?' )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (?) complete") ));
- return KErrNone;
- }
- // The check below detects the following type of cases:
- // ATCMD<delimiter>
- if ( IsDelimiterCharacter(character) )
- {
- aEndIndex--;
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (delimiter) complete") ));
- return KErrNone;
- }
- // The check below detects the following type of cases:
- // ATCMD+CMD [first + as delimiter]
- // AT+CMD+CMD [second + as delimiter]
- if ( IsExtendedCharacter(character) )
- {
- found = IsExtendedBorder( character, startIndex, aEndIndex );
- if ( !found )
- {
- continue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (extended) complete") ));
- return KErrNone;
- }
- found = FindSubCommandAlphaBorder( character, aEndIndex );
- if ( found )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (alpha sub) complete") ));
- return KErrNone;
- }
- SaveFoundCharDecodeState( character );
- }
- aEndIndex--;
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (not found) complete") ));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Check if "A/" command
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::IsASlashCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsASlashCommand()") ));
- if ( iLineBuffer.Length() == 2 )
- {
- if ( iLineBuffer[1] == '/' &&
- (iLineBuffer[0] == 'A' || iLineBuffer[0] == 'a') )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsASlashCommand() (found) complete") ));
- return ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::IsASlashCommand() (not found) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Handles "A/" command
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::HandleASlashCommand()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand()") ));
- // If not "A/" command, return
- if ( !IsASlashCommand() )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() (no push) complete") ));
- return EFalse;
- }
- iEndIndex = iInput->Length(); // Causes skipping of last '/' in ManageEndOfCmdHandling()
- // If "A/" command and last buffer exist, set the last buffer as the current buffer
- if ( iLastBuffer.Length() > 0 )
- {
- iLineBuffer.Copy( iLastBuffer );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() (copy) complete") ));
- return EFalse;
- }
- // Last buffer not set so return "ERROR"
- iDownstream->NotifyDataPushRequest( &iErrorBuffer, NULL );
- FTRACE(FPrint( _L("CDunAtCmdHandler::HandleASlashCommand() complete") ));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Manages command mode change
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ManageCommandModeChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCommandModeChange()" ) ));
- if ( aMode & KCommandModeChanged )
- {
- if ( aMode & KModeCommand ) // command mode ON
- {
- ReportCommandModeChange( ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCommandModeChange() command mode changed ON" ) ));
- }
- else // command mode OFF
- {
- ReportCommandModeChange( EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCommandModeChange() command mode changed OFF" ) ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCommandModeChange() (change) complete" ) ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCommandModeChange()" ) ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Reports command mode start/end change
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::ReportCommandModeChange( TBool aStart )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ReportCommandModeChange()" ) ));
- TInt i;
- TInt count = iCmdCallbacks.Count();
- if ( aStart )
- {
- if ( iDataMode )
- {
- for ( i=0; i<count; i++ )
- {
- iCmdCallbacks[i]->NotifyCommandModeStart();
- }
- iDataMode = EFalse;
- }
- }
- else // end
- {
- if ( !iDataMode )
- {
- for ( i=0; i<count; i++ )
- {
- iCmdCallbacks[i]->NotifyCommandModeEnd();
- }
- iDataMode = ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ReportCommandModeChange() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages echo mode change
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ManageEchoModeChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange()" ) ));
- if ( aMode & KEchoModeChanged )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() checking echo mode..." ) ));
- if ( aMode & KModeEcho ) // echo mode ON
- {
- iEchoOn = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() echo mode changed ON" ) ));
- }
- else // echo mode OFF
- {
- iEchoOn = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() echo mode changed OFF" ) ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() (change) complete" ) ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() complete" ) ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Manages quiet mode change
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ManageQuietModeChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageQuietModeChange()" ) ));
- if ( aMode & KQuietModeChanged )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEchoModeChange() checking quiet mode..." ) ));
- if ( aMode & KModeQuiet ) // quiet mode ON
- {
- iAtCmdExt.ReportQuietModeChange( ETrue );
- iQuietOn = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageQuietModeChange() quiet mode changed ON" ) ));
- }
- else // quiet mode OFF
- {
- iAtCmdExt.ReportQuietModeChange( EFalse );
- iQuietOn = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageQuietModeChange() quiet mode changed OFF" ) ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageQuietModeChange() (change) complete" ) ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageQuietModeChange() complete" ) ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Manages quiet mode change
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::ManageVerboseModeChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageVerboseModeChange()" ) ));
- if ( aMode & KVerboseModeChanged )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageVerboseModeChange() checking verbose mode..." ) ));
- if ( aMode & KModeVerbose ) // verbose mode ON
- {
- iAtCmdExt.ReportVerboseModeChange( ETrue );
- iVerboseOn = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyVerboseStatusChange() verbose mode changed ON" ) ));
- }
- else // verbose mode OFF
- {
- iAtCmdExt.ReportVerboseModeChange( EFalse );
- iVerboseOn = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyVerboseStatusChange() verbose mode changed OFF" ) ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageVerboseModeChange() (change) complete" ) ));
- return ETrue;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageVerboseModeChange() complete" ) ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Manages character change
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::ManageCharacterChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCharacterChange()" ) ));
- if ( aMode & KCarriageChanged )
- {
- iCarriageReturn = aMode & (KModeChanged-1);
- iAtCmdExt.ReportCharacterChange( ECharTypeCarriage, iCarriageReturn );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCharacterChange() carriage return changed" ) ));
- }
- else if ( aMode & KLineFeedChanged )
- {
- iLineFeed = aMode & (KModeChanged-1);
- iAtCmdExt.ReportCharacterChange( ECharTypeLineFeed, iLineFeed );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCharacterChange() line feed changed" ) ));
- }
- else if ( aMode & KBackspaceChanged )
- {
- iBackspace = aMode & (KModeChanged-1);
- iAtCmdExt.ReportCharacterChange( ECharTypeBackspace, iBackspace );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCharacterChange() backspace changed" ) ));
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageCharacterChange() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages editor mode reply
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::ManageEditorModeReply( TBool aStart )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEditorModeReply()" ) ));
- // Two modes possible here:
- // 1) Sending data directly from DTE to DCE, i.e. no subsequent data in
- // the input buffer -> Reissue read request from DTE.
- // 2) Sending data from input buffer to DCE -> Do not reissue read request
- // from DTE: send the data in a loop
- // In summary: send data byte-by-byte in editor mode until end of input.
- // When end of input notify CDunUpstream to reissue the read request.
- TBool nextContentFound = FindNextContent( aStart );
- if ( !nextContentFound )
- {
- iUpstream->NotifyEditorModeReply( aStart );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEditorModeReply() complete") ));
- return KErrNone;
- }
- // In block mode end the block mode by sending <ESC> and hope it works.
- iEscapeBuffer.Zero();
- iEscapeBuffer.Append( KDunEscape );
- iCmdPusher->IssueRequest( iEscapeBuffer, EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageEditorModeReply() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Finds the next content from the input data
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::FindNextContent( TBool aStart )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent()" ) ));
- if ( !aStart )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent() (skip) complete" ) ));
- return iEditorModeInfo.iContentFound;
- }
- // If iEndIndex is (>=0 && <iInput.Length()) it means more data waits in
- // iInput that didn't fit in iInputBuffer. Only check FindStartOfCommand()
- // if iEndIndex < 0, meaning more data is needed from CDunUpstream.
- TBool contentFound = EFalse;
- TInt cmdLength = iInput->Length();
- TBool subBlock = ( iEndIndex>=0&&iEndIndex<cmdLength ) ? ETrue : EFalse;
- if ( subBlock )
- {
- contentFound = ETrue;
- }
- if ( !contentFound )
- {
- contentFound = ExtractNextSubCommand( ETrue ); // peek
- }
- iEditorModeInfo.iContentFound = contentFound;
- FTRACE(FPrint( _L("CDunAtCmdHandler::FindNextContent() complete" ) ));
- return contentFound;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdPusher.
-// Notifies about end of AT command processing. This is after all reply data
-// for an AT command is multiplexed to the downstream.
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::NotifyEndOfProcessing( TInt /*aError*/ )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfProcessing()" ) ));
- TBool editorMode = iCmdPusher->EditorMode();
- if ( editorMode )
- {
- ManageEditorModeReply( ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfProcessing() (editor) complete" ) ));
- return KErrNone;
- }
- HandleNextSubCommand();
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfProcessing() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdPusher.
-// Notifies about request to stop AT command handling for the rest of the
-// command line data
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdHandler::NotifyEndOfCmdLineProcessing()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfCmdLineProcessing()" ) ));
- ManageEndOfCmdHandling( ETrue, ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEndOfCmdLineProcessing() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdPusher.
-// Notifies about request to peek for the next command
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdHandler::NotifyNextCommandPeekRequest()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyNextCommandPeekRequest()") ));
- TBool extracted = ExtractNextSubCommand( ETrue );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyNextCommandPeekRequest() complete") ));
- return extracted;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdPusher.
-// Notifies about editor mode reply
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::NotifyEditorModeReply()
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEditorModeReply()") ));
- TInt retVal = ManageEditorModeReply( EFalse );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyEditorModeReply() complete") ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtEcomListen.
-// Notifies about new plugin installation
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::NotifyPluginInstallation( TUid& /*aPluginUid*/ )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginInstallation()" ) ));
- CDunAtUrcHandler* urcHandler = NULL;
- TRAPD( retTrap, urcHandler=AddOneUrcHandlerL() );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginInstallation() (trapped!) complete" ) ));
- return retTrap;
- }
- TInt retTemp = urcHandler->IssueRequest();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginInstallation() (issuerequest) complete" ) ));
- return retTemp;
- }
- TUid ownerUid = urcHandler->OwnerUid();
- iAtCmdExt.ReportListenerUpdateReady( ownerUid, EEcomTypeInstall );
- // As a last step recreate the special command data
- retTemp = RecreateSpecialCommands();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginInstallation() (recreate) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginInstallation() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtEcomListen.
-// Notifies about existing plugin uninstallation
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::NotifyPluginUninstallation( TUid& aPluginUid )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginUninstallation()" ) ));
- TInt i;
- TInt count = iUrcHandlers.Count();
- for ( i=count-1; i>=0; i-- )
- {
- TUid ownerUid = iUrcHandlers[i]->OwnerUid();
- if ( ownerUid == aPluginUid )
- {
- delete iUrcHandlers[i];
- iUrcHandlers.Remove( i );
- iAtCmdExt.ReportListenerUpdateReady( ownerUid,
- EEcomTypeUninstall );
- }
- }
- // As a last step recreate the special command data
- TInt retTemp = RecreateSpecialCommands();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginUninstallation() (recreate) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyPluginUninstallation() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtModeListen.
-// Gets called on mode status change
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdHandler::NotifyModeStatusChange( TUint aMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange()") ));
- TBool commandModeSet = ManageCommandModeChange( aMode );
- TBool echoModeSet = ManageEchoModeChange( aMode );
- TBool quietModeSet = ManageQuietModeChange( aMode );
- TBool verboseModeSet = ManageVerboseModeChange( aMode );
- if ( quietModeSet || verboseModeSet )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() new settings: E=%d, Q=%d, V=%d"), iEchoOn, iQuietOn, iVerboseOn ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() (regenerate) mode set" ) ));
- RegenerateReplyStrings();
- return KErrNone;
- }
- // Keep the following after "quietModeSet || verboseModeSet" in order to
- // regenerate the reply also if two modes change at the same time
- if ( commandModeSet || echoModeSet )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() new settings: E=%d, Q=%d, V=%d"), iEchoOn, iQuietOn, iVerboseOn ));
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() mode set" ) ));
- return KErrNone;
- }
- ManageCharacterChange( aMode );
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() new settings: CR=%u, LF=%u, BS=%u"), iCarriageReturn, iLineFeed, iBackspace ));
- RegenerateReplyStrings();
- FTRACE(FPrint( _L("CDunAtCmdHandler::NotifyModeStatusChange() complete") ));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,521 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command pusher for downstream
-*
-*/
-
-/*
- * Filtering categories for multiple commands on one line (DunAtCmdPusher.cpp)
- * (here "OTHER" reply means a reply which is something else than "OK" and "ERROR")
- * One reply: OK -> OK
- * One reply: OTHER -> OTHER
- * One reply: ERROR -> ERROR
- * Two replies: OK, OK -> OK
- * Two replies: OTHER, OTHER -> OTHER, OTHER
- * Two replies: OK, OTHER -> OTHER
- * Two replies: OTHER, OK -> OTHER
- * Two replies: OK, ERROR -> ERROR
- * Two replies: OTHER, ERROR -> OTHER, ERROR
- * Note: "OK" replies are skipped. The "OK" string is stripped from the "OTHER"
- * replies and manually added the the downstream as the last operation if either
- * "OK" or "OTHER" was received before.
- */
-
-#include "DunAtCmdPusher.h"
-#include "DunDownstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdPusher* CDunAtCmdPusher::NewL(
- RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer )
- {
- CDunAtCmdPusher* self = NewLC( aAtCmdExt,
- aCallback,
- aDownstream,
- aOkBuffer );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdPusher* CDunAtCmdPusher::NewLC(
- RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer )
- {
- CDunAtCmdPusher* self = new (ELeave) CDunAtCmdPusher( aAtCmdExt,
- aCallback,
- aDownstream,
- aOkBuffer );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdPusher::~CDunAtCmdPusher()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::~CDunAtCmdPusher()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtCmdPusher::~CDunAtCmdPusher() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtCmdPusher::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Starts AT command handling
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdPusher::IssueRequest( TDesC8& aInput, TBool aNormalMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest()") ));
- FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() send ATEXT:") ));
- FTRACE(FPrintRaw(aInput) );
- if ( iAtPushState!=EDunStateIdle && aNormalMode )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (not ready) complete") ));
- return KErrNotReady;
- }
- if ( iDownstream->IsDataInQueue(&iRecvBuffer) )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() (in queue!) complete") ));
- return KErrGeneral;
- }
- iStatus = KRequestPending;
- iAtCmdExt->HandleCommand( iStatus,
- aInput,
- iRecvBuffer,
- iReplyLeftPckg,
- iReplyTypePckg );
- SetActive();
- iAtPushState = EDunStateAtCmdPushing;
- FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops AT command handling
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdPusher::Stop()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::Stop()") ));
- SetEndOfCmdLine();
- if ( iAtPushState != EDunStateAtCmdPushing )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- // As the EDunStateAtCmdHandling can be set even when the actual request
- // has completed (when replying with NotifyDataPushComplete() and setting
- // idle eventually), cancel the actual operation in DoCancel()
- Cancel();
- iAtPushState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunAtCmdPusher::Stop() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Manages request to abort command handling
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdPusher::ManageAbortRequest()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageAbortRequest()") ));
- if ( iAtPushState != EDunStateAtCmdPushing )
- {
- FTRACE(FPrint( _L("CDunAtCmdHandler::ManageAbortRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( iCmdAbort )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageAbortRequest() (already exists) complete") ));
- return KErrAlreadyExists;
- }
- TInt retTemp = iAtCmdExt->ReportHandleCommandAbort( iStop );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageAbortRequest() (ERROR) complete") ));
- return retTemp;
- }
- iCmdAbort = ETrue;
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageAbortRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets end of command line marker on for the possible series of AT commands.
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::SetEndOfCmdLine()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine()") ));
- iNoErrorReceived = EFalse;
- iLastOkPush = EFalse;
- iCmdAbort = EFalse;
- iStop = EFalse;
- iEditorMode = EFalse;
- FTRACE(FPrint( _L("CDunAtCmdPusher::SetEndOfCmdLine() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Gets the editor mode status
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtCmdPusher::EditorMode()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::EditorMode()") ));
- FTRACE(FPrint( _L("CDunAtCmdPusher::EditorMode() complete") ));
- return iEditorMode;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdPusher::CDunAtCmdPusher
-// ---------------------------------------------------------------------------
-//
-CDunAtCmdPusher::CDunAtCmdPusher( RATExt* aAtCmdExt,
- MDunAtCmdPusher* aCallback,
- MDunStreamManipulator* aDownstream,
- TDesC8* aOkBuffer ) :
- CActive( EPriorityHigh ),
- iAtCmdExt( aAtCmdExt ),
- iCallback( aCallback ),
- iDownstream( aDownstream ),
- iOkBuffer( aOkBuffer ),
- iReplyLeftPckg( iReplyBytesLeft ),
- iReplyTypePckg( iReplyType )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtCmdPusher::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ConstructL()") ));
- if ( !iAtCmdExt || !iCallback || !iDownstream || !iOkBuffer )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunAtCmdPusher::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::Initialize()
- {
- // Don't initialize iAtCmdExt here (it is set through NewL)
- // Don't initialize iCallback here (it is set through NewL)
- // Don't initialize iDownstream here (it is set through NewL)
- // Don't initialize iOkBuffer here (it is set through NewL)
- iAtPushState = EDunStateIdle;
- iReplyBytesLeft = 0;
- iReplyType = EReplyTypeUndefined;
- SetEndOfCmdLine();
- }
-
-// ---------------------------------------------------------------------------
-// Sets state to idle and notifies about subcommand handling completion
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::SetToIdleAndNotifyEnd( TInt aError )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::SetToIdleAndNotifyEnd()") ));
- iCmdAbort = EFalse;
- iAtPushState = EDunStateIdle;
- iCallback->NotifyEndOfProcessing( aError );
- FTRACE(FPrint( _L("CDunAtCmdPusher::SetToIdleAndNotifyEnd() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Checks if "OK" (verbose) or "0" (numeric) string or exists at the end of
-// buffer and removes it
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtCmdPusher::CheckAndRemoveOkString()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::CheckAndRemoveOkString()") ));
- TInt recvBufferLength = iRecvBuffer.Length();
- TInt okBufferLength = iOkBuffer->Length();
- // Skip the removal if removing not possible, if removal results in zero
- // length (plugin should have used KErrReplyTypeOk) or if string to be
- // removed is zero.
- // Note also that if plugin sends a final reply when quiet mode is on, DUN
- // can't remove the possibly existing result code as it is different from
- // iOkReply (zero length).
- if ( recvBufferLength<=okBufferLength || okBufferLength<=0 )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::CheckAndRemoveOkString() (skip) complete") ));
- return KErrGeneral;
- }
- TInt lengthWithNoOk = recvBufferLength - okBufferLength;
- TPtr8 recvBufferDes( &iRecvBuffer[lengthWithNoOk], okBufferLength, okBufferLength );
- if ( recvBufferDes.Compare(*iOkBuffer) != 0 )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::CheckAndRemoveOkString() (not found) complete") ));
- return KErrNotFound;
- }
- iRecvBuffer.SetLength( lengthWithNoOk );
- FTRACE(FPrint( _L("CDunAtCmdPusher::CheckAndRemoveOkString() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sends reply data to downstream
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::SendReplyData( TBool aRecvBuffer )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::SendReplyData()") ));
- TDesC8* sendBuffer = iOkBuffer;
- if ( aRecvBuffer )
- {
- sendBuffer = &iRecvBuffer;
- // Check if last block of long push and remove "OK" if exists
- if ( iReplyType==EReplyTypeOther && iReplyBytesLeft==0 )
- {
- CheckAndRemoveOkString();
- }
- }
- FTRACE(FPrint( _L("CDunAtCmdPusher::SendReplyData() send reply:") ));
- FTRACE(FPrintRaw(*sendBuffer) );
- iDownstream->NotifyDataPushRequest( sendBuffer, this );
- FTRACE(FPrint( _L("CDunAtCmdPusher::SendReplyData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages change in reply type to EReplyTypeOther
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ManageReplyTypeChangeToOther()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOther()") ));
- iNoErrorReceived = ETrue;
- SendReplyData();
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOther() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages change in reply type to EReplyTypeOk
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ManageReplyTypeChangeToOk()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOk()") ));
- // Skip the "OK" replies if not last. Only push the "OK" reply at the end.
- // iStop changes it so that the we have to send the "OK" immediately and
- // only stop with NotifyDataPushComplete()
- TBool found = iCallback->NotifyNextCommandPeekRequest();
- if ( !found || iStop )
- {
- SendReplyData();
- }
- else
- {
- iNoErrorReceived = ETrue;
- SetToIdleAndNotifyEnd( KErrNone );
- }
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToOk() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages change in reply type to EReplyTypeError
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ManageReplyTypeChangeToError()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToError()") ));
- if ( iNoErrorReceived )
- {
- iAtCmdExt->ReportExternalHandleCommandError();
- }
- SendReplyData();
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToError() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages change in reply type to EReplyTypeEditor
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ManageReplyTypeChangeToEditor()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor()") ));
- if ( !iEditorMode )
- {
- // First change to editor mode: manage it as EReplyTypeOther (prompt)
- iEditorMode = ETrue;
- ManageReplyTypeChangeToOther();
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor() (editor) complete") ));
- return;
- }
- // The same reply to editor mode as before: no reply, only notification for
- // echo/forwarding purposes
- iCallback->NotifyEditorModeReply();
- // Do nothing after notifying. The next ForwardEditorModeInput() triggers
- // the next call of this function.
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChangeToEditor() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages change in reply type
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::ManageReplyTypeChange()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange()") ));
- switch ( iReplyType )
- {
- case EReplyTypeOther:
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOther") ));
- iEditorMode = EFalse;
- ManageReplyTypeChangeToOther();
- }
- break;
- case EReplyTypeOk:
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeOk") ));
- iEditorMode = EFalse;
- ManageReplyTypeChangeToOk();
- }
- break;
- case EReplyTypeError:
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeError") ));
- iEditorMode = EFalse;
- ManageReplyTypeChangeToError();
- }
- break;
- case EReplyTypeEditor:
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeEditor") ));
- ManageReplyTypeChangeToEditor();
- break;
- default:
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() EReplyTypeUndefined") ));
- iEditorMode = EFalse;
- SetToIdleAndNotifyEnd( KErrNone );
- }
- break;
- }
- FTRACE(FPrint( _L("CDunAtCmdPusher::ManageReplyTypeChange() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when AT command handled
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::RunL()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::RunL()") ));
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- SetToIdleAndNotifyEnd( retTemp );
- FTRACE(FPrint( _L("CDunAtCmdPusher::RunL() (ERROR) complete (%d)"), retTemp));
- return;
- }
- ManageReplyTypeChange();
- FTRACE(FPrint( _L("CDunAtCmdPusher::RunL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::DoCancel()
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::DoCancel()") ));
- iAtCmdExt->CancelHandleCommand();
- FTRACE(FPrint( _L("CDunAtCmdPusher::DoCancel() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCompletionReporter.
-// Gets called when data push is complete
-// ---------------------------------------------------------------------------
-//
-void CDunAtCmdPusher::NotifyDataPushComplete( TBool /*aAllPushed*/ )
- {
- FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete()") ));
- // First check if error or stop condition detected
- if ( iReplyType==EReplyTypeError || iStop )
- {
- SetEndOfCmdLine();
- iAtPushState = EDunStateIdle;
- iCallback->NotifyEndOfCmdLineProcessing();
- FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (error reply) complete") ));
- return;
- }
- // Secondly check only the case where push restart is required
- if ( iReplyType==EReplyTypeOther && iReplyBytesLeft>0 )
- {
- iAtCmdExt->GetNextPartOfReply( iRecvBuffer, iReplyBytesLeft );
- SendReplyData();
- FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (push restart) complete") ));
- return;
- }
- // Next check the case where other than "OK" and "ERROR" reply is received
- // and that is the last one in the command line. Then just send "OK".
- if ( !iLastOkPush && iReplyType==EReplyTypeOther )
- {
- TBool found = iCallback->NotifyNextCommandPeekRequest();
- if ( !found )
- {
- // Force iReplyType here to match the correct one in NotifyDataPushComplete()
- iReplyType = EReplyTypeOk;
- iLastOkPush = ETrue;
- SendReplyData( EFalse );
- FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() (last OK) complete") ));
- return;
- }
- // Now the next command was found so just fall through
- }
- // As a last step just set to idle
- SetToIdleAndNotifyEnd( KErrNone );
- FTRACE(FPrint( _L("CDunAtCmdPusher::NotifyDataPushComplete() complete") ));
- }
--- a/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECom plugin install/uninstall/version listener
-*
-*/
-
-
-#include "DunAtEcomListen.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtEcomListen* CDunAtEcomListen::NewL(
- RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback )
- {
- CDunAtEcomListen* self = NewLC( aAtCmdExt, aCallback );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtEcomListen* CDunAtEcomListen::NewLC(
- RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback )
- {
- CDunAtEcomListen* self = new (ELeave) CDunAtEcomListen( aAtCmdExt,
- aCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtEcomListen::~CDunAtEcomListen()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::~CDunAtEcomListen()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtEcomListen::~CDunAtEcomListen() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtEcomListen::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtEcomListen::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Starts waiting for ECom plugin install/uninstall/version status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtEcomListen::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest()") ));
- if ( iEcomListenState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() (not ready) complete") ));
- return KErrNotReady;
- }
- iStatus = KRequestPending;
- iAtCmdExt->ReceiveEcomPluginChange( iStatus, iPluginUidPckg, iEcomTypePckg );
- SetActive();
- iEcomListenState = EDunStateEcomListening;
- FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops waiting for Ecom plugin install/uninstall/version status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtEcomListen::Stop()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::Stop()") ));
- if ( iEcomListenState != EDunStateEcomListening )
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iAtCmdExt->CancelReceiveEcomPluginChange();
- Cancel();
- iEcomListenState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunAtEcomListen::Stop() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtEcomListen::CDunAtEcomListen
-// ---------------------------------------------------------------------------
-//
-CDunAtEcomListen::CDunAtEcomListen( RATExt* aAtCmdExt,
- MDunAtEcomListen* aCallback ) :
- CActive( EPriorityHigh ),
- iAtCmdExt( aAtCmdExt ),
- iCallback( aCallback ),
- iPluginUidPckg( iPluginUid ),
- iEcomTypePckg( EEcomTypeUninstall )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtEcomListen::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtEcomListen::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::ConstructL()") ));
- if ( !iAtCmdExt || !iCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunAtEcomListen::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtEcomListen::Initialize()
- {
- // Don't initialize iAtCmdExt here (it is set through NewL)
- // Don't initialize iCallback here (it is set through NewL)
- iEcomListenState = EDunStateIdle;
- iPluginUid = TUid::Null();
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when plugin installed, uninstalled or changed
-// ---------------------------------------------------------------------------
-//
-void CDunAtEcomListen::RunL()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::RunL()") ));
- iEcomListenState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::RunL() (ERROR) complete (%d)"), retTemp ));
- return;
- }
- IssueRequest();
- // Now the operation is either unintall or install of plugin
- // Notify parent and ATEXT
- if ( iEcomTypePckg() == EEcomTypeUninstall )
- {
- iCallback->NotifyPluginUninstallation( iPluginUid );
- }
- else if ( iEcomTypePckg() == EEcomTypeInstall )
- {
- iCallback->NotifyPluginInstallation( iPluginUid );
- }
- else
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::RunL() (not supported) complete") ));
- }
- FTRACE(FPrint( _L("CDunAtEcomListen::RunL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunAtEcomListen::DoCancel()
- {
- FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel()") ));
- FTRACE(FPrint( _L("CDunAtEcomListen::DoCancel() complete") ));
- }
--- a/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Modem's mode listener and notifier
-*
-*/
-
-
-#include "DunAtModeListen.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtModeListen* CDunAtModeListen::NewL( RATExtCommon* aAtCmdExtCommon,
- MDunAtModeListen* aCallback )
- {
- CDunAtModeListen* self = NewLC( aAtCmdExtCommon, aCallback );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtModeListen* CDunAtModeListen::NewLC( RATExtCommon* aAtCmdExtCommon,
- MDunAtModeListen* aCallback )
- {
- CDunAtModeListen* self = new (ELeave) CDunAtModeListen( aAtCmdExtCommon,
- aCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtModeListen::~CDunAtModeListen()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::~CDunAtModeListen()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtModeListen::~CDunAtModeListen() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtModeListen::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtModeListen::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start monitoring for mode status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtModeListen::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest()" )));
- if ( iModeListenState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() (not ready) complete" ) ));
- return KErrNotReady;
- }
- iStatus = KRequestPending;
- iAtCmdExtCommon->ReceiveModeStatusChange( iStatus, iModePckg );
- SetActive();
- iModeListenState = EDunStateModeListening;
- FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops monitoring for mode status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtModeListen::Stop()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::Stop()" )));
- if ( iModeListenState != EDunStateModeListening )
- {
- FTRACE(FPrint( _L("CDunAtModeListen::Stop() (not ready) complete" ) ));
- return KErrNotReady;
- }
- iAtCmdExtCommon->CancelReceiveModeStatusChange();
- Cancel();
- iModeListenState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunAtModeListen::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtModeListen::CDunAtModeListen
-// ---------------------------------------------------------------------------
-//
-CDunAtModeListen::CDunAtModeListen( RATExtCommon* aAtCmdExtCommon,
- MDunAtModeListen* aCallback ) :
- CActive( EPriorityHigh ),
- iAtCmdExtCommon( aAtCmdExtCommon ),
- iCallback( aCallback ),
- iModePckg( iMode )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtModeListen::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtModeListen::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::ConstructL()") ));
- if ( !iAtCmdExtCommon || !iCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunAtModeListen::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtModeListen::Initialize()
- {
- // Don't initialize iAtCmdExtCommon here (it is set through NewL)
- // Don't initialize iCallback here (it is set through NewL)
- iModeListenState = EDunStateIdle;
- iMode = 0;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when mode changes
-// ---------------------------------------------------------------------------
-//
-void CDunAtModeListen::RunL()
- {
- FTRACE(FPrint( _L("CDunAtModeListen::RunL()") ));
- iModeListenState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtModeListen::RunL() (ERROR) complete (%d)"), retTemp ));
- return;
- }
- FTRACE(FPrint( _L("CDunAtModeListen::RunL() managing 0x%08X" ), iMode ));
- iCallback->NotifyModeStatusChange( iMode );
- IssueRequest();
- FTRACE(FPrint( _L("CDunAtModeListen::RunL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunAtModeListen::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT NVRAM status change listener and notifier
-*
-*/
-
-
-#include "DunAtNvramListen.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtNvramListen* CDunAtNvramListen::NewL( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon )
- {
- CDunAtNvramListen* self = NewLC( aAtCmdExt, aAtCmdExtCommon );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtNvramListen* CDunAtNvramListen::NewLC( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon )
- {
- CDunAtNvramListen* self = new (ELeave) CDunAtNvramListen(
- aAtCmdExt,
- aAtCmdExtCommon );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtNvramListen::~CDunAtNvramListen()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::~CDunAtNvramListen()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtNvramListen::~CDunAtNvramListen() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtNvramListen::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtNvramListen::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Starts waiting for NVRAM status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtNvramListen::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::IssueRequest()") ));
- if ( iNvramHandleState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::IssueRequest() (not ready) complete") ));
- return KErrNotReady;
- }
- if ( !iStarted )
- {
- iAtCmdExtCommon->GetNvramStatus( iNvramBuffer );
- iAtCmdExt->BroadcastNvramStatusChange( iNvramBuffer );
- iStarted = ETrue;
- }
- iStatus = KRequestPending;
- iAtCmdExtCommon->ReceiveNvramStatusChange( iStatus, iNvramBuffer );
- SetActive();
- iNvramHandleState = EDunStateNvramListening;
- FTRACE(FPrint( _L("CDunAtNvramListen::IssueRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops waiting for NVRAM status changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtNvramListen::Stop()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::Stop()") ));
- if ( iNvramHandleState != EDunStateNvramListening )
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iAtCmdExtCommon->CancelReceiveNvramStatusChange();
- Cancel();
- iNvramHandleState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunAtNvramListen::Stop() complete") ));
- // Note: Don't mark iStarted to EFalse here!
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtNvramListen::CDunAtNvramListen
-// ---------------------------------------------------------------------------
-//
-CDunAtNvramListen::CDunAtNvramListen( RATExt* aAtCmdExt,
- RATExtCommon* aAtCmdExtCommon ) :
- CActive( EPriorityHigh ),
- iAtCmdExt( aAtCmdExt ),
- iAtCmdExtCommon( aAtCmdExtCommon )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtNvramListen::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtNvramListen::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::ConstructL()") ));
- if ( !iAtCmdExt || !iAtCmdExtCommon )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunAtNvramListen::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtNvramListen::Initialize()
- {
- // Don't initialize iAtCmdExt here (it is set through NewL)
- // Don't initialize iAtCmdExtCommon here (it is set through NewL)
- iNvramHandleState = EDunStateIdle;
- iStarted = EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when NVRAM has changed
-// ---------------------------------------------------------------------------
-//
-void CDunAtNvramListen::RunL()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::RunL()") ));
- iNvramHandleState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::RunL() (ERROR) complete (%d)"), retTemp ));
- return;
- }
- iAtCmdExt->BroadcastNvramStatusChange( iNvramBuffer );
- IssueRequest();
- FTRACE(FPrint( _L("CDunAtNvramListen::RunL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunAtNvramListen::DoCancel()
- {
- FTRACE(FPrint( _L("CDunAtNvramListen::DoCancel()") ));
- FTRACE(FPrint( _L("CDunAtNvramListen::DoCancel() complete") ));
- }
--- a/localconnectivityservice/dun/atext/src/DunAtSpecialCmdHandler.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Special AT command handler
-*
-*/
-
-#include "DunAtSpecialCmdHandler.h"
-#include "DunDebug.h"
-
-const TInt KDefaultGranularity = 1;
-
-// AT command(s) below is part of the AT&FE0Q0V1&C1&D2+IFC=3,1. command which
-// is sent by MAC. There is no delimiter between "AT&F" and "E0".
-// Only list those commands where alphabetical boundary detection is needed
-// (i.e. "AT&F0" is not needed as "AT&F0E0" has non-alphabetical boundary)
-_LIT8( KSpecialATCmd1, "AT&F" );
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtSpecialCmdHandler* CDunAtSpecialCmdHandler::NewL()
- {
- CDunAtSpecialCmdHandler* self = new (ELeave) CDunAtSpecialCmdHandler();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtSpecialCmdHandler::CDunAtSpecialCmdHandler
-// ---------------------------------------------------------------------------
-//
-CDunAtSpecialCmdHandler::CDunAtSpecialCmdHandler()
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtSpecialCmdHandler::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtSpecialCmdHandler::ConstructL()
- {
- iSpecialCmds = new (ELeave) CDesC8ArrayFlat( KDefaultGranularity );
- // Add here all special commands which need to be handled
- iSpecialCmds->AppendL( KSpecialATCmd1 );
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler()
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler()") ));
- delete iSpecialCmds;
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::~CDunAtSpecialCmdHandler() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Checks if the command has to be treated special way.
-// For example in case of MAC, it sends command AT&FE0Q0V1&C1&D2+IFC=3,1.
-// meaning there is no delimiters in the command.
-// In case of MAC we try to search AT&F (sub command) string from the beginning
-// of the command.
-// Search is done character by character basis.
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtSpecialCmdHandler::IsCompleteSubCommand( TChar aCharacter )
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand()") ));
- iBuffer.Append( aCharacter );
- TBool completeSubCmd = EFalse;
-
- if( !IsDataReadyForComparison(iBuffer.Length()) )
- {
- // No need to do comparison because we don't have correct amount of data
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), no need to compare") ));
- return completeSubCmd;
- }
-
- TInt count = iSpecialCmds->Count();
- for ( TInt i=0; i<count; i++ )
- {
- if( iSpecialCmds->MdcaPoint(i).Compare(iBuffer) == 0 )
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand(), match found, cmd index %d"), i ));
- // Reset internal buffer for next comparison.
- ResetComparisonBuffer();
- completeSubCmd = ETrue;
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsCompleteSubCommand() complete") ));
- return completeSubCmd;
- }
-
-// ---------------------------------------------------------------------------
-// Resets the buffer used for comparisons
-// ---------------------------------------------------------------------------
-//
-void CDunAtSpecialCmdHandler::ResetComparisonBuffer()
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::ResetComparisonBuffer()") ));
- iBuffer.FillZ();
- iBuffer.Zero();
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::ResetComparisonBuffer() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Defines when comparison is excecuted, checks if the data lengths are equal.
-// ---------------------------------------------------------------------------
-//
-TBool CDunAtSpecialCmdHandler::IsDataReadyForComparison( TInt aLength )
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsDataReadyForComparison()") ));
- TInt count = iSpecialCmds->Count();
- for ( TInt i=0; i<count; i++ )
- {
- if( iSpecialCmds->MdcaPoint(i).Length() == aLength )
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsDataReadyForComparison() (ready) complete") ));
- return ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::IsDataReadyForComparison() (not ready) complete") ));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Defines minimum length of the special commands.
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtSpecialCmdHandler::MinimumLength()
- {
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::MinimumLength()") ));
- TInt length = iSpecialCmds->MdcaPoint(0).Length();
- TInt count = iSpecialCmds->Count();
- for ( TInt i=1; i<count; i++ )
- {
- if( iSpecialCmds->MdcaPoint(i).Length() < length )
- {
- length = iSpecialCmds->MdcaPoint(i).Length();
- break;
- }
- }
- FTRACE(FPrint( _L("CDunAtSpecialCmdHandler::MinimumLength() complete") ));
- return length;
- }
--- a/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: AT command URC handler
-*
-*/
-
-
-#include <atext.h>
-#include "DunAtCmdHandler.h"
-#include "DunAtUrcHandler.h"
-#include "DunDownstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtUrcHandler* CDunAtUrcHandler::NewL(
- RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback )
- {
- CDunAtUrcHandler* self = NewLC( aAtCmdExt, aStreamCallback );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtUrcHandler* CDunAtUrcHandler::NewLC(
- RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback )
- {
- CDunAtUrcHandler* self = new (ELeave) CDunAtUrcHandler( aAtCmdExt,
- aStreamCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunAtUrcHandler::~CDunAtUrcHandler()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::~CDunAtUrcHandler()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunAtUrcHandler::~CDunAtUrcHandler() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::ResetData()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // Don't close iAtCmdExt here (it is done in CDunAtCmdHandler)!
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunAtUrcHandler::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Starts waiting for an incoming URC message
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtUrcHandler::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest()") ));
- if ( iUrcHandleState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest() (not ready) complete") ));
- return KErrNotReady;
- }
- iStatus = KRequestPending;
- iAtCmdExt->ReceiveUnsolicitedResult( iStatus, iRecvBuffer, iOwnerUidPckg );
- SetActive();
- iUrcHandleState = EDunStateAtUrcHandling;
- // Next mark ownership
- if ( !iStarted )
- {
- TInt retTemp = iAtCmdExt->MarkUrcHandlingOwnership( iOwnerUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest() (not owned) complete") ));
- return KErrGeneral;
- }
- }
- iStarted = ETrue;
- FTRACE(FPrint( _L("CDunAtUrcHandler::IssueRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops waiting for an incoming URC message
-// ---------------------------------------------------------------------------
-//
-TInt CDunAtUrcHandler::Stop()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::Stop()") ));
- if ( iUrcHandleState != EDunStateAtUrcHandling )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iAtCmdExt->CancelReceiveUnsolicitedResult( iOwnerUid );
- Cancel();
- iUrcHandleState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunAtUrcHandler::Stop() complete") ));
- // Note: Don't mark iStarted to EFalse here as it is used to get the UID
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// UID of the owning plugin
-// ---------------------------------------------------------------------------
-//
-TUid CDunAtUrcHandler::OwnerUid()
- {
- return iOwnerUid;
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtUrcHandler::CDunAtUrcHandler
-// ---------------------------------------------------------------------------
-//
-CDunAtUrcHandler::CDunAtUrcHandler( RATExt* aAtCmdExt,
- MDunStreamManipulator* aStreamCallback ) :
- CActive( EPriorityHigh ),
- iAtCmdExt( aAtCmdExt ),
- iStreamCallback( aStreamCallback ),
- iOwnerUidPckg( iOwnerUid )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunAtUrcHandler::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::ConstructL()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::ConstructL()") ));
- if ( !iAtCmdExt || !iStreamCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunAtUrcHandler::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::Initialize()
- {
- // Don't initialize iStreamCallback here (it is set through NewL)
- iUrcHandleState = EDunStateIdle;
- iOwnerUid = TUid::Null();
- iStarted = EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when URC command received
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::RunL()
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::RunL()") ));
- iUrcHandleState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::RunL() (ERROR) complete (%d)"), retTemp));
- return;
- }
- if ( iRecvBuffer.Length() == 0 )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::RunL() (empty buffer) complete") ));
- return;
- }
-
- // Send received URC message
-
- iStreamCallback->NotifyDataPushRequest( &iRecvBuffer, this );
-
- FTRACE(FPrint( _L("CDunAtUrcHandler::RunL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::DoCancel()
- {
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCompletionReporter.
-// Gets called when data push is complete
-// ---------------------------------------------------------------------------
-//
-void CDunAtUrcHandler::NotifyDataPushComplete( TBool /*aAllPushed*/ )
- {
- FTRACE(FPrint( _L("CDunAtUrcHandler::NotifyDataPushComplete()") ));
- IssueRequest();
- FTRACE(FPrint( _L("CDunAtUrcHandler::NotifyDataPushComplete() complete") ));
- }
--- a/localconnectivityservice/dun/client/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* This file provides the information required for building the
-* whole of DUN client
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-../../rom/dunclient.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunclient.iby)
-
-PRJ_MMPFILES
-dunclient.mmp
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/dun/client/group/dunclient.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN client
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-TARGET dunclient.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0x20002775
-
-CAPABILITY CAP_ECOM_PLUGIN
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE dunplugin.cpp
-SOURCE dunactive.cpp
-SOURCE dunclient.cpp
-SOURCE proxy.cpp
-
-START RESOURCE 0x20002775.rss
-TARGET dunclient.rsc
-END // RESOURCE
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc ../../utils/inc
-USERINCLUDE ../../../inc ../../../../inc
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/client/inc/dunactive.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Controls asynchronous requests between LOCOD and DUN server
-*
-*/
-
-
-#ifndef C_CDUNACTIVE_H
-#define C_CDUNACTIVE_H
-
-#include <locodservicepluginobserver.h>
-
-class CDunPlugin;
-
-/**
- * Class for accessing bearer statuses of CDunActive class
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunActive )
- {
-
-public:
-
- /**
- * Bearer
- *
- * @since S60 3.2
- * @return Bearer
- */
- virtual TLocodBearer Bearer() = 0;
-
- /**
- * Bearer status
- *
- * @since S60 3.2
- * @return Bearer status
- */
- virtual TBool BearerStatus() = 0;
-
- };
-
-/**
- * Class that controls asynchronous requests between LOCOD and DUN server
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunActive ) : public CActive, public MDunActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aPlugin Plugin
- * @param aBearer Brearer
- * @param aBearerStatus Bearer status
- * @return Instance of self
- */
- static CDunActive* NewL( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus );
-
- /**
- * Two-phased constructor.
- * @param aPlugin Plugin
- * @param aBearer Brearer
- * @param aBearerStatus Bearer status
- * @return Instance of self
- */
- static CDunActive* NewLC( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus );
-
- /**
- * Destructor.
- */
- virtual ~CDunActive();
-
- /**
- * Request function
- *
- * @since S60 3.2
- * @return Symbian Error code
- */
- TInt ServiceRequest();
-
-private:
-
- CDunActive( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus );
-
- void ConstructL();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Called when read or write operation is ready.
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Cancel current activity.
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunActive
-
- /**
- * From MDunActive.
- * Bearer
- *
- * @since S60 3.2
- * @return Bearer
- */
- TLocodBearer Bearer();
-
- /**
- * From MDunActive.
- * Bearer status
- *
- * @since S60 3.2
- * @return Bearer status
- */
- TBool BearerStatus();
-
-private: // data
-
- /**
- * CDunPlugin
- * Not own. Passed by DunPlugin
- */
- CDunPlugin* iPlugin;
-
- /**
- * Bearer
- * Not own. Passed by DunPlugin
- */
- TLocodBearer iBearer;
-
- /**
- * Service state
- * Not own. Passed by DunPlugin
- */
- TBool iBearerStatus;
-
- };
-
-#endif // C_CDUNACTIVE_H
--- a/localconnectivityservice/dun/client/inc/dunclient.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Main client side interface of DUN
-*
-*/
-
-
-#ifndef R_RDUNCLIENT_H
-#define R_RDUNCLIENT_H
-
-#include <e32def.h>
-#include <e32std.h>
-#include <locodserviceplugin.h>
-
-class MDunActive;
-
-/**
- * Main client side interface of DUN
- * Manages service from/to LOCOD
- *
- * @since S60 v3.2
- */
-class RDun : public RSessionBase
- {
-
-public:
-
- RDun();
-
- /**
- * This function starts DUN open/close for different medias
- *
- * @since S60 3.2
- * @param aRequest Request to manage
- * @param aReqStatus Active object's request status
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ManageService( MDunActive* aRequest, TRequestStatus& aReqStatus );
-
- /**
- * This function gets the active connection
- * (For testing purposes only).
- *
- * @since S60 5.0
- * @return Active connection if found, NULL otherwise
- */
- TAny* ActiveConnection();
-
- /**
- * Version number
- *
- * @since S60 3.2
- * @return Version number of DUN
- */
- TVersion Version() const;
-
- /**
- * This function connects to DUN server and creates a new session.
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Connect();
-
- };
-
-#endif // R_RDUNCLIENT_H
--- a/localconnectivityservice/dun/client/inc/dunplugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: EComm interface implementation and the client side of DUN
-*
-*/
-
-
-#ifndef C_CDUNPLUGIN_H
-#define C_CDUNPLUGIN_H
-
-#include <locodbearer.h>
-#include <locodserviceplugin.h>
-#include "dunclient.h"
-
-class CDunActive;
-
-/**
- * Class of EComm interface implementation and the client side of DUN
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunPlugin ) : public CLocodServicePlugin
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aParams LOCOD service plugin parameters
- * @return Instance of self
- */
- static CDunPlugin* NewL( TLocodServicePluginParams& aParams );
-
- /**
- * Destructor.
- */
- ~CDunPlugin();
-
- /**
- * Return owned RServer
- *
- * @since S60 3.2
- * @return RDun
- */
- RDun& Server();
-
- /**
- * Called by instance of CDunActive to inform Observer of service completed.
- * Destruct the active object.
- *
- * @since S60 3.2
- * @param aRequest Request to service
- * @param aError Error value
- * @return None
- */
- void ServiceCompleted( MDunActive* aRequest, TInt aError );
-
-// from base class CLocodServicePlugin
-
- /**
- * From CLocodServicePlugin.
- * Implements interface virtual function
- *
- * @since S60 3.2
- * @param aBearer, BT/IR/USB bearer defined in locodbearer.h
- * @param aBearerStatus, the status of this bearer,
- ETrue if it is available;
- EFalse otherwise.
- * @return None
- */
- void ManageService( TLocodBearer aBearer, TBool aBearerStatus );
-
-private:
-
- CDunPlugin( TLocodServicePluginParams& aParams );
-
- void ConstructL();
-
- /**
- * Reports completion status to LOCOD
- *
- * @since S60 3.2
- * @param aBearer Bearer to report
- * @param aBearerStatus Bearer status to report
- * @param aErr Error condition to report
- * @return None
- */
- void ReportCompletion( TLocodBearer aBearer,
- TBool aBearerStatus,
- TInt aErr);
-
-private: // data
-
- /**
- * Client side of DUN Server
- */
- RDun iServer;
-
- /**
- * Array of Active Object
- */
- RPointerArray<CDunActive> iActiveContainer;
-
- };
-
-#endif // C_CDUNPLUGIN_H
--- a/localconnectivityservice/dun/client/inc/dunserverdef.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for server
-*
-*/
-
-
-#ifndef DUN_SERVERDEF_H
-#define DUN_SERVERDEF_H
-
-// INCLUDES
-#include <e32base.h>
-#include <e32svr.h>
-
-// DATA TYPES
-enum TDunIpc
- {
- EDunFuncManageService,
- EDunFuncActiveConnection, // For testing purposes only
- EInvalidIpc
- };
-
-// GLOBAL CONSTANTS
-
-_LIT( KDialupServerName, "dunserver" );
-
-const TUint KDunServerMajorVersionNumber = 2;
-const TUint KDunServerMinorVersionNumber = 0;
-const TUint KDunServerBuildVersionNumber = 0;
-
-#endif // DUN_SERVERDEF_H
--- a/localconnectivityservice/dun/client/src/0x20002775.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource definitions for project DUN
-*
-*/
-
-
-#include <ecom/registryinfov2.rh>
-#include <locodplugin.hrh>
-
-RESOURCE REGISTRY_INFO theInfo
- {
- // resource_format_version must always be set as follows
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
- // UID for the DLL
- dll_uid = 0x20002775;
- // Declare array of interface info
- interfaces =
- {
- INTERFACE_INFO
- {
- // UID of interface that is implemented
- interface_uid = KLOCODSERVICEINTERFACEUID;
- implementations =
- {
- // Info for CDunPlugin
- IMPLEMENTATION_INFO
- {
- implementation_uid = KFeatureIdDialupNetworking;
- version_no = 1;
- display_name = "DialupNetwork Plugin";
- default_data = "";
- opaque_data = "";
- // This implementation CANNOT be overridden by a RAM-based plug-in
- rom_only = 1;
- }
- };
- }
- };
- }
--- a/localconnectivityservice/dun/client/src/dunactive.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Controls asynchronous requests between LOCOD and DUN server
-*
-*/
-
-
-#include "dunactive.h"
-#include "dunplugin.h"
-#include "DunDebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunActive* CDunActive::NewL( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus)
- {
- CDunActive* self = CDunActive::NewLC( aPlugin, aBearer, aBearerStatus );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunActive* CDunActive::NewLC( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus )
- {
- CDunActive* self = new (ELeave) CDunActive( aPlugin,
- aBearer,
- aBearerStatus );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunActive::~CDunActive()
- {
- FTRACE(FPrint( _L("CDunActive::~CDunActive()") ));
- Cancel();
- FTRACE(FPrint( _L("CDunActive::~CDunActive() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Request function
-// ---------------------------------------------------------------------------
-//
-TInt CDunActive::ServiceRequest()
- {
- FTRACE(FPrint( _L("CDunActive::ServiceRequest()") ));
- TInt err = KErrNone;
-
- iStatus = KRequestPending;
- err = (iPlugin->Server()).ManageService( this, iStatus );
- SetActive();
- FTRACE(FPrint( _L("CDunActive::ServiceRequest() complete") ));
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// CDunActive::CDunActive
-// ---------------------------------------------------------------------------
-//
-CDunActive::CDunActive( CDunPlugin* aPlugin,
- TLocodBearer aBearer,
- TBool aBearerStatus )
- : CActive( EPriorityStandard ),
- iPlugin( aPlugin ),
- iBearer( aBearer ),
- iBearerStatus( aBearerStatus )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunActive::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunActive::ConstructL()
- {
- FTRACE(FPrint( _L("CDunActive::ConstructL()") ));
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunActive::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Cancel current activity.
-// ---------------------------------------------------------------------------
-//
-void CDunActive::DoCancel()
- {
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive
-// Called when read or write operation is ready.
-// ---------------------------------------------------------------------------
-//
-void CDunActive::RunL()
- {
- FTRACE(FPrint( _L("CDunActive::RunL()") ));
- TInt retVal = iStatus.Int();
- iPlugin->ServiceCompleted( this, retVal );
- FTRACE(FPrint( _L("CDunActive::RunL() complete (%d)"), retVal ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunActive.
-// Bearer
-// ---------------------------------------------------------------------------
-//
-TLocodBearer CDunActive::Bearer()
- {
- FTRACE(FPrint( _L("CDunActive::Bearer()") ));
- FTRACE(FPrint( _L("CDunActive::Bearer() complete") ));
- return iBearer;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunActive.
-// Bearer status
-// ---------------------------------------------------------------------------
-//
-TBool CDunActive::BearerStatus()
- {
- FTRACE(FPrint( _L("CDunActive::BearerStatus()") ));
- FTRACE(FPrint( _L("CDunActive::BearerStatus() complete") ));
- return iBearerStatus;
- }
--- a/localconnectivityservice/dun/client/src/dunclient.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Main client side interface of DUN
-*
-*/
-
-
-#include "dunclient.h"
-#include "dunserverdef.h"
-#include "DunDebug.h"
-#include "dunactive.h"
-
-const TInt KDunRetryCount = 3;
-const TInt KDunNumOfMessageSlots = 4;
-
-// ======== LOCAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Create server thread/process
-// ---------------------------------------------------------------------------
-//
-static TInt StartServer()
- {
- FTRACE(FPrint( _L("StartServer()") ));
- TInt retVal = KErrNone;
- TRequestStatus statusStarted;
-
- RProcess server;
- retVal = server.Create( KDialupServerName, KNullDesC, EOwnerThread );
-
- if ( retVal != KErrNone )
- {
- FTRACE(FPrint( _L("StartServer() complete (%d)"), retVal ));
- return retVal;
- }
-
- TRequestStatus stat;
- server.Rendezvous( stat );
-
- if ( stat != KRequestPending )
- {
- server.Kill( 0 ); //abort startup
- }
- else
- {
- server.Resume(); //logon OK - start the server
- }
-
- User::WaitForRequest( stat ); //wait the start or death of the server
-
- /*
- we can't use the 'exit reason' if the server panicked as this
- is the panic 'reason' and may be '0' which cannot be distinguished
- from KErrNone
- */
- retVal = stat.Int();
- if ( server.ExitType() == EExitPanic )
- {
- retVal = KErrServerTerminated;
- }
-
- server.Close();
- FTRACE(FPrint( _L("StartServer() complete (%d)"), retVal ));
- return retVal;
- }
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// RDun::RDun()
-// ---------------------------------------------------------------------------
-//
-RDun::RDun()
- {
- }
-
-// ---------------------------------------------------------------------------
-// This function starts DUN open/close for different medias
-// ---------------------------------------------------------------------------
-//
-TInt RDun::ManageService( MDunActive* aRequest, TRequestStatus& aReqStatus )
- {
- FTRACE(FPrint( _L("RDun::ManageService()") ));
- SendReceive( EDunFuncManageService,
- TIpcArgs(aRequest->Bearer(),
- aRequest->BearerStatus()),
- aReqStatus );
- FTRACE(FPrint( _L("RDun::ManageService() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// This function gets the active connection
-// ---------------------------------------------------------------------------
-//
-TAny* RDun::ActiveConnection()
- {
- FTRACE(FPrint( _L("RDun::ActiveConnection()") ));
- TAny* connId = NULL;
- TPckg<TAny*> connIdPckg( connId );
- SendReceive( EDunFuncActiveConnection,
- TIpcArgs(&connIdPckg) );
- FTRACE(FPrint( _L("RDun::ActiveConnection() complete") ));
- return connId;
- }
-
-// ---------------------------------------------------------------------------
-// Version number
-// ---------------------------------------------------------------------------
-//
-TVersion RDun::Version() const
- {
- FTRACE(FPrint( _L("RDun::Version()") ));
- FTRACE(FPrint( _L("RDun::Version() complete") ));
- return ( TVersion(KDunServerMajorVersionNumber,
- KDunServerMinorVersionNumber,
- KDunServerBuildVersionNumber) );
- }
-
-// ---------------------------------------------------------------------------
-// This function connects to DUN server and creates a new session.
-// ---------------------------------------------------------------------------
-//
-TInt RDun::Connect()
- {
- FTRACE(FPrint( _L("RDun::Connect()") ));
- TInt retry;
- TInt retVal = KErrNone;
- for ( retry=KDunRetryCount; retry>=0; retry-- )
- {
- retVal=CreateSession( KDialupServerName,
- TVersion(KDunServerMajorVersionNumber,
- KDunServerMinorVersionNumber,
- KDunServerBuildVersionNumber),
- KDunNumOfMessageSlots );
- if ( retVal == KErrNotFound || retVal == KErrServerTerminated )
- {
- retVal = StartServer();
- if ( retVal!=KErrNone && retVal!=KErrAlreadyExists )
- {
- FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal ));
- return retVal;
- }
- }
- else // KErrNone, or other error code.
- {
- FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal ));
- return retVal;
- }
- }
- FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal ));
- return retVal;
- }
--- a/localconnectivityservice/dun/client/src/dunplugin.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: EComm interface implementation and the client side of DUN
-*
-*/
-
-
-#include "dunplugin.h"
-#include "dunactive.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunPlugin* CDunPlugin::NewL( TLocodServicePluginParams& aParams )
- {
- CDunPlugin* self = new (ELeave) CDunPlugin( aParams );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunPlugin::~CDunPlugin()
- {
- FTRACE(FPrint( _L("CDunPlugin::~CDunPlugin()") ));
- iActiveContainer.ResetAndDestroy();
- iActiveContainer.Close();
- if ( iServer.Handle() != KNullHandle )
- {
- iServer.Close();
- }
- FTRACE(FPrint( _L("CDunPlugin::~CDunPlugin() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Return owned RServer
-// ---------------------------------------------------------------------------
-//
-RDun& CDunPlugin::Server()
- {
- FTRACE(FPrint( _L("CDunPlugin::Server()") ));
- FTRACE(FPrint( _L("CDunPlugin::Server() complete") ));
- return iServer;
- }
-
-// ---------------------------------------------------------------------------
-// Called by instance of CDunActive to inform Observer of service completed.
-// Destruct the active object.
-// ---------------------------------------------------------------------------
-//
-void CDunPlugin::ServiceCompleted( MDunActive* aRequest, TInt aError )
- {
- FTRACE(FPrint( _L("CDunPlugin::ServiceCompleted()") ));
- TInt i;
- TLocodBearer bearer = aRequest->Bearer();
- TBool status = aRequest->BearerStatus();
- for ( i=iActiveContainer.Count()-1; i>=0; i-- )
- {
- if ( iActiveContainer[i] == aRequest )
- {
- delete iActiveContainer[i];
- iActiveContainer.Remove( i );
- break;
- }
- }
- ReportCompletion( bearer, status, aError );
- FTRACE(FPrint( _L("CDunPlugin::ServiceCompleted() completed (%d)"), aError ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CLocodServicePlugin.
-// Implements interface virtual function
-// ---------------------------------------------------------------------------
-//
-void CDunPlugin::ManageService( TLocodBearer aBearer, TBool aBearerStatus )
- {
- FTRACE(FPrint( _L("CDunPlugin::ManageService()") ));
- TInt retTemp;
- if ( iServer.Handle() == KNullHandle )
- {
- retTemp = iServer.Connect();
- if ( retTemp != KErrNone )
- {
- ReportCompletion( aBearer, aBearerStatus, retTemp );
- FTRACE(FPrint( _L("CDunPlugin::ManageService() (failed!) complete (%d)"), retTemp ));
- return;
- }
- }
- CDunActive* stateRequest = NULL;
- TRAPD( retTrap, stateRequest=CDunActive::NewL( this,
- aBearer,
- aBearerStatus ));
- if ( retTrap != KErrNone )
- {
- ReportCompletion( aBearer, aBearerStatus, retTrap );
- FTRACE(FPrint( _L("CDunPlugin::ManageService() (failed!) complete (%d)"), retTrap ));
- return;
- }
- if ( !stateRequest )
- {
- ReportCompletion( aBearer, aBearerStatus, KErrGeneral );
- FTRACE(FPrint( _L("CDunPlugin::ManageService() (failed!) complete (%d)"), KErrGeneral ));
- return;
- }
- retTemp = iActiveContainer.Append( stateRequest );
- if ( retTemp != KErrNone )
- {
- ReportCompletion( aBearer, aBearerStatus, retTemp );
- FTRACE(FPrint( _L("CDunPlugin::ManageService() (failed!) complete (%d)"), retTemp ));
- return;
- }
- stateRequest->ServiceRequest();
- FTRACE(FPrint( _L("CDunPlugin::ManageService() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// CDunPlugin::CDunPlugin
-// ---------------------------------------------------------------------------
-//
-CDunPlugin::CDunPlugin( TLocodServicePluginParams& aParams )
- : CLocodServicePlugin( aParams )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunPlugin::ConstructL()
- {
- FTRACE(FPrint( _L("CDunPlugin::ConstructL()") ));
- FTRACE(FPrint( _L("CDunPlugin::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Reports completion status to LOCOD
-// ---------------------------------------------------------------------------
-//
-void CDunPlugin::ReportCompletion( TLocodBearer aBearer,
- TBool aBearerStatus,
- TInt aErr)
- {
- FTRACE(FPrint( _L("CDunPlugin::ReportCompletion()") ));
- Observer().ManageServiceCompleted( aBearer,
- aBearerStatus,
- ImplementationUid(),
- aErr);
- FTRACE(FPrint( _L("CDunPlugin::ReportCompletion() completed (%d)"), aErr ));
- }
--- a/localconnectivityservice/dun/client/src/proxy.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Export ECom interface implementations
-*
-*/
-
-
-#include <ecom/implementationproxy.h> //ECom header file
-#include "dunplugin.h"
-
-// ---------------------------------------------------------------------------
-// An array of TImplementationProxy objects which onnect each
-// implemeation with its instantiation function
-// ---------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( KFeatureIdDialupNetworking, CDunPlugin::NewL )
- };
-
-// ---------------------------------------------------------------------------
-// Exported proxy function to resolve instantiation methods for an Ecom
-// plug-in DLL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
- TInt & aTableCount )
- {
- aTableCount = sizeof( ImplementationTable ) /
- sizeof( TImplementationProxy );
- return ImplementationTable;
- }
--- a/localconnectivityservice/dun/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-
-// bld.inf list of the modules to be build using this file
-// NOTE: order of this list must be same as the correct building order
-
-#include "../atext/group/bld.inf"
-#include "../utils/group/bld.inf"
-#include "../server/group/bld.inf"
-#include "../client/group/bld.inf"
-#include "../plugins/group/bld.inf"
--- a/localconnectivityservice/dun/group/dun.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component dun
-
-source \sf\mw\remoteconn\localconnectivityservice\dun
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/localconnectivityservice/dun/plugins/bwins/dunbtu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
-
--- a/localconnectivityservice/dun/plugins/bwins/duniru.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
-
--- a/localconnectivityservice/dun/plugins/bwins/dunusbu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
-
--- a/localconnectivityservice/dun/plugins/eabi/dunbtu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z15NewLocalPluginLv @ 1 NONAME
-
--- a/localconnectivityservice/dun/plugins/eabi/duniru.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z15NewLocalPluginLv @ 1 NONAME
-
--- a/localconnectivityservice/dun/plugins/eabi/dunusbu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z15NewLocalPluginLv @ 1 NONAME
-
--- a/localconnectivityservice/dun/plugins/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* This file provides the information required for building the whole of
-* plugins.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-#ifdef __BT
-../../rom/dunbt.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunbt.iby)
-#endif
-#ifdef __IRDA
-../../rom/dunir.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunir.iby)
-#endif
-#ifdef __USB
-../../rom/dunusb.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunusb.iby)
-#endif
-
-PRJ_MMPFILES
-
-#ifdef __BT
-dunbt.mmp
-#endif
-#ifdef __IRDA
-dunir.mmp
-#endif
-#ifdef __USB
-dunusb.mmp
-#endif
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/dun/plugins/group/dunbt.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN BT plugin.
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET dunbt.dll
-TARGETTYPE DLL
-UID 0x101F6E2D 0x101F6E2B
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src/bt
-SOURCE DunBtPlugin.cpp
-SOURCE DunBtListen.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc/bt ../../utils/inc
-USERINCLUDE ../../../inc
-
-LIBRARY euser.lib
-LIBRARY esock.lib
-LIBRARY btengdiscovery.lib
-LIBRARY bluetooth.lib
-LIBRARY dunutils.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/plugins/group/dunir.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN IR plugin
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET dunir.dll
-TARGETTYPE DLL
-UID 0x101F6E2D 0x101FBAEB
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src/ir
-SOURCE DunIrPlugin.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc/ir ../../utils/inc
-USERINCLUDE ../../../inc
-
-LIBRARY euser.lib
-LIBRARY c32.lib
-LIBRARY dunutils.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/plugins/group/dunusb.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN USB plugin
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET dunusb.dll
-TARGETTYPE DLL
-UID 0x101F6E2D 0x101F6E2F
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src/usb
-SOURCE DunUsbPlugin.cpp
-SOURCE DunUsbListen.cpp
-SOURCE DunUsbConfig.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc/usb ../../utils/inc
-USERINCLUDE ../../../inc
-
-LIBRARY euser.lib
-LIBRARY c32.lib
-LIBRARY usbman.lib
-LIBRARY dunutils.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/plugins/inc/bt/DunBtListen.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,261 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Bluetooth plugin's listener
-*
-*/
-
-
-#ifndef C_CDUNBTLISTEN_H
-#define C_CDUNBTLISTEN_H
-
-#include <btengdiscovery.h>
-#include "DunPlugin.h"
-#include "DunTransporter.h"
-
-class TBtPortEntity;
-
-enum TBtListenState
- {
- EBtListenStateIdle,
- EBtListenStateListening
- };
-
-/**
- * DUN Bluetooth plugin's listener class
- * This class starts listening on a created BT RFComm channel and notifies
- * parent (CDunBtPlugin) when new connection is detected. Also registers and
- * unregisters DUN SDP record.
- *
- * @lib dunbt.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunBtListen ) : public CActive,
- public MDunServAdvMon
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aServer Server
- * @param aParent Callback interface to parent
- * @param aTransporter Transporter
- * @param aEntity Data socket entity
- * @return Instance of self
- */
- static CDunBtListen* NewL( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- CDunTransporter* aTransporter,
- TBtPortEntity& aEntity );
-
- /**
- * Destructor.
- */
- virtual ~CDunBtListen();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Registers DUN and starts to listen.
- * Registers itself to SDP and BT manager, opens a socket
- * and starts to listen it.
- *
- * @since S60 3.2
- * @return None
- */
- void IssueRequestL();
-
- /**
- * Stops listening
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunBtListen( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- CDunTransporter* aTransporter,
- TBtPortEntity& aEntity );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Starts dialup service advertisement
- *
- * @since S60 3.2
- * @param aInUse ETrue is returned if all RFCOMM channels in use.
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StartServiceAdvertisement( TBool& aInUse );
-
- /**
- * Stops dialup service advertisement
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StopServiceAdvertisement();
-
- /**
- * Method which reserves local RFCOMM channel (from possible channels 1-30)
- * and returns it to client.
- *
- * @since S60 3.2
- * @param aSocketServer Handle to connected socket server.
- * @param aListenSocket Socket which is initiated for listening.
- * @param aChannelNum RFCOMM channel which is reserved for listening.
- * @param aInUse ETrue is returned if all RFCOMM channels in use.
- * @return KErrNone if OK, else value indicating error situation.
- */
- TInt ReserveLocalChannel( RSocketServ& aSocketServ,
- RSocket& aListenSocket,
- TUint& aChannelNum,
- TBool& aInUse );
-
- /**
- * Tries to bind to a fixed port and if that fails with
- * KRfcommPassiveAutoBind. This is for spec breaking solutions like the
- * OSX Leopard.
- *
- * @since S60 5.0
- * @param aListenSocket Listen socket for Bind()
- * @param aSockAddr Address for the socket
- * (must be set for KRfcommPassiveAutoBind)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoExtendedBind( RSocket& aListenSocket, TRfcommSockAddr& aSockAddr );
-
-// from base class CActive
-
- /**
- * From CActive.
- * Called when a service is requested via BT.
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Cancel current activity.
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunServAdvMon
-
- /**
- * From MDunServAdvMon.
- * Gets called when advertisement status changes to start
- *
- * @since S60 5.0
- * @param aCreation ETrue if channel creation
- * EFalse if channel free
- * @return None
- */
- void NotifyAdvertisementStart( TBool aCreation );
-
- /**
- * From MDunServAdvMon.
- * Gets called when advertisement status changes to end
- *
- * @since S60 5.0
- * @return None
- */
- void NotifyAdvertisementEnd();
-
-private: // data
-
- /**
- * Callback to call when notification via MDunServerCallback to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Callback to call when notification via MDunListenCallback to be made
- * Not own.
- */
- MDunListenCallback* iParent;
-
- /**
- * Transporter to use for network side communication
- * Not own.
- */
- CDunTransporter* iTransporter;
-
- /**
- * Data socket entity for actual data transfer
- * This will be valid after CDunBtListen reacts to new data in
- * listener socket
- */
- TBtPortEntity& iEntity;
-
- /**
- * Current state of listening: active or inactive
- */
- TBtListenState iListenState;
-
- /**
- * Listener socket that will listen for activity in RFComm channel
- */
- RSocket iListenSocket;
-
- /**
- * Socket server used to reserve RFComm channel and creating data socket
- */
- RSocketServ iSockServer;
-
- /**
- * BT engine's Bluetooth discovery functionality
- * Used for registering/unregistering SDP record
- * Own.
- */
- CBTEngDiscovery* iDiscovery;
-
- /**
- * Local BT channel number
- * Set to reserved RFComm channel and used to register SDP record
- */
- TUint iChannelNum;
-
- /**
- * Handle to the reserver SDP channel
- * Set when SDP record registered
- */
- TSdpServRecordHandle iSDPHandleDun;
-
- };
-
-#endif // C_CDUNBTLISTEN_H
--- a/localconnectivityservice/dun/plugins/inc/bt/DunBtPlugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Bluetooth plugin
-*
-*/
-
-
-#ifndef C_CDUNBTPLUGIN_H
-#define C_CDUNBTPLUGIN_H
-
-#include <e32base.h>
-#include <es_sock.h>
-#include "DunTransporter.h"
-#include "DunPlugin.h"
-
-/**
- * Cleanup information for AllocateChannelL().
- * This data is needed to clean up partially constructed data in
- * NotifyChannelAllocate() when a leave occurs in channel creation.
- *
- * @lib dunbt.lib
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( TBtCleanupInfo )
- {
-
-public:
-
- /**
- * Flag to indicate whether or not a new entity was created
- */
- TBool iNewEntity;
-
- /**
- * Index to the position of the found entity
- */
- TInt iEntityIndex;
-
- };
-
-/**
- * DUN BT plugin's port entity
- * This class is used to keep track of N number of BT ports and RFCOMM
- * channel numbers associated to them.
- *
- * @lib dunbt.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TBtPortEntity )
- {
-
-public:
-
- /**
- * RFCOMM channel number for BT local media side
- */
- TInt iChannelNum;
-
- /**
- * Port for BT local media side
- */
- RSocket iBTPort;
-
- };
-
-/**
- * DUN Bluetooth plugin's main class
- * This class creates new transporter channel when new data is detected by
- * CDunBtListen class and acts on transporter's state changes. Also acts on
- * DUN server's requests.
- *
- * @lib dunbt.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunBtPlugin ) : public CBase,
- public MDunLocalMediaPlugin,
- public MDunListenCallback,
- public MDunConnMon
- {
-
-public:
-
- CDunBtPlugin();
-
- /**
- * Destructor.
- */
- virtual ~CDunBtPlugin();
-
-private:
-
- /**
- * State of this plugin
- *
- * @since S60 3.2
- * @return State of plugin
- */
- TDunPluginState PluginState();
-
- /**
- * Constructs a listener object for this plugin
- *
- * @since S60 3.2
- * @return None
- */
- void ConstructListenerL();
-
- /**
- * Sets new state
- * New state must be one more than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeUp( TDunPluginState aPluginState );
-
- /**
- * Sets new state
- * New state must be one less than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeDown( TDunPluginState aPluginState );
-
- /**
- * Allocates a free channel
- *
- * @since S60 3.2
- * @param aNoFreeChans ETrue if no free channels, EFalse otherwise
- * @param aCleanupInfo Cleanup information
- * @return None
- */
- void AllocateChannelL( TBool& aNoFreeChans, TBtCleanupInfo& aCleanupInfo );
-
- /**
- * Frees existing channels
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt FreeChannels();
-
- /**
- * Uninitializes this plugin
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Uninitialize();
-
- /**
- * Gets port's index and entity by connection ID
- *
- * @since S60 3.2
- * @param aConnId Connection ID of the connection to find
- * @param aEntity Returned port entity
- * @return KErrNotFound if entity not found, found index otherwise
- */
- TInt GetPortByConnId( TConnId aConnId, TBtPortEntity*& aEntity );
-
- /**
- * Gets first free port's index and entity
- *
- * @since S60 3.2
- * @param aEntity Returned port entity
- * @return KErrNotFound if entity not found, found index otherwise
- */
- TInt GetFirstFreePort( TBtPortEntity*& aEntity );
-
- /**
- * Sets modem's MSC (Modem Status Command)
- *
- * @since S60 3.2
- * @param aEntity Port entity for which to change signal
- * @param aSignal Signal to set to high or low
- * @param aSignalOn ETrue if signal wanted high, otherwise low
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetRFCOMMStatusCommand( TBtPortEntity& aEntity,
- TUint8 aSignal,
- TBool aSignalOn );
-
- /**
- * Manages advertiser for channel free operation
- *
- * @since S60 5.0
- * @return None
- */
- void ManageAdvertiserFreeOperationL();
-
- /**
- * Cleans partial created channel data based on TATExtCleanupInfo
- *
- * @since S60 5.0
- * @param aCleanupInfo Cleanup information
- * @return None
- */
- void CleanPartialChanneldata( TBtCleanupInfo& aCleanupInfo );
-
-// from base class MDunLocalMediaPlugin
-
- void ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server changes a plugin's state
- *
- * @since S60 3.2
- * @param aPluginState New changed state
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyServerStateChange( TDunPluginState aPluginState );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server needs to know the active connection
- * (For testing purposes only)
- *
- * @since S60 5.0
- * @return Active connection, NULL otherwise
- */
- TConnId ActiveConnection();
-
-// from base class MDunListenCallback
-
- /**
- * From MDunListenCallback.
- * Gets called when new channel must be created
- *
- * @since S60 3.2
- * @param aNoFreeChans ETrue if no free channels, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelAllocate( TBool& aNoFreeChans );
-
- /**
- * From MDunListenCallback.
- * Gets called when an existing channel must be freed
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelFree();
-
-// from base class MDunConnMon
-
- /**
- * From MDunConnMon.
- * Gets called when line status changes or when any type of error is
- * detected
- *
- * @since S60 3.2
- * @param aConnId Connection ID for callback
- * @param aConnReason Reason for progress change
- * @return None
- */
- void NotifyProgressChangeL( TConnId aConnId,
- TDunConnectionReason aConnReason );
-
-private: // data
-
- /**
- * Callback to call when notification via MDunServerCallback to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Listener for detecting new data in RFComm channel
- * Notifies this class about new data
- * Own.
- */
- CDunBtListen* iBTListen;
-
- /**
- * Data socket entity for actual data transfer
- * This will be valid after CDunBtListen reacts to new data in
- * listener socket
- */
- TBtPortEntity iEntity;
-
- /**
- * Array of RSocket port(s) entities for BT local media side
- */
- RArray<TBtPortEntity> iBTPorts;
-
- /**
- * Transporter to use for network side communication
- * Not own.
- */
- CDunTransporter* iTransporter;
-
- };
-
-#endif // C_CDUNBTPLUGIN_H
--- a/localconnectivityservice/dun/plugins/inc/ir/DunIrPlugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Infrared plugin
-*
-*/
-
-
-#ifndef C_CDUNIRPLUGIN_H
-#define C_CDUNIRPLUGIN_H
-
-#include <e32base.h>
-#include <c32comm.h>
-#include "DunTransporter.h"
-#include "DunPlugin.h"
-
-/**
- * DUN Infrared plugin's main class
- * This class creates new transporter channel as soon as listening is
- * required by DUN server
- *
- * @lib dunir.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunIrPlugin ) : public CBase,
- public MDunLocalMediaPlugin,
- public MDunConnMon
- {
-
-public:
-
- CDunIrPlugin();
-
- /**
- * Destructor.
- */
- virtual ~CDunIrPlugin();
-
-private:
-
- /**
- * State of this plugin
- *
- * @since S60 3.2
- * @return State of plugin
- */
- TDunPluginState PluginState();
-
- /**
- * Constructs a listener object for this plugin
- *
- * @since S60 3.2
- * @return None
- */
- TInt ConstructListener();
-
- /**
- * Sets new state
- * New state must be one more than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeUp( TDunPluginState aPluginState );
-
- /**
- * Sets new state
- * New state must be one less than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeDown( TDunPluginState aPluginState );
-
- /**
- * Initializes one infrared port with role DCE
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitPort();
-
- /**
- * Allocates a channel
- *
- * @since S60 3.2
- * @return None
- */
- void AllocateChannelL();
-
- /**
- * Uninitializes this plugin
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Uninitialize();
-
-// from base class MDunLocalMediaPlugin
-
- void ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server changes a plugin's state
- *
- * @since S60 3.2
- * @param aPluginState New changed state
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyServerStateChange( TDunPluginState aPluginState );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server needs to know the active connection
- * (For testing purposes only)
- *
- * @since S60 5.0
- * @return Active connection, NULL otherwise
- */
- TConnId ActiveConnection();
-
-// from base class MDunConnMon
-
- /**
- * From MDunConnMon.
- * Gets called when line status changes or when any type of error is
- * detected
- *
- * @since S60 3.2
- * @param aConnId Connection ID for callback
- * @param aConnReason Reason for progress change
- * @return None
- */
- void NotifyProgressChangeL( TConnId aConnId,
- TDunConnectionReason aConnReason );
-
-private: // Data
-
- /**
- * Callback to call when notification MDunServerCallback via to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Communications server used to load IRCOMM and open IR port
- */
- RCommServ iCommServer;
-
- /**
- * RComm port for infrared local media side
- */
- RComm iIrPort;
-
- /**
- * Transporter to use for network side communication
- * Not own.
- */
- CDunTransporter* iTransporter;
-
- };
-
-#endif // C_CDUNIRPLUGIN_H
--- a/localconnectivityservice/dun/plugins/inc/usb/DunUsbConfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB configuration accessor and listener
-*
-*/
-
-
-#ifndef C_CDUNUSBCONFIG_H
-#define C_CDUNUSBCONFIG_H
-
-#include <e32property.h>
-#include <usb/acmconfig.h>
-#include "DunPlugin.h"
-
-enum TUsbConfigState
- {
- EUsbConfigStateIdle,
- EUsbConfigStateWaiting
- };
-
-/**
- * Notification interface class to report USB ACM configuration change
- *
- * @lib dunusb.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunUsbConfig )
- {
-
-public:
-
- /**
- * Gets called when one or more ACM configurations are added
- *
- * @since S60 3.2
- * @param aIndex Index (also port number) of added ACM configuration
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyConfigAddition( TInt aIndex ) = 0;
-
- /**
- * Gets called when one or more ACM configurations are removed
- *
- * @since S60 3.2
- * @param aIndex Index (also port number) of removed ACM configuration
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyConfigRemoval( TInt aIndex ) = 0;
-
- };
-
-/**
- * Class for detecting USB ACM configuration change
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunUsbConfig ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aServer Server
- * @param aCallback Pointer to listener callback
- * @param aProtocol Protocol number to listen
- * @return Instance of self
- */
- static CDunUsbConfig* NewL( MDunServerCallback* aServer,
- MDunUsbConfig* aCallback,
- TUint8 aProtocol );
-
- /**
- * Destructor.
- */
- virtual ~CDunUsbConfig();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Compares initialized protocol number to configuration by index
- *
- * @since S60 3.2
- * @param aIndex Index for which to compare protocol number
- * @param aValidity If initialized protocol matched at aIndex then ETrue
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt GetConfigValidityByIndex( TInt aIndex, TBool& aValidity );
-
- /**
- * Starts listening for ACM configuration changes
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops listening for ACM configuration changes
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunUsbConfig( MDunServerCallback* aServer,
- MDunUsbConfig* aCallback,
- TUint8 aProtocol );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /*
- * Gets current ACM configuration
- */
- TInt GetConfiguration( TPublishedAcmConfigs& aConfig );
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when ACM configuration changes
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback to call when notification via MDunServerCallback to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Callback to call when notification(s) via MDunUsbConfig to be made
- */
- MDunUsbConfig* iCallback;
-
- /**
- * Current state of configuration waiting: active or inactive
- */
- TUsbConfigState iConfigState;
-
- /*
- * Protocol number of USB ACM to which listening is done
- */
- TUint8 iProtocol;
-
- /**
- * ACM config from the previous Get()
- * Used to check whether configs are added or removed and also array data
- * needed for check in the removal case
- */
- TPublishedAcmConfigs iConfig;
-
- /*
- * ACM configuration property
- */
- RProperty iAcmProperty;
-
- /*
- * Flag to indicate if configuration already received
- */
- TBool iConfigExist;
-
- };
-
-#endif // C_CDUNUSBCONFIG_H
--- a/localconnectivityservice/dun/plugins/inc/usb/DunUsbListen.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB plugin's listener
-*
-*/
-
-
-#ifndef C_CDUNUSBLISTEN_H
-#define C_CDUNUSBLISTEN_H
-
-#include <e32std.h>
-#include <c32comm.h>
-#include <usbman.h>
-#include "DunPlugin.h"
-
-enum TUsbListenState
- {
- EUsbListenStateIdle,
- EUsbListenStateListening
- };
-
-/**
- * DUN USB plugin's listener class
- * This class starts listening for USB device state to change to configured.
- * When change to configured is detected, parent (CDunUsbPlugin) is notified
- * to create a channel. Also when device state is no longer configured,
- * parent (CDunUsbPlugin) is notified to remove a channel.
- *
- * @lib dunusb.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunUsbListen ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aServer Server
- * @param aParent Creator of this instance
- * @param aUsbServer USB server
- * @return Instance of self
- */
- static CDunUsbListen* NewL( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- RUsb& aUsbServer );
-
- /**
- * Destructor.
- */
- virtual ~CDunUsbListen();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * IssueRequest to USB server for device state change notifications
- *
- * @return KErrAlreadyExists if device state configured,
- * KErrNone otherwise
- */
- TInt IssueRequestL();
-
- /**
- * Stops listening
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunUsbListen( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- RUsb& aUsbServer );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Activates listening request
- *
- * @since S60 3.2
- * @return KErrNotReady if already active, KErrNone otherwise
- */
- TInt Activate();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Called when read or write operation is ready.
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Cancel current activity.
- *
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback to call when notification via MDunServerCallback to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Callback to call when notification via MDunListenCallback to be made
- * Not own.
- */
- MDunListenCallback* iParent;
-
- /**
- * Current state of listening: active or inactive
- */
- TUsbListenState iListenState;
-
- /**
- * USB server (USB manager) needed for device state notifications
- * Device states needed to create transporter channel
- */
- RUsb& iUsbServer;
-
- /**
- * Device state of USB set when RUsb::DeviceStateNotification completes
- */
- TUsbDeviceState iDeviceState;
-
- /**
- * Previous state of USB set when RUsb::DeviceStateNotification completes
- */
- TUsbDeviceState iDeviceStatePrev;
-
- };
-
-#endif // C_CDUNUSBLISTEN_H
--- a/localconnectivityservice/dun/plugins/inc/usb/DunUsbPlugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB plugin
-*
-*/
-
-
-#ifndef C_CDUNUSBPLUGIN_H
-#define C_CDUNUSBPLUGIN_H
-
-#include <e32base.h>
-#include <usbman.h>
-#include "DunTransporter.h"
-#include "DunUsbListen.h"
-#include "DunUsbConfig.h"
-#include "DunPlugin.h"
-
-/**
- * DUN USB plugin's port entity
- * This class is used to keep track of N number of USB ports and port
- * numbers associated to them (for CDunUsbConfig's purposes).
- *
- * @lib dunusb.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TUsbPortEntity )
- {
-
-public:
-
- /**
- * Port number for USB local media side
- */
- TInt iPortNum;
-
- /**
- * Port for USB local media side
- */
- RComm iUsbPort;
-
- };
-
-/**
- * DUN USB plugin's main class
- * This class creates new transporter channel(s) when configured USB is
- * detected by CDunUsbListen class and acts on transporter's state changes.
- * Also acts on DUN server's requests.
- *
- * @lib dunusb.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunUsbPlugin ) : public CBase,
- public MDunLocalMediaPlugin,
- public MDunListenCallback,
- public MDunBufferCorrection,
- public MDunConnMon,
- public MDunUsbConfig
- {
-
-public:
-
- CDunUsbPlugin();
-
- /**
- * Destructor.
- */
- virtual ~CDunUsbPlugin();
-
-private:
-
- /**
- * State of this plugin
- *
- * @since S60 3.2
- * @return State of plugin
- */
- TDunPluginState PluginState();
-
- /**
- * Constructs a listener object for this plugin
- *
- * @since S60 3.2
- * @return None
- */
- void ConstructListenerL();
-
- /**
- * Initializes USB by loading LDD
- *
- * @since S60 3.2
- * @return None
- */
- void InitUsbL();
-
- /**
- * Initializes all usable USB ports for DUN
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitPorts();
-
- /**
- * Creates empty usable USB ports that can be used by DUN
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt CreateAllPorts();
-
- /**
- * Initializes one USB port for DUN
- *
- * @since S60 3.2
- * @param aEntity Pointer to port entity
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitOnePort( TUsbPortEntity* aEntity );
-
- /**
- * Sets channel for one USB port
- *
- * @since S60 3.2
- * @param aEntity Pointer to port entity
- * @return None
- */
- void SetChannelL( TUsbPortEntity* aEntity );
-
- /**
- * Adds skipped error code to Transporter
- * The skipped error is added to local media's read and write operations
- *
- * @since S60 3.2
- * @param aError Skipped error code to add
- * @param aComm RComm object for which to add the error code
- * @return None
- */
- void AddSkippedErrorL( TInt aError, RComm* aComm );
-
- /**
- * Sets new state
- * New state must be one more than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeUp( TDunPluginState aPluginState );
-
- /**
- * Sets new state
- * New state must be one less than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReportStateChangeDown( TDunPluginState aPluginState );
-
- /**
- * Frees existing channels
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt FreeChannels();
-
- /**
- * Uninitializes this plugin
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Uninitialize();
-
- /**
- * Gets port's index and entity by connection ID
- *
- * @since S60 3.2
- * @param aConnId Connection ID of the connection to find
- * @param aEntity Returned port entity
- * @return KErrNotFound if entity not found, found index otherwise
- */
- TInt GetEntityByConnId( TConnId aConnId, TUsbPortEntity*& aEntity );
-
- /**
- * Gets port's entity by port number
- *
- * @since S60 3.2
- * @param aPortNum Port number of the connection to find
- * @param aEntity Returned port entity
- * @return KErrNotFound if entity not found, found index otherwise
- */
- TInt GetEntityByPortNumber( TInt aPortNum, TUsbPortEntity*& aEntity );
-
- /**
- * Gets first free port's index and entity
- *
- * @since S60 3.2
- * @param aEntity Returned port entity
- * @return KErrNotFound if entity not found, found index otherwise
- */
- TInt GetFirstFreeEntity( TUsbPortEntity*& aEntity );
-
-// from base class MDunLocalMediaPlugin
-
- void ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server changes a plugin's state
- *
- * @since S60 3.2
- * @param aPluginState New changed state
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyServerStateChange( TDunPluginState aPluginState );
-
- /**
- * From MDunLocalMediaPlugin.
- * Gets called when server needs to know the active connection
- * (For testing purposes only)
- *
- * @since S60 5.0
- * @return Active connection, NULL otherwise
- */
- TConnId ActiveConnection();
-
-// from base class MDunListenCallback
-
- /**
- * From MDunListenCallback.
- * Gets called when new channel must be created
- *
- * @since S60 3.2
- * @param aNoFreeChans ETrue if no free channels, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelAllocate( TBool& aNoFreeChans );
-
- /**
- * From MDunListenCallback.
- * Gets called when an existing channel must be freed
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelFree();
-
-// from base class MDunConnMon
-
- /**
- * From MDunConnMon.
- * Gets called when line status changes or when any type of error is
- * detected
- *
- * @since S60 3.2
- * @param aConnId Connection ID for callback
- * @param aConnReason Reason for progress change
- * @return None
- */
- void NotifyProgressChangeL( TConnId aConnId,
- TDunConnectionReason aConnReason );
-
-// from base class MDunBufferCorrection
-
- /**
- * Gets called when request to change local media's buffer size
- *
- * @since S60 3.2
- * @param aLength Suggested buffer length that will be used if no
- * correction done
- * @return New (corrected) buffer length
- */
- TInt NotifyBufferCorrection( TInt aLength );
-
-// from base class MDunUsbConfig
-
- /**
- * Gets called when one or more ACM configurations are added
- *
- * @since S60 3.2
- * @param aIndex Index (also port number) of added ACM configuration
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyConfigAddition( TInt aIndex );
-
- /**
- * Gets called when one or more ACM configurations are removed
- *
- * @since S60 3.2
- * @param aIndex Index (also port number) of removed ACM configuration
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyConfigRemoval( TInt aIndex );
-
-private: // data
-
- /**
- * Callback to call when notification via MDunServerCallback to be made
- * Not own.
- */
- MDunServerCallback* iServer;
-
- /**
- * Listener for detecting attached USB cable and configured ACM
- * Notifies this class to create new channel
- * Own.
- */
- CDunUsbListen* iUsbListen;
-
- /**
- * Listener and accessor for detecting USB ACM configuration change
- * Own.
- */
- CDunUsbConfig* iUsbConfig;
-
- /**
- * Communications server used to load ECACM and open USB port(s)
- * Also used to get port information to calculate number of supported ACMs
- */
- RCommServ iCommServer;
-
- /**
- * USB server (USB manager) needed for device state notifications
- * Device states needed to create transporter channel
- */
- RUsb iUsbServer;
-
- /**
- * Array of port(s) for USB local media side
- */
- RArray<TUsbPortEntity> iUsbPorts;
-
- /**
- * Transporter to use for network side communication
- * Not own.
- */
- CDunTransporter* iTransporter;
-
- /**
- * Flag to be set on if CDunUsbPlugin is waiting for shutdown.
- * This flag is used to skip subsequent higher-level error codes after
- * driver based error occurred.
- */
- TBool iShutdown;
-
- };
-
-#endif // C_CDUNUSBPLUGIN_H
--- a/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,464 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Bluetooth plugin's listener
-*
-*/
-
-
-#include <btsdp.h>
-#include <e32std.h>
-#include <bt_sock.h>
-#include <btengdiscovery.h>
-#include "DunPlugin.h"
-#include "DunBtListen.h"
-#include "DunBtPlugin.h"
-#include "DunDebug.h"
-
-const TInt KListenQueSize = 1;
-const TInt KDunFixedChannel = 22; // Hack/kludge for Apple Bug ID 6527598
-
-//Service Class Bits supported by DUN
-static const TUint16 KCoDDunServiceClass = EMajorServiceTelephony | EMajorServiceNetworking;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunBtListen* CDunBtListen::NewL( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- CDunTransporter* aTransporter,
- TBtPortEntity& aEntity )
- {
- CDunBtListen* self = new (ELeave) CDunBtListen( aServer,
- aParent,
- aTransporter,
- aEntity );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunBtListen::~CDunBtListen()
- {
- FTRACE(FPrint( _L("CDunBtListen::~CDunBtListen()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunBtListen::~CDunBtListen() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::ResetData()
- {
- // APIs affecting this:
- // IssueRequestL()
- Stop();
- StopServiceAdvertisement();
- // NewL()
- iTransporter->FreeAdvertisementMonitor( KDunBtPluginUid, this );
- delete iDiscovery;
- iDiscovery = NULL;
- if ( iSockServer.Handle() != KNullHandle )
- {
- iSockServer.Close();
- }
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Registers itself to SDP and BT manager, opens a socket
-// and starts to listen it.
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::IssueRequestL()
- {
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL()" ) ));
-
- if ( iListenState == EBtListenStateListening )
- {
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() (already active) complete" ) ));
- User::Leave( KErrNotReady );
- }
-
- TBool advertise = iTransporter->AdvertisementStatus();
- if ( !advertise )
- {
- // Return silently here as CDunTransporter will notify later
- return;
- }
-
- TBool inUse = EFalse;
- TInt numOfChans = 0;
- TInt retTemp = StartServiceAdvertisement( inUse );
- if ( retTemp != KErrNone )
- {
- if ( inUse )
- {
- numOfChans = iTransporter->GetNumberOfAllocatedChannelsByUid(
- KDunBtPluginUid );
- if ( numOfChans == 0)
- {
- // No channels so parent can't reissue requests of this object
- // This is fatal case -> leave.
- // NOTE: To add full support for this case a poller (timer) is
- // needed that polls for free RFCOMM channel by given interval.
- User::Leave( retTemp );
- }
- // If in use and parent has channels then just fail silently.
- // Let this object to wait until parent finds new resources.
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() complete" ) ));
- return;
- }
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() (failed!) complete" ) ));
- User::Leave( retTemp );
- }
-
- // Not already active here so start listening
- // First open blank data socket
- retTemp = iEntity.iBTPort.Open( iSockServer );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() (ERROR) complete (%d)" ), retTemp));
- User::Leave( retTemp );
- }
- iStatus = KRequestPending;
- iListenSocket.Accept( iEntity.iBTPort, iStatus );
- SetActive();
- iListenState = EBtListenStateListening;
-
- FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Stops listening
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtListen::Stop()
- {
- FTRACE(FPrint( _L( "CDunBtListen::Stop()") ));
- if ( iListenState != EBtListenStateListening )
- {
- FTRACE(FPrint( _L("CDunBtListen::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iListenSocket.CancelAccept();
- Cancel();
- iListenState = EBtListenStateIdle;
- FTRACE(FPrint( _L( "CDunBtListen::Stop() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunBtListen::CDunBtListen
-// ---------------------------------------------------------------------------
-//
-CDunBtListen::CDunBtListen( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- CDunTransporter* aTransporter,
- TBtPortEntity& aEntity ) :
- CActive( EPriorityStandard ),
- iServer( aServer ),
- iParent( aParent ),
- iTransporter( aTransporter ),
- iEntity( aEntity )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunBtListen::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::ConstructL()
- {
- FTRACE(FPrint(_L("CDunBtListen::ConstructL()")));
- if ( !iServer || !iParent || !iTransporter )
- {
- User::Leave( KErrGeneral );
- }
-
- CBTEngDiscovery* discovery = CBTEngDiscovery::NewLC();
- FTRACE(FPrint(_L("CDunBtListen::ConstructL: iSockServer.Connect")));
- User::LeaveIfError( iSockServer.Connect() );
-
- // Set advertisement monitor
- iTransporter->SetAdvertisementMonitorL( KDunBtPluginUid, this );
-
- // Then we are ready to start listening and accepting incoming connection
- // requests.
- CleanupStack::Pop( discovery );
- iDiscovery = discovery;
- CActiveScheduler::Add( this );
- FTRACE(FPrint(_L("CDunBtListen::ConstructL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::Initialize()
- {
- // Don't initialize iServer here (it is set through NewL)
- // Don't initialize iParent here (it is set through NewL)
- // Don't initialize iTransporter here (it is set through NewL)
- // Don't initialize iEntity here (it is set through NewL)
- iListenState = EBtListenStateIdle;
- iDiscovery = NULL;
- iChannelNum = 0;
- iSDPHandleDun = 0;
- }
-
-// ---------------------------------------------------------------------------
-// Starts dialup service advertisement
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtListen::StartServiceAdvertisement( TBool& aInUse )
- {
- FTRACE(FPrint( _L( "CDunBtListen::StartServiceAdvertisement()" ) ));
-
- TInt retTemp = ReserveLocalChannel( iSockServer,
- iListenSocket,
- iChannelNum,
- aInUse );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtListen::StartServiceAdvertisement() (ERROR) complete" ) ));
- return retTemp;
- }
-
- // Now RFCOMM channel number of the next data socket must be the same as
- // the current listener's RFCOMM channel number. Set that now.
- iEntity.iChannelNum = iChannelNum;
-
- // Register SDP record
- iSDPHandleDun = 0;
- retTemp = iDiscovery->RegisterSdpRecord( KDialUpNetworkingUUID,
- iChannelNum,
- iSDPHandleDun );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtListen::StartServiceAdvertisement() (failed!) complete (%d)" ), retTemp));
- return retTemp;
- }
- FTRACE(FPrint( _L( "CDunBtListen::StartServiceAdvertisement() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops dialup service advertisement
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtListen::StopServiceAdvertisement()
- {
- FTRACE(FPrint( _L( "CDunBtListen::StopServiceAdvertisement()" ) ));
- if ( !iDiscovery )
- {
- FTRACE(FPrint( _L( "CDunBtListen::StopServiceAdvertisement() (iDiscovery) not initialized!" ) ));
- return KErrGeneral;
- }
- if ( iSDPHandleDun != 0 )
- {
- TInt retTemp = iDiscovery->DeleteSdpRecord( iSDPHandleDun );
- FTRACE(FPrint( _L( "CDunBtListen::StopServiceAdvertisement() record closed (%d)" ), retTemp ));
- iSDPHandleDun = 0;
- }
- if ( iListenSocket.SubSessionHandle() )
- {
- iListenSocket.Close();
- }
- FTRACE(FPrint( _L( "CDunBtListen::StopServiceAdvertisement() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Method which reserves local RFCOMM channel (from possible channels 1-30)
-// and returns it to client.
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtListen::ReserveLocalChannel( RSocketServ& aSocketServ,
- RSocket& aListenSocket,
- TUint& aChannelNum,
- TBool& aInUse )
- {
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel()")));
- aInUse = EFalse;
- if ( aListenSocket.SubSessionHandle() )
- {
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() (open socket!) complete")));
- return KErrArgument;
- }
- TInt retTemp;
- TProtocolDesc pInfo;
- retTemp = aSocketServ.FindProtocol( TProtocolName(KRFCOMMDesC), pInfo );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() (FindProtocol failed) complete (%d)"), retTemp));
- return retTemp;
- }
- retTemp = aListenSocket.Open( aSocketServ,
- pInfo.iAddrFamily,
- pInfo.iSockType,
- pInfo.iProtocol );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() (Open failed) complete (%d)"), retTemp));
- return retTemp;
- }
- TRfcommSockAddr addr;
- TBTServiceSecurity sec;
- sec.SetAuthentication( ETrue );
- sec.SetAuthorisation( ETrue );
- sec.SetEncryption( ETrue );
- sec.SetPasskeyMinLength( 0 );
- addr.SetSecurity( sec );
- addr.SetPort( KRfcommPassiveAutoBind );
- // When fix from Apple, replace the following with
- // "retTemp = aListenSocket.Bind( addr );"
- retTemp = DoExtendedBind( aListenSocket, addr );
- if ( retTemp != KErrNone )
- {
- aListenSocket.Close();
- aInUse = ETrue;
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() Bind() complete (%d)"), retTemp));
- return KErrInUse;
- }
- aChannelNum = aListenSocket.LocalPort();
-
- // We try to set the Telephony and Networking bits in our service class. If this fails we
- // ignore it, as it's better to carry on without it than to fail to start listening.
- aListenSocket.SetOpt(KBTRegisterCodService, KSolBtRFCOMM, KCoDDunServiceClass);
-
- retTemp = aListenSocket.Listen( KListenQueSize );
- if ( retTemp != KErrNone )
- {
- aListenSocket.Close();
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() Listen() complete (%d)"), retTemp));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunBtListen::ReserveLocalChannel() complete (%d)"), aChannelNum));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Tries to bind to a fixed port and if that fails with KRfcommPassiveAutoBind.
-// This is for spec breaking solutions like the OSX Leopard.
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtListen::DoExtendedBind( RSocket& aListenSocket,
- TRfcommSockAddr& aSockAddr )
- {
- FTRACE(FPrint(_L("CDunBtListen::DoExtendedBind()")));
- if ( !aListenSocket.SubSessionHandle() )
- {
- FTRACE(FPrint(_L("CDunBtListen::DoExtendedBind() (closed socket!) complete")));
- return KErrGeneral;
- }
- TRfcommSockAddr fixedAddr = aSockAddr;
- fixedAddr.SetPort( KDunFixedChannel );
- TInt retTemp = aListenSocket.Bind( fixedAddr );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtListen::DoExtendedBind() complete")));
- return KErrNone;
- }
- TInt retVal = aListenSocket.Bind( aSockAddr );
- FTRACE(FPrint(_L("CDunBtListen::DoExtendedBind() complete")));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Called when a service is requested via BT.
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::RunL()
- {
- FTRACE(FPrint( _L( "CDunBtListen::RunL()" ) ));
- iListenState = EBtListenStateIdle;
-
- StopServiceAdvertisement();
-
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtListen::RunL() (ERROR) complete (%d)" ), retTemp));
- iServer->NotifyPluginCloseRequest( KDunBtPluginUid, ETrue );
- return;
- }
- // Notify new connection
- TBool noFreeChans = EFalse;
- retTemp = iParent->NotifyChannelAllocate( noFreeChans );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtListen::RunL() channel allocation failed! (%d)" ), retTemp));
- // Other error than no free channels, close plugin now
- if ( !noFreeChans )
- {
- iServer->NotifyPluginCloseRequest( KDunBtPluginUid, ETrue );
- }
- return;
- }
-
- // Don't restart listening here. Request is issued via
- // NotifyAdvertisementStart()
-
- FTRACE(FPrint( _L( "CDunBtListen::RunL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Cancel current activity.
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::DoCancel()
- {
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServAdvMon.
-// Gets called when advertisement status changes to start.
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::NotifyAdvertisementStart( TBool aCreation )
- {
- FTRACE(FPrint( _L( "CDunBtListen::NotifyAdvertisementStart()" ) ));
- // Remove the "if" below when fix comes from Apple
- if ( !aCreation )
- {
- TRAP_IGNORE( IssueRequestL() );
- }
- FTRACE(FPrint( _L( "CDunBtListen::NotifyAdvertisementStart() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServAdvMon.
-// Gets called when advertisement status changes to end.
-// ---------------------------------------------------------------------------
-//
-void CDunBtListen::NotifyAdvertisementEnd()
- {
- FTRACE(FPrint( _L( "CDunBtListen::NotifyAdvertisementEnd()" ) ));
- Stop();
- StopServiceAdvertisement();
- FTRACE(FPrint( _L( "CDunBtListen::NotifyAdvertisementEnd() complete" ) ));
- }
--- a/localconnectivityservice/dun/plugins/src/bt/DunBtPlugin.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,582 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Bluetooth plugin
-*
-*/
-
-
-#include <bt_sock.h>
-#include <c32comm.h>
-#include "DunPlugin.h"
-#include "DunBtListen.h"
-#include "DunBtPlugin.h"
-#include "DunDebug.h"
-#include "DunTransporter.h"
-
-_LIT( KBtChannelName, "DUNBT::" );
-
-const TInt KCharactersInTInt = 10; // For "2147483648"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CDunBtPlugin::CDunBtPlugin()
-// ---------------------------------------------------------------------------
-//
-CDunBtPlugin::CDunBtPlugin() :
- iServer( NULL ),
- iBTListen( NULL ),
- iTransporter( NULL )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunBtPlugin::~CDunBtPlugin()
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::~CDunBtPlugin()" ) ));
- Uninitialize();
- FTRACE(FPrint( _L( "CDunBtPlugin::~CDunBtPlugin() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// State of this plugin
-// ---------------------------------------------------------------------------
-//
-TDunPluginState CDunBtPlugin::PluginState()
- {
- return iServer->GetPluginStateByUid( KDunBtPluginUid );
- }
-
-// ---------------------------------------------------------------------------
-// Constructs a listener object for this plugin
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::ConstructListenerL()
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ConstructListenerL()")));
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ConstructListenerL() (not ready) complete")));
- User::Leave( KErrNotReady );
- }
- ReportStateChangeUp( EDunStateTryListen );
- if ( iBTListen )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ConstructListenerL() (already exists) complete")));
- User::Leave( KErrAlreadyExists );
- }
- CDunBtListen* listen = CDunBtListen::NewL( iServer,
- this,
- iTransporter,
- iEntity );
- CleanupStack::PushL( listen );
- listen->IssueRequestL();
- CleanupStack::Pop( listen );
- iBTListen = listen;
- ReportStateChangeUp( EDunStateListening );
- FTRACE(FPrint(_L("CDunBtPlugin::ConstructListenerL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one more than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::ReportStateChangeUp( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeUp()")));
- TInt retTemp = iServer->NotifyPluginStateChangeUp( aPluginState,
- KDunBtPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeUp() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeUp() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one less than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::ReportStateChangeDown( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeDown()")));
- TInt retTemp = iServer->NotifyPluginStateChangeDown( aPluginState,
- KDunBtPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeDown() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunBtPlugin::ReportStateChangeDown() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Allocates a free channel
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::AllocateChannelL( TBool& aNoFreeChans,
- TBtCleanupInfo& aCleanupInfo )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL()")));
- // iDataSocket has new data socket information so copy it to iBTPorts
- TBtPortEntity* foundEntity = NULL;
- TInt foundIndex = GetFirstFreePort( foundEntity );
- if ( !foundEntity ) // free not found so add new
- {
- TBtPortEntity newEntity;
- iBTPorts.AppendL( newEntity );
- aCleanupInfo.iNewEntity = ETrue;
- aCleanupInfo.iEntityIndex = iBTPorts.Count() - 1;
- foundEntity = &iBTPorts[ aCleanupInfo.iEntityIndex ];
- }
- else // free found so change array
- {
- aCleanupInfo.iNewEntity = EFalse;
- aCleanupInfo.iEntityIndex = foundIndex;
- foundEntity = &iBTPorts[ foundIndex ];
- }
- foundEntity->iChannelNum = iEntity.iChannelNum;
- foundEntity->iBTPort = iEntity.iBTPort;
- RSocket* socket = &foundEntity->iBTPort;
- HBufC8* channelName = HBufC8::NewMaxLC( KBtChannelName().Length() +
- KCharactersInTInt );
- TPtr8 channelNamePtr = channelName->Des();
- channelNamePtr.Copy( KBtChannelName );
- channelNamePtr.AppendNum( iEntity.iChannelNum );
- iTransporter->AllocateChannelL( socket,
- KDunBtPluginUid,
- channelNamePtr,
- EFalse,
- aNoFreeChans );
- iTransporter->AddConnMonCallbackL( socket,
- this,
- EDunReaderUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( socket,
- this,
- EDunWriterUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( socket,
- this,
- EDunReaderDownstream,
- ETrue );
- iTransporter->AddConnMonCallbackL( socket,
- this,
- EDunWriterDownstream,
- EFalse );
- iTransporter->IssueTransferRequestsL( socket );
- CleanupStack::PopAndDestroy( channelName );
- FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Frees an existing channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::FreeChannels()
- {
- FTRACE(FPrint(_L("CDunBtPlugin::FreeChannels()")));
- if ( PluginState() != EDunStateTryUninitialize )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::FreeChannels() (not ready) complete")));
- return KErrNotReady;
- }
- TInt i;
- TInt count = iBTPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iBTPorts[i].iBTPort.SubSessionHandle() )
- {
- iTransporter->FreeChannel( &iBTPorts[i].iBTPort );
- iBTPorts[i].iBTPort.Close();
- // All channels freed and this is for Uninitialize() so don't touch
- // advertisement monitor here!
- }
- iBTPorts[i].iChannelNum = KErrNotFound;
- }
- iBTPorts.Close();
- FTRACE(FPrint(_L("CDunBtPlugin::FreeChannels() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Uninitializes this plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::Uninitialize()
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::Uninitialize()" ) ));
- ReportStateChangeDown( EDunStateTryUninitialize );
- // Free channels (ignore errors)
- FreeChannels();
- // Delete listening object (also advertisement monitor)
- delete iBTListen;
- iBTListen = NULL;
- // Set state back to loaded
- ReportStateChangeUp( EDunStateUninitialized );
- ReportStateChangeUp( EDunStateTryLoad );
- ReportStateChangeUp( EDunStateLoaded );
- FTRACE(FPrint( _L( "CDunBtPlugin::Uninitialize() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Gets port's index and entity by connection ID
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::GetPortByConnId( TConnId aConnId, TBtPortEntity*& aEntity )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::GetPortByConnId()")) );
- TInt i;
- TInt count = iBTPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( &iBTPorts[i].iBTPort == aConnId )
- {
- aEntity = &iBTPorts[i];
- FTRACE(FPrint( _L( "CDunBtPlugin::GetPortByConnId() complete")) );
- return i;
- }
- }
- aEntity = NULL;
- FTRACE(FPrint( _L( "CDunBtPlugin::GetPortByConnId() (not found) complete")) );
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Gets first free port's index and entity
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::GetFirstFreePort( TBtPortEntity*& aEntity )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::GetFirstFreePort()")) );
- TInt i;
- TInt count = iBTPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( !iBTPorts[i].iBTPort.SubSessionHandle() )
- {
- aEntity = &iBTPorts[i];
- FTRACE(FPrint( _L( "CDunBtPlugin::GetFirstFreePort() complete")) );
- return i;
- }
- }
- aEntity = NULL;
- FTRACE(FPrint( _L( "CDunBtPlugin::GetFirstFreePort() (not found) complete")) );
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Sets modem's MSC (Modem Status Command)
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::SetRFCOMMStatusCommand( TBtPortEntity& aEntity,
- TUint8 aSignal,
- TBool aSignalOn )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::SetRFCOMMStatusCommand()" ) ));
- // Get existing Modem Status Command (MSC)
- // Ref.: 3GPP TS 07.10 V7.2.0 (2002-03)
- // Table 6,7, (5.4.6.3.7)
- TUint8 modemStatus = 0;
- TPckgBuf<TUint8> pkg( modemStatus );
- TInt retTemp = aEntity.iBTPort.GetOpt( KRFCOMMLocalModemStatus,
- KSolBtRFCOMM,
- pkg );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::SetRFCOMMStatusCommand() (GetOpt failed!) complete" ) ));
- return retTemp;
- }
- modemStatus = pkg();
- FTRACE(FPrint( _L( "CDunBtPlugin::SetRFCOMMStatusCommand() signals are: 0x%02X" ), modemStatus));
- TBool changed = EFalse;
- TUint8 signal = modemStatus & aSignal;
- if ( aSignalOn )
- {
- if ( !signal )
- {
- modemStatus |= aSignal;
- changed = ETrue;
- }
- }
- else
- {
- if ( signal )
- {
- modemStatus &= ( ~aSignal );
- changed = ETrue;
- }
- }
- if ( changed )
- {
- pkg = modemStatus;
- retTemp = aEntity.iBTPort.SetOpt( KRFCOMMLocalModemStatus,
- KSolBtRFCOMM,
- pkg );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::SetRFCOMMStatusCommand() (SetOpt failed!) complete" ) ));
- return retTemp;
- }
- }
- FTRACE(FPrint( _L( "CDunBtPlugin::SetRFCOMMStatusCommand() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Manages advertiser for channel free operation
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::ManageAdvertiserFreeOperationL()
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ManageAdvertiserFreeOperationL()")));
- TInt numOfChans = iTransporter->NumberOfAllocatedChannels();
- // Remove of last CDunTransporter channel removes also the
- // advertisement monitor so set it now if necessary
- if ( numOfChans == 0 )
- {
- iTransporter->SetAdvertisementMonitorL( KDunBtPluginUid, iBTListen );
- }
- FTRACE(FPrint(_L("CDunBtPlugin::ManageAdvertiserFreeOperationL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Cleans partial created channel data based on TATExtCleanupInfo
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::CleanPartialChanneldata( TBtCleanupInfo& aCleanupInfo )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::CleanPartialChanneldata()")));
- RSocket* socket = &iBTPorts[aCleanupInfo.iEntityIndex].iBTPort;
- iTransporter->FreeChannel( socket );
- iBTPorts[aCleanupInfo.iEntityIndex].iChannelNum = KErrNotFound;
- socket->Close();
- if ( aCleanupInfo.iNewEntity )
- {
- iBTPorts.Remove( aCleanupInfo.iEntityIndex );
- }
- FTRACE(FPrint(_L("CDunBtPlugin::CleanPartialChanneldata() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// CDunBtPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::ConstructL()" ) ));
- if ( !aServer || !aTransporter )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ConstructL() not initialized!")));
- User::Leave( KErrBadHandle );
- }
- iServer = aServer;
- iTransporter = aTransporter;
- FTRACE(FPrint( _L( "CDunBtPlugin::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server changes a plugin's state
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::NotifyServerStateChange( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange()")));
- TInt retTemp;
- switch ( aPluginState )
- {
- case EDunStateTryListen:
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Change to listening mode
- TRAPD( retTrap, ConstructListenerL() );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() (ERROR) complete (%d)"), retTrap));
- return retTrap;
- }
- break;
- case EDunStateTryUninitialize:
- if ( PluginState() == EDunStateUninitialized )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Uninitialize
- retTemp = Uninitialize();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() (not ready) complete (%d)"), retTemp));
- return KErrNotReady;
- }
- break;
- default:
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() (unknown state) complete")));
- return KErrNotSupported;
- }
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyServerStateChange() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server needs to know the active connection
-// ---------------------------------------------------------------------------
-//
-TConnId CDunBtPlugin::ActiveConnection()
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ActiveConnection()")));
- if ( iBTPorts.Count() >= 1 )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::ActiveConnection() complete")));
- return &iBTPorts[0];
- }
- FTRACE(FPrint(_L("CDunBtPlugin::ActiveConnection() (not found) complete")));
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunListenCallback.
-// Gets called when new channel must be created
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::NotifyChannelAllocate( TBool& aNoFreeChans )
- {
- // Now state can be either EDunStateListening (no channels) or
- // EDunStateChanneled (one or more channels). Support both states
- TDunPluginState startState = PluginState();
- if ( startState!=EDunStateListening && startState!=EDunStateChanneled )
- {
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyChannelAllocate() (not ready) complete")));
- return KErrNotReady;
- }
- if ( startState == EDunStateListening )
- {
- ReportStateChangeUp( EDunStateTryChannel );
- }
- TBtCleanupInfo cleanupInfo;
- TRAPD( retTrap, AllocateChannelL(aNoFreeChans,cleanupInfo) );
- if ( retTrap != KErrNone )
- {
- CleanPartialChanneldata( cleanupInfo );
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyChannelAllocate() (trapped!) complete")));
- return retTrap;
- }
- if ( startState == EDunStateListening )
- {
- ReportStateChangeUp( EDunStateChanneled );
- }
- FTRACE(FPrint(_L("CDunBtPlugin::NotifyChannelAllocate() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunListenCallback.
-// Gets called when an existing channel must be freed
-// ---------------------------------------------------------------------------
-//
-TInt CDunBtPlugin::NotifyChannelFree()
- {
- // No implementation needed here
- return KErrNotSupported;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunConnMon.
-// Gets called when line status changes or when any type of error is detected
-// ---------------------------------------------------------------------------
-//
-void CDunBtPlugin::NotifyProgressChangeL( TConnId aConnId,
- TDunConnectionReason aConnReason )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL()" ) ));
- // Find matching failed ID
- TBtPortEntity* foundEntity = NULL;
- TInt foundIndex = GetPortByConnId( aConnId, foundEntity );
- if ( !foundEntity )
- {
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL() (not found) complete")) );
- User::Leave( KErrNotFound );
- }
- if ( aConnReason.iReasonType == EDunReasonTypeSignal )
- {
- if ( aConnReason.iContext != EDunMediaContextNetwork )
- {
- // Should never come here as other signals are for RComm
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL() (ERROR) complete")) );
- User::Leave( KErrGeneral );
- }
- // Signal change detected on network side -> process change
- if ( aConnReason.iSignalType == KSignalDCD )
- {
- SetRFCOMMStatusCommand( *foundEntity,
- KModemSignalDV,
- aConnReason.iSignalHigh );
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL() DV changed")) );
- }
- else if ( aConnReason.iSignalType == KSignalRNG )
- {
- SetRFCOMMStatusCommand( *foundEntity,
- KModemSignalIC,
- aConnReason.iSignalHigh );
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL() IC changed")) );
- }
- // Omit other signals
- }
- else
- {
- // All other cases are down indications from local media side
- if ( foundEntity->iBTPort.SubSessionHandle() )
- {
- iTransporter->FreeChannel( &foundEntity->iBTPort );
- // CDunTransporter will notify the listener about advertisement
- // status change after FreeChannel() so no need to do
- // IssueRequestL() for CDunBtListen here after this.
- foundEntity->iBTPort.Close();
- }
- ManageAdvertiserFreeOperationL();
- // Now resources are freed so command server to reopen possibly
- // existing queued plugins
- iServer->NotifyPluginReopenRequest();
- }
- FTRACE(FPrint( _L( "CDunBtPlugin::NotifyProgressChangeL() complete")) );
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLocalPluginL implements factory construction for
-// the class CDunBtPlugin.
-// The function is exported at ordinal 1.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MDunLocalMediaPlugin* NewLocalPluginL()
- {
- return new (ELeave) CDunBtPlugin;
- }
--- a/localconnectivityservice/dun/plugins/src/ir/DunIrPlugin.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN Infrared plugin
-*
-*/
-
-
-#include "DunIrPlugin.h"
-#include "DunUtils.h"
-#include "DunDebug.h"
-
-_LIT( KIrdaCsy, "IRCOMM" );
-_LIT( KIrdaCsy0, "IRCOMM::0" );
-_LIT( KIrChannelName, "DUNIR::0" );
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CDunIrPlugin::CDunIrPlugin
-// ---------------------------------------------------------------------------
-//
-CDunIrPlugin::CDunIrPlugin() :
- iServer( NULL ),
- iTransporter( NULL )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunIrPlugin::~CDunIrPlugin()
- {
- FTRACE(FPrint( _L( "CDunIrPlugin::~CDunIrPlugin()" ) ));
- Uninitialize();
- FTRACE(FPrint( _L( "CDunIrPlugin::~CDunIrPlugin() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Gets state of this plugin
-// ---------------------------------------------------------------------------
-//
-TDunPluginState CDunIrPlugin::PluginState()
- {
- return iServer->GetPluginStateByUid( KDunIrPluginUid );
- }
-
-// ---------------------------------------------------------------------------
-// Constructs a listener object for this plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::ConstructListener()
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructListenerL()")));
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructListenerL() (not ready) complete")));
- return KErrNotReady;
- }
- ReportStateChangeUp( EDunStateTryListen );
- TInt retTemp = InitPort();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructListenerL() (ERROR) complete")));
- return retTemp;
- }
- ReportStateChangeUp( EDunStateListening );
- ReportStateChangeUp( EDunStateTryChannel );
- TRAPD( retTrap, AllocateChannelL() );
- if ( retTrap != KErrNone )
- {
- iTransporter->FreeChannel( &iIrPort );
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructListenerL() (trapped!) complete")));
- return retTrap;
- }
- ReportStateChangeUp( EDunStateChanneled );
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructListenerL() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one more than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::ReportStateChangeUp( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeUp()")));
- TInt retTemp = iServer->NotifyPluginStateChangeUp( aPluginState,
- KDunIrPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeUp() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeUp() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one less than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::ReportStateChangeDown( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeDown()")));
- TInt retTemp = iServer->NotifyPluginStateChangeDown( aPluginState,
- KDunIrPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeDown() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunIrPlugin::ReportStateChangeDown() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Initializes one infrared port with role DCE
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::InitPort()
- {
- FTRACE(FPrint( _L( "CDunIrPlugin::InitPort()" ) ));
- TInt retTemp;
- retTemp = CDunUtils::ConnectCommsServer( iCommServer );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunIrPlugin::InitPort() (ERROR) complete" ) ));
- return retTemp;
- }
- retTemp = iCommServer.LoadCommModule( KIrdaCsy );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::InitPort() (load module) failed!") ));
- return retTemp;
- }
- if ( iIrPort.SubSessionHandle() )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::InitPort (already exists!) complete") ));
- return KErrAlreadyExists;
- }
- retTemp = iIrPort.Open( iCommServer,
- KIrdaCsy0,
- ECommExclusive,
- ECommRoleDCE );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::InitPort() (open) failed!") ));
- return retTemp;
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Allocates a channel
-// ---------------------------------------------------------------------------
-//
-void CDunIrPlugin::AllocateChannelL()
- {
- FTRACE(FPrint(_L("CDunIrPlugin::AllocateChannelL()")));
- HBufC8* channelName = HBufC8::NewMaxLC( KIrChannelName().Length() );
- TPtr8 channelNamePtr = channelName->Des();
- channelNamePtr.Copy( KIrChannelName );
- iTransporter->AllocateChannelL( &iIrPort,
- KDunIrPluginUid,
- channelNamePtr,
- ETrue );
- iTransporter->AddConnMonCallbackL( &iIrPort,
- this,
- EDunReaderUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &iIrPort,
- this,
- EDunWriterUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &iIrPort,
- this,
- EDunReaderDownstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &iIrPort,
- this,
- EDunWriterDownstream,
- EFalse );
- iTransporter->IssueTransferRequestsL( &iIrPort );
- CleanupStack::PopAndDestroy( channelName );
- FTRACE(FPrint(_L("CDunIrPlugin::AllocateChannelL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Uninitializes this plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::Uninitialize()
- {
- FTRACE(FPrint(_L("CDunIrPlugin::Uninitialize()" )));
- ReportStateChangeDown( EDunStateTryUninitialize );
- if ( iIrPort.SubSessionHandle() )
- {
- iTransporter->FreeChannel( &iIrPort );
- iIrPort.SetSignals( 0, KSignalDCEOutputs );
- iIrPort.Close();
- }
- if ( iCommServer.Handle() )
- {
- iCommServer.UnloadCommModule( KIrdaCsy );
- iCommServer.Close();
- }
- ReportStateChangeUp( EDunStateUninitialized );
- ReportStateChangeUp( EDunStateTryLoad );
- ReportStateChangeUp( EDunStateLoaded );
- FTRACE(FPrint(_L("CDunIrPlugin::Uninitialize() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// CDunIrPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunIrPlugin::ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructL()")));
- if ( !aServer || !aTransporter )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructL() not initialized!")));
- User::Leave( KErrGeneral );
- }
- iServer = aServer;
- iTransporter = aTransporter;
- FTRACE(FPrint(_L("CDunIrPlugin::ConstructL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server changes a plugin's state
-// ---------------------------------------------------------------------------
-//
-TInt CDunIrPlugin::NotifyServerStateChange( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange()")));
- TInt retTemp;
- switch ( aPluginState )
- {
- case EDunStateTryListen:
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Change to listening mode
- retTemp = ConstructListener();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() (ERROR) complete (%d)"), retTemp));
- return retTemp;
- }
- break;
- case EDunStateTryUninitialize:
- if ( PluginState() == EDunStateUninitialized )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Uninitialize
- retTemp = Uninitialize();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() (ERROR) complete (%d)"), retTemp));
- return retTemp;
- }
- break;
- default:
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() (unknown state) complete")));
- return KErrNotSupported;
- }
- FTRACE(FPrint(_L("CDunIrPlugin::NotifyServerStateChange() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server needs to know the active connection
-// ---------------------------------------------------------------------------
-//
-TConnId CDunIrPlugin::ActiveConnection()
- {
- FTRACE(FPrint(_L("CDunIrPlugin::ActiveConnection()")));
- FTRACE(FPrint(_L("CDunIrPlugin::ActiveConnection() (not found) complete")));
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunConnMon.
-// Gets called when line status changes or when any type of error is detected
-// ---------------------------------------------------------------------------
-//
-void CDunIrPlugin::NotifyProgressChangeL(
- TConnId aConnId,
- TDunConnectionReason /*aConnReason*/ )
- {
- FTRACE(FPrint( _L( "CDunIrPlugin::NotifyProgressChangeL()" ) ));
- RComm* irConn = static_cast<RComm*>( aConnId );
- if ( &iIrPort != irConn )
- {
- FTRACE(FPrint( _L( "CDunIrPlugin::NotifyProgressChangeL() (not found) complete")) );
- User::Leave( KErrNotFound );
- }
- // Now indications are down indications from local media side
- FTRACE(FPrint( _L( "CDunIrPlugin::NotifyProgressChangeL() restart plugin" ) ));
- iServer->NotifyPluginRestart( KDunIrPluginUid );
- FTRACE(FPrint( _L( "CDunIrPlugin::NotifyProgressChangeL() complete")) );
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLocalPluginL implements factory construction for
-// the class CDunIrPlugin.
-// The function is exported at ordinal 1.
-// Returns: Pointer: The new instance of CDunIrPlugin
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MDunLocalMediaPlugin* NewLocalPluginL()
- {
- return new (ELeave) CDunIrPlugin;
- }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB configuration accessor and listener
-*
-*/
-
-
-#include "DunUsbConfig.h"
-#include "DunDebug.h"
-
-const TUint KDunUsbSupportedConfigVersion = 1;
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunUsbConfig* CDunUsbConfig::NewL( MDunServerCallback* aServer,
- MDunUsbConfig* aCallback,
- TUint8 aProtocol )
- {
- CDunUsbConfig* self = new (ELeave) CDunUsbConfig( aServer,
- aCallback,
- aProtocol );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunUsbConfig::~CDunUsbConfig()
- {
- FTRACE(FPrint( _L("CDunUsbConfig::~CDunUsbConfig()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunUsbConfig::~CDunUsbConfig() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunUsbConfig::ResetData()
- {
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // NewL()
- iAcmProperty.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Compares initialized protocol number to configuration by index
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbConfig::GetConfigValidityByIndex( TInt aIndex, TBool& aValidity )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex()" )));
- if ( iConfigState != EUsbConfigStateIdle )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iConfigExist )
- {
- TInt retTemp = GetConfiguration( iConfig );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() (get failed) complete" )));
- return retTemp;
- }
- }
- if ( aIndex < 0 ||
- aIndex >= iConfig.iAcmCount ||
- aIndex >= TPublishedAcmConfigs::KAcmMaxFunctions )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() (not found) complete" )));
- return KErrNotFound;
- }
- if ( iConfig.iAcmConfig[aIndex].iProtocol == iProtocol )
- {
- aValidity = ETrue;
- }
- else
- {
- aValidity = EFalse;
- }
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfigValidityByIndex() complete (%d/%d)" ), aIndex, aValidity));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Starts listening for ACM configuration changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbConfig::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest()" )));
- if ( iConfigState != EUsbConfigStateIdle )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- iStatus = KRequestPending;
- iAcmProperty.Subscribe( iStatus );
- SetActive();
- iConfigState = EUsbConfigStateWaiting;
- FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops listening for ACM configuration changes
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbConfig::Stop()
- {
- FTRACE(FPrint( _L("CDunUsbConfig::Stop()" )));
- if ( iConfigState != EUsbConfigStateWaiting )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- iAcmProperty.Cancel();
- Cancel();
- iConfigState = EUsbConfigStateIdle;
- FTRACE(FPrint( _L("CDunUsbConfig::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunUsbConfig::CDunUsbConfig
-// ---------------------------------------------------------------------------
-//
-CDunUsbConfig::CDunUsbConfig( MDunServerCallback* aServer,
- MDunUsbConfig* aCallback,
- TUint8 aProtocol ) :
- CActive( EPriorityStandard ),
- iServer( aServer ),
- iCallback( aCallback ),
- iProtocol( aProtocol )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunUsbConfig::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunUsbConfig::ConstructL()
- {
- FTRACE(FPrint( _L("CDunUsbConfig::ConstructL()" )));
- if ( !iServer || !iCallback )
- {
- User::Leave( KErrGeneral );
- }
- User::LeaveIfError( iAcmProperty.Attach(KUidSystemCategory,KAcmKey) );
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunUsbConfig::ConstructL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunUsbConfig::Initialize()
- {
- // Don't initialize iCallback here (it is set through NewL)
- // Don't initialize iProtocol here (it is set through NewL)
- iConfigState = EUsbConfigStateIdle;
- iConfig.iAcmConfigVersion = 0;
- iConfig.iAcmCount = 0;
- iConfigExist = EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Gets current ACM configuration
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbConfig::GetConfiguration( TPublishedAcmConfigs& aConfig )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfiguration()" )));
- TPckgBuf<TPublishedAcmConfigs> configBuf;
- TInt retTemp = iAcmProperty.Get( configBuf );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfiguration() (ERROR) complete" )));
- return retTemp;
- }
- aConfig = configBuf();
- // Check that version is that which we currently support
- if ( aConfig.iAcmConfigVersion != KDunUsbSupportedConfigVersion )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfiguration() (not supported) complete" )));
- return KErrNotSupported;
- }
- // Check that count is within bounds
- if ( aConfig.iAcmCount > TPublishedAcmConfigs::KAcmMaxFunctions )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfiguration() (overflow) complete" )));
- return KErrOverflow;
- }
- iConfigExist = ETrue;
- FTRACE(FPrint( _L("CDunUsbConfig::GetConfiguration() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when ACM configuration changes
-// ---------------------------------------------------------------------------
-//
-void CDunUsbConfig::RunL()
- {
- FTRACE(FPrint( _L("CDunUsbConfig::RunL()" )));
- iConfigState = EUsbConfigStateIdle;
-
- TPublishedAcmConfigs newConfig;
- TInt retTemp = GetConfiguration( newConfig );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::RunL() (ERROR) complete (%d)" ), retTemp));
- iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue );
- return;
- }
- // Change that is same is not possible so check that first
- if ( newConfig.iAcmCount == iConfig.iAcmCount )
- {
- FTRACE(FPrint( _L("CDunUsbConfig::RunL() (no change) complete" )));
- iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue );
- return;
- }
-
- // Now we have the changed configuration so find out are there added or
- // removed USB ACMs
-
- TInt i;
- if ( newConfig.iAcmCount > iConfig.iAcmCount ) // addition
- {
- // Addition is always done to end of ACM queue by N entry addition
- // Scan through new array and report change if necessary
- for ( i=iConfig.iAcmCount; i<newConfig.iAcmCount; i++ )
- {
- if ( newConfig.iAcmConfig[i].iProtocol == iProtocol )
- {
- iCallback->NotifyConfigAddition( i );
- }
- }
- }
- else // removal ( newConfig.iAcmCount < iConfig.iAcmCount )
- {
- // Removal is always done to end of ACM queue by N entry removal
- // Scan through old array and report change if necessary
- for ( i=newConfig.iAcmCount; i<iConfig.iAcmCount; i++ )
- {
- if ( iConfig.iAcmConfig[i].iProtocol == iProtocol )
- {
- iCallback->NotifyConfigRemoval( i );
- }
- }
- }
-
- // Update config and restart listening
- iConfig = newConfig;
- IssueRequest();
-
- FTRACE(FPrint( _L("CDunUsbConfig::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunUsbConfig::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB plugin's listener
-*
-*/
-
-
-#include <e32std.h>
-#include "DunUtils.h"
-#include "DunUsbListen.h"
-#include "DunDebug.h"
-
-const TUint KDunUsbDeviceStateMask = 0x00ff;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunUsbListen* CDunUsbListen::NewL( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- RUsb& aUsbServer )
- {
- CDunUsbListen* self = new (ELeave) CDunUsbListen( aServer,
- aParent,
- aUsbServer );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunUsbListen::~CDunUsbListen()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::~CDunUsbListen()" ) ));
- ResetData();
- FTRACE(FPrint( _L( "CDunUsbListen::~CDunUsbListen() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunUsbListen::ResetData()
- {
- // APIs affecting this:
- // IssueRequestL()
- Stop();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// IssueRequest to USB server for device state change notifications
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbListen::IssueRequestL()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::IssueRequestL()" )));
-
- if ( iUsbServer.Handle() == KNullHandle )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::IssueRequestL() (iUsbServer) complete" ) ));
- User::Leave( KErrGeneral );
- }
-
- TUsbDeviceState usbDeviceState;
- User::LeaveIfError( iUsbServer.GetDeviceState(usbDeviceState) );
- FTRACE(FPrint( _L( "CDunUsbListen::IssueRequestL() Usb device state = %X" ), usbDeviceState));
- if ( iDeviceState == EUsbDeviceStateUndefined )
- {
- iDeviceState = usbDeviceState;
- }
-
- // USB device state now set; if configured already, notify parent
- // If not yet configured, start listening
-
- if ( usbDeviceState == EUsbDeviceStateConfigured )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::IssueRequestL() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
-
- Activate();
-
- FTRACE(FPrint( _L( "CDunUsbListen::IssueRequestL() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops listening
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbListen::Stop()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::Stop()" ) ));
- if ( iListenState != EUsbListenStateListening )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::Stop() (not ready) complete" ) ));
- return KErrNotReady;
- }
- iUsbServer.DeviceStateNotificationCancel();
- Cancel();
- iListenState = EUsbListenStateIdle;
- iDeviceState = EUsbDeviceStateUndefined;
- iDeviceStatePrev = EUsbDeviceStateUndefined;
- FTRACE(FPrint( _L( "CDunUsbListen::Stop() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunUsbListen::CDunUsbListen
-// ---------------------------------------------------------------------------
-//
-CDunUsbListen::CDunUsbListen( MDunServerCallback* aServer,
- MDunListenCallback* aParent,
- RUsb& aUsbServer ) :
- CActive( EPriorityStandard ),
- iServer( aServer ),
- iParent( aParent ),
- iUsbServer( aUsbServer )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunUsbListen::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunUsbListen::ConstructL()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::ConstructL()" ) ));
- if ( !iServer || !iParent )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L( "CDunUsbListen::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunUsbListen::Initialize()
- {
- // Don't initialize iServer here (it is set through NewL)
- // Don't initialize iParent here (it is set through NewL)
- // Don't initialize iUsbServer here (it is set through NewL)
- iDeviceState = EUsbDeviceStateUndefined;
- iDeviceStatePrev = EUsbDeviceStateUndefined;
- }
-
-// ---------------------------------------------------------------------------
-// Activates listening request
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbListen::Activate()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::Activate()" ) ));
-
- if ( iListenState != EUsbListenStateIdle )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::Activate() (not ready) complete" ) ));
- return KErrNotReady;
- }
- iDeviceStatePrev = iDeviceState;
- iStatus = KRequestPending;
- iUsbServer.DeviceStateNotification( KDunUsbDeviceStateMask,
- iDeviceState,
- iStatus );
- SetActive();
- iListenState = EUsbListenStateListening;
- FTRACE(FPrint( _L( "CDunUsbListen::Activate() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Called when read or write operation is ready.
-// ---------------------------------------------------------------------------
-//
-void CDunUsbListen::RunL()
- {
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() iStatus=%d"), iStatus.Int() ));
- iListenState = EUsbListenStateIdle;
-
- if ( iStatus.Int() != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() (ERROR) complete" )));
- iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue );
- return;
- }
-
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() Usb device state =%X, Issue request" ), iDeviceState));
-
- TDunPluginState parentState = iServer->GetPluginStateByUid( KDunUsbPluginUid );
-
- TInt retTemp = KErrNone;
- if ( iDeviceState == EUsbDeviceStateConfigured &&
- iDeviceStatePrev != EUsbDeviceStateConfigured &&
- parentState != EDunStateChanneled )
- {
- // USB has been connected&configured and we are in PC Suite mode
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() DeviceState is configured -> open connection" ) ));
- TBool noFreeChans = EFalse;
- // noFreeChans will be omitted (not needed to set to RComm)
- retTemp = iParent->NotifyChannelAllocate( noFreeChans );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() channel allocation failed!" ) ));
- iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue );
- return;
- }
- }
- else if ( iDeviceState < EUsbDeviceStateConfigured &&
- iDeviceStatePrev >= EUsbDeviceStateConfigured &&
- parentState == EDunStateChanneled )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() DeviceState is not configured -> close connection" ) ));
- retTemp = iParent->NotifyChannelFree();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() channel free failed!" ) ));
- iServer->NotifyPluginCloseRequest( KDunUsbPluginUid, ETrue );
- return;
- }
- }
-
- // Start listening again
- Activate();
-
- FTRACE(FPrint( _L( "CDunUsbListen::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Cancel current activity.
-// ---------------------------------------------------------------------------
-//
-void CDunUsbListen::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbPlugin.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,781 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN USB plugin
-*
-*/
-
-
-#include <c32comm.h>
-#include <d32usbc.h>
-#include "DunPlugin.h"
-#include "DunUtils.h"
-#include "DunUsbPlugin.h"
-#include "DunDebug.h"
-
-_LIT( KUsbCsyName, "ECACM" );
-_LIT( KUsbPortName, "ACM" );
-_LIT( KUsbPortPort, "::" );
-_LIT( KUsbLddName, "EUSBC" );
-_LIT( KUsbChannelName, "DUNUSB::" );
-
-const TInt KCharactersInTInt = 10; // For "2147483648"
-const TUint8 KDefaultAcmProtocolNum = 0x01; // Hayes compatible modem
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CDunUsbPlugin::CDunUsbPlugin
-// ---------------------------------------------------------------------------
-//
-CDunUsbPlugin::CDunUsbPlugin() :
- iServer( NULL ),
- iUsbListen( NULL ),
- iUsbConfig( NULL ),
- iTransporter( NULL )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunUsbPlugin::~CDunUsbPlugin()
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::~CDunUsbPlugin()" ) ));
- Uninitialize();
- FTRACE(FPrint( _L( "CDunUsbPlugin::~CDunUsbPlugin() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// State of this plugin
-// ---------------------------------------------------------------------------
-//
-TDunPluginState CDunUsbPlugin::PluginState()
- {
- return iServer->GetPluginStateByUid( KDunUsbPluginUid );
- }
-
-// ---------------------------------------------------------------------------
-// Constructs a listener object for this plugin
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::ConstructListenerL()
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ConstructListenerL()")));
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ConstructListenerL() (not ready) complete")));
- User::Leave( KErrNotReady );
- }
- ReportStateChangeUp( EDunStateTryListen );
- if ( iUsbListen )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ConstructListenerL() (already exists) complete")));
- User::Leave( KErrAlreadyExists );
- }
- InitUsbL();
- CDunUsbListen* listen = CDunUsbListen::NewL( iServer, this, iUsbServer );
- CleanupStack::PushL( listen );
- TInt retTemp = listen->IssueRequestL();
- CleanupStack::Pop( listen );
- iUsbListen = listen;
- // Here return value of KErrAlreadyExists means the device is already
- // configured
- // In this case we have to switch directly to channeled mode
- ReportStateChangeUp( EDunStateListening );
- if ( retTemp == KErrAlreadyExists )
- {
- TBool noFreeChans = EFalse;
- // noFreeChans will be omitted (not needed to set to RComm)
- NotifyChannelAllocate( noFreeChans ); // Create channel and change state
- }
- FTRACE(FPrint(_L("CDunUsbPlugin::ConstructListenerL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes USB by loading LDD
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::InitUsbL()
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitUsbL()") ));
- // Load Logical device driver for USB
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitUsbL() LoadLogicalDevice") ));
- TInt retTemp = User::LoadLogicalDevice( KUsbLddName );
- if ( retTemp!=KErrAlreadyExists && retTemp!=KErrNone )
- {
- User::Leave( retTemp );
- }
- // Connect to the USB Manager server
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitUsbL() Connect()") ));
- User::LeaveIfError( iUsbServer.Connect() );
- // Create USB configuration accessor and listener
- iUsbConfig = CDunUsbConfig::NewL( iServer, this, KDefaultAcmProtocolNum );
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitUsbL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes all usable USB ports for DUN
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::InitPorts()
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitPorts() (num=%d)" ), iUsbPorts.Count()));
- TInt i;
- TInt retTemp = CreateAllPorts();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitPorts() (ERROR) complete" )));
- return retTemp;
- }
- TInt count = iUsbPorts.Count();
- for ( i=0; i<count; i++ )
- {
- retTemp = InitOnePort( &iUsbPorts[i] );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitPorts() (not ready) complete" )));
- return KErrGeneral;
- }
- }
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitPorts() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Creates empty usable USB ports that can be used by DUN
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::CreateAllPorts()
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::CreateAllPorts()" ) ));
- // Connect to comms server
- TInt retTemp = CDunUtils::ConnectCommsServer( iCommServer );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::CreateAllPorts() (ERROR) complete" )));
- return retTemp;
- }
- // Load communications module
- retTemp = iCommServer.LoadCommModule( KUsbCsyName );
- if ( retTemp!=KErrNone && retTemp!=KErrAlreadyExists )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::CreateAllPorts() (LoadCommModule failed) complete" ) ));
- return retTemp;
- }
- // Stop waiter now (just to be sure) before explicitly fetching port data
- iUsbConfig->Stop();
- // Find out what ports can be supported and append them to array
- TBool validConfig;
- TUsbPortEntity entity;
- for ( TInt i=0;; i++ )
- {
- retTemp = iUsbConfig->GetConfigValidityByIndex( i, validConfig );
- if ( retTemp != KErrNone )
- {
- break;
- }
- if ( !validConfig )
- {
- continue;
- }
- // Valid config found, append it to array
- entity.iPortNum = i;
- retTemp = iUsbPorts.Append( entity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::CreateAllPorts() (append failed!) complete" ) ));
- return retTemp;
- }
- }
- FTRACE(FPrint( _L( "CDunUsbPlugin::CreateAllPorts() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Initializes one USB port for DUN
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::InitOnePort( TUsbPortEntity* aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitOnePort()" )));
- if ( !aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitOnePort() (not initialized!) complete" )));
- return KErrGeneral;
- }
- TInt retTemp;
- TName portName;
- portName.Copy( KUsbPortName );
- portName.Append( KUsbPortPort );
- portName.AppendNum( aEntity->iPortNum );
- retTemp = aEntity->iUsbPort.Open( iCommServer,
- portName,
- ECommExclusive,
- ECommRoleDCE );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitOnePort() Open failed (%d)" ), retTemp));
- return retTemp;
- }
- TRAPD( retTrap, SetChannelL(aEntity) );
- if ( retTrap != KErrNone )
- {
- iTransporter->FreeChannel( &aEntity->iUsbPort );
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitOnePort() (trapped!) complete" )));
- return retTrap;
- }
- FTRACE(FPrint( _L( "CDunUsbPlugin::InitOnePort() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets channel for one USB port
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::SetChannelL( TUsbPortEntity* aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::SetChannelL()" )));
- if ( !aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::SetChannelL() (not initialized!) complete" )));
- User::Leave( KErrGeneral );
- }
- HBufC8* channelName = HBufC8::NewMaxLC( KUsbChannelName().Length() +
- KCharactersInTInt );
- TPtr8 channelNamePtr = channelName->Des();
- channelNamePtr.Copy( KUsbChannelName );
- channelNamePtr.AppendNum( aEntity->iPortNum );
- iTransporter->AllocateChannelL( &aEntity->iUsbPort,
- KDunUsbPluginUid,
- channelNamePtr,
- ETrue,
- this );
- AddSkippedErrorL( KErrUsbInterfaceChange, &aEntity->iUsbPort );
- iTransporter->AddConnMonCallbackL( &aEntity->iUsbPort,
- this,
- EDunReaderUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &aEntity->iUsbPort,
- this,
- EDunWriterUpstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &aEntity->iUsbPort,
- this,
- EDunReaderDownstream,
- EFalse );
- iTransporter->AddConnMonCallbackL( &aEntity->iUsbPort,
- this,
- EDunWriterDownstream,
- EFalse );
- iTransporter->IssueTransferRequestsL( &aEntity->iUsbPort );
- CleanupStack::PopAndDestroy( channelName );
- FTRACE(FPrint( _L( "CDunUsbPlugin::SetChannelL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Adds skipped error code to Transporter
-// The skipped error is added to local media's read and write operations
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::AddSkippedErrorL( TInt aError, RComm* aComm )
- {
- iTransporter->AddSkippedErrorL( aError, aComm, EDunReaderUpstream );
- iTransporter->AddSkippedErrorL( aError, aComm, EDunWriterDownstream );
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one more than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::ReportStateChangeUp( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeUp()")));
- TInt retTemp = iServer->NotifyPluginStateChangeUp( aPluginState,
- KDunUsbPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeUp() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeUp() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets new state
-// New state must be one less than the old state
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::ReportStateChangeDown( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeDown()")));
- TInt retTemp = iServer->NotifyPluginStateChangeDown( aPluginState,
- KDunUsbPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeDown() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunUsbPlugin::ReportStateChangeDown() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Frees existing channels
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::FreeChannels()
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::FreeChannels()")));
- if ( PluginState() != EDunStateTryUninitialize )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::FreeChannels() (not ready) complete" ) ));
- return KErrNotReady;
- }
- TInt i;
- TInt count = iUsbPorts.Count();
- for ( i=0; i<count; i++ )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::FreeChannels() i=%d" ), i));
- if ( iUsbPorts[i].iUsbPort.SubSessionHandle() )
- {
- iTransporter->FreeChannel( &iUsbPorts[i].iUsbPort );
- iUsbPorts[i].iUsbPort.SetSignals( 0, KSignalDCEOutputs );
- iUsbPorts[i].iUsbPort.Close();
- }
- }
- iUsbPorts.Close();
- if ( iCommServer.Handle() != KNullHandle )
- {
- iCommServer.UnloadCommModule( KUsbCsyName );
- iCommServer.Close();
- }
- FTRACE(FPrint(_L("CDunUsbPlugin::FreeChannels() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Uninitializes this plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::Uninitialize()
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::Uninitialize()" ) ));
- ReportStateChangeDown( EDunStateTryUninitialize );
- // Free channel(s), ignore errors
- FreeChannels();
- delete iUsbListen; // delete before iUsbServer close
- iUsbListen = NULL;
- delete iUsbConfig;
- iUsbConfig = NULL;
- if ( iUsbServer.Handle() != KNullHandle )
- {
- iUsbServer.Close();
- }
- User::FreeLogicalDevice( KUsbLddName );
- ReportStateChangeUp( EDunStateUninitialized );
- ReportStateChangeUp( EDunStateTryLoad );
- ReportStateChangeUp( EDunStateLoaded );
- FTRACE(FPrint( _L( "CDunUsbPlugin::Uninitialize() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Gets port's index and entity by connection ID
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::GetEntityByConnId( TConnId aConnId,
- TUsbPortEntity*& aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByConnId()")) );
- TInt i;
- TInt count = iUsbPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( &iUsbPorts[i].iUsbPort == aConnId )
- {
- aEntity = &iUsbPorts[i];
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByConnId() complete")) );
- return i;
- }
- }
- aEntity = NULL;
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByConnId() (not found) complete")) );
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Gets port's entity by port number
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::GetEntityByPortNumber( TInt aPortNum,
- TUsbPortEntity*& aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByPortNumber()")) );
- TInt i;
- TInt count = iUsbPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iUsbPorts[i].iPortNum == aPortNum )
- {
- aEntity = &iUsbPorts[i];
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByPortNumber() complete")) );
- return i;
- }
- }
- aEntity = NULL;
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetEntityByPortNumber() (not found) complete")) );
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Gets first free port's index and entity
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::GetFirstFreeEntity( TUsbPortEntity*& aEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetFirstFreeEntity()")) );
- TInt i;
- TInt count = iUsbPorts.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iUsbPorts[i].iPortNum == KErrNotFound &&
- !iUsbPorts[i].iUsbPort.SubSessionHandle() )
- {
- aEntity = &iUsbPorts[i];
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetFirstFreeEntity() complete")) );
- return i;
- }
- }
- aEntity = NULL;
- FTRACE(FPrint( _L( "CDunUsbPlugin::GetFirstFreeEntity() (not found) complete")) );
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// CDunUsbPlugin::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::ConstructL()" ) ));
- if ( !aServer || !aTransporter )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::ConstructL() not initialized!" ) ));
- User::Leave( KErrGeneral );
- }
- iServer = aServer;
- iTransporter = aTransporter;
- FTRACE(FPrint( _L( "CDunUsbPlugin::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server changes a plugin's state
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyServerStateChange( TDunPluginState aPluginState )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange()")));
- TInt retTemp;
- switch ( aPluginState )
- {
- case EDunStateTryListen:
- if ( PluginState() != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Change to listening mode
- TRAPD( retTrap, ConstructListenerL() );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() (ERROR) complete (%d)"), retTrap));
- return retTrap;
- }
- break;
- case EDunStateTryUninitialize:
- if ( PluginState() == EDunStateUninitialized )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() (not ready) complete")));
- return KErrNotReady;
- }
- // Uninitialize
- retTemp = Uninitialize();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() (not ready) complete (%d)"), retTemp));
- return retTemp;
- }
- break;
- default:
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() (unknown state) complete")));
- return KErrNotSupported;
- }
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyServerStateChange() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunLocalMediaPlugin.
-// Gets called when server needs to know the active connection
-// ---------------------------------------------------------------------------
-//
-TConnId CDunUsbPlugin::ActiveConnection()
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::ActiveConnection()")));
- FTRACE(FPrint(_L("CDunUsbPlugin::ActiveConnection() (not found) complete")));
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunListenCallback.
-// Gets called when new channel must be created
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyChannelAllocate( TBool& /*aNoFreeChans*/ )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelAllocate()")));
- if ( PluginState() != EDunStateListening )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelAllocate() (not ready) complete")));
- return KErrNotReady;
- }
- ReportStateChangeUp( EDunStateTryChannel );
- TInt retTemp = InitPorts();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelAllocate() (ERROR) complete")));
- return retTemp;
- }
- // Channels allocated so start to wait for possible port config change
- retTemp = iUsbConfig->IssueRequest();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelAllocate() (ERROR) complete")));
- return retTemp;
- }
- iShutdown = EFalse;
- ReportStateChangeUp( EDunStateChanneled );
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelAllocate() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunListenCallback.
-// Gets called when an existing channel must be freed
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyChannelFree()
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelFree()")));
- if ( PluginState() != EDunStateChanneled )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelFree() (not ready) complete")));
- return KErrNotReady;
- }
- // Cable removed or PC sleep, hibernate or reset.
- // Just remove channels.
- ReportStateChangeDown( EDunStateTryUninitialize );
- TInt retTemp = FreeChannels();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelFree() (ERROR) complete")));
- return retTemp;
- }
- ReportStateChangeUp( EDunStateUninitialized );
- ReportStateChangeUp( EDunStateTryLoad );
- ReportStateChangeUp( EDunStateLoaded );
- ReportStateChangeUp( EDunStateTryListen );
- ReportStateChangeUp( EDunStateListening );
- FTRACE(FPrint(_L("CDunUsbPlugin::NotifyChannelFree() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunConnMon.
-// Gets called when line status changes or when any type of error is detected
-// ---------------------------------------------------------------------------
-//
-void CDunUsbPlugin::NotifyProgressChangeL(
- TConnId aConnId,
- TDunConnectionReason aConnReason )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL()")) );
- // Find matching failed ID
- TUsbPortEntity* foundEntity = NULL;
- TInt foundIndex = GetEntityByConnId( aConnId, foundEntity );
- if ( !foundEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL() (not found) complete")) );
- User::Leave( KErrNotFound );
- }
- if ( aConnReason.iReasonType == EDunReasonTypeRW ||
- aConnReason.iReasonType == EDunReasonTypeRunL )
- {
- // The following check will make it possible for CDunUsbListen to react
- // to cable removal (<KErrUsbDriverBase) or to the case when personality
- // is changed from USBUI and LOCOD/USBWatcher is too slow to notify the
- // change (KErrAccessDenied).
- if ( aConnReason.iErrorCode < KErrUsbDriverBase ||
- aConnReason.iErrorCode == KErrAccessDenied )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL() (shutdown now) complete")) );
- iShutdown = ETrue;
- return;
- }
- }
- if ( iShutdown )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL() (shutdown) complete")) );
- return;
- }
- // Now indications are down indications from local media side
- if ( foundEntity->iUsbPort.SubSessionHandle() )
- {
- iTransporter->FreeChannel( &foundEntity->iUsbPort );
- foundEntity->iUsbPort.SetSignals( 0, KSignalDCEOutputs );
- foundEntity->iUsbPort.Close();
- }
- TInt retTemp = InitOnePort( foundEntity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL() (ERROR) complete")) );
- User::Leave( KErrGeneral );
- }
- // Now this plugin was basically "restarted", but only for one
- // channel. Because transporter has channels with waiters, notify
- // server to reopen queued plugin(s)
- iServer->NotifyPluginReopenRequest();
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyProgressChangeL() complete")) );
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunBufferCorrection.
-// Gets called when request to change local media's buffer size
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyBufferCorrection( TInt aLength )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyBufferCorrection()")) );
- /*
- * This method modifies the default buffer length to match the maximum value
- * used by "CanHandleZLP=0" configuration option. This length is nearest length
- * divisible by 64 - 1. With slow USB compared to high speed HSDPA some products
- * can start to collect data to Dataport which results in full packet writes to
- * USB. However, the default full packet must not be divisible by 64, which results
- * in the ACM to send the full packet to LDD plus one extra packet with one byte
- * (disabling interrupts for a long time with current non-DMA USB driver).
- */
- TInt newLength = aLength;
- if ( newLength % 64 == 0 )
- {
- newLength = ((aLength >> 6) << 6) - 1;
- }
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyBufferCorrection() complete")) );
- return newLength;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunUsbConfig.
-// Gets called when one or more ACM configurations are added
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyConfigAddition( TInt aIndex )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigAddition()")) );
- // Configuration added so aIndex is the port number to be added to array.
- // This port number must not already exist in the array.
- TUsbPortEntity* foundEntity = NULL;
- TInt foundIndex = GetEntityByPortNumber( aIndex, foundEntity );
- if ( foundEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigAddition() (already exists) complete")) );
- return KErrAlreadyExists;
- }
- // Now either find port with KErrNotFound set as port number or if that is
- // not found then try to append to array
- foundIndex = GetFirstFreeEntity( foundEntity );
- if ( !foundEntity ) // free not found so add new
- {
- // Now append the new port to array
- TUsbPortEntity newEntity;
- newEntity.iPortNum = aIndex;
- TInt retTemp = iUsbPorts.Append( newEntity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigAddition() (append failed!) complete")) );
- return KErrGeneral;
- }
- // entity not valid here so set now
- foundEntity = &iUsbPorts[iUsbPorts.Count()-1];
- }
- else // free found so change array
- {
- foundEntity->iPortNum = aIndex;
- }
- // Open port and create channel for it
- TInt retTemp = InitOnePort( foundEntity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigAddition() (ERROR) complete" )));
- return KErrGeneral;
- }
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigAddition() complete")) );
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunUsbConfig.
-// Gets called when one or more ACM configurations are removed
-// ---------------------------------------------------------------------------
-//
-TInt CDunUsbPlugin::NotifyConfigRemoval( TInt aIndex )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigRemoval()")) );
- // Configuration removed so aIndex is the port number to be added to array.
- // This port number must already exist in the array.
- TUsbPortEntity* foundEntity = NULL;
- TInt foundIndex = GetEntityByPortNumber( aIndex, foundEntity );
- if ( !foundEntity )
- {
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigRemoval() (not found) complete")) );
- return KErrNotFound;
- }
- // Now free channel and mark as unused
- iTransporter->FreeChannel( &foundEntity->iUsbPort );
- foundEntity->iUsbPort.SetSignals( 0, KSignalDCEOutputs );
- foundEntity->iUsbPort.Close();
- iUsbPorts[foundIndex].iPortNum = KErrNotFound;
- FTRACE(FPrint( _L( "CDunUsbPlugin::NotifyConfigRemoval() complete")) );
- return KErrNone;
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLocalPluginL implements factory construction for
-// the class CDunUsbPlugin.
-// The function is exported at ordinal 1.
-// Returns: Pointer: The new instance of CDunUsbPlugin
-// ---------------------------------------------------------------------------
-//
-EXPORT_C MDunLocalMediaPlugin* NewLocalPluginL()
- {
- return new (ELeave) CDunUsbPlugin;
- }
--- a/localconnectivityservice/dun/rom/dunatext.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN ATEXT
-*
-*/
-
-
-#ifndef __DUNATEXT_IBY__
-#define __DUNATEXT_IBY__
-
-#ifdef __DIALUP_NETWORKING
-file=ABI_DIR\BUILD_DIR\dunatext.dll SHARED_LIB_DIR\dunatext.dll
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunbt.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN BT plugin
-*
-*/
-
-
-#ifndef __DUNBT_IBY__
-#define __DUNBT_IBY__
-
-#ifdef __DIALUP_NETWORKING
-#ifdef __BT
-file=ABI_DIR\BUILD_DIR\dunbt.dll SHARED_LIB_DIR\dunbt.dll
-#endif
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunclient.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN
-*
-*/
-
-
-#ifndef __DUNCLIENT_IBY__
-#define __DUNCLIENT_IBY__
-
-#ifdef __DIALUP_NETWORKING
-ECOM_PLUGIN(dunclient.dll,dunclient.rsc)
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunir.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN IR plugin
-*
-*/
-
-
-#ifndef __DUNIR_IBY__
-#define __DUNIR_IBY__
-
-#ifdef __DIALUP_NETWORKING
-#ifdef __IRDA
-file=ABI_DIR\BUILD_DIR\dunir.dll SHARED_LIB_DIR\dunir.dll
-#endif
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunserver.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN
-*
-*/
-
-
-#ifndef __DUNSERVER_IBY__
-#define __DUNSERVER_IBY__
-
-#ifdef __DIALUP_NETWORKING
-file=ABI_DIR\BUILD_DIR\dunserver.exe PROGRAMS_DIR\dunserver.exe
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunusb.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN USB plugin
-*
-*/
-
-
-#ifndef __DUNUSB_IBY__
-#define __DUNUSB_IBY__
-
-#ifdef __DIALUP_NETWORKING
-#ifdef __USB
-file=ABI_DIR\BUILD_DIR\dunusb.dll SHARED_LIB_DIR\dunusb.dll
-#endif
-#endif
-
-#endif
--- a/localconnectivityservice/dun/rom/dunutils.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project DUN utilities
-*
-*/
-
-
-#ifndef __DUNUTILS_IBY__
-#define __DUNUTILS_IBY__
-
-#ifdef __DIALUP_NETWORKING
-file=ABI_DIR\BUILD_DIR\dunutils.dll SHARED_LIB_DIR\dunutils.dll
-#endif
-
-#endif
--- a/localconnectivityservice/dun/server/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* This file provides the information required for building the
-* whole of a DUN server
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-../../rom/dunserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunserver.iby)
-
-PRJ_MMPFILES
-dunserver.mmp
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/dun/server/group/dunserver.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN server
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET dunserver.exe
-TARGETTYPE EXE
-UID 0x1000008d 0x0100387D
-
-CAPABILITY CAP_SERVER NetworkControl CommDD LocalServices WriteDeviceData
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE DunSession.cpp
-SOURCE DunServer.cpp
-SOURCE DunServerUtils.cpp
-SOURCE DunCloseWait.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc ../../utils/inc
-USERINCLUDE ../../../inc ../../../../inc
-
-LIBRARY euser.lib
-LIBRARY dunutils.lib
-LIBRARY btfeatures.lib
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/server/inc/DunCloseWait.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common waiter for closing self-destruct plugins
-*
-*/
-
-#ifndef C_CDUNCLOSEWAIT_H
-#define C_CDUNCLOSEWAIT_H
-
-#include <e32base.h>
-
-class MDunLocalMediaPlugin;
-
-/**
- * Notification interface class to report requst for closing a plugin
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( MDunCloseWait )
- {
-
-public:
-
- /**
- * Gets called when closing of plugins should be done
- *
- * @since S60 5.0
- * @param aPluginsToClose Plugins to be closed
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual void NotifyPluginCloseAfterWait(
- RPointerArray<MDunLocalMediaPlugin>& aPluginsToClose ) = 0;
-
- };
-
-/**
- * Common waiter for closing self-destruct plugins
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CDunCloseWait ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aCallback Callback to call when notification via MDunCloseWait
- * to be made
- * @return Instance of self
- */
- static CDunCloseWait* NewL( MDunCloseWait* aCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunCloseWait();
-
- /**
- * Resets data to initial values
- *
- * @since S60 5.0
- * @return None
- */
- void ResetData();
-
- /**
- * Adds a new plugin to be closed to the list
- *
- * @since S60 5.0
- * @param aPluginToClose The plugin to be closed
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddPluginToClose( MDunLocalMediaPlugin* aPluginToClose );
-
- /**
- * Issues request to start closing the objects in the close list
- *
- * @since S60 5.0
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops closing the objects in the close list
- *
- * @since S60 5.0
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunCloseWait( MDunCloseWait* aCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 5.0
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when closing of the plugins should be done
- *
- * @since S60 5.0
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 5.0
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback to call when notification via MDunCloseWait to be made
- */
- MDunCloseWait* iCallback;
-
- /**
- * List of plugins to be closed
- * Not own.
- */
- RPointerArray<MDunLocalMediaPlugin> iCloseList;
-
-};
-
-#endif // C_CDUNCLOSEWAIT_H
--- a/localconnectivityservice/dun/server/inc/DunServer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN server
-*
-*/
-
-
-#ifndef C_CDUNSERVER_H
-#define C_CDUNSERVER_H
-
-#include <e32base.h>
-#include "DunPlugin.h"
-#include "DunCloseWait.h"
-#include "dunserverdef.h"
-#include "dundomainpskeys.h"
-
-_LIT( KDunPluginBt, "dunbt.dll" );
-_LIT( KDunPluginIrda, "dunir.dll" );
-_LIT( KDunPluginUsb, "dunusb.dll" );
-
-class MDunSession;
-class MDunServerUtility;
-
-/**
- * Class used to store data needed for each separate plugin
- * One TDunConnectionData data contains objects needed for one plugin
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunConnectionData )
- {
-
-public:
-
- /**
- * Pointer to plugin DLL
- * Not own.
- */
- MDunLocalMediaPlugin* iLocalModulePtr;
-
- /**
- * Current state of plugin
- */
- TDunPluginState iPluginState;
-
- /**
- * DLL library server needed to open/close existing plugin
- */
- RLibrary iModuleLibrary;
-
- /**
- * Loaded plugin's UID
- */
- TUid iLocalModuleUid;
-
- };
-
-/**
- * Main DUN server's class
- *
- * @since S60 v3.2
- */
-class CDunServer : public CPolicyServer,
- public MDunServerCallback,
- public MDunCloseWait
- {
-
- friend class CDunServerUtils;
-
-public:
-
- /**
- * Two-phased constructor.
- * @return Instance of self
- */
- static CDunServer* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CDunServer();
-
- /**
- * Notification to manage local media On request
- * This comes from client
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to open
- * @return None
- */
- TInt NotifyMediaOpenRequest( TUid aPluginUid );
-
- /**
- * Notification to manage local media Off request
- * This comes from client
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to close
- * @return None
- */
- TInt NotifyMediaCloseRequest( TUid aPluginUid );
-
- /**
- * Current active connection
- * (For testing purposes only)
- *
- * @since S60 5.0
- * @return Active connection, NULL otherwise
- */
- TConnId ActiveConnection();
-
- /**
- * Increases reference count made by sessions
- * This comes from client
- *
- * @since S60 3.2
- * @return None
- */
- void IncRefCount();
-
- /**
- * Decreases reference count made by sessions
- * This comes from client
- *
- * @since S60 3.2
- * @return None
- */
- void DecRefCount();
-
-// from base class CServer2 (CPolicyServer -> CServer2)
-
- /**
- * From CServer2 (CPolicyServer derived from CServer2).
- * Creates a server-side client session object.
- *
- * @since S60 3.2
- * @param aVersion Version information supplied by the client
- * @return A pointer to the newly created server-side client session
- */
- CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& ) const;
-
-private:
-
- CDunServer( TInt aPriority );
-
- void ConstructL();
-
- /**
- * Opens local media plugin by UID
- *
- * @since S60 3.2
- * @param aPluginUid UID of local media plugin to open
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also TryClosePlugin()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt OpenMediaByUid( TUid aPluginUid, TBool aDequeue );
-
- /**
- * Closes local media plugin by UID
- *
- * @since S60 3.2
- * @param aPluginUid UID of local media plugin to close
- * @param aClearQueued ETrue if clear from plugin queue wanted,
- * EFalse otherwise
- * @param aClientClose ETrue if close originator is client
- * @param aSelfDelete ETrue if plugin closes itself, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt CloseMediaByUid( TUid aPluginUid,
- TBool aClearQueued,
- TBool aClientClose,
- TBool aSelfDelete );
-
- /**
- * Reopens plugins from plugin queue
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ReopenQueuedPlugins();
-
-// from base class MDunServerCallback
-
- /**
- * From MDunServerCallback.
- * Searches for plugin in connection data and returns its state
- *
- * @since S60 3.2
- * @param aPluginUid UID of local media plugin to search for
- * @return State of plugin
- */
- TDunPluginState GetPluginStateByUid( TUid aPluginUid );
-
- /**
- * From MDunServerCallback.
- * Notification about request to change plugin state up by one level
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a local media plugin
- * @param aPluginUid UID of the local media plugin whose state to change
- * @return KErrNotFound if plugin not found by UID,
- KErrNotSupported if unknown state,
- KErrNone otherwise
- */
- TInt NotifyPluginStateChangeUp( TDunPluginState aPluginState,
- TUid aPluginUid );
-
- /**
- * From MDunServerCallback.
- * Notification about request to change plugin state down by one level
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a local media plugin
- * @param aPluginUid UID of the local media plugin whose state to change
- * @return KErrNotFound if plugin not found by UID,
- KErrNotSupported if unknown state,
- KErrNone otherwise
- */
- TInt NotifyPluginStateChangeDown( TDunPluginState aPluginState,
- TUid aPluginUid );
-
- /**
- * From MDunServerCallback.
- * Notification about plugin restart request
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to restart
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyPluginRestart( TUid aPluginUid );
-
- /**
- * From MDunServerCallback.
- * Notification about plugin reopen request
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyPluginReopenRequest();
-
-// from base class MDunPluginManager (MDunServerCallback->MDunPluginManager).
-
- /**
- * From MDunPluginManager (MDunServerCallback->MDunPluginManager).
- * Notification about request to enqueue a plugin to plugin queue
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to enqueue
- * @return KErrNotFound = plugin not found by UID,
- KErrAlreadyExists = plugin already in queue,
- KErrNone otherwise
- */
- TInt NotifyPluginEnqueueRequest( TUid aPluginUid );
-
- /**
- * From MDunPluginManager (MDunServerCallback->MDunPluginManager).
- * Notification about request to dequeue a plugin from plugin queue
- * Just removes a found UID from the queue
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to dequeue
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyPluginDequeueRequest( TUid aPluginUid );
-
- /**
- * From MDunPluginManager (MDunServerCallback->MDunPluginManager).
- * Notification about request to close a plugin
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to close
- * @param aSelfClose ETrue if plugin closes itself, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyPluginCloseRequest( TUid aPluginUid,
- TBool aSelfClose );
-
-// from base class MDunCloseWait
-
- /**
- * From MDunCloseWait.
- * Notification about request to close a plugin after wait
- *
- * @since S60 5.0
- * @param aPluginsToClose Plugins to be closed
- * @return Symbian error code on error, KErrNone otherwise
- */
- void NotifyPluginCloseAfterWait(
- RPointerArray<MDunLocalMediaPlugin>& aPluginsToClose );
-
-private: // data
-
- /**
- * Pointer to common utility class
- * Own.
- */
- MDunServerUtility* iUtility;
-
- /**
- * Transporter to use for network side communication
- * Own.
- */
- CDunTransporter* iTransporter;
-
- /**
- * Waiter for closing self-destruct plugins
- * Own.
- */
- CDunCloseWait* iCloseWait;
-
- /**
- * Array of TDunConnectionData needed for each loaded plugin
- */
- RArray<TDunConnectionData> iConnData;
-
- /**
- * Array of plugin UIDs
- * Used for queuing plugins that have no resources to use
- * Used for dequeuing plugins when free resources detected
- */
- RArray<TUid> iPluginQueue;
-
- /**
- * Array of plugin UIDs
- * Used for queuing plugins that were successfully closed outside
- * this server. This is to avoid returning KErrNotFound to LOCOD
- * when NotifyMediaCloseRequest() is caught
- */
- RArray<TUid> iClosedQueue;
-
- /**
- * Connection status of dialup: active or inactive
- * Used for updating KPSUidDialupConnStatus Pub&Sub key
- */
- TDialupConnStatus iConnStatus;
-
- /**
- * Reference count of client sides
- */
- TInt iRefCount;
-
- };
-
-#endif // C_CDUNSERVER_H
--- a/localconnectivityservice/dun/server/inc/DunServerSecurityPolicy.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN server security policy definition
-*
-*/
-
-
-#ifndef DUNSERVER_SECURITYPOLICY_H
-#define DUNSERVER_SECURITYPOLICY_H
-
-#include "dunserverdef.h"
-
-// First range for KServerRanges[] definition, do not change
-const TInt KFirstServerRange = 0;
-
-// First range for KServerElementsIndex[] definition, do not change
-const TInt KFirstElementRange = 0;
-
-// ---------------------------------------------------------------------------
-// DunServer's policy
-// ---------------------------------------------------------------------------
-//
-
-// Definition of the ranges of IPC numbers
-const TInt KServerRanges[] =
- {
- KFirstServerRange, // Range 1: all client APIs
- EInvalidIpc // Range 2: Invalid IPC opcode
- };
-
-const TUint KServerRangeCount = sizeof( KServerRanges ) / sizeof( TInt );
-
-// Policy to implement for each of the above ranges
-const TUint8 KServerElementsIndex[KServerRangeCount] =
- {
- KFirstElementRange, // applies to 0th range
- CPolicyServer::ENotSupported // out of range DUN's IPC
- };
-
-//Specific capability checks
-const CPolicyServer::TPolicyElement KServerElements[] =
- {
- {_INIT_SECURITY_POLICY_C2(ECapabilityLocalServices, ECapabilityNetworkServices),
- CPolicyServer::EFailClient
- } // Policy 0
- };
-
-// Policy structure for DunServer. This is passed to DunServer's constructor
-const CPolicyServer::TPolicy KDunServerPolicy =
- {
- CPolicyServer::EAlwaysPass, // Indicates that Connect attempts should be processed without any further checks.
- KServerRangeCount, // Range count
- KServerRanges, // ranges array
- KServerElementsIndex, // elements' index
- KServerElements // array of elements
- };
-
-#endif // DUNSERVER_SECURITYPOLICY_H
--- a/localconnectivityservice/dun/server/inc/DunServerUtils.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Utility class for CDunServer
-*
-*/
-
-
-#ifndef C_CDUNSERVERUTILS_H
-#define C_CDUNSERVERUTILS_H
-
-#include <e32base.h>
-#include "DunPlugin.h"
-
-class CDunServer;
-
-/**
- * Utility accessor class for CDunServer class
- * Basically a collection of miscellaneous helper methods
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunServerUtility )
- {
-
-public:
-
- /**
- * From MDunServerUtility.
- * Closes plugins with state marked as zombie
- *
- * @since S60 3.2
- * @return KErrGeneral = close on any of the plugins failed,
- KErrNone otherwise
- */
- virtual TInt RemoveZombiePlugins() = 0;
-
- /**
- * From MDunServerUtility.
- * Loads local media module
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media module to load
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt CreateNewPlugin( TUid aPluginUid ) = 0;
-
- /**
- * From MDunServerUtility.
- * Constructs local media module
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media module to construct
- * @param aDllName Name of the DLL to the constructed local media module
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt ConstructLocalMediaModule( const TUid& aPluginUid,
- const TPtrC& aDllName ) = 0;
-
- /**
- * From MDunServerUtility.
- * Clears queued UIDs
- *
- * @since S60 3.2
- * @param aPluginUid UID of local media plugin to remove
- * @param aClearClosed ETrue if clear from closed queued wanted
- * @param aClearQueued ETrue if clear from plugin queue wanted
- * @return ETrue if plugin UID was removed, EFalse otherwise
- */
- virtual TBool ClearQueuedUIDs( TUid aPluginUid,
- TBool aClearClosed,
- TBool aClearQueued ) = 0;
-
- /**
- * From MDunServerUtility.
- * Tries to close loaded local media plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @param aClientClose ETrue if close originator is client
- * @param aSelfClose ETrue if plugin closes itself, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt TryClosePlugin( TInt aIndex,
- TBool aDequeue,
- TBool aClientClose,
- TBool aSelfClose ) = 0;
-
- /**
- * From MDunServerUtility.
- * Closes a plugin directly without uninitializing it
- *
- * @since S60 5.0
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @param aClientClose ETrue if close originator is client
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoClosePlugin( TInt aIndex,
- TBool aDequeue,
- TBool aClientClose ) = 0;
-
- /**
- * From MDunServerUtility.
- * Does immediate close of plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoImmediatePluginClose( TInt aIndex,
- TBool aDequeue ) = 0;
-
- /**
- * From MDunServerUtility.
- * Tries uninitialization and after that listening state switch on a plugin
- *
- * @since S60 3.2
- * @param aPluginUid UID of the plugin to initialize to listening state
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt TryInitializeToListening( TUid aPluginUid ) = 0;
-
- /**
- * From MDunServerUtility.
- * Tries listening state switch on a plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @return KErrNotFound = plugin not found,
- KErrNotReady = wrong state,
- KErrNone otherwise
- */
- virtual TInt TryListening( TInt aIndex ) = 0;
-
- /**
- * From MDunServerUtility.
- * Tries uninitialization of a plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @return KErrNotFound = plugin not found, KErrNone otherwise
- */
- virtual TInt TryUninitialize( TInt aIndex ) = 0;
-
- };
-
-/**
- * DUN server's utility class
- *
- * @since S60 v3.2
- */
-class CDunServerUtils : public CBase,
- public MDunServerUtility
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aParent Parent class owning this friend class (CDunServer)
- * @return Instance of self
- */
- static CDunServerUtils* NewL( CDunServer& aParent );
-
- /**
- * Destructor.
- */
- virtual ~CDunServerUtils();
-
-private:
-
- CDunServerUtils( CDunServer& aParent );
-
- void ConstructL();
-
-// from base class MDunServerUtility
-
- /**
- * From MDunServerUtility.
- * Closes plugins with state marked as zombie
- *
- * @since S60 3.2
- * @return KErrGeneral = close on any of the plugins failed,
- KErrNone otherwise
- */
- TInt RemoveZombiePlugins();
-
- /**
- * From MDunServerUtility.
- * Loads local media module
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media module to load
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt CreateNewPlugin( TUid aPluginUid );
-
- /**
- * From MDunServerUtility.
- * Constructs local media module
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media module to construct
- * @param aDllName Name of the DLL to the constructed local media module
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ConstructLocalMediaModule( const TUid& aPluginUid,
- const TPtrC& aDllName );
-
- /**
- * From MDunServerUtility.
- * Clears queued UIDs
- *
- * @since S60 3.2
- * @param aPluginUid UID of local media plugin to remove
- * @param aClearClosed ETrue if clear from closed queued wanted
- * @param aClearQueued ETrue if clear from plugin queue wanted
- * @return ETrue if plugin UID was removed, EFalse otherwise
- */
- TBool ClearQueuedUIDs( TUid aPluginUid,
- TBool aClearClosed,
- TBool aClearQueued );
-
- /**
- * From MDunServerUtility.
- * Tries to close loaded local media plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @param aClientClose ETrue if close originator is client
- * @param aSelfClose ETrue if plugin closes itself, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt TryClosePlugin( TInt aIndex,
- TBool aDequeue,
- TBool aClientClose,
- TBool aSelfClose );
-
- /**
- * From MDunServerUtility.
- * Closes a plugin directly without uninitializing it
- *
- * @since S60 5.0
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @param aClientClose ETrue if close originator is client
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoClosePlugin( TInt aIndex,
- TBool aDequeue,
- TBool aClientClose );
-
- /**
- * From MDunServerUtility.
- * Does immediate close of plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @param aDequeue ETrue if restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (normal case, see also OpenMediaByUid()),
- * EFalse if no restarting of queued plugins and plugin
- * dequeue wanted after successful plugin close
- * (in this case caller is reopener itself, see also
- * ReopenQeueuedPlugins())
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoImmediatePluginClose( TInt aIndex,
- TBool aDequeue );
-
- /**
- * From MDunServerUtility.
- * Tries uninitialization and after that listening state switch on a plugin
- *
- * @since S60 3.2
- * @param aPluginUid UID of the plugin to initialize to listening state
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt TryInitializeToListening( TUid aPluginUid );
-
- /**
- * From MDunServerUtility.
- * Tries listening state switch on a plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @return KErrNotFound = plugin not found,
- KErrNotReady = wrong state,
- KErrNone otherwise
- */
- TInt TryListening( TInt aIndex );
-
- /**
- * From MDunServerUtility.
- * Tries uninitialization of a plugin
- *
- * @since S60 3.2
- * @param aIndex Index of plugin in connectiondata
- * @return KErrNotFound = plugin not found, KErrNone otherwise
- */
- TInt TryUninitialize( TInt aIndex );
-
-private: // data
-
- /**
- * Parent class owning this friend class (CDunServer)
- */
- CDunServer& iParent;
-
- /**
- * Transporter to use for network side communication
- * (from parent iParent)
- */
- CDunTransporter*& iTransporter;
-
- /**
- * Waiter for closing self-destruct plugins
- * (from parent iParent)
- */
- CDunCloseWait*& iCloseWait;
-
- /**
- * Array of TDunConnectionData needed for each loaded plugin
- * (from parent iParent)
- */
- RArray<TDunConnectionData>& iConnData;
-
- /**
- * Array of plugin UIDs (from parent iParent)
- * Used for queuing plugins that have no resources to use
- * Used for dequeuing plugins when free resources detected
- */
- RArray<TUid>& iPluginQueue;
-
- /**
- * Array of plugin UIDs (from parent iParent)
- * Used for queuing plugins that were successfully closed outside
- * this server. This is to avoid returning KErrNotFound to LOCOD
- * when NotifyMediaCloseRequest() is caught
- */
- RArray<TUid>& iClosedQueue;
-
- };
-
-#endif // C_CDUNSERVERUTILS_H
--- a/localconnectivityservice/dun/server/inc/DunSession.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The session object for DUN server
-*
-*/
-
-
-#include "DunServer.h"
-
-#ifndef C_CDUNSESSION_H
-#define C_CDUNSESSION_H
-
-/**
- * Manages separate DUN server sessions for client(s)
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunSession ) : public CSession2
- {
-
-public:
-
- CDunSession( CDunServer* aDunServer );
-
- /**
- * Destructor.
- */
- virtual ~CDunSession();
-
- /**
- * Return the version number
- *
- * @since S60 3.2
- * @return Version number
- */
- TVersion Version() const;
-
-// from base class CSession2
-
- /**
- * From CSession2.
- * Handles the servicing of client requests passed to the server
- *
- * @since S60 3.2
- * @param aMessage Message containing the client request
- * @return None
- */
- void ServiceL( const RMessage2 &aMessage );
-
- /**
- * From CSession2.
- * Return a reference to DUN server
- *
- * @since S60 3.2
- * @return Server reference
- */
- CDunServer& Server() const;
-
-private:
-
- /**
- * Handles incoming service messages
- *
- * @since S60 3.2
- * @param aMessage Message containing the client request
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoService( const RMessage2& aMessage );
-
- /**
- * Handles incoming test service messages
- *
- * @since S60 5.0
- * @param aMessage Message containing the client request
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoTestService( const RMessage2& aMessage );
-
-private: // data
-
- /**
- * Message containing the client request
- */
- RMessage2 iMessage;
-
- /**
- * Pointer to DUN server
- * Not own.
- */
- CDunServer* iDunServer;
-
-};
-
-#endif // C_CDUNSESSION_H
--- a/localconnectivityservice/dun/server/inc/dunserverdef.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for server
-*
-*/
-
-
-#ifndef DUN_SERVERDEF_H
-#define DUN_SERVERDEF_H
-
-// INCLUDES
-#include <e32base.h>
-#include <e32svr.h>
-
-// DATA TYPES
-enum TDunIpc
- {
- EDunFuncManageService,
- EDunFuncActiveConnection, // For testing purposes only
- EInvalidIpc
- };
-
-// GLOBAL CONSTANTS
-
-_LIT( KDialupServerName, "dunserver" );
-
-const TUint KDunServerMajorVersionNumber = 2;
-const TUint KDunServerMinorVersionNumber = 0;
-const TUint KDunServerBuildVersionNumber = 0;
-
-#endif // DUN_SERVERDEF_H
--- a/localconnectivityservice/dun/server/src/DunCloseWait.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common waiter for closing self-destruct plugins
-*
-*/
-
-#include "DunCloseWait.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunCloseWait* CDunCloseWait::NewL( MDunCloseWait* aCallback )
- {
- CDunCloseWait* self = new (ELeave) CDunCloseWait( aCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunCloseWait::~CDunCloseWait()
- {
- FTRACE(FPrint( _L("CDunCloseWait::~CDunCloseWait()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunCloseWait::~CDunCloseWait() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunCloseWait::ResetData()
- {
- // IssueRequest()
- Stop();
- // AddPluginToClose()
- iCloseList.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Adds a new object to be destructed to the list
-// ---------------------------------------------------------------------------
-//
-TInt CDunCloseWait::AddPluginToClose( MDunLocalMediaPlugin* aPluginToClose )
- {
- FTRACE(FPrint( _L("CDunCloseWait::AddPluginToClose()" ) ));
- if ( !aPluginToClose )
- {
- FTRACE(FPrint( _L("CDunCloseWait::AddPluginToClose() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCloseList.Find( aPluginToClose );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunCloseWait::AddPluginToClose() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCloseList.Append( aPluginToClose );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunCloseWait::AddPluginToClose() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunCloseWait::AddPluginToClose() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start closing the objects in the close list
-// ---------------------------------------------------------------------------
-//
-TInt CDunCloseWait::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunCloseWait::IssueRequest()" )));
- if ( IsActive() )
- {
- FTRACE(FPrint( _L("CDunCloseWait::IssueRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus* requestStatus = &iStatus;
- User::RequestComplete( requestStatus, KErrNone );
- FTRACE(FPrint( _L("CDunCloseWait::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops closing the objects in the close list
-// ---------------------------------------------------------------------------
-//
-TInt CDunCloseWait::Stop()
- {
- FTRACE(FPrint( _L("CDunCloseWait::Stop()" )));
- if ( !IsActive() )
- {
- FTRACE(FPrint( _L("CDunCloseWait::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- Cancel();
- FTRACE(FPrint( _L("CDunCloseWait::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunCloseWait::CDunCloseWait
-// ---------------------------------------------------------------------------
-//
-CDunCloseWait::CDunCloseWait( MDunCloseWait* aCallback ) :
- CActive( EPriorityHigh ),
- iCallback( aCallback )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunCloseWait::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunCloseWait::ConstructL()
- {
- FTRACE(FPrint( _L("CDunCloseWait::ConstructL()" ) ));
- if ( !iCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunCloseWait::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunCloseWait::Initialize()
- {
- // Don't initialize iCallback here (it is set through NewL)
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when closing of the plugins should be done
-// ---------------------------------------------------------------------------
-//
-void CDunCloseWait::RunL()
- {
- FTRACE(FPrint( _L("CDunCloseWait::RunL()" )));
- iCallback->NotifyPluginCloseAfterWait( iCloseList );
- iCloseList.Reset();
- FTRACE(FPrint( _L("CDunCloseWait::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunCloseWait::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/server/src/DunServer.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,674 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: DUN server
-*
-*/
-
-
-#include <e32property.h>
-#include "DunServer.h"
-#include "DunServerUtils.h"
-#include "DunSession.h"
-#include "DunDebug.h"
-#include "DunServerSecurityPolicy.h"
-#include "dundomainpskeys.h"
-#include "DunTransporter.h"
-
-// PubSub security settings constants
-_LIT_SECURITY_POLICY_PASS( KConnStatusReadPolicy );
-_LIT_SECURITY_POLICY_C2( KConnStatusWritePolicy,
- ECapabilityLocalServices,
- ECapabilityWriteDeviceData );
-
-// ======== LOCAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// StartServerL Create Active Scheduler and CDunServer.
-// ---------------------------------------------------------------------------
-//
-static void StartServerL()
- {
- FTRACE(FPrint( _L("CDunServer::StartServerL()") ));
- CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
- CleanupStack::PushL( scheduler );
- CActiveScheduler::Install( scheduler );
-
- CDunServer* server = CDunServer::NewL();
- CleanupStack::PushL( server );
-
- User::RenameThread( KDialupServerName );
- RProcess::Rendezvous( KErrNone );
- FTRACE(FPrint( _L("CDunServer::StartServerL() Initialization done. Server is running.") ));
-
- CActiveScheduler::Start(); // run the server
-
- CleanupStack::PopAndDestroy( server );
- CleanupStack::PopAndDestroy( scheduler );
- FTRACE(FPrint( _L("CDunServer::StartServerL() complete") ));
- }
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunServer* CDunServer::NewL()
- {
- CDunServer* self = new (ELeave) CDunServer( EPriorityStandard );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunServer::~CDunServer()
- {
- FTRACE(FPrint(_L("CDunServer::~CDunServer()")));
- // Destroy iConnData
- TInt i;
- for ( i=iConnData.Count()-1; i>=0; i-- )
- {
- if ( iUtility )
- {
- iUtility->TryClosePlugin( i, EFalse, EFalse, EFalse );
- }
- }
- if ( iConnData.Count() == 0 )
- {
- iConnData.Close();
- }
- else
- {
- FTRACE(FPrint(_L("CDunServer::~CDunServer() (ERROR) complete")));
- }
- // Destroy iPluginQueue
- iPluginQueue.Close();
- // Destroy iClosedQueue
- iClosedQueue.Close();
- // Destroy transporter
- delete iTransporter;
- iTransporter = NULL;
- // Destroy utility
- CDunServerUtils* utility = static_cast<CDunServerUtils*>( iUtility );
- delete utility;
- iUtility = NULL;
- // Destroy close waiter
- delete iCloseWait;
- iCloseWait = NULL;
- // Remove key
- RProperty::Delete( KPSUidDialupConnStatus, KDialupConnStatus );
- FTRACE(FPrint(_L("CDunServer::~CDunServer() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Notification to manage local media On request
-// This comes from client
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyMediaOpenRequest( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyMediaOpenRequest()")));
- iUtility->ClearQueuedUIDs( aPluginUid, ETrue, ETrue );
- iUtility->RemoveZombiePlugins();
- TInt retVal = OpenMediaByUid( aPluginUid, ETrue );
- FTRACE(FPrint(_L("CDunServer::NotifyMediaOpenRequest() complete (%d)"), retVal));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Notification to manage local media Off request
-// This comes from client
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyMediaCloseRequest( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyMediaCloseRequest()")));
- // If plugin can be found with iEnqueue or iClosed marked ETrue,
- // Close also them in the same way (no special processing needed)
- TInt retVal = CloseMediaByUid( aPluginUid, ETrue, ETrue, ETrue );
- FTRACE(FPrint(_L("CDunServer::NotifyMediaCloseRequest() complete (%d)"), retVal));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Current active connection
-// This comes from client
-// ---------------------------------------------------------------------------
-//
-TConnId CDunServer::ActiveConnection()
- {
- FTRACE(FPrint(_L("CDunServer::ActiveConnection()")));
- if ( iConnData.Count()<1 || iConnData.Count()>1 )
- {
- FTRACE(FPrint(_L("CDunServer::ActiveConnection() (unknown plugin amount) complete")));
- return NULL;
- }
- TDunConnectionData& plugin = iConnData[0];
- if ( !plugin.iLocalModulePtr )
- {
- FTRACE(FPrint(_L("CDunServer::ActiveConnection() (no instance) complete")));
- return NULL;
- }
- TConnId connId = plugin.iLocalModulePtr->ActiveConnection();
- FTRACE(FPrint(_L("CDunServer::ActiveConnection() complete")));
- return connId;
- }
-
-// ---------------------------------------------------------------------------
-// Increases reference count made by sessions
-// This comes from client
-// ---------------------------------------------------------------------------
-//
-void CDunServer::IncRefCount()
- {
- FTRACE(FPrint(_L("CDunServer::IncRefCount()")));
- iRefCount++;
- FTRACE(FPrint(_L("CDunServer::IncRefCount() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Decreases reference count made by sessions
-// This comes from client
-// ---------------------------------------------------------------------------
-//
-void CDunServer::DecRefCount()
- {
- FTRACE(FPrint(_L("CDunServer::DecRefCount()")));
- if ( iRefCount > 0 )
- {
- iRefCount--;
- FTRACE(FPrint(_L("CDunServer::DecRefCount() reference count decreased")));
- if ( iRefCount == 0 )
- {
- FTRACE(FPrint(_L("CDunServer::DecRefCount() stopping activescheduler...")));
- CActiveScheduler::Stop();
- }
- }
- FTRACE(FPrint(_L("CDunServer::DecRefCount() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class CServer2 (CPolicyServer -> CServer2).
-// Creates a server-side client session object.
-// ---------------------------------------------------------------------------
-//
-CSession2* CDunServer::NewSessionL( const TVersion& aVersion,
- const RMessage2& /*aMessage*/ ) const
- {
- FTRACE(FPrint(_L("CDunServer::NewSessionL()")));
- TVersion version(KDunServerMajorVersionNumber,
- KDunServerMinorVersionNumber,
- KDunServerBuildVersionNumber );
- TBool supported = User::QueryVersionSupported( version, aVersion );
- if ( !supported )
- {
- FTRACE(FPrint(_L("CDunServer::NewSessionL() (not supported) complete")));
- User::Leave( KErrNotSupported );
- }
- CDunSession* session = new (ELeave) CDunSession(const_cast<CDunServer*>( this ));
- FTRACE(FPrint(_L("CDunServer::NewSessionL() complete")));
- return session;
- }
-
-// ---------------------------------------------------------------------------
-// CDunServer::CDunServer
-// ---------------------------------------------------------------------------
-//
-CDunServer::CDunServer( TInt aPriority ) :
- // aPriority: priority of AO
- // KDunServerPolicy: TPolicy structure of DUN
- CPolicyServer( aPriority, KDunServerPolicy ),
- iTransporter( NULL ),
- iConnStatus( EDialupUndefined ),
- iRefCount( 0 )
- {
- FTRACE( FPrint( _L( "CDunServer::CDunServer()" )));
- }
-
-// ---------------------------------------------------------------------------
-// CDunServer::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunServer::ConstructL()
- {
- FTRACE( FPrint( _L( "CDunServer::ConstructL()" )));
- StartL( KDialupServerName );
- // Initialize pubsub key properties
- User::LeaveIfError(
- RProperty::Define( KPSUidDialupConnStatus,
- KDialupConnStatus,
- RProperty::EInt,
- KConnStatusReadPolicy,
- KConnStatusWritePolicy) );
- // Set key to initial value
- RProperty::Set( KPSUidDialupConnStatus,
- KDialupConnStatus,
- EDialupInactive );
- // Create waiter for closing self-destruct plugins
- CDunCloseWait* closeWait = CDunCloseWait::NewL( this );
- CleanupStack::PushL( closeWait );
- // Create transporter
- CDunTransporter* transporter = CDunTransporter::NewL( this );
- CleanupStack::PushL( transporter );
- // Create utility
- CDunServerUtils* utility = CDunServerUtils::NewL( *this );
- iUtility = static_cast<MDunServerUtility*>( utility );
- iTransporter = transporter;
- iCloseWait = closeWait;
- CleanupStack::Pop( transporter );
- CleanupStack::Pop( closeWait );
- FTRACE( FPrint( _L( "CDunServer::ConstructL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Opens local media plugin by UID
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::OpenMediaByUid( TUid aPluginUid, TBool aDequeue )
- {
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() (already exists) complete")));
- return KErrAlreadyExists;
- }
- }
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() creating new plugin 0x%08X"), aPluginUid.iUid));
- TInt retTemp = iUtility->CreateNewPlugin( aPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() (ERROR) complete")));
- return retTemp;
- }
- TInt pluginIndex = iConnData.Count() - 1;
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() trying listen at index %d"), pluginIndex));
- retTemp = iUtility->TryListening( pluginIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() trying close at index %d"), pluginIndex));
- iUtility->TryClosePlugin( pluginIndex, aDequeue, EFalse, EFalse );
- // Ignore error(s), TryClosePlugin()'s TryUninitialize already sets to Zombie if error(s)
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() (ERROR) complete")));
- return retTemp;
- }
- // Clear queued also from queued plugin UIDs, just to be safe
- iUtility->ClearQueuedUIDs( aPluginUid, ETrue, ETrue );
- FTRACE(FPrint(_L("CDunServer::OpenMediaByUid() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Closes local media plugin by UID
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::CloseMediaByUid( TUid aPluginUid,
- TBool aClearQueued,
- TBool aClientClose,
- TBool aSelfDelete )
- {
- FTRACE(FPrint(_L("CDunServer::CloseMediaByUid()")));
- TInt i;
- TBool cleared = EFalse;
- if ( aClearQueued )
- {
- cleared = iUtility->ClearQueuedUIDs( aPluginUid, ETrue, ETrue );
- }
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServer::CloseMediaByUid() (not found) complete")));
- return KErrNotFound;
- }
- FTRACE(FPrint(_L("CDunServer::CloseMediaByUid() trying close at index %d"), i));
- // Plugin found from main list, now close
- TInt retTemp = iUtility->TryClosePlugin( i,
- ETrue,
- aClientClose,
- aSelfDelete );
- if ( retTemp!=KErrNone && !cleared )
- {
- FTRACE(FPrint(_L("CDunServer::CloseMediaByUid() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServer::CloseMediaByUid() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Reopens plugins from plugin queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::ReopenQueuedPlugins()
- {
- FTRACE(FPrint(_L("CDunServer::ReopenQueuedPlugins() (%d)"), iPluginQueue.Count()));
- TInt i = iPluginQueue.Count() - 1;
- while ( i >= 0 )
- {
- TInt retTemp = OpenMediaByUid( iPluginQueue[i], EFalse );
- if ( retTemp == KErrNone )
- {
- // Open succeeded so plugin UID was removed by ClearQueuedUIDs().
- // Recalculate i because this method can remove more than one
- // match.
- i = iPluginQueue.Count() - 1;
- }
- else
- {
- // Open failed so the plugin UID was not removed from queue.
- // Just decrease index (avoid forever loop).
- i--;
- }
- }
- FTRACE(FPrint(_L("CDunServer::ReopenQueuedPlugin()")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerCallback.
-// Searches for plugin in connection data and returns its state
-// ---------------------------------------------------------------------------
-//
-TDunPluginState CDunServer::GetPluginStateByUid( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::GetPluginStateByUid()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServer::GetPluginStateByUid() (not found) complete")));
- return EDunStateNone;
- }
- FTRACE(FPrint(_L("CDunServer::GetPluginStateByUid() state at index %d is %d"), i, iConnData[i].iPluginState));
- FTRACE(FPrint(_L("CDunServer::GetPluginStateByUid() complete")));
- return iConnData[i].iPluginState;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerCallback.
-// Notification about request to change plugin state up by one level
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginStateChangeUp( TDunPluginState aPluginState,
- TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp() (not found) complete")));
- return KErrNotFound;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp() found at index %d"), i));
- TDunPluginState pluginState = iConnData[i].iPluginState;
- if ( pluginState<EDunStateTryUninitialize || aPluginState-pluginState!=1 )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp() (unknown state) complete (%d/%d)"), pluginState, aPluginState));
- return KErrNotSupported;
- }
- iConnData[i].iPluginState = aPluginState;
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp() state changed to %d(%d)"), aPluginState, pluginState));
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeUp() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerCallback.
-// Notification about request to change plugin state down by one level
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginStateChangeDown( TDunPluginState aPluginState,
- TUid aPluginUid)
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() (not found) complete")));
- return KErrNotFound;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() found at index %d"), i));
- TDunPluginState pluginState = iConnData[i].iPluginState;
- if ( aPluginState >= pluginState )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() (unknown state) complete (%d/%d)"), pluginState, aPluginState));
- return KErrNotSupported;
- }
- // Next catch the cases where state is not "try"
- if ( aPluginState != EDunStateTryUninitialize &&
- aPluginState != EDunStateTryLoad &&
- aPluginState != EDunStateTryListen &&
- aPluginState != EDunStateTryChannel )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() (unknown state) complete (%d/%d)"), pluginState, aPluginState));
- return KErrNotSupported;
- }
- iConnData[i].iPluginState = aPluginState;
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() state changed to %d(%d)"), aPluginState, pluginState));
- FTRACE(FPrint(_L("CDunServer::NotifyPluginStateChangeDown() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerCallback.
-// Notification about plugin restart request
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginRestart( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginRestart()")));
- TInt retTemp = iUtility->TryInitializeToListening( aPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginRestart() (ERROR) initialize failed")));
- return retTemp;
- }
- // Restarting may have freed channel(s),
- // try to reopen queued plugins (ignore error(s))
- ReopenQueuedPlugins();
- FTRACE(FPrint(_L("CDunServer::NotifyPluginRestart() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerCallback.
-// Notification about plugin restart request
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginReopenRequest()
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginReopenRequest()")));
- TInt retVal = ReopenQueuedPlugins();
- FTRACE(FPrint(_L("CDunServer::NotifyPluginReopenRequest() complete")));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunPluginManager (MDunServerCallback->MDunPluginManager).
-// Notification about request to enqueue a plugin to plugin queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginEnqueueRequest( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() (not found) complete")));
- return KErrNotFound;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() found at index %d"), i));
- // Plugin exists, now try to find it from plugin queue
- count = iPluginQueue.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iPluginQueue[i] == aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() (already exists) complete")));
- return KErrAlreadyExists;
- }
- }
- // New plugin found, queue
- TInt retTemp = CloseMediaByUid( aPluginUid, EFalse, EFalse, ETrue );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() (close failed) complete")));
- return KErrGeneral;
- }
- retTemp = iPluginQueue.Append( aPluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() (append failed!) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() appended to index %d"), iPluginQueue.Count()-1));
- FTRACE(FPrint(_L("CDunServer::NotifyPluginEnqueueRequest() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunPluginManager (MDunServerCallback->MDunPluginManager).
-// Notification about request to dequeue a plugin from plugin queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginDequeueRequest( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginDequeueRequest()")));
- TBool cleared = iUtility->ClearQueuedUIDs( aPluginUid, ETrue, ETrue );
- if ( !cleared )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginDequeueRequest() (not found) complete")));
- return KErrNotFound;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginDequeueRequest() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunPluginManager (MDunServerCallback->MDunPluginManager).
-// Notification about request to close a plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServer::NotifyPluginCloseRequest( TUid aPluginUid, TBool aSelfClose )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginCloseRequest()")));
- TInt retTemp = CloseMediaByUid( aPluginUid, ETrue, EFalse, aSelfClose );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginCloseRequest() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginCloseRequest() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From MDunCloseWait.
-// Notification about request to close a plugin after wait
-// ---------------------------------------------------------------------------
-//
-void CDunServer::NotifyPluginCloseAfterWait(
- RPointerArray<MDunLocalMediaPlugin>& aPluginsToClose )
- {
- FTRACE(FPrint(_L("CDunServer::NotifyPluginCloseAfterWait()")));
- TInt i;
- TInt j;
- TInt closeCount = aPluginsToClose.Count();
- for ( i=0; i<closeCount; i++ )
- {
- // keep iConnData.Count() on the line below as it changes!
- for ( j=0; j<iConnData.Count(); j++ )
- {
- if ( iConnData[j].iLocalModulePtr == aPluginsToClose[i] )
- {
- iUtility->DoClosePlugin( j, ETrue, EFalse );
- }
- }
- }
- FTRACE(FPrint(_L("CDunServer::NotifyPluginCloseAfterWait() complete")));
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// WinsMain/E32Main implements main function for DUN
-// exe.
-// Create Cleanup Stack, initialise server and start Active
-// Scheduler.
-// Returns: Error value: General error value
-// ---------------------------------------------------------------------------
-//
-TInt E32Main()
- {
- FTRACE(FPrint( _L("CDunServer::Main() Process started.") ));
-__UHEAP_MARK;
- CTrapCleanup* cleanup = CTrapCleanup::New();
- TInt retVal = KErrNoMemory;
-
- if ( cleanup )
- {
- TRAP( retVal, StartServerL() ); // perform all other initialisation
- delete cleanup;
- }
-__UHEAP_MARKEND;
-
- FTRACE(FPrint( _L("CDunServer::Main() Process exit code = %d"), retVal));
- return retVal;
- }
--- a/localconnectivityservice/dun/server/src/DunServerUtils.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,497 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Utility class for CDunServer
-*
-*/
-
-
-#include <e32uid.h>
-#include "DunServer.h"
-#include "DunServerUtils.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunServerUtils* CDunServerUtils::NewL( CDunServer& aParent )
- {
- CDunServerUtils* self = new (ELeave) CDunServerUtils( aParent );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunServerUtils::~CDunServerUtils()
- {
- FTRACE(FPrint(_L("CDunServerUtils::~CDunServerUtils()")));
- FTRACE(FPrint(_L("CDunServerUtils::~CDunServerUtils() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// CDunServerUtils::CDunServerUtils
-// ---------------------------------------------------------------------------
-//
-CDunServerUtils::CDunServerUtils( CDunServer& aParent ) :
- iParent( aParent ),
- iTransporter( aParent.iTransporter ),
- iCloseWait( aParent.iCloseWait ),
- iConnData( aParent.iConnData ),
- iPluginQueue( aParent.iPluginQueue ),
- iClosedQueue( aParent.iClosedQueue )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunServerUtils::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunServerUtils::ConstructL()
- {
- FTRACE(FPrint( _L("CDunServerUtils::ConstructL()" ) ));
- FTRACE(FPrint( _L("CDunServerUtils::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Closes plugins with state marked as zombie
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::RemoveZombiePlugins()
- {
- FTRACE(FPrint(_L("CDunServerUtils::RemoveZombiePlugins()")));
- TInt i;
- TInt retVal = KErrNone;
- for ( i=iConnData.Count()-1; i>=0; i-- )
- {
- if ( iConnData[i].iPluginState == EDunStateZombie )
- {
- // Following closes and removes if remove ok
- FTRACE(FPrint(_L("CDunServerUtils::RemoveZombiePlugins() trying close at index %d"), i));
- TInt retTemp = TryClosePlugin( i, ETrue, EFalse, EFalse );
- if ( retTemp != KErrNone )
- {
- retVal = KErrGeneral;
- }
- }
- }
- FTRACE(FPrint(_L("CDunServerUtils::RemoveZombiePlugins() complete")));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Loads local media module
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::CreateNewPlugin( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServerUtils::CreateNewPlugin()")));
- // plugin not constructed, construct now
- TFileName pluginFile;
- switch ( aPluginUid.iUid )
- {
- case KDunBtPluginUidValue:
- pluginFile.Copy( KDunPluginBt );
- break;
- case KDunIrPluginUidValue:
- pluginFile.Copy( KDunPluginIrda );
- break;
- case KDunUsbPluginUidValue:
- pluginFile.Copy( KDunPluginUsb );
- break;
- default:
- FTRACE(FPrint(_L("CDunServerUtils::CreateNewPlugin() (not supported) complete")));
- return KErrNotSupported;
- }
- TDunConnectionData emptyConn;
- emptyConn.iLocalModulePtr = NULL;
- emptyConn.iLocalModuleUid = TUid::Null();
- emptyConn.iPluginState = EDunStateNone;
- TInt retTemp = iConnData.Append( emptyConn );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::CreateNewPlugin() (append failed!) complete")));
- return retTemp;
- }
- retTemp = ConstructLocalMediaModule( aPluginUid, pluginFile );
- if ( retTemp != KErrNone )
- {
- iConnData.Remove( iConnData.Count()-1 );
- FTRACE(FPrint(_L("CDunServerUtils::CreateNewPlugin() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServerUtils::CreateNewPlugin() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Constructs local media module
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::ConstructLocalMediaModule( const TUid& aPluginUid,
- const TPtrC& aDllName )
- {
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule()")));
- // Create a new library object
- if ( iConnData.Count() == 0 )
- {
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() (not ready) complete")));
- return KErrNotReady;
- }
- TInt index = iConnData.Count() - 1;
- iConnData[index].iLocalModuleUid = aPluginUid;
- iConnData[index].iPluginState = EDunStateTryLoad;
- // Load the DLL containing the plug-in
- TUidType uidType( KDynamicLibraryUid,
- KDunLocalMediaPluginInterfaceUid,
- aPluginUid );
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() loading")));
- TInt retTemp = iConnData[index].iModuleLibrary.Load( aDllName, uidType );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() (ERROR) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() plugin 0x%08X loaded"), aPluginUid.iUid));
- // Create the plugin object.
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() looking up")));
- TLibraryFunction factoryFunction = iConnData[index].iModuleLibrary.Lookup( 1 );
- if ( !factoryFunction )
- {
- iConnData[index].iModuleLibrary.Close();
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() (ERROR) complete")));
- return KErrNotFound;
- }
- MDunLocalMediaPlugin* localPlugin =
- reinterpret_cast<MDunLocalMediaPlugin*>( factoryFunction() );
- if ( !localPlugin )
- {
- iConnData[index].iModuleLibrary.Close();
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() (ERROR) complete")));
- return KErrGeneral;
- }
- iConnData[index].iLocalModulePtr = localPlugin;
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() constructing")));
- TRAPD( retTrap, localPlugin->ConstructL(&iParent, iTransporter) );
- if ( retTrap != KErrNone )
- {
- delete iConnData[index].iLocalModulePtr;
- iConnData[index].iLocalModulePtr = NULL;
- iConnData[index].iModuleLibrary.Close();
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() (ERROR) complete")));
- return retTrap;
- }
- iConnData[index].iPluginState = EDunStateLoaded;
- FTRACE(FPrint(_L("CDunServerUtils::ConstructLocalMediaModule() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Clears queued UIDs
-// ---------------------------------------------------------------------------
-//
-TBool CDunServerUtils::ClearQueuedUIDs( TUid aPluginUid,
- TBool aClearClosed,
- TBool aClearQueued )
- {
- FTRACE(FPrint(_L("CDunServerUtils::ClearQueuedUIDs()")));
- TInt i;
- TBool cleared = EFalse;
- if ( aClearClosed )
- {
- for ( i=iClosedQueue.Count()-1; i>=0; i-- )
- {
- if ( iClosedQueue[i] == aPluginUid )
- {
- iClosedQueue.Remove( i );
- cleared = ETrue;
- FTRACE(FPrint(_L("CDunServerUtils::ClearQueuedUIDs() removed from closed queue at %d"), i));
- }
- }
- }
- if ( aClearQueued )
- {
- for ( i=iPluginQueue.Count()-1; i>=0; i-- )
- {
- if ( iPluginQueue[i] == aPluginUid )
- {
- iPluginQueue.Remove( i );
- cleared = ETrue;
- FTRACE(FPrint(_L("CDunServerUtils::ClearQueuedUIDs() removed from plugin queue at %d"), i));
- }
- }
- }
- FTRACE(FPrint(_L("CDunServerUtils::ClearQueuedUIDs() complete")));
- return cleared;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Tries to close loaded local media plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::TryClosePlugin( TInt aIndex,
- TBool aDequeue,
- TBool aClientClose,
- TBool aSelfClose )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin()")));
- if ( aIndex < 0 ||
- aIndex >= iConnData.Count() )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() (not found) complete")));
- return KErrNotFound;
- }
- TInt retTemp = TryUninitialize( aIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() (ERROR) complete")));
- return retTemp;
- }
- if ( !aSelfClose )
- {
- retTemp = DoClosePlugin( aIndex, aDequeue, aClientClose );
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() complete")));
- return retTemp;
- }
- retTemp = iCloseWait->AddPluginToClose( iConnData[aIndex].iLocalModulePtr );
- if ( retTemp != KErrNone )
- {
- iConnData[aIndex].iPluginState = EDunStateZombie;
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() state changed to %d"), EDunStateZombie));
- return retTemp;
- }
- retTemp = iCloseWait->IssueRequest();
- if ( retTemp != KErrNone )
- {
- iConnData[aIndex].iPluginState = EDunStateZombie;
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() state changed to %d"), EDunStateZombie));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryClosePlugin() (waiting) complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Closes a plugin directly without uninitializing it
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::DoClosePlugin(
- TInt aIndex,
- TBool aDequeue,
- TBool aClientClose )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin()")));
- if ( aIndex < 0 ||
- aIndex >= iConnData.Count() )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin() (not found) complete")));
- return KErrNotFound;
- }
- TUid pluginUid = iConnData[aIndex].iLocalModuleUid;
- DoImmediatePluginClose( aIndex, aDequeue );
- if ( !aClientClose )
- {
- // Plugin was closed by something else than client
- // Enqueue it to closed queue
- TInt i;
- TInt count = iClosedQueue.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iClosedQueue[i] == pluginUid )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin() (already exists) complete")));
- return KErrAlreadyExists;
- }
- }
- TInt retTemp = iClosedQueue.Append( pluginUid );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin() (append failed!) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin() appended to index %d"), iClosedQueue.Count()-1));
- }
- FTRACE(FPrint(_L("CDunServerUtils::DoClosePlugin() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Does immediate close of plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::DoImmediatePluginClose( TInt aIndex, TBool aDequeue )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoImmediatePluginClose()")));
- if ( aIndex < 0 ||
- aIndex >= iConnData.Count() )
- {
- FTRACE(FPrint(_L("CDunServerUtils::DoImmediatePluginClose() (not found) complete")));
- return KErrNotFound;
- }
- delete iConnData[aIndex].iLocalModulePtr;
- iConnData[aIndex].iLocalModulePtr = NULL;
- if ( iConnData[aIndex].iModuleLibrary.Handle() != KNullHandle )
- {
- iConnData[aIndex].iModuleLibrary.Close();
- }
- iConnData.Remove( aIndex );
- // Now, the following check is needed to avoid recursion by:
- // ReopenQueuedPlugins()->OpenMediaByUid()->TryClosePlugin()->
- // DoImmediatePluginClose()->ReopenQueuedPlugins()
- if ( aDequeue )
- {
- iParent.ReopenQueuedPlugins();
- }
- // Ignore error(s); this function must only report it's own operation status
- FTRACE(FPrint(_L("CDunServerUtils::DoImmediatePluginClose() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Tries uninitialization and after that listening state switch on a plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::TryInitializeToListening( TUid aPluginUid )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryInitializeToListening()")));
- TInt i;
- TInt count = iConnData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iConnData[i].iLocalModuleUid == aPluginUid )
- {
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryInitializeToListening() (not found) complete")));
- return KErrNotFound;
- }
- TInt retTemp = TryUninitialize( i );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryInitializeToListening() (uninitialize error) complete")));
- return retTemp;
- }
- // Change from Uninitialized to Loaded because listening mode needs it
- // (plugin is already loaded anyway)
- iConnData[i].iPluginState = EDunStateLoaded;
- retTemp = TryListening( i );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryInitializeToListening() (listening error) complete")));
- return retTemp;
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryInitializeToListening() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Tries listening state switch on a plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::TryListening( TInt aIndex )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryListening()")));
- if ( aIndex < 0 ||
- aIndex >= iConnData.Count() )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() (not found) complete")));
- return KErrNotFound;
- }
- if ( iConnData[aIndex].iPluginState != EDunStateLoaded )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() (not ready) complete")));
- return KErrNotReady;
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() notifying server state change (%d)"), EDunStateTryListen));
- TInt retTemp =
- iConnData[aIndex].iLocalModulePtr->NotifyServerStateChange( EDunStateTryListen );
- if ( retTemp != KErrNone )
- {
- iConnData[aIndex].iPluginState = EDunStateZombie;
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() state changed to %d"), EDunStateZombie));
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() (ERROR) complete")));
- return retTemp;
- }
- // Plugin could have changed state, only change state if possible
- // This can happen if plugin has no real listening and switches directly
- // from listening mode to channeled mode
- if ( iConnData[aIndex].iPluginState == EDunStateTryListen )
- {
- iConnData[aIndex].iPluginState = EDunStateListening;
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() state changed to %d"), EDunStateListening));
- FTRACE(FPrint(_L("CDunServerUtils::TryListening() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunServerUtility.
-// Tries uninitialization of a plugin
-// ---------------------------------------------------------------------------
-//
-TInt CDunServerUtils::TryUninitialize( TInt aIndex )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize()")));
- if ( aIndex < 0 ||
- aIndex >= iConnData.Count() )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() (not found) complete")));
- return KErrNotFound;
- }
- if ( iConnData[aIndex].iPluginState == EDunStateUninitialized )
- {
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() (already uninitialized) complete")));
- return KErrNotReady;
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() notifying server state change (%d)"), EDunStateTryUninitialize));
- TInt retTemp =
- iConnData[aIndex].iLocalModulePtr->NotifyServerStateChange( EDunStateTryUninitialize );
- if ( retTemp != KErrNone )
- {
- iConnData[aIndex].iPluginState = EDunStateZombie;
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() state changed to %d"), EDunStateZombie));
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() (ERROR) complete")));
- return retTemp;
- }
- // Plugin state must be EDunStateLoaded after uninitialization
- if ( iConnData[aIndex].iPluginState == EDunStateLoaded )
- {
- iConnData[aIndex].iPluginState = EDunStateUninitialized;
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() state changed to %d"), EDunStateUninitialized));
- }
- else
- {
- // Should never come here
- iConnData[aIndex].iPluginState = EDunStateZombie;
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() state changed to %d"), EDunStateZombie));
- }
- FTRACE(FPrint(_L("CDunServerUtils::TryUninitialize() complete")));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/server/src/DunSession.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The session object for DUN server
-*
-*/
-
-
-#include <e32std.h>
-#include <c32comm.h>
-#include <f32file.h>
-#include <e32math.h>
-#include <locodbearer.h>
-#include <btfeaturescfg.h>
-#include "dunserverdef.h"
-#include "DunSession.h"
-#include "DunServer.h"
-#include "DunPlugin.h"
-#include "DunDebug.h"
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CDunSession::CDunSession
-// ---------------------------------------------------------------------------
-//
-CDunSession::CDunSession( CDunServer* aDunServer ) :
- CSession2(),
- iDunServer( aDunServer )
- {
- FTRACE(FPrint( _L( "CDunSession::CDunSession()") ));
- iDunServer->IncRefCount();
- FTRACE(FPrint( _L( "CDunSession::CDunSession() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunSession::~CDunSession()
- {
- FTRACE(FPrint(_L("CDunSession::~CDunSession()")));
- if ( iDunServer )
- {
- iDunServer->DecRefCount();
- iDunServer = NULL;
- }
- FTRACE(FPrint(_L("CDunSession::~CDunSession() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Return the version number
-// ---------------------------------------------------------------------------
-//
-TVersion CDunSession::Version(void) const
- {
- return (TVersion( KDunServerMajorVersionNumber,
- KDunServerMinorVersionNumber,
- KDunServerBuildVersionNumber ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CSession2.
-// Handles the servicing of client requests passed to the server
-// ---------------------------------------------------------------------------
-//
-void CDunSession::ServiceL( const RMessage2& aMessage )
- {
- FTRACE(FPrint(_L("CDunSession::ServiceL()")));
- TBool hasCapability = aMessage.HasCapability( ECapabilityLocalServices );
- if ( !hasCapability )
- {
- aMessage.Complete( KErrPermissionDenied );
- FTRACE(FPrint(_L("CDunSession::ServiceL() (no capability) complete")));
- return;
- }
- TInt retVal = KErrNotSupported;
- switch ( aMessage.Function() )
- {
- case EDunFuncManageService:
- retVal = DoService( aMessage );
- break;
- case EDunFuncActiveConnection:
- retVal = DoTestService( aMessage );
- break;
- default:
- FTRACE(FPrint(_L("CDunSession::ServiceL() (not supported) complete")));
- break;
- }
- aMessage.Complete( retVal );
- FTRACE(FPrint(_L("CDunSession::ServiceL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class CSession2.
-// Return a reference to DUN server
-// ---------------------------------------------------------------------------
-//
-CDunServer& CDunSession::Server() const
- {
- return *iDunServer;
- }
-
-// ---------------------------------------------------------------------------
-// Handles incoming service messages
-// ---------------------------------------------------------------------------
-//
-TInt CDunSession::DoService( const RMessage2& aMessage )
- {
- FTRACE(FPrint(_L("CDunSession::DoService()")));
- if ( !iDunServer )
- {
- FTRACE(FPrint(_L("CDunSession::DoService() (iDunServer) not initialized!")));
- return KErrGeneral;
- }
-
- TLocodBearer bearer = static_cast<TLocodBearer>( aMessage.Int0() );
- TBool bearerStatus = static_cast<TBool>( aMessage.Int1() );
-
- TUid pluginUid;
- switch ( bearer )
- {
- case ELocodBearerBT:
- {
- pluginUid = KDunBtPluginUid;
- FTRACE(FPrint(_L("CDunSession::DoService() Managing service for BT, bearer status %d"), bearerStatus));
-
- BluetoothFeatures::TEnterpriseEnablementMode mode = BluetoothFeatures::EDisabled;
- TRAPD(err, mode = BluetoothFeatures::EnterpriseEnablementL());
- if ( err )
- {
- FTRACE(FPrint(_L("CDunSession::DoService() complete: failed to get BluetoothFeatures::EnterpriseEnablementL")));
- return err;
- }
- if ( mode != BluetoothFeatures::EEnabled )
- {
- FTRACE(FPrint(_L("CDunSession::DoService() complete: !BluetoothFeatures::EEnabled")));
- return KErrNotSupported;
- }
- }
- break;
- case ELocodBearerIR:
- pluginUid = KDunIrPluginUid;
- FTRACE(FPrint(_L("CDunSession::DoService() Managing service for IR, bearer status %d"), bearerStatus));
- break;
- case ELocodBearerUSB:
- pluginUid = KDunUsbPluginUid;
- FTRACE(FPrint(_L("CDunSession::DoService() Managing service for USB, bearer status %d"), bearerStatus));
- break;
- default:
- FTRACE(FPrint(_L("CDunSession::DoService() Unknown service %d, bearer status %d!"), bearer, bearerStatus));
- return KErrNotSupported;
- }
- TInt retVal = KErrNone;
- if ( bearerStatus ) // ON
- {
- retVal = iDunServer->NotifyMediaOpenRequest( pluginUid );
- }
- else // OFF
- {
- retVal = iDunServer->NotifyMediaCloseRequest( pluginUid );
- }
- FTRACE(FPrint(_L("CDunSession::DoService() complete")));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Handles incoming test service messages
-// ---------------------------------------------------------------------------
-//
-TInt CDunSession::DoTestService( const RMessage2& aMessage )
- {
- FTRACE(FPrint(_L("CDunSession::DoTestService()")));
- if ( !iDunServer )
- {
- FTRACE(FPrint(_L("CDunSession::DoTestService() (iDunServer) not initialized!")));
- return KErrGeneral;
- }
- TConnId connId = iDunServer->ActiveConnection();
- TPckgBuf<TConnId> connIdPckg( connId );
- aMessage.Write( 0, connIdPckg ); // First argument in EDunFuncActiveConnection
- FTRACE(FPrint(_L("CDunSession::DoTestService() complete")));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/tsrc/bwins/dunutilstestu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
-
--- a/localconnectivityservice/dun/tsrc/conf/dunutilstest.cfg Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-[Test]
-title Launch the dialog
-create dunutilstest Dun_Handler_Tester
-Dun_Handler_Tester LaunchDialog
-delete Dun_Handler_Tester
-[Endtest]
-
--- a/localconnectivityservice/dun/tsrc/eabi/dunutilstestu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
-
--- a/localconnectivityservice/dun/tsrc/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-dunutilstest.mmp
--- a/localconnectivityservice/dun/tsrc/group/dunutilstest.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-TARGET dunutilstest.dll
-TARGETTYPE dll
-UID 0x1000008d 0xE9AF118D
-
-CAPABILITY ALL -TCB
-
-DEFFILE dunutilstest.def
-
-USERINCLUDE ../inc ../../utils/inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-SOURCEPATH ../src
-
-SOURCE dunutilstest.cpp
-
-SOURCEPATH ../../utils/src
-
-SOURCE DunNoteHandler.cpp
-
-
-LIBRARY euser.lib
-LIBRARY stiftestinterface.lib
-LIBRARY sysutil.lib
-LIBRARY HbWidgets.lib
-
-LANG SC
--- a/localconnectivityservice/dun/tsrc/inc/dunutilstest.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-// This file defines the API for dunutilstest.dll
-
-#ifndef DUNUTILSTEST_H
-#define DUNUTILSTEST_H
-
-// Include Files
-
-#include <StifLogger.h>
-#include <TestScripterInternal.h>
-#include <StifTestModule.h>
-
-#include "DunNoteHandler.h"
-
-// Constants
-
-// Class Definitions
-
-
-NONSHARABLE_CLASS(Cdunutilstest) : public CScriptBase
- {
-public:
- // new functions
-
- static Cdunutilstest* NewL(CTestModuleIf& aTestModuleIf);
-
- virtual ~Cdunutilstest();
-
-public: // Functions from base classes
-
- /**
- * From CScriptBase Runs a script line.
- * @since ?Series60_version
- * @param aItem Script line containing method name and parameters
- * @return Symbian OS error code
- */
- virtual TInt RunMethodL( CStifItemParser& aItem );
-
-private:
- // new functions
- Cdunutilstest(CTestModuleIf& aTestModuleIf);
- void ConstructL();
-
- virtual TInt LaunchDialogL( CStifItemParser& aItem );
-
-private:
- // data
- CDunNoteHandler* mDunandler;
- };
-
-#endif // DUNUTILSTEST_H
-
--- a/localconnectivityservice/dun/tsrc/init/dunutilstest.ini Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-#
-# This is STIF initialization file
-# Comment lines start with '#'-character.
-# See STIF TestFramework users guide.doc for instructions
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set following test engine settings:
-# - Set Test Reporting mode. TestReportMode's possible values are:
-# + 'Summary': Summary of the tested test cases.
-# + 'Environment': Hardware and software info.
-# + 'TestCases': Test case report.
-# + 'FullReport': Set of all above ones.
-# + Example 'TestReportMode= Summary TestCases'
-#
-# - CreateTestReport setting controls report creation mode
-# + YES, Test report will created.
-# + NO, No Test report.
-#
-# - File path indicates the base path of the test report.
-# - File name indicates the name of the test report.
-#
-# - File format indicates the type of the test report.
-# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
-# + HTML, Test report will be html type, for example 'TestReport.html'.
-#
-# - File output indicates output source of the test report.
-# + FILE, Test report logging to file.
-# + RDEBUG, Test report logging to using rdebug.
-#
-# - File Creation Mode indicates test report overwriting if file exist.
-# + OVERWRITE, Overwrites if the Test report file exist.
-# + APPEND, Continue logging after the old Test report information if
-# report exist.
-# - Sets a device reset module's dll name(Reboot).
-# + If Nokia specific reset module is not available or it is not correct one
-# StifHWResetStub module may use as a template for user specific reset
-# module.
-# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
-# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
-#
-
-[Engine_Defaults]
-
-TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
- # 'TestCases' or 'FullReport'
-
-CreateTestReport= YES # Possible values: YES or NO
-
-TestReportFilePath= e:\testing\logs\
-TestReportFileName= obexServApiTest_TestReport
-
-TestReportFormat= TXT # Possible values: TXT, HTML or XML
-TestReportOutput= FILE # Possible values: FILE or RDEBUG
-TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
-
-DisableMeasurement= stifmeasurementdisablenone # Possible values are:
- # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
- # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
- # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
- # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
-
-Timeout= 0 # Default timeout value for each test case. In milliseconds
-#UITestingSupport= YES # Possible values: YES or NO
-#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
-[End_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Module configurations start
-# Modules are added between module tags
-# tags. Module name is specified after ModuleName= tag, like
-# ModuleName= XXXXXXXXX
-# Modules might have initialisation file, specified as
-# IniFile= c:\testframework\YYYYYY
-# Modules might have several configuration files, like
-# TestCaseFile= c:\testframework\NormalCases.txt
-# TestCaseFile= c:\testframework\SmokeCases.txt
-# TestCaseFile= c:\testframework\ManualCases.txt
-
-# (TestCaseFile is synonym for old term ConfigFile)
-
-# Following case specifies demo module settings. Demo module
-# does not read any settings from file, so tags
-# IniFile and TestCaseFile are not used.
-# In the simplest case it is enough to specify only the
-# name of the test module when adding new test module
-
-[New_Module]
-ModuleName= testscripter
-TestCaseFile= c:\testing\conf\dunutilstest.cfg
-[End_Module]
-
-
-# Load testmoduleXXX, optionally with initialization file and/or test case files
-#[New_Module]
-#ModuleName= testmodulexxx
-
-#TestModuleXXX used initialization file
-#IniFile= c:\testframework\init.txt
-
-#TestModuleXXX used configuration file(s)
-#TestCaseFile= c:\testframework\testcases1.cfg
-#TestCaseFile= c:\testframework\testcases2.cfg
-#TestCaseFile= c:\testframework\manualtestcases.cfg
-
-#[End_Module]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set STIF logging overwrite parameters for Logger.
-# Hardware and emulator environment logging path and styles can
-# be configured from here to overwrite the Logger's implemented values.
-#
-# Settings description:
-# - Indicates option for creation log directory/directories. If log directory/directories
-# is/are not created by user they will make by software.
-# + YES, Create log directory/directories if not allready exist.
-# + NO, Log directory/directories not created. Only created one is used.
-#
-# - Overwrite emulator path setting.
-# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
-# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
-# will be 'C:\LOGS\TestFramework\LOGS\Module\'
-#
-# - Overwrite emulator's logging format.
-# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
-# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
-#
-# - Overwrited emulator logging output source.
-# + FILE, Logging to file(s).
-# + RDEBUG, Logging to using rdebug(s).
-#
-# - Overwrite hardware path setting (Same description as above in emulator path).
-# - Overwrite hardware's logging format(Same description as above in emulator format).
-# - Overwrite hardware's logging output source(Same description as above in emulator output).
-#
-# - File Creation Mode indicates file overwriting if file exist.
-# + OVERWRITE, Overwrites if file(s) exist.
-# + APPEND, Continue logging after the old logging information if file(s) exist.
-#
-# - Will thread id include to the log filename.
-# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
-# + NO, No thread id to log file(s), Example filename 'Module.txt'.
-#
-# - Will time stamps include the to log file.
-# + YES, Time stamp added to each line in log file(s). Time stamp is
-# for example'12.Nov.2003 115958 LOGGING INFO'
-# + NO, No time stamp(s).
-#
-# - Will line breaks include to the log file.
-# + YES, Each logging event includes line break and next log event is in own line.
-# + NO, No line break(s).
-#
-# - Will event ranking include to the log file.
-# + YES, Event ranking number added to each line in log file(s). Ranking number
-# depends on environment's tics, for example(includes time stamp also)
-# '012 12.Nov.2003 115958 LOGGING INFO'
-# + NO, No event ranking.
-#
-# - Will write log file in unicode format.
-# + YES, Log file will be written in unicode format
-# + NO, Log will be written as normal, not unicode, file.
-#
-
-[Logger_Defaults]
-
-#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
-#NOTE: TestEngine and TestServer logging settings cannot change here
-
-CreateLogDirectories= YES # Possible values: YES or NO
-
-#EmulatorBasePath= C:\LOGS\TestFramework\
-#EmulatorFormat= HTML # Possible values: TXT or HTML
-#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
-
-#HardwareBasePath= D:\LOGS\TestFramework\
-#HardwareFormat= HTML # Possible values: TXT or HTML
-#HardwareOutput= FILE # Possible values: FILE or RDEBUG
-
-#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-#ThreadIdToLogFile= YES # Possible values: YES or NO
-#WithTimeStamp= YES # Possible values: YES or NO
-#WithLineBreak= YES # Possible values: YES or NO
-#WithEventRanking= YES # Possible values: YES or NO
-
-#FileUnicode= YES # Possible values: YES or NO
-#AddTestCaseTitle= YES # Possible values: YES or NO
-[End_Logger_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set filters to be used by ConsoleUI.
-# If you want to use filter with ConsoleUI, simply remove comments
-# from section below and provide valid filter entries.
-# Each filter line has to start with "filter= " keyword.
-# Filter can contain special wildcard characters:
-# * which stands for none or any literal;
-# ? which stands for single character.
-# Filters are not case-sensitive.
-
-#[Filters]
-#filter= *math*
-#filter= *radio*
-#[End_Filters]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-# End of file
--- a/localconnectivityservice/dun/tsrc/src/dunutilstest.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include "dunutilstest.h" // Cdunutilstest
-
-// Member Functions
-
-
-Cdunutilstest* Cdunutilstest::NewL(CTestModuleIf& aTestModuleIf)
- {
- Cdunutilstest* self = new (ELeave) Cdunutilstest( aTestModuleIf );
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
-
- }
-
-Cdunutilstest::Cdunutilstest(CTestModuleIf& aTestModuleIf ):
- CScriptBase( aTestModuleIf )
- {
- }
-
-void Cdunutilstest::ConstructL()
- {
- // second phase constructor, anything that may leave must be constructed here
- mDunandler = CDunNoteHandler::NewL();
-
- }
-
-Cdunutilstest::~Cdunutilstest()
- {
- delete mDunandler;
- }
-
-TInt Cdunutilstest::RunMethodL( CStifItemParser& aItem )
- {
-
- static TStifFunctionInfo const KFunctions[] =
- {
- // Copy this line for every implemented function.
- // First string is the function name used in TestScripter script file.
- // Second is the actual implementation member function.
- ENTRY( "LaunchDialog", Cdunutilstest::LaunchDialogL )
- };
-
- const TInt count = sizeof( KFunctions ) /
- sizeof( TStifFunctionInfo );
-
- return RunInternalL( KFunctions, count, aItem );
-
- }
-
-TInt Cdunutilstest::LaunchDialogL( CStifItemParser& /*aItem*/ )
- {
-
- TTimeIntervalMicroSeconds32 time(7000000); //7 Seconds
-
- mDunandler->IssueRequest();
- User::After(time);
- return KErrNone;
- }
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// -----------------------------------------------------------------------------
-// LibEntryL is a polymorphic Dll entry point.
-// Returns: CScriptBase: New CScriptBase derived object
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CScriptBase* LibEntryL(
- CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
- {
-
- return ( CScriptBase* ) Cdunutilstest::NewL( aTestModuleIf );
-
- }
-
-
--- a/localconnectivityservice/dun/utils/bwins/dunutilsu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-EXPORTS
- ?NewL@CDunTransporter@@SAPAV1@PAVMDunPluginManager@@H@Z @ 1 NONAME ; class CDunTransporter * CDunTransporter::NewL(class MDunPluginManager *, int)
- ?NumberOfAllocatedChannels@CDunTransporter@@QAEHXZ @ 2 NONAME ; int CDunTransporter::NumberOfAllocatedChannels(void)
- ?AllocateChannelL@CDunTransporter@@QAEXPAVRComm@@VTUid@@ABVTDesC8@@HPAVMDunBufferCorrection@@@Z @ 3 NONAME ; void CDunTransporter::AllocateChannelL(class RComm *, class TUid, class TDesC8 const &, int, class MDunBufferCorrection *)
- ?SetAdvertisementMonitorL@CDunTransporter@@QAEXVTUid@@PAVMDunServAdvMon@@@Z @ 4 NONAME ; void CDunTransporter::SetAdvertisementMonitorL(class TUid, class MDunServAdvMon *)
- ?InitializeL@CDunTransporter@@AAEHXZ @ 5 NONAME ; int CDunTransporter::InitializeL(void)
- ?AllocateChannelL@CDunTransporter@@QAEXPAVRSocket@@VTUid@@ABVTDesC8@@HAAH@Z @ 6 NONAME ; void CDunTransporter::AllocateChannelL(class RSocket *, class TUid, class TDesC8 const &, int, int &)
- ?GetNumberOfAllocatedChannelsByUid@CDunTransporter@@QAEHVTUid@@@Z @ 7 NONAME ; int CDunTransporter::GetNumberOfAllocatedChannelsByUid(class TUid)
- ?FreeChannel@CDunTransporter@@QAEHPAVRComm@@@Z @ 8 NONAME ; int CDunTransporter::FreeChannel(class RComm *)
- ?FreeChannel@CDunTransporter@@QAEHPAVRSocket@@@Z @ 9 NONAME ; int CDunTransporter::FreeChannel(class RSocket *)
- ?FreeAdvertisementMonitor@CDunTransporter@@QAEHVTUid@@PAVMDunServAdvMon@@@Z @ 10 NONAME ; int CDunTransporter::FreeAdvertisementMonitor(class TUid, class MDunServAdvMon *)
- ?GetNumberOfWaitingChannelsByUid@CDunTransporter@@QAEHVTUid@@@Z @ 11 NONAME ; int CDunTransporter::GetNumberOfWaitingChannelsByUid(class TUid)
- ?StopTransfers@CDunTransporter@@QAEHPAVRComm@@@Z @ 12 NONAME ; int CDunTransporter::StopTransfers(class RComm *)
- ?NumberOfWaitingChannels@CDunTransporter@@QAEHXZ @ 13 NONAME ; int CDunTransporter::NumberOfWaitingChannels(void)
- ?AddSkippedErrorL@CDunTransporter@@QAEXHPAVRComm@@W4TDunDirection@@@Z @ 14 NONAME ; void CDunTransporter::AddSkippedErrorL(int, class RComm *, enum TDunDirection)
- ?ConnectCommsServer@CDunUtils@@SAHAAVRCommServ@@@Z @ 15 NONAME ; int CDunUtils::ConnectCommsServer(class RCommServ &)
- ?IssueTransferRequestsL@CDunTransporter@@QAEXPAVRSocket@@@Z @ 16 NONAME ; void CDunTransporter::IssueTransferRequestsL(class RSocket *)
- ?AddConnMonCallbackL@CDunTransporter@@QAEXPAVRSocket@@PAVMDunConnMon@@W4TDunDirection@@H@Z @ 17 NONAME ; void CDunTransporter::AddConnMonCallbackL(class RSocket *, class MDunConnMon *, enum TDunDirection, int)
- ?UnInitialize@CDunTransporter@@AAEXXZ @ 18 NONAME ; void CDunTransporter::UnInitialize(void)
- ?StopTransfers@CDunTransporter@@QAEHPAVRSocket@@@Z @ 19 NONAME ; int CDunTransporter::StopTransfers(class RSocket *)
- ?AddSkippedErrorL@CDunTransporter@@QAEXHPAVRSocket@@W4TDunDirection@@@Z @ 20 NONAME ; void CDunTransporter::AddSkippedErrorL(int, class RSocket *, enum TDunDirection)
- ?AddConnMonCallbackL@CDunTransporter@@QAEXPAVRComm@@PAVMDunConnMon@@W4TDunDirection@@H@Z @ 21 NONAME ; void CDunTransporter::AddConnMonCallbackL(class RComm *, class MDunConnMon *, enum TDunDirection, int)
- ?IssueTransferRequestsL@CDunTransporter@@QAEXPAVRComm@@@Z @ 22 NONAME ; void CDunTransporter::IssueTransferRequestsL(class RComm *)
- ?SetRCommBufferLength@CDunUtils@@SAHAAVRComm@@H@Z @ 23 NONAME ; int CDunUtils::SetRCommBufferLength(class RComm &, int)
- ?AdvertisementStatus@CDunTransporter@@QAEHXZ @ 24 NONAME ; int CDunTransporter::AdvertisementStatus(void)
-
--- a/localconnectivityservice/dun/utils/eabi/dunutilsu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-EXPORTS
- _ZN15CDunTransporter11FreeChannelEP5RComm @ 1 NONAME
- _ZN15CDunTransporter11FreeChannelEP7RSocket @ 2 NONAME
- _ZN15CDunTransporter11InitializeLEv @ 3 NONAME
- _ZN15CDunTransporter12UnInitializeEv @ 4 NONAME
- _ZN15CDunTransporter13StopTransfersEP5RComm @ 5 NONAME
- _ZN15CDunTransporter13StopTransfersEP7RSocket @ 6 NONAME
- _ZN15CDunTransporter16AddSkippedErrorLEiP5RComm13TDunDirection @ 7 NONAME
- _ZN15CDunTransporter16AddSkippedErrorLEiP7RSocket13TDunDirection @ 8 NONAME
- _ZN15CDunTransporter16AllocateChannelLEP5RComm4TUidRK6TDesC8iP20MDunBufferCorrection @ 9 NONAME
- _ZN15CDunTransporter16AllocateChannelLEP7RSocket4TUidRK6TDesC8iRi @ 10 NONAME
- _ZN15CDunTransporter19AddConnMonCallbackLEP5RCommP11MDunConnMon13TDunDirectioni @ 11 NONAME
- _ZN15CDunTransporter19AddConnMonCallbackLEP7RSocketP11MDunConnMon13TDunDirectioni @ 12 NONAME
- _ZN15CDunTransporter19AdvertisementStatusEv @ 13 NONAME
- _ZN15CDunTransporter22IssueTransferRequestsLEP5RComm @ 14 NONAME
- _ZN15CDunTransporter22IssueTransferRequestsLEP7RSocket @ 15 NONAME
- _ZN15CDunTransporter23NumberOfWaitingChannelsEv @ 16 NONAME
- _ZN15CDunTransporter24FreeAdvertisementMonitorE4TUidP14MDunServAdvMon @ 17 NONAME
- _ZN15CDunTransporter24SetAdvertisementMonitorLE4TUidP14MDunServAdvMon @ 18 NONAME
- _ZN15CDunTransporter25NumberOfAllocatedChannelsEv @ 19 NONAME
- _ZN15CDunTransporter31GetNumberOfWaitingChannelsByUidE4TUid @ 20 NONAME
- _ZN15CDunTransporter33GetNumberOfAllocatedChannelsByUidE4TUid @ 21 NONAME
- _ZN15CDunTransporter4NewLEP17MDunPluginManageri @ 22 NONAME
- _ZN9CDunUtils18ConnectCommsServerER9RCommServ @ 23 NONAME
- _ZN9CDunUtils20SetRCommBufferLengthER5RCommi @ 24 NONAME
-
--- a/localconnectivityservice/dun/utils/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* This file provides the information required for building the
-* whole of DUN utilities
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-../../rom/dunutils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dunutils.iby)
-
-
-PRJ_MMPFILES
-dunutils.mmp
-
-PRJ_TESTMMPFILES
--- a/localconnectivityservice/dun/utils/group/dunutils.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project DUN utilities
-*
-*/
-
-
-// Define the following flag to enable network side logging.
-// This makes it possible to test AT commands with idle Telephony/RComm.
-// Note that because RComm is a stub the only way to test the connection
-// is via RSocket (Bluetooth).
-
-#undef ENABLE_NETWORK_STUBS
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-#ifdef ENABLE_NETWORK_STUBS
-MACRO PRJ_USE_NETWORK_STUBS
-#define PRJ_USE_NETWORK_STUBS
-#endif // ENABLE_NETWORK_STUBS
-
-TARGET dunutils.dll
-TARGETTYPE DLL
-UID 0x1000008d 0x101F6E2A
-
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE DunStream.cpp
-SOURCE DunUpstream.cpp
-SOURCE DunDownstream.cpp
-SOURCE DunSignalCopy.cpp
-SOURCE DunSignalNotify.cpp
-SOURCE DunSignalWaiter.cpp
-SOURCE DunDataWaiter.cpp
-SOURCE DunNetDataport.cpp
-SOURCE DunTransUtils.cpp
-SOURCE DunTransporter.cpp
-SOURCE DunChanMan.cpp
-SOURCE DunDataPusher.cpp
-SOURCE DunNoteHandler.cpp
-SOURCE DunUtils.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc ../../atext/inc
-USERINCLUDE ../../../inc
-
-LIBRARY bafl.lib
-#ifdef PRJ_USE_NETWORK_STUBS
-LIBRARY c32comm_stub.lib
-LIBRARY etelmm_stub.lib
-#else
-LIBRARY c32.lib
-LIBRARY etel.lib
-LIBRARY etelmm.lib
-#endif
-LIBRARY esock.lib
-LIBRARY dunatext.lib
-LIBRARY efsrv.lib
-LIBRARY euser.lib
-LIBRARY HbWidgets.lib
-
-DEBUGLIBRARY flogger.lib
--- a/localconnectivityservice/dun/utils/inc/DunChanMan.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,407 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: RComm channel management related functionality (waiter)
-*
-*/
-
-
-#ifndef C_CDUNCHANMAN_H
-#define C_CDUNCHANMAN_H
-
-#include "DunTransUtils.h"
-#include "DunTransporter.h"
-
-class CDunSignalWaiter;
-class CDunDataWaiter;
-
-/**
- * Class for CDunDataWaiter's and CDunSignalWaiter's connection monitoring
- * support
- * When CDunDataWaiter or CDunSignalWaiter detects activity, data in this
- * class is used as helper data to create subsequent calls to
- * CDunTransporter::AddConnMonCallbackL
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunConnMonCallback )
- {
-
-public:
-
- /**
- * Callback to call when notification via MDunConnMon to be made
- * (CDunTransporter::AddConnMonCallbackL, aCallback parameter)
- * Not own.
- */
- MDunConnMon* iCallback;
-
- /**
- * Direction where to add connection monitor
- * (CDunTransporter::AddConnMonCallbackL, aDirection parameter)
- */
- TDunDirection iDirection;
-
- };
-
-/**
- * Class for CDunDataWaiter's and CDunSignalWaiter's connection monitoring
- * support
- * When CDunConnWaiter or CDunSignalWaiter detects activity, data in this
- * class is used as helper data to create subsequent calls to
- * CDunTransporter::AddSkippedErrorL
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunSkippedError )
- {
-
-public:
-
- /**
- * Error code of read/write condition that should be skipped
- * (CDunTransporter::AddSkippedErrorL, aError parameter)
- */
- TInt iError;
-
- /**
- * Direction of read/write error condition
- * (CDunTransporter::AddSkippedErrorL, aDirection parameter)
- */
- TDunDirection iDirection;
-
- };
-
-/**
- * Class for CDunDataWaiter's or CDunSignalWaiter's connection monitoring
- * support
- * When CDunDataWaiter or CDunSignalWaiter detects activity, data in this
- * class is used as helper
- * data to create subsequent calls to the following APIs
- * CDunTransporter::AddConnMonCallbackL
- * CDunTransporter::AddSkippedErrorL
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunWaiterData )
- {
-
-public:
-
- /**
- * RComm object of local media side
- * Not own.
- */
- RComm* iComm;
-
- /**
- * Name for the channel
- */
- HBufC8* iChannelName;
-
- /**
- * Signal waiter object for a channel
- * Not own.
- */
- CDunSignalWaiter* iSignalWaiter;
-
- /**
- * Data waiter object for a channel
- * Not own.
- */
- CDunDataWaiter* iDataWaiter;
-
- /**
- * Pointer to object implementing buffer correction
- * Not own.
- */
- MDunBufferCorrection* iCorrection;
-
- /**
- * Connection monitor raw data that will be added to TDunChannelData array
- * after activity detected by iDataWaiter or iSignalWaiter
- */
- RArray<TDunConnMonCallback> iConnMons;
-
- /**
- * Skipped error raw data that will be added to TDunChannelData array
- * after activity detected by iDataWaiter or iSignalWaiter
- */
- RArray<TDunSkippedError> iOkErrors;
-
- /**
- * Flag to indicate whether enqueued channel allocation required.
- * Second option is to use service advertisement API.
- */
- TBool iEnqueuedFail;
-
- /**
- * UID of plugin that allocated this channel
- * Used for making notification via MDunPluginManager callback
- * Added to TDunChannelData array after activity detected by iDataWaiter
- */
- TUid iOwnerUid;
-
- };
-
-/**
- * Notification interface class for creating new channel
- * Used by CDunDataWaiter ro CDunSignalWaiter to create new channel when
- * activity is detected
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunChannelAllocator )
- {
-
-public:
-
- /**
- * CDunTransporter callback: gets called when waiter wants new channel
- *
- * @since S60 3.2
- * @param aComm Connection where new data exists
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyNewChannelRequest( RComm* aComm ) = 0;
-
- };
-
-/**
- * Class for RComm channel management related functionality (waiter)
- * activity is detected by CDunDataWaiter or CDunSignalWaiter objects
- * Also takes care of waiter object creation.
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunChanMan ) : public CBase,
- public MDunChannelAllocator
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aParent Parent class owning this friend class (CDunTransporter)
- * @param aUtility Pointer to common utility class
- * @param aUtilityAux Pointer to other than CDunTransporter utility class
- * @param aPluginManager Callback to call when notification via
- * MDunPluginManager to be made
- * @return Instance of self
- */
- static CDunChanMan* NewL( CDunTransporter& aParent,
- MDunTransporterUtility* aUtility,
- MDunTransporterUtilityAux* aUtilityAux,
- MDunPluginManager* aPluginManager );
-
- /**
- * Destructor.
- */
- virtual ~CDunChanMan();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Number of waiters
- *
- * @since S60 3.2
- * @return Number of waiters
- */
- TInt NumberOfWaiters();
-
- /**
- * Gets number of waiters by owner UID
- *
- * @since S60 5.0
- * @param aOwnerUid UID of the channel owner
- * @return Number of waiters
- */
- TInt GetNumberOfWaitersByUid( TUid aOwnerUid );
-
- /**
- * Adds new connection waiter to connection waiter array
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @param aOwnerUid UID of the channel owner
- * @param aName Name for the channel
- * @param aEnqueuedFail ETrue if enqueued failure, EFalse otherwise
- * @param aCorrection Pointer to object implementing buffer correction
- * @return None
- */
- void AddConnWaiterL( RComm* aComm,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- MDunBufferCorrection* aCorrection );
-
- /**
- * Removes existing waiter from connection waiter array
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return KErrNotFound if waiter not found, KErrNone if removed
- */
- TInt RemoveConnWaiter( RComm* aComm );
-
- /**
- * Makes CDunDataWaiter and CDunSignalWaiter ready to detect activity
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return KErrNotFound if waiter not found, KErrNone if request issued
- */
- TInt IssueConnWaiterRequest( RComm* aComm );
-
- /**
- * Stops CDunDataWaiter and CDunSignalWaiter to detect new data
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return KErrNotFound if waiter not found, KErrNone if stopped
- */
- TInt StopConnWaiter( RComm* aComm );
-
- /**
- * Saves waiter's connection monitor callback data
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @param aCallback Pointer to object whose callbacks will be called
- * @param aDirection Direction of operation to monitor for read/write
- * error
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SaveWaiterConnMonCallbackL( RComm* aComm,
- MDunConnMon* aCallback,
- TDunDirection aDirection );
-
- /**
- * Saves waiter's skipped error data
- *
- * @since S60 3.2
- * @param aError Error code to consider as "no error"
- * @param aComm Pointer to opened local media RComm ID object
- * @param aDirection One of four data transfer endpoints where to add a
- * skipped error code
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SaveWaiterSkippedErrorL( TInt aError,
- RComm* aComm,
- TDunDirection aDirection );
-
-private:
-
- CDunChanMan( CDunTransporter& aParent,
- MDunTransporterUtility* aUtility,
- MDunTransporterUtilityAux* aUtilityAux,
- MDunPluginManager* aPluginManager );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Fills data for channel created by waiter
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @param aFirstFree Index to first free channel
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt FillNewWaiterChannelData(RComm* aComm, TInt aFirstFree);
-
- /**
- * Restores saved waiter data to connection data
- *
- * @since S60 3.2
- * @param aWaiterIndex Index to waiter data
- * @param aChannelIndex Index to connection data
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt RestoreWaiterData( TInt aWaiterIndex, TInt aChannelIndex );
-
- /**
- * Deletes waiter objects of aIndex:th waiters
- *
- * @since S60 3.2
- * @param aIndex Index of waiters to delete
- * @param aNewOwnership ETrue if ownership transferred, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DeleteWaiters( TInt aIndex, TBool aNewOwnership=EFalse );
-
-// from base class MDunChannelAllocator
-
- /**
- * From MDunChannelAllocator.
- * Notifies when new channel is wanted
- *
- * @since S60 3.2
- * @param aComm Connection where new data exists
- * @return KErrNone
- */
- TInt NotifyNewChannelRequest( RComm* aComm );
-
-private: // data
-
- /**
- * Parent class owning this friend class (CDunTransporter)
- */
- CDunTransporter& iParent;
-
- /**
- * Pointer to common utility class
- * Not own.
- */
- MDunTransporterUtility* iUtility;
-
- /**
- * Pointer to other than CDunTransporter utility class
- * Not own.
- */
- MDunTransporterUtilityAux* iUtilityAux;
-
- /**
- * Callback to call when notification via MDunPluginManager to be made
- * Not own.
- */
- MDunPluginManager* iPluginManager;
-
- /**
- * Waiter's data that will be added to iChannelData when waiter detects
- * read activity. After copying to iChannelData the data will be removed
- * from this array.
- */
- RArray<TDunWaiterData> iWaiterData;
-
- };
-
-#endif // C_CDUNCHANMAN_H
--- a/localconnectivityservice/dun/utils/inc/DunDataPusher.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,284 +0,0 @@
-/*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Pushes data to existing stream from outside
-*
-*/
-
-
-#ifndef C_CDUNDATAPUSHER_H
-#define C_CDUNDATAPUSHER_H
-
-#include "DunTransporter.h"
-
-class MDunCompletionReporter;
-
-/**
- * Class used for storing data related to data push
- * (data coming from MDunStreamManipulator::NotifyDataPushRequest())
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunDataPush )
- {
-
-public:
-
- /**
- * Data to push to the stream (not copied)
- */
- const TDesC8* iDataToPush;
-
- /**
- * Callback to call when data is processed by the stream
- * If this is NULL then no callback will be made
- */
- MDunCompletionReporter* iCallback;
-
- };
-
-/**
- * Class for notifications of stream manipulator's completion events
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunCompletionReporter )
- {
-
-public:
-
- /**
- * Gets called when data from
- * MDunStreamManipulator::NotifyDataPushRequest() has been processed and
- * CDunDownstream is ready to process more data.
- *
- * @since S60 5.0
- * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
- * @return None
- */
- virtual void NotifyDataPushComplete( TBool aAllPushed ) = 0;
-
- };
-
-/**
- * Class for pushing data to existing CDunDownstream stream from outside
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunDataPusher ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aParent Parent class owning this friend class (CDunDownstream)
- * @param aStreamCallback Callback to call when events processed
- * @return Instance of self
- */
- static CDunDataPusher* NewL( CDunDownstream& aParent,
- MDunCompletionReporter* aStreamCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunDataPusher();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Sets media to be used for this endpoint
- *
- * @since S60 3.2
- * @param aComm RComm pointer to use as the endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm );
-
- /**
- * Sets media to be used for this endpoint
- *
- * @since S60 3.2
- * @param aSocket RSocket pointer to use as the endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RSocket* aSocket );
-
- /**
- * Adds event notification to queue
- *
- * @since S60 3.2
- * @param aDataToPush Data to push to the stream (not copied)
- * @param aCallback Callback to call when data is processed by the stream
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddToEventQueue( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback );
-
- /**
- * Finds an event from queue
- *
- * @since S60 5.0
- * @param aDataToPush Data to push to the stream (not copied)
- * @return Index of found event, Symbian error code otherwise
- */
- TInt FindEventFromQueue( const TDesC8* aDataToPush );
-
- /**
- * Stops one event in the event queue
- *
- * @since S60 5.0
- * @param aDataToPush Data to push to the stream (not copied)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StopOneEvent( const TDesC8* aDataToPush );
-
- /**
- * Sends queued data in round robin
- *
- * @since S60 3.2
- * @return ETrue if sending started, EFalse if nothing to do
- */
- TBool SendQueuedData();
-
- /**
- * Stops sending for write endpoint
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
- /**
- * Stops sending for write endpoint and clears event queue
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StopAndClearQueue();
-
- /**
- * Signals completion status in round robin and clears event queue
- *
- * @return Symbian error code on error, KErrNone otherwise
- * @return None
- */
- TInt SignalCompletionAndClearQueue();
-
-private:
-
- CDunDataPusher( CDunDownstream& aParent,
- MDunCompletionReporter* aStreamCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Manages one event's data push
- *
- * @since S60 3.2
- * @return None
- */
- TInt ManageOneEvent();
-
- /**
- * Check whether an error code is severe error or not
- *
- * @since S60 3.2
- * @param aError Error code to check for severity
- * @param aIsError ETrue if error code is error, EFalse if not error
- * @return ETrue if severe error detected, EFalse if not severe error
- */
- TBool ProcessErrorCondition( TInt aError, TBool& aIsError );
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when endpoint data write complete
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Parent class owning this friend class (CDunDownstream)
- */
- CDunDownstream& iParent;
-
- /**
- * Callback to call when notification via MDunCompletionReporter to be made
- * Not own.
- */
- MDunCompletionReporter* iStreamCallback;
-
- /**
- * Event queue for pushed data requests
- */
- RArray<TDunDataPush> iEventQueue;
-
- /**
- * Current state of data push: active or inactive
- */
- TDunState iPushState;
-
- /**
- * Index of current event to serve
- */
- TInt iEventIndex;
-
- /**
- * RSocket object of local media side
- * If this is set then iComm is not used
- * Not own.
- */
- RSocket* iSocket;
-
- /**
- * RComm object of local media or network side
- * If this is set then iSocket is not used
- * Not own.
- */
- RComm* iComm;
-
- };
-
-#endif // C_DUNDATAPUSHER_H
--- a/localconnectivityservice/dun/utils/inc/DunDataWaiter.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors for new data in RComm local media side
-*
-*/
-
-
-#ifndef C_CDUNDATAWAITER_H
-#define C_CDUNDATAWAITER_H
-
-#include "DunChanMan.h"
-
-/**
- * Class to monitor for new data in RComm local media side
- * This class is needed to avoid unnecessary resource allocation of Dataport
- * side when number of supported Dataport ports for DUN is less than the
- * number of local media side plugins that use RComm
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunDataWaiter ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aChannelCallback Callback to call when notification via
- * MDunChannelAllocator to be made
- * @return Instance of self
- */
- static CDunDataWaiter* NewL( MDunChannelAllocator* aChannelCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunDataWaiter();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Adds callback for RunL error controlling
- * The callback will be called when error is detected in asynchronous
- * operation
- *
- * @since S60 3.2
- * @param aCallback Callback to call when line status changes
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddCallback( MDunConnMon* aCallback );
-
- /**
- * Sets media to use for this endpoint
- *
- * @since S60 3.2
- * @param aComm RComm pointer to use as the endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm );
-
- /**
- * Issues request to start waiting for new data in RComm
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops monitoring for new data
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunDataWaiter( MDunChannelAllocator* aChannelCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when new data in RComm object
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * Normally contains only one callback
- */
- RPointerArray<MDunConnMon> iCallbacks;
-
- /**
- * Callback to call when notification via MDunChannelAllocator to be made
- * Not own.
- */
- MDunChannelAllocator* iChannelCallback;
-
- /**
- * Current state of data monitoring: active or inactive
- */
- TDunState iDataWaiterState;
-
- /**
- * RComm object of local media side
- * Not own.
- */
- RComm* iComm;
-
- };
-
-#endif // C_CDUNDATAWAITER_H
--- a/localconnectivityservice/dun/utils/inc/DunDebug.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common debug functionality for this component
-*
-*/
-
-
-#ifndef DUN_DEBUG_H
-#define DUN_DEBUG_H
-
-_LIT( KComponentName, "[DUN] " );
-
-//#define FILE_LOGGING
-
-#ifdef _DEBUG
-
-#ifdef FILE_LOGGING
-
-#include <e32std.h>
-#include <f32file.h>
-#include <flogger.h>
-
-#define FTRACE(a) {a;}
-
-_LIT( KLogFile,"dun.txt" );
-_LIT( KLogDir, "dun" );
-_LIT( KLogDirFullName,"c:\\logs\\dun\\" );
-
-// Declare the FPrint function
-//
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
- {
- VA_LIST list;
- VA_START( list, aFmt );
- RFileLogger::WriteFormat( KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list );
- }
-
-inline void FPrintRaw( const TDesC8& /*aDes*/ )
- {
- }
-
-#else
-
-#include <e32svr.h>
-
-#define FTRACE(a) {a;}
-
-/**
-Overflow handler for VA_LIST parsing into a fixed size buffer to
-be printed out using RDebug.
-*/
-NONSHARABLE_CLASS( TRDebugOverflowHander ) : public TDesOverflow
-{
- /**
- The function that will get called when the buffer is over-flowed.
- In this case we just ignore the overflow, so the buffer will
- effectively be truncated.
- */
- virtual void Overflow( TDes16& /*aDes*/ ) { return; }
-};
-
-/** The maximum length of a log line (in characters) output using RDebug. */
-const TUint KRDebugMaxLineLen = 0x100;
-
-// Declare the FPrint function
-//
-
-inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
- {
- VA_LIST list;
- VA_START( list, aFmt );
- TRDebugOverflowHander overflow;
- TBuf<KRDebugMaxLineLen> buf;
- TRefByValue<const TDesC> fmt = aFmt;
- buf.Copy( KComponentName );
- buf.AppendFormatList( fmt, list, &overflow );
- RDebug::Print( buf );
- }
-
-inline void FPrintRaw( const TDesC8& aDes )
- {
- RDebug::RawPrint( aDes );
- }
-
-#endif // FILE_LOGGING
-
-// ===========================================================================
-#else // // No loggings --> Reduced binary size
-// ===========================================================================
-#define FTRACE( a )
-
-#endif // _DEBUG
-
-#endif // DUN_DEBUG_H
-
-// End of File
--- a/localconnectivityservice/dun/utils/inc/DunDownstream.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,276 +0,0 @@
-/*
-* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for one "stream" of CDunTransporter
-*
-*/
-
-
-#ifndef C_CDUNDOWNSTREAM_H
-#define C_CDUNDOWNSTREAM_H
-
-#include "DunTransUtils.h"
-#include "DunStream.h"
-#include "DunAtCmdHandler.h"
-#include "DunDataPusher.h"
-
-class MDunCompletionReporter;
-class MDunAtCmdHandler;
-
-/**
- * Class used for storing data related to data pushing
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunPushData )
- {
-
-public:
-
- /**
- * Flag for command mode notifier's MDunCmdModeMonitor callback
- * This flag is needed to mark command mode start/end
- */
- TBool iDataMode;
-
- /**
- * Data pusher for stream manipulation
- */
- CDunDataPusher* iDataPusher;
-
- /**
- * AT command handling related functionality for CDunDownstream
- * Not own.
- */
- MDunAtCmdHandler* iAtCmdHandler;
-
- };
-
-/**
- * Class for manipulating existing stream's contents from outside
- * (outside of class CDunDownstream)
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunStreamManipulator )
- {
-
-public:
-
- /**
- * Gets called when outside party wants to push data to the existing stream
- *
- * @since S60 5.0
- * @param aDataToPush Data to push to the stream (not copied)
- * @param aCallback Callback to call when data is processed by the stream
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyDataPushRequest(
- const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback ) = 0;
-
- /**
- * Checks if data is in queue
- *
- * @since TB9.2
- * @param aDataToPush Data to check
- * @return ETrue if data is in queue, EFalse otherwise
- */
- virtual TBool IsDataInQueue( const TDesC8 *aDataToPush ) = 0;
-
- };
-
-/**
- * Class for data transmission of one "stream" from network to local media
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunDownstream ) : public CDunStream,
- public MDunStreamManipulator,
- public MDunCompletionReporter,
- public MDunCmdModeMonitor
- {
-
- friend class CDunDataPusher;
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aUtility Pointer to common utility class
- * @return Instance of self
- */
- static CDunDownstream* NewL( MDunTransporterUtilityAux* aUtility );
-
- /**
- * Destructor.
- */
- virtual ~CDunDownstream();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Starts downstream by issuing read request
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StartStream();
-
- /**
- * Stops transfer for read or write endpoints
- *
- * @since S60 3.2
- * @param aStopMplex ETrue if multiplexer stop, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop( TBool aStopMplex=ETrue );
-
- /**
- * Initializes this stream for data pushing
- *
- * @since S60 3.2
- * @param aAtCmdHandler AT command handling related functionality
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitializeForDataPushing( MDunAtCmdHandler* aAtCmdHandler );
-
- /**
- * Checks if data is in queue
- *
- * @since TB9.2
- * @param aDataToPush Data to check
- * @return ETrue if data is in queue, EFalse otherwise
- */
- TBool IsDataInQueue( const TDesC8* aDataToPush );
-
- /**
- * Adds data to event queue and starts sending if needed
- *
- * @since S60 5.0
- * @param aDataToPush Data to push to the stream (not copied)
- * @param aCallback Callback to call when data is processed by the stream
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddToQueueAndSend( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback );
-
-private:
-
- CDunDownstream( MDunTransporterUtilityAux* aUtility );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Issues transfer request for this stream
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when endpoint data read complete
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunStreamManipulator
-
- /**
- * Gets called when outside party wants to push data to the existing stream
- *
- * @since S60 3.2
- * @param aDataToPush Data to push to the stream (not copied)
- * @param aCallback Callback to call when data is processed by the stream
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyDataPushRequest( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback );
-
-// from base class MDunCompletionReporter
-
- /**
- * Gets called when data push is complete
- *
- * @since S60 5.0
- * @param aAllPushed ETrue if all in the queue were pushed, EFalse otherwise
- * @return None
- */
- void NotifyDataPushComplete( TBool aAllPushed );
-
-// from base class MDunCmdModeMonitor
-
- /**
- * Notifies about command mode start
- *
- * @since S60 5.0
- * @return None
- */
- void NotifyCommandModeStart();
-
- /**
- * Notifies about command mode end
- *
- * @since S60 5.0
- * @return None
- */
- void NotifyCommandModeEnd();
-
-private: // data
-
- /**
- * Pointer to common utility class
- * Not own.
- */
- MDunTransporterUtilityAux* iUtility;
-
- /**
- * Data related to data pushing
- */
- TDunPushData iPushData;
-
- };
-
-#endif // C_CDUNDOWNSTREAM_H
--- a/localconnectivityservice/dun/utils/inc/DunNetDataport.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dataport specific network resource accessor implementation
-*
-*/
-
-
-#ifndef C_CDUNNETDATAPORT_H
-#define C_CDUNNETDATAPORT_H
-
-#include <e32base.h>
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#include <etelmm_stub.h>
-#else
-#include <etelmm.h>
-#endif
-
-/**
- * Class to store data needed for each separate "call"
- * One TDunDataportEntity entity contains objects needed for one network data
- * connection
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunDataportEntity )
- {
-
-public:
-
- /**
- * Dataport for one call
- */
- RComm iDataport;
-
- /**
- * Call for this entity
- */
- RMobileCall iMobileCall;
-
- /**
- * Specifies whether this entity is in use or not
- */
- TBool iEntityInUse;
-
- };
-
-/**
- * Class for common network resource usage
- * This class provides network side independent functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunNetwork )
- {
-
-public:
-
- /**
- * Abstract; Initializes network
- * Must be called before any other operation
- *
- * @since S60 3.2
- * @return None
- */
- virtual void InitializeL() = 0;
-
- };
-
-/**
- * Class for Dataport specific network resource usage
- * This class is provides Dataport (RComm) dependent functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunNetDataport ) : public MDunNetwork
- {
-
-public:
-
- /**
- * Abstract; Called when channel was created by transporter
- * Initializes network for channel creation
- *
- * @since S60 3.2
- * @param aComm Network ID returned when allocation successful
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt AllocateChannel( RComm*& aComm ) = 0;
-
- /**
- * Abstract; Called when channel was deleted/closed by transporter
- * Uninitializes network for channel deletion/close
- *
- * @since S60 3.2
- * @param aComm Network ID of owning entity that will be freed
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt FreeChannel( RComm* aComm ) = 0;
-
- /**
- * Gets index by network ID for Dataport
- *
- * @since S60 3.2
- * @param aComm Index to get by this network ID
- * @return Symbian error code on error, index otherwise
- */
- virtual TInt GetIndexById( RComm* aComm ) = 0;
-
- };
-
-/**
- * Class for accessing network functionality through Dataport
- * This class is needed by CDunTransporter to create abstract "channels"
- * for data communication.
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunNetDataport ) : public CBase, public MDunNetDataport
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aNumOfMaxChannels Maximum number of supported Dataport ports
- * for DUN
- * @return Instance of self
- */
- static CDunNetDataport* NewL( TInt aNumOfMaxChannels );
-
- /**
- * Destructor.
- */
- ~CDunNetDataport();
-
-// from base class MDunNetwork (MDunNetDataport -> MDunNetwork)
-
- /**
- * From MDunNetwork (MDunNetDataport -> MDunNetwork).
- * Initializes network for Dataport
- * Must be called before any other operation
- *
- * @since S60 3.2
- * @return None
- */
- void InitializeL();
-
-// from base class MDunNetDataport
-
- /**
- * From MDunNetDataport.
- * Called when channel was created by transporter for Dataport
- * Initializes network for channel creation
- *
- * @since S60 3.2
- * @param aComm Network ID returned when allocation successful
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AllocateChannel( RComm*& aComm );
-
- /**
- * From MDunNetDataport.
- * Called when channel was deleted/closed by transporter for Dataport
- * Uninitializes network for channel deletion/close
- *
- * @since S60 3.2
- * @param aComm Network ID of owning entity that will be freed
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt FreeChannel( RComm* aComm );
-
- /**
- * From MDunNetDataport.
- * Gets index by network ID for Dataport
- *
- * @since S60 3.2
- * @param aComm Index to get by this network ID
- * @return Symbian error code on error, index otherwise
- */
- TInt GetIndexById( RComm* aComm );
-
-private:
-
- CDunNetDataport( TInt aNumOfMaxChannels );
-
- void ConstructL();
-
- /**
- * Allocates phone objects for use
- *
- * @since S60 3.2
- * @return None
- */
- void AllocatePhoneObjectsL();
-
- /**
- * Initializes first free entity
- *
- * @since S60 3.2
- * @return Symbian error code on error, found index otherwise
- */
- TInt InitializeFirstFreeEntity();
-
- /**
- * Remove network entity by index
- *
- * @since S60 3.2
- * @param aIndex Index which entity to remove
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt RemoveEntity( TInt aIndex );
-
- /**
- * Deletes own internal data
- *
- * @since S60 3.2
- * @return None
- */
- void DeleteNetwork();
-
- /**
- * Deletes one network entity at index aIndex for Dataport
- *
- * @since S60 3.2
- * @param aIndex Index where to delete an entity
- * @param aCheckFree Check free status before deletion
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DeleteNetworkEntity( TInt aIndex, TBool aCheckFree );
-
-private: // data
-
- /**
- * Maximum number of supported Dataport ports for DUN
- */
- TInt iNumOfMaxChannels;
-
- /**
- * Array of abstractions of each "call".
- * One TDunDataportEntity entity contains objects needed for one network
- * data connection
- */
- RArray<TDunDataportEntity> iEntities;
-
- /**
- * Communication server needed for Dataport port opening, port information
- * fetching, and Dataport communication module loading and unloading
- */
- RCommServ iCommServer;
-
- /**
- * Telephony server needed for opening iMobilePhone mobile phone session
- * and for telephony module loading and unloading
- */
- RTelServer iTelServer;
-
- /**
- * Mobile phone server needed for opening iMobileLine mobile line session
- */
- RMobilePhone iMobilePhone;
-
- /**
- * Mobile line server needed for opening new calls to Dataport.
- * Each new call is also new network data connection
- */
- RMobileLine iMobileLine;
-
- };
-
-#endif // C_CDUNNETDATAPORT_H
--- a/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Manages note showing in UI
-*
-*/
-
-
-#ifndef C_CDUNNOTEHANDLER_H
-#define C_CDUNNOTEHANDLER_H
-
-#include <e32base.h>
-#include <hb/hbwidgets/hbdevicemessageboxsymbian.h>
-#include "DunTransporter.h"
-
-/**
- * Class for managing note showing in UI
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunNoteHandler ) : public CBase,
- public MHbDeviceMessageBoxObserver
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @return Instance of self
- */
- static CDunNoteHandler* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CDunNoteHandler();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Issues request to start showing UI note
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops showing UI note
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunNoteHandler();
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Issues request to start showing UI note
- *
- * @since S60 3.2
- * @return None
- */
- void DoIssueRequestL();
-
-// from base class MHbDeviceMessageBoxObserver
-
- // TODO: ADD DESCRIPTION HERE!
- void MessageBoxClosed( const CHbDeviceMessageBoxSymbian* aMessageBox,
- CHbDeviceMessageBoxSymbian::TButtonId aButton );
-
-private: // data
-
- /**
- * Note to show
- */
- CHbDeviceMessageBoxSymbian* iNote;
-
- /**
- * Current state of note showing: active or inactive
- */
- TDunState iNoteState;
-
- };
-
-#endif // C_CDUNNOTEHANDLER_H
--- a/localconnectivityservice/dun/utils/inc/DunPlugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,243 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common definitions and classes needed by DUN plugins
-*
-*/
-
-
-#ifndef DUN_PLUGIN_H
-#define DUN_PLUGIN_H
-
-#include <e32base.h>
-
-typedef TAny* TConnId; // supported now: RSocket*, RComm*
-
-enum TDunPluginState
- {
- EDunStateNone = KErrNotFound, // -1
- EDunStateZombie = 0, // 0
- EDunStateTryUninitialize, // 1
- EDunStateUninitialized, // 2
- EDunStateTryLoad, // 3
- EDunStateLoaded, // 4
- EDunStateTryListen, // 5
- EDunStateListening, // 6
- EDunStateTryChannel, // 7
- EDunStateChanneled // 8
- };
-
-const TInt KDunLocalMediaPluginInterfaceUidValue = 0x101F6E2D;
-const TUid KDunLocalMediaPluginInterfaceUid = { KDunLocalMediaPluginInterfaceUidValue };
-
-const TInt KDunBtPluginUidValue = 0x101F6E2B;
-const TUid KDunBtPluginUid = { KDunBtPluginUidValue };
-const TInt KDunIrPluginUidValue = 0x101FBAEB;
-const TUid KDunIrPluginUid = { KDunIrPluginUidValue };
-const TInt KDunUsbPluginUidValue = 0x101F6E2F;
-const TUid KDunUsbPluginUid = { KDunUsbPluginUidValue };
-
-class CDunTransporter;
-
-/**
- * Notification interface class to report request for plugin enqueue
- * This reqeust is made when there are not enough network resources for a
- * certain plugin's needs
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunPluginManager )
- {
-
-public:
-
- /**
- * Gets called when old plugin should be enqueued
- *
- * @since S60 3.2
- * @param aPluginUid UID of the plugin that should be enqueued
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginEnqueueRequest( TUid aPluginUid ) = 0;
-
- /**
- * Gets called when new plugin should be dequeued
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to dequeue
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginDequeueRequest( TUid aPluginUid ) = 0;
-
- /**
- * Get callen when plugin should be closed
- *
- * @since S60 3.2
- * @param aPluginUid UID of the local media plugin to close
- * @param aSelfClose ETrue if plugin closes itself, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginCloseRequest( TUid aPluginUid,
- TBool aSelfClose ) = 0;
-
- };
-
-/**
- * Interface class for accessing CDunServer's functionality
- * Shares basic interface for all plugins to use when plugin needs to access
- * server's functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunServerCallback ) : public MDunPluginManager
- {
-
-public:
-
- /**
- * Callback from plugins to server to get a plugin's state
- *
- * @since S60 3.2
- * @param aPluginUid Plugin's UID which state to get
- * @return Plugin's state
- */
- virtual TDunPluginState GetPluginStateByUid( TUid aPluginUid ) = 0;
-
- /**
- * Callback from plugins to server to set a new state
- * New state must be one more than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @param aPluginUid Plugin's UID for which to change state
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginStateChangeUp( TDunPluginState aPluginState,
- TUid aPluginUid ) = 0;
-
- /**
- * Callback from plugins to server to set a new state
- * New state must be one less than the old state
- *
- * @since S60 3.2
- * @param aPluginState New state to set for a plugin
- * @param aPluginUid Plugin's UID for which to change state
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginStateChangeDown( TDunPluginState aPluginState,
- TUid aPluginUid ) = 0;
-
- /**
- * Callback from plugins to server to restart a plugin
- * Restarting must be done by uninitialization->listening switch since
- * context is in plugin
- *
- * @since S60 3.2
- * @param aPluginUid Plugin's UID to restart
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginRestart( TUid aPluginUid ) = 0;
-
- /**
- * Callback from plugins to server to reopen a plugin from queue
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyPluginReopenRequest() = 0;
-
- };
-
-/**
- * Interface class for accessing plugins' functionality
- * Shares basic interface for server to use when server needs to access
- * plugin's functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunLocalMediaPlugin )
- {
-
-public:
-
- /**
- * Destructor. Derived class must have virtual destructor also as a plugin
- * module is always destructed via M-class.
- */
- inline virtual ~MDunLocalMediaPlugin() {};
-
- /**
- * Symbian 2nd phase constructor.
- */
- virtual void ConstructL( MDunServerCallback* aServer,
- CDunTransporter* aTransporter ) = 0;
-
- /**
- * Callback from server to plugins to notify when server changes a
- * plugin's state
- *
- * @since S60 3.2
- * @param aPluginState New changed state
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyServerStateChange( TDunPluginState aPluginState ) = 0;
-
- /**
- * Callback from server to plugins to ask for current active connection
- * (For testing purposes only)
- *
- * @since S60 5.0
- * @return Active connection, NULL otherwise
- */
- virtual TConnId ActiveConnection() = 0;
-
- };
-
-/**
- * Interface class for accessing plugin's main class when its listener
- * reports that channel can be created. Can be used also to notify plugin's
- * main class when channel can be deleted.
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunListenCallback )
- {
-
-public:
-
- /**
- * Callback from plugin's listener to plugin to notify about need to
- * allocate new channel
- *
- * @since S60 3.2
- * @param aNoFreeChan ETrue if no free channels, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyChannelAllocate( TBool& aNoFreeChans ) = 0;
-
- /**
- * Callback from plugin's listener to plugin to notify about need to free
- * an existing channel
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyChannelFree() = 0;
-
- };
-
-#endif // DUN_PLUGIN_H
--- a/localconnectivityservice/dun/utils/inc/DunSignalCopy.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-/*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Copies signals changes between network and local media
-*
-*/
-
-
-#ifndef C_CDUNSIGNALCOPY_H
-#define C_CDUNSIGNALCOPY_H
-
-#include "DunTransporter.h"
-#include "DunTransUtils.h"
-#include "DunAtCmdHandler.h"
-
-/**
- * Class for copying signal changes between to endpoints
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunSignalCopy ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @return Instance of self
- */
- static CDunSignalCopy* NewL();
-
- /**
- * Destructor.
- */
- virtual ~CDunSignalCopy();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Adds callback for line status change controlling
- * The callback will be called when RunL error is detected
- *
- * @since S60 3.2
- * @param aCallback Callback to call when line status changes
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddCallback( MDunConnMon* aCallback );
-
- /**
- * Sets media to use for this endpoint monitor
- *
- * @since S60 3.2
- * @param aComm RComm pointer to local media side
- * @param aNetwork RComm pointer to network side
- * @param aStreamType Stream type for this endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm,
- RComm* aNetwork,
- TDunStreamType aStreamType );
-
- /**
- * Issues request to start monitoring the endpoint for line status change
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops monitoring the endpoint for line status change
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunSignalCopy();
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Manages upstream signal changes
- *
- * @since S60 3.2
- * @return None
- */
- void ManageSignalChange();
-
- /**
- * Manages signal changes
- *
- * @since S60 3.2
- * @return None
- */
- void ManageSignalChangeUpstream();
-
- /**
- * Manages downstream signal changes
- *
- * @since S60 3.2
- * @return None
- */
- void ManageSignalChangeDownstream();
-
- /**
- * Changes upstream signal
- *
- * @since S60 5.0
- * @param aSetMask Set the handshaking lines in the mask
- * @param aClearMask Clear the handshaking lines in the mask
- * @return None
- */
- void ChangeUpstreamSignal( TUint aSetMask, TUint aClearMask );
-
- /**
- * Changes downstream signal
- *
- * @since S60 3.2
- * @param aSetMask Set the handshaking lines in the mask
- * @param aClearMask Clear the handshaking lines in the mask
- * @return None
- */
- void ChangeDownstreamSignal( TUint aSetMask, TUint aClearMask );
-
-// from base class CActive
-
- /*
- * From CActive.
- * Gets called when line status changes
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * Normally contains only one callback
- */
- RPointerArray<MDunConnMon> iCallbacks;
-
- /**
- * Callback(s) to call when command mode starts or ends
- * Usually two needed: one for upstream and second for downstream
- */
- RPointerArray<MDunCmdModeMonitor> iCmdCallbacks;
-
- /**
- * Used media context: network or local
- */
- TDunMediaContext iContextInUse;
-
- /**
- * Used stream type: upstream or downstream
- */
- TDunStreamType iStreamType;
-
- /**
- * Current state of connection monitoring: active or inactive
- */
- TDunState iSignalCopyState;
-
- /**
- * Signal to listen with RComm::NotifySignalChange()
- */
- TUint iListenSignals;
-
- /**
- * Signals set when RComm::NotifySignalChange() request completes
- */
- TUint iSignals;
-
- /**
- * RComm object of network side
- * Not own.
- */
- RComm* iNetwork;
-
- /**
- * RComm object of local media side
- * Not own.
- */
- RComm* iComm;
-
- };
-
-#endif // C_CDUNSIGNALCOPY_H
--- a/localconnectivityservice/dun/utils/inc/DunSignalNotify.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors signal changes on network side and reports changes
-*
-*/
-
-
-#ifndef C_CDUNSIGNALNOTIFY_H
-#define C_CDUNSIGNALNOTIFY_H
-
-#include "DunTransUtils.h"
-#include "DunAtCmdHandler.h"
-
-/**
- * Class for monitoring line status and reporting changes
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunSignalNotify ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aUtility Pointer to common utility class
- * @return Instance of self
- */
- static CDunSignalNotify* NewL( MDunTransporterUtilityAux* aUtility );
-
- /**
- * Destructor.
- */
- virtual ~CDunSignalNotify();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Adds callback for line status change controlling
- * The callback will be called when line status change is detected in
- * endpoint
- *
- * @since S60 3.2
- * @param aCallback Callback to call when line status changes
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddCallback( MDunConnMon* aCallback );
-
- /**
- * Sets media to use for this endpoint monitor (network side)
- *
- * @since S60 3.2
- * @param aComm RComm pointer to use as the endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm );
-
- /**
- * Issues request to start monitoring the endpoint for line status change
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops monitoring the endpoint for line status change
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunSignalNotify( MDunTransporterUtilityAux* aUtility );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Manages signal changes
- *
- * @since S60 3.2
- * @return None
- */
- void ManageSignalChange();
-
- /**
- * Reports signal change
- *
- * @since S60 3.2
- * @param aSetMask Set the handshaking lines in the mask
- * @param aClearMask Clear the handshaking lines in the mask.
- * @return None
- */
- void ReportSignalChange( TUint aSetMask, TUint aClearMask );
-
-// from base class CActive
-
- /*
- * From CActive.
- * Gets called when line status changes
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * Normally contains only one callback
- */
- RPointerArray<MDunConnMon> iCallbacks;
-
- /**
- * Pointer to common utility class
- * Not own.
- */
- MDunTransporterUtilityAux* iUtility;
-
- /**
- * Current state of signal monitoring: active or inactive
- */
- TDunState iSignalNotifyState;
-
- /**
- * Signals to listen with RComm::NotifySignalChange()
- */
- TUint iListenSignals;
-
- /**
- * Signals set when RComm::NotifySignalChange() request completes
- */
- TUint iSignals;
-
- /**
- * RComm object of network side
- * Not own.
- */
- RComm* iNetwork;
-
- };
-
-#endif // C_CDUNSIGNALNOTIFY_H
--- a/localconnectivityservice/dun/utils/inc/DunSignalWaiter.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors for signal change in RComm local media side
-*
-*/
-
-
-#ifndef C_CDUNSIGNALWAITER_H
-#define C_CDUNSIGNALWAITER_H
-
-#include "DunChanMan.h"
-
-/**
- * Class to monitor for signal change in RComm local media side
- * This class is needed to avoid unnecessary resource allocation of Dataport
- * side when number of supported Dataport ports for DUN is less than the
- * number of local media side plugins that use RComm
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunSignalWaiter ) : public CActive
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aChannelCallback Callback to call when notification via
- * MDunChannelAllocator to be made
- * @return Instance of self
- */
- static CDunSignalWaiter* NewL( MDunChannelAllocator* aChannelCallback );
-
- /**
- * Destructor.
- */
- virtual ~CDunSignalWaiter();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Adds callback for RunL error controlling
- * The callback will be called when error is detected in asynchronous
- * operation
- *
- * @since S60 3.2
- * @param aCallback Callback to call when line status changes
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddCallback( MDunConnMon* aCallback );
-
- /**
- * Sets media to use for this endpoint
- *
- * @since S60 3.2
- * @param aComm RComm pointer to use as the endpoint
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm );
-
- /**
- * Issues request to start waiting for new data in RComm
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Stops monitoring for new data
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
-private:
-
- CDunSignalWaiter( MDunChannelAllocator* aChannelCallback );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when new data in RComm object
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-private: // data
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * Normally contains only one callback
- */
- RPointerArray<MDunConnMon> iCallbacks;
-
- /**
- * Callback to call when notification via MDunChannelAllocator to be made
- * Not own.
- */
- MDunChannelAllocator* iChannelCallback;
-
- /**
- * Current state of data monitoring: active or inactive
- */
- TDunState iSignalWaiterState;
-
- /**
- * Signals set when RComm::NotifySignalChange() request completes
- */
- TUint iSignals;
-
- /**
- * RComm object of local media side
- * Not own.
- */
- RComm* iComm;
-
- };
-
-#endif // C_CDUNSIGNALWAITER_H
--- a/localconnectivityservice/dun/utils/inc/DunStream.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for common stream functionality
-*
-*/
-
-
-#ifndef C_CDUNSTREAM_H
-#define C_CDUNSTREAM_H
-
-#include "DunTransporter.h"
-
-/**
- * Class for common stream functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunStream ) : public CActive
- {
-
-public:
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Adds error code to consider as "no error" to either endpoint
- *
- * @since S60 3.2
- * @param aError Error code to add
- * @param aOperationType Type of operation for which to add error
- * (read or write)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddSkippedError( TInt aError, TDunOperationType aOperationType );
-
- /**
- * Adds callback for line status change controlling
- * The callback will be called when serious read error is detected
- *
- * @since S60 3.2
- * @param aCallback Callback to call when read error occurs
- * @param aOperationType Type of operation for which to add error
- * (read or write)
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt AddConnMonCallback( MDunConnMon* aCallback,
- TDunOperationType aOperationType );
-
- /**
- * Sets buffering for this stream
- *
- * @since S60 3.2
- * @param aBufferPtr Pointer to the buffer
- * @return KErrGeneral if buffer pointer null, KErrNone otherwise
- */
- TInt SetBuffering( TPtr8* aBufferPtr );
-
- /**
- * Sets media to be used for this endpoint
- *
- * @since S60 3.2
- * @param aComm RComm pointer to use as the endpoint
- * @param aMediaContext Media context to use for this endpoint, either
- * local or network
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RComm* aComm, TDunMediaContext aMediaContext );
-
- /**
- * Sets media to be used for this endpoint
- *
- * @since S60 3.2
- * @param aSocket RSocket pointer to use as the endpoint
- * @param aMediaContext Media context to use for this endpoint, either
- * local or network
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt SetMedia( RSocket* aSocket, TDunMediaContext aMediaContext );
-
- /**
- * Gets media context
- *
- * @since S60 3.2
- * @param aStreamType Stream type
- * @return Media context in use
- */
- TDunMediaContext GetMediaContext( TDunStreamType aStreamType );
-
-protected:
-
- CDunStream();
-
- /**
- * Destructor.
- */
- virtual ~CDunStream();
-
- /**
- * Check whether an error code is severe error or not
- *
- * @since S60 3.2
- * @param aError Error code to check for severity
- * @param aIsError ETrue if error code is error, EFalse if not error
- * @return ETrue if severe error detected, EFalse if not severe error
- */
- TBool ProcessErrorCondition( TInt aError, TBool& aIsError );
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when endpoint data read/write complete
- *
- * @since S60 3.2
- * @return None
- */
- virtual void RunL() {};
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- virtual void DoCancel() {};
-
-private:
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
-protected: // data
-
- /**
- * Pointer to stream's data buffer: upstream or downstream
- * Not own.
- */
- TPtr8* iBufferPtr;
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * These callbacks are called on read failures
- */
- RPointerArray<MDunConnMon> iCallbacksR;
-
- /**
- * Callback(s) to call when notification(s) via MDunConnMon to be made
- * These callbacks are called on write failures
- */
- RPointerArray<MDunConnMon> iCallbacksW;
-
- /**
- * Read length set when RSocket::RecvOneOrMore() request completes
- */
- TSockXfrLength iReadLengthSocket;
-
- /**
- * Type of current operation: read or write
- */
- TDunOperationType iOperationType;
-
- /**
- * Current state of transfer: active or inactive
- */
- TDunState iTransferState;
-
- /**
- * Direction of data transfer
- * This is set after iStreamType and iOperationType are known
- */
- TDunDirection iDirection;
-
- /**
- * Array of error codes that will be skipped for read operations
- */
- RArray<TInt> iOkErrorsR;
-
- /**
- * Array of error codes that will be skipped for write operations
- */
- RArray<TInt> iOkErrorsW;
-
- /**
- * RComm object of network side
- * Not own.
- */
- RComm* iNetwork;
-
- /**
- * RSocket object of local media side
- * If this is set then iComm is not used
- * Not own.
- */
- RSocket* iSocket;
-
- /**
- * RComm object of local media side
- * If this is set then iSocket is not used
- * Not own.
- */
- RComm* iComm;
-
- };
-
-#endif // C_CDUNSTREAM_H
--- a/localconnectivityservice/dun/utils/inc/DunTransUtils.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,531 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Utility class for other CDunTransporter classes
-*
-*/
-
-
-#ifndef C_CDUNTRANSUTILS_H
-#define C_CDUNTRANSUTILS_H
-
-#include "DunTransporter.h"
-
-/**
- * Notification interface class for managing channel's activity
- * This class is needed to update KPSUidDialupConnStatus pub&sub key
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunActivityManager )
- {
-
-public:
-
- /**
- * CDunTransporter callback: gets called when activity is detected on a
- * channel
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt NotifyChannelActivity() = 0;
-
- /**
- * CDunTransporter callback: gets called when inactivity is detected on a
- * channel
- *
- * @since S60 3.2
- * @return KErrGeneral if mismatch in channel activity, KErrNone otherwise
- */
- virtual TInt NotifyChannelInactivity() = 0;
-
- };
-
-/**
- * Utility accessor class for CDunTransporter class itself
- * Shares basic functionality of CDunTransporter by simplifying it
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunTransporterUtility )
- {
-
-public:
-
- /**
- * Initializes first free channel
- *
- * @since S60 3.2
- * @param aLocalIdNew Identifier of the new local endpoint
- * @return Symbian error code on error, found index otherwise
- */
- virtual TInt InitializeFirstFreeChannel( TConnId aLocalIdNew ) = 0;
-
- /**
- * Allocates a channel by creating and setting local media independent
- * objects
- * This is a common method used by exported local media dependent methods
- *
- * @since S60 3.2
- * @param aBufferLength Buffer length selected for this channel
- * @param aFirstFree Index to first free channel data
- * @param aCorrection Pointer to object implementing buffer correction
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual void DoAllocateChannelL(
- RComm* aComm,
- TInt& aBufferLength,
- TInt aFirstFree,
- MDunBufferCorrection* aCorrection ) = 0;
-
- /**
- * Adds connection monitor callback for either local media or network side
- * by connection ID
- * Error will be added to aIndex:th endpoint
- *
- * @since S60 3.2
- * @param aIndex Index where to add new connection monitor callback
- * @param aCallback Pointer to object whose callbacks will be called
- * @param aDirection Direction of operation to monitor for read/write error
- * @param aSignal Receive also signal change if ETrue
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoAddConnMonCallback( TInt aIndex,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal ) = 0;
-
- /**
- * Adds error to consider as no error condition when doing any of the four
- * endpoint's read/writer operation
- * Error will be added to aIndex:th endpoint
- *
- * @since S60 3.2
- * @param aIndex Index where to add new "no error" code
- * @param aError Error code to consider as "no error"
- * @param aDirection One of four data transfer endpoints where to add a
- * skipped error code
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoAddSkippedError( TInt aIndex,
- TInt aError,
- TDunDirection aDirection ) = 0;
-
- /**
- * Issues transfers requests for aIndex:th transfer objects
- *
- * @since S60 3.2
- * @param aIndex Index to transfer objects that will be activated
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoIssueTransferRequests( TInt aIndex ) = 0;
-
- /**
- * Stops transfers for aIndex:th transfer objects
- *
- * @since S60 3.2
- * @param aIndex Index to transfer objects that will be stopped
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoStopTransfers( TInt aIndex ) = 0;
-
- /**
- * Free aIndex:th channel's objects
- *
- * @since S60 3.2
- * @param aIndex Index of channel to free
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoFreeChannel( TInt aIndex ) = 0;
-
- };
-
-/**
- * Utility accessor class for other than CDunTransporter classes
- * Basically a collection of miscellaneous helper methods
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunTransporterUtilityAux )
- {
-
-public:
-
- /**
- * Gets local ID counterpart of a network ID
- *
- * @since S60 3.2
- * @param aComm Network ID to search for
- * @return Null if ID not found, otherwise found ID
- */
- virtual TConnId GetLocalId( RComm* aComm ) = 0;
-
- /**
- * Notifies when serious read/write error is detected on a connection
- *
- * @since S60 3.2
- * @param aComm Non-null if error on RComm
- * @param aSocket Non-null if error on RSocket
- * @param aConnReason Reason of connection error
- * @param aCallbacks Callbacks to notify on connections error
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt DoNotifyConnectionNotOk(
- RComm* aComm,
- RSocket* aSocket,
- TDunConnectionReason& aConnReason,
- RPointerArray<MDunConnMon>& aCallbacks) = 0;
-
- };
-
-/**
- * Utility class for other CDunTransporter classes
- * This class implements basic functionality that is shared by different
- * CDunTransporter classes, also for simplifying CDunTransporter itself
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunTransUtils ) : public CBase,
- public MDunActivityManager,
- public MDunTransporterUtility,
- public MDunTransporterUtilityAux
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aParent Parent class owning this friend class (CDunTransporter)
- * @param aPluginManager Callback to call when notification via
- * MDunPluginManager to be made
- * @return Instance of self
- */
- static CDunTransUtils* NewL( CDunTransporter& aParent,
- MDunPluginManager* aPluginManager );
-
- /**
- * Destructor.
- */
- virtual ~CDunTransUtils();
-
-private:
-
- CDunTransUtils( CDunTransporter& aParent,
- MDunPluginManager* aPluginManager );
-
- void ConstructL();
-
- /**
- * Manages service advertisement status changes
- *
- * @since S60 5.0
- * @param aAdvertise New advertisement status
- * @param aCreation ETrue if channel creation
- * EFalse if channel free
- * @return None
- */
- void ManageAdvertisementStatusChange( TBool aAdvertise,
- TBool aCreation=EFalse );
-
- /**
- * Creates empty channel data
- *
- * @since S60 3.2
- * @param aChannel Channel data to set empty
- * @return None
- */
- void CreateEmptyChannelData( TDunChannelData& aChannel );
-
- /**
- * Creates new buffer if source buffer defined, otherwise already existing
- * buffer will be used
- *
- * @since S60 3.2
- * @param aSrcBuffer Source buffer
- * @param aSrcPtr Pointer to source buffer
- * @param aDstBuffer Destination buffer
- * @param aDstPtr Pointer to destination buffer
- * @param aItemsInCs Items in cleanup stack, will be incremented if
- * necessary
- * @return None
- */
- void DoCreateBufferLC( TUint8* aSrcBuffer,
- TPtr8* aSrcPtr,
- TUint8*& aDstBuffer,
- TPtr8*& aDstPtr,
- TInt aBufferLength,
- TInt& aItemsInCs );
-
- /**
- * Creates new signal copy object if source defined, otherwise
- * already existing will be used
- *
- * @since S60 3.2
- * @param aSrcSignalCopy Source signal copy object
- * @param aDstSignalCopy Destination signal copy object
- * @param aItemsInCs Items in cleanup stack, will be incremented if
- * necessary
- * @return None
- */
- void DoCreateSignalCopyLC( CDunSignalCopy* aSrcSignalCopy,
- CDunSignalCopy*& aDstSignalCopy,
- TInt& aItemsInCs );
-
- /**
- * Creates new signal notify object if source defined, otherwise
- * already existing will be used
- *
- * @since S60 3.2
- * @param aSrcSignalNotify Source signal notify object
- * @param aDstSignalNotify Destination signal notify object
- * @param aItemsInCs Items in cleanup stack, will be incremented if
- * necessary
- * @return None
- */
- void DoCreateSignalNotifyLC( CDunSignalNotify* aSrcSignalNotify,
- CDunSignalNotify*& aDstSignalNotify,
- TInt& aItemsInCs );
-
- /**
- * Creates transfer objects for reader and writer if sources defined,
- * otherwise already existing ones will be used
- *
- * @since S60 3.2
- * @param aSrcReader Source reader object
- * @param aDstReader Destination reader object
- * @param aItemsInCs Items in cleanup stack, will be incremented if
- * necessary
- * @return None
- */
- void DoCreateUpTransferObjectL( CDunUpstream* aSrcReader,
- CDunUpstream*& aDstReader,
- TInt& aItemsInCs );
-
- /**
- * Creates transfer objects for reader and writer if sources defined,
- * otherwise already existing ones will be used
- *
- * @since S60 3.2
- * @param aSrcReader Source reader object
- * @param aDstReader Destination reader object
- * @param aItemsInCs Items in cleanup stack, will be incremented if
- * necessary
- * @return None
- */
- void DoCreateDownTransferObjectL( CDunDownstream* aSrcReader,
- CDunDownstream*& aDstReader,
- TInt& aItemsInCs );
-
- /**
- * Resets/frees network data of aIndex:th channel
- *
- * @since S60 3.2
- * @param aIndex Index of channel to reset/free
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DeleteOneNetworkData( TInt aIndex );
-
- /**
- * Deletes local data of aIndex:th channel
- *
- * @since S60 3.2
- * @param aIndex Index of channel to delete
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DeleteOneLocalData( TInt aIndex );
-
- /**
- * Deletes buffering objects of aIndex:th channel
- *
- * @since S60 3.2
- * @param aIndex Index of channel to delete
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DeleteBuffering( TInt aIndex );
-
-// from base class MDunTransporterUtility
-
- /**
- * From MDunTransporterUtility.
- * Initializes first free channel
- *
- * @since S60 3.2
- * @param aLocalIdNew Identifier of the new local endpoint
- * @return Symbian error code on error, found index otherwise
- */
- TInt InitializeFirstFreeChannel( TConnId aLocalIdNew );
-
- /**
- * From MDunTransporterUtility.
- * Allocates a channel by creating and setting local media independent
- * objects
- * This is a common method used by exported local media dependent methods
- *
- * @since S60 3.2
- * @param aBufferLength Buffer length selected for this channel
- * @param aFirstFree Index to first free channel data
- * @param aCorrection Pointer to object implementing buffer correction
- * @return Symbian error code on error, KErrNone otherwise
- */
- void DoAllocateChannelL( RComm* aComm,
- TInt& aBufferLength,
- TInt aFirstFree,
- MDunBufferCorrection* aCorrection );
-
- /**
- * From MDunTransporterUtility.
- * Adds connection monitor callback for either local media or network side
- * by connection ID
- * Connection monitor will be added to aIndex:th endpoint
- *
- * @since S60 3.2
- * @param aIndex Index where to add new connection monitor callback
- * @param aCallback Pointer to object whose callbacks will be called
- * @param aDirection Direction of operation to monitor for read/write error
- * @param aSignal Receive also signal change if ETrue
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoAddConnMonCallback( TInt aIndex,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal );
-
- /**
- * From MDunTransporterUtility.
- * Adds error to consider as no error condition when doing any of the four
- * endpoint's read/writer operation
- * Error will be added to aIndex:th endpoint
- *
- * @since S60 3.2
- * @param aIndex Index where to add new "no error" code
- * @param aError Error code to consider as "no error"
- * @param aDirection One of four data transfer endpoints where to add a
- * skipped error code
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoAddSkippedError( TInt aIndex,
- TInt aError,
- TDunDirection aDirection );
-
- /**
- * From MDunTransporterUtility.
- * Issues transfers requests for aIndex:th transfer objects
- *
- * @since S60 3.2
- * @param aIndex Index to transfer objects that will be activated
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoIssueTransferRequests( TInt aIndex );
-
- /**
- * From MDunTransporterUtility.
- * Stops transfers for aIndex:th transfer objects
- *
- * @since S60 3.2
- * @param aIndex Index to transfer objects that will be stopped
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoStopTransfers( TInt aIndex );
-
- /**
- * From MDunTransporterUtility.
- * Free aIndex:th channel's objects
- *
- * @since S60 3.2
- * @param aIndex Index of channel to free
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoFreeChannel( TInt aIndex );
-
-// from base class MDunTransporterUtilityAux
-
- /**
- * From MDunTransporterUtilityAux.
- * Gets local ID counterpart of a network ID
- *
- * @since S60 3.2
- * @param aComm Network ID to search for
- * @return Null if ID not found, otherwise found ID
- */
- TConnId GetLocalId( RComm* aComm );
-
- /**
- * From MDunTransporterUtilityAux.
- * Notifies when serious read/write error is detected on a connection
- *
- * @since S60 3.2
- * @param aComm Non-null if error on RComm
- * @param aSocket Non-null if error on RSocket
- * @param aConnReason Reason of connection error
- * @param aCallbacks Callbacks to notify on connections error
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt DoNotifyConnectionNotOk(
- RComm* aComm,
- RSocket* aSocket,
- TDunConnectionReason& aConnReason,
- RPointerArray<MDunConnMon>& aCallbacks);
-
-// from base class MDunActivityManager
-
- /**
- * From MDunActivityManager.
- * Notifies about activity on a channel
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelActivity();
-
- /**
- * From MDunActivityManager.
- * Notifies about inactivity on a channel
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt NotifyChannelInactivity();
-
-private: // data
-
- /**
- * Parent class owning this friend class (CDunTransporter)
- */
- CDunTransporter& iParent;
-
- /**
- * Array of abstractions of each "channel" (from parent iParent)
- * One TDunChannelData entry contains objects needed for one channel
- */
- RArray<TDunChannelData>& iChannelData;
-
- /**
- * Array of service advertisement data for each plugin (from parent iParent)
- * One TDunServAdvData entry contains objects needed for one plugin
- */
- RArray<TDunServAdvData>& iServAdvData;
-
- /**
- * Callback to call when notification via MDunPluginManager to be made
- * Not own.
- */
- MDunPluginManager* iPluginManager;
-
- };
-
-#endif // C_CDUNTRANSUTILS_H
--- a/localconnectivityservice/dun/utils/inc/DunTransporter.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,800 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Managing abstracted "channels" of network side communication
-*
-*/
-
-
-#ifndef C_CDUNTRANSPORTER_H
-#define C_CDUNTRANSPORTER_H
-
-#include <e32base.h>
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#else
-#include <c32comm.h>
-#endif
-#include <es_sock.h>
-#include "DunNetDataport.h"
-
-typedef TAny* TConnId; // supported now: RSocket*, RComm*
-
-const TInt KDunStreamTypeMask = 0x02; // 10
-const TInt KDunOperationTypeMask = 0x01; // 01
-
-enum TDunOperationType
- {
- EDunOperationTypeUndefined = KErrNotFound,
- EDunOperationTypeRead = 0x00, // 00
- EDunOperationTypeWrite = 0x01 // 01
- };
-
-enum TDunMediaContext
- {
- EDunMediaContextUndefined = KErrNotFound,
- EDunMediaContextNetwork = 0,
- EDunMediaContextLocal
- };
-
-enum TDunMedia
- {
- EDunMediaUndefined = KErrNotFound,
- EDunMediaNetwork = 0,
- EDunMediaRComm,
- EDunMediaRSocket
- };
-
-enum TDunDirection
- {
- EDunDirectionUndefined = KErrNotFound,
- EDunReaderUpstream = 0x00, // 00
- EDunWriterUpstream = 0x01, // 01
- EDunReaderDownstream = 0x02, // 10
- EDunWriterDownstream = 0x03 // 11
- };
-
-enum TDunStreamType
- {
- EDunStreamTypeUndefined = KErrNotFound,
- EDunStreamTypeUpstream = 0x00, // 00
- EDunStreamTypeDownstream = 0x02 // 10
- };
-
-enum TDunState
- {
- EDunStateIdle,
- EDunStateTransferring, // Transporter state for data tranfer (up/downstream)
- EDunStateSignalCopy, // Transporter state for signal copying (RComm)
- EDunStateSignalNotify, // Transporter state for signal notifying (RSocket)
- EDunStateDataWaiting, // Transporter state for data waiting
- EDunStateSignalWaiting, // Transporter state for signal waiting
- EDunStateDataPushing, // Transporter state for data pushing (multiplexer)
- EDunStateCallListen, // Transporter state for call state listening
- EDunStateAtCmdHandling, // ATEXT state for AT command handling
- EDunStateAtCmdPushing, // ATEXT state for AT command reply pushing
- EDunStateAtCmdEchoing, // ATEXT state for AT command character echoing (text mode)
- EDunStateAtUrcHandling, // ATEXT state for URC handling
- EDunStateModeListening, // ATEXT state for mode change listening
- EDunStateEcomListening, // ATEXT state for ECOM change listening
- EDunStateNvramListening, // ATEXT state for NVRAM change listening
- EDunStateUiNoting // Transporter state for UI note showing
- };
-
-enum TDunReasonType
- {
- EDunReasonTypeSignal,
- EDunReasonTypeRW,
- EDunReasonTypeRunL
- };
-
-class CDunChanMan;
-class MDunPluginManager;
-class MDunTransporterUtility;
-class CDunTransUtils;
-class CDunConnWaiter;
-class TDunWaiterData;
-class CDunUpstream;
-class CDunDownstream;
-class CDunSignalCopy;
-class CDunSignalNotify;
-class CDunNoteHandler;
-
-/**
- * Class used for reporting connection error's reason and signal changes
- * of network side
- * Connection error can happen in read/write and RunL error cases
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunConnectionReason )
- {
-
-public:
-
- /**
- * Reason type of error; either R/W or RunL
- * or signal (network side)
- * Set in all cases (signal, R/W, RunL)
- */
- TDunReasonType iReasonType;
-
- /**
- * Context of media where error occurred: network or local
- * Set in all error cases (signal, R/W, RunL)
- */
- TDunMediaContext iContext;
-
- /**
- * Signal type of network side
- * Set if signal case, 0 otherwise
- */
- TUint iSignalType;
-
- /**
- * Is signal high or low of network side
- * Set if signal case, 0 otherwise
- */
- TBool iSignalHigh;
-
- /**
- * Direction of data transfer
- * Set if R/W case, EDunDirectionUndefined otherwise
- */
- TDunDirection iDirection;
-
- /**
- * Error code of failure
- * Set if R/W or RunL case, KErrNone otherwise
- */
- TInt iErrorCode;
-
- };
-
-/**
- * Notification interface class to report line status
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunConnMon )
- {
-
-public:
-
- /**
- * Gets called when line status changes or when any type of error is
- * detected
- *
- * @since S60 3.2
- * @param aConnId Connection ID for callback
- * @param aConnReason Reason for progress change
- * @return None
- */
- virtual void NotifyProgressChangeL(
- TConnId aConnId,
- TDunConnectionReason aConnReason ) = 0;
-
- };
-
-/**
- * Notification interface class to report service advertisement status changes
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunServAdvMon )
- {
-
-public:
-
- /**
- * Gets called when advertisement status changes to start
- *
- * @since S60 5.0
- * @param aCreation ETrue if channel creation
- * EFalse if channel free
- * @return None
- */
- virtual void NotifyAdvertisementStart( TBool aCreation ) = 0;
-
- /**
- * Gets called when advertisement status changes to end
- *
- * @since S60 5.0
- * @return None
- */
- virtual void NotifyAdvertisementEnd() = 0;
-
- };
-
-/**
- * Notification interface class for buffer correction
- * This interface makes possible to change suggested local media buffer size
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunBufferCorrection )
- {
-
-public:
-
- /**
- * Notifies about request to change local media's buffer size
- *
- * @since S60 3.2
- * @param aLength Suggested buffer length that will be used if no
- * correction done
- * @return New (corrected) buffer length
- */
- virtual TInt NotifyBufferCorrection( TInt aLength ) = 0;
-
- };
-
-/**
- * Class to store data needed for each separate "channel"
- * One TDunChannelData data contains objects needed for one channel
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunChannelData )
- {
-
-public:
-
- /**
- * RComm object of network side
- * Not own.
- */
- RComm* iNetwork;
-
- /**
- * RComm object of local media side
- * If this is set then iSocket is not used
- * Not own.
- */
- RComm* iComm;
-
- /**
- * RSocket object of local media side
- * If this is set then iComm is not used
- * Not own.
- */
- RSocket* iSocket;
-
- /**
- * Name for the channel
- */
- HBufC8* iChannelName;
-
- /**
- * Upstream read/write object
- * Reads data from local media and writes to network
- * Not own.
- */
- CDunUpstream* iUpstreamRW;
-
- /**
- * Downstream read/write object
- * Reads data from network and writes to local media
- * Not own.
- */
- CDunDownstream* iDownstreamRW;
-
- /**
- * Upstream buffer (Local -> Network)
- * Not own.
- */
- TUint8* iBufferUpstream;
-
- /**
- * Downstream buffer (Local <- Network)
- * Not own.
- */
- TUint8* iBufferDownstream;
-
- /**
- * Pointer to upstream's buffer (Local -> Network)
- * Not own.
- */
- TPtr8* iBufferUpPtr;
-
- /**
- * Pointer to downstream's buffer (Local <- Network)
- * Not own.
- */
- TPtr8* iBufferDownPtr;
-
- /**
- * Upstream signal copy
- * If this is set then iSignalNotify is not used
- * Not own.
- */
- CDunSignalCopy* iUpstreamSignalCopy;
-
- /**
- * Downstream signal copy
- * If this is set then iSignalNotify is not used
- * Not own.
- */
- CDunSignalCopy* iDownstreamSignalCopy;
-
- /**
- * Signal notifier
- * If this is set then the following are not used:
- * iUpstreamSignalCopy, iDownstreamSignalCopy
- * Not own.
- */
- CDunSignalNotify* iSignalNotify;
-
- /**
- * Owner's UID
- */
- TUid iOwnerUid;
-
- /**
- * Flag that indicates whether this channel is allocated or not
- */
- TBool iChannelInUse;
-
- };
-
-/**
- * Class to store data needed for each plugin service advertisement
- * One TDunChannelData data contains objects needed for one plugin
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunServAdvData )
- {
-
-public:
-
- /**
- * Owner's UID for which to have the monitor
- */
- TUid iOwnerUid;
-
- /**
- * Service advertisement monitor
- * Not own.
- */
- MDunServAdvMon* iServAdvMon;
-
- };
-
-/**
- * Class for managing abstracted "channels" of network side communication
- * This is main class to be used by other components
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunTransporter ) : public CBase
- {
-
- friend class CDunTransUtils;
- friend class CDunChanMan;
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aPluginManager Callback to call when notification via
- * MDunPluginManager to be made
- * @param aNumOfMaxChannels Number of wanted maximum channels
- * (can be omitted with 0)
- * @return Instance of self
- */
- IMPORT_C static CDunTransporter* NewL( MDunPluginManager* aPluginManager,
- TInt aNumOfMaxChannels=0 );
-
- /**
- * Destructor.
- */
- virtual ~CDunTransporter();
-
- /**
- * Number of allocated channels, is the same number as allocated and active
- * (non-waiting) channels
- *
- * @since S60 3.2
- * @return Number of allocated channels
- */
- IMPORT_C TInt NumberOfAllocatedChannels();
-
- /**
- * Number of waiting channels, is the same number as allocated and inactive
- * (waiting) channels
- *
- * @since S60 3.2
- * @return Number of waiting channels
- */
- IMPORT_C TInt NumberOfWaitingChannels();
-
- /**
- * Gets the number of allocated channels by owner UID, is the same number
- * as allocated and active (non-waiting) channels
- *
- * @since S60 5.0
- * @param aOwnerUid UID of the channel owner
- * @return Number of allocated channels by UID
- */
- IMPORT_C TInt GetNumberOfAllocatedChannelsByUid( TUid aOwnerUid );
-
- /**
- * Gets the number of waiting channels by owner UID, is the same number
- * as allocated and inactive (waiting) channels
- *
- * @since S60 5.0
- * @param aOwnerUid UID of the channel owner
- * @return Number of waiting channels by UID
- */
- IMPORT_C TInt GetNumberOfWaitingChannelsByUid( TUid aOwnerUid );
-
- /**
- * Service advertisement status
- *
- * @since S60 5.0
- * @return ETrue if OK to advertise, EFalse otherwise
- */
- IMPORT_C TBool AdvertisementStatus();
-
- /**
- * Creates a channel of communication between local media (aComm) and
- * network
- * Local media object pointer also works as a connection ID for the
- * allocated channel
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @param aOwnerUid UID of the channel owner
- * @param aName Name for the channel
- * @param aEnqueuedFail ETrue if enqueued failure, EFalse otherwise
- * @param aCorrection Pointer to object implementing buffer correction
- * @return None
- */
- IMPORT_C void AllocateChannelL(
- RComm* aComm,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- MDunBufferCorrection* aCorrection=NULL );
-
- /**
- * Creates a channel of communication between local media (aSocket) and
- * network
- * Local media object pointer also works as a connection ID for the
- * allocated channel
- *
- * @since S60 3.2
- * @param aSocket Pointer to opened local media RSocket ID object
- * @param aOwnerUid UID of the channel owner
- * @param aName Name for the channel
- * @param aEnqueuedFail ETrue if enqueued failure, EFalse otherwise
- * @param aNoFreeChans ETrue if no free channels, EFalse otherwise
- * @return None
- */
- IMPORT_C void AllocateChannelL(
- RSocket* aSocket,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- TBool& aNoFreeChans );
-
- /**
- * Frees an allocated channel by local media (aComm) connection ID
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt FreeChannel( RComm* aComm );
-
- /**
- * Frees an allocated channel by local media (aSocket) connection ID
- *
- * @since S60 3.2
- * @param aSocket Pointer to opened local media RSocket ID object
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt FreeChannel( RSocket* aSocket );
-
- /**
- * Issues transfer requests for all transfer objects by local media
- * (aComm) connection ID
- * This will cause the Transporter by be ready for transferring data
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return None
- */
- IMPORT_C void IssueTransferRequestsL( RComm* aComm );
-
- /**
- * Issues transfer requests for all transfer objects by local media
- * (aSocket) connection ID
- * This will cause the Transporter by be ready for transferring data
- *
- * @since S60 3.2
- * @param aSocket Pointer to opened local media RSocket ID object
- * @return None
- */
- IMPORT_C void IssueTransferRequestsL( RSocket* aSocket );
-
- /**
- * Stops transfers for all transfer objects by local media (aComm)
- * connection ID
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt StopTransfers( RComm* aComm );
-
- /**
- * Stops transfers for all transfer objects by local media (aSocket)
- * connection ID
- *
- * @since S60 3.2
- * @param aSocket Pointer to opened local media RSocket ID object
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt StopTransfers( RSocket* aSocket );
-
- /**
- * Adds connection monitor callback for either local media or network side
- * by connection ID
- * Callbacks will be called read/write error is detected during endpoint
- * operation
- *
- * @since S60 3.2
- * @param aComm Pointer to opened local media RComm ID object
- * @param aCallback Pointer to object whose callbacks will be called
- * @param aDirection Direction of operation to monitor for read/write error
- * @param aSignal ETrue if also signal notification wanted from network side
- * @return None
- */
- IMPORT_C void AddConnMonCallbackL( RComm* aComm,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal );
-
- /**
- * Adds connection monitor callback for either local media or network side
- * by connection ID
- * Callbacks will be called when line status switches to high or low
- *
- * @since S60 3.2
- * @param aSocket Pointer to opened local media RSocket ID object
- * @param aCallback Pointer to object whose callbacks will be called
- * @param aDirection Direction of operation to monitor for read/write error
- * @param aSignal ETrue if also signal notification wanted from network side
- * @return None
- */
- IMPORT_C void AddConnMonCallbackL( RSocket* aSocket,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal );
-
- /**
- * Adds error to consider as no error condition when doing any of the four
- * endpoint's read/writer operation
- *
- * @since S60 3.2
- * @param aError Error code to consider as "no error"
- * @param aComm Pointer to opened local media RComm ID object
- * @param aDirection One of four data transfer endpoints where to add a
- * skipped error code
- * @return None
- */
- IMPORT_C void AddSkippedErrorL( TInt aError,
- RComm* aComm,
- TDunDirection aDirection );
-
- /**
- * Adds error to consider as no error condition when doing any of the four
- * endpoint's read/writer operation
- *
- * @since S60 3.2
- * @param aError Error code to consider as "no error"
- * @param aSocket Pointer to opened local media RSocket ID object
- * @param aDirection One of four data transfer endpoints where to add a
- * skipped error code
- * @return None
- */
- IMPORT_C void AddSkippedErrorL( TInt aError,
- RSocket* aSocket,
- TDunDirection aDirection );
-
- /**
- * Sets service advertisement monitor callback by owner UID
- * Callbacks will be called when advertisement status changes.
- * The callbacks are updated with every successfully completed
- * channel allocation/free (and allocation failure) so it is recommended
- * to call this method after AllocateChannelL().
- *
- * @since S60 5.0
- * @param aOwnerUid Owner's UID for which to have the monitor
- * @param aCallback Pointer to object whose callbacks will be called
- * @return None
- */
- IMPORT_C void SetAdvertisementMonitorL( TUid aOwnerUid,
- MDunServAdvMon* aCallback );
-
- /**
- * Frees service advertisement monitor callback by owner UID
- *
- * @since S60 5.0
- * @param aOwnerUid Owner's UID for which to have the monitor
- * @param aCallback Pointer to object whose callbacks will be called
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C TInt FreeAdvertisementMonitor( TUid aOwnerUid,
- MDunServAdvMon* aCallback );
-
-private:
-
- CDunTransporter( MDunPluginManager* aPluginManager,
- TInt aNumOfMaxChannels );
-
- void ConstructL();
-
- /**
- * Initializes the transporter, must be called as the first operation
- *
- * @since S60 3.2
- * @return KErrAlreadyExists = already initialized,
- * KErrGeneral = network initialization failed,
- * KErrNone otherwise
- */
- TInt InitializeL();
-
- /**
- * UnInitializes the transporter, can be called as the last operation
- *
- * @since S60 3.2
- * @return None
- */
- void UnInitialize();
-
- /**
- * Initialize the transporter
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitializeOnDemand();
-
- /**
- * UnInitialize the transporter
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt UnInitializeOnDemand();
-
- /**
- * Returns index of media for connection ID
- *
- * @since S60 3.2
- * @param aConnId Connection ID for media
- * @param aMediaContext Context of media to search for; either local or
- * network
- * @return Symbian error code on error, found index otherwise
- */
- TInt GetMediaIndex( TConnId aConnId,
- TDunMediaContext aMediaContext=EDunMediaContextLocal );
-
- /**
- * Returns index of media for connection ID
- *
- * @since S60 3.2
- * @param aConnId Connection ID for media
- * @param aMediaContext Context of media to search for; either local or
- * network
- * @return Found index
- */
- TInt GetMediaIndexL( TConnId aConnId,
- TDunMediaContext aMediaContext=EDunMediaContextLocal );
-
- /**
- * Checks initialization and RSubSessionBase() handle
- *
- * @since S60 3.2
- * @param aConnId Connection ID for media
- * @return KErrNotReady if not initialized, KErrBadHandle if no handle
- */
- TInt CheckInitAndHandle( TConnId aConnId );
-
- /**
- * Deletes own internal data
- *
- * @since S60 3.2
- * @return None
- */
- void DeleteTransporter();
-
-private: // data
-
- /**
- * Pointer to common utility class
- * Own.
- */
- MDunTransporterUtility* iUtility;
-
- /**
- * Pointer to RComm channel manager class
- * Own.
- */
- CDunChanMan* iChanMan;
-
- /**
- * Pointer to note handler class
- * Own.
- */
- CDunNoteHandler* iNoteHandler;
-
- /**
- * Array of abstractions of each "channel"
- * One TDunChannelData entry contains objects needed for one channel
- */
- RArray<TDunChannelData> iChannelData;
-
- /**
- * Array of service advertisement data for each plugin
- * One TDunServAdvData entry contains objects needed for one plugin
- */
- RArray<TDunServAdvData> iServAdvData;
-
- /**
- * Callback to call when notification via MDunPluginManager to be made
- * Not own.
- */
- MDunPluginManager* iPluginManager;
-
- /**
- * Number of channels that are active
- * Used for updating KPSUidDialupConnStatus Pub&Sub key
- */
- TInt iActiveChannels;
-
- /**
- * Number of wanted maximum channels (can be omitted with 0)
- * Used for initialization of this class
- */
- TInt iNumOfMaxChannels;
-
- /**
- * Indicates whether this class is initialized or not
- */
- TBool iInitialized;
-
- /**
- * Indicates whether or not it is OK to advertise services
- */
- TBool iAdvertise;
-
- /**
- * Instance of network side abstraction
- * Own.
- */
- CDunNetDataport* iNetwork;
-
- };
-
-#endif // C_CDUNTRANSPORTER_H
--- a/localconnectivityservice/dun/utils/inc/DunUpstream.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*
-* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for one "stream" of CDunTransporter
-*
-*/
-
-
-#ifndef C_CDUNUPSTREAM_H
-#define C_CDUNUPSTREAM_H
-
-#include "DunTransUtils.h"
-#include "DunStream.h"
-#include "DunAtCmdHandler.h"
-#include "DunAtCmdEchoer.h"
-#include "DunDataPusher.h"
-
-class MDunCmdModeMonitor;
-
-/**
- * Class used for storing data related to activity monitoring
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunActivityData )
- {
-
-public:
-
- /**
- * Callback to call when notification via MDunActivityManager to be made
- * Not own.
- */
- MDunActivityManager* iActivityCallback;
-
- /**
- * Flag for data read activity's MDunActivityManager callback
- * This flag is needed to prevent multiple notifications of same activity
- */
- TBool iDataRead;
-
- /**
- * Used as a flag for the first notification of read activity
- * This flag is needed to keep MDunActivityManager notifications in sync
- * (inactivity notification done only if activity notification done first)
- */
- TBool iNotified;
-
- };
-
-/**
- * Class used for storing data related to AT command parsing
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( TDunParseData )
- {
-
-public:
-
- /**
- * Flag for command mode notifier's MDunCmdModeMonitor callback
- * This flag is needed to mark command mode start/end for parse start/end
- */
- TBool iDataMode;
-
- /**
- * AT Command handler.
- */
- CDunAtCmdHandler* iAtCmdHandler;
-
- };
-
-/**
- * Accessor class for AT command handling related functionality
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( MDunAtCmdHandler )
- {
-
-public:
-
- /**
- * Starts URC message handling
- * This is an accessor for CDunDownstream's StartStream()
- *
- * @since S60 5.0
- * @return Symbian error code on error, KErrNone otherwise
- */
- virtual TInt StartUrc() = 0;
-
- /**
- * Stops AT command handling downstream related activity (also URC)
- * This is an accessor for CDunDownstream's Stop()
- *
- * @since S60 3.2
- * @return None
- */
- virtual TInt StopAtCmdHandling() = 0;
-
- };
-
-/**
- * Class for data transmission of one "stream" from local media to network
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunUpstream ) : public CDunStream,
- public MDunAtCmdHandler,
- public MDunCmdModeMonitor,
- public MDunAtCmdStatusReporter,
- public MDunAtCmdEchoer
- {
-
-public:
-
- /**
- * Two-phased constructor.
- * @param aUtility Pointer to common utility class
- * @return Instance of self
- */
- static CDunUpstream* NewL( MDunTransporterUtilityAux* aUtility );
-
- /**
- * Destructor.
- */
- virtual ~CDunUpstream();
-
- /**
- * Resets data to initial values
- *
- * @since S60 3.2
- * @return None
- */
- void ResetData();
-
- /**
- * Sets activity callback for this stream
- *
- * @since S60 3.2
- * @param aActivityCallback Pointer to activity callback
- * @return KErrGeneral if callback null, KErrNone otherwise
- */
- TInt SetActivityCallback( MDunActivityManager* aActivityCallback );
-
- /**
- * Initializes this stream for AT command notifications
- *
- * @since S60 5.0
- * @param aStreamCallback Pointer to stream callback
- * @param aConnectionName Connection identifier name
- * @param aCallbackUp Upstream callback to call when command mode starts or
- * ends
- * @param aCallbackDown Downstream callback to call when command mode starts
- * or ends
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt InitializeForAtParsing( MDunStreamManipulator* aStreamCallback,
- const TDesC8* aConnectionName,
- MDunCmdModeMonitor* aCallbackUp,
- MDunCmdModeMonitor* aCallbackDown );
-
- /**
- * Starts upstream by issuing read request
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StartStream();
-
- /**
- * Stops transfer for read & write endpoints
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt Stop();
-
- /**
- * Data transmission state (if read completed)
- *
- * @since S60 3.2
- * @return ETrue if data successfully read, EFalse otherwise
- */
- TBool DataReadStatus();
-
-private:
-
- CDunUpstream( MDunTransporterUtilityAux* aUtility );
-
- void ConstructL();
-
- /**
- * Initializes this class
- *
- * @since S60 3.2
- * @return None
- */
- void Initialize();
-
- /**
- * Issues transfer request for this stream
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt IssueRequest();
-
- /**
- * Processes data that was read
- *
- * @since S60 5.0
- * @return ETrue if request to be reissued, EFalse otherwise
- */
- TBool ProcessReadData();
-
- /**
- * Manages activity in a channel
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt ManageChannelActivity();
-
-// from base class CActive
-
- /**
- * From CActive.
- * Gets called when endpoint data read/write complete
- *
- * @since S60 3.2
- * @return None
- */
- void RunL();
-
- /**
- * From CActive.
- * Gets called on cancel
- *
- * @since S60 3.2
- * @return None
- */
- void DoCancel();
-
-// from base class MDunAtCmdStatusReporter
-
- /**
- * Notifies about parser's need to get more data
- *
- * @since TB9.2
- * @return None
- */
- void NotifyParserNeedsMoreData();
-
- /**
- * Notifies about editor mode reply
- *
- * @since TB9.2
- * @param aStart ETrue if start of editor mode, EFalse otherwise
- * @return Symbian error code on error, KErrNone otherwise
- */
- void NotifyEditorModeReply( TBool aStart );
-
-// from base class MDunAtCmdHandler
-
- /**
- * Starts URC message handling
- * This is an accessor for CDunDownstream's StartStream()
- *
- * @since S60 5.0
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StartUrc();
-
- /**
- * Stops AT command handling downstream related activity (also URC)
- * This is an accessor for CDunDownstream's Stop()
- *
- * @since S60 3.2
- * @return Symbian error code on error, KErrNone otherwise
- */
- TInt StopAtCmdHandling();
-
-// from base class MDunCmdModeMonitor
-
- /**
- * Notifies about command mode start
- *
- * @since S60 5.0
- * @return None
- */
- void NotifyCommandModeStart();
-
- /**
- * Notifies about command mode end
- *
- * @since S60 5.0
- * @return None
- */
- void NotifyCommandModeEnd();
-
-// from base class MDunAtCmdEchoer
-
- /**
- * Notifies about completed echo in text mode
- *
- * @since TB9.2
- * @return None
- */
- void NotifyEchoComplete();
-
-private: // data
-
- /**
- * Pointer to common utility class
- * Not own.
- */
- MDunTransporterUtilityAux* iUtility;
-
- /**
- * Data related to activity monitoring
- */
- TDunActivityData iActivityData;
-
- /**
- * Data related to AT command parsing
- */
- TDunParseData iParseData;
-
- };
-
-#endif // C_CDUNUPSTREAM_H
--- a/localconnectivityservice/dun/utils/inc/DunUtils.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common utility methods for DUN
-*
-*/
-
-
-#ifndef C_CDUNUTILS_H
-#define C_CDUNUTILS_H
-
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#else
-#include <c32comm.h>
-#endif
-#include <e32std.h>
-
-/**
- * This class contains common utility methods for DUN
- *
- * @lib dunutils.lib
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS( CDunUtils ) : public CBase
- {
-
-public:
-
- /**
- * Connects to comms server
- *
- * @since S60 3.2
- * @param aCommServer Comms server where to connect
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C static TInt ConnectCommsServer( RCommServ& aCommServer );
-
- /**
- * Sets RComm buffer length
- *
- * @since S60 3.2
- * @param aComm RComm object whose length to set
- * @param aLength Length to set to aComm
- * @return Symbian error code on error, KErrNone otherwise
- */
- IMPORT_C static TInt SetRCommBufferLength( RComm& aComm, TInt aLength );
-
- };
-
-#endif // C_CDUNUTILS_H
--- a/localconnectivityservice/dun/utils/src/DunChanMan.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,577 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: RComm channel management related functionality (waiter)
-*
-*/
-
-
-#include "DunSignalWaiter.h"
-#include "DunDataWaiter.h"
-#include "DunUpstream.h"
-#include "DunDownstream.h"
-#include "DunSignalCopy.h"
-#include "DunChanMan.h"
-#include "DunUtils.h"
-#include "DunDebug.h"
-#include "DunPlugin.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunChanMan* CDunChanMan::NewL( CDunTransporter& aParent,
- MDunTransporterUtility* aUtility,
- MDunTransporterUtilityAux* aUtilityAux,
- MDunPluginManager* aPluginManager )
- {
- CDunChanMan* self = new (ELeave) CDunChanMan( aParent,
- aUtility,
- aUtilityAux,
- aPluginManager );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunChanMan::~CDunChanMan()
- {
- FTRACE(FPrint( _L("CDunChanMan::~CDunChanMan()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunChanMan::~CDunChanMan() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunChanMan::ResetData()
- {
- FTRACE(FPrint( _L("CDunChanMan::ResetData()") ));
- // APIs affecting this:
- // AddConnWaiterL()
- // IssueConnWaiterRequest()
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- DeleteWaiters( i );
- }
- iWaiterData.Close();
- FTRACE(FPrint( _L("CDunChanMan::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Number of waiters
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::NumberOfWaiters()
- {
- FTRACE(FPrint( _L("CDunChanMan::NumberOfWaiters()" )));
- TInt waiters = iWaiterData.Count();
- FTRACE(FPrint( _L("CDunChanMan::NumberOfWaiters() complete" )));
- return waiters;
- }
-
-// ---------------------------------------------------------------------------
-// Gets number of waiters by owner UID
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::GetNumberOfWaitersByUid( TUid aOwnerUid )
- {
- FTRACE(FPrint( _L("CDunChanMan::GetNumberOfWaitersByUid()" )));
- TInt i;
- TInt waiters = 0;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iOwnerUid == aOwnerUid )
- {
- waiters++;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::GetNumberOfWaitersByUid() complete" )));
- return waiters;
- }
-
-// ---------------------------------------------------------------------------
-// Adds new connection waiter to connection waiter array
-// ---------------------------------------------------------------------------
-//
-void CDunChanMan::AddConnWaiterL( RComm* aComm,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- MDunBufferCorrection* aCorrection )
- {
- FTRACE(FPrint( _L("CDunChanMan::AddConnWaiterL()" )));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunChanMan::AddConnWaiterL() (aComm not initialized!) complete" )));
- User::Leave( KErrGeneral );
- }
- CDunSignalWaiter* signalWaiter = CDunSignalWaiter::NewL( this );
- CleanupStack::PushL( signalWaiter );
- TInt retTemp = signalWaiter->SetMedia( aComm );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunChanMan::AddConnWaiterL() (ERROR) complete" )));
- User::Leave( retTemp );
- }
- CDunDataWaiter* dataWaiter = CDunDataWaiter::NewL( this );
- CleanupStack::PushL( dataWaiter );
- retTemp = dataWaiter->SetMedia( aComm );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunChanMan::AddConnWaiterL() (ERROR) complete" )));
- User::Leave( retTemp );
- }
- TDunWaiterData waiterData;
- waiterData.iComm = aComm;
- waiterData.iChannelName = HBufC8::NewMaxL( aName.Length() );
- TPtr8 chanNamePtr = waiterData.iChannelName->Des();
- chanNamePtr.Copy( aName );
- waiterData.iSignalWaiter = signalWaiter;
- waiterData.iDataWaiter = dataWaiter;
- waiterData.iCorrection = aCorrection;
- waiterData.iEnqueuedFail = aEnqueuedFail;
- waiterData.iOwnerUid = aOwnerUid;
- iWaiterData.AppendL( waiterData );
- CleanupStack::Pop( dataWaiter );
- CleanupStack::Pop( signalWaiter );
- FTRACE(FPrint( _L("CDunChanMan::AddConnWaiterL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Removes existing waiter from connection waiter array
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::RemoveConnWaiter( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunChanMan::RemoveConnWaiter()" )));
- TInt i;
- for ( i=iWaiterData.Count()-1; i>=0; i-- )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iComm == aComm )
- {
- DeleteWaiters( i );
- iWaiterData.Remove( i );
- FTRACE(FPrint( _L("CDunChanMan::RemoveConnWaiter() complete" )));
- return KErrNone;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::RemoveConnWaiter() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Makes CDunConnWaiter ready to detect new data
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::IssueConnWaiterRequest( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunChanMan::IssueConnWaiterRequest()" )));
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iComm == aComm )
- {
- waiterData.iSignalWaiter->IssueRequest();
- waiterData.iDataWaiter->IssueRequest();
- FTRACE(FPrint( _L("CDunChanMan::IssueConnWaiterRequest() complete" )));
- return KErrNone;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::IssueConnWaiterRequest() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Stops CDunConnWaiter to detect new data
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::StopConnWaiter( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunChanMan::StopConnWaiter()" )));
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iComm == aComm )
- {
- waiterData.iSignalWaiter->Stop();
- waiterData.iDataWaiter->Stop();
- FTRACE(FPrint( _L("CDunChanMan::StopConnWaiter() complete" )));
- return KErrNone;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::StopConnWaiter() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Saves waiter's connection monitor callback data
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::SaveWaiterConnMonCallbackL( RComm* aComm,
- MDunConnMon* aCallback,
- TDunDirection aDirection )
- {
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterConnMonCallbackL()" )));
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iComm != aComm )
- {
- continue;
- }
- TDunConnMonCallback connMon;
- connMon.iCallback = aCallback;
- connMon.iDirection = aDirection;
- if ( aDirection==EDunReaderUpstream ||
- aDirection==EDunWriterDownstream )
- {
- // Local media -> add to object
- // Add signal waiter's callback (for RunL error monitoring)
- if ( !waiterData.iSignalWaiter )
- {
- FTRACE(FPrint( _L("CDunTransUtils::SaveWaiterConnMonCallbackL() (ERROR) complete" )));
- return KErrGeneral;
- }
- waiterData.iSignalWaiter->AddCallback( aCallback );
- // Add data waiter's callback (for RunL error monitoring)
- if ( !waiterData.iDataWaiter )
- {
- FTRACE(FPrint( _L("CDunTransUtils::SaveWaiterConnMonCallbackL() (ERROR) complete" )));
- return KErrGeneral;
- }
- waiterData.iDataWaiter->AddCallback( aCallback );
- // Now just store information for R/W case
- waiterData.iConnMons.AppendL( connMon );
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterConnMonCallbackL() complete" )));
- return KErrNone;
- }
- else if ( aDirection==EDunWriterUpstream ||
- aDirection==EDunReaderDownstream )
- {
- // Network -> just store information for R/W case
- waiterData.iConnMons.AppendL( connMon );
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterConnMonCallbackL() complete" )));
- return KErrNone;
- }
- else
- {
- FTRACE(FPrint( _L("CDunTransUtils::SaveWaiterConnMonCallbackL() (ERROR) complete" )));
- return KErrGeneral;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterConnMonCallbackL() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Saves waiter's skipped error data
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::SaveWaiterSkippedErrorL( TInt aError,
- RComm* aComm,
- TDunDirection aDirection )
- {
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterSkippedErrorL()" )));
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunWaiterData& waiterData = iWaiterData[i];
- if ( waiterData.iComm == aComm )
- {
- TDunSkippedError skippedError;
- skippedError.iError = aError;
- skippedError.iDirection = aDirection;
- waiterData.iOkErrors.AppendL( skippedError );
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterSkippedErrorL() complete" )));
- return KErrNone;
- }
- }
- FTRACE(FPrint( _L("CDunChanMan::SaveWaiterSkippedErrorL() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// CDunChanMan::CDunChanMan
-// ---------------------------------------------------------------------------
-//
-CDunChanMan::CDunChanMan( CDunTransporter& aParent,
- MDunTransporterUtility* aUtility,
- MDunTransporterUtilityAux* aUtilityAux,
- MDunPluginManager* aPluginManager ) :
- iParent( aParent ),
- iUtility( aUtility ),
- iUtilityAux( aUtilityAux ),
- iPluginManager( aPluginManager )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunChanMan::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunChanMan::ConstructL()
- {
- FTRACE(FPrint( _L("CDunChanMan::ConstructL()" ) ));
- if ( !iUtility || !iUtilityAux || !iPluginManager )
- {
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunChanMan::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunChanMan::Initialize()
- {
- FTRACE(FPrint( _L("CDunChanMan::Initialize()" ) ));
- // Don't initialize iParent here (it is set through NewL)
- // Don't initialize iUtility here (it is set through NewL)
- // Don't initialize iUtilityAux here (it is set through NewL)
- // Don't initialize iPluginManager here (it is set through NewL)
- FTRACE(FPrint( _L("CDunChanMan::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunChannelAllocator.
-// Notifies when new channel is wanted
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::NotifyNewChannelRequest( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest()" )));
- if ( !aComm->SubSessionHandle() )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) (bad handle) complete" ) ));
- return KErrBadHandle;
- }
- // Get plugin UID for connection ID
- TInt i;
- TUid foundUid = TUid::Null();
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iWaiterData[i].iComm == aComm )
- {
- foundUid = iWaiterData[i].iOwnerUid;
- break;
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) (not found) complete" )));
- return KErrNotFound;
- }
- TDunWaiterData& waiterData = iWaiterData[i];
- // Try to stop if either one of the waiters are still runnig
- waiterData.iSignalWaiter->Stop();
- waiterData.iDataWaiter->Stop();
- // enqueued will be omitted (not needed to set to RComm)
- TInt firstFree = iUtility->InitializeFirstFreeChannel( aComm );
- if ( firstFree < 0 )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) (firstfree failed!) complete" ) ));
- return firstFree;
- }
- if ( firstFree >= iParent.iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) (firstfree failed!) complete" )));
- return KErrGeneral;
- }
- TInt bufferLength = KErrNotFound;
- MDunBufferCorrection* correction = waiterData.iCorrection;
- TRAPD( retTrap,
- iUtility->DoAllocateChannelL(aComm, bufferLength, firstFree, correction) );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() trapped!" ) ));
- iParent.UnInitializeOnDemand(); // remove unused initialized channel
- if ( retTrap == KErrTooBig )
- {
- if ( waiterData.iEnqueuedFail )
- {
- // Inform plugin enqueue request
- iPluginManager->NotifyPluginEnqueueRequest( foundUid );
- }
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) complete" )));
- return KErrTooBig;
- }
- iPluginManager->NotifyPluginCloseRequest( foundUid, EFalse );
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (ERROR) complete" )));
- return retTrap;
- }
- TInt retTemp = CDunUtils::SetRCommBufferLength( *aComm, bufferLength );
- if ( retTemp != KErrNone )
- {
- iParent.UnInitializeOnDemand(); // remove unused initialized channel
- iPluginManager->NotifyPluginCloseRequest( foundUid, EFalse );
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (ERROR) complete" )));
- }
- // Next find aComm from iWaiterData and copy its contents to channel data
- retTemp = FillNewWaiterChannelData( aComm, firstFree );
- if ( retTemp != KErrNone )
- {
- iParent.UnInitializeOnDemand(); // remove unused initialized channel
- iPluginManager->NotifyPluginCloseRequest( foundUid, EFalse );
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) (not found) complete" )));
- }
- FTRACE(FPrint( _L("CDunChanMan::NotifyNewChannelRequest() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Fills data for channel created by waiter
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::FillNewWaiterChannelData( RComm* aComm,
- TInt aFirstFree )
- {
- FTRACE(FPrint( _L("CDunChanMan::FillNewWaiterChannelData()" )));
- TInt i;
- TInt count = iWaiterData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iWaiterData[i].iComm == aComm )
- {
- break;
- }
- }
- if ( i >= count ||
- aFirstFree < 0 ||
- aFirstFree >= iParent.iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunChanMan::FillNewWaiterChannelData() (not found) complete" )));
- return KErrNotFound;
- }
- TUid thisUid = iWaiterData[i].iOwnerUid; // pick up before remove
- TDunChannelData& channelData = iParent.iChannelData[aFirstFree];
- TDunWaiterData& waiterData = iWaiterData[i];
- channelData.iComm = waiterData.iComm;
- channelData.iChannelName = waiterData.iChannelName;
- channelData.iUpstreamRW->SetMedia( aComm, EDunMediaContextLocal );
- channelData.iDownstreamRW->SetMedia( aComm, EDunMediaContextLocal );
- channelData.iOwnerUid = thisUid;
- // Channel now occupied
- channelData.iChannelInUse = ETrue;
- // Restore data from waiter to transfer objects
- RestoreWaiterData( i, aFirstFree );
- // Now delete waiters before request issuing
- DeleteWaiters( i, ETrue );
- iWaiterData.Remove( i );
- // Issue transfer requests
- iUtility->DoIssueTransferRequests( aFirstFree );
- // Clear the queue, just to be sure
- iPluginManager->NotifyPluginDequeueRequest( thisUid );
- FTRACE(FPrint( _L("CDunChanMan::FillNewWaiterChannelData() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Restores saved waiter data to connection data
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::RestoreWaiterData( TInt aWaiterIndex,
- TInt aChannelIndex )
- {
- FTRACE(FPrint( _L("CDunChanMan::RestoreWaiterData()" )));
- if ( aWaiterIndex < 0 ||
- aWaiterIndex >= iWaiterData.Count() ||
- aChannelIndex < 0 ||
- aChannelIndex >= iParent.iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunChanMan::RestoreWaiterData() (not found) complete" )));
- return KErrNotFound;
- }
- TInt i;
- TInt count = iWaiterData[aWaiterIndex].iConnMons.Count();
- for ( i=0; i<count; i++ )
- {
- TDunConnMonCallback& connMon = iWaiterData[aWaiterIndex].iConnMons[i];
- // Add connection monitor callbacks (ignore errors)
- // Errors are ignored because in this phase they cannot be reported to
- // plugins. Instead add error checking to
- // CDunTransporter::AddConnMonCallbackL() if needed
- iUtility->DoAddConnMonCallback( aChannelIndex,
- connMon.iCallback,
- connMon.iDirection,
- NULL );
- }
- count = iWaiterData[aWaiterIndex].iOkErrors.Count();
- for (i=0; i<count; i++)
- {
- TDunSkippedError& skippedError = iWaiterData[aWaiterIndex].iOkErrors[i];
- // Add skipped errors (ignore errors)
- // Errors are ignored because in this phase they cannot be reported to
- // plugins. Instead add error checking to
- // CDunTransporter::AddSkippedErrorL() if needed
- iUtility->DoAddSkippedError( aChannelIndex,
- skippedError.iError,
- skippedError.iDirection );
- }
- FTRACE(FPrint( _L("CDunChanMan::RestoreWaiterData() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Deletes waiter objects of aIndex:th waiters
-// ---------------------------------------------------------------------------
-//
-TInt CDunChanMan::DeleteWaiters( TInt aIndex, TBool aNewOwnership )
- {
- FTRACE(FPrint( _L("CDunChanMan::DeleteWaiters()" )));
-
- if ( aIndex < 0 ||
- aIndex >= iWaiterData.Count() )
- {
- FTRACE(FPrint( _L("CDunChanMan::DeleteWaiters() (not found) complete" )));
- return KErrNotFound;
- }
-
- TDunWaiterData& waiterData = iWaiterData[aIndex];
- if ( !aNewOwnership )
- {
- delete waiterData.iChannelName;
- }
- waiterData.iChannelName = NULL;
- delete waiterData.iSignalWaiter;
- waiterData.iSignalWaiter = NULL;
- delete waiterData.iDataWaiter;
- waiterData.iDataWaiter = NULL;
-
- waiterData.iConnMons.Close();
- waiterData.iOkErrors.Close();
-
- FTRACE(FPrint( _L("CDunChanMan::DeleteWaiters() complete" )));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/utils/src/DunDataPusher.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,450 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Pushes data to existing stream from outside
-*
-*/
-
-
-#include "DunDataPusher.h"
-#include "DunDownstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunDataPusher* CDunDataPusher::NewL( CDunDownstream& aParent,
- MDunCompletionReporter* aStreamCallback )
- {
- CDunDataPusher* self = new (ELeave) CDunDataPusher( aParent,
- aStreamCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunDataPusher::~CDunDataPusher()
- {
- FTRACE(FPrint( _L("CDunDataPusher::~CDunDataPusher()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunDataPusher::~CDunDataPusher() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunDataPusher::ResetData()
- {
- // APIs affecting this:
- // SendQueuedData()
- Stop();
- // AddToEventQueue()
- iEventQueue.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to be used for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::SetMedia( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RComm)" )));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RComm) (not initialized!) complete" )));
- return KErrGeneral;
- }
- iComm = aComm;
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to be used for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::SetMedia( RSocket* aSocket )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RSocket)" )));
- if ( !aSocket )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RSocket) (not initialized!) complete" )));
- return KErrGeneral;
- }
- iSocket = aSocket;
- FTRACE(FPrint( _L("CDunDataPusher::SetMedia() (RSocket) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Adds event notification to queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::AddToEventQueue( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback )
- {
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue()" )));
- if ( !aDataToPush || aDataToPush->Length()<0 )
- {
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (unknown data) complete" )));
- return KErrGeneral;
- }
- // Check if identical pointer to data already exists
- TInt foundIndex = FindEventFromQueue( aDataToPush );
- if ( foundIndex >= 0 )
- {
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (already exists) complete" )));
- return KErrAlreadyExists;
- }
- // Unique pointer -> add to event queue
- TDunDataPush dataPush;
- dataPush.iDataToPush = aDataToPush;
- dataPush.iCallback = aCallback;
- TInt retTemp = iEventQueue.Append( dataPush );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() (append failed!) complete" )));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunDataPusher::AddToQueue() complete (count=%d)" ), iEventQueue.Count() ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Finds an event from queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::FindEventFromQueue( const TDesC8* aDataToPush )
- {
- FTRACE(FPrint( _L("CDunDataPusher::FindEventFromQueue()" )));
- TInt i;
- TInt count = iEventQueue.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iEventQueue[i].iDataToPush == aDataToPush )
- {
- FTRACE(FPrint( _L("CDunDataPusher::FindEventFromQueue() complete" )));
- return i;
- }
- }
- FTRACE(FPrint( _L("CDunDataPusher::FindEventFromQueue() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Stops one event in the event queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::StopOneEvent( const TDesC8* aDataToPush )
- {
- FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent()" )));
- if ( !aDataToPush )
- {
- FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent() (unknown data) complete" )));
- return KErrGeneral;
- }
- TInt foundIndex = FindEventFromQueue( aDataToPush );
- if ( foundIndex >= 0 )
- {
- if ( iEventIndex == foundIndex )
- {
- Stop();
- }
- FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent() complete" )));
- return KErrNone;
- }
- FTRACE(FPrint( _L("CDunDataPusher::StopOneEvent() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Sends queued data in round robin
-// ---------------------------------------------------------------------------
-//
-TBool CDunDataPusher::SendQueuedData()
- {
- FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData()" )));
- if ( iPushState!=EDunStateIdle || iEventQueue.Count()==0 )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() (not ready) complete" )));
- return EFalse;
- }
- TInt retTemp = ManageOneEvent();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() (ERROR) complete" )));
- return EFalse;
- }
- iPushState = EDunStateDataPushing;
- FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() complete (%d)" ), iEventQueue.Count() ));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Stops sending for write endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::Stop()
- {
- FTRACE(FPrint( _L("CDunDataPusher::Stop()" )));
- if ( iPushState != EDunStateDataPushing )
- {
- FTRACE(FPrint( _L("CDunDataPusher::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- // As the EDunStateDataPushing can be on even with multiple requests,
- // cancel the actual operation in DoCancel()
- Cancel();
- iPushState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunDataPusher::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops sending for write endpoint and clears event queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::StopAndClearQueue()
- {
- FTRACE(FPrint( _L("CDunDataPusher::StopAndClearQueue()" )));
- TInt retVal = Stop();
- iEventQueue.Reset();
- iEventIndex = 0;
- FTRACE(FPrint( _L("CDunDataPusher::StopAndClearQueue() complete" )));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Signals completion status in round robin and clears event queue
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::SignalCompletionAndClearQueue()
- {
- FTRACE(FPrint( _L("CDunDataPusher::SignalCompletionAndClearQueue()" )));
- // First copy the event queue to temporary notitication queue and
- // reset the real event queue before notifications. This is done because
- // implementor of NotifyDataPushComplete() can call AddToEventQueue()
- // (and KErrAlreadyExists will happen there)
- TInt i;
- TInt retTemp;
- RPointerArray<MDunCompletionReporter> notify;
- TInt count = iEventQueue.Count();
- for ( i=0; i<count; i++ )
- {
- if ( !iEventQueue[i].iCallback )
- {
- continue;
- }
- retTemp = notify.Append( iEventQueue[i].iCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDataPusher::SignalCompletionAndClearQueue() (append failed!) complete" )));
- return retTemp;
- }
- }
- iEventQueue.Reset();
- iEventIndex = 0;
- // Now notify
- count = notify.Count();
- for ( i=0; i<count; i++ )
- {
- notify[i]->NotifyDataPushComplete( EFalse );
- }
- notify.Close();
- FTRACE(FPrint( _L("CDunDataPusher::SignalCompletionAndClearQueue() complete (%d)" ), count ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunDataPusher::CDunDataPusher
-// ---------------------------------------------------------------------------
-//
-CDunDataPusher::CDunDataPusher( CDunDownstream& aParent,
- MDunCompletionReporter* aStreamCallback ) :
- CActive( EPriorityHigh ),
- iParent( aParent ),
- iStreamCallback( aStreamCallback )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunDataPusher::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunDataPusher::ConstructL()
- {
- FTRACE(FPrint( _L("CDunDataPusher::ConstructL()" )));
- if ( !iStreamCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunDataPusher::ConstructL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunDataPusher::Initialize()
- {
- // Don't initialize iUtility here (it is set through NewL)
- // Don't initialize iStreamCallback here (it is set through NewL)
- iPushState = EDunStateIdle;
- iEventIndex = 0;
- iSocket = NULL;
- iComm = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// Manages one event's data push
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::ManageOneEvent()
- {
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent()" )));
- if ( IsActive() )
- {
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( iEventIndex < 0 ||
- iEventIndex >= iEventQueue.Count() )
- {
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (buffer mismatch) complete" )));
- return KErrGeneral;
- }
- const TDesC8* dataToPush = iEventQueue[iEventIndex].iDataToPush;
- if ( iComm )
- {
- iStatus = KRequestPending;
- iComm->Write( iStatus, *dataToPush );
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested (buffer=0x%08X)" ), dataToPush ));
- }
- else if ( iSocket )
- {
- iStatus = KRequestPending;
- iSocket->Send( *dataToPush, 0, iStatus );
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested (buffer=0x%08X)" ), dataToPush ));
- }
- else
- {
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (ERROR) complete" )));
- return KErrGeneral;
- }
- SetActive();
- FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Check whether an error code is severe error or not
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataPusher::ProcessErrorCondition( TInt aError, TBool& aIsError )
- {
- FTRACE(FPrint( _L("CDunDataPusher::ProcessErrorCondition() (Dir=%d)" ), EDunWriterDownstream));
- aIsError = EFalse;
- if ( aError != KErrNone )
- {
- aIsError = ETrue;
- TInt retTemp = iParent.iOkErrorsW.Find( aError );
- if ( retTemp == KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunDataPusher::ProcessErrorCondition() (Dir=%d) (%d=ETrue) complete" ), EDunWriterDownstream, aError));
- return ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunDataPusher::ProcessErrorCondition() (Dir=%d) (%d=EFalse) complete" ), EDunWriterDownstream, aError));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when endpoint data write complete
-// ---------------------------------------------------------------------------
-//
-void CDunDataPusher::RunL()
- {
- FTRACE(FPrint( _L("CDunDataPusher::RunL() (buffer=0x%08X)" ), iEventQueue[iEventIndex].iDataToPush ));
-
- TBool isError;
- TInt retTemp = iStatus.Int();
- TInt stop = ProcessErrorCondition( retTemp, isError );
-
- if ( !stop ) // no real error detected -> continue
- {
- if ( !isError )
- {
- iEventIndex++;
- }
- if ( iEventIndex < iEventQueue.Count() )
- {
- // More to serve so start again
- ManageOneEvent();
- }
- else
- {
- // Last was served so stop processing and notify
- iPushState = EDunStateIdle;
- iStreamCallback->NotifyDataPushComplete( ETrue );
- }
- } // if ( !stop )
- else // stop -> tear down connection
- {
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRW;
- connReason.iContext = EDunMediaContextLocal;
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = EDunWriterDownstream;
- connReason.iErrorCode = retTemp;
- iParent.iUtility->DoNotifyConnectionNotOk( iComm,
- iSocket,
- connReason,
- iParent.iCallbacksW );
- } // else
-
- FTRACE(FPrint( _L("CDunDataPusher::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunDataPusher::DoCancel()
- {
- FTRACE(FPrint( _L("CDunDataPusher::DoCancel()" )));
- if ( iComm )
- {
- iComm->WriteCancel();
- FTRACE(FPrint( _L("CDunDataPusher::DoCancel() (RComm) cancelled" )));
- }
- else if ( iSocket )
- {
- iSocket->CancelWrite();
- FTRACE(FPrint( _L("CDunDataPusher::DoCancel() (RSocket) cancelled" )));
- }
- FTRACE(FPrint( _L("CDunDataPusher::DoCancel() complete" )));
- }
--- a/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors for new data in RComm local media side
-*
-*/
-
-
-#include "DunTransporter.h"
-#include "DunDataWaiter.h"
-#include "DunSignalCopy.h"
-#include "DunDebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunDataWaiter* CDunDataWaiter::NewL( MDunChannelAllocator* aChannelCallback )
- {
- CDunDataWaiter* self = new (ELeave) CDunDataWaiter( aChannelCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunDataWaiter::~CDunDataWaiter()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::~CDunDataWaiter()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunDataWaiter::~CDunDataWaiter() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunDataWaiter::ResetData()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::ResetData()") ));
- Stop();
- // APIs affecting this:
- // AddConnMonCallbackL()
- iCallbacks.Close();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunDataWaiter::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for RunL error controlling
-// The callback will be called when error is detected in asynchronous
-// operation
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataWaiter::AddCallback( MDunConnMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::AddCallback()" ) ));
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCallbacks.Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCallbacks.Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunDataWaiter::AddCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataWaiter::SetMedia( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::SetMedia(RComm) (addr=0x%08X)" ), aComm));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (aComm) not initialized!" )));
- return KErrGeneral;
- }
- TCommCaps2 caps;
- aComm->Caps( caps );
- if ( !(caps().iNotificationCaps & KNotifyDataAvailableSupported) )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (RComm) (not supported) complete" )));
- return KErrNotSupported;
- }
- iComm = aComm;
- FTRACE(FPrint( _L("CDunDataWaiter::SetMedia() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start waiting for new data in RComm
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataWaiter::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest()" )));
- if ( iDataWaiterState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iComm )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (iComm) not initialized!" ) ));
- return KErrGeneral;
- }
- iStatus = KRequestPending;
- iComm->ResetBuffers();
- iComm->NotifyDataAvailable( iStatus );
- SetActive();
- iDataWaiterState = EDunStateDataWaiting;
- FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops monitoring for new data
-// ---------------------------------------------------------------------------
-//
-TInt CDunDataWaiter::Stop()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::Stop()" )));
- if ( iDataWaiterState != EDunStateDataWaiting )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iComm )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::Stop() (iComm) not initialized!" )));
- return KErrGeneral;
- }
- iComm->NotifyDataAvailableCancel();
- Cancel();
- iDataWaiterState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunDataWaiter::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunDataWaiter::CDunDataWaiter
-// ---------------------------------------------------------------------------
-//
-CDunDataWaiter::CDunDataWaiter( MDunChannelAllocator* aChannelCallback ) :
- CActive( EPriorityHigh ),
- iChannelCallback( aChannelCallback )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunDataWaiter::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunDataWaiter::ConstructL()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::ConstructL()" ) ));
- if ( !iChannelCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunDataWaiter::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunDataWaiter::Initialize()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::Initialize()" ) ));
- // Don't initialize iChannelCallback here (it is set through NewL)
- iDataWaiterState = EDunStateIdle;
- iComm = NULL;
- FTRACE(FPrint( _L("CDunDataWaiter::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when new data in RComm object
-// ---------------------------------------------------------------------------
-//
-void CDunDataWaiter::RunL()
- {
- FTRACE(FPrint( _L("CDunDataWaiter::RunL()" ) ));
- iDataWaiterState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDataWaiter::RunL() (failed) complete (%d)"), retTemp));
- TInt count = iCallbacks.Count();
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRunL;
- connReason.iContext = EDunMediaContextLocal;
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = EDunDirectionUndefined;
- connReason.iErrorCode = retTemp;
- for ( TInt i=0; i<count; i++ )
- {
- TRAP_IGNORE(
- iCallbacks[i]->NotifyProgressChangeL( iComm, connReason ) );
- }
- return;
- }
- if ( iChannelCallback )
- {
- iChannelCallback->NotifyNewChannelRequest( iComm );
- }
- // Don't check other iMediaInUse values here
- // They can't be other than EDunMediaRComm (checked in IssueRequest())
- FTRACE(FPrint( _L("CDunDataWaiter::RunL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunDataWaiter::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/utils/src/DunDownstream.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,468 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for one "stream" of CDunTransporter
-*
-*/
-
-
-/*
- * TODO: When local media is of type RComm, listening on it is started with
- * RComm::NotifyDataAvailable() call. Check that USB ACM port and Irda RCOMM
- * (and any other new media in the future) behaves correctly so that when
- * RComm::ReadOneOrMore() is issued, the read is issued immediately without
- * checking for new data. If waiting for new data happens in this
- * NotifyDataAvailable/ReadOneOrMore combination, raise a defect to Symbian.
- */
-
-#include "DunTransporter.h"
-#include "DunDownstream.h"
-#include "DunUpstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunDownstream* CDunDownstream::NewL( MDunTransporterUtilityAux* aUtility )
- {
- CDunDownstream* self = new (ELeave) CDunDownstream( aUtility );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunDownstream::~CDunDownstream()
- {
- FTRACE(FPrint( _L("CDunDownstream::~CDunDownstream()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunDownstream::~CDunDownstream() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::ResetData()
- {
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // InitializeForDataPushing()
- delete iPushData.iDataPusher;
- iPushData.iDataPusher = NULL;
- // AddConnMonCallbackL()
- iCallbacksR.Close();
- iCallbacksW.Close();
- // AddSkippedErrorL()
- iOkErrorsR.Close();
- iOkErrorsW.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this stream for AT command notifications
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::InitializeForDataPushing(
- MDunAtCmdHandler* aAtCmdHandler )
- {
- FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing()" ) ));
- if ( iPushData.iDataPusher || iPushData.iAtCmdHandler ) // optional
- {
- FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- if ( !aAtCmdHandler )
- {
- FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (aAtCmdHandler) not initialized!" ) ));
- return KErrGeneral;
- }
- CDunDataPusher* dataPusher = NULL;
- TRAPD( retTrap, dataPusher = CDunDataPusher::NewL(*this,this) );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() (trapped!) complete" ) ));
- return retTrap;
- }
- if ( iComm )
- {
- dataPusher->SetMedia( iComm );
- }
- else if ( iSocket )
- {
- dataPusher->SetMedia( iSocket );
- }
- iPushData.iDataPusher = dataPusher;
- iPushData.iAtCmdHandler = aAtCmdHandler;
- FTRACE(FPrint( _L("CDunDownstream::InitializeForDataPushing() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Checks if data is in queue
-// ---------------------------------------------------------------------------
-//
-TBool CDunDownstream::IsDataInQueue( const TDesC8* aDataToPush )
- {
- FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue()" ) ));
- if ( !iPushData.iDataPusher )
- {
- FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() (iPushData.iDataPusher not initialized!) complete" )));
- return EFalse;
- }
- TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( aDataToPush );
- FTRACE(FPrint( _L("CDunDownstream::IsDataInQueue() complete" ) ));
- return ( foundIndex >= 0 ) ? ETrue : EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// Adds data to event queue and starts sending if needed
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::AddToQueueAndSend( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback )
- {
- FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend()" ) ));
- if ( !iPushData.iDataPusher )
- {
- FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (iPushData.iDataPusher not initialized!) complete" )));
- return KErrGeneral;
- }
- // Add to event queue. If something went wrong, just return
- TInt retTemp = iPushData.iDataPusher->AddToEventQueue( aDataToPush, aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() (ERROR) complete" )));
- return retTemp;
- }
- // Now push the data. If already active, push will start later, if not
- // active it will start immediately.
- iPushData.iDataPusher->SendQueuedData();
- FTRACE(FPrint( _L("CDunDownstream::AddToQueueAndSend() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Starts downstream by issuing read request
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::StartStream()
- {
- FTRACE(FPrint( _L("CDunDownstream::StartStream()" ) ));
- FTRACE(FPrint( _L("CDunDownstream::StartStream() (buffer=0x%08X)" ), iBufferPtr ));
- // Note: only start URC here.
- // The downstream read request is started when command mode ends.
- // This is done to make the data arrive in the correct order (reply vs.
- // data) with "ATD" command.
- TInt retVal = KErrNone;
- if ( iPushData.iAtCmdHandler )
- {
- retVal = iPushData.iAtCmdHandler->StartUrc();
- }
- FTRACE(FPrint( _L("CDunDownstream::StartStream() complete" ) ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Stops transfer for read or write endpoints
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::Stop( TBool aStopMplex )
- {
- FTRACE(FPrint( _L("CDunDownstream::Stop() (Dir=%d)" ), iDirection));
- if ( !iPushData.iDataPusher )
- {
- FTRACE(FPrint( _L("CDunDownstream::Stop() (iPushData.iDatapusher not initialized!) complete" )));
- return KErrGeneral;
- }
- // Stop the downstream related AT command handling functionality
- if ( aStopMplex ) // optional
- {
- if ( iPushData.iAtCmdHandler )
- {
- iPushData.iAtCmdHandler->StopAtCmdHandling();
- }
- // Stop the multiplexer separately
- iPushData.iDataPusher->Stop();
- }
- if ( iTransferState != EDunStateTransferring )
- {
- FTRACE(FPrint( _L("CDunDownstream::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- // Stop only current operation
- if ( iOperationType == EDunOperationTypeRead )
- {
- if ( iNetwork )
- {
- iNetwork->ReadCancel();
- Cancel();
- FTRACE(FPrint( _L("CDunDownstream::Stop() (Network) cancelled" )));
- }
- }
- else if ( iOperationType == EDunOperationTypeWrite )
- {
- iPushData.iDataPusher->StopOneEvent( iBufferPtr );
- }
- iTransferState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunDownstream::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunDownstream::CDunDownstream
-// ---------------------------------------------------------------------------
-//
-CDunDownstream::CDunDownstream( MDunTransporterUtilityAux* aUtility ) :
- iUtility( aUtility )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunDownstream::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::ConstructL()
- {
- FTRACE(FPrint( _L("CDunDownstream::ConstructL()" ) ));
- if ( !iUtility )
- {
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunDownstream::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::Initialize()
- {
- // Don't initialize iUtility here (it is set through NewL)
- iPushData.iDataMode = EFalse;
- iPushData.iDataPusher = NULL;
- iPushData.iAtCmdHandler = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// Issues transfer request for this stream
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::IssueRequest()
- {
- // Set direction
- iDirection = static_cast<TDunDirection>( EDunStreamTypeDownstream | iOperationType );
-
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d)" ), iDirection));
- if ( !iPushData.iDataPusher )
- {
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (iPushData.iDataPusher not initialized!) complete" ) ));
- return KErrGeneral;
- }
-
- if ( iTransferState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (not ready) complete" ) ));
- return KErrNotReady;
- }
-
- if ( iOperationType == EDunOperationTypeRead )
- {
- iBufferPtr->SetLength( iBufferPtr->MaxLength() );
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() trying to read %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
- }
- else // iOperationType == EDunOperationTypeWrite
- {
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() writing %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
- }
-
- switch ( iDirection )
- {
- case EDunReaderDownstream:
- iStatus = KRequestPending;
- iNetwork->ReadOneOrMore( iStatus, *iBufferPtr );
- SetActive();
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
- break;
- case EDunWriterDownstream:
- AddToQueueAndSend( iBufferPtr, this );
- break;
- default:
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (ERROR) complete" ) ));
- return KErrGeneral;
- }
-
- iTransferState = EDunStateTransferring;
-
- FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when endpoint data read complete
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::RunL()
- {
- FTRACE(FPrint( _L("CDunDownstream::RunL() (Dir=%d)" ), iDirection));
- iTransferState = EDunStateIdle;
- if ( iOperationType != EDunOperationTypeRead )
- {
- FTRACE(FPrint( _L("CDunDownstream::RunL() (wrong operation type!) complete" )));
- return;
- }
-
- TBool isError;
- TInt retTemp = iStatus.Int();
- TInt stop = ProcessErrorCondition( retTemp, isError );
-
- if ( !stop ) // no real error detected -> continue
- {
- if ( !isError )
- {
- // Operation type was read so now set to write
- iOperationType = EDunOperationTypeWrite;
- } // if ( !isError )
-
- IssueRequest();
-
- } // if ( !stop )
- else // stop -> tear down connection
- {
- // Now CDunDataPusher notifies to write case so here we just notify the
- // read case.
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRW;
- connReason.iContext = GetMediaContext( EDunStreamTypeDownstream );
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = iDirection;
- connReason.iErrorCode = retTemp;
- iUtility->DoNotifyConnectionNotOk( iComm,
- iSocket,
- connReason,
- iCallbacksR );
- FTRACE(FPrint( _L("CDunDownstream::RunL() stop" )));
- } // else
-
- FTRACE(FPrint( _L("CDunDownstream::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::DoCancel()
- {
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunStreamManipulator.
-// Gets called when outside party wants to push data to the existing stream
-// ---------------------------------------------------------------------------
-//
-TInt CDunDownstream::NotifyDataPushRequest( const TDesC8* aDataToPush,
- MDunCompletionReporter* aCallback )
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest()" )));
- // If in data mode push the reply anyway as "CONNECT" or "NO CARRIER"
- // reply could arrive before/after the command mode information itself.
- TInt retVal = AddToQueueAndSend( aDataToPush, aCallback );
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushRequest() complete" )));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCompletionReporter.
-// Gets called when data push is complete
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::NotifyDataPushComplete( TBool aAllPushed )
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete()" )));
- // Next just skip the notifications of atomic operations because also this
- // class initiates the pushing of atomic data.
- if ( !aAllPushed )
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" )));
- return;
- }
- iTransferState = EDunStateIdle;
- iOperationType = EDunOperationTypeUndefined;
- if ( !iPushData.iDataPusher )
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" )));
- return;
- }
- // Now the multiplexer might have pushed the contained data in this class
- // or it might have pushed only the external data. If the pushed data
- // contains this classes data then reissue request, otherwise just clear
- // the queue.
- TInt foundIndex = iPushData.iDataPusher->FindEventFromQueue( iBufferPtr );
- iPushData.iDataPusher->SignalCompletionAndClearQueue();
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" )));
- if ( foundIndex >= 0 )
- {
- // Restart the reading from Dataport only if in data mode
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" )));
- if ( iPushData.iDataMode )
- {
- iOperationType = EDunOperationTypeRead;
- IssueRequest();
- }
- }
- FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCmdModeMonitor.
-// Notifies about command mode start
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::NotifyCommandModeStart()
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" )));
- iPushData.iDataMode = EFalse;
- // Now the data mode has ended.
- // If read operation then cancel it.
- if ( iOperationType == EDunOperationTypeRead )
- {
- Stop( EFalse );
- }
- FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCmdModeMonitor.
-// Notifies about command mode end
-// ---------------------------------------------------------------------------
-//
-void CDunDownstream::NotifyCommandModeEnd()
- {
- FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" )));
- iPushData.iDataMode = ETrue;
- // Command mode ends here so start reading from Dataport
- iOperationType = EDunOperationTypeRead;
- IssueRequest();
- FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" )));
- }
--- a/localconnectivityservice/dun/utils/src/DunNetDataport.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,395 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dataport specific network resource accessor implementation
-*
-*/
-
-
-#include <mmtsy_names.h>
-#include "DunNetDataport.h"
-#include "DunUtils.h"
-#include "DunDebug.h"
-
-_LIT(DUN_GGP_DATAPORT_CSY_PORT, "::DUN");
-_LIT(DUN_GGP_DATAPORT_CSY, "DATAPORT");
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunNetDataport* CDunNetDataport::NewL( TInt aNumOfMaxChannels )
- {
- CDunNetDataport* self = new (ELeave) CDunNetDataport( aNumOfMaxChannels );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunNetDataport::~CDunNetDataport()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::~CDunNetDataport()")));
- TInt i;
- TInt count = iEntities.Count();
- for ( i=0; i<count; i++ )
- {
- DeleteNetworkEntity( i, ETrue );
- }
- DeleteNetwork();
- FTRACE(FPrint(_L( "CDunNetDataport::~CDunNetDataport() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunNetwork (MDunNetDataport -> MDunNetwork).
-// Initializes network for Dataport
-// Must be called before any other operation
-// ---------------------------------------------------------------------------
-//
-void CDunNetDataport::InitializeL()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::InitializeL()")));
- AllocatePhoneObjectsL();
- FTRACE(FPrint(_L( "CDunNetDataport::InitializeL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunNetDataport.
-// Called when channel was created by transporter for Dataport
-// Initializes network for channel creation
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::AllocateChannel( RComm*& aComm )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel()")));
- TInt firstFree = InitializeFirstFreeEntity();
- if ( firstFree < 0 )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() (not found) complete")));
- return firstFree;
- }
- if ( firstFree >= iEntities.Count() )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() (firstfree failed!) complete")));
- return KErrGeneral;
- }
- TInt retTemp = iEntities[firstFree].iMobileCall.OpenNewCall( iMobileLine );
- if ( retTemp != KErrNone )
- {
- RemoveEntity( firstFree ); // remove unused initialized channel
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() OpenNewCall FAILED %d" ), retTemp));
- return KErrGeneral;
- }
- retTemp = iEntities[firstFree].iMobileCall.Connect();
- if ( retTemp != KErrNone )
- {
- RemoveEntity( firstFree ); // remove unused initialized channel
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() iEntities[%d]->iMobileCall.Connect FAILED %d" ), firstFree, retTemp));
- return KErrGeneral;
- }
- RCall::TCommPort portName;
- portName.iPort.Copy( DUN_GGP_DATAPORT_CSY );
- portName.iPort.Append( DUN_GGP_DATAPORT_CSY_PORT );
- retTemp = iEntities[firstFree].iMobileCall.LoanDataPort( portName );
- if ( retTemp != KErrNone )
- {
- RemoveEntity( firstFree ); // remove unused initialized channel
- if ( retTemp == KErrEtelPortNotLoanedToClient )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() (too big) complete")));
- return KErrTooBig;
- }
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() iEntities[%d]->iMobileCall.LoanDataPort FAILED %d" ), firstFree, retTemp));
- return KErrGeneral;
- }
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() Created call object at index %d" ), firstFree));
- retTemp = iEntities[firstFree].iDataport.Open( iCommServer,
- portName.iPort,
- ECommExclusive,
- ECommRoleDTE );
- if ( retTemp != KErrNone )
- {
- RemoveEntity( firstFree ); // remove unused initialized channel
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() FAILED to open dataport %d"), retTemp));
- return KErrGeneral;
- }
- iEntities[firstFree].iDataport.ResetBuffers();
- iEntities[firstFree].iEntityInUse = ETrue;
- aComm = &iEntities[firstFree].iDataport;
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() (iEntities[%d]->iDataport) opened"), firstFree));
- FTRACE(FPrint(_L( "CDunNetDataport::AllocateChannel() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunNetDataport.
-// Called when channel was deleted/closed by transporter for Dataport
-// Uninitializes network for channel deletion/close
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::FreeChannel( RComm* aComm )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::FreeChannel()")));
- TInt i;
- TInt count = iEntities.Count();
- for ( i=0; i<count; i++ )
- {
- if ( &iEntities[i].iDataport == aComm )
- {
- if ( iEntities[i].iEntityInUse )
- {
- break;
- }
- }
- }
- if ( i >= count )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::FreeChannel() (not found) complete")));
- return KErrNotFound;
- }
- DeleteNetworkEntity( i, ETrue );
- FTRACE(FPrint(_L( "CDunNetDataport::FreeChannel() (iEntities[%d]->iDataport) freed"), i));
- FTRACE(FPrint(_L( "CDunNetDataport::FreeChannel() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunNetDataport.
-// Gets index by network ID for Dataport
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::GetIndexById( RComm* aComm )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::GetIndexById()")));
- TInt i;
- TInt count = iEntities.Count();
- for ( i=0; i<count; i++ )
- {
- TDunDataportEntity& entity = iEntities[i];
- if ( entity.iEntityInUse )
- {
- if ( &entity.iDataport == aComm )
- {
- return i;
- }
- }
- }
- FTRACE(FPrint(_L( "CDunNetDataport::GetIndexById() (not found) complete")));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// CDunNetDataport::CDunNetDataport
-// ---------------------------------------------------------------------------
-//
-CDunNetDataport::CDunNetDataport( TInt aNumOfMaxChannels ) :
- iNumOfMaxChannels( aNumOfMaxChannels )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunNetDataport::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunNetDataport::ConstructL()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::ConstructL()")));
- if ( iNumOfMaxChannels < 0 )
- {
- User::Leave( KErrGeneral );
- }
- TInt retTemp = CDunUtils::ConnectCommsServer( iCommServer );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::ConstructL() FAILED to connect comms server")));
- User::Leave( retTemp );
- }
- retTemp = iCommServer.LoadCommModule( DUN_GGP_DATAPORT_CSY );
- if ( retTemp != KErrNone )
- {
- iCommServer.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::ConstructL() FAILED to load comm module")));
- User::Leave( retTemp );
- }
- FTRACE(FPrint(_L( "CDunNetDataport::ConstructL() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Allocates phone objects for use
-// ---------------------------------------------------------------------------
-//
-void CDunNetDataport::AllocatePhoneObjectsL()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL()" ) ));
- TInt retTemp;
- retTemp = iTelServer.Connect();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL() iTelServer Connect FAILED %d" ), retTemp ));
- User::Leave( retTemp );
- }
- retTemp = iTelServer.LoadPhoneModule( KMmTsyModuleName );
- if ( retTemp!=KErrNone && retTemp!=KErrAlreadyExists )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL() LoadPhoneModule FAILED %d" ), retTemp ));
- User::Leave( retTemp );
- }
- retTemp = iMobilePhone.Open( iTelServer, KMmTsyPhoneName );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL() MobilePhone Open FAILED %d" ), retTemp ));
- User::Leave( retTemp );
- }
- retTemp = iMobileLine.Open( iMobilePhone, KMmTsyDataLineName );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL() MobileLine Open FAILED %d" ), retTemp ));
- User::Leave( retTemp );
- }
- FTRACE(FPrint(_L( "CDunNetDataport::AllocatePhoneObjectsL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes first free entity
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::InitializeFirstFreeEntity()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::InitializeFirstFreeEntity()")));
- TInt i;
- TInt retTemp;
- TInt count = iEntities.Count();
- for ( i=0; i<count; i++ )
- {
- if ( !iEntities[i].iEntityInUse )
- {
- FTRACE(FPrint( _L("CDunNetDataport::InitializeFirstFreeEntity() complete" )));
- return i;
- }
- }
- // Free channel not found, now create new if possible
- if ( iNumOfMaxChannels!=0 && iEntities.Count()>=iNumOfMaxChannels )
- {
- FTRACE(FPrint( _L("CDunNetDataport::InitializeFirstFreeEntity() (too big) complete" )));
- return KErrTooBig;
- }
- TDunDataportEntity emptyEntity;
- emptyEntity.iEntityInUse = EFalse;
- retTemp = iEntities.Append( emptyEntity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunNetDataport::InitializeFirstFreeEntity() (append failed!) complete" )));
- return retTemp;
- }
- FTRACE(FPrint(_L( "CDunNetDataport::InitializeFirstFreeEntity() complete")));
- return i;
- }
-
-// ---------------------------------------------------------------------------
-// Remove network entity by index
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::RemoveEntity( TInt aIndex )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::RemoveEntity()")));
- if ( aIndex < 0 ||
- aIndex >= iEntities.Count() )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::RemoveEntity() (not found) complete")));
- return KErrNotFound;
- }
- DeleteNetworkEntity( aIndex, EFalse );
- FTRACE(FPrint(_L( "CDunNetDataport::RemoveEntity() complete")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Deletes own internal data
-// ---------------------------------------------------------------------------
-//
-void CDunNetDataport::DeleteNetwork()
- {
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork()")));
- if ( iMobileLine.SubSessionHandle() )
- {
- iMobileLine.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() mobile line closed")));
- }
- if ( iMobilePhone.SubSessionHandle() )
- {
- iMobilePhone.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() mobile phone closed")));
- }
- if ( iTelServer.Handle() )
- {
- iTelServer.UnloadPhoneModule( KMmTsyModuleName );
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() phone module unloaded")));
- iTelServer.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() phone module closed")));
- }
- if ( iCommServer.Handle() )
- {
- iCommServer.UnloadCommModule( DUN_GGP_DATAPORT_CSY );
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() comm module unloaded")));
- iCommServer.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() comm module closed")));
- }
- iEntities.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetwork() complete")));
- }
-
-// ---------------------------------------------------------------------------
-// Deletes one network entity at index aIndex for Dataport
-// ---------------------------------------------------------------------------
-//
-TInt CDunNetDataport::DeleteNetworkEntity( TInt aIndex, TBool aCheckFree )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity()")));
- if ( aIndex < 0 ||
- aIndex >= iEntities.Count() )
- {
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() (not found) complete"), aIndex));
- return KErrGeneral;
- }
- TDunDataportEntity& entity = iEntities[aIndex];
- if ( (aCheckFree&&entity.iEntityInUse) || !aCheckFree )
- {
- if ( entity.iDataport.SubSessionHandle() )
- {
- // The next will set KSignalDTEOutputs down twice for RComm
- // local media case because CDunSignalCopy clears them also which
- // in turn causes plugin to free channel. But this probably won't
- // cause any harm.
- entity.iDataport.SetSignals( 0, KSignalDTEOutputs );
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() RComm signals set")));
- entity.iDataport.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() RComm closed")));
- }
- if ( entity.iMobileCall.SubSessionHandle() )
- {
- entity.iMobileCall.RecoverDataPort();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() Dataport recovered")));
- entity.iMobileCall.Close();
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() Dataport closed")));
- }
- entity.iEntityInUse = EFalse;
- }
- FTRACE(FPrint(_L( "CDunNetDataport::DeleteNetworkEntity() complete")));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Manages note showing in UI
-*
-*/
-
-
-#include "DunNoteHandler.h"
-#include "DunDebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunNoteHandler* CDunNoteHandler::NewL()
- {
- CDunNoteHandler* self = new (ELeave) CDunNoteHandler();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CDunNoteHandler::~CDunNoteHandler()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::~CDunNoteHandler()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunNoteHandler::~CDunNoteHandler() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::ResetData()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- delete iNote;
- iNote = NULL;
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunNoteHandler::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start showing UI note
-// ---------------------------------------------------------------------------
-//
-TInt CDunNoteHandler::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest()") ));
- if ( iNoteState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() (not ready) complete") ));
- return KErrNotReady;
- }
- TRAPD( retTrap, DoIssueRequestL() );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() (trapped!) complete (%d)"), retTrap));
- return retTrap;
- }
- iNoteState = EDunStateUiNoting;
- FTRACE(FPrint( _L("CDunNoteHandler::IssueRequest() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops showing UI note
-// ---------------------------------------------------------------------------
-//
-TInt CDunNoteHandler::Stop()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::Stop()") ));
- if ( iNoteState != EDunStateUiNoting )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::Stop() (not ready) complete") ));
- return KErrNotReady;
- }
- if ( !iNote )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::Stop() (iNote not initialized!) complete") ));
- return KErrGeneral;
- }
- iNote->Close();
- iNoteState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunNoteHandler::Stop() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunNoteHandler::CDunNoteHandler
-// ---------------------------------------------------------------------------
-//
-CDunNoteHandler::CDunNoteHandler()
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunNoteHandler::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::ConstructL()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::ConstructL()") ));
- FTRACE(FPrint( _L("CDunNoteHandler::ConstructL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::Initialize()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::Initialize()" ) ));
- iNote = NULL;
- iNoteState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunNoteHandler::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start showing UI note
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::DoIssueRequestL()
- {
- FTRACE(FPrint( _L("CDunNoteHandler::DoIssueRequestL()") ));
- if ( iNote )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::DoIssueRequestL() (ERROR) complete") ));
- User::Leave( KErrGeneral );
- }
-
- CHbDeviceMessageBoxSymbian* messageBox =
- CHbDeviceMessageBoxSymbian::NewL(
- CHbDeviceMessageBoxSymbian::EWarning);
- CleanupStack::PushL(messageBox);
- //ToDo: Need to use localised strings.
- _LIT(KText, "Maximum number of dialup-connections. Dial-up failed.");
- messageBox->SetTextL(KText);
- messageBox->SetObserver(this);
- messageBox->SetTimeout(0);
- messageBox->ShowL();
- CleanupStack::Pop(messageBox);
- iNote = messageBox;
- FTRACE(FPrint( _L("CDunNoteHandler::DoIssueRequestL() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// From class MHbDeviceMessageBoxObserver.
-// Gets called on dialog close.
-// ---------------------------------------------------------------------------
-//
-void CDunNoteHandler::MessageBoxClosed(
- const CHbDeviceMessageBoxSymbian* /*aMessageBox*/,
- CHbDeviceMessageBoxSymbian::TButtonId /*aButton*/ )
- {
- FTRACE(FPrint( _L("CDunNoteHandler::MessageBoxClosed()" ) ));
- iNoteState = EDunStateIdle;
- delete iNote;
- iNote = NULL;
- FTRACE(FPrint( _L("CDunNoteHandler::MessageBoxClosed() complete" ) ));
- }
--- a/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Copies signals changes between network and local media
-*
-*/
-
-
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#else
-#include <d32comm.h>
-#endif
-#include "DunTransporter.h"
-#include "DunSignalCopy.h"
-#include "DunDebug.h"
-
-const TUint KDunSixLowestBitsMask = 0x3F; // Symbian magic
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunSignalCopy* CDunSignalCopy::NewL()
- {
- CDunSignalCopy* self = new (ELeave) CDunSignalCopy();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CDunSignalCopy::~CDunSignalCopy()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::~CDunSignalCopy()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunSignalCopy::~CDunSignalCopy() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ResetData()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // AddCallback()
- iCallbacks.Close();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunSignalCopy::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for line status change controlling
-// The callback will be called when RunL error is detected
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalCopy::AddCallback( MDunConnMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::AddCallback()" ) ));
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (aCallback) not initialized!" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCallbacks.Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCallbacks.Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunSignalCopy::AddCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint monitor
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalCopy::SetMedia( RComm* aComm,
- RComm* aNetwork,
- TDunStreamType aStreamType )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::SetMedia()" )));
- if ( !aNetwork )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aComm) not initialized!" )));
- return KErrGeneral;
- }
- RComm* comm = NULL;
- if ( aStreamType == EDunStreamTypeUpstream )
- {
- iContextInUse = EDunMediaContextLocal;
- comm = aComm;
- }
- else if ( aStreamType == EDunStreamTypeDownstream )
- {
- iContextInUse = EDunMediaContextNetwork;
- comm = aNetwork;
- }
- else
- {
- FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aStreamtype) not initialized!" )));
- return KErrGeneral;
- }
- // No possibility to do iUtility->GetLocalId() here as aComm is not yet
- // in channel data; use aComm directly
- TCommCaps2 caps;
- comm->Caps( caps );
- if ( !(caps().iNotificationCaps & KNotifySignalsChangeSupported) )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) (not supported) complete" )));
- return KErrNotSupported;
- }
- iComm = aComm;
- iNetwork = aNetwork;
- iStreamType = aStreamType;
- FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start monitoring the endpoint for line status change
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalCopy::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest()" )));
- if ( iSignalCopyState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (not ready) complete" ) ));
- return KErrNotReady;
- }
- RComm* comm = NULL;
- if ( iStreamType == EDunStreamTypeUpstream )
- {
- iListenSignals = KSignalDCEInputs;
- comm = iComm;
- }
- else if ( iStreamType == EDunStreamTypeDownstream )
- {
- iListenSignals = KSignalDTEInputs;
- comm = iNetwork;
- }
- else
- {
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TUint currentSignals = comm->Signals( iListenSignals );
- TUint oldSignalsLow = iSignals & KDunSixLowestBitsMask;
- TUint newSignalsLow = currentSignals & KDunSixLowestBitsMask;
- TUint oldSignalsHigh = oldSignalsLow * KSignalChanged;
- TUint newSignalsHigh = newSignalsLow * KSignalChanged;
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsLow=0x%08X" ), oldSignalsLow ));
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsLow=0x%08X" ), newSignalsLow ));
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsHigh=0x%08X" ), oldSignalsHigh ));
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsHigh=0x%08X" ), newSignalsHigh ));
- if ( newSignalsLow != oldSignalsLow )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() signals already set..." ) ));
- iSignals = newSignalsLow | (oldSignalsHigh ^ newSignalsHigh);
- ManageSignalChange();
- }
- else
- {
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() start waiting for change..." ) ));
- iStatus = KRequestPending;
- comm->NotifySignalChange( iStatus, iSignals, iListenSignals );
- SetActive();
- iSignalCopyState = EDunStateSignalCopy;
- }
- FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops monitoring the endpoint for line status change
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalCopy::Stop()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::Stop()" )));
- if ( iSignalCopyState != EDunStateSignalCopy )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( iStreamType == EDunStreamTypeUpstream )
- {
- iComm->NotifySignalChangeCancel();
- }
- else if ( iStreamType == EDunStreamTypeDownstream )
- {
- iNetwork->NotifySignalChangeCancel();
- }
- else
- {
- FTRACE(FPrint( _L("CDunSignalCopy::Stop() (ERROR) complete" )));
- return KErrGeneral;
- }
- Cancel();
- iSignalCopyState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunSignalCopy::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalCopy::CDunSignalCopy
-// ---------------------------------------------------------------------------
-//
-CDunSignalCopy::CDunSignalCopy() :
- CActive( EPriorityHigh )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalCopy::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ConstructL()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ConstructL()" ) ));
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunSignalCopy::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::Initialize()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::Initialize()" ) ));
- iContextInUse = EDunMediaContextUndefined;
- iStreamType = EDunStreamTypeUndefined;
- iSignalCopyState = EDunStateIdle;
- iListenSignals = 0;
- iSignals = 0;
- iNetwork = NULL;
- iComm = NULL;
- FTRACE(FPrint( _L("CDunSignalCopy::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages signal changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ManageSignalChange()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChange()" ) ));
-
- if ( iStreamType == EDunStreamTypeUpstream )
- {
- // Manage upstream case
- ManageSignalChangeUpstream();
- }
- else // iStreamType == EDunStreamTypeDownstream
- {
- // Manage downstream case
- ManageSignalChangeDownstream();
- }
-
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChange() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages upstream signal changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ManageSignalChangeUpstream()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream()" ) ));
- // For upstream the following signals are set for local media:
- // KSignalDCEInputs = KSignalRTS | KSignalDTR
- if ( iSignals & KRTSChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() checking RTS..." ) ));
- if ( iSignals & KSignalRTS ) // RTS changed to high
- {
- ChangeUpstreamSignal( KSignalRTS, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() RTS changed high" ) ));
- }
- else // RTS changed to low
- {
- ChangeUpstreamSignal( 0, KSignalRTS );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() RTS changed low" ) ));
- }
- }
- if ( iSignals & KDTRChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() checking DTR..." ) ));
- if ( iSignals & KSignalDTR ) // DTR changed to high
- {
- ChangeUpstreamSignal( KSignalDTR, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() DTR changed high" ) ));
- }
- else // DTR changed to low
- {
- ChangeUpstreamSignal( 0, KSignalDTR );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() DTR changed low" ) ));
- }
- }
- IssueRequest();
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeUpstream() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages downstream signal changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ManageSignalChangeDownstream()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream()" ) ));
- // For downstream the following signals are set for network:
- // KSignalDTEInputs = KSignalCTS | KSignalDSR | KSignalDCD | KSignalRNG
- if ( iSignals & KCTSChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking CTS..." ) ));
- if ( iSignals & KSignalCTS ) // CTS changed to high or initially high
- {
- ChangeDownstreamSignal( KSignalCTS, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() CTS changed high" ) ));
- }
- else // CTS changed to low
- {
- ChangeDownstreamSignal( 0, KSignalCTS );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() CTS changed low" ) ));
- }
- }
- if ( iSignals & KDSRChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking DSR..." ) ));
- if ( iSignals & KSignalDSR ) // DSR changed to high
- {
- ChangeDownstreamSignal( KSignalDSR, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DSR changed high" ) ));
- }
- else // DSR changed to low
- {
- ChangeDownstreamSignal( 0, KSignalDSR );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DSR changed low" ) ));
- }
- }
- if ( iSignals & KDCDChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking DCD..." ) ));
- if ( iSignals & KSignalDCD ) // DCD changed to high
- {
- ChangeDownstreamSignal( KSignalDCD, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DCD changed high" ) ));
- }
- else // DCD changed to low
- {
- ChangeDownstreamSignal( 0, KSignalDCD );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() DCD changed low" ) ));
- }
- }
- if ( iSignals & KRNGChanged )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() checking RNG..." ) ));
- if ( iSignals & KSignalRNG ) // RNG changed to high
- {
- ChangeDownstreamSignal( KSignalRNG, 0 );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() RNG changed high" ) ));
- }
- else // RNG changed to low
- {
- ChangeDownstreamSignal( 0, KSignalRNG );
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() RNG changed low" ) ));
- }
- }
- IssueRequest();
- FTRACE(FPrint( _L("CDunSignalCopy::ManageSignalChangeDownstream() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Changes upstream signal
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ChangeUpstreamSignal( TUint aSetMask, TUint aClearMask )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ChangeUpstreamSignal()" ) ));
- if ( iNetwork )
- {
- iNetwork->SetSignals( aSetMask, aClearMask );
- }
- // Add other cases here if necessary
- FTRACE(FPrint( _L("CDunSignalCopy::ChangeUpstreamSignal() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Changes downstream signal
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::ChangeDownstreamSignal( TUint aSetMask, TUint aClearMask )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::ChangeDownstreamSignal()" ) ));
- if ( iComm )
- {
- iComm->SetSignals( aSetMask, aClearMask );
- }
- // Add other cases here if necessary
- FTRACE(FPrint( _L("CDunSignalCopy::ChangeDownstreamSignal() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when line status changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::RunL()
- {
- FTRACE(FPrint( _L("CDunSignalCopy::RunL()" ) ));
- iSignalCopyState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunSignalCopy::RunL() (failed) complete (%d)"), retTemp));
- TInt i;
- TInt count = iCallbacks.Count();
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRunL;
- connReason.iContext = iContextInUse;
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = EDunDirectionUndefined;
- connReason.iErrorCode = retTemp;
- for ( i=0; i<count; i++ )
- {
- TRAP_IGNORE(
- iCallbacks[i]->NotifyProgressChangeL( iComm, connReason ) );
- }
- return;
- }
- FTRACE(FPrint( _L("CDunSignalCopy::RunL() managing signal 0x%08X" ), iSignals ));
- ManageSignalChange();
- FTRACE(FPrint( _L("CDunSignalCopy::RunL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunSignalCopy::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,385 +0,0 @@
-/*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors signal changes on network side and reports changes
-*
-*/
-
-
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#else
-#include <d32comm.h>
-#endif
-#include "DunTransporter.h"
-#include "DunSignalNotify.h"
-#include "DunDebug.h"
-
-const TUint KDunSixLowestBitsMask = 0x3F; // Symbian magic
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunSignalNotify* CDunSignalNotify::NewL( MDunTransporterUtilityAux* aUtility )
- {
- CDunSignalNotify* self = new (ELeave) CDunSignalNotify( aUtility );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CDunSignalNotify::~CDunSignalNotify()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::~CDunSignalNotify()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunSignalNotify::~CDunSignalNotify() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::ResetData()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // AddCallback()
- iCallbacks.Close();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunSignalNotify::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for line status change controlling
-// The callback will be called when line status change is detected in
-// endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalNotify::AddCallback( MDunConnMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::AddCallback()" ) ));
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::AddCallback() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCallbacks.Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::AddCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCallbacks.Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::AddCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunSignalNotify::AddCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint monitor
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalNotify::SetMedia( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::SetMedia()" )));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::SetMedia() (aComm) not initialized!" )));
- return KErrGeneral;
- }
- // As it's not possible to listen for RFCOMM signal changes the RTS and DTR
- // signals should be anyway set high to Dataport
- aComm->SetSignals( KSignalRTS|KSignalDTR, 0 );
- // Next check if signal change notification from Dataport supported
- TCommCaps2 caps;
- aComm->Caps( caps );
- if ( !(caps().iNotificationCaps & KNotifySignalsChangeSupported) )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::SetMedia() (RComm) (not supported) complete" )));
- return KErrNotSupported;
- }
- iListenSignals = KSignalDTEInputs;
- iNetwork = aComm;
- FTRACE(FPrint( _L("CDunSignalNotify::SetMedia() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start monitoring the endpoint for line status change
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalNotify::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest()" )));
- if ( iSignalNotifyState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iNetwork )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() (iNetwork) not initialized!" ) ));
- return KErrGeneral;
- }
- TUint currentSignals = iNetwork->Signals( iListenSignals );
- TUint oldSignalsLow = iSignals & KDunSixLowestBitsMask;
- TUint newSignalsLow = currentSignals & KDunSixLowestBitsMask;
- TUint oldSignalsHigh = oldSignalsLow * KSignalChanged;
- TUint newSignalsHigh = newSignalsLow * KSignalChanged;
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() oldSignalsLow=0x%08X" ), oldSignalsLow ));
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() newSignalsLow=0x%08X" ), newSignalsLow ));
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() oldSignalsHigh=0x%08X" ), oldSignalsHigh ));
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() newSignalsHigh=0x%08X" ), newSignalsHigh ));
- if ( newSignalsLow != oldSignalsLow )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() signals already set..." ) ));
- iSignals = newSignalsLow | (oldSignalsHigh ^ newSignalsHigh);
- ManageSignalChange();
- }
- else
- {
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() start waiting for change..." ) ));
- iStatus = KRequestPending;
- iNetwork->NotifySignalChange( iStatus, iSignals, iListenSignals );
- SetActive();
- iSignalNotifyState = EDunStateSignalNotify;
- }
- FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops monitoring the endpoint for line status change
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalNotify::Stop()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::Stop()" )));
- if ( iSignalNotifyState != EDunStateSignalNotify )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iNetwork )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::Stop() (iNetwork) not initialized!" )));
- return KErrGeneral;
- }
- iNetwork->NotifySignalChangeCancel();
- Cancel();
- iSignalNotifyState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunSignalNotify::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalNotify::CDunSignalNotify
-// ---------------------------------------------------------------------------
-//
-CDunSignalNotify::CDunSignalNotify( MDunTransporterUtilityAux* aUtility ) :
- CActive( EPriorityHigh ),
- iUtility( aUtility )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalNotify::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::ConstructL()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ConstructL()" ) ));
- if ( !iUtility )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunSignalNotify::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::Initialize()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::Initialize()" ) ));
- // Don't initialize iUtility here (it is set through NewL)
- iSignalNotifyState = EDunStateIdle;
- iListenSignals = 0;
- iSignals = 0;
- iNetwork = NULL;
- FTRACE(FPrint( _L("CDunSignalNotify::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Manages signal changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::ManageSignalChange()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange()" ) ));
- // The following signals are input signals from network side:
- // KSignalDTEInputs = KSignalCTS | KSignalDSR | KSignalDCD | KSignalRNG
- if ( iSignals & KCTSChanged )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() checking CTS..." ) ));
- if ( iSignals & KSignalCTS ) // CTS changed to high
- {
- ReportSignalChange( KSignalCTS, 0 );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() CTS changed high" ) ));
- }
- else // CTS changed to low
- {
- ReportSignalChange( 0, KSignalCTS );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() CTS changed low" ) ));
- }
- }
- if ( iSignals & KDSRChanged )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() checking DSR..." ) ));
- if ( iSignals & KSignalDSR ) // DSR changed to high
- {
- ReportSignalChange( KSignalDSR, 0 );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() DSR changed high" ) ));
- }
- else // DSR changed to low
- {
- ReportSignalChange( 0, KSignalDSR );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() DSR changed low" ) ));
- }
- }
- if ( iSignals & KDCDChanged )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() checking DCD..." ) ));
- if ( iSignals & KSignalDCD ) // DCD changed to high
- {
- ReportSignalChange( KSignalDCD, 0 );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() DCD changed high" ) ));
- }
- else // DCD changed to low
- {
- ReportSignalChange( 0, KSignalDCD );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() DCD changed low" ) ));
- }
- }
- if ( iSignals & KRNGChanged )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() checking RNG..." ) ));
- if ( iSignals & KSignalRNG ) // RNG changed to high
- {
- ReportSignalChange( KSignalRNG, 0 );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() RNG changed high" ) ));
- }
- else // RNG changed to low
- {
- ReportSignalChange( 0, KSignalRNG );
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() RNG changed low" ) ));
- }
- }
- IssueRequest();
- FTRACE(FPrint( _L("CDunSignalNotify::ManageSignalChange() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Reports signal change
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::ReportSignalChange( TUint aSetMask, TUint aClearMask )
- {
- FTRACE(FPrint( _L("CDunSignalNotify::ReportSignalChange()" ) ));
-
- TUint signalType = aClearMask;
- TUint signalHigh = EFalse;
- if ( aSetMask != 0 )
- {
- signalType = aSetMask;
- signalHigh = ETrue;
- }
- TInt i;
- TInt count = iCallbacks.Count();
- TDunConnectionReason connReason;
- TConnId localId = iUtility->GetLocalId( iNetwork );
- connReason.iReasonType = EDunReasonTypeSignal;
- connReason.iContext = EDunMediaContextNetwork;
- connReason.iSignalType = signalType;
- connReason.iSignalHigh = signalHigh;
- connReason.iDirection = EDunDirectionUndefined;
- connReason.iErrorCode = KErrNone;
- for ( i=0; i<count; i++ )
- {
- TRAP_IGNORE(
- iCallbacks[i]->NotifyProgressChangeL( localId, connReason ) );
- }
-
- FTRACE(FPrint( _L("CDunSignalNotify::ReportSignalChange() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when line status changes
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::RunL()
- {
- FTRACE(FPrint( _L("CDunSignalNotify::RunL()" ) ));
- iSignalNotifyState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- TInt i;
- TInt count = iCallbacks.Count();
- TDunConnectionReason connReason;
- TConnId localId = iUtility->GetLocalId( iNetwork );
- connReason.iReasonType = EDunReasonTypeRunL;
- connReason.iContext = EDunMediaContextNetwork;
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = EDunDirectionUndefined;
- connReason.iErrorCode = retTemp;
- for ( i=0; i<count; i++ )
- {
- TRAP_IGNORE(
- iCallbacks[i]->NotifyProgressChangeL( localId, connReason ) );
- }
- return;
- }
- FTRACE(FPrint( _L("CDunSignalNotify::RunL() managing signal 0x%08X" ), iSignals ));
- ManageSignalChange();
- FTRACE(FPrint( _L("CDunSignalNotify::RunL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunSignalNotify::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Monitors for new data in RComm local media side
-*
-*/
-
-
-#ifdef PRJ_USE_NETWORK_STUBS
-#include <c32comm_stub.h>
-#else
-#include <d32comm.h>
-#endif
-#include "DunTransporter.h"
-#include "DunSignalWaiter.h"
-#include "DunSignalCopy.h"
-#include "DunDebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunSignalWaiter* CDunSignalWaiter::NewL( MDunChannelAllocator* aChannelCallback )
- {
- CDunSignalWaiter* self = new (ELeave) CDunSignalWaiter( aChannelCallback );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunSignalWaiter::~CDunSignalWaiter()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::~CDunSignalWaiter()") ));
- ResetData();
- FTRACE(FPrint( _L("CDunSignalWaiter::~CDunSignalWaiter() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunSignalWaiter::ResetData()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::ResetData()") ));
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // AddConnMonCallbackL()
- iCallbacks.Close();
- // Internal
- Initialize();
- FTRACE(FPrint( _L("CDunSignalWaiter::ResetData() complete") ));
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for RunL error controlling
-// The callback will be called when error is detected in asynchronous
-// operation
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalWaiter::AddCallback( MDunConnMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::AddCallback()" ) ));
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::AddCallback() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TInt retTemp = iCallbacks.Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::AddCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = iCallbacks.Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::AddCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunSignalWaiter::AddCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalWaiter::SetMedia( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::SetMedia(RComm) (addr=0x%08X)" ), aComm));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::SetMedia() (aComm) not initialized!" )));
- return KErrGeneral;
- }
- TCommCaps2 caps;
- aComm->Caps( caps );
- if ( !(caps().iNotificationCaps & KNotifySignalsChangeSupported) )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::SetMedia() (RComm) (not supported) complete" )));
- return KErrNotSupported;
- }
- iComm = aComm;
- FTRACE(FPrint( _L("CDunSignalWaiter::SetMedia() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues request to start waiting for new data in RComm
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalWaiter::IssueRequest()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest()" )));
- if ( iSignalWaiterState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iComm )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest() (iComm) not initialized!" ) ));
- return KErrGeneral;
- }
- iStatus = KRequestPending;
- iComm->NotifySignalChange( iStatus, iSignals, KSignalDCEInputs );
- SetActive();
- iSignalWaiterState = EDunStateSignalWaiting;
- FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops monitoring for new data
-// ---------------------------------------------------------------------------
-//
-TInt CDunSignalWaiter::Stop()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::Stop()" )));
- if ( iSignalWaiterState != EDunStateSignalWaiting )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- if ( !iComm )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::Stop() (iComm) not initialized!" )));
- return KErrGeneral;
- }
- iComm->NotifySignalChangeCancel();
- Cancel();
- iSignalWaiterState = EDunStateIdle;
- FTRACE(FPrint( _L("CDunSignalWaiter::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalWaiter::CDunSignalWaiter
-// ---------------------------------------------------------------------------
-//
-CDunSignalWaiter::CDunSignalWaiter( MDunChannelAllocator* aChannelCallback ) :
- CActive( EPriorityHigh ),
- iChannelCallback( aChannelCallback )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunSignalWaiter::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunSignalWaiter::ConstructL()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::ConstructL()" ) ));
- if ( !iChannelCallback )
- {
- User::Leave( KErrGeneral );
- }
- CActiveScheduler::Add( this );
- FTRACE(FPrint( _L("CDunSignalWaiter::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunSignalWaiter::Initialize()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::Initialize()" ) ));
- // Don't initialize iChannelCallback here (it is set through NewL)
- iSignalWaiterState = EDunStateIdle;
- iSignals = 0;
- iComm = NULL;
- FTRACE(FPrint( _L("CDunSignalWaiter::Initialize() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when signals changed in RComm object
-// ---------------------------------------------------------------------------
-//
-void CDunSignalWaiter::RunL()
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::RunL()" ) ));
- iSignalWaiterState = EDunStateIdle;
- TInt retTemp = iStatus.Int();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunSignalWaiter::RunL() (failed) complete (%d)"), retTemp));
- TInt count = iCallbacks.Count();
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRunL;
- connReason.iContext = EDunMediaContextLocal;
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = EDunDirectionUndefined;
- connReason.iErrorCode = retTemp;
- for ( TInt i=0; i<count; i++ )
- {
- TRAP_IGNORE(
- iCallbacks[i]->NotifyProgressChangeL( iComm, connReason ) );
- }
- return;
- }
- if ( iChannelCallback )
- {
- iChannelCallback->NotifyNewChannelRequest( iComm );
- }
- FTRACE(FPrint( _L("CDunSignalWaiter::RunL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunSignalWaiter::DoCancel()
- {
- }
--- a/localconnectivityservice/dun/utils/src/DunStream.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for common stream functionality
-*
-*/
-
-
-/*
- * TODO: When local media is of type RComm, listening on it is started with
- * RComm::NotifyDataAvailable() call. Check that USB ACM port and Irda RCOMM
- * (and any other new media in the future) behaves correctly so that when
- * RComm::ReadOneOrMore() is issued, the read is issued immediately without
- * checking for new data. If waiting for new data happens in this
- * NotifyDataAvailable/ReadOneOrMore combination, raise a defect to Symbian.
- */
-
-#include "DunStream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunStream::~CDunStream()
- {
- FTRACE(FPrint( _L("CDunStream::~CDunStream()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunStream::~CDunStream() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunStream::ResetData()
- {
- // APIs affecting this:
- // AddConnMonCallback()
- iCallbacksR.Close();
- iCallbacksW.Close();
- // AddSkippedError()
- iOkErrorsR.Close();
- iOkErrorsW.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Adds error code to consider as "no error" to either endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::AddSkippedError( TInt aError,
- TDunOperationType aOperationType )
- {
- FTRACE(FPrint( _L("CDunStream::AddSkippedError()" ) ));
- RArray<TInt>* okErrors = NULL;
- if ( aOperationType == EDunOperationTypeRead )
- {
- okErrors = &iOkErrorsR;
- }
- else if ( aOperationType == EDunOperationTypeWrite )
- {
- okErrors = &iOkErrorsW;
- }
- else
- {
- FTRACE(FPrint( _L("CDunStream::AddSkippedError() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- if ( aError >= 0 ) // errors can't be >= 0
- {
- FTRACE(FPrint( _L("CDunStream::AddSkippedError() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- TInt retTemp = okErrors->Find( aError );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunStream::AddSkippedError() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = okErrors->Append( aError );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunStream::AddSkippedError() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunStream::AddSkippedError() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Adds callback for line status change controlling
-// The callback will be called when serious read error is detected
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::AddConnMonCallback( MDunConnMon* aCallback,
- TDunOperationType aOperationType )
- {
- FTRACE(FPrint( _L("CDunStream::AddConnMonCallback()" ) ));
- RPointerArray<MDunConnMon>* callbacks = NULL;
- if ( aOperationType == EDunOperationTypeRead )
- {
- callbacks = &iCallbacksR;
- }
- else if ( aOperationType == EDunOperationTypeWrite )
- {
- callbacks = &iCallbacksW;
- }
- else
- {
- FTRACE(FPrint( _L("CDunStream::AddConnMonCallback() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunStream::AddConnMonCallback() (aCallback) not initialized!" ) ));
- return KErrGeneral;
- }
- TInt retTemp = callbacks->Find( aCallback );
- if ( retTemp != KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunStream::AddCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- retTemp = callbacks->Append( aCallback );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunStream::AddCallback() (append failed!) complete" ) ));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunStream::AddCallback() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets buffering for this stream
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::SetBuffering( TPtr8* aBufferPtr )
- {
- FTRACE(FPrint( _L("CDunStream::SetBuffering()" ) ));
- if ( !aBufferPtr )
- {
- FTRACE(FPrint( _L("CDunStream::SetBuffering() (aBufferPtr) not initialized!" ) ));
- return KErrGeneral;
- }
- if ( iBufferPtr )
- {
- FTRACE(FPrint( _L("CDunStream::SetBuffering() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- iBufferPtr = aBufferPtr;
- FTRACE(FPrint( _L("CDunStream::SetBuffering() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::SetMedia( RComm* aComm, TDunMediaContext aMediaContext )
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RComm)" ) ));
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RComm) (aComm not initialized!) complete" ) ));
- return KErrGeneral;
- }
- if ( aMediaContext == EDunMediaContextNetwork )
- {
- iNetwork = aComm;
- }
- else if ( aMediaContext == EDunMediaContextLocal )
- {
- iComm = aComm;
- }
- else
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RComm) (ERROR) complete" )));
- return KErrGeneral;
- }
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RComm) complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets media to use for this endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::SetMedia( RSocket* aSocket,
- TDunMediaContext aMediaContext )
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RSocket)" ) ));
- if ( !aSocket )
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RSocket) (aSocket not initialized!) complete" ) ));
- return KErrGeneral;
- }
- if ( aMediaContext == EDunMediaContextLocal )
- {
- iSocket = aSocket;
- }
- else
- {
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RSocket) (not supported) complete" ) ));
- return KErrNotSupported;
- }
- FTRACE(FPrint( _L("CDunStream::SetMedia() (RSocket) complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Gets media context
-// ---------------------------------------------------------------------------
-//
-TDunMediaContext CDunStream::GetMediaContext( TDunStreamType aStreamType )
- {
- FTRACE(FPrint( _L("CDunStream::GetMediaContext()" ) ));
- if ( aStreamType == EDunStreamTypeUpstream )
- {
- if ( iOperationType == EDunOperationTypeRead )
- {
- return EDunMediaContextLocal;
- }
- else if ( iOperationType == EDunOperationTypeWrite )
- {
- return EDunMediaContextNetwork;
- }
- else
- {
- return EDunMediaContextUndefined;
- }
- }
- else if ( aStreamType == EDunStreamTypeDownstream )
- {
- if ( iOperationType == EDunOperationTypeRead )
- {
- return EDunMediaContextNetwork;
- }
- else if ( iOperationType == EDunOperationTypeWrite )
- {
- return EDunMediaContextLocal;
- }
- else
- {
- return EDunMediaContextUndefined;
- }
- }
- FTRACE(FPrint( _L("CDunStream::GetMediaContext() complete" ) ));
- return EDunMediaContextUndefined;
- }
-
-// ---------------------------------------------------------------------------
-// Check whether an error code is severe error or not
-// ---------------------------------------------------------------------------
-//
-TInt CDunStream::ProcessErrorCondition( TInt aError, TBool& aIsError )
- {
- FTRACE(FPrint( _L("CDunStream::ProcessErrorCondition() (Dir=%d)" ), iDirection));
- aIsError = EFalse;
- if ( aError != KErrNone )
- {
- aIsError = ETrue;
- RArray<TInt>* okErrors = NULL;
- if ( iOperationType == EDunOperationTypeRead )
- {
- okErrors = &iOkErrorsR;
- }
- else // iOperationType == EDunOperationTypeWrite
- {
- okErrors = &iOkErrorsW;
- }
- TInt retTemp = okErrors->Find( aError );
- if ( retTemp == KErrNotFound )
- {
- FTRACE(FPrint( _L("CDunStream::ProcessErrorCondition() (Dir=%d) (%d=ETrue) complete" ), iDirection, aError));
- return ETrue;
- }
- }
- FTRACE(FPrint( _L("CDunStream::ProcessErrorCondition() (Dir=%d) (%d=EFalse) complete" ), iDirection, aError));
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// CDunStream::CDunStream
-// ---------------------------------------------------------------------------
-//
-CDunStream::CDunStream() : CActive( EPriorityHigh )
- {
- Initialize();
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunStream::Initialize()
- {
- // Don't initialize iUtility here (it is set through NewL)
- iBufferPtr = NULL;
- iReadLengthSocket = 0;
- iOperationType = EDunOperationTypeUndefined;
- iTransferState = EDunStateIdle;
- iDirection = EDunDirectionUndefined;
- iNetwork = NULL;
- iSocket = NULL;
- iComm = NULL;
- }
--- a/localconnectivityservice/dun/utils/src/DunTransUtils.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1077 +0,0 @@
-/*
-* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Utility class for other CDunTransporter classes
-*
-*/
-
-
-#include <e32base.h>
-#include <e32property.h>
-#include "dundomainpskeys.h"
-#include "DunTransUtils.h"
-#include "DunDataWaiter.h"
-#include "DunUpstream.h"
-#include "DunDownstream.h"
-#include "DunSignalCopy.h"
-#include "DunSignalNotify.h"
-#include "DunNoteHandler.h"
-#include "DunUtils.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunTransUtils* CDunTransUtils::NewL( CDunTransporter& aParent,
- MDunPluginManager* aPluginManager )
- {
- CDunTransUtils* self = new (ELeave) CDunTransUtils( aParent,
- aPluginManager );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunTransUtils::~CDunTransUtils()
- {
- FTRACE(FPrint( _L("CDunTransUtils::~CDunTransUtils()" )));
- FTRACE(FPrint( _L("CDunTransUtils::~CDunTransUtils() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// CDunTransUtils::CDunTransUtils
-// ---------------------------------------------------------------------------
-//
-CDunTransUtils::CDunTransUtils( CDunTransporter& aParent,
- MDunPluginManager* aPluginManager ) :
- iParent( aParent ),
- iChannelData( aParent.iChannelData ),
- iServAdvData( aParent.iServAdvData ),
- iPluginManager( aPluginManager )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunTransUtils::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::ConstructL()
- {
- FTRACE(FPrint( _L("CDunTransUtils::ConstructL()" )));
- if ( !iPluginManager )
- {
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunTransUtils::ConstructL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Manages service advertisement status changes
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::ManageAdvertisementStatusChange( TBool aAdvertise,
- TBool aCreation )
- {
- FTRACE(FPrint( _L("CDunTransUtils::ManageAdvertisementStatusChange()" )));
- TInt i;
- TInt count;
- iParent.iAdvertise = aAdvertise;
- count = iServAdvData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunServAdvData& servAdvData = iServAdvData[i];
- if ( servAdvData.iServAdvMon )
- {
- if ( aAdvertise )
- {
- servAdvData.iServAdvMon->NotifyAdvertisementStart( aCreation );
- }
- else
- {
- servAdvData.iServAdvMon->NotifyAdvertisementEnd();
- }
- }
- }
- FTRACE(FPrint( _L("CDunTransUtils::ManageAdvertisementStatusChange() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates empty channel data
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::CreateEmptyChannelData( TDunChannelData& aChannel )
- {
- FTRACE(FPrint( _L("CDunTransUtils::CreateEmptyChannelData()" )));
- aChannel.iNetwork = NULL;
- aChannel.iComm = NULL;
- aChannel.iSocket = NULL;
- aChannel.iChannelName = NULL;
- aChannel.iUpstreamRW = NULL;
- aChannel.iDownstreamRW = NULL;
- aChannel.iBufferUpstream = NULL;
- aChannel.iBufferDownstream = NULL;
- aChannel.iBufferUpPtr = NULL;
- aChannel.iBufferDownPtr = NULL;
- aChannel.iUpstreamSignalCopy = NULL;
- aChannel.iDownstreamSignalCopy = NULL;
- aChannel.iSignalNotify = NULL;
- aChannel.iOwnerUid = TUid::Null();
- aChannel.iChannelInUse = EFalse;
- FTRACE(FPrint( _L("CDunTransUtils::CreateEmptyChannelData() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates new buffer if source buffer defined, otherwise already existing
-// buffer will be used
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoCreateBufferLC( TUint8* aSrcBuffer,
- TPtr8* aSrcPtr,
- TUint8*& aDstBuffer,
- TPtr8*& aDstPtr,
- TInt aBufferLength,
- TInt& aItemsInCs )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC()" )));
- TUint8* buffer;
- if ( !aSrcBuffer )
- {
- buffer = new (ELeave) TUint8[aBufferLength];
- CleanupStack::PushL( buffer );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC() new created" )));
- }
- else
- {
- buffer = aSrcBuffer;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC() existing set" )));
- }
- TPtr8* bufferPtr;
- if ( !aSrcPtr )
- {
- bufferPtr = new (ELeave) TPtr8( buffer, aBufferLength, aBufferLength );
- CleanupStack::PushL( bufferPtr );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC() new created" )));
- }
- else
- {
- bufferPtr = aSrcPtr;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC() existing set" )));
- }
- aDstBuffer = buffer;
- aDstPtr = bufferPtr;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateBufferLC() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates new signal copy object if source defined, otherwise already
-// existing will be used
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoCreateSignalCopyLC( CDunSignalCopy* aSrcSignalCopy,
- CDunSignalCopy*& aDstSignalCopy,
- TInt& aItemsInCs )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalCopyLC()" )));
- CDunSignalCopy* signalCopy;
- if ( !aSrcSignalCopy )
- {
- signalCopy = CDunSignalCopy::NewL();
- CleanupStack::PushL( signalCopy );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalCopyLC() new created" )));
- }
- else
- {
- signalCopy = aSrcSignalCopy;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalCopyLC() existing set" )));
- }
- aDstSignalCopy = signalCopy;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalCopyLC() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates new signal notify object if source defined, otherwise already
-// existing will be used
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoCreateSignalNotifyLC(
- CDunSignalNotify* aSrcSignalNotify,
- CDunSignalNotify*& aDstSignalNotify,
- TInt& aItemsInCs )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalNotifyLC()" )));
- CDunSignalNotify* signalNotify;
- if ( !aSrcSignalNotify )
- {
- signalNotify = CDunSignalNotify::NewL( this );
- CleanupStack::PushL( signalNotify );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalNotifyLC() new created" )));
- }
- else
- {
- signalNotify = aSrcSignalNotify;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalNotifyLC() existing set" )));
- }
- aDstSignalNotify = signalNotify;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateSignalNotifyLC() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates transfer objects for reader and writer if sources defined,
-// otherwise already existing ones will be used
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoCreateUpTransferObjectL( CDunUpstream* aSrcReader,
- CDunUpstream*& aDstReader,
- TInt& aItemsInCs )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateUpTransferObjectL()" )));
- CDunUpstream* dunReader;
- if ( !aSrcReader )
- {
- dunReader = CDunUpstream::NewL( this );
- CleanupStack::PushL( dunReader );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateUpTransferObjectL() new created" )));
- }
- else
- {
- dunReader = aSrcReader;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateUpTransferObjectL() existing set" )));
- }
- aDstReader = dunReader;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateUpTransferObjectL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates transfer objects for reader and writer if sources defined,
-// otherwise already existing ones will be used
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoCreateDownTransferObjectL( CDunDownstream* aSrcReader,
- CDunDownstream*& aDstReader,
- TInt& aItemsInCs )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateDownTransferObjectL()" )));
- CDunDownstream* dunReader;
- if ( !aSrcReader )
- {
- dunReader = CDunDownstream::NewL( this );
- CleanupStack::PushL( dunReader );
- aItemsInCs++;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateDownTransferObjectL() new created" )));
- }
- else
- {
- dunReader = aSrcReader;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateDownTransferObjectL() existing set" )));
- }
- aDstReader = dunReader;
- FTRACE(FPrint( _L("CDunTransUtils::DoCreateDownTransferObjectL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets/frees network data of aIndex:th channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DeleteOneNetworkData( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneNetworkData()" )));
-
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneNetworkData (not found) complete" )));
- return KErrNotFound;
- }
-
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneNetworkData() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- // channelData.iDownstreamSignalCopy may or may not exist (optional)
- // channelData.iSignalNotify may or may not exist (optional)
- delete channelData.iDownstreamSignalCopy;
- channelData.iDownstreamSignalCopy = NULL;
- delete channelData.iSignalNotify;
- channelData.iSignalNotify = NULL;
- delete channelData.iDownstreamRW;
- channelData.iDownstreamRW = NULL;
-
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneNetworkData complete()" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Resets/frees network data of aIndex:th channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DeleteOneLocalData( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneLocalData()" )));
-
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneLocalData() (not found) complete" )));
- return KErrNotFound;
- }
-
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneLocalData() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- // channelData.iUpstreamSignalCopy may or may not exist (optional)
- delete channelData.iUpstreamSignalCopy;
- channelData.iUpstreamSignalCopy = NULL;
- delete channelData.iUpstreamRW;
- channelData.iUpstreamRW = NULL;
-
- FTRACE(FPrint( _L("CDunTransUtils::DeleteOneLocalData() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Deletes buffering objects of aIndex:th channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DeleteBuffering( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteBuffering()" )));
-
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteBuffering() (not found) complete" )));
- return KErrNotFound;
- }
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DeleteBuffering() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- delete channelData.iChannelName;
- channelData.iChannelName = NULL;
- delete channelData.iBufferUpstream;
- channelData.iBufferUpstream = NULL;
- delete channelData.iBufferDownstream;
- channelData.iBufferDownstream = NULL;
- delete channelData.iBufferUpPtr;
- channelData.iBufferUpPtr = NULL;
- delete channelData.iBufferDownPtr;
- channelData.iBufferDownPtr = NULL;
-
- FTRACE(FPrint( _L("CDunTransUtils::DeleteBuffering() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Initializes first free channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::InitializeFirstFreeChannel( TConnId aLocalIdNew )
- {
- FTRACE(FPrint( _L("CDunTransUtils::InitializeFirstFreeChannel()" )));
- TInt i;
- TInt count;
- TInt retTemp;
- TInt firstFree = KErrNotFound;
- count = iChannelData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunChannelData& channelData = iChannelData[i];
- if ( channelData.iComm==aLocalIdNew ||
- channelData.iSocket==aLocalIdNew )
- {
- FTRACE(FPrint( _L("CDunTransUtils::InitializeFirstFreeChannel() (already exists) complete" )));
- return KErrAlreadyExists;
- }
- if ( !channelData.iChannelInUse && firstFree==KErrNotFound )
- {
- firstFree = i;
- // no "break" here since KErrAlreadyExists needs to be checked
- }
- }
- if ( firstFree >= 0 )
- {
- FTRACE(FPrint( _L("CDunTransUtils::InitializeFirstFreeChannel() complete" )));
- return i;
- }
- // Free channel not found, now create new if possible
- TDunChannelData emptyChannel;
- CreateEmptyChannelData( emptyChannel );
- retTemp = iChannelData.Append( emptyChannel );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransUtils::InitializeFirstFreeChannel() (append failed!) complete" )));
- return retTemp;
- }
- FTRACE(FPrint( _L("CDunTransUtils::InitializeFirstFreeChannel() complete" )));
- return i;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Allocates a channel by creating and setting local media independent
-// objects
-// This is a common method used by exported local media dependent methods
-// ---------------------------------------------------------------------------
-//
-void CDunTransUtils::DoAllocateChannelL( RComm* aComm,
- TInt& aBufferLength,
- TInt aFirstFree,
- MDunBufferCorrection* aCorrection )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL()" )));
- TInt retTemp;
- TInt itemsInCs = 0;
-
- if ( !iParent.iNetwork )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (iNetwork) not initialized!" )));
- User::Leave( KErrGeneral );
- }
-
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() aFirstFree = %d" ), aFirstFree));
-
- // Allocate network channel
- RComm* networkEntity;
- retTemp = iParent.iNetwork->AllocateChannel( networkEntity );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() network allocation failed" )));
- if ( retTemp == KErrTooBig )
- {
- // Start to show note
- if ( iParent.iNoteHandler )
- {
- iParent.iNoteHandler->IssueRequest();
- }
- // Set flag to indicate that advertisement is not possible anymore
- ManageAdvertisementStatusChange( EFalse );
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (too big) complete" )));
- User::Leave( KErrTooBig );
- }
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (ERROR) complete" )));
- User::Leave( KErrGeneral );
- }
-
- TInt currentLength = networkEntity->ReceiveBufferLength();
- TInt newLength = currentLength;
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() buffer length before = %d" ), currentLength));
- if ( aCorrection )
- {
- // Get network side buffer length and request change if required.
- // Check "newlength>currentLength" here as it is not possible to
- // increase Dataport's buffer length
- newLength = aCorrection->NotifyBufferCorrection( currentLength );
- if ( newLength<=0 || newLength>currentLength )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() unknown buffer length" )));
- User::Leave( KErrGeneral );
- }
- // It is not possible to set Dataport side receive buffer length to any
- // arbitrary value (currently only 8kB..20kB are supported but that
- // can't be queried via an API). So here only default buffer size will
- // be used from Dataport while this component's local buffering uses
- // Dataport's default buffer size if not adjusted via plugin side.
- // NOTE: If Dataport side starts to support arbitrary receive buffer
- // size, it should be changed here if newLength != currentLength.
- }
- aBufferLength = newLength;
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() buffer length after = %d" ), newLength));
-
- // Get channel data
-
- TDunChannelData& channelData = iChannelData[aFirstFree];
-
- // Create buffers and set length
-
- TUint8* bufferUpstream;
- TPtr8* bufferUpPtr;
- DoCreateBufferLC( channelData.iBufferUpstream,
- channelData.iBufferUpPtr,
- bufferUpstream,
- bufferUpPtr,
- newLength,
- itemsInCs );
-
- TUint8* bufferDownstream;
- TPtr8* bufferDownPtr;
- DoCreateBufferLC( channelData.iBufferDownstream,
- channelData.iBufferDownPtr,
- bufferDownstream,
- bufferDownPtr,
- newLength,
- itemsInCs );
-
- // Create signal copy objects
-
- CDunSignalCopy* upstreamCopy = channelData.iUpstreamSignalCopy;
- CDunSignalCopy* downstreamCopy = channelData.iDownstreamSignalCopy;
- if ( aComm )
- {
- DoCreateSignalCopyLC( channelData.iUpstreamSignalCopy,
- upstreamCopy,
- itemsInCs );
- DoCreateSignalCopyLC( channelData.iDownstreamSignalCopy,
- downstreamCopy,
- itemsInCs );
- retTemp = upstreamCopy->SetMedia( aComm,
- networkEntity,
- EDunStreamTypeUpstream );
- if ( retTemp != KErrNone )
- {
- delete upstreamCopy;
- upstreamCopy = NULL;
- }
- retTemp = downstreamCopy->SetMedia( aComm,
- networkEntity,
- EDunStreamTypeDownstream );
- if ( retTemp != KErrNone )
- {
- delete downstreamCopy;
- downstreamCopy = NULL;
- }
- }
-
- // Create signal notify objects
-
- CDunSignalNotify* signalNotify = channelData.iSignalNotify;
- if ( !aComm ) // RSocket
- {
- DoCreateSignalNotifyLC( channelData.iSignalNotify,
- signalNotify,
- itemsInCs );
- retTemp = signalNotify->SetMedia( networkEntity );
- if ( retTemp != KErrNone )
- {
- delete signalNotify;
- signalNotify = NULL;
- }
- }
-
- // Create upstream objects
-
- CDunUpstream* upstreamRW;
- DoCreateUpTransferObjectL( channelData.iUpstreamRW,
- upstreamRW,
- itemsInCs );
- upstreamRW->SetBuffering( bufferUpPtr );
- upstreamRW->SetMedia( networkEntity, EDunMediaContextNetwork );
- upstreamRW->SetActivityCallback( this );
-
- // Create downstream objects
-
- CDunDownstream* downstreamRW;
- DoCreateDownTransferObjectL( channelData.iDownstreamRW,
- downstreamRW,
- itemsInCs );
- downstreamRW->SetBuffering( bufferDownPtr );
- downstreamRW->SetMedia( networkEntity, EDunMediaContextNetwork );
-
- // Save values
-
- channelData.iNetwork = networkEntity;
- channelData.iUpstreamRW = upstreamRW;
- channelData.iDownstreamRW = downstreamRW;
- channelData.iBufferUpstream = bufferUpstream;
- channelData.iBufferDownstream = bufferDownstream;
- channelData.iBufferUpPtr = bufferUpPtr;
- channelData.iBufferDownPtr = bufferDownPtr;
- channelData.iUpstreamSignalCopy = upstreamCopy;
- channelData.iDownstreamSignalCopy = downstreamCopy;
- channelData.iSignalNotify = signalNotify;
-
- CleanupStack::Pop( itemsInCs );
-
- // Set flag to indicate that advertisement is now possible
- ManageAdvertisementStatusChange( ETrue, ETrue );
-
- FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Adds connection monitor callback for either local media or network side
-// by connection ID
-// Connection monitor will be added to aIndex:th endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoAddConnMonCallback( TInt aIndex,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback()" )));
-
- if ( !iParent.iNetwork )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback() (iNetwork) not initialized!" )));
- return KErrGeneral;
- }
-
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback() (not found) complete" )));
- return KErrNotFound;
- }
-
- TDunChannelData& channelData = iChannelData[aIndex];
-
- // Get upstream and downstream
- CDunUpstream* upstream = channelData.iUpstreamRW;
- CDunDownstream* downstream = channelData.iDownstreamRW;
-
- if ( aDirection == EDunReaderUpstream )
- {
- // Initialize stream for AT parsing (ignore errors)
- upstream->InitializeForAtParsing( downstream,
- channelData.iChannelName,
- upstream,
- downstream );
- downstream->InitializeForDataPushing( upstream );
- }
-
- // Get stream type and operation type
-
- TDunStreamType streamType =
- static_cast<TDunStreamType>( aDirection & KDunStreamTypeMask );
- TDunOperationType operationType =
- static_cast<TDunOperationType>( aDirection & KDunOperationTypeMask );
-
- if ( streamType == EDunStreamTypeUpstream )
- {
- // If signal copy object(s) exist then add RunL error monitoring for them
- if ( channelData.iUpstreamSignalCopy ) // optional
- {
- // Add callback (ignore errors)
- channelData.iUpstreamSignalCopy->AddCallback( aCallback );
- }
- }
- else if ( streamType == EDunStreamTypeDownstream )
- {
- // If signal copy object(s) exist then add RunL error monitoring for them
- if ( channelData.iDownstreamSignalCopy ) // optional
- {
- // Add callback (ignore errors)
- channelData.iDownstreamSignalCopy->AddCallback( aCallback );
- }
- }
- else
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback() (stream) not initialized!" ) ));
- return KErrGeneral;
- }
-
- // Set signal notify callback
-
- if ( aSignal && aDirection==EDunReaderDownstream )
- {
- if ( !channelData.iSignalNotify )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback() (iSignalNotify) not initialized" )));
- return KErrGeneral;
- }
- // Add callback (ignore errors)
- channelData.iSignalNotify->AddCallback( aCallback );
- }
-
- // Add callback (ignore errors)
- if ( streamType == EDunStreamTypeUpstream )
- {
- upstream->AddConnMonCallback( aCallback, operationType );
- }
- else // streamType == EDunStreamTypeDownstream
- {
- downstream->AddConnMonCallback( aCallback, operationType );
- }
-
- FTRACE(FPrint( _L("CDunTransUtils::DoAddConnMonCallback() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Adds error to consider as no error condition when doing any of the four
-// endpoint's read/writer operation
-// Error will be added to aIndex:th endpoint
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoAddSkippedError( TInt aIndex,
- TInt aError,
- TDunDirection aDirection )
- {
- FTRACE(FPrint( _L("CDunTransUtils::AddOneSkippedError" ) ));
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() (not found) complete" )));
- return KErrNotFound;
- }
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- if ( aDirection != EDunReaderUpstream &&
- aDirection != EDunWriterUpstream &&
- aDirection != EDunReaderDownstream &&
- aDirection != EDunWriterDownstream )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() (ERROR) added" ) ));
- return KErrNotSupported;
- }
-
- TDunStreamType streamType =
- static_cast<TDunStreamType>( aDirection & KDunStreamTypeMask );
- TDunOperationType operationType =
- static_cast<TDunOperationType>( aDirection & KDunOperationTypeMask );
-
- if ( streamType != EDunStreamTypeUpstream &&
- streamType != EDunStreamTypeDownstream )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() (stream) not initialized!" ) ));
- return KErrGeneral;
- }
-
- // Add skipped error (ignore errors)
-
- if ( streamType == EDunStreamTypeUpstream )
- {
- channelData.iUpstreamRW->AddSkippedError( aError, operationType );
- }
- else if ( streamType == EDunStreamTypeDownstream )
- {
- channelData.iDownstreamRW->AddSkippedError( aError, operationType );
- }
- else
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() (stream) not initialized!" ) ));
- return KErrGeneral;
- }
-
- FTRACE(FPrint( _L("CDunTransUtils::DoAddSkippedError() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Issues transfers requests for aIndex:th transfer objects
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoIssueTransferRequests( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests()" )));
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests() (not found) complete" )));
- return KErrNotFound;
- }
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- if ( !channelData.iUpstreamRW )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests() (iUpstreamRW) not initialized!" )));
- return KErrGeneral;
- }
- if ( !channelData.iDownstreamRW )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests() (iDownstreamRW) not initialized!" )));
- return KErrGeneral;
- }
-
- // Below issuing requests on signal objects (CDunSignalCopy,
- // CDunSignalNotify) before issuing request on read/write objects
- // (CDunUpstream/CDunDownstream). This is to guarantee that if signals are
- // already set in local media side then they will be copied to network side
- // before data.
-
- if ( channelData.iUpstreamSignalCopy ) // optional (RComm)
- {
- channelData.iUpstreamSignalCopy->IssueRequest();
- }
- if ( channelData.iDownstreamSignalCopy ) // optional (RComm)
- {
- channelData.iDownstreamSignalCopy->IssueRequest();
- }
- if ( channelData.iSignalNotify ) // optional (RSocket)
- {
- channelData.iSignalNotify->IssueRequest();
- }
- channelData.iUpstreamRW->StartStream();
- channelData.iDownstreamRW->StartStream();
-
- FTRACE(FPrint( _L("CDunTransUtils::DoIssueTransferRequests() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Stops transfers for aIndex:th transfer objects
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoStopTransfers( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers()" )));
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers() (not found) complete" )));
- return KErrNotFound;
- }
-
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers() (channel not found) complete" ), aIndex));
- return KErrGeneral;
- }
-
- if ( !channelData.iUpstreamRW )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers() (iUpstreamRW) not initialized!" )));
- return KErrGeneral;
- }
- if ( !channelData.iDownstreamRW )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers() (iDownstreamRW) not initialized!" )));
- return KErrGeneral;
- }
-
- // Now stop operation of signal objects (CDunSignalCopy, CDunSignalNotify)
- // before stopping operation on read/write objects (CDunUpstream/
- // CDunDownstream). This is to ensure that signals don't change after
- // stopping read/write which in turn could cause problems.
-
- if ( channelData.iUpstreamSignalCopy ) // optional (RComm)
- {
- channelData.iUpstreamSignalCopy->Stop();
- }
- if ( channelData.iDownstreamSignalCopy ) // optional (RComm)
- {
- channelData.iDownstreamSignalCopy->Stop();
- }
- if ( channelData.iSignalNotify ) // optional (RSocket)
- {
- channelData.iSignalNotify->Stop();
- }
- channelData.iUpstreamRW->Stop();
- channelData.iDownstreamRW->Stop();
-
- FTRACE(FPrint( _L("CDunTransUtils::DoStopTransfers() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtility.
-// Free aIndex:th channel's objects
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoFreeChannel( TInt aIndex )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoFreeChannel()" )));
-
- TDunChannelData& channelData = iChannelData[aIndex];
- if ( aIndex < 0 ||
- aIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoFreeChannel (not found) complete" )));
- return KErrNotFound;
- }
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoFreeChannel (already free) complete" )));
- return KErrNone;
- }
- if ( !iParent.iNetwork )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoFreeChannel (iNetwork) not initialized!" )));
- return KErrGeneral;
- }
-
- DoStopTransfers( aIndex );
- DeleteOneNetworkData( aIndex );
- DeleteOneLocalData( aIndex );
- DeleteBuffering( aIndex );
-
- iParent.iNetwork->FreeChannel( channelData.iNetwork );
-
- channelData.iNetwork = NULL;
- channelData.iComm = NULL;
- channelData.iSocket = NULL;
- channelData.iChannelInUse = EFalse;
-
- // If note exist then stop it now as no reason to show it anymore
- if ( iParent.iNoteHandler )
- {
- iParent.iNoteHandler->Stop();
- }
- // Set flag to indicate that advertisement is now possible
- ManageAdvertisementStatusChange( ETrue, EFalse );
-
- FTRACE(FPrint( _L("CDunTransUtils::DoFreeChannel() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunTransporterUtilityAux.
-// Gets local ID counterpart of a network ID
-// ---------------------------------------------------------------------------
-//
-TConnId CDunTransUtils::GetLocalId( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId()" )));
- TInt mediaIndex = iParent.GetMediaIndex( aComm, EDunMediaContextNetwork );
- if ( mediaIndex < 0 )
- {
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId() (ERROR) complete (%d)" ), mediaIndex));
- return NULL;
- }
- if ( mediaIndex >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId() (not found) complete" ) ));
- return NULL;
- }
- TDunChannelData& channelData = iChannelData[mediaIndex];
- if ( channelData.iComm )
- {
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId() (iComm) complete" )));
- return channelData.iComm;
- }
- if ( channelData.iSocket )
- {
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId() (iSocket) complete" )));
- return channelData.iSocket;
- }
- FTRACE(FPrint( _L("CDunTransUtils::GetLocalId() (ERROR) complete" )));
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// From MDunTransporterUtilityAux.
-// Notifies when serious read/write error is detected on a connection
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::DoNotifyConnectionNotOk(
- RComm* aComm,
- RSocket* aSocket,
- TDunConnectionReason& aConnReason,
- RPointerArray<MDunConnMon>& aCallbacks )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk()" )));
- TConnId localId = NULL;
- if ( aComm )
- {
- localId = aComm;
- }
- else if ( aSocket )
- {
- localId = aSocket;
- }
- TInt i;
- TInt count = aCallbacks.Count();
- for ( i=0; i<count; i++ )
- {
- if ( !aCallbacks[i] )
- {
- FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk() (iCallbacks[%d]) not initialized!" ), i));
- return KErrGeneral;
- }
- TRAP_IGNORE(
- aCallbacks[i]->NotifyProgressChangeL( localId, aConnReason ) );
- }
- FTRACE(FPrint( _L("CDunTransUtils::DoNotifyConnectionNotOk() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunActivityManager.
-// Notifies about activity on a channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::NotifyChannelActivity()
- {
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelActivity()" )));
- iParent.iActiveChannels++;
- if ( iParent.iActiveChannels == 1 )
- {
- // Now set key and notify (only once) that DUN is active
- TInt retTemp = RProperty::Set( KPSUidDialupConnStatus,
- KDialupConnStatus,
- EDialupActive );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelActivity() (ERROR) complete" )));
- return retTemp;
- }
- }
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelActivity() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunActivityManager.
-// Notifies about inactivity on a channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransUtils::NotifyChannelInactivity()
- {
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelInactivity()" )));
- if ( iParent.iActiveChannels <= 0 )
- {
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelInactivity() (wrong iActiveChannels!) complete" )));
- return KErrGeneral;
- }
- iParent.iActiveChannels--;
- if ( iParent.iActiveChannels == 0 )
- {
- // Now set key and notify (only once) that DUN is inactive
- TInt retTemp = RProperty::Set( KPSUidDialupConnStatus,
- KDialupConnStatus,
- EDialupInactive );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelInactivity() (ERROR) complete" )));
- return retTemp;
- }
- }
- FTRACE(FPrint( _L("CDunTransUtils::NotifyChannelInactivity() complete" )));
- return KErrNone;
- }
--- a/localconnectivityservice/dun/utils/src/DunTransporter.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,891 +0,0 @@
-/*
-* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Managing abstracted "channels" of network side communication
-*
-*/
-
-
-#include "DunTransUtils.h"
-#include "DunTransporter.h"
-#include "DunDataWaiter.h"
-#include "DunUpstream.h"
-#include "DunDownstream.h"
-#include "DunSignalCopy.h"
-#include "DunNoteHandler.h"
-#include "DunUtils.h"
-#include "DunDebug.h"
-#include "DunPlugin.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CDunTransporter* CDunTransporter::NewL(
- MDunPluginManager* aPluginManager,
- TInt aNumOfMaxChannels )
- {
- CDunTransporter* self = new (ELeave) CDunTransporter( aPluginManager,
- aNumOfMaxChannels );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunTransporter::~CDunTransporter()
- {
- FTRACE(FPrint( _L("CDunTransporter::~CDunTransporter()" )));
- UnInitialize();
- FTRACE(FPrint( _L("CDunTransporter::~CDunTransporter() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Number of allocated channels, is the same number as allocated and active
-// (non-waiting) channels
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::NumberOfAllocatedChannels()
- {
- FTRACE(FPrint( _L("CDunTransporter::NumberOfAllocatedChannels()" )));
- TInt i;
- TInt allocChannels = 0;
- TInt count = iChannelData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunChannelData& channelData = iChannelData[i];
- if ( channelData.iChannelInUse )
- {
- allocChannels++;
- }
- }
- FTRACE(FPrint( _L("CDunTransporter::NumberOfAllocatedChannels() complete" )));
- return allocChannels;
- }
-
-// ---------------------------------------------------------------------------
-// Number of waiting channels, is the same number as allocated and inactive
-// (waiting) channels
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::NumberOfWaitingChannels()
- {
- FTRACE(FPrint( _L("CDunTransporter::NumberWaitingChannels()" )));
- if ( !iInitialized )
- {
- FTRACE(FPrint( _L("CDunTransporter::NumberWaitingChannels() complete" )));
- return 0;
- }
- TInt waiters = iChanMan->NumberOfWaiters();
- FTRACE(FPrint( _L("CDunTransporter::NumberWaitingChannels() complete" )));
- return waiters;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the number of allocated channels by owner UID, is the same number as
-// allocated and active (non-waiting) channels
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::GetNumberOfAllocatedChannelsByUid(
- TUid aOwnerUid )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetNumberOfAllocatedChannelsByUid()" )));
- TInt i;
- TInt allocChannels = 0;
- TInt count = iChannelData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunChannelData& channelData = iChannelData[i];
- if ( channelData.iOwnerUid==aOwnerUid && channelData.iChannelInUse )
- {
- allocChannels++;
- }
- }
- FTRACE(FPrint( _L("CDunTransporter::GetNumberOfAllocatedChannelsByUid() complete" )));
- return allocChannels;
- }
-
-// ---------------------------------------------------------------------------
-// Gets the number of waiting channels by owner UID, is the same number as
-// allocated and inactive (waiting) channels
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::GetNumberOfWaitingChannelsByUid(
- TUid aOwnerUid )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetNumberWaitingChannelsByUid()" )));
- if ( !iInitialized )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetNumberWaitingChannelsByUid() complete" )));
- return 0;
- }
- TInt waiters = iChanMan->GetNumberOfWaitersByUid( aOwnerUid );
- FTRACE(FPrint( _L("CDunTransporter::GetNumberWaitingChannelsByUid() complete" )));
- return waiters;
- }
-
-// ---------------------------------------------------------------------------
-// Transporter's service advertisement status
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CDunTransporter::AdvertisementStatus()
- {
- FTRACE(FPrint( _L("CDunTransporter::AdvertisementStatus()" )));
- FTRACE(FPrint( _L("CDunTransporter::AdvertisementStatus() complete" )));
- return iAdvertise;
- }
-
-// ---------------------------------------------------------------------------
-// Creates a channel of communication between local media (aComm) and network
-// Local media object pointer also works as a connection ID for the
-// allocated channel
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AllocateChannelL(
- RComm* aComm,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- MDunBufferCorrection* aCorrection )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RComm)" )));
-
- if ( !aComm )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (aComm not initialized!) complete" )));
- User::Leave( KErrGeneral );
- }
-
- if ( !aComm->SubSessionHandle() )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RComm) (bad handle) complete" ) ));
- User::Leave( KErrBadHandle );
- }
-
- TInt retTemp = InitializeOnDemand();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RComm) (ERROR) complete" ) ));
- User::Leave( retTemp );
- }
-
- iChanMan->AddConnWaiterL( aComm,
- aOwnerUid,
- aName,
- aEnqueuedFail,
- aCorrection );
-
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RComm) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Creates a channel of communication between local media (aSocket) and
-// network
-// Local media object pointer also works as a connection ID for the
-// allocated channel
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AllocateChannelL(
- RSocket* aSocket,
- TUid aOwnerUid,
- const TDesC8& aName,
- TBool aEnqueuedFail,
- TBool& aNoFreeChans )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket)" )));
-
- aNoFreeChans = EFalse; // Initialize now if plugin didn't do it already
-
- if ( !aSocket )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (aSocket not initialized!) complete" )));
- User::Leave( KErrGeneral );
- }
- if ( !aSocket->SubSessionHandle() )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) (bad handle) complete" ) ));
- User::Leave( KErrBadHandle );
- }
- TInt retTemp = InitializeOnDemand();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) (ERROR) complete" )));
- User::Leave( retTemp );
- }
- TInt firstFree = iUtility->InitializeFirstFreeChannel( aSocket );
- if ( firstFree < 0 )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) (firstfree failed!) complete" ) ));
- User::Leave( firstFree );
- }
- if ( firstFree >= iChannelData.Count() )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) (firstfree failed!) complete" ) ));
- User::Leave( KErrGeneral );
- }
- TInt bufferLength = KErrNotFound;
- // bufferLength will be omitted (not needed to set to RSocket)
- TRAPD( retTrap,
- iUtility->DoAllocateChannelL(NULL, bufferLength, firstFree, NULL) );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) trapped!" ) ));
- UnInitializeOnDemand(); // remove unused initialized channel
- if ( retTrap == KErrTooBig )
- {
- if ( aEnqueuedFail )
- {
- // Inform plugin enqueue request
- iPluginManager->NotifyPluginEnqueueRequest( aOwnerUid );
- }
- aNoFreeChans = ETrue; // Inform plugin about no free channels
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) complete" )));
- User::Leave( KErrTooBig );
- }
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) complete" )));
- User::Leave( retTrap );
- }
- TDunChannelData& channelData = iChannelData[firstFree];
- channelData.iSocket = aSocket;
- channelData.iChannelName = HBufC8::NewMaxL( aName.Length() );
- TPtr8 chanNamePtr = channelData.iChannelName->Des();
- chanNamePtr.Copy( aName );
- channelData.iUpstreamRW->SetMedia( aSocket, EDunMediaContextLocal );
- channelData.iDownstreamRW->SetMedia( aSocket, EDunMediaContextLocal );
- channelData.iOwnerUid = aOwnerUid;
- // Channel now occupied
- channelData.iChannelInUse = ETrue;
-
- // Clear the queue, just to be sure
- iPluginManager->NotifyPluginDequeueRequest( aOwnerUid );
-
- FTRACE(FPrint( _L("CDunTransporter::AllocateChannel() (RSocket) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Frees an allocated channel by local media (aComm) connection ID
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::FreeChannel( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm)" )));
-
- TInt retTemp = CheckInitAndHandle( aComm );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm) (ERROR) complete" ) ));
- return retTemp;
- }
-
- retTemp = iChanMan->RemoveConnWaiter( aComm );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm) complete" )));
- return KErrNone;
- }
-
- // No waiter found, so try to find from channels
- TInt mediaIndex = GetMediaIndex( aComm );
- if ( mediaIndex < 0 )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm) (ERROR) complete" ) ));
- return mediaIndex;
- }
-
- retTemp = iUtility->DoFreeChannel( mediaIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm) (ERROR) complete" )));
- return retTemp;
- }
- UnInitializeOnDemand();
-
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Frees an allocated channel by local media (aSocket) connection ID
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::FreeChannel( RSocket* aSocket )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RSocket)" )));
-
- TInt retTemp = CheckInitAndHandle( aSocket );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RSocket) (ERROR) complete" ) ));
- return retTemp;
- }
-
- TInt mediaIndex = GetMediaIndex( aSocket );
- if ( mediaIndex < 0 )
- {
- return mediaIndex;
- }
-
- retTemp = iUtility->DoFreeChannel( mediaIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RSocket) (ERROR) complete" ) ));
- return retTemp;
- }
- UnInitializeOnDemand();
-
- FTRACE(FPrint( _L("CDunTransporter::FreeChannel() (RSocket) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Issues transfer requests for all transfer objects by local media
-// (aComm) connection ID
-// This will cause the Transporter by be ready for transferring data
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::IssueTransferRequestsL( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunTransporter::IssueTransferRequests() (RComm)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aComm ) );
- TInt retTemp = iChanMan->IssueConnWaiterRequest( aComm );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::IssueTransferRequests() (RComm) complete" )));
- return;
- }
-
- // No waiter found, so try to find from channels
- TInt mediaIndex = GetMediaIndexL( aComm );
- User::LeaveIfError( iUtility->DoIssueTransferRequests( mediaIndex ) );
-
- FTRACE(FPrint( _L("CDunTransporter::IssueTransferRequests() (RComm) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Issues transfer requests for all transfer objects by local media
-// (aSocket) connection ID
-// This will cause the Transporter by be ready for transferring data
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::IssueTransferRequestsL( RSocket* aSocket )
- {
- FTRACE(FPrint( _L("CDunTransporter::IssueTransferRequests() (RSocket)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aSocket ) );
- TInt mediaIndex = GetMediaIndexL( aSocket );
- User::LeaveIfError( iUtility->DoIssueTransferRequests(mediaIndex) );
-
- FTRACE(FPrint( _L("CDunTransporter::IssueTransferRequests() (RSocket) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Stops transfers for all transfer objects by local media (aComm)
-// connection ID
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::StopTransfers( RComm* aComm )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm)" )));
-
- TInt retTemp = CheckInitAndHandle( aComm );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm) (ERROR) complete" ) ));
- return retTemp;
- }
-
- retTemp = iChanMan->StopConnWaiter( aComm );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm) complete" )));
- return KErrNone;
- }
-
- // No waiter found, so try to find from channels
- TInt mediaIndex = GetMediaIndex( aComm );
- if ( mediaIndex < 0 )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm) (ERROR) complete" ) ));
- return mediaIndex;
- }
-
- retTemp = iUtility->DoStopTransfers( mediaIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm) (ERROR) complete" )));
- return retTemp;
- }
-
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RComm) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Stops transfers for all transfer objects by local media (aSocket)
-// connection ID
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::StopTransfers( RSocket* aSocket )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RSocket)" )));
-
- TInt retTemp = CheckInitAndHandle( aSocket );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RSocket) (ERROR) complete" ) ));
- return retTemp;
- }
-
- TInt mediaIndex = GetMediaIndex( aSocket );
- if ( mediaIndex < 0 )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RSocket) (ERROR) complete" ) ));
- return mediaIndex;
- }
-
- retTemp = iUtility->DoStopTransfers( mediaIndex );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RSocket) (ERROR) complete" )));
- return retTemp;
- }
-
- FTRACE(FPrint( _L("CDunTransporter::StopTransfers() (RSocket) complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Adds connection monitor callback for either local media or network side
-// by connection ID
-// Callbacks will be called read/write error is detected during endpoint
-// operation
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AddConnMonCallbackL( RComm* aComm,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool /*aSignal*/ )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddConnMonCallbackL() (RComm)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aComm ) );
- TInt retTemp = iChanMan->SaveWaiterConnMonCallbackL( aComm,
- aCallback,
- aDirection );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddConnMonCallbackL() (RComm) complete" )));
- return;
- }
-
- TInt mediaIndex = GetMediaIndexL( aComm );
- User::LeaveIfError( iUtility->DoAddConnMonCallback( mediaIndex,
- aCallback,
- aDirection,
- NULL ));
-
- FTRACE(FPrint( _L("CDunTransporter::AddConnMonCallbackL() (RComm) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Adds connection monitor callback for either local media or network side
-// by connection ID
-// Callbacks will be called when line status switches to high or low
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AddConnMonCallbackL( RSocket* aSocket,
- MDunConnMon* aCallback,
- TDunDirection aDirection,
- TBool aSignal )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddConnMonCallbackL() (RSocket)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aSocket ) );
- TInt mediaIndex = GetMediaIndexL( aSocket );
- User::LeaveIfError( iUtility->DoAddConnMonCallback( mediaIndex,
- aCallback,
- aDirection,
- aSignal ));
-
- FTRACE(FPrint( _L("CDunTransporter::AddConnMonCallbackL() (RSocket) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Adds error to consider as no error condition when doing any of the four
-// endpoint's read/writer operation
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AddSkippedErrorL( TInt aError,
- RComm* aComm,
- TDunDirection aDirection )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddSkippedErrorL() (RComm)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aComm ) );
- TInt retTemp = iChanMan->SaveWaiterSkippedErrorL( aError,
- aComm,
- aDirection );
- if ( retTemp == KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddSkippedErrorL() (RComm) complete" )));
- return;
- }
-
- TInt mediaIndex = GetMediaIndexL( aComm );
- User::LeaveIfError( iUtility->DoAddSkippedError( mediaIndex,
- aError,
- aDirection ));
-
- FTRACE(FPrint( _L("CDunTransporter::AddSkippedErrorL() (RComm) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Adds error to consider as no error condition when doing any of the four
-// endpoint's read/writer operation
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::AddSkippedErrorL( TInt aError,
- RSocket* aSocket,
- TDunDirection aDirection )
- {
- FTRACE(FPrint( _L("CDunTransporter::AddSkippedErrorL() (RSocket)" )));
-
- User::LeaveIfError( CheckInitAndHandle( aSocket ) );
- TInt mediaIndex = GetMediaIndexL( aSocket );
- User::LeaveIfError( iUtility->DoAddSkippedError( mediaIndex,
- aError,
- aDirection ));
-
- FTRACE(FPrint( _L("CDunTransporter::AddSkippedErrorL() (RSocket) complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Sets service advertisement monitor callback by owner UID
-// Callbacks will be called when advertisement status changes.
-// The callbacks are updated with every successfully completed
-// channel allocation/free (and allocation failure) so it is recommended
-// to call this method after AllocateChannelL().
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::SetAdvertisementMonitorL(
- TUid aOwnerUid,
- MDunServAdvMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunTransporter::SetAdvertisementMonitorL()" )));
- TInt i;
- TInt count;
- if ( !aCallback )
- {
- FTRACE(FPrint( _L("CDunTransporter::SetAdvertisementMonitorL() (aCallback) not initialized!" )));
- User::Leave( KErrGeneral );
- }
- count = iServAdvData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunServAdvData& servAdvData = iServAdvData[i];
- if ( servAdvData.iOwnerUid==aOwnerUid &&
- servAdvData.iServAdvMon==aCallback )
- {
- FTRACE(FPrint( _L("CDunTransporter::SetAdvertisementMonitorL() (already exist) complete" )));
- User::Leave( KErrAlreadyExists );
- }
- }
- TDunServAdvData servAdvData;
- servAdvData.iOwnerUid = aOwnerUid;
- servAdvData.iServAdvMon = aCallback;
- iServAdvData.AppendL( servAdvData );
- FTRACE(FPrint( _L("CDunTransporter::SetAdvertisementMonitorL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Frees service advertisement monitor callback by plugin UID
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::FreeAdvertisementMonitor(
- TUid aOwnerUid,
- MDunServAdvMon* aCallback )
- {
- FTRACE(FPrint( _L("CDunTransporter::FreeAdvertisementMonitor()" )));
- TInt i;
- TInt count = iServAdvData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunServAdvData& servAdvData = iServAdvData[i];
- if ( servAdvData.iOwnerUid==aOwnerUid &&
- servAdvData.iServAdvMon==aCallback )
- {
- iServAdvData.Remove( i );
- FTRACE(FPrint( _L("CDunTransporter::FreeAdvertisementMonitor() complete" )));
- return KErrNone;
- }
- }
- FTRACE(FPrint( _L("CDunTransporter::FreeAdvertisementMonitor() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// CDunTransporter::CDunTransporter
-// ---------------------------------------------------------------------------
-//
-CDunTransporter::CDunTransporter( MDunPluginManager* aPluginManager,
- TInt aNumOfMaxChannels ) :
- iUtility( NULL ),
- iPluginManager( aPluginManager ),
- iActiveChannels( 0 ),
- iNumOfMaxChannels( aNumOfMaxChannels ),
- iInitialized( EFalse ),
- iAdvertise( ETrue ),
- iNetwork( NULL )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CDunTransporter::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunTransporter::ConstructL()
- {
- FTRACE(FPrint( _L("CDunTransporter::ConstructL()" )));
- if ( !iPluginManager || iNumOfMaxChannels<0 )
- {
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunTransporter::ConstructL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes the transporter, must be called as the first operation
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunTransporter::InitializeL()
- {
- FTRACE(FPrint( _L("CDunTransporter::InitializeL()" )));
-
- if ( iInitialized )
- {
- FTRACE(FPrint( _L("CDunTransporter::InitializeL() (already exists) complete" )));
- return KErrAlreadyExists;
- }
- CDunTransUtils* utility = CDunTransUtils::NewL( *this, iPluginManager );
- iUtility = static_cast<MDunTransporterUtility*>( utility );
- MDunTransporterUtilityAux* utilityAux = static_cast<MDunTransporterUtilityAux*>( utility );
- iChanMan = CDunChanMan::NewL( *this, iUtility, utilityAux, iPluginManager );
- iNetwork = CDunNetDataport::NewL( iNumOfMaxChannels );
- iNetwork->InitializeL();
- iNoteHandler = CDunNoteHandler::NewL();
- iInitialized = ETrue;
-
- FTRACE(FPrint( _L("CDunTransporter::InitializeL() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// UnInitializes the transporter, can be called as the last operation
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDunTransporter::UnInitialize()
- {
- FTRACE(FPrint( _L("CDunTransporter::UnInitialize()" )));
- // first stop channel waiters before deletion
- if ( iChanMan )
- {
- iChanMan->ResetData();
- }
- // now ready to remove channel data as no existing waiters
- TInt i;
- TInt count = iChannelData.Count();
- for ( i=0; i<count; i++ )
- {
- if ( iChannelData[i].iChannelInUse )
- {
- iUtility->DoFreeChannel( i );
- }
- }
- iChannelData.Close();
- iServAdvData.Close();
- DeleteTransporter();
- iInitialized = EFalse;
- FTRACE(FPrint( _L("CDunTransporter::UnInitialize() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Initialize the transporter
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransporter::InitializeOnDemand()
- {
- FTRACE(FPrint( _L("CDunTransporter::InitializeOnDemand()" ) ));
- if ( !iInitialized )
- {
- TRAPD( retTrap, InitializeL() );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunTransporter::InitializeOnDemand() initialize failed!" ) ));
- return retTrap;
- }
- }
- FTRACE(FPrint( _L("CDunTransporter::InitializeOnDemand() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// UnInitialize the transporter
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransporter::UnInitializeOnDemand()
- {
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand()" ) ));
- if ( !iInitialized )
- {
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand() (not ready) complete" ) ));
- return KErrNotReady;
- }
- // Check if non-free channel exists, also remove empty channel(s)
- TInt i;
- TBool allFree = ETrue;
- for ( i=iChannelData.Count()-1; i>=0; i-- )
- {
- TDunChannelData& channelData = iChannelData[i];
- if ( !channelData.iChannelInUse )
- {
- if ( !channelData.iNetwork )
- {
- // iChannelData must not contain data here
- iChannelData.Remove( i );
- }
- }
- else // channel not free
- {
- allFree = EFalse;
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand() channel found" ) ));
- }
- }
- if ( iChanMan->NumberOfWaiters() > 0 )
- {
- allFree = EFalse;
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand() waiter found" ) ));
- }
- if ( allFree )
- {
- // All channels were free -> uninitialize
- UnInitialize();
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand() complete" ) ));
- return KErrNone;
- }
- FTRACE(FPrint( _L("CDunTransporter::UnInitializeOnDemand() (not ready) complete" ) ));
- return KErrNotReady;
- }
-
-// ---------------------------------------------------------------------------
-// Returns index of media for connection ID
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransporter::GetMediaIndex( TConnId aConnId,
- TDunMediaContext aMediaContext )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndex()" )));
- if ( aMediaContext != EDunMediaContextNetwork &&
- aMediaContext != EDunMediaContextLocal )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndex() (not supported) complete" )));
- return KErrNotSupported;
- }
- TInt i;
- TInt count = iChannelData.Count();
- for ( i=0; i<count; i++ )
- {
- TDunChannelData& channelData = iChannelData[i];
- if ( (aMediaContext==EDunMediaContextNetwork && channelData.iNetwork==aConnId) ||
- (aMediaContext==EDunMediaContextLocal && channelData.iComm==aConnId) ||
- (aMediaContext==EDunMediaContextLocal && channelData.iSocket==aConnId) )
- {
- if ( !channelData.iChannelInUse )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndex() (channel free!) complete" ) ));
- return KErrGeneral;
- }
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndex() complete (i=%d)" ), i));
- return i;
- }
- }
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndex() (not found) complete" )));
- return KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// Returns index of media for connection ID
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransporter::GetMediaIndexL( TConnId aConnId,
- TDunMediaContext aMediaContext )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndexL()" )));
- TInt index = GetMediaIndex( aConnId, aMediaContext );
- if ( index < 0 )
- {
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndexL() (ERROR) complete" )));
- User::Leave( index );
- }
- FTRACE(FPrint( _L("CDunTransporter::GetMediaIndexL() complete" )));
- return index;
- }
-
-// ---------------------------------------------------------------------------
-// Checks initialization and RSubSessionBase() handle
-// ---------------------------------------------------------------------------
-//
-TInt CDunTransporter::CheckInitAndHandle( TConnId aConnId )
- {
- FTRACE(FPrint( _L("CDunTransporter::CheckInitAndHandle()" )));
- if ( !iInitialized )
- {
- FTRACE(FPrint( _L("CDunTransporter::CheckInitAndHandle() (not ready) complete" )));
- return KErrNotReady;
- }
- RSubSessionBase* subBase = static_cast<RSubSessionBase*>( aConnId );
- if ( !subBase->SubSessionHandle() )
- {
- FTRACE(FPrint( _L("CDunTransporter::CheckInitAndHandle() (bad handle) complete" )));
- return KErrBadHandle;
- }
- FTRACE(FPrint( _L("CDunTransporter::CheckInitAndHandle() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Deletes own internal data
-// ---------------------------------------------------------------------------
-//
-void CDunTransporter::DeleteTransporter()
- {
- FTRACE(FPrint( _L("CDunTransporter::DeleteTransporter()" )));
- // first, delete channel manager with waiters
- delete iChanMan;
- iChanMan = NULL;
- // second, delete the network object
- delete iNetwork;
- iNetwork = NULL;
- // as last step delete utility class
- CDunTransUtils* utility = static_cast<CDunTransUtils*>( iUtility );
- delete utility;
- iUtility = NULL;
- // delete note class
- delete iNoteHandler;
- iNoteHandler = NULL;
- FTRACE(FPrint( _L("CDunTransporter::DeleteTransporter() complete" )));
- }
--- a/localconnectivityservice/dun/utils/src/DunUpstream.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,576 +0,0 @@
-/*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions needed for one "stream" of CDunTransporter
-*
-*/
-
-/*
- * TODO: When local media is of type RComm, listening on it is started with
- * RComm::NotifyDataAvailable() call. Check that USB ACM port and Irda RCOMM
- * (and any other new media in the future) behaves correctly so that when
- * RComm::ReadOneOrMore() is issued, the read is issued immediately without
- * checking for new data. If waiting for new data happens in this
- * NotifyDataAvailable/ReadOneOrMore combination, raise a defect to Symbian.
- */
-
-#include "DunTransporter.h"
-#include "DunUpstream.h"
-#include "DunDebug.h"
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CDunUpstream* CDunUpstream::NewL( MDunTransporterUtilityAux* aUtility )
- {
- CDunUpstream* self = new (ELeave) CDunUpstream( aUtility );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CDunUpstream::~CDunUpstream()
- {
- FTRACE(FPrint( _L("CDunUpstream::~CDunUpstream()" )));
- ResetData();
- FTRACE(FPrint( _L("CDunUpstream::~CDunUpstream() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// Resets data to initial values
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::ResetData()
- {
- // APIs affecting this:
- // IssueRequest()
- Stop();
- // InitializeForAtParsing()
- delete iParseData.iAtCmdHandler;
- iParseData.iAtCmdHandler = NULL;
- // AddConnMonCallbackL()
- iCallbacksR.Close();
- iCallbacksW.Close();
- // AddSkippedErrorL()
- iOkErrorsR.Close();
- iOkErrorsW.Close();
- // Internal
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// Sets activity callback for this stream
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::SetActivityCallback(
- MDunActivityManager* aActivityCallback )
- {
- if ( !aActivityCallback )
- {
- FTRACE(FPrint( _L("CDunUpstream::SetActivityCallback() (aActivityCallback) not initialized!" ) ));
- return KErrGeneral;
- }
- if ( iActivityData.iActivityCallback )
- {
- FTRACE(FPrint( _L("CDunUpstream::SetActivityCallback() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- iActivityData.iActivityCallback = aActivityCallback;
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this stream for AT command notifications
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::InitializeForAtParsing(
- MDunStreamManipulator* aStreamCallback,
- const TDesC8* aConnectionName,
- MDunCmdModeMonitor* aCallbackUp,
- MDunCmdModeMonitor* aCallbackDown )
- {
- FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing()" ) ));
- if ( iParseData.iAtCmdHandler )
- {
- FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (already exists) complete" ) ));
- return KErrAlreadyExists;
- }
- TInt retTrap = KErrNone;
- CDunAtCmdHandler* atCmdHandler = NULL;
- TRAP( retTrap, atCmdHandler = CDunAtCmdHandler::NewL(this,
- aStreamCallback,
- aConnectionName) );
- if ( retTrap != KErrNone )
- {
- FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (trapped!) complete" ) ));
- return retTrap;
- }
- atCmdHandler->AddCmdModeCallback( aCallbackUp );
- atCmdHandler->AddCmdModeCallback( aCallbackDown );
- iParseData.iDataMode = EFalse;
- iParseData.iAtCmdHandler = atCmdHandler;
- FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() complete" ) ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Starts upstream by issuing read request
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::StartStream()
- {
- FTRACE(FPrint( _L("CDunUpstream::StartStream()" ) ));
- if ( !iNetwork )
- {
- FTRACE(FPrint( _L("CDunUpstream::StartStream() (iNetwork) not initialized!" ) ));
- return KErrGeneral;
- }
- if ( !iComm && !iSocket )
- {
- FTRACE(FPrint( _L("CDunUpstream::StartStream() (iComm&iSocket) not initialized!" ) ));
- return KErrGeneral;
- }
- iOperationType = EDunOperationTypeRead;
- TInt retVal = IssueRequest();
- FTRACE(FPrint( _L("CDunUpstream::StartStream() complete" ) ));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// Stops transfer for read or write endpoints
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::Stop()
- {
- FTRACE(FPrint( _L("CDunUpstream::Stop() (Dir=%d)" ), iDirection));
- // Don't stop CDunAtCmdHandler here as it is downstream related!
- if ( iTransferState != EDunStateTransferring )
- {
- FTRACE(FPrint( _L("CDunUpstream::Stop() (not ready) complete" )));
- return KErrNotReady;
- }
- // Stop only current operation
- if ( iOperationType == EDunOperationTypeRead )
- {
- if ( iComm )
- {
- iComm->ReadCancel();
- FTRACE(FPrint( _L("CDunUpstream::Stop() (RComm) cancelled" )));
- }
- else if ( iSocket )
- {
- iSocket->CancelRecv();
- FTRACE(FPrint( _L("CDunUpstream::Stop() (RSocket) cancelled" )));
- }
- }
- else if ( iOperationType == EDunOperationTypeWrite )
- {
- if ( iNetwork )
- {
- iNetwork->WriteCancel();
- FTRACE(FPrint( _L("CDunUpstream::Stop() (Network) cancelled" )));
- }
- }
- Cancel();
- iTransferState = EDunStateIdle;
- // Notify parent about inactivity
- if ( iActivityData.iActivityCallback && iActivityData.iNotified )
- {
- iActivityData.iActivityCallback->NotifyChannelInactivity();
- iActivityData.iNotified = EFalse;
- }
- FTRACE(FPrint( _L("CDunUpstream::Stop() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Data transmission state (if read completed)
-// ---------------------------------------------------------------------------
-//
-TBool CDunUpstream::DataReadStatus()
- {
- return iActivityData.iDataRead;
- }
-
-// ---------------------------------------------------------------------------
-// CDunUpstream::CDunUpstream
-// ---------------------------------------------------------------------------
-//
-CDunUpstream::CDunUpstream( MDunTransporterUtilityAux* aUtility ) :
- iUtility( aUtility )
- {
- Initialize();
- }
-
-// ---------------------------------------------------------------------------
-// CDunUpstream::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::ConstructL()
- {
- FTRACE(FPrint( _L("CDunUpstream::ConstructL()" ) ));
- if ( !iUtility )
- {
- User::Leave( KErrGeneral );
- }
- FTRACE(FPrint( _L("CDunUpstream::ConstructL() complete" ) ));
- }
-
-// ---------------------------------------------------------------------------
-// Initializes this class
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::Initialize()
- {
- // Don't initialize iUtility here (it is set through NewL)
- iActivityData.iActivityCallback = NULL;
- iActivityData.iDataRead = EFalse;
- iActivityData.iNotified = EFalse;
- iParseData.iDataMode = EFalse;
- iParseData.iAtCmdHandler = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// Issues transfer request for this stream
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::IssueRequest()
- {
- // Set direction
- iDirection = static_cast<TDunDirection>( EDunStreamTypeUpstream | iOperationType );
-
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d)" ), iDirection));
-
- if ( iTransferState != EDunStateIdle )
- {
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (not ready) complete" ) ));
- return KErrNotReady;
- }
-
- if ( iOperationType == EDunOperationTypeRead )
- {
- iBufferPtr->SetLength( iBufferPtr->MaxLength() );
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() trying to read %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
- }
- else // iOperationType == EDunOperationTypeWrite
- {
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() writing %d bytes... (Dir=%d)" ), iBufferPtr->Length(), iDirection));
- }
-
- switch ( iDirection )
- {
- case EDunReaderUpstream:
- if ( iComm )
- {
- iStatus = KRequestPending;
- iComm->ReadOneOrMore( iStatus, *iBufferPtr );
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
- }
- else if ( iSocket )
- {
- iStatus = KRequestPending;
- iSocket->RecvOneOrMore( *iBufferPtr, 0, iStatus, iReadLengthSocket );
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RSocket RecvOneOrMore() requested" ) ));
- }
- else
- {
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (ERROR) complete" ) ));
- return KErrGeneral;
- }
- break;
- case EDunWriterUpstream:
- iStatus = KRequestPending;
- iNetwork->Write( iStatus, *iBufferPtr );
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm Write() requested" ) ));
- break;
- default:
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (ERROR) complete" ) ));
- return KErrGeneral;
- }
-
- SetActive();
- iTransferState = EDunStateTransferring;
-
- FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d) complete" ), iDirection));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Processes data that was read
-// ---------------------------------------------------------------------------
-//
-TBool CDunUpstream::ProcessReadData()
- {
- FTRACE(FPrint( _L("CDunUpstream::ProcessReadData()" )));
- // The following will be transferred to Dataport
- if ( iParseData.iDataMode )
- {
- iOperationType = EDunOperationTypeWrite;
- FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (next write) complete" )));
- return ETrue;
- }
- if ( !iParseData.iAtCmdHandler ) // optional
- {
- FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (no handler) complete" )));
- return ETrue;
- }
- // The following will be transferred to parser
- TInt retTemp = KErrNone;
- TBool moreNeeded = EFalse;
- retTemp = iParseData.iAtCmdHandler->AddDataForParsing( *iBufferPtr,
- moreNeeded );
- if ( retTemp!=KErrNone || !moreNeeded )
- {
- // If error or no error but no more data needed, don't reissue
- FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (no reissue) complete" )));
- return EFalse;
- }
- // If no error and more data needed, reissue
- FTRACE(FPrint( _L("CDunUpstream::ProcessReadData() (reissue) complete" )));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Manages activity in a channel
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::ManageChannelActivity()
- {
- FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity()" )));
- if ( iActivityData.iDataRead )
- {
- FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity() (not ready) complete" )));
- return KErrNotReady;
- }
- iActivityData.iDataRead = ETrue;
- if ( iActivityData.iActivityCallback && !iActivityData.iNotified )
- {
- iActivityData.iActivityCallback->NotifyChannelActivity();
- iActivityData.iNotified = ETrue;
- }
- FTRACE(FPrint( _L("CDunUpstream::ManageChannelActivity() complete" )));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called when endpoint data read/write complete
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::RunL()
- {
- FTRACE(FPrint( _L("CDunUpstream::RunL() (Dir=%d)" ), iDirection));
- iTransferState = EDunStateIdle;
-
- TBool isError;
- TInt retTemp = iStatus.Int();
- TInt stop = ProcessErrorCondition( retTemp, isError );
-
- if ( !stop ) // no real error detected -> continue
- {
- TBool reIssue = ETrue;
- if ( !isError )
- {
- if ( iOperationType == EDunOperationTypeRead )
- {
- ManageChannelActivity();
- reIssue = ProcessReadData();
- } // if ( iOperationType == EDunOperationTypeRead )
- else // iOperationType == EDunOperationTypeWrite
- {
- iOperationType = EDunOperationTypeRead;
- }
- } // if ( !isError )
-
- if ( reIssue )
- {
- IssueRequest();
- }
-
- } // if ( !stop )
- else // stop -> tear down connection
- {
- FTRACE(FPrint( _L("CDunUpstream::RunL() stop" )));
- TDunConnectionReason connReason;
- connReason.iReasonType = EDunReasonTypeRW;
- connReason.iContext = GetMediaContext( EDunStreamTypeUpstream );
- connReason.iSignalType = 0;
- connReason.iSignalHigh = EFalse;
- connReason.iDirection = iDirection;
- connReason.iErrorCode = retTemp;
- if ( iOperationType == EDunOperationTypeRead )
- {
- iUtility->DoNotifyConnectionNotOk( iComm,
- iSocket,
- connReason,
- iCallbacksR );
- }
- else // iOperationType == EDunOperationTypeWrite
- {
- iUtility->DoNotifyConnectionNotOk( iComm,
- iSocket,
- connReason,
- iCallbacksW );
- }
- } // else
-
- FTRACE(FPrint( _L("CDunUpstream::RunL() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive.
-// Gets called on cancel
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::DoCancel()
- {
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdStatusReporter
-// Notifies about parser's need to get more data
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyParserNeedsMoreData()
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData()" )));
- IssueRequest(); // iOperationType must be read here (don't set)
- FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdStatusReporter
-// Notifies about editor mode reply
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyEditorModeReply( TBool aStart )
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply()" )));
- if ( iParseData.iDataMode )
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() (not ready) complete" )));
- return;
- }
- // If start of editor mode then just reissue the read request
- // If continuation then echo and reissue the read request
- if ( aStart )
- {
- IssueRequest();
- FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() (start) complete" )));
- return;
- }
- iParseData.iAtCmdHandler->SendEchoCharacter( iBufferPtr, this );
- FTRACE(FPrint( _L("CDunUpstream::NotifyEditorModeReply() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdHandler
-// Starts URC message handling
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::StartUrc()
- {
- FTRACE(FPrint( _L("CDunUpstream::StartUrc()" )));
- TInt retVal = KErrNone;
- if ( iParseData.iAtCmdHandler ) // optional
- {
- retVal = iParseData.iAtCmdHandler->StartUrc();
- }
- FTRACE(FPrint( _L("CDunUpstream::StartUrc() complete" )));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdHandler
-// Stops AT command handling downstream related activity (also URC)
-// ---------------------------------------------------------------------------
-//
-TInt CDunUpstream::StopAtCmdHandling()
- {
- FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling()" )));
- TInt retVal = KErrNone;
- if ( iParseData.iAtCmdHandler ) // optional
- {
- retVal = iParseData.iAtCmdHandler->StopUrc();
- if ( retVal != KErrNone )
- {
- iParseData.iAtCmdHandler->Stop();
- FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling() (iAtCmdHandler) complete" )));
- return retVal;
- }
- retVal = iParseData.iAtCmdHandler->Stop();
- }
- FTRACE(FPrint( _L("CDunUpstream::StopAtCmdHandling() complete" )));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCmdModeMonitor.
-// Notifies about command mode start
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyCommandModeStart()
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeStart()" )));
- iParseData.iDataMode = EFalse;
- // Stop processing (just to be sure).
- // This will stop any possibly pending operations of
- // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
- // clearing (and stopping) non-callback write queues.
- StopAtCmdHandling();
- // Also restart the URC handling after the data mode
- StartUrc();
- FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeStart() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunCmdModeMonitor.
-// Notifies about command mode end
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyCommandModeEnd()
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd()" )));
- iParseData.iDataMode = ETrue;
- // Stop processing (mandatory).
- // This will stop any possibly pending operations of
- // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
- // clearing (and stopping) non-callback write queues.
- StopAtCmdHandling();
- // The follow is needed because stopping the AT command handling here
- // prevents the subsequent AT command handling notification to reach the
- // NotifyAtCmdHandlingEnd() in this class (the notification starts from
- // CDunAtCmdPusher's SetToIdleAndNotifyEnd()).
- // So here we have to do the block "if ( aStartIndex < 0 )" in function
- // NotifyAtCmdHandlingEnd().
- IssueRequest();
- FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd() complete" )));
- }
-
-// ---------------------------------------------------------------------------
-// From class MDunAtCmdEchoer.
-// Notifies about command mode end
-// ---------------------------------------------------------------------------
-//
-void CDunUpstream::NotifyEchoComplete()
- {
- FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete()" )));
- IssueRequest();
- FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete() complete" )));
- }
--- a/localconnectivityservice/dun/utils/src/DunUtils.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Common utility methods for DUN
-*
-*/
-
-
-#include <e32base.h>
-#include "DunUtils.h"
-#include "DunDebug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Connects to comms server
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunUtils::ConnectCommsServer( RCommServ& aCommServer )
- {
- FTRACE(FPrint(_L( "CDunUtils::ConnectCommsServer()") ));
- TInt retTemp;
-#ifndef PRJ_USE_NETWORK_STUBS
- retTemp = StartC32();
- if ( retTemp!=KErrNone && retTemp!=KErrAlreadyExists )
- {
- FTRACE(FPrint(_L( "CDunUtils::ConnectCommsServer() StartC32 %d" ), retTemp));
- return retTemp;
- }
-#endif
- retTemp = aCommServer.Connect();
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunUtils::ConnectCommsServer() aCommServer.Connect %d" ), retTemp));
- return retTemp;
- }
- FTRACE(FPrint(_L( "CDunUtils::ConnectCommsServer() complete") ));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Sets RComm buffer length
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CDunUtils::SetRCommBufferLength( RComm& aComm, TInt aLength )
- {
- FTRACE(FPrint(_L( "CDunUtils::SetRCommBufferLength()") ));
- TInt retTemp = aComm.SetReceiveBufferLength( aLength );
- if ( retTemp != KErrNone )
- {
- FTRACE(FPrint(_L( "CDunUtils::SetRCommBufferLength() (set failed) complete (%d)"), retTemp));
- return retTemp;
- }
- TInt setLength = aComm.ReceiveBufferLength();
- if ( setLength != aLength )
- {
- FTRACE(FPrint(_L( "CDunUtils::SetRCommBufferLength() (get failed) complete") ));
- return KErrGeneral;
- }
- FTRACE(FPrint(_L( "CDunUtils::SetRCommBufferLength() complete") ));
- return KErrNone;
- }
--- a/localconnectivityservice/generichid/bwins/generichidu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-EXPORTS
- ?Unit@CField@@QBEHXZ @ 1 NONAME ; int CField::Unit(void) const
- ?IsInReport@CField@@QBEHH@Z @ 2 NONAME ; int CField::IsInReport(int) const
- ?NewLC@CGenericHid@@SAPAV1@PAVMTransportLayer@@@Z @ 3 NONAME ; class CGenericHid * CGenericHid::NewLC(class MTransportLayer *)
- ?UsageMax@CField@@QBEHXZ @ 4 NONAME ; int CField::UsageMax(void) const
- ?UnitExponent@CField@@QBEHXZ @ 5 NONAME ; int CField::UnitExponent(void) const
- ?StringMin@CField@@QBEHXZ @ 6 NONAME ; int CField::StringMin(void) const
- ?NewL@CHidDriver@@SAPAV1@VTUid@@PAVMDriverAccess@@@Z @ 7 NONAME ; class CHidDriver * CHidDriver::NewL(class TUid, class MDriverAccess *)
- ?SetOffset@CField@@QAEXH@Z @ 8 NONAME ; void CField::SetOffset(int)
- ?NewLC@CParser@@SAPAV1@XZ @ 9 NONAME ; class CParser * CParser::NewLC(void)
- ?SetStringRange@CField@@QAEXHH@Z @ 10 NONAME ; void CField::SetStringRange(int, int)
- ?ReportSizeBytes@CReportRoot@@QBEHHW4TType@CField@@@Z @ 11 NONAME ; int CReportRoot::ReportSizeBytes(int, enum CField::TType) const
- ?ClearUsageList@CField@@QAEXXZ @ 12 NONAME ; void CField::ClearUsageList(void)
- ?IsNamedArray@CCollection@@QBEHXZ @ 13 NONAME ; int CCollection::IsNamedArray(void) const
- ?SetUnitExponent@CField@@QAEXH@Z @ 14 NONAME ; void CField::SetUnitExponent(int)
- ?SetAttributes@CField@@QAEXK@Z @ 15 NONAME ; void CField::SetAttributes(unsigned long)
- ?SetPhysicalMin@CField@@QAEXH@Z @ 16 NONAME ; void CField::SetPhysicalMin(int)
- ?SetUsagePage@CField@@QAEXH@Z @ 17 NONAME ; void CField::SetUsagePage(int)
- ?SetStringMin@CField@@QAEXH@Z @ 18 NONAME ; void CField::SetStringMin(int)
- ?CollectionByIndex@CCollection@@QBEPBV1@H@Z @ 19 NONAME ; class CCollection const * CCollection::CollectionByIndex(int) const
- ?FieldByIndex@CCollection@@QBEPBVCField@@H@Z @ 20 NONAME ; class CField const * CCollection::FieldByIndex(int) const
- ?SetPhysicalRange@CField@@QAEXHH@Z @ 21 NONAME ; void CField::SetPhysicalRange(int, int)
- ?SetDesignatorRange@CField@@QAEXHH@Z @ 22 NONAME ; void CField::SetDesignatorRange(int, int)
- ?CollectionCount@CCollection@@QBEHXZ @ 23 NONAME ; int CCollection::CollectionCount(void) const
- ?NewLC@CReportGenerator@@SAPAV1@PBVCReportRoot@@HW4TType@CField@@@Z @ 24 NONAME ; class CReportGenerator * CReportGenerator::NewLC(class CReportRoot const *, int, enum CField::TType)
- ?IsInput@CField@@QBEHXZ @ 25 NONAME ; int CField::IsInput(void) const
- ?StringMax@CField@@QBEHXZ @ 26 NONAME ; int CField::StringMax(void) const
- ?SetLogicalMin@CField@@QAEXH@Z @ 27 NONAME ; void CField::SetLogicalMin(int)
- ?GetUsageId@TReportTranslator@@QBEHAAHH@Z @ 28 NONAME ; int TReportTranslator::GetUsageId(int &, int) const
- ?SearchL@THidFieldSearch@@QAEXPBVCReportRoot@@PAVMHidFieldFinder@@@Z @ 29 NONAME ; void THidFieldSearch::SearchL(class CReportRoot const *, class MHidFieldFinder *)
- ?IsConstant@CField@@QBEHXZ @ 30 NONAME ; int CField::IsConstant(void) const
- ?PhysicalMin@CField@@QBEHXZ @ 31 NONAME ; int CField::PhysicalMin(void) const
- ?ParseL@CParser@@QAEPAVCReportRoot@@ABVTDesC8@@@Z @ 32 NONAME ; class CReportRoot * CParser::ParseL(class TDesC8 const &)
- ?AddUsageL@CField@@QAEXH@Z @ 33 NONAME ; void CField::AddUsageL(int)
- ?Count@CField@@QBEHXZ @ 34 NONAME ; int CField::Count(void) const
- ?SetSize@CField@@QAEXH@Z @ 35 NONAME ; void CField::SetSize(int)
- ??0TReportTranslator@@QAE@ABVTDesC8@@PBVCField@@@Z @ 36 NONAME ; TReportTranslator::TReportTranslator(class TDesC8 const &, class CField const *)
- ?ReportId@CField@@QBEHXZ @ 37 NONAME ; int CField::ReportId(void) const
- ?IsArray@CField@@QBEHXZ @ 38 NONAME ; int CField::IsArray(void) const
- ?SetPhysicalMax@CField@@QAEXH@Z @ 39 NONAME ; void CField::SetPhysicalMax(int)
- ?NewL@CGenericHid@@SAPAV1@PAVMTransportLayer@@@Z @ 40 NONAME ; class CGenericHid * CGenericHid::NewL(class MTransportLayer *)
- ?HasUsage@CField@@QBEHH@Z @ 41 NONAME ; int CField::HasUsage(int) const
- ?SetStringMax@CField@@QAEXH@Z @ 42 NONAME ; void CField::SetStringMax(int)
- ?IsFeature@CField@@QBEHXZ @ 43 NONAME ; int CField::IsFeature(void) const
- ?StringIndex@CField@@QBEHXZ @ 44 NONAME ; int CField::StringIndex(void) const
- ?Report@CReportGenerator@@QAE?AVTPtr8@@XZ @ 45 NONAME ; class TPtr8 CReportGenerator::Report(void)
- ??0CHidDriver@@IAE@XZ @ 46 NONAME ; CHidDriver::CHidDriver(void)
- ?AllowedToHandleEvent@CHidInputDataHandlingReg@@QAEHHH@Z @ 47 NONAME ; int CHidInputDataHandlingReg::AllowedToHandleEvent(int, int)
- ?UsageIdL@TReportTranslator@@QBEHH@Z @ 48 NONAME ; int TReportTranslator::UsageIdL(int) const
- ?SetLogicalMax@CField@@QAEXH@Z @ 49 NONAME ; void CField::SetLogicalMax(int)
- ?IsOutput@CField@@QBEHXZ @ 50 NONAME ; int CField::IsOutput(void) const
- ?Usage@CCollection@@QBEHXZ @ 51 NONAME ; int CCollection::Usage(void) const
- ?SetUnit@CField@@QAEXH@Z @ 52 NONAME ; void CField::SetUnit(int)
- ?PhysicalMax@CField@@QBEHXZ @ 53 NONAME ; int CField::PhysicalMax(void) const
- ?IsData@CField@@QBEHXZ @ 54 NONAME ; int CField::IsData(void) const
- ?SetUsageRange@CField@@QAEXHH@Z @ 55 NONAME ; void CField::SetUsageRange(int, int)
- ?DesignatorIndex@CField@@QBEHXZ @ 56 NONAME ; int CField::DesignatorIndex(void) const
- ?IsApplication@CCollection@@QBEHXZ @ 57 NONAME ; int CCollection::IsApplication(void) const
- ?LogicalMin@CField@@QBEHXZ @ 58 NONAME ; int CField::LogicalMin(void) const
- ?DesignatorMin@CField@@QBEHXZ @ 59 NONAME ; int CField::DesignatorMin(void) const
- ?RawValueL@TReportTranslator@@QBEHH@Z @ 60 NONAME ; int TReportTranslator::RawValueL(int) const
- ?SetDesignatorIndex@CField@@QAEXH@Z @ 61 NONAME ; void CField::SetDesignatorIndex(int)
- ?AddHandledEvent@CHidInputDataHandlingReg@@QAEXHH@Z @ 62 NONAME ; void CHidInputDataHandlingReg::AddHandledEvent(int, int)
- ?Type@CField@@QBE?AW4TType@1@XZ @ 63 NONAME ; enum CField::TType CField::Type(void) const
- ?Attributes@CField@@QBEKXZ @ 64 NONAME ; unsigned long CField::Attributes(void) const
- ?IsReport@CCollection@@QBEHXZ @ 65 NONAME ; int CCollection::IsReport(void) const
- ?IsUsageModifier@CCollection@@QBEHXZ @ 66 NONAME ; int CCollection::IsUsageModifier(void) const
- ?LastUsage@CField@@QBEHXZ @ 67 NONAME ; int CField::LastUsage(void) const
- ?SetUsageMin@CField@@QAEXH@Z @ 68 NONAME ; void CField::SetUsageMin(int)
- ?IsUsageSwitch@CCollection@@QBEHXZ @ 69 NONAME ; int CCollection::IsUsageSwitch(void) const
- ?Size@CField@@QBEHXZ @ 70 NONAME ; int CField::Size(void) const
- ?IsLogical@CCollection@@QBEHXZ @ 71 NONAME ; int CCollection::IsLogical(void) const
- ?FieldCount@CCollection@@QBEHXZ @ 72 NONAME ; int CCollection::FieldCount(void) const
- ?SetField@CReportGenerator@@QAEHPBVCField@@HHH@Z @ 73 NONAME ; int CReportGenerator::SetField(class CField const *, int, int, int)
- ?IsPhysical@CCollection@@QBEHXZ @ 74 NONAME ; int CCollection::IsPhysical(void) const
- ?LogicalMax@CField@@QBEHXZ @ 75 NONAME ; int CField::LogicalMax(void) const
- ?SetDesignatorMin@CField@@QAEXH@Z @ 76 NONAME ; void CField::SetDesignatorMin(int)
- ?DesignatorMax@CField@@QBEHXZ @ 77 NONAME ; int CField::DesignatorMax(void) const
- ?Type@CCollection@@QBEKXZ @ 78 NONAME ; unsigned long CCollection::Type(void) const
- ?Count@TReportTranslator@@QBEHXZ @ 79 NONAME ; int TReportTranslator::Count(void) const
- ?GetValue@TReportTranslator@@QBEHAAHHH@Z @ 80 NONAME ; int TReportTranslator::GetValue(int &, int, int) const
- ?IsVariable@CField@@QBEHXZ @ 81 NONAME ; int CField::IsVariable(void) const
- ?ValueL@TReportTranslator@@QBEHHH@Z @ 82 NONAME ; int TReportTranslator::ValueL(int, int) const
- ?SetUsageMax@CField@@QAEXH@Z @ 83 NONAME ; void CField::SetUsageMax(int)
- ?SetType@CField@@QAEXABW4TType@1@@Z @ 84 NONAME ; void CField::SetType(enum CField::TType const &)
- ?Usage@CField@@QBEHH@Z @ 85 NONAME ; int CField::Usage(int) const
- ?NewL@CReportGenerator@@SAPAV1@PBVCReportRoot@@HW4TType@CField@@@Z @ 86 NONAME ; class CReportGenerator * CReportGenerator::NewL(class CReportRoot const *, int, enum CField::TType)
- ?UsagePage@CField@@QBEHXZ @ 87 NONAME ; int CField::UsagePage(void) const
- ?SetStringIndex@CField@@QAEXH@Z @ 88 NONAME ; void CField::SetStringIndex(int)
- ?UsageMin@CField@@QBEHXZ @ 89 NONAME ; int CField::UsageMin(void) const
- ?UsageArray@CField@@QBE?AV?$TArray@H@@XZ @ 90 NONAME ; class TArray<int> CField::UsageArray(void) const
- ?SetCount@CField@@QAEXH@Z @ 91 NONAME ; void CField::SetCount(int)
- ?UsagePage@CCollection@@QBEHXZ @ 92 NONAME ; int CCollection::UsagePage(void) const
- ??1CHidDriver@@UAE@XZ @ 93 NONAME ; CHidDriver::~CHidDriver(void)
- ?Offset@CField@@QBEHXZ @ 94 NONAME ; int CField::Offset(void) const
- ?SetDesignatorMax@CField@@QAEXH@Z @ 95 NONAME ; void CField::SetDesignatorMax(int)
- ?SetReportId@CField@@QAEXH@Z @ 96 NONAME ; void CField::SetReportId(int)
- ?NewL@CParser@@SAPAV1@XZ @ 97 NONAME ; class CParser * CParser::NewL(void)
- ?UsageCount@CField@@QBEHXZ @ 98 NONAME ; int CField::UsageCount(void) const
- ?SetLogicalRange@CField@@QAEXHH@Z @ 99 NONAME ; void CField::SetLogicalRange(int, int)
-
--- a/localconnectivityservice/generichid/eabi/generichidu.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-EXPORTS
- _ZN10CHidDriver4NewLE4TUidP13MDriverAccess @ 1 NONAME
- _ZN10CHidDriverC2Ev @ 2 NONAME
- _ZN10CHidDriverD0Ev @ 3 NONAME
- _ZN10CHidDriverD1Ev @ 4 NONAME
- _ZN10CHidDriverD2Ev @ 5 NONAME
- _ZN11CGenericHid4NewLEP15MTransportLayer @ 6 NONAME
- _ZN11CGenericHid5NewLCEP15MTransportLayer @ 7 NONAME
- _ZN15THidFieldSearch7SearchLEPK11CReportRootP15MHidFieldFinder @ 8 NONAME
- _ZN16CReportGenerator4NewLEPK11CReportRootiN6CField5TTypeE @ 9 NONAME
- _ZN16CReportGenerator5NewLCEPK11CReportRootiN6CField5TTypeE @ 10 NONAME
- _ZN16CReportGenerator6ReportEv @ 11 NONAME
- _ZN16CReportGenerator8SetFieldEPK6CFieldiii @ 12 NONAME
- _ZN17TReportTranslatorC1ERK6TDesC8PK6CField @ 13 NONAME
- _ZN17TReportTranslatorC2ERK6TDesC8PK6CField @ 14 NONAME
- _ZN24CHidInputDataHandlingReg15AddHandledEventEii @ 15 NONAME
- _ZN24CHidInputDataHandlingReg20AllowedToHandleEventEii @ 16 NONAME
- _ZN6CField11SetReportIdEi @ 17 NONAME
- _ZN6CField11SetUsageMaxEi @ 18 NONAME
- _ZN6CField11SetUsageMinEi @ 19 NONAME
- _ZN6CField12SetStringMaxEi @ 20 NONAME
- _ZN6CField12SetStringMinEi @ 21 NONAME
- _ZN6CField12SetUsagePageEi @ 22 NONAME
- _ZN6CField13SetAttributesEm @ 23 NONAME
- _ZN6CField13SetLogicalMaxEi @ 24 NONAME
- _ZN6CField13SetLogicalMinEi @ 25 NONAME
- _ZN6CField13SetUsageRangeEii @ 26 NONAME
- _ZN6CField14ClearUsageListEv @ 27 NONAME
- _ZN6CField14SetPhysicalMaxEi @ 28 NONAME
- _ZN6CField14SetPhysicalMinEi @ 29 NONAME
- _ZN6CField14SetStringIndexEi @ 30 NONAME
- _ZN6CField14SetStringRangeEii @ 31 NONAME
- _ZN6CField15SetLogicalRangeEii @ 32 NONAME
- _ZN6CField15SetUnitExponentEi @ 33 NONAME
- _ZN6CField16SetDesignatorMaxEi @ 34 NONAME
- _ZN6CField16SetDesignatorMinEi @ 35 NONAME
- _ZN6CField16SetPhysicalRangeEii @ 36 NONAME
- _ZN6CField18SetDesignatorIndexEi @ 37 NONAME
- _ZN6CField18SetDesignatorRangeEii @ 38 NONAME
- _ZN6CField7SetSizeEi @ 39 NONAME
- _ZN6CField7SetTypeERKNS_5TTypeE @ 40 NONAME
- _ZN6CField7SetUnitEi @ 41 NONAME
- _ZN6CField8SetCountEi @ 42 NONAME
- _ZN6CField9AddUsageLEi @ 43 NONAME
- _ZN6CField9SetOffsetEi @ 44 NONAME
- _ZN7CParser4NewLEv @ 45 NONAME
- _ZN7CParser5NewLCEv @ 46 NONAME
- _ZN7CParser6ParseLERK6TDesC8 @ 47 NONAME
- _ZNK11CCollection10FieldCountEv @ 48 NONAME
- _ZNK11CCollection10IsPhysicalEv @ 49 NONAME
- _ZNK11CCollection12FieldByIndexEi @ 50 NONAME
- _ZNK11CCollection12IsNamedArrayEv @ 51 NONAME
- _ZNK11CCollection13IsApplicationEv @ 52 NONAME
- _ZNK11CCollection13IsUsageSwitchEv @ 53 NONAME
- _ZNK11CCollection15CollectionCountEv @ 54 NONAME
- _ZNK11CCollection15IsUsageModifierEv @ 55 NONAME
- _ZNK11CCollection17CollectionByIndexEi @ 56 NONAME
- _ZNK11CCollection4TypeEv @ 57 NONAME
- _ZNK11CCollection5UsageEv @ 58 NONAME
- _ZNK11CCollection8IsReportEv @ 59 NONAME
- _ZNK11CCollection9IsLogicalEv @ 60 NONAME
- _ZNK11CCollection9UsagePageEv @ 61 NONAME
- _ZNK11CReportRoot15ReportSizeBytesEiN6CField5TTypeE @ 62 NONAME
- _ZNK17TReportTranslator10GetUsageIdERii @ 63 NONAME
- _ZNK17TReportTranslator5CountEv @ 64 NONAME
- _ZNK17TReportTranslator6ValueLEii @ 65 NONAME
- _ZNK17TReportTranslator8GetValueERiii @ 66 NONAME
- _ZNK17TReportTranslator8UsageIdLEi @ 67 NONAME
- _ZNK17TReportTranslator9RawValueLEi @ 68 NONAME
- _ZNK6CField10AttributesEv @ 69 NONAME
- _ZNK6CField10IsConstantEv @ 70 NONAME
- _ZNK6CField10IsInReportEi @ 71 NONAME
- _ZNK6CField10IsVariableEv @ 72 NONAME
- _ZNK6CField10LogicalMaxEv @ 73 NONAME
- _ZNK6CField10LogicalMinEv @ 74 NONAME
- _ZNK6CField10UsageArrayEv @ 75 NONAME
- _ZNK6CField10UsageCountEv @ 76 NONAME
- _ZNK6CField11PhysicalMaxEv @ 77 NONAME
- _ZNK6CField11PhysicalMinEv @ 78 NONAME
- _ZNK6CField11StringIndexEv @ 79 NONAME
- _ZNK6CField12UnitExponentEv @ 80 NONAME
- _ZNK6CField13DesignatorMaxEv @ 81 NONAME
- _ZNK6CField13DesignatorMinEv @ 82 NONAME
- _ZNK6CField15DesignatorIndexEv @ 83 NONAME
- _ZNK6CField4SizeEv @ 84 NONAME
- _ZNK6CField4TypeEv @ 85 NONAME
- _ZNK6CField4UnitEv @ 86 NONAME
- _ZNK6CField5CountEv @ 87 NONAME
- _ZNK6CField5UsageEi @ 88 NONAME
- _ZNK6CField6IsDataEv @ 89 NONAME
- _ZNK6CField6OffsetEv @ 90 NONAME
- _ZNK6CField7IsArrayEv @ 91 NONAME
- _ZNK6CField7IsInputEv @ 92 NONAME
- _ZNK6CField8HasUsageEi @ 93 NONAME
- _ZNK6CField8IsOutputEv @ 94 NONAME
- _ZNK6CField8ReportIdEv @ 95 NONAME
- _ZNK6CField8UsageMaxEv @ 96 NONAME
- _ZNK6CField8UsageMinEv @ 97 NONAME
- _ZNK6CField9IsFeatureEv @ 98 NONAME
- _ZNK6CField9LastUsageEv @ 99 NONAME
- _ZNK6CField9StringMaxEv @ 100 NONAME
- _ZNK6CField9StringMinEv @ 101 NONAME
- _ZNK6CField9UsagePageEv @ 102 NONAME
- _ZTI10CHidDriver @ 103 NONAME ; #<TI>#
- _ZTI11CCollection @ 104 NONAME ; #<TI>#
- _ZTI11CGenericHid @ 105 NONAME ; #<TI>#
- _ZTI11CReportRoot @ 106 NONAME ; #<TI>#
- _ZTI15CDriverListItem @ 107 NONAME ; #<TI>#
- _ZTI16CReportGenerator @ 108 NONAME ; #<TI>#
- _ZTI24CHidInputDataHandlingReg @ 109 NONAME ; #<TI>#
- _ZTI6CField @ 110 NONAME ; #<TI>#
- _ZTI7CParser @ 111 NONAME ; #<TI>#
- _ZTV10CHidDriver @ 112 NONAME ; #<VT>#
- _ZTV11CCollection @ 113 NONAME ; #<VT>#
- _ZTV11CGenericHid @ 114 NONAME ; #<VT>#
- _ZTV11CReportRoot @ 115 NONAME ; #<VT>#
- _ZTV15CDriverListItem @ 116 NONAME ; #<VT>#
- _ZTV16CReportGenerator @ 117 NONAME ; #<VT>#
- _ZTV24CHidInputDataHandlingReg @ 118 NONAME ; #<VT>#
- _ZTV6CField @ 119 NONAME ; #<VT>#
- _ZTV7CParser @ 120 NONAME ; #<VT>#
-
--- a/localconnectivityservice/generichid/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build information file for project generichid
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../rom/generichid.iby CORE_MW_LAYER_IBY_EXPORT_PATH(generichid.iby)
-
-PRJ_MMPFILES
-generichid.mmp
--- a/localconnectivityservice/generichid/group/generichid.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project generichid
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-TARGET generichid.dll
-TARGETTYPE DLL
-UID 0x1000008d 0x10281cfe
-
-CAPABILITY CAP_APPLICATION CommDD ProtServ // two latter needed by USB
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE hidgeneric.cpp
-SOURCE hiddriveritem.cpp
-SOURCE hidfield.cpp
-SOURCE hidparser.cpp
-SOURCE hiditem.cpp
-SOURCE hidcollection.cpp
-SOURCE hidsearch.cpp
-SOURCE hidreporttranslator.cpp
-SOURCE hidreportroot.cpp
-SOURCE hidreportbase.cpp
-SOURCE hidreportgenerator.cpp
-SOURCE hidinterfaces.cpp
-SOURCE hidconnectioninfo.cpp
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-
-
--- a/localconnectivityservice/generichid/group/generichid.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component generichid
-
-source \sf\mw\remoteconn\localconnectivityservice\generichid
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/localconnectivityservice/generichid/inc/debug.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Logging definition
-*
-*/
-
-
-#ifndef PRJ_LOGGING_H
-#define PRJ_LOGGING_H
-
-#include "debugconfig.h"
-
-#ifdef PRJ_ENABLE_TRACE
-
-#ifdef PRJ_FILE_TRACE
-#include <flogger.h>
-#else
-#include <e32debug.h>
-#endif
-
-const TInt KMaxLogLineLength = 512;
-
-#define KPRINTERROR 0x00000001 // Tracing level: error
-#define KPRINTINFO 0x00000002 // Tracing level: function trace
-#define KPRINTSTATE 0x00000004 // Tracing level: state machine info
-#define KPRINTWARNING 0x00000008 // Tracing level: warning
-
-const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING;
-
-NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
- {
-public:
- void Overflow(TDes16& /*aDes*/) {}
- };
-
-NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
- {
-public:
- void Overflow(TDes8& /*aDes*/) {}
- };
-
-inline void Trace(TRefByValue<const TDesC16> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list,aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TBuf16<KMaxLogLineLength> theFinalString;
- theFinalString.Append(KTracePrefix16);
- TOverflowTruncate16 overflow;
- theFinalString.AppendFormatList(aFmt,list,&overflow);
- RDebug::Print(theFinalString);
-#endif
- }
-
-inline void Trace(TRefByValue<const TDesC8> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list, aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TOverflowTruncate8 overflow;
- TBuf8<KMaxLogLineLength> buf8;
- buf8.Append(KTracePrefix8);
- buf8.AppendFormatList(aFmt, list, &overflow);
- TBuf16<KMaxLogLineLength> buf16(buf8.Length());
- buf16.Copy(buf8);
- TRefByValue<const TDesC> tmpFmt(_L("%S"));
- RDebug::Print(tmpFmt, &buf16);
-#endif
- }
-
-inline void TracePanic(
- char* aFile,
- TInt aLine,
- TInt aPanicCode,
- const TDesC& aPanicCategory)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KPanicPrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName);
- Trace(buf);
- User::Panic(aPanicCategory, aPanicCode);
- }
-
-inline void TraceLeave(char* aFile, TInt aLine, TInt aReason)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KLeavePrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName);
- Trace(buf);
- User::LeaveIfError(aReason);
- }
-
-#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
-
-#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
-
-#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
-
-#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
-
-#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
-
-#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
-
-#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
-
-#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
-
-#define TRACE_FUNC_ENTRY_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
-
-#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
-
-#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
-
-#define TRACE_FUNC_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
-
-#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
-
-#else // PRJ_ENABLE_TRACE not defined
-
-#define TRACE_INFO(p)
-
-#define TRACE_ERROR(p)
-
-#define TRACE_STATE(p)
-
-#define TRACE_WARNING(p)
-
-#define TRACE_INFO_SEG(p)
-
-#define TRACE_ASSERT(GUARD, CODE)
-
-#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
-
-#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
-
-#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
-
-#define TRACE_FUNC_ENTRY
-
-#define TRACE_FUNC_ENTRY_THIS
-
-#define TRACE_FUNC_EXIT
-
-#define TRACE_FUNC
-
-#define TRACE_FUNC_THIS
-
-#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
-#endif // PRJ_ENABLE_TRACE
-
-#endif // PRJ_LOGGING_H
--- a/localconnectivityservice/generichid/inc/debugconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef GENERICHID_DEBUGCONFIG_H
-#define GENERICHID_DEBUGCONFIG_H
-
-#include "prjconfig.h"
-
-
-/**
- * Custom logging variations.
- */
-#ifdef PRJ_FILE_TRACE
-_LIT(KLogFile,"generichid.txt");
-_LIT(KLogDir,"generichid");
-#endif
-
-#ifdef PRJ_ENABLE_TRACE
-_LIT(KTracePrefix16, "[generichid] ");
-_LIT8(KTracePrefix8, "[generichid] ");
-_LIT8(KFuncFormat8, "><%S");
-_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
-_LIT8(KFuncEntryFormat8, ">%S");
-_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
-_LIT8(KFuncExitFormat8, "<%S");
-
-_LIT(KPanicCategory, "generichid");
-_LIT8(KPanicPrefix8, "PANIC code ");
-_LIT8(KLeavePrefix8, "LEAVE code ");
-#endif
-
-#endif // OBEXSM_DEBUGCONFIG_H
--- a/localconnectivityservice/generichid/inc/hidconnectioninfo.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ?Description
-*
-*/
-
-
-#ifndef C_CONNECTIONINFO_H_
-#define C_CONNECTIONINFO_H_
-
-
-#include <e32base.h>
-
-class CReportRoot;
-class CHidDriver;
-
-/**
- * CConnectionInfo
- * Connection information
- *
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS ( CConnectionInfo ) : public CBase
- {
-
-public:
- /**
- * Two-phased constructor.
- * @param aConnectionID Connection identifier
- * @param aReportRoot Connection ReportRoot
- */
- static CConnectionInfo* NewL(TInt aConnectionID, CReportRoot* aReportRoot);
- static CConnectionInfo* NewLC(TInt aConnectionID, CReportRoot* aReportRoot);
-
- /**
- * Destructor.
- */
- virtual ~CConnectionInfo();
-
-public:
- /**
- * Get Connection id
- *
- * @since S60 v5.0
- * @return connection id
- */
- TInt ConnectionID();
-
- /**
- * Get report id
- *
- * @since S60 v5.0
- * @return report id
- */
- CReportRoot* ReportRoot();
-
- /**
- * Set last command handler
- *
- * @since S60 v5.0
- * @param aHidDriverItem hiddriver item
- * @return None
- */
- void SetLastCommandHandler(CHidDriver* aHidDriverItem);
-
- /**
- * Set last command handler
- *
- * @since S60 v5.0
- * @param aHidDriverItem hiddriver item
- * @return None
- */
- CHidDriver* ReturnLastCommandHandler();
-
-private:
- CConnectionInfo(TInt aConnectionID, CReportRoot* aReportRoot);
-
-private:
-
- /**
- * Connection id
- */
- TInt iConnectionID;
-
- /**
- * Connection id
- * Own.
- */
- CReportRoot* iReportRoot;
-
- /**
- * Pointer to last driver which handled last command
- * Not own.
- */
- CHidDriver* iLastCmdDriver;
- };
-
-#endif /* C_CONNECTIONINFO_H_ */
--- a/localconnectivityservice/generichid/inc/hiddriveritem.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares driver list itemapplication class.
-*
-*/
-
-
-
-#ifndef C_DRIVERLISTITEM_H
-#define C_DRIVERLISTITEM_H
-
-#include "hidreportroot.h"
-#include "hidinterfaces.h"
-
-/**
- * Container class so we can maintain a list of driver instances
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CDriverListItem : public CBase
- {
- // Give access to the TSglQueLink offset:
- friend class CGenericHid;
-
-public :
-
- explicit CDriverListItem(TInt aConnectionId);
-
- /**
- * Destructor.
- */
- virtual ~CDriverListItem();
-
-
- /**
- * Set driver instance
- *
- * @since S60 v5.0
- * @param aDriver Driver instance
- * @return None
- */
- void SetDriver(CHidDriver* aDriver);
-
- /**
- * Return connection ID
- *
- * @since S60 v5.0
- * @return Connection id
- */
- TInt ConnectionId() const;
-
- /**
- * Return driver instance
- *
- * @since S60 v5.0
- * @return driver instance
- */
- CHidDriver* Driver() const;
-
-
-private :
-
- /**
- * Queue link
- */
- TSglQueLink iSlink;
-
- /**
- * The transport-layer ID for the connection
- */
- TInt iConnectionId;
-
- /**
- * The device driver
- * Own.
- */
- CHidDriver* iDriver;
-
- };
-#endif
-
--- a/localconnectivityservice/generichid/inc/hiditem.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: BTHid item
-*
-*/
-
-
-#ifndef T_ITEM_H
-#define T_ITEM_H
-
-#include <e32std.h>
-
-/**
- * HID item class
- * A HID report descriptor is comprised of a sequence of "items"
- * that provide information about the device. Items consist of a
- * header and zero or more bytes of data. The header contains the item
- * type (main/global/local), an item "tag" (subtype) and the item size.
- * Items can be "short" (containing a maximum of 4 bytes of data) or
- * "long" (a maximum of 255 bytes of data).
-
- * A TItem represents a single HID report descriptor item. It is
- * constructed from an eight bit non-modifiable (Symbian-) descriptor,
- * which is assumed to contain report (HID-) descriptor data.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class TItem
- {
-public:
- /**
- * The possible item types: main, global or local. Item type is
- * a two-bit field -- the 11b value is reserved for "long items", which
- * are only used for vendor-specific commands.
- */
- enum TItemType
- {
- EMain = 0, //!< Input, output, feature and begin or end collection
- EGlobal = 1, //!< Global item items affect all subsequent fields
- ELocal = 2, //!< Local items only persist until the next main item
- EReserved = 3 //!< No defined use in the current HID standard (v1.11)
- };
-
-public:
-
- /**
- * The constructor takes a an eight bit non-modifiable (Symbian-)
- * descriptor containing report (HID-) descriptor data.
- * The item tag, type, data size and offset are calculated here.
- *
- * @since S60 v5.0
- * @param aRawData The raw item data, represented as a Symbian
- * descriptor. The item data is assumed to be at the beginning of the
- * descriptor. The size of the TDesC8 may be greater than the size
- * of the item, as the item size will be calculated from the raw HID
- * descriptor data. Of course, the TDesC8 should be at least as
- * long as the raw item data.
- */
- TItem(const TDesC8& aRawData);
-
- /**
- * DataSize() returns the size of the item data in bytes. This
- * is the total item size minus the size of any header information.
- * (A short item header is a single byte, a long item header is
- * three bytes long.)
- *
- * @since S60 v5.0
- * @return The size, in bytes, of the item data. Range 0-255.
- */
- TInt DataSize() const;
-
- /**
- * Tag() returns the tag (subtype) value for this item.
- *
- * @since S60 v5.0
- * @return The item tag.
- */
- TInt Tag() const;
-
- /**
- * Data() returns the data associated with the item, represented as a
- * 32-bit unsigned integer. This is only meaningful if the data length
- * is less than 4 bytes.
- *
- * @since S60 v5.0
- * @return The item data as a 32-bit unsigned integer.
- */
- TUint32 Data() const;
-
- /**
- * SignedData() returns the data associated with the item,
- * represented as a 32-bit signed integer. This is only
- * meaningful if the data length is less than 4 bytes.
- *
- * @since S60 v5.0
- * @return The item data as a 32-bit signed integer.
- */
- TInt32 SignedData() const;
-
- /**
- * Returns the byte at the given offset within the item data block.
- *
- * @since S60 v5.0
- * @param aIndex The index within the data block for the current tag.
- * @return The data at the specified index.
- */
- TUint8 operator[](TInt aIndex) const;
-
- /**
- * Type() returns the item type (e.g. "global").
- *
- * @since S60 v5.0
- * @return The item type.
- */
- TItemType Type() const;
-
- /**
- * Check if item is main
- *
- * @since S60 v5.0
- * @return ETrue if item type is "main"
- */
- TBool IsMain() const;
-
- /**
- * Check if item is local
- *
- * @since S60 v5.0
- * @return ETrue if item type is "local"
- */
- TBool IsLocal() const;
-
- /**
- * Check if item is global
- *
- * @since S60 v5.0
- * @return ETrue if item type is "global"
- */
- TBool IsGlobal() const;
-
- /**
- * Check if item is global
- *
- * @since S60 v5.0
- * @return ETrue if this is a long item
- */
- TBool IsLong() const;
-
- /**
- * ItemSize() returns the total size of this item, including the
- * header data.
- *
- * @since S60 v5.0
- * @return The total size of this item, in bytes.
- */
- TInt ItemSize() const;
-
-private:
- /**
- * Pointer to the raw report descriptor data
- */
- TPtrC8 iRawData;
-
- /**
- * Item data size
- */
-
- TInt iSize;
- /**
- * Item tag value
- */
- TInt iTag;
-
- /**
- * Offset in bytes of the data block
- */
- TInt iDataOffset;
-
- /**
- * Item type
- */
- TItemType iType;
- };
-
-#endif
-
--- a/localconnectivityservice/generichid/inc/hidparser.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1041 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: BTHid item
-*
-*/
-
-#ifndef C_PARSER_H
-#define C_PARSER_H
-
-#include "hidreportroot.h"
-
-class TItem;
-
-/**
- * HID Parser error codes. For a description of the error code
- * format, see "HID Parser Error Codes", Revision 1.2, USB
- * Implementers' Forum, February 2000.
- */
-enum THidParserError
- {
- // General:
- //
- EUnknownItem = 0xbf00,
- ELongItemDefined = 0x3e00,
- //
- // Global:
- //
- EZeroUsagePage = 0x8004,
- EUsagePageOutOfRange = 0x8104,
- ELogicalMinInvalidForArray = 0x8214,
- ELogicalMaxInvalidForArray = 0x8224,
- ELonelyPhysicalMin = 0x8034,
- ELonelyPhysicalMax = 0x8044,
- EZeroReportId = 0x8084,
- EReportIdTooBig = 0x8184,
- ELateReportId = 0x8284,
- EReportIdOutsideTopLevel = 0x8484,
- EZeroReportCount = 0x8094,
- EPushWithoutPop = 0x80a4,
- EPushHasData = 0x81a4,
- EPopWithoutPush = 0x80b4,
- EPopHasData = 0x81b4,
- ERedundantGlobalItem = 0x80f4,
- EReservedUsagePage = 0x0004,
- ELogicalMinExceedsMax = 0x0014,
- EPhysicalMinExceedsMax = 0x0034,
- EExponentReservedBitsNonZero = 0x0054,
- EUnitReservedBitsNonZero = 0x0064,
- //
- // Local:
- //
- ELonelyUsageMin = 0x8018,
- EUsageMinExceedsMax = 0x8118,
- EUsagePageMismatchMin = 0x8318,
- ELonelyUsageMax = 0x8028,
- EUsagePageMismatchMax = 0x8228,
- ELonelyDesignatorMin = 0x8048,
- EDesignatorMinExceedsMax = 0x8148,
- ELonelyDesignatorMax = 0x8058,
- ELonelyStringMin = 0x8088,
- EStringMinExceedsMax = 0x8188,
- ELonelyStringMax = 0x8098,
- EUnknownDelimiter = 0x80a8,
- ENestedDelimiter = 0x81a8,
- ELonelyDelimiter = 0x82a8,
- EInvalidItemWithinDelimiter = 0x83a8,
- EDelimiterAtTopLevel = 0x84a8,
- EZeroUsage = 0x0008,
- //
- // Main:
- //
- EInputMissingItems = 0x8080,
- EInputItemWithinDelimiter = 0x8180,
- EInputReportSize = 0x8280,
- EInputMinExceedsMax = 0x8380,
- EOutputMissingItems = 0x8090,
- EOutputItemWithinDelimiter = 0x8190,
- EOutputReportSize = 0x8290,
- EOutputMinExceedsMax = 0x8390,
- EFeatureMissingItems = 0x80b0,
- EFeatureItemWithinDelimiter = 0x81b0,
- EFeatureReportSize = 0x82b0,
- EFeatureMinExceedsMax = 0x83b0,
- ENoMatchingBeginCollection = 0x80c0,
- EEndCollectionWithinDelimiter = 0x81c0,
- EReportMustBeEightBitMultiple = 0x82c0,
- ENoMatchingEndCollection = 0x80a0,
- EBeginCollectionWithinDelimiter = 0x81a0,
- EApplicationCollectionLevel = 0x82a0,
- EInputReservedBitsNonZero = 0x0080,
- EInputLocalMultipleUse = 0x0280,
- EOutputReservedBitsNonZero = 0x0090,
- EOutputLocalMultipleUse = 0x0290,
- EFeatureReservedBitsNonZero = 0x00b0,
- EFeatureLocalMultipleUse = 0x02b0,
- ECollectionLocalUnused = 0x00a0,
- ECollectionTypeUnknownReserved = 0x01a0,
- EEndCollectionLocalUnused = 0x00c0,
- EEndCollectionHasData = 0x01c0,
- //
- // Our ("vendor specific") codes:
- //
- EInvalidItemLength = 0xC000,
- EApplicationHasDelimiter = 0x40a0,
- EDelimiterWithinNamedArray = 0x40a8,
- ECollectionHasNoUsage = 0x40c0,
- ECollectionHasNoUsagePage = 0x41c0
- };
-
-/**
- * HID parser panics
- */
-enum THidParsingError
- {
- // ASSERT_ALWAYS:
- //
- EZeroLengthItem = 1, //!< Zero descriptor length in TItem constructor
- ENoReportRoot = 2, //!< iReportRoot is 0 in CreateFieldL()
- ENoCurrentCollection = 3, //!< No current collection in Collection()
- //
- // ASSERT_DEBUG:
- //
- ENoCollectionToCheck = 10, //!< No collection in CheckForCollectionErrors()
- EPopFailed = 11, //!< Empty collection stack in PopCollection()
- EIndexOutOfRange = 12, //!< Index out of range in TItem::operator[]
- EItemTooLong = 13 //!< Data() called for item with size > 4
- };
-
-
-/**
- * Parser global states
- *
- * CParser uses TParserGlobalState objects to store the global item
- * state during parsing. The global state can be saved and restored
- * using the HID descriptor POP and PUSH tags, therefore CParser
- * incorporates a stack of TParserGlobalState objects.
- *
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class TParserGlobalState
- {
- friend class CParser;
-
-public:
-
- TParserGlobalState();
-
- /**
- * Copies all data members into a CField object. The other
- * members of the CField object (those corresponding to local
- * HID descriptor tags) are unaffected.
- *
- * @since S60 v5.0
- * @param aField Pointer to the field object to populate.
- * @return None.
- */
- void Populate(CField *aField) const;
-
-private:
- /**
- * Usage page
- */
- TInt iUsagePage;
-
- /**
- * Logical minimum
- */
- TInt iLogicalMin;
-
- /**
- * Logical maximum
- */
- TInt iLogicalMax;
-
- /**
- * Physical minimum
- */
- TInt iPhysicalMin;
-
- /**
- * Physical maximum
- */
- TInt iPhysicalMax;
-
- /**
- * Unit type
- */
- TInt iUnit;
-
- /**
- * Unit exponent
- */
- TInt iUnitExponent;
-
- /**
- * Associated report ID
- */
- TInt iReportId;
-
- /**
- * Report size
- */
- TInt iSize;
-
- /**
- * Report count
- */
- TInt iCount;
- };
-
-
-/**
- *
- * HID parser
- * CParser parses a HID report descriptor. It outputs a CReportRoot
- * containing a tree of CCollection and CField objects representing
- * the descriptor information. A HID device driver can then use this,
- * in conjunction with TReportTranslator and CReportGenerator objects,
- * to facilitate communication with a HID device.
- *
- * The parsing process conforms to the HID class specification
- * document: "USB Device Class Definition for Human Interface Devices
- * (HID)", Firmware Specification, Version 1.11, USB Implementers' Forum,
- * June 2001.
- *
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CParser : public CBase
- {
-public:
- IMPORT_C static CParser* NewL();
- IMPORT_C static CParser* NewLC();
-
- virtual ~CParser();
-
- /**
- * ParseL() parses a string of bytes representing a HID report
- * descriptor. It returns a tree of collection and field objects (a
- * CReportRoot). Ownership of the CReportRoot is transferred to the
- * caller.
- *
- * Warning messages produced during the parse process are added to
- * a list which the driver can retrieve using the Warnings()
- * function. Note that the list will be overwritten by the next
- * ParseL() operation.
- *
- * Errors and warnings are represented using the format described
- * in "HID Parser Error Codes", Revision 1.2, USB Implementers'
- * Forum, February 2000.
- *
- * @since S60 v5.0
- * @param aRawData The report descriptor data to be processed
- * @return The root collection, a tree of CCollection and CField objects
- */
- IMPORT_C CReportRoot* ParseL(const TDesC8& aRawData);
-
- /**
- * Return field count
- *
- * @since S60 v5.0
- * @return field count
- */
- TInt FieldCount();
-
-
-
-
-
-private:
- CParser();
- void ConstructL();
-
- /**
- * Handle a HID descriptor main item. This includes the creation
- * of new field objects in the current collection and management of
- * the global item state stack.
- *
- * @since S60 v5.0
- * @param aItem The current report descriptor tag and its associated data
- * @return KErrNone (0) on success, otherwise a critical error code in
- * the standard HID format.
- */
- TInt MainItemL(const TItem& aItem);
-
- /**
- * Handle a HID descriptor local item. Stores the data in the
- * appropriate member of the local state object, *iLocal.
- *
- * @since S60 v5.0
- * @param aItem The current report descriptor tag and its associated data
- * @return KErrNone (0) on success, otherwise a critical error code in
- * the standard HID format.
- */
- TInt LocalItemL(const TItem& aItem);
-
- /**
- * Handle a HID descriptor global item. Stores the data in the
- * appropriate member of the current global state object, iGlobal.
- *
- * @since S60 v5.0
- * @param aItem The current report descriptor tag and its associated data
- * @return KErrNone (0) on success, otherwise a critical error code in
- * the standard HID format.
- */
- TInt GlobalItemL(const TItem& aItem);
-
- /**
- * Used to access the current collection object, i.e. the object
- * at the top of the collection stack (iCollectionStack).
- *
- *
- * @since S60 v5.0
- * @return A pointer to the current collection object.
- *
- */
- CCollection* Collection();
-
- /**
- * Pushes a pointer to the current collection object on to the
- * collection stack.
- *
- * Note that the collection stack is used to create the tree of
- * collections. It should not be confused with the global state
- * stack, iGlobalStack.
- *
- * @since S60 v5.0
- * @param aCollection The collection to be pushed onto the stack
- * @return None.
- *
- */
- void PushCollectionL(const CCollection* aCollection);
-
- /**
- * Pushes a pointer to the current collection object on to the
- * collection stack.
- *
- * Note that the collection stack is used to create the tree of
- * collections. It should not be confused with the global state
- * stack, iGlobalStack.
- *
- * @since S60 v5.0
- * @return None.
- *
- */
- void PopCollection();
-
- /**
- * CreateFieldL() is called to instantiate a new CField object
- * when an input, output or feature item is encountered in the
- * report descriptor.
- *
- * The current local and global states extracted from the report
- * descriptor are copied to the CField, which is placed into the
- * current CCollection.
- *
- * @since S60 v5.0
- * @param aType The type of field: input, output or feature
- * @param aAttributes The attributes for the field (e.g. Data, Array,
- * Absolute.)
- * @return KErrNone (0) on success, otherwise a critical error code
- * in the standard HID format.
- *
- */
- TInt CreateFieldL(CField::TType aType, TUint32 aAttributes);
-
- /**
- * ClearLocalState() clears the appropriate fields in the CField
- * object that represents the current local item state.
- *
- * @since S60 v5.0
- * @return None
- *
- */
- void ClearLocalState();
-
- /**
- * DumpStateTableL() copies the current local and global item state
- * into a CField object.
- *
- * @since S60 v5.0
- * @param aField The field object to receive the data
- * @return None
- *
- */
- void DumpStateTableL(CField *aField) const;
-
- /**
- * CreateCollectionL() is called to instantiate a new CCollection
- * object when a "begin collection" item is encountered in the
- * report descriptor.
- *
- * @since S60 v5.0
- * @param aType The type of the collection. This can be one of the
- * seven standard types defined in CCollection::TType,
- * or a vendor defined value.
- * @return KErrNone (0) on success, otherwise a critical error code in
- * the standard HID format.
- */
- TInt CreateCollectionL(TUint32 aType);
-
- /**
- * CheckForCollectionErrors() validates the current collection
- * object. It adds non-critical errors to the warnings list. It
- * returns an error code if a critical error is encountered.
- *
- * @since S60 v5.0
- * @param aType The type of the collection (one of the CCollection::TType
- * values, or vendor defined).
- * @return KErrNone (0) if there was no error, otherwise a critical
- * error code in the standard HID format.
- */
- TInt CheckForCollectionErrors(TUint32 aType);
-
- /**
- * CheckForFieldErrors() validates the current global and local
- * item state in preparation for creating a CField object. It adds
- * non-critical errors to the warnings list. It returns an error
- * code if a critical error is encountered.
- *
- * @since S60 v5.0
- * @param @param aType The type of the field (input, output or feature).
- * @param aAttributes The attributes for the field (e.g. Data, Array,
- * Absolute.)
- * @return KErrNone (0) if there was no error, otherwise a critical
- * error code in the standard HID format.
- */
- TInt CheckForFieldErrors(CField::TType aType, TUint32 aAttributes);
-
- /**
- * CheckForMainErrors() performs error checking common to
- * CheckForCollectionErrors() and CheckForFieldErrors(). It adds
- * non-critical errors to the warnings list. It returns an error
- * code if a critical error is encountered.
- *
- * @since S60 v5.0
- * @return KErrNone (0) if there was no error, otherwise a critical
- * error code in the standard HID format.
- */
- TInt CheckForMainErrors();
-
- /**
- * CheckAllReportSizes() checks if all report sizes are integral
- * multiples of 8 bits.
- *
- * @since S60 v5.0
- * @return ETrue if all report sizes are integral multiples of
- * 8 bits.
- */
- TBool CheckAllReportSizes() const;
-
- /**
- * BitsToRepresentRange() returns the number of bits required to
- * represent all values in a given range. It is used to check
- * that the report field size is appropriate for the given
- * logical minimum and maximum.
- *
- * If the range is all positive then it is assumed that there is no
- * sign bit, otherwise twos complement format is assumed, as per
- * the HID class specification, v1.11, Section 6.2.2.7.
- *
- * @since S60 v5.0
- * @param aMin Logical minimum
- * @param aMax Logical maximum
- * @return The number of bits required to represent the range aMin
- * to aMax (inclusive).
- */
- static TInt BitsToRepresentRange(TInt aMin, TInt aMax);
-
- /**
- * NumberOfLeadingZeros() is used by BitsToRepresentRange(). It
- * returns the number of leading zeros in the binary representation
- * of a number, effectively performing a log_2 operation.
- *
- * @since S60 v5.0
- * @param aValue Unsigned 32-bit value
- * @return Number of leading zeros in the binary representation of aValue
- */
- static TInt NumberOfLeadingZeros(TUint32 aValue);
-
- /**
- * IssueWarning() adds a TParserWarning to the warning list.
- *
- * @since S60 v5.0
- * @param aHidWarningCode The error or warning code, which should
- * be in the standard HID format.
- * @return None
- */
- void IssueWarning(TInt aHidWarningCode);
-
- /**
- * IsReservedUsagePage() checks if the given HID usage page is
- * listed as reserved according to the HID clas specification,
- * v1.11.
- *
- * @since S60 v5.0
- * @param aUsagePage The usage page to check.
- * @result ETrue if the usage page is listed as reserved.
- */
- static TBool IsReservedUsagePage(TInt aUsagePage);
-
-
- /**
- * HandleMainInputTagL
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleMainInputTagL(const TItem& aItem);
-
-
- /**
- * HandleMainOutputTag
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleMainOutputTagL(const TItem& aItem);
-
- /**
- * HandleMainFeature
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleMainFeatureL( const TItem& aItem );
-
- /**
- * HandleMainCollection
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleMainCollectionL( const TItem& aItem );
-
-
- /**
- * MainEndCollection
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleMainEndCollection( const TItem& aItem);
-
- /**
- * HandleGlobalReportId
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalReportId( const TItem& aItem );
-
- /**
- * HandleGlobalUsagePage
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalUsagePage( const TItem& aItem );
-
- /**
- * HandleGlobalLogicalMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalLogicalMinimum( const TItem& aItem );
-
- /**
- * HandleGlobalLogicalMaximum
- *
- * @since S60 ?S60_version *** for example, S60 v3.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalLogicalMaximum( const TItem& aItem );
-
- /**
- * HandleGlobalPhysicalMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalPhysicalMinimum( const TItem& aItem );
-
- /**
- * HandleGlobalPhysicalMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalPhysicalMaximum( const TItem& aItem );
-
- /**
- * HandleGlobalUnit
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalUnit( const TItem& aItem );
-
- /**
- * HandleGlobalUnitExponent
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalUnitExponent( const TItem& aItem );
-
- /**
- * HandleGlobalReportSize
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalReportSize( const TItem& aItem );
-
- /**
- * HandleGlobalReportSize
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalReportCount( const TItem& aItem );
-
- /**
- * HandleGlobalPush
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalPushL( const TItem& aItem );
-
- /**
- * HandleGlobalPop
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleGlobalPop( const TItem& aItem );
-
- /**
- * HandleLocalUsage
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalUsageL( const TItem& aItem );
-
- /**
- * HandleLocalUsageMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalUsageMinimum( const TItem& aItem );
-
- /**
- * HandleLocalUsageMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalUsageMaximum( const TItem& aItem );
-
- /**
- * HandleLocalDesignatorIndex
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalDesignatorIndex( const TItem& aItem );
-
- /**
- * HandleLocalDesignatorMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalDesignatorMinimum( const TItem& aItem );
-
- /**
- * HandleLocalDesignatorMaximum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalDesignatorMaximum( const TItem& aItem );
-
- /**
- * HandleLocalStringIndex
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalStringIndex( const TItem& aItem );
-
- /**
- * HandleLocalStringMinimum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalStringMinimum( const TItem& aItem );
-
- /**
- * HandleLocalStringMaximum
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalStringMaximum( const TItem& aItem );
-
- /**
- * HandleLocalDelimiter
- *
- * @since S60 v5.0
- * @param aItem a Hid field item
- * @result error code
- */
- TInt HandleLocalDelimiter( const TItem& aItem );
-
- /**
- * CheckMandatoryFieldError
- *
- * @since S60 v5.0
- * @param aType a field type
- * @param aAttributes attributes
- * @result error code
- */
- TInt CheckMandatoryFieldExistence( CField::TType aType, TUint32 aAttributes );
-
- /**
- * CheckUsageMinAndMaxErrors
- *
- * @since S60 v5.0
- * @result error code
- */
- TInt CheckUsageMinAndMaxErrors();
-
- /**
- * CheckDesignatorMinAndMaxErrors
- *
- * @since S60 v5.0
- * @result error code
- */
- TInt CheckDesignatorMinAndMaxErrors();
-
- /**
- * CheckStringMinAndMaxErrors
- *
- * @since S60 v5.0
- * @result error code
- */
- TInt CheckStringMinAndMaxErrors();
-
- /**
- * CheckMandatoryFieldError
- *
- * @since S60 v5.0
- * @param aType a field type
- * @param aAttributes attributes
- * @result error code
- */
- TInt CheckMandatoryFieldErrors( CField::TType aType, TUint32 aAttributes );
-
- /**
- * CheckLogicalMinAndMax
- * Check if logical minimum and maximum must match the number of usage
- * values
- *
- * @since S60 v5.0
- * @param aAttributes attributes
- * @result error code
- */
- void CheckLogicalMinAndMax( TUint32 aAttributes );
-
- /**
- * CheckMandatoryFieldError
- *
- * @since S60 v5.0
- * @param aType a field type
- * @param aAttributes attributes
- * @result error code
- */
- void CheckFieldBitNeeded( CField::TType aType, TUint32 aAttributes );
-
- /**
- * HandleItem
- *
- * @since S60 v5.0
- * @result error code
- */
- void HandleItemL(TItem& aItem);
-
- /**
- * CheckParseErrors
- *
- * @since S60 v5.0
- * @result error code
- */
- void CheckParseErrors();
-
- /**
- * ResetParser
- *
- * @since S60 v5.0
- * @result error code
- */
- void ResetParserL();
-
-private:
- /**
- * A bitmask containing the THidItem flags which represent local
- * (as opposed to main or global) items.
- */
- static const TUint32 KLocalItemMask;
-
- /**
- * A bitmask containing the THidItem flags which represent local
- * unused items.
- */
- static const TUint32 KUnusedLocalItemsMask;
-
- /**
- * A bitmask containing the THidItem flags which represent mandatory
- * items.
- */
- static const TUint32 KMandatoryItemMask;
-
- /**
- * A bitmask containing the THidItem flags which represent report
- * items.
- */
- static const TUint32 KReportItemMask;
-
-private:
-
- /**
- * THidItem defineds a set of flags used for keeping track of
- * which items have been encountered in the report descriptor for
- * the current report field. The flags are used with the
- * iItemsDefined and iGlobalItemsDefined data members.
- */
- enum THidItem
- {
- EUsagePage = 1<<0,
- ELogicalMin = 1<<1,
- ELogicalMax = 1<<2,
- EReportSize = 1<<3,
- EReportCount = 1<<4,
- EReportId = 1<<5,
- EUsageMin = 1<<6,
- EUsageMax = 1<<7,
- EPhysicalMin = 1<<8,
- EPhysicalMax = 1<<9,
- EUnit = 1<<10,
- EUnitExponent = 1<<11,
- EDesignatorIndex = 1<<12,
- EDesignatorMin = 1<<13,
- EDesignatorMax = 1<<14,
- EStringIndex = 1<<15,
- EStringMin = 1<<16,
- EStringMax = 1<<17,
- EInputReport = 1<<18,
- EOutputReport = 1<<19,
- EFeatureReport = 1<<20,
- EDelimiter = 1<<21,
- EUsageId = 1<<22
- };
-
- /**
- * HID local tags
- */
- enum THidLocalTags
- {
- ELocalUsage = 0x00,
- ELocalUsageMinimum = 0x01,
- ELocalUsageMaximum = 0x02,
- ELocalDesignatorIndex = 0x03,
- ELocalDesignatorMinimum = 0x04,
- ELocalDesignatorMaximum = 0x05,
- ELocalStringIndex = 0x07,
- ELocalStringMinimum = 0x08,
- ELocalStringMaximum = 0x09,
- ELocalDelimiter = 0x0a
- };
-
- /**
- * HID global tags
- */
- enum THidGlobalTags
- {
- EGlobalUsagePage = 0x00,
- EGlobalLogicalMinimum = 0x01,
- EGlobalLogicalMaximum = 0x02,
- EGlobalPhysicalMinimum = 0x03,
- EGlobalPhysicalMaximum = 0x04,
- EGlobalUnitExponent = 0x05,
- EGlobalUnit = 0x06,
- EGlobalReportSize = 0x07,
- EGlobalReportId = 0x08,
- EGlobalReportCount = 0x09,
- EGlobalPush = 0x0a,
- EGlobalPop = 0x0b
- };
-
- /**
- * HID main tags
- */
- enum THidMainTags
- {
- EMainInput = 0x08,
- EMainOutput = 0x09,
- EMainFeature = 0x0b,
- EMainCollection = 0x0a,
- EMainEndCollection = 0x0c
- };
-
- /**
- * The local state, cleared after each "Main" item
- * Own.
- */
- CField* iLocal;
-
- /**
- * Current global state
- */
- TParserGlobalState iGlobal;
-
- /**
- * Global state stack, to allow HID descriptor PUSH and POP commands
- */
- RArray<TParserGlobalState> iGlobalStack;
-
- // For delimiter handling:
- //
- /**
- * ETrue if currently within a delimiter pair
- */
- TBool iWithinDelimiter;
-
- /**
- * Count of alternate USAGE declarations so far
- */
- TInt iAliasCount;
-
- /**
- * Count of alternate USAGE_MIN declarations
- */
- TInt iAliasCountMin;
-
- /**
- * Count of alternate USAGE_MAX declarations
- */
- TInt iAliasCountMax;
-
- /**
- * The root node of the collection tree
- * Own.
- */
- CReportRoot* iReportRoot;
-
- /**
- * Stack used to create the collection tree
- */
- RPointerArray<CCollection> iCollectionStack;
-
- // Keep track of which items have been seen in the descriptor:
- //
- /**
- * All items forming the current item state
- */
- TUint32 iItemsDefined;
-
- /**
- * Global items seen since the last main tag
- */
- TUint32 iGlobalItemsDefined;
-
- /**
- * ETrue if a redundant local item is seen
- */
- TBool iLocalMultipleUse;
-
- /**
- * Number of the item we're currently processing
- */
- TInt iItemNumber;
-
- /**
- * Record of any critical error encountered
- */
- TInt iErrorCode;
-
- /**
- * Field count
- */
- TInt iFieldCount;
- };
-
-#endif
--- a/localconnectivityservice/generichid/inc/hidreportgenerator.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Report generator
-*
-*/
-
-#ifndef C_REPORT_GENERATOR_H
-#define C_REPORT_GENERATOR_H
-
-#include "hidreportroot.h"
-#include "hidtranslate.h"
-
-/**
- * HID report generator
- *
- * Class used for generating output or feature reports to send to the device.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CReportGenerator : public CBase
- {
-public:
- /**
- * Constructs a CReportGenerator.
- *
- * @since S60 v5.0
- * @param aReportRoot Tree generated by CParser from the report
- * descriptor.
- * @param aReportId Report ID of the report to generate.
- * @param aType Type of report to generate (output or feature).
- */
- IMPORT_C static CReportGenerator* NewLC(const CReportRoot* aReportRoot,
- TInt aReportId, CField::TType aType);
-
- /**
- * Constructs a CReportGenerator.
- *
- * @since S60 v5.0
- * @param aReportRoot Tree generated by CParser from the report
- * descriptor.
- * @param aReportId Report ID of the report to generate.
- * @param aType Type of report to generate (output or feature).
- */
- IMPORT_C static CReportGenerator* NewL(const CReportRoot* aReportRoot,
- TInt aReportId, CField::TType aType);
-
- virtual ~CReportGenerator();
-
- /**
- * Sets the value of a single field in the report. Stores the requested
- * control value in a field in the report buffer. For array fields, adds
- * the requested usage ID to the array.
- *
- * @since S60 v5.0
- * @param aField Pointer to the field in which to set a value.
- * @param aUsageId Usage ID of the control to set.
- * @param aValue Value to write to the field, used for variable
- * fields only.
- * @param aControlOffset Which control to set when more than one
- * have the same usage ID.
- * @return Error code indicating success or reason for failure.
- */
- IMPORT_C TInt SetField(const CField* aField, TInt aUsageId, TInt aValue,
- TInt aControlOffset = 0);
-
- /**
- * Get the buffer holding the generated report
- *
- * @since S60 v5.0
- * @return pointer to buffer
- */
- IMPORT_C TPtr8 Report();
-
-private:
- /**
- * Constructor for CReportGenerator.
- *
- * @since S60 v5.0
- * @param aReportId Report ID of the report to generate.
- * @param aType Type of report to generate (output or feature).
- */
- CReportGenerator(TInt aReportId, CField::TType aType);
-
- /**
- * 2nd phase constructor for CReportGenerator. Allocates the
- * report buffer iBuf.
- *
- * @since S60 v5.0
- * @param aReportRoot Tree generated by CParser from the report
- * descriptor.
- */
- void ConstructL(const CReportRoot* aReportRoot);
-
- /**
- * Report ID of the report to generate
- */
- TInt iReportId;
-
- /**
- * Type of report to generate
- */
- CField::TType iType;
-
- /**
- * Tree of fields from the report descriptor
- * Not own.
- */
- const CReportRoot* iReportRoot;
-
- /**
- * Buffer to hold the generated report
- * Own.
- */
- HBufC8* iBuf;
- };
-
-#endif // __REPORT_GENERATOR_H__
--- a/localconnectivityservice/generichid/inc/hiduids.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: UID definitions.
-*
-*/
-
-
-#ifndef HIDUIDS_H
-#define HIDUIDS_H
-
-#define ECOM_UID 0x10009d8d
-#define REMCON_PLUGIN_IF 0x10204546
-//----- original HID uids, reserved from Symbian
-#define LAYOUT_PLUGIN_UID 0x10201d25
-#define DRIVER_PLUGIN_IF 0x10201d26
-#define LAYOUT_PLUGIN_IF 0x10201d27
-#define BTHID_SRV_UID 0x10201d28
-#define LAYOUTMGR_UID 0x10201d29
-#define BTKEYBOARD_APP_UID 0x10201d2a
-#define STARTER_UID 0x10201d2b
-#define BTHID_PLUGIN_UID 0x10201d2c
-//----- reserved from NSS list
-#define MOUSE_UID 0x10281cfc
-#define BTHID_CLIENT_UID 0x10281cfd
-#define GENERICHID_UID 0x10281cfe
-#define GSPLUGIN_IMP 0x10281cff
-#define BTHID_MAIN_IMP 0x10281d00
-#define BTHID_SETTINGS_IMP 0x10281d01
-#define BTHID_PLUGIN_IF 0x10281d02
-#define INSTALLER_UID 0x10281d03
-#define KEYBOARD_UID 0x10281d04
-#define KEYBOARD_DRIVER_IMP 0x10282bfd
-#define MOUSE_DRIVER_IMP 0x10282bfe
-#define BELGIAN_LAYOUT_IMP 0x10282bff
-#define DANISH_LAYOUT_IMP 0x10282c00
-#define DUTCH_LAYOUT_IMP 0x10282c01
-#define FINSWE_LAYOUT_IMP 0x10282c02
-#define FRENCH_LAYOUT_IMP 0x10282c03
-#define GERMAN_LAYOUT_IMP 0x10282c04
-#define ITALIAN_LAYOUT_IMP 0x10282c05
-#define NORWEGIAN_LAYOUT_IMP 0x10282c06
-#define PORTUGUESE_LAYOUT_IMP 0x10282c07
-#define SPANISH_LAYOUT_IMP 0x10282c08
-#define SU8GERMAN_LAYOUT_IMP 0x10282c09
-#define SU8RUSSIAN_LAYOUT_IMP 0x10282c0a
-#define SU8RUSSIANINT_LAYOUT_IMP 0x10282c0b
-#define SU8FINSWE_LAYOUT_IMP 0x10282c0c
-#define SU8DANNOR_LAYOUT_IMP 0x10282c0d
-#define SU8USENGLISH_LAYOUT_IMP 0x10282c0e
-#define SU8INTUSENGLISH_LAYOUT_IMP 0x10282c0f
-#define UK_LAYOUT_IMP 0x10282c10
-#define US_LAYOUT_IMP 0x10282c11
-#define USDVORAK_LAYOUT_IMP 0x10282c12
-#define USINT_LAYOUT_IMP 0x10282c13
-#define KBDCLIENT_UID 0x10282c14
-#define HEADSET_UID 0x10282c15
-#define HEADSET_DRIVER_IMP 0x10282c16
-#define HIDREMCON_UID 0x10282c17
-#define HIDREMCON_IMP 0x10282c18
-#define HIDEVENTPUBLISHER_UID 0x10282c19
-// Last reserved UID 0x10282c3c
-
-#endif // __HIDUIDS_H__
--- a/localconnectivityservice/generichid/inc/prjconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef GENERICHID_PRJCONFIG_H
-#define GENERICHID_PRJCONFIG_H
-
-/**
- * Traces are enabled via RDebug::Print() in UDEB build, by default.
- */
-#ifdef _DEBUG
-#define PRJ_ENABLE_TRACE
-#endif
-
-/**
- * Traces will be written to file if this is defined.
- */
-//#define PRJ_FILE_TRACE
-
-
-/**
- * build the project for module test purpose if this is defined
- */
-//#define PRJ_MODULETEST_BUILD
-
-/**
- * build the project using stubs to replace the dependencies if this is defined
- */
-//#define PRJ_USE_STUB
-
-#endif // OBEXSM_PRJCONFIG_H
--- a/localconnectivityservice/generichid/rom/generichid.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project generichid
-*
-*/
-
-
-#ifndef __GENERICHID_IBY__
-#define __GENERICHID_IBY__
-
-file=ABI_DIR\BUILD_DIR\generichid.dll SHARED_LIB_DIR\generichid.dll
-
-
-#endif
--- a/localconnectivityservice/generichid/src/hidcollection.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,284 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID collection implementation
-*
-*/
-
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32des8.h>
-#include <e32svr.h>
-
-#include "hidreportroot.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// NewLC()
-// -----------------------------------------------------------------------------
-//
-CCollection* CCollection::NewLC()
- {
- CCollection* self = new (ELeave) CCollection();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-// -----------------------------------------------------------------------------
-// NewL()
-// -----------------------------------------------------------------------------
-//
-CCollection* CCollection::NewL()
- {
- CCollection* self=NewLC();
- CleanupStack::Pop();
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// ConstructL()
-// -----------------------------------------------------------------------------
-//
-void CCollection::ConstructL()
- {
- // Nothing to do here
- }
-
-// -----------------------------------------------------------------------------
-// CCollection()
-// -----------------------------------------------------------------------------
-//
-CCollection::CCollection()
- {
- // Nothing to do here
- }
-
-// -----------------------------------------------------------------------------
-// ~CCollection()
-// -----------------------------------------------------------------------------
-//
-CCollection::~CCollection()
- {
- iCollections.ResetAndDestroy();
- iFields.ResetAndDestroy();
- }
-
-// -----------------------------------------------------------------------------
-// Type()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TUint32 CCollection::Type() const
- {
- return iType;
- }
-
-// -----------------------------------------------------------------------------
-// UsagePage()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CCollection::UsagePage() const
- {
- return iUsagePage;
- }
-
-// -----------------------------------------------------------------------------
-// Usage()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CCollection::Usage() const
- {
- return iUsage;
- }
-
-// -----------------------------------------------------------------------------
-// CollectionCount()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CCollection::CollectionCount() const
- {
- return iCollections.Count();
- }
-
-// -----------------------------------------------------------------------------
-// FieldCount()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CCollection::FieldCount() const
- {
- return iFields.Count();
- }
-
-// -----------------------------------------------------------------------------
-// CollectionByIndex
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const CCollection* CCollection::CollectionByIndex(TInt aIndex) const
- {
- return (0 <= aIndex && aIndex < iCollections.Count()) ?
- iCollections[aIndex] : NULL;
- }
-
-// -----------------------------------------------------------------------------
-// FieldByIndex
-// -----------------------------------------------------------------------------
-//
-EXPORT_C const CField* CCollection::FieldByIndex(TInt aIndex) const
- {
- return (0 <= aIndex && aIndex < iFields.Count()) ?
- iFields[aIndex] : NULL;
- }
-
-// -----------------------------------------------------------------------------
-// IsPhysical()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsPhysical() const
- {
- return iType == EPhysical;
- }
-
-// -----------------------------------------------------------------------------
-// IsApplication()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsApplication() const
- {
- return iType == EApplication;
- }
-
-// -----------------------------------------------------------------------------
-// IsLogical()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsLogical() const
- {
- return iType == ELogical;
- }
-
-// -----------------------------------------------------------------------------
-// IsReport()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsReport() const
- {
- return iType == EReport;
- }
-
-// -----------------------------------------------------------------------------
-// IsNamedArray()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsNamedArray() const
- {
- return iType == ENamedArray;
- }
-
-// -----------------------------------------------------------------------------
-// IsUsageSwitch()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsUsageSwitch() const
- {
- return iType == EUsageSwitch;
- }
-
-// -----------------------------------------------------------------------------
-// IsUsageModifier()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CCollection::IsUsageModifier() const
- {
- return iType == EUsageModifier;
- }
-
-// -----------------------------------------------------------------------------
-// SetType()
-// -----------------------------------------------------------------------------
-//
-void CCollection::SetType(TUint32 aType)
- {
- iType = aType;
- }
-
-// -----------------------------------------------------------------------------
-// SetUsagePage()
-// -----------------------------------------------------------------------------
-//
-void CCollection::SetUsagePage(TInt aUsagePage)
- {
- iUsagePage = aUsagePage;
- }
-
-// -----------------------------------------------------------------------------
-// SetUsage()
-// -----------------------------------------------------------------------------
-//
-void CCollection::SetUsage(TInt aUsage)
- {
- iUsage = aUsage;
- }
-// -----------------------------------------------------------------------------
-// AddFieldL()
-// -----------------------------------------------------------------------------
-//
-CField* CCollection::AddFieldL()
- {
- CField* field = CField::NewL();
- CleanupStack::PushL(field);
- User::LeaveIfError(iFields.Append(field));
- CleanupStack::Pop(field);
- return field;
- }
-
-// -----------------------------------------------------------------------------
-// AddCollectionL()
-// -----------------------------------------------------------------------------
-//
-CCollection* CCollection::AddCollectionL()
- {
- CCollection* collection = CCollection::NewL();
- CleanupStack::PushL(collection);
- User::LeaveIfError(iCollections.Append(collection));
- CleanupStack::Pop(collection);
- return collection;
- }
-
-
-
-
-
-// -----------------------------------------------------------------------------
-// Match()
-// -----------------------------------------------------------------------------
-//
-TBool TReportSize::Match(const TReportSize& aFirst,
- const TReportSize& aSecond)
- {
- return (aFirst.iReportId == aSecond.iReportId) &&
- (aFirst.iType == aSecond.iType);
- }
-
-
-// -----------------------------------------------------------------------------
-// TReportSize()
-// -----------------------------------------------------------------------------
-//
-TReportSize::TReportSize(TInt aReportId, CField::TType aType)
- : iReportId(aReportId), iType(aType), iSize(0)
- {
- // Nothing else to do
- }
-
--- a/localconnectivityservice/generichid/src/hidconnectioninfo.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-#include "hidconnectioninfo.h"
-#include "hidreportroot.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CConnectionInfo::CConnectionInfo(TInt aConnectionID, CReportRoot* aReportRoot):
-iConnectionID(aConnectionID),
-iReportRoot(aReportRoot)
- {
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CConnectionInfo* CConnectionInfo::NewL(TInt aConnectionID, CReportRoot* aReportRoot)
- {
- CConnectionInfo* self = CConnectionInfo::NewLC(aConnectionID, aReportRoot);
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CConnectionInfo* CConnectionInfo::NewLC(TInt aConnectionID, CReportRoot* aReportRoot)
- {
- CConnectionInfo* self = new( ELeave ) CConnectionInfo( aConnectionID, aReportRoot);
- CleanupStack::PushL( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CConnectionInfo::~CConnectionInfo()
- {
- TRACE_FUNC_ENTRY
- delete iReportRoot;
- iReportRoot = NULL;
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// ConnectionID
-// ---------------------------------------------------------------------------
-//
-TInt CConnectionInfo::ConnectionID()
- {
- return iConnectionID;
- }
-
-// ---------------------------------------------------------------------------
-// ReportRoot
-// ---------------------------------------------------------------------------
-//
-CReportRoot* CConnectionInfo::ReportRoot()
- {
- return iReportRoot;
- }
-
-// ---------------------------------------------------------------------------
-// SetLastCommandHandler
-// ---------------------------------------------------------------------------
-//
-void CConnectionInfo::SetLastCommandHandler(CHidDriver* aHidDriverItem)
- {
- iLastCmdDriver = aHidDriverItem;
- }
-// ---------------------------------------------------------------------------
-// ReturnLastCommandHandler
-// ---------------------------------------------------------------------------
-//
-CHidDriver* CConnectionInfo::ReturnLastCommandHandler()
- {
- return iLastCmdDriver;
- }
--- a/localconnectivityservice/generichid/src/hiddriveritem.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Driver list item implementation
-*
-*/
-
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32uid.h>
-
-#include "hiddriveritem.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CDriverListItem::CDriverListItem(TInt aConnectionId)
- : iConnectionId(aConnectionId)
- {
- }
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CDriverListItem::~CDriverListItem()
- {
- delete iDriver;
- }
-
-// ---------------------------------------------------------------------------
-// ConnectionId()
-// ---------------------------------------------------------------------------
-//
-TInt CDriverListItem::ConnectionId() const
- {
- return iConnectionId;
- }
-
-// ---------------------------------------------------------------------------
-// Driver()
-// ---------------------------------------------------------------------------
-//
-CHidDriver* CDriverListItem::Driver() const
- {
- return iDriver;
- }
-
-// ---------------------------------------------------------------------------
-// SetDriver()
-// ---------------------------------------------------------------------------
-//
-void CDriverListItem::SetDriver(CHidDriver* aDriver)
- {
- delete iDriver;
- iDriver = aDriver;
- }
-
--- a/localconnectivityservice/generichid/src/hidfield.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,638 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid field implementation
-*
-*/
-
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32des8.h>
-#include <e32svr.h>
-
-#include "hidreportroot.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewL()
-// ---------------------------------------------------------------------------
-//
-CField* CField::NewL()
- {
- CField* self = NewLC();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewLC()
-// ---------------------------------------------------------------------------
-//
-CField* CField::NewLC()
- {
- // Two-phase construction isn't necessary at present:
- CField* self = new (ELeave) CField;
- CleanupStack::PushL(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CField()
-// ---------------------------------------------------------------------------
-//
-CField::CField()
- {
- // nothing else to do
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CField::~CField()
- {
- iUsageList.Close();
- }
-
-// ---------------------------------------------------------------------------
-// UsagePage()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::UsagePage() const
- {
- return iUsagePage;
- }
-
-// ---------------------------------------------------------------------------
-// ReportId()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::ReportId() const
- {
- return iReportId;
- }
-
-// ---------------------------------------------------------------------------
-// Offset()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::Offset() const
- {
- return (iReportId == 0) ? iPos : (iPos+KSizeOfByte);
- }
-
-// ---------------------------------------------------------------------------
-// Size()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::Size() const
- {
- return iSize;
- }
-
-// ---------------------------------------------------------------------------
-// Count()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::Count() const
- {
- return iCount;
- }
-
-// ---------------------------------------------------------------------------
-// LogicalMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::LogicalMin() const
- {
- return iLogicalMin;
- }
-
-// ---------------------------------------------------------------------------
-// LogicalMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::LogicalMax() const
- {
- return iLogicalMax;
- }
-
-// ---------------------------------------------------------------------------
-// UsageMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::UsageMin() const
- {
- return iUsageMin;
- }
-
-// ---------------------------------------------------------------------------
-// UsageMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::UsageMax() const
- {
- return iUsageMax;
- }
-
-// ---------------------------------------------------------------------------
-// PhysicalMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::PhysicalMin() const
- {
- return iPhysicalMin;
- }
-
-// ---------------------------------------------------------------------------
-// PhysicalMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::PhysicalMax() const
- {
- return iPhysicalMax;
- }
-
-// ---------------------------------------------------------------------------
-// Unit()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::Unit() const
- {
- return iUnit;
- }
-
-// ---------------------------------------------------------------------------
-// UnitExponent()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::UnitExponent() const
- {
- return iUnitExponent;
- }
-
-// ---------------------------------------------------------------------------
-// DesignatorIndex()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::DesignatorIndex() const
- {
- return iDesignatorIndex;
- }
-
-// ---------------------------------------------------------------------------
-// DesignatorMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::DesignatorMin() const
- {
- return iDesignatorMin;
- }
-
-// ---------------------------------------------------------------------------
-// DesignatorMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::DesignatorMax() const
- {
- return iDesignatorMax;
- }
-
-// ---------------------------------------------------------------------------
-// StringMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::StringMin() const
- {
- return iStringMin;
- }
-
-// ---------------------------------------------------------------------------
-// StringMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::StringMax() const
- {
- return iStringMax;
- }
-
-// ---------------------------------------------------------------------------
-// StringIndex()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::StringIndex() const
- {
- return iStringIndex;
- }
-
-// ---------------------------------------------------------------------------
-// UsageArray()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TArray<TInt> CField::UsageArray() const
- {
- return iUsageList.Array();
- }
-
-// ---------------------------------------------------------------------------
-// HasUsage()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::HasUsage(const TInt aUsage) const
- {
- return iUsageList.Find(aUsage) != KErrNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// AddUsageL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::AddUsageL(const TInt aUsage)
- {
- User::LeaveIfError(iUsageList.Append(aUsage));
- }
-
-// ---------------------------------------------------------------------------
-// ClearUsageList()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::ClearUsageList()
- {
- iUsageList.Reset();
- }
-
-// ---------------------------------------------------------------------------
-// LastUsage()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::LastUsage() const
- {
- TInt usage = 0;
- if (iUsageList.Count() > 0)
- {
- usage = iUsageList[iUsageList.Count()-1];
- }
- return usage;
- }
-
-// ---------------------------------------------------------------------------
-// Attributes()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TUint32 CField::Attributes() const
- {
- return iAttributes;
- }
-
-// ---------------------------------------------------------------------------
-// Type()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CField::TType CField::Type() const
- {
- return iType;
- }
-
-// ---------------------------------------------------------------------------
-// IsVariable()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsVariable() const
- {
- return (( iAttributes & KFieldAttributeVariable ) != 0);
- }
-
-// ---------------------------------------------------------------------------
-// IsArray()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsArray() const
- {
- return ( ( iAttributes & KFieldAttributeVariable ) == 0);
- }
-
-// ---------------------------------------------------------------------------
-// IsConstant()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsConstant() const
- {
- return (( iAttributes & KFieldAttributeConstant ) != 0 );
- }
-
-// ---------------------------------------------------------------------------
-// IsData()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsData() const
- {
- // Field atribute first bit present if data is constat or is it data.
- // If first bit is zero field attibute data is set.
- return ( ( iAttributes & KFieldAttributeConstant ) == 0 );
- }
-
-// ---------------------------------------------------------------------------
-// SetType()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetType(const TType& aType)
- {
- iType = aType;
- }
-
-// ---------------------------------------------------------------------------
-// SetUsagePage()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUsagePage(const TInt aUsagePage)
- {
- iUsagePage = aUsagePage;
- }
-
-// ---------------------------------------------------------------------------
-// Destructor()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetReportId(const TInt aId)
- {
- iReportId = aId;
- }
-
-// ---------------------------------------------------------------------------
-// SetOffset()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetOffset(const TInt aOffset)
- {
- iPos = aOffset;
- }
-
-// ---------------------------------------------------------------------------
-// SetSize()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetSize(const TInt aSize)
- {
- iSize = aSize;
- }
-
-// ---------------------------------------------------------------------------
-// SetCount()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetCount(const TInt aCount)
- {
- iCount = aCount;
- }
-
-// ---------------------------------------------------------------------------
-// SetLogicalMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetLogicalMin(const TInt aMin)
- {
- iLogicalMin = aMin;
- }
-
-// ---------------------------------------------------------------------------
-// SetLogicalMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetLogicalMax(const TInt aMax)
- {
- iLogicalMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetUsageMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUsageMin(const TInt aMin)
- {
- iUsageMin = aMin;
- }
-
-// ---------------------------------------------------------------------------
-// SetUsageMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUsageMax(const TInt aMax)
- {
- iUsageMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetAttributes()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetAttributes(const TUint32 aAttributes)
- {
- iAttributes = aAttributes;
- }
-
-// ---------------------------------------------------------------------------
-// SetPhysicalMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetPhysicalMin(TInt aValue)
- {
- iPhysicalMin = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetPhysicalMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetPhysicalMax(TInt aValue)
- {
- iPhysicalMax = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetUnit()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUnit(TInt aValue)
- {
- iUnit = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetUnitExponent()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUnitExponent(TInt aValue)
- {
- iUnitExponent = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetDesignatorIndex()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetDesignatorIndex(TInt aValue)
- {
- iDesignatorIndex = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetDesignatorMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetDesignatorMin(TInt aValue)
- {
- iDesignatorMin = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetDesignatorMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetDesignatorMax(TInt aValue)
- {
- iDesignatorMax = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetStringMin()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetStringMin(TInt aValue)
- {
- iStringMin = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetStringMax()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetStringMax(TInt aValue)
- {
- iStringMax = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetStringIndex()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetStringIndex(TInt aValue)
- {
- iStringIndex = aValue;
- }
-
-// ---------------------------------------------------------------------------
-// SetLogicalRange()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetLogicalRange(TInt aMin, TInt aMax)
- {
- iLogicalMin = aMin;
- iLogicalMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetUsageRange()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetUsageRange(TInt aMin, TInt aMax)
- {
- iUsageMin = aMin;
- iUsageMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetPhysicalRange
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetPhysicalRange(TInt aMin, TInt aMax)
- {
- iPhysicalMin = aMin;
- iPhysicalMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetStringRange()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetStringRange(TInt aMin, TInt aMax)
- {
- iStringMin = aMin;
- iStringMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// SetDesignatorRange()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CField::SetDesignatorRange(TInt aMin, TInt aMax)
- {
- iDesignatorMin = aMin;
- iDesignatorMax = aMax;
- }
-
-// ---------------------------------------------------------------------------
-// IsInput()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsInput() const
- {
- return iType == EInput;
- }
-
-// ---------------------------------------------------------------------------
-// IsOutput()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsOutput() const
- {
- return iType == EOutput;
- }
-
-// ---------------------------------------------------------------------------
-// IsFeature()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsFeature() const
- {
- return iType == EFeature;
- }
-
-// ---------------------------------------------------------------------------
-// UsageCount()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::UsageCount() const
- {
- return iUsageList.Count();
- }
-
-// ---------------------------------------------------------------------------
-// Usage()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CField::Usage(TInt aIndex) const
- {
- return iUsageList[aIndex];
- }
-
-// ---------------------------------------------------------------------------
-// IsInReport()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CField::IsInReport(TInt aReportId) const
- {
- return ( 0 == iReportId || aReportId == iReportId );
- }
-
--- a/localconnectivityservice/generichid/src/hidgeneric.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,533 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Generic hid implementation
-*
-*/
-
-#include <e32std.h>
-
-#include "debug.h"
-#include "hidgeneric.h"
-#include "hidreportroot.h"
-#include "hidparser.h"
-#include "hiddriveritem.h"
-#include "hidconnectioninfo.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CGenericHid* CGenericHid::NewLC(MTransportLayer* aTransportLayer)
- {
- TRACE_INFO((_L("[HID]\tCGenericHid::NewLC(0x%08x)"), aTransportLayer));
- CGenericHid* self = new (ELeave) CGenericHid(aTransportLayer);
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CGenericHid* CGenericHid::NewL(MTransportLayer* aTransportLayer)
- {
- TRACE_INFO((_L("[HID]\tCGenericHid::NewL(0x%08x)"), aTransportLayer));
- CGenericHid* self = NewLC(aTransportLayer);
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::ConstructL()
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::ConstructL()"));
- TRACE_INFO(_L("[HID]\tCGenericHid::ConstructL(): Creating Parser..."));
- iParser = CParser::NewL();
- iInputHandlingReg = CHidInputDataHandlingReg::NewL();
- }
-
-// ---------------------------------------------------------------------------
-// CGenericHid()
-// ---------------------------------------------------------------------------
-//
-CGenericHid::CGenericHid(MTransportLayer* aTransportLayer) :
- iDriverList(_FOFF(CDriverListItem, iSlink)),
- iTransportLayer(aTransportLayer)
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CGenericHid::~CGenericHid()
- {
- TRACE_FUNC_ENTRY
- RemoveDrivers();
- iConnectionInfo.ResetAndDestroy();
- iConnectionInfo.Close();
- delete iInputHandlingReg;
- delete iParser;
- REComSession::FinalClose();
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// CountryCodeL
-// ---------------------------------------------------------------------------
-//
-TUint CGenericHid::CountryCodeL(TInt aConnID)
- {
- // Pass the request through to the transport layer.
- return (iTransportLayer->CountryCodeL(aConnID));
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// VendorIdL
-// ---------------------------------------------------------------------------
-//
-TUint CGenericHid::VendorIdL(TInt aConnID)
- {
- // Pass the request through to the transport layer.
- return (iTransportLayer->VendorIdL(aConnID));
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// ProductIdL()
-// ---------------------------------------------------------------------------
-//
-TUint CGenericHid::ProductIdL(TInt aConnID)
- {
- // Pass the request through to the transport layer.
- return iTransportLayer->ProductIdL(aConnID);
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// SetProtocol
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::SetProtocolL(TInt aConnectionId, TUint16 aInterface,
- MDriverAccess::TProtocols aProtocol,
- CHidDriver* aDriver)
- {
- iTransportLayer->SetProtocolL(aConnectionId, static_cast<TUint16>(aProtocol),
- aInterface);
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- conninfo->SetLastCommandHandler(aDriver);
- }
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// GetProtocol
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::GetProtocolL(TInt aConnectionId,TUint16 aInterface)
- {
- iTransportLayer->GetProtocolL(aConnectionId, aInterface);
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// GetReport
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::GetReportL(TInt aConnectionId,
- TUint8 aReportId, TUint16 aInterface, TUint16 aLength)
- {
- iTransportLayer->GetReportL(aConnectionId, MDriverAccess::EInput, aReportId,
- aInterface, aLength);
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// SetReport()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::SetReportL(TInt aConnectionId, TUint8 aReportId,
- MDriverAccess::TReportType aReportType, const TDesC8& aPayload,
- TUint16 aInterface, CHidDriver* aDriver)
- {
- iTransportLayer->SetReportL(aConnectionId, static_cast<TUint8>(aReportType),
- aReportId, aInterface, aPayload);
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- conninfo->SetLastCommandHandler(aDriver);
- }
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// DataOut()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::DataOutL(TInt aConnectionId, TUint8 aReportId,
- const TDesC8& aPayload,
- TUint16 aInterface)
- {
- iTransportLayer->DataOutL(aConnectionId, aReportId, aInterface, aPayload);
- }
-
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// GetIdle()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::GetIdleL(TInt aConnectionId, TUint8 aReportId,
- TUint16 aInterface )
- {
- iTransportLayer->GetIdleL(aConnectionId, aReportId, aInterface);
- }
-
-// ---------------------------------------------------------------------------
-// From MDriverAccess
-// SetIdle()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::SetIdleL(TInt aConnectionId, TUint8 aDuration,
- TUint8 aReportId, TUint16 aInterface, CHidDriver* aDriver)
- {
- iTransportLayer->SetIdleL(aConnectionId, aDuration, aReportId, aInterface);
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- conninfo->SetLastCommandHandler(aDriver);
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// RemoveDrivers()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::RemoveDrivers()
- {
- TRACE_FUNC
- // Driver instances
- CDriverListItem* driverItem;
- while ( !iDriverList.IsEmpty() )
- {
- driverItem = iDriverList.Last();
- iDriverList.Remove( *driverItem );
- delete driverItem;
- }
- }
-
-// ---------------------------------------------------------------------------
-// From CHidTransport
-// Disconnected()
-// ---------------------------------------------------------------------------
-//
-TInt CGenericHid::Disconnected( TInt aConnectionId )
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrNone;
-
- TSglQueIter<CDriverListItem> driverIter( iDriverList );
- driverIter.SetToFirst();
-
- CDriverListItem* driverItem = driverIter;
- while ( driverItem )
- {
- driverIter++;
- if ( driverItem->ConnectionId() == aConnectionId )
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::Disconnected driver"));
- if (driverItem->Driver())
- {
- driverItem->Driver()->Disconnected(0);
- }
- // Remove it from the list of driver instances
-
- iDriverList.Remove(*driverItem);
- delete driverItem;
- driverItem = NULL;
- retVal = KErrNone;
- }
- driverItem = driverIter;
-
- TRACE_INFO(_L("[HID]\tCGenericHid::Disconnected next driver"));
- }
- TRACE_INFO(_L("[HID]\tCGenericHid::Disconnected remove connection info"));
- TInt count = iConnectionInfo.Count();
- for (TInt i = count-1 ; i>=0; i--)
- {
- TRACE_INFO((_L("[HID]\tCGenericHid::Disconnected remove connection info %d"),i));
- CConnectionInfo* conninfo = iConnectionInfo[i];
- TRACE_INFO((_L("[HID]\tCGenericHid::Disconnected remove connection info %d"),i));
- if ( conninfo->ConnectionID() == aConnectionId )
- {
- iConnectionInfo.Remove(i);
- delete conninfo;
- TRACE_INFO((_L("[HID]\tCGenericHid::Disconnected remove connection info %d removed"),i));
- }
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From CHidTransport
-// ConnectedL
-// HID device has been connected. Attempt to find a driver that can
-// handle reports in the format specified by the report descriptor.
-// ---------------------------------------------------------------------------
-//
-TInt CGenericHid::ConnectedL( TInt aConnectionId, const TDesC8& aDescriptor )
- {
- TRACE_INFO((_L("[HID]\tCGenericHid::ConnectedL(%d, ...)"), aConnectionId))
-
- // Place the parsed report descriptor in the driver list item:
-
- TBool found = EFalse;
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- return KErrInUse;
- }
-
- CReportRoot* reportRoot = iParser->ParseL( aDescriptor );
- CleanupStack::PushL(reportRoot);
-
- TRACE_INFO(_L("[HID]\tCGenericHid::ConnectedL: evaluate driver array"));
- // Implementation info array
- RImplInfoPtrArray implInfoArray;
- REComSession::ListImplementationsL( KHidDriverPluginInterfaceUid, implInfoArray );
- CleanupClosePushL(implInfoArray);
-
- TRACE_INFO((_L("[HID]\tCGenericHid::ConnectedL: %d implementations found"), implInfoArray.Count()));
- TInt index = 0;
- TInt retVal = KErrHidNoDriver;
- TInt supportedfields = 0;
- CHidDriver* driver = NULL;
- for ( index = 0; index < implInfoArray.Count(); index++ )
- {
- // parse implementation UID
- CImplementationInformation* info = implInfoArray[ index ];
- TUid implUid = info->ImplementationUid();
- TRACE_INFO((_L("[HID]\tCGenericHid::ConnectedL: load plugin 0x%08x"),implUid ));
- // load driver
- // Trap so other drivers will be enumerated even if
- // this fails:
-
- TRAPD(retTrap, driver = CHidDriver::NewL( implUid, this ));
- if ( retTrap != KErrNone)
- {
- continue;
- }
- CleanupStack::PushL(driver);
- TRACE_INFO((_L("[HID]\tCGenericHid::ConnectedL: init plugin 0x%08x"),implUid ));
- driver->InitialiseL( aConnectionId );
- TInt ret = driver->CanHandleReportL( reportRoot );
- if (ret == KErrNone)
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::ConnectedL(): found driver"));
-
- // Make a new driver list item:
- CDriverListItem* driverItem = new ( ELeave ) CDriverListItem( aConnectionId );
- CleanupStack::PushL( driverItem );
- driver->SetInputHandlingReg( iInputHandlingReg );
- supportedfields += driver->SupportedFieldCount();
- iDriverList.AddLast( *driverItem );
- CleanupStack::Pop( driverItem );
- driverItem->SetDriver( driver );
- CleanupStack::Pop( driver );
- retVal = KErrNone;
- found = ETrue;
- }
- else
- {
- CleanupStack::PopAndDestroy( driver );
- }
- }
- TRACE_INFO((_L("[HID]\tCGenericHid::ConnectedL Partial supported hid device supported %d in report %d&"),supportedfields,iParser->FieldCount()));
- if (supportedfields < iParser->FieldCount() && found )
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::ConnectedL Partial supported hid device"));
- }
- implInfoArray.ResetAndDestroy();
- CleanupStack::PopAndDestroy(); // info
- if ( found )
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::ConnectedL append connection info"));
- conninfo = CConnectionInfo::NewL(aConnectionId, reportRoot);
- CleanupStack::Pop(reportRoot); // ownership transfered to conninfo
- CleanupStack::PushL(conninfo);
- iConnectionInfo.AppendL(conninfo);
- CleanupStack::Pop(conninfo);
- }
- else
- {
- CleanupStack::PopAndDestroy(reportRoot);
- }
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From CHidTransport
-// DataIn
-// Determine which driver is handling this connection ID and pass the payload
-// reference to it
-// ---------------------------------------------------------------------------
-//
-TInt CGenericHid::DataIn(TInt aConnectionId,
- CHidTransport::THidChannelType aChannel, const TDesC8& aPayload)
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrHidNoDriver;
- TInt ret = KErrNone;
-
- TSglQueIter<CDriverListItem> driverIter( iDriverList );
- driverIter.SetToFirst();
-
- CDriverListItem* item = driverIter;
- TBool found = EFalse;
- while ( item )
- {
- if ( item->ConnectionId() == aConnectionId )
- {
- ret = item->Driver()->DataIn( aChannel, aPayload );
- if (ret == KErrNone)
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::DataIn command handled"));
- found = ETrue;
- retVal = KErrNone;
- }
- }
- TRACE_INFO(_L("[HID]\tCGenericHid::DataIn next driver"));
- driverIter++;
- item = driverIter;
- }
- if ( !found && aChannel == CHidTransport::EHidChannelCtrl )
- {
- retVal = KErrNone;
- }
- iInputHandlingReg->Reset();
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-
-// ---------------------------------------------------------------------------
-// ReportDescriptor
-// Provides access to the parsed results to the factory
-// ---------------------------------------------------------------------------
-//
-CReportRoot* CGenericHid::ReportDescriptor(TInt aConnectionId)
- {
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- return conninfo->ReportRoot();
- }
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// From CHidTransport
-// DriverActive()
-// ---------------------------------------------------------------------------
-//
-TInt CGenericHid::DriverActive(TInt aConnectionId,
- CHidTransport::TDriverState aActive)
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrHidNoDriver;
- // Find the driver handling the connection and stop it
- TSglQueIter<CDriverListItem> driverIter( iDriverList );
- driverIter.SetToFirst();
- CDriverListItem* item = driverIter;
-
- while ( item )
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::DriverActive"));
- if ( item->ConnectionId() == aConnectionId && item->Driver() )
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::DriverActive driver found"));
- if ( aActive == CHidTransport::EActive )
- {
- TRAP(retVal, item->Driver()->StartL( aConnectionId ));
- if (retVal != KErrNone)
- {
- break;
- }
- }
- else if ( aActive == CHidTransport::ESuspend)
- {
- item->Driver()->Stop();
- retVal = KErrNone;
- }
- }
- driverIter++;
- item = driverIter;
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CommandResult()
-// ---------------------------------------------------------------------------
-//
-void CGenericHid::CommandResult(TInt aConnectionId, TInt aCmdAck)
- {
- // Get the driver handling this connection
- CConnectionInfo* conninfo = SeekConnectionInfo( aConnectionId );
- if ( conninfo )
- {
- CHidDriver* hiddriver = conninfo->ReturnLastCommandHandler();
- if (hiddriver)
- {
- hiddriver->CommandResult(aCmdAck);
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// SeekConnectionInfo()
-// ---------------------------------------------------------------------------
-//
-CConnectionInfo* CGenericHid::SeekConnectionInfo(TInt aConnectionId)
- {
- TRACE_FUNC
- CConnectionInfo* conninfo = NULL;
- TInt count = iConnectionInfo.Count();
- TRACE_INFO((_L("[HID]\tCGenericHid::SeekConnectionInfo count %d"), count));
- for (TInt i = 0 ; i < count; i++)
- {
- conninfo = iConnectionInfo[i];
- TRACE_INFO((_L("[HID]\tCGenericHid::SeekConnectionInfo connection info check %d %d"),aConnectionId, conninfo->ConnectionID()));
- if ( conninfo->ConnectionID() == aConnectionId)
- {
- TRACE_INFO(_L("[HID]\tCGenericHid::SeekConnectionInfo connection info found"));
- return conninfo;
- }
- }
- return NULL;
- }
--- a/localconnectivityservice/generichid/src/hidinterfaces.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
-* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid interface implementation
-*
-*/
-
-
-#include <hidinterfaces.h>
-
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CHidDriver::CHidDriver()
- {
- }
-
-// -----------------------------------------------------------------------------
-// Desturctor
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CHidDriver::~CHidDriver()
- {
- REComSession::DestroyedImplementation( iDtor_ID_Key );
- }
-
-// -----------------------------------------------------------------------------
-// NewL()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CHidDriver* CHidDriver::NewL(
- TUid aImplementationUid,
- MDriverAccess* aHid )
- {
- TAny* ptr;
- TInt32 keyOffset = _FOFF( CHidDriver, iDtor_ID_Key );
- ptr = REComSession::CreateImplementationL(
- aImplementationUid,
- keyOffset,
- aHid
- );
- return reinterpret_cast<CHidDriver*> (ptr);
- }
-
-
-// -----------------------------------------------------------------------------
-// NewL()
-// -----------------------------------------------------------------------------
-//
-CHidInputDataHandlingReg* CHidInputDataHandlingReg::NewL()
- {
- CHidInputDataHandlingReg* self = new (ELeave) CHidInputDataHandlingReg();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
-
- }
-
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-CHidInputDataHandlingReg::CHidInputDataHandlingReg()
- {
- }
-
-// -----------------------------------------------------------------------------
-// Constructor
-// -----------------------------------------------------------------------------
-//
-void CHidInputDataHandlingReg::ConstructL()
- {
- iEventArray = new ( ELeave ) CArrayFixFlat<THidEvent>( 2 );
- }
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-//
-CHidInputDataHandlingReg::~CHidInputDataHandlingReg()
- {
- Reset();
- delete iEventArray;
- }
-
-// -----------------------------------------------------------------------------
-// AddHandledEvent
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CHidInputDataHandlingReg::AddHandledEvent( TInt aUsagePage, TInt aUsage )
- {
- THidEvent event;
- event.iUsagePage = aUsagePage;
- event.iKeyCode = aUsage;
- TRAP_IGNORE(iEventArray->AppendL( event ));
- }
-
-// -----------------------------------------------------------------------------
-// AllowedToHandleEvent
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TBool CHidInputDataHandlingReg::AllowedToHandleEvent(TInt aUsagePage, TInt aUsage)
- {
- TInt i;
- for (i = 0; i< iEventArray->Count() ;i++)
- {
- if ( iEventArray->At(i).iUsagePage == aUsagePage && iEventArray->At(i).iKeyCode == aUsage )
- {
- return EFalse;
- }
- }
- return ETrue;
- }
-
-// -----------------------------------------------------------------------------
-// Reset
-// -----------------------------------------------------------------------------
-//
-void CHidInputDataHandlingReg::Reset()
- {
- iEventArray->Reset();
- }
-
-
--- a/localconnectivityservice/generichid/src/hiditem.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Item implementation
-*
-*/
-
-
-// References:
-//
-// [1] USB Device Class Definition for Human Interface Devices (HID),
-// Firmware Specification, Version 1.11, USB Implementers' Forum,
-// June 2001
-//
-// ----------------------------------------------------------------------
-
-#include <e32std.h>
-
-#include "hiditem.h"
-#include "hidparser.h"
-
-const TInt KSizeMask = 0x03;
-const TInt KTypeMask = 0x03;
-const TInt KTypePosn = 2;
-const TInt KTagMask = 0x0F;
-const TInt KTagPosn = 4;
-const TInt KLongItemId = 0xfe;
-const TInt KMaxItemlength = 4;
-const TInt KSizeThree = 3;
-const TInt KSizeFour = 4;
-const TInt KLongItemMin = 3;
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-TItem::TItem(const TDesC8& aRawData)
- : iRawData(aRawData)
- {
- if (aRawData.Length() < 1)
- {
- return;
- }
- TBool isShortItem = (aRawData[0] != KLongItemId);
-
- if (isShortItem)
- {
- // +----+----+----+----+----+----+----+----+
- // | Tag | Type | Size | [data...]
- // | . . . | . | . |
- // +----+----+----+----+----+----+----+----+
- // 7 6 5 4 3 2 1 0
- //
- // A short item is followed by 0, 1, 2 or 4 bytes of data, as
- // specified in the size field. See [1], Section 6.2.2.2.
- iSize = aRawData[0] & KSizeMask;
- if (iSize == KSizeThree)
- {
- iSize = KSizeFour;
- }
- iType = static_cast<TItemType>((aRawData[0] >> KTypePosn) & KTypeMask);
- iTag = (aRawData[0] >> KTagPosn) & KTagMask;
- iDataOffset = 1;
- }
- else
- {
- // Byte 0 Byte 1 Byte 2
- // +------+------+------+ +-----------+ +-----------+
- // | Tag | Type | Size | | Data size | | Long item | [data...]
- // | 1111 | 11 | 10 | | (0-255) | | tag |
- // +------+------+------+ +-----------+ +-----------+
- // 7654 32 10
- //
- // A long item is followed by 0-255 bytes of data, as specified
- // in the data size byte. See [1], Section 6.2.2.3.
-
- iType = EReserved;
-
- if (aRawData.Length() > KLongItemMin)
- {
- iSize = aRawData[1];
- iTag = aRawData[2];
- iDataOffset = KLongItemMin;
- }
- else
- {
- iSize = 0;
- iTag = 0;
- iDataOffset = 0;
- }
- }
-
-#ifdef DBG_ACTIVE
- for (TInt i=0; (i<aRawData.Length()) && (i<(iSize+iDataOffset)); ++i)
- {
- RDebug::Print(_L("aRawData[%d] = 0x%02x"), i, aRawData[i]);
- }
-#endif
- }
-
-// ---------------------------------------------------------------------------
-// DataSize()
-// ---------------------------------------------------------------------------
-//
-TInt TItem::DataSize() const
- {
- return iSize;
- }
-
-// ---------------------------------------------------------------------------
-// Tag()
-// ---------------------------------------------------------------------------
-//
-TInt TItem::Tag() const
- {
- return iTag;
- }
-
-// ---------------------------------------------------------------------------
-// Data()
-// ---------------------------------------------------------------------------
-//
-TUint32 TItem::Data() const
- {
- TInt size = DataSize();
-
- // Calling Data() makes no sense for long items that have a data
- // size over 4 bytes, as it only returns a TUint32:
- //
- if (size > KMaxItemlength)
- {
- size = KMaxItemlength;
- }
-
- // Ensure we don't overrun the source buffer:
- //
- if (size > (iRawData.Length() - 1))
- {
- size = iRawData.Length() - 1;
- }
-
- // Concatenate each byte into a TUint32. Note that this function must
- // return zero if the data size is zero (see Parser.cpp, MainItemL()).
- //
- TUint32 tagData = 0;
- for (TInt i=0; i<size; ++i)
- {
- tagData |= (iRawData[1 + i] << (KSizeOfByte*i));
- }
-
- return tagData;
- }
-
-// ---------------------------------------------------------------------------
-// SignedData()
-// ---------------------------------------------------------------------------
-//
-TInt32 TItem::SignedData() const
- {
- TUint32 data = Data();
-
- // For 8 and 16 bit negative values, we need to
- // sign extend to 32-bits:
- //
- if ((DataSize() == 1) && (data & 0x80))
- {
- data |= 0xffffff00;
- }
- if ((DataSize() == 2) && (data & 0x8000))
- {
- data |= 0xffff0000;
- }
-
- // Note that this assumes that the machine uses 2s complement
- // representation internally. All current Symbian devices do,
- // including ARM devices and the WINS emulator. This is almost
- // certain to remain the case in the future.
- //
- return static_cast<TInt32>(data);
- }
-
-// ---------------------------------------------------------------------------
-// Operator []
-// ---------------------------------------------------------------------------
-//
-TUint8 TItem::operator[](TInt aIndex) const
- {
-
- TUint8 value = 0;
- if ((aIndex >= 0) && (aIndex < iSize))
- {
- value = iRawData[iDataOffset + aIndex];
- }
- return value;
- }
-
-// ---------------------------------------------------------------------------
-// Type()
-// ---------------------------------------------------------------------------
-//
-TItem::TItemType TItem::Type() const
- {
- return iType;
- }
-
-// ---------------------------------------------------------------------------
-// IsMain()
-// ---------------------------------------------------------------------------
-//
-TBool TItem::IsMain() const
- {
- return iType == TItem::EMain;
- }
-
-// ---------------------------------------------------------------------------
-// IsLocal()
-// ---------------------------------------------------------------------------
-//
-TBool TItem::IsLocal() const
- {
- return iType == TItem::ELocal;
- }
-
-// ---------------------------------------------------------------------------
-// IsGlobal()
-// ---------------------------------------------------------------------------
-//
-TBool TItem::IsGlobal() const
- {
- return iType == TItem::EGlobal;
- }
-
-// ---------------------------------------------------------------------------
-// IsLong()
-// ---------------------------------------------------------------------------
-//
-TBool TItem::IsLong() const
- {
- return iType == TItem::EReserved;
- }
-
-// ---------------------------------------------------------------------------
-// ItemSize()
-// ---------------------------------------------------------------------------
-//
-TInt TItem::ItemSize() const
- {
- return iSize + iDataOffset;
- }
-
--- a/localconnectivityservice/generichid/src/hidparser.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1941 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID parser implementation
-*
-*/
-
-
-// ----------------------------------------------------------------------
-
-// References:
-//
-// [1] USB Device Class Definition for Human Interface Devices (HID),
-// Firmware Specification, Version 1.11, USB Implementers' Forum,
-// June 2001
-//
-// [2] HID Parser Error Codes (HID Parser Error Checking), Revision
-// 1.2, USB Implementers' Forum, February 2000
-//
-// [3] USB HID Usage Tables, Version 1.11, USB Implementers' Forum,
-// June 2001
-//
-// ----------------------------------------------------------------------
-
-#include <e32std.h>
-#include <e32base.h>
-#include <e32des8.h>
-#include <e32svr.h>
-
-#include "hidreportroot.h"
-#include "hiditem.h"
-#include "hidparser.h"
-#include "debug.h"
-
-
-
-
-// ----------------------------------------------------------------------
-/*
-// Define PARSER_DEBUG to activate trace output for WINS debug builds:
-#undef PARSER_DEBUG
-
-#if defined(PARSER_DEBUG) && defined(_DEBUG) && defined(__WINS__)
-#define PDBG(a) a;
-#define PDBG_ACTIVE
-#else
-#define PDBG(a)
-#endif
-*/
-#define PDBG_ACTIVE
-
-const TUint32 CParser::KLocalItemMask =
- EUsageMin | EUsageMax | EUsageId |
- EDesignatorIndex | EDesignatorMin | EDesignatorMax |
- EStringIndex | EStringMin | EStringMax;
-
-
-const TUint32 KMaxStandardType = 0x06;
-const TUint32 KMinVendorType = 0x80;
-const TUint32 KMaxVendorType = 0xFF;
-const TUint32 KMaxUsagePage = 0xffff;
-const TUint32 KUnitData = 0x0f;
-
-const TUint32 CParser::KUnusedLocalItemsMask = KLocalItemMask & ~EUsageId;
-
-const TUint32 KInputReservedBitsMask = 0xffffff00;
-const TUint32 KOutputReservedBitsMask = 0xffffff00;
-const TUint32 KFeatureReservedBitsMask = 0xffffff00;
-const TUint32 KUnitReservedBitsMask = 0xf0000000;
-
-const TInt KConstantFlag = 1<<0; // Constant (1) or Data (0)
-const TInt KVariableFlag = 1<<1; // Array (0) or Variable (1)
-const TInt KNullStateFlag = 1<<6;
-
-const TInt KExtendedDataSize = 4; // 32-bit extended data size
-const TInt KExtendedDataShift = 16; // 16 bit shift if extended usage page is used
-const TInt KMaxReportIDMax = 255;
-const TInt K32Bit = 32;
-
-const TUint K32BitFirstBitOn = 1u<<31;
-const TInt KUnitSystemMin = 5;
-const TInt KUnitSystem15 = 15;
-
-const TUint32 CParser::KMandatoryItemMask = EUsagePage |
- ELogicalMin | ELogicalMax | EReportSize | EReportCount;
-
-const TUint32 CParser::KReportItemMask = EInputReport |
- EOutputReport | EFeatureReport;
-
-
-// Reserved values as per the HUT document 1.11, [3]:
-// This ranges are reserverd in future use.
-
-const TInt KReservedUsage = 0x0e;
-const TInt KReservedUsageRange1Min = 0x11;
-const TInt KReservedUsageRange1Max = 0x13;
-const TInt KReservedUsageRange2Min = 0x15;
-const TInt KReservedUsageRange2Max = 0x3f;
-const TInt KReservedUsageRange3Min = 0x41;
-const TInt KReservedUsageRange3Max = 0x7f;
-const TInt KReservedUsageRange4Min = 0x88;
-const TInt KReservedUsageRange4Max = 0x8b;
-const TInt KReservedUsageRange5Min = 0x92;
-const TInt KReservedUsageRange5Max = 0xfeff;
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLC()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CParser* CParser::NewLC()
- {
- CParser* self = new (ELeave) CParser;
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CParser* CParser::NewL()
- {
- CParser* self = NewLC();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CParser::ConstructL()
- {
- TRACE_FUNC_THIS
- iLocal = CField::NewL();
- }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CParser::CParser():
- iFieldCount(0)
- {
- TRACE_FUNC_THIS
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CParser:: ~CParser()
- {
- TRACE_FUNC_THIS
-
- // Free all RArray storage:
- iGlobalStack.Reset();
-
-
- // Although iCollectionStack is an RPointerArray, we aren't doing
- // a ResetAndDestroy() here, as all the collections are owned by
- // the report root object, iReportRoot:
- iCollectionStack.Reset();
-
- delete iReportRoot;
- delete iLocal;
- }
-
-// ---------------------------------------------------------------------------
-// CreateCollectionL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CreateCollectionL(TUint32 aType)
- {
- TInt err = CheckForCollectionErrors(aType);
-
- if (err == KErrNone)
- {
- CCollection* collection = Collection()->AddCollectionL(); // Created collection added
- // Collection's collection array
- collection->SetType(aType);
- collection->SetUsagePage(iGlobal.iUsagePage);
- collection->SetUsage(iLocal->LastUsage());
- PushCollectionL(collection);
- }
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// CheckForMainErrors()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckForMainErrors()
- {
- if ( ( iItemsDefined & ELogicalMin ) && ( iItemsDefined & ELogicalMax ) )
- {
- if ( iGlobal.iLogicalMin > iGlobal.iLogicalMax )
- {
- IssueWarning( ELogicalMinExceedsMax );
- }
- }
- if ( iItemsDefined & (EPhysicalMin | EPhysicalMax ) )
- {
- if ( !( iItemsDefined & EPhysicalMax ) )
- {
- return ELonelyPhysicalMin;
- }
- if (!( iItemsDefined & EPhysicalMin ))
- {
- return ELonelyPhysicalMax;
- }
-
- if ( iGlobal.iPhysicalMin > iGlobal.iPhysicalMax )
- {
- IssueWarning(EPhysicalMinExceedsMax);
- }
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CheckForCollectionErrors()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckForCollectionErrors(TUint32 aType)
- {
- if (iCollectionStack.Count() == 0 )
- {
- return ENoCollectionToCheck;
- }
-
- if (aType > KMaxStandardType)
- {
- if ((aType < KMinVendorType) || (aType > KMaxVendorType))
- {
- IssueWarning( ECollectionTypeUnknownReserved );
- }
- }
-
- if ( iItemsDefined & KUnusedLocalItemsMask )
- {
- IssueWarning( ECollectionLocalUnused );
- }
-
- TInt numUsages = iLocal->UsageCount();
-
- if ( numUsages > 1 )
- {
- // Only a single usage value can be associated with a collection:
- IssueWarning( ECollectionLocalUnused );
- }
-
- if ( numUsages == 0 )
- {
- // A usage tag must be associated with a collection (see [1],
- // Section 6.2.2.6):
- IssueWarning( ECollectionHasNoUsage );
- }
-
- if ( !( iItemsDefined & EUsagePage ) )
- {
- // A usage page must be associated with a collection (see [1],
- // Section 6.2.2.6):
- IssueWarning( ECollectionHasNoUsagePage );
- }
-
- if (( aType == CCollection::EApplication ) && ( iItemsDefined & EDelimiter ))
- {
- // Delimiters can't be used when defining usages that apply to
- // Application Collections ([1], Section 6.2.2.8):
- IssueWarning(EApplicationHasDelimiter);
-
- // It is an error to declare a delimiter for a top-level
- // application collection, [2]:
- if (iCollectionStack.Count() == 1)
- {
- return EDelimiterAtTopLevel;
- }
- }
- return CheckForMainErrors();
- }
-
-
-// ---------------------------------------------------------------------------
-// CheckForFieldErrors()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckForFieldErrors(CField::TType aType, TUint32 aAttributes)
- {
- TInt ret = KErrNone;
- ret = CheckMandatoryFieldErrors(aType, aAttributes);
- if ( ret != KErrNone )
- {
- return ret;
- }
-
- const TInt KLimitsError[] =
- { EInputMinExceedsMax, EOutputMinExceedsMax, EFeatureMinExceedsMax };
-
- if ( iGlobal.iLogicalMin > iGlobal.iLogicalMax )
- {
- return KLimitsError[aType];
- }
-
- if ( ( iItemsDefined & ( EPhysicalMin | EPhysicalMax ) )
- && ( iGlobal.iPhysicalMin > iGlobal.iPhysicalMax ))
- {
- return KLimitsError[aType];
- }
- CheckLogicalMinAndMax( aAttributes );
- CheckFieldBitNeeded( aType, aAttributes );
- return CheckForMainErrors();
- }
-
-
-// ---------------------------------------------------------------------------
-// BitsToRepresentRange()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::BitsToRepresentRange(TInt aMin, TInt aMax)
- {
- // The number of bits required to represent all values in the
- // range aMin to aMax inclusive. If the range is all positive
- // then there is no sign bit, otherwise twos complement format is
- // assumed. ([1], Section 6.2.2.7.)
-
- TInt bitsNeeded = 0;
-
- if (aMin != aMax)
- {
- TUint absVal = static_cast<TUint>(Max(Abs(aMin), Abs(aMax)));
-
- bitsNeeded = K32Bit - NumberOfLeadingZeros(absVal);
-
- // If either are negative, we'll need space for the sign bit:
- //
- if ((aMax < 0) || (aMin < 0))
- {
- bitsNeeded++;
-
- // However, 2s complement allows us to represent one extra
- // negative number than positive, and so our calculation
- // may be one bit over. Catch this with a special case:
- //
- if (bitsNeeded > 1)
- {
- TInt n = 1 << (bitsNeeded - 2);
- if ((aMin == -n) && (aMax < n))
- {
- bitsNeeded--;
- }
- }
- }
- }
-
- return bitsNeeded;
- }
-
-// ---------------------------------------------------------------------------
-// NumberOfLeadingZeros()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::NumberOfLeadingZeros(TUint32 aValue)
- {
- TInt count = 0;
-
- TUint32 pos = K32BitFirstBitOn;
- while ((pos != 0) && ((aValue & pos) == 0))
- {
- count++;
- pos >>= 1;
- }
-
- return count;
- }
-
-
-// ---------------------------------------------------------------------------
-// CheckAllReportSizes()
-// ---------------------------------------------------------------------------
-//
-TBool CParser::CheckAllReportSizes() const
- {
- // Final report sizes must be an integral number of bytes, [2]:
-
- TBool sizesOk = ETrue;
-
- for (TInt i=0; sizesOk && (i<iReportRoot->NumberOfReports()); ++i)
- {
- TInt bits = iReportRoot->ReportSize(i);
-
- if ((bits == 0) || ((bits % 8) != 0))
- {
- sizesOk = EFalse;
- }
- }
- return sizesOk;
- }
-
-
-// ---------------------------------------------------------------------------
-// CreateFieldL()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CreateFieldL(CField::TType aType, TUint32 aAttributes)
- {
- TInt err = CheckForFieldErrors( aType, aAttributes );
- //Microsoft Elite 2 keyboard HID bug fix
- if ( err == EInputMissingItems && iGlobal.iUsagePage == 0x07 )
- if ( iLocal->UsageMin( ) == 0xe0 && iLocal->UsageMax( ) == 0xe7 )
- {
- iGlobal.iLogicalMin = 0x0;
- iGlobal.iLogicalMax = 0x1;
- err = KErrNone;
- }
- else
- {
- iGlobal.iLogicalMin = 0x0;
- err = KErrNone;
- }
-
- if (err == KErrNone)
- {
- // Create a new field object:
- CField* field = Collection()->AddFieldL( ); // Created field added
- // to collection's field array
- DumpStateTableL( field );
- field->SetType( aType );
- field->SetAttributes( aAttributes );
-
- // Set the field offset to the current report size, and
- // increase the report size by the size of this field:
- if ( !iReportRoot )
- {
- User::Leave(ENoReportRoot);
- }
- field->SetOffset( iReportRoot->ReportSize( field->ReportId( ), aType) );
- iReportRoot->IncrementReportSizeL( field->ReportId(),
- aType, field->Count() * field->Size() );
- TRACE_INFO(_L("CParser::CreateFieldL Field added"));
- if ( field->UsageCount() )
- {
- iFieldCount++;
- }
- }
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// DumpStateTableL()
-// ---------------------------------------------------------------------------
-//
-void CParser::DumpStateTableL(CField *aField) const
- {
- TRACE_INFO((_L("DumpStateTableL(0x%08x)\n"), aField));
-
- // Copy global state:
- //
- iGlobal.Populate(aField);
-
- // Copy local state:
- //
- aField->SetUsageRange( iLocal->UsageMin(), iLocal->UsageMax() );
- aField->SetDesignatorIndex( iLocal->DesignatorIndex() );
- aField->SetDesignatorRange( iLocal->DesignatorMin(),
- iLocal->DesignatorMax() );
- aField->SetStringIndex( iLocal->StringIndex() );
- aField->SetStringRange( iLocal->StringMin(), iLocal->StringMax() );
-
- // Copy usage list (local state) and calculate the usage range, if
- // it hasn't already been explicitly specified:
- //
- if ( iLocal->UsageCount() > 0 )
- {
- TInt minUsage, maxUsage;
- minUsage = maxUsage = iLocal->Usage( 0 );
-
- for (TInt i=0; i<iLocal->UsageCount(); ++i)
- {
- TInt value = iLocal->Usage( i );
- aField->AddUsageL( value );
- if ( value < minUsage )
- {
- minUsage = value;
- }
- if ( value > maxUsage )
- {
- maxUsage = value;
- }
- }
- if ( (iItemsDefined & (EUsageMin | EUsageMax) ) == 0)
- {
- aField->SetUsageRange( minUsage, maxUsage );
- }
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Collection()
-// ---------------------------------------------------------------------------
-//
-CCollection* CParser::Collection()
- {
- CCollection* lastcollection = NULL;
- if ( iCollectionStack.Count( ) > 0 )
- {
- lastcollection = iCollectionStack[ iCollectionStack.Count() - 1 ];
- }
- return lastcollection;
- }
-
-// ---------------------------------------------------------------------------
-// PushCollectionL()
-// ---------------------------------------------------------------------------
-//
-void CParser::PushCollectionL(const CCollection* aCollection)
- {
- User::LeaveIfError( iCollectionStack.Append( aCollection ) );
- }
-
-// ---------------------------------------------------------------------------
-// PopCollection()
-// ---------------------------------------------------------------------------
-//
-void CParser::PopCollection()
- {
-
- if ( iCollectionStack.Count() > 0 )
- {
- iCollectionStack.Remove( iCollectionStack.Count() - 1 );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// IssueWarning()
-// ---------------------------------------------------------------------------
-//
-void CParser::IssueWarning(TInt aHidWarningCode)
- {
- TRACE_ERROR((_L("Item %3d: Warning 0x%04x\n"), iItemNumber, aHidWarningCode));
- (void)aHidWarningCode;
- }
-
-// ---------------------------------------------------------------------------
-// ParseL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CReportRoot* CParser::ParseL(const TDesC8& aRawData)
- {
- ResetParserL();
- // Now we can parse the descriptor data:
- const TInt length = aRawData.Length();
- TInt posn = 0;
- TRACE_INFO((_L("CParser::ParseL() Start parsing length %d"), length));
- while ((posn < length) && (iErrorCode == 0))
- {
- iItemNumber++;
- TRACE_INFO((_L("posn is %d"), posn));
-
- TItem item(aRawData.Right(length-posn));
-
-#ifdef PDBG_ACTIVE
- TRACE_INFO((_L("Item: size %d, tag %d, type %d\n"),
- item.DataSize(), item.Tag(), item.Type()));
- for (TInt i=0; i<item.DataSize(); ++i)
- {
- TRACE_INFO((_L(" Data[%d] = 0x%02x (%d)\n"),
- i, item[i], item[i]))
- }
-#endif
-
- HandleItemL( item );
- posn += item.ItemSize();
- if (posn > length)
- {
- iErrorCode = EInvalidItemLength;
- }
- }
-
- PopCollection();
-
- // PUSH without POP:
- CheckParseErrors();
-
- iGlobalStack.Reset();
- iCollectionStack.Reset();
-
- TRACE_INFO((_L("CParser::ParseL() error code is %d"), iErrorCode));
- // Finished, transfer ownership to caller:
- CReportRoot* reportRoot = iReportRoot;
- iReportRoot = 0;
- return reportRoot;
- }
-
-// ---------------------------------------------------------------------------
-// CParser::FieldCount()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::FieldCount()
- {
- return iFieldCount;
- }
-
-// ---------------------------------------------------------------------------
-// CParser::MainItemL()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::MainItemL(const TItem& aItem)
- {
- TInt retVal = 0;
-
- switch (aItem.Tag())
- {
- case EMainInput:
- retVal = HandleMainInputTagL( aItem );
- break;
-
- case EMainOutput:
- retVal = HandleMainOutputTagL( aItem );
- break;
-
- case EMainFeature:
- retVal = HandleMainFeatureL( aItem );
- break;
-
- case EMainCollection:
- retVal = HandleMainCollectionL( aItem );
- break;
-
- case EMainEndCollection:
- retVal = HandleMainEndCollection( aItem );
- break;
- default:
- TRACE_ERROR(_L("Error: unknown main item\n"));
- retVal = EUnknownItem;
- break;
- }
-
- // All main items cause local state to be cleared:
- ClearLocalState();
-
- // For checking if global items declared more than once between
- // main items:
- iGlobalItemsDefined = 0;
-
- return retVal;
- }
-// ---------------------------------------------------------------------------
-// ClearLocalState()
-// ---------------------------------------------------------------------------
-//
-void CParser::ClearLocalState()
- {
- iLocal->ClearUsageList();
- iLocal->SetUsageRange(0, 0);
- iLocal->SetStringIndex(0);
- iLocal->SetStringRange(0, 0);
- iLocal->SetDesignatorIndex(0);
- iLocal->SetDesignatorRange(0, 0);
-
- iItemsDefined &= ~(KLocalItemMask | EDelimiter);
- iLocalMultipleUse = EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// GlobalItemL()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::GlobalItemL(const TItem& aItem)
- {
- TInt retVal = 0;
- switch (aItem.Tag())
- {
- case EGlobalReportId:
- retVal = HandleGlobalReportId( aItem );
- break;
- case EGlobalUsagePage:
- retVal = HandleGlobalUsagePage( aItem );
- break;
- case EGlobalLogicalMinimum:
- retVal = HandleGlobalLogicalMinimum( aItem );
- break;
- case EGlobalLogicalMaximum:
- retVal = HandleGlobalLogicalMaximum( aItem );
- break;
- case EGlobalPhysicalMinimum:
- retVal = HandleGlobalPhysicalMinimum( aItem );
- break;
- case EGlobalPhysicalMaximum:
- retVal = HandleGlobalPhysicalMaximum( aItem );
- break;
- case EGlobalUnit:
- retVal = HandleGlobalUnit( aItem );
- break;
- case EGlobalUnitExponent:
- retVal = HandleGlobalUnitExponent( aItem );
- break;
- case EGlobalReportSize:
- retVal = HandleGlobalReportSize( aItem );
- break;
- case EGlobalReportCount:
- retVal = HandleGlobalReportCount(aItem );
- break;
- case EGlobalPush:
- retVal = HandleGlobalPushL( aItem );
- break;
- case EGlobalPop:
- retVal = HandleGlobalPop( aItem );
- break;
- default:
- TRACE_ERROR(_L("Error: unknown global item\n"));
- retVal = EUnknownItem;
- break;
- }
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// LocalItemL()
-// ---------------------------------------------------------------------------
-//
-TInt CParser::LocalItemL(const TItem& aItem)
- {
- TInt retVal = 0;
- switch (aItem.Tag())
- {
- case ELocalUsage:
- retVal = HandleLocalUsageL( aItem );
- break;
- case ELocalUsageMinimum:
- retVal = HandleLocalUsageMinimum( aItem );
- break;
- case ELocalUsageMaximum:
- retVal = HandleLocalUsageMaximum( aItem );
- break;
- case ELocalDesignatorIndex:
- retVal = HandleLocalDesignatorIndex( aItem );
- break;
- case ELocalDesignatorMinimum:
- retVal = HandleLocalDesignatorMinimum( aItem );
- break;
- case ELocalDesignatorMaximum:
- retVal = HandleLocalDesignatorMaximum( aItem );
- break;
- case ELocalStringIndex:
- retVal = HandleLocalStringIndex( aItem );
- break;
- case ELocalStringMinimum:
- retVal = HandleLocalStringMinimum( aItem );
- break;
- case ELocalStringMaximum:
- retVal = HandleLocalStringMaximum( aItem );
- break;
- // "HID parsers must handle Delimiters however, the support
- // for the alternative usages that they define is optional.
- // Usages other than the first (most preferred) usage defined
- // may not be made accessible by system software.", [1],
- // Section 6.2.2.8.
- //
- // This parser only supports the first usage in a delimiter list.
- case ELocalDelimiter:
- retVal = HandleLocalDelimiter( aItem );
- break;
- default:
- TRACE_ERROR(_L("Error: unknown local item\n"));
- retVal = EUnknownItem;
- break;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// IsReservedUsagePage()
-// ---------------------------------------------------------------------------
-//
-TBool CParser::IsReservedUsagePage(TInt aId)
- {
- return (aId == KReservedUsage) ||
- ((aId >= KReservedUsageRange1Min ) && (aId <= KReservedUsageRange1Max)) ||
- ((aId >= KReservedUsageRange2Min ) && (aId <= KReservedUsageRange2Max)) ||
- ((aId >= KReservedUsageRange3Min) && (aId <= KReservedUsageRange3Max)) ||
- ((aId >= KReservedUsageRange4Min ) && (aId <= KReservedUsageRange4Max)) ||
- ((aId >= KReservedUsageRange5Min) && (aId <= KReservedUsageRange5Max));
- }
-
-// ---------------------------------------------------------------------------
-// Populate()
-// ---------------------------------------------------------------------------
-//
-void TParserGlobalState::Populate(CField *aField) const
- {
- aField->SetUsagePage(iUsagePage);
- aField->SetReportId(iReportId);
- aField->SetLogicalRange(iLogicalMin, iLogicalMax);
- aField->SetSize(iSize);
- aField->SetCount(iCount);
- aField->SetUnit(iUnit);
- aField->SetUnitExponent(iUnitExponent);
-
- // If the physical min and max are both zero, then the HID class
- // document specifies that they should be assumed to be equal to
- // the corresponding logical values ([1], Section 6.2.2.7):
- //
- if ((iPhysicalMin == 0) && (iPhysicalMax == 0))
- {
- aField->SetPhysicalRange(iLogicalMin, iLogicalMax);
- }
- else
- {
- aField->SetPhysicalRange(iPhysicalMin, iPhysicalMax);
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// TParserGlobalState()
-// ---------------------------------------------------------------------------
-//
-TParserGlobalState::TParserGlobalState()
- : iUsagePage(0), iLogicalMin(0), iLogicalMax(0),
- iPhysicalMin(0), iPhysicalMax(0), iUnit(0),
- iUnitExponent(0), iReportId(0), iSize(0), iCount(0)
- {
- // Nothing else to do
- }
-
-// ---------------------------------------------------------------------------
-// HandleMainInputTagL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleMainInputTagL(const TItem& aItem)
- {
- // Section 6.2.2.4 of the HID class specification, [1],
- // states that an Input item may have a data size of zero
- // bytes:
- //
- // "In this case the value of each data bit for the item
- // can be assumed to be zero. This is functionally
- // identical to using a item tag that specifies a 4-byte
- // data item followed by four zero bytes."
- //
- // For a data size of zero, TItem::Data() will return zero
- // and so we will get the required behaviour.
- TRACE_INFO((_L("Input %d\n"), aItem.Data()));
- TInt retVal=0;
-
- iItemsDefined |= EInputReport;
-
- if ( aItem.Data() & KInputReservedBitsMask )
- {
- IssueWarning( EInputReservedBitsNonZero );
- }
- if ( iLocalMultipleUse )
- {
- IssueWarning( EInputLocalMultipleUse );
- }
- if ( iWithinDelimiter )
- {
- retVal = EInputItemWithinDelimiter;
- }
- else
- {
- retVal = CreateFieldL( CField::EInput, aItem.Data() );
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleMainOutputTagL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleMainOutputTagL(const TItem& aItem)
- {
- TRACE_INFO((_L("Output %d\n"), aItem.Data()));
- TInt retVal=0;
- iItemsDefined |= EOutputReport;
-
- if ( aItem.Data() & KOutputReservedBitsMask )
- {
- IssueWarning( EOutputReservedBitsNonZero );
- }
-
- if ( iLocalMultipleUse )
- {
- IssueWarning( EOutputLocalMultipleUse );
- }
-
- if ( iWithinDelimiter )
- {
- retVal = EOutputItemWithinDelimiter;
- }
- else
- {
- retVal = CreateFieldL( CField::EOutput, aItem.Data() );
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleMainFeatureL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleMainFeatureL( const TItem& aItem )
- {
- TRACE_INFO((_L("Feature %d\n"), aItem.Data()));
- TInt retVal=0;
- iItemsDefined |= EFeatureReport;
-
- if ( aItem.Data() & KFeatureReservedBitsMask )
- {
- IssueWarning(EFeatureReservedBitsNonZero );
- }
-
- if ( iLocalMultipleUse )
- {
- IssueWarning( EFeatureLocalMultipleUse );
- }
-
- if ( iWithinDelimiter )
- {
- retVal = EFeatureItemWithinDelimiter;
- }
- else
- {
- retVal = CreateFieldL( CField::EFeature, aItem.Data() );
- }
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleMainCollectionL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleMainCollectionL( const TItem& aItem )
- {
- TRACE_INFO((_L("Start collection %d\n"), aItem.Data()));
- TInt retVal = 0;
-
- if ( iWithinDelimiter )
- {
- retVal = EBeginCollectionWithinDelimiter;
- }
- else
- {
- // Application collections can only be declared at
- // top-level:
- if ((aItem.Data() == CCollection::EApplication) &&
- (iCollectionStack.Count() != 1))
- {
- retVal = EApplicationCollectionLevel;
- }
- else
- {
- retVal = CreateCollectionL(aItem.Data());
- }
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleMainEndCollection
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleMainEndCollection( const TItem& aItem )
- {
- TRACE_INFO((_L("Start collection %d\n"), aItem.Data()));
- TInt retVal = 0;
-
- if (aItem.DataSize() != 0)
- {
- IssueWarning(EEndCollectionHasData);
- }
-
- if (iItemsDefined & KLocalItemMask)
- {
- IssueWarning(EEndCollectionLocalUnused);
- }
-
- if (iCollectionStack.Count() > 1)
- {
- PopCollection();
- }
- else
- {
- retVal = ENoMatchingBeginCollection;
- }
-
- if (iWithinDelimiter)
- {
- retVal = EEndCollectionWithinDelimiter;
- }
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalReportId
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalReportId( const TItem& aItem )
- {
- TRACE_INFO((_L("Global report ID %d\n"), aItem.Data()));
- TInt retVal = 0;
- TUint reportId = aItem.Data();
-
- if (reportId == 0)
- {
- retVal = EZeroReportId;
- }
- if (reportId > KMaxReportIDMax)
- {
- retVal = EReportIdTooBig;
- }
-
- // If there are to be any report IDs specified at all,
- // then a report ID must be defined before the first
- // input, output or feature report:
- //
- if ((iGlobal.iReportId == 0) && (iItemsDefined & KReportItemMask))
- {
- retVal = ELateReportId;
- }
-
- // Report ID defined outside a top level collection (Microsoft
- // restriction)
- //
- if (iCollectionStack.Count() == 1)
- {
- retVal = EReportIdOutsideTopLevel;
- }
-
- // Same item shouldn't have been declared since last main item:
- //
- if (iGlobalItemsDefined & EReportId)
- {
- // This is an error according to [2], but as it isn't
- // a critical problem, and as some real-world devices
- // fail this check, we issue a warning instead:
- IssueWarning(ERedundantGlobalItem);
- }
- iGlobalItemsDefined |= EReportId;
-
- iItemsDefined |= EReportId;
- iGlobal.iReportId = reportId;
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalUsagePage
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalUsagePage( const TItem& aItem )
- {
- TRACE_INFO((_L("Global usage page %d\n"), aItem.Data()));
- TInt retVal = 0;
-
- iGlobal.iUsagePage = aItem.Data();
-
- if (aItem.Data() == 0)
- {
- retVal = EZeroUsagePage;
- }
-
- if (aItem.Data() > KMaxUsagePage)
- {
- retVal = EUsagePageOutOfRange;
- }
-
- if (IsReservedUsagePage(aItem.Data()))
- {
- IssueWarning(EReservedUsagePage);
- }
-
- iItemsDefined |= EUsagePage;
-
- if (iGlobalItemsDefined & EUsagePage)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EUsagePage;
-
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalLogicalMinimum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalLogicalMinimum( const TItem& aItem )
- {
- TRACE_INFO((_L("Global logical min %d\n"), aItem.SignedData()));
- TInt retVal = 0;
- iGlobal.iLogicalMin = aItem.SignedData();
- iItemsDefined |= ELogicalMin;
-
- if (iGlobalItemsDefined & ELogicalMin)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= ELogicalMin;
-
- // "Until Physical Minimum and Physical Maximum are
- // declared in a report descriptor they are assumed by the
- // HID parser to be equal to Logical Minimum and Logical
- // Maximum, respectively.", [1], Section 6.2.2.7.
- //
- if (!(iItemsDefined & EPhysicalMin))
- {
- iGlobal.iPhysicalMin = aItem.SignedData();
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalLogicalMaximum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalLogicalMaximum( const TItem& aItem )
- {
- TRACE_INFO((_L("Global logical max %d\n"), aItem.SignedData()));
- TInt retVal = 0;
-
- iGlobal.iLogicalMax = aItem.SignedData();
- if ( !(iItemsDefined & EPhysicalMax) )
- {
- iGlobal.iPhysicalMax = aItem.SignedData();
- }
- iItemsDefined |= ELogicalMax;
-
- if (iGlobalItemsDefined & ELogicalMax)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= ELogicalMax;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalPhysicalMinimum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalPhysicalMinimum( const TItem& aItem )
- {
- TRACE_INFO((_L("Global physical min %d\n"), aItem.SignedData()));
- TInt retVal = 0;
- iGlobal.iPhysicalMin = aItem.SignedData();
- iItemsDefined |= EPhysicalMin;
-
- if (iGlobalItemsDefined & EPhysicalMin)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EPhysicalMin;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalPhysicalMaximum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalPhysicalMaximum( const TItem& aItem )
- {
- TRACE_INFO((_L("Global physical max %d\n"), aItem.SignedData()));
-
- TInt retVal = 0;
- iGlobal.iPhysicalMax = aItem.SignedData();
- iItemsDefined |= EPhysicalMax;
-
- if ( iGlobalItemsDefined & EPhysicalMax )
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EPhysicalMax;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalUnit
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalUnit( const TItem& aItem )
- {
- TRACE_INFO((_L("Global unit %d\n"), aItem.Data()));
- TInt retVal = 0;
- iGlobal.iUnit = aItem.Data();
- iItemsDefined |= EUnit;
-
- if (iGlobalItemsDefined & EUnit)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EUnit;
-
- TInt unitSystem = aItem.Data() & KUnitData;
- if (((unitSystem >= KUnitSystemMin ) && (unitSystem != KUnitSystem15)) ||
- (aItem.Data() & KUnitReservedBitsMask ))
- {
- IssueWarning(EUnitReservedBitsNonZero);
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalUnitExponent
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalUnitExponent( const TItem& aItem )
- {
- TRACE_INFO((_L("Global unit exponent %d\n"), aItem.Data()));
- TInt retVal = 0;
- iGlobal.iUnitExponent = aItem.Data();
- iItemsDefined |= EUnitExponent;
-
- if (iGlobalItemsDefined & EUnitExponent)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EUnitExponent;
- const TUint32 KReservedBits = ~0x0fUL;
- if (aItem.Data() & KReservedBits)
- {
- IssueWarning( EExponentReservedBitsNonZero );
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalReportSize
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalReportSize( const TItem& aItem )
- {
- TRACE_INFO((_L("Global report size %d\n"), aItem.Data()));
- TInt retVal = 0;
- iGlobal.iSize = aItem.Data();
- iItemsDefined |= EReportSize;
-
- if (iGlobalItemsDefined & EReportSize)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EReportSize;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalReportCount
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalReportCount( const TItem& aItem )
- {
- TRACE_INFO((_L("Global report count %d\n"), aItem.Data()));
- TInt retVal = 0;
- iGlobal.iCount = aItem.Data();
- if (aItem.Data() == 0)
- {
- retVal = EZeroReportCount;
- }
- iItemsDefined |= EReportCount;
-
- if (iGlobalItemsDefined & EReportCount)
- {
- retVal = ERedundantGlobalItem;
- }
- iGlobalItemsDefined |= EReportCount;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalPushL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalPushL( const TItem& aItem )
- {
- TRACE_INFO(_L("Global push\n"));
- TInt retVal = 0;
- if (aItem.DataSize() != 0)
- {
- retVal = EPushHasData;
- }
- User::LeaveIfError(iGlobalStack.Append(iGlobal));
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleGlobalPop
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleGlobalPop( const TItem& aItem )
- {
- TRACE_INFO(_L("Global pop\n"));
- TInt retVal = 0;
- if (aItem.DataSize() != 0)
- {
- retVal = EPopHasData;
- }
-
- if (iGlobalStack.Count() > 0)
- {
- iGlobal = iGlobalStack[iGlobalStack.Count()-1];
- iGlobalStack.Remove(iGlobalStack.Count()-1);
- }
- else
- {
- retVal = EPopWithoutPush;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalUsageL
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalUsageL( const TItem& aItem )
- {
- TRACE_INFO((_L("Local usage %d\n"), aItem.Data()));
- TInt retVal = 0;
-
- if (aItem.DataSize() == KExtendedDataSize )
- {
- // Extended (32-bit) usage:
- TInt usagePage = (aItem.Data() >> KExtendedDataShift);
- if (IsReservedUsagePage(usagePage))
- {
- IssueWarning(EReservedUsagePage);
- }
- }
-
- if ((aItem.Data() & 0xffff) == 0)
- {
- IssueWarning(EZeroUsage);
- }
-
- if (!iWithinDelimiter || (iAliasCount++ == 0))
- {
- iLocal->AddUsageL(aItem.Data());
- iItemsDefined |= EUsageId;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalUsageMinimum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalUsageMinimum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local usage min %d\n"), aItem.Data()));
- TInt retVal = 0;
- if (!iWithinDelimiter || (iAliasCountMin++ == 0))
- {
- TInt usagePage = iGlobal.iUsagePage;
-
- if (aItem.DataSize() == KExtendedDataSize )
- {
- // Extended usage specified.
- usagePage = aItem.Data() >> KExtendedDataShift;
- }
-
- if (iItemsDefined & EUsageMax)
- {
- TInt maxPage =
- static_cast<TUint32>(iLocal->UsageMax()) >> KExtendedDataShift;
- if (maxPage == 0)
- {
- maxPage = iGlobal.iUsagePage;
- }
- if (usagePage != maxPage)
- {
- retVal = EUsagePageMismatchMin;
- }
- }
- iLocal->SetUsageMin(aItem.Data());
- }
- if (iItemsDefined & EUsageMin)
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EUsageMin;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalUsageMaximum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalUsageMaximum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local usage max %d\n"), aItem.Data()));
-
- TInt retVal = 0;
-
- if (!iWithinDelimiter || (iAliasCountMax++ == 0))
- {
- TInt usagePage = iGlobal.iUsagePage;
-
- if (aItem.DataSize() == KExtendedDataSize )
- {
- // Extended usage specified.
- usagePage = aItem.Data() >> KExtendedDataShift;
- }
- if (iItemsDefined & EUsageMin)
- {
- TInt minPage =
- static_cast<TUint32>(iLocal->UsageMin()) >> KExtendedDataShift;
- if (minPage == 0)
- {
- minPage = iGlobal.iUsagePage;
- }
- if (usagePage != minPage)
- {
- retVal = EUsagePageMismatchMax;
- }
- }
- iLocal->SetUsageMax(aItem.Data());
- }
- if (iItemsDefined & EUsageMax)
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EUsageMax;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalDesignatorIndex
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalDesignatorIndex( const TItem& aItem )
- {
- TRACE_INFO((_L("Local designator index %d\n"),
- aItem.Data()));
- TInt retVal = 0;
- iLocal->SetDesignatorIndex(aItem.Data());
- if (iWithinDelimiter)
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- if (iItemsDefined & EDesignatorIndex)
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EDesignatorIndex;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalDesignatorMinimum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalDesignatorMinimum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local designator min %d\n"), aItem.Data()));
- TInt retVal = 0;
- iLocal->SetDesignatorMin(aItem.Data());
- if ( iWithinDelimiter )
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- if (iItemsDefined & EDesignatorMin)
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EDesignatorMin;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalDesignatorMaximum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalDesignatorMaximum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local designator max %d\n"), aItem.Data()));
- TInt retVal = 0;
- iLocal->SetDesignatorMax(aItem.Data());
- if ( iWithinDelimiter )
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- if ( iItemsDefined & EDesignatorMax )
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EDesignatorMax;
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalStringIndex
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalStringIndex( const TItem& aItem )
- {
- TRACE_INFO((_L("Local string index %d\n"), aItem.Data()));
- TInt retVal = 0;
- iLocal->SetStringIndex(aItem.Data());
- if ( iItemsDefined & EStringIndex )
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EStringIndex;
- if ( iWithinDelimiter )
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalStringMinimum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalStringMinimum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local string min %d\n"),
- aItem.Data()));
- TInt retVal = 0;
- iLocal->SetStringMin(aItem.Data());
- if ( iItemsDefined & EStringMin)
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EStringMin;
- if (iWithinDelimiter)
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalStringMaximum
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalStringMaximum( const TItem& aItem )
- {
- TRACE_INFO((_L("Local string max %d\n"),
- aItem.Data()));
- TInt retVal = 0;
- iLocal->SetStringMax(aItem.Data());
- if ( iItemsDefined & EStringMax )
- {
- iLocalMultipleUse = ETrue;
- }
- iItemsDefined |= EStringMax;
- if ( iWithinDelimiter )
- {
- retVal = EInvalidItemWithinDelimiter;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleLocalDelimiter
-// ---------------------------------------------------------------------------
-//
-TInt CParser::HandleLocalDelimiter( const TItem& aItem )
- {
- const TInt KBeginDelimiter = 1;
- const TInt KEndDelimiter = 0;
- TInt retVal = 0;
-
- switch ( aItem.Data() )
- {
- case KBeginDelimiter:
- if ( iWithinDelimiter )
- {
- retVal = ENestedDelimiter;
- }
- // Delimiters can't be used when defining usages
- // that apply to array items ([1], Section 6.2.2.8):
- //
- if ( Collection()->Type() == CCollection::ENamedArray )
- {
- IssueWarning( EDelimiterWithinNamedArray );
- }
- iWithinDelimiter = ETrue;
- iAliasCount = 0;
- iAliasCountMin = 0;
- iAliasCountMax = 0;
- break;
-
- case KEndDelimiter:
- if ( !iWithinDelimiter )
- {
- retVal = ELonelyDelimiter;
- }
- iWithinDelimiter = EFalse;
- break;
-
- default:
- retVal = EUnknownDelimiter;
- TRACE_ERROR((_L("Error: Unknown delimiter type %d\n"),
- aItem.Data()));
- break;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CheckMandatoryFieldExistence
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckMandatoryFieldExistence( CField::TType aType, TUint32 aAttributes )
- {
- TInt retVal = KErrNone;
-
- if ( ( ( iItemsDefined & KMandatoryItemMask ) != KMandatoryItemMask )
- && (!(aAttributes & KConstantFlag)))
- {
- if ( aType == CField::EInput )
- {
- retVal = EInputMissingItems;
- }
- if ( aType == CField::EOutput )
- {
- retVal = EOutputMissingItems;
- }
- if ( aType == CField::EFeature )
- {
- retVal = EFeatureMissingItems;
- }
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CheckUsageMinAndMaxErrors
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckUsageMinAndMaxErrors()
- {
- TInt retVal = KErrNone;
-
- if ( iItemsDefined & ( EUsageMin | EUsageMax ))
- {
- if (!( iItemsDefined & EUsageMax ))
- {
- retVal = ELonelyUsageMin;
- }
- if (!( iItemsDefined & EUsageMin ))
- {
- retVal = ELonelyUsageMax;
- }
- if ( iLocal->UsageMin() > iLocal->UsageMax() )
- {
- retVal = EUsageMinExceedsMax;
- }
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CheckDesignatorMinAndMaxErrors
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckDesignatorMinAndMaxErrors()
- {
- TInt retVal = KErrNone;
-
- if ( iItemsDefined & ( EDesignatorMin | EDesignatorMax ))
- {
- if ( !( iItemsDefined & EDesignatorMax ) )
- {
- retVal = ELonelyDesignatorMin;
- }
- if ( !( iItemsDefined & EDesignatorMin ) )
- {
- retVal = ELonelyDesignatorMax;
- }
- if ( iLocal->DesignatorMin( ) > iLocal->DesignatorMax( ) )
- {
- retVal = EDesignatorMinExceedsMax;
- }
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// CheckStringMinAndMaxErrors
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckStringMinAndMaxErrors()
- {
- TInt retVal = KErrNone;
-
- if (iItemsDefined & (EStringMin | EStringMax))
- {
- if ( !( iItemsDefined & EStringMax ) )
- {
- retVal = ELonelyStringMin;
- }
- if ( !( iItemsDefined & EStringMin ) )
- {
- retVal = ELonelyStringMax;
- }
- if ( iLocal->StringMin( ) > iLocal->StringMax( ) )
- {
- retVal = EStringMinExceedsMax;
- }
- }
- return retVal;
- }
-
-
-// ---------------------------------------------------------------------------
-// CheckStringMinAndMaxErrors
-// ---------------------------------------------------------------------------
-//
-TInt CParser::CheckMandatoryFieldErrors( CField::TType aType, TUint32 aAttributes )
- {
- TInt ret = KErrNone;
- // Check for mandatory items:
- ret = CheckMandatoryFieldExistence( aType, aAttributes );
- if ( ret != KErrNone )
- {
- return ret;
- }
- ret = CheckUsageMinAndMaxErrors();
- if ( ret != KErrNone )
- {
- return ret;
- }
- ret = CheckDesignatorMinAndMaxErrors();
- if ( ret != KErrNone )
- {
- return ret;
- }
- ret = CheckStringMinAndMaxErrors();
- if ( ret != KErrNone )
- {
- return ret;
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CheckLogicalMinAndMax
-// ---------------------------------------------------------------------------
-//
-void CParser::CheckLogicalMinAndMax( TUint32 aAttributes )
- {
- // Logical minimum and maximum must match the number of usage
- // values defined if the Array flag is set (Var=0). (Ignore this
- // check for constant fields)
- //
- if ( !( aAttributes & KVariableFlag ) && ( ! ( aAttributes & KConstantFlag ) ) )
- {
- // Logical minimum must equal 1:
- //
- if ( iGlobal.iLogicalMin != 1 )
- {
- // This is an error according to [2], but we issue a
- // warning instead, as many devices (including the
- // Logitech diNovo keyboard) fail this check:
- IssueWarning( ELogicalMinInvalidForArray );
- }
-
- // Logical maximum must equal the number of defined usages:
- //
- TInt numUsages = iLocal->UsageCount();
- if ( numUsages == 0 )
- {
- numUsages = iLocal->UsageMax( ) - iLocal->UsageMin( ) + 1;
- }
- if ( iGlobal.iLogicalMax != numUsages )
- {
- // Again, we issue a warning rather than an error:
- IssueWarning( ELogicalMaxInvalidForArray );
- }
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// CheckFieldBitNeeded
-// ---------------------------------------------------------------------------
-//
-void CParser::CheckFieldBitNeeded( CField::TType aType, TUint32 aAttributes )
- {
- // "The bit field declared by Report Size must be large enough to
- // hold all values declared by Logical Minimum and Logical
- // Maximum. This includes a sign bit if either are less than
- // 0. Also if the Null flag is set then the field must be capable
- // of reporting all values declared by Logical Minimum and Logical
- // Maximum, and a null value.", [2] (footnote 5).
-
- TInt bitsNeeded = 0;
-
- if ( !( aAttributes & KConstantFlag ) )
- {
- if ( aAttributes & KNullStateFlag )
- {
- // The null state flag is set, so there needs to be at
- // least one extra "out of range" value. This could be
- // below the lowest value or above the highest, whichever
- // will fit better:
- bitsNeeded = Min(
- BitsToRepresentRange(iGlobal.iLogicalMin - 1,
- iGlobal.iLogicalMax),
- BitsToRepresentRange(iGlobal.iLogicalMin,
- iGlobal.iLogicalMax + 1));
- }
- else
- {
- // No null state declared:
- bitsNeeded = BitsToRepresentRange(iGlobal.iLogicalMin,
- iGlobal.iLogicalMax);
- }
- }
-
- if ( iGlobal.iSize < bitsNeeded )
- {
- // The Logitech diNovo is missing a Logical Min and Logical
- // Max pair and so will trigger a range error here. As a
- // workaround, we will treat this as a warning rather than
- // a critical error:
- const TInt KRangeError[] =
- { EInputReportSize, EOutputReportSize, EFeatureReportSize };
- IssueWarning(KRangeError[aType]);
- }
- }
-
-// ---------------------------------------------------------------------------
-// HandleItem
-// ---------------------------------------------------------------------------
-//
-void CParser::HandleItemL( TItem& aItem )
- {
- iErrorCode = EUnknownItem;
- if (aItem.IsLocal())
- {
- iErrorCode = LocalItemL(aItem);
- }
- else
- {
- // Not allowed non-local items within a delimiter pair:
- //
- if ( iWithinDelimiter )
- {
- iErrorCode = EInvalidItemWithinDelimiter;
- }
- else
- {
- if ( aItem.IsMain() )
- {
- iErrorCode = MainItemL(aItem);
- }
-
- if ( aItem.IsGlobal() )
- {
- iErrorCode = GlobalItemL(aItem);
- }
- if ( aItem.IsLong() )
- {
- IssueWarning(ELongItemDefined);
- iErrorCode = 0;
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CheckParseErrors()
-// ---------------------------------------------------------------------------
-//
-void CParser::CheckParseErrors()
- {
- if ( !iErrorCode && ( iGlobalStack.Count() > 0) )
- {
- iErrorCode = EPushWithoutPop;
- }
-
- // COLLECTION without END_COLLECTION:
- if ( !iErrorCode && ( iCollectionStack.Count() != 0 ) )
- {
- iErrorCode = ENoMatchingEndCollection;
- }
-
- // DELIMITER(Open) without DELIMITER(Close):
- if ( !iErrorCode && iWithinDelimiter )
- {
- iErrorCode = ELonelyDelimiter;
- }
-
- // Final size of all reports must be a multiple of eight bits:
- if ( !CheckAllReportSizes() )
- {
- IssueWarning( EReportMustBeEightBitMultiple );
- }
- }
-
-// ---------------------------------------------------------------------------
-// ResetParser
-// ---------------------------------------------------------------------------
-//
-void CParser::ResetParserL()
- {
- // Create the root collection, which is the container for all
- // other collections and fields:
- //
- delete iReportRoot; // may exist if there has been a Leave()
- iReportRoot = 0;
- iReportRoot = CReportRoot::NewL();
- iCollectionStack.Reset();
- PushCollectionL(iReportRoot);
-
- // Clear the error code and the warnings list:
- //
- iErrorCode = 0;
-
- // Reset the parser internal state:
- //
- iGlobal = TParserGlobalState();
- iGlobalStack.Reset();
- iWithinDelimiter = EFalse;
- iItemsDefined = 0;
- iGlobalItemsDefined = 0;
- iItemNumber = 0;
- ClearLocalState();
- }
-
--- a/localconnectivityservice/generichid/src/hidreportbase.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Report base class implementation
-*
-*/
-
-
-#include "hidfield.h"
-#include "hidtranslate.h"
-#include "hidinterfaces.h"
-
-const TUint KValueMask = 0xFFFFFFFF;
-const TUint KSignBitMask = 0x80000000;
-const TInt KThreeLSB = 7;
-const TInt KThreeLSBShift = 3;
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// GetIndexOfUsage()
-// ---------------------------------------------------------------------------
-//
-TBool TReportUtils::GetIndexOfUsage(const CField* aField,
- TInt aUsageId, TInt& aUsageIndex)
- {
- TArray<TInt> usages(aField->UsageArray());
-
- if ( usages.Count() > 0 )
- {
- // Find the usage in the array
- for ( TInt i = 0; i < usages.Count(); i++ )
- {
- if ( usages[i] == aUsageId )
- {
- aUsageIndex = i;
- return ETrue;
- }
- }
- }
- else
- {
- // The field includes all usages between the min and max
- if ( aField->UsageMin() <= aUsageId && aUsageId <= aField->UsageMax() )
- {
- aUsageIndex = aUsageId - aField->UsageMin();
- return ETrue;
- }
- }
-
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// UsageAtIndex()
-// ---------------------------------------------------------------------------
-//
-TInt TReportUtils::UsageAtIndex(const CField* aField, TInt aUsageIndex)
- {
- TInt usageId = 0;
- TArray<TInt> usages(aField->UsageArray());
-
- if ( usages.Count() > 0 )
- {
- if ( aUsageIndex < 0 )
- {
- // Null state for array control
- }
- else if ( aUsageIndex < usages.Count() )
- {
- // Get the usage ID from the set of possible usages
- usageId = usages[aUsageIndex];
- }
- else
- {
- // If there aren't enough usages in the set, the last one repeats
- usageId = usages[usages.Count() - 1];
- }
- }
- else
- {
- // Get the usage ID from the range
- if ( 0 <= aUsageIndex
- && aUsageIndex <= (aField->UsageMax() - aField->UsageMin()) )
- {
- usageId = aField->UsageMin() + aUsageIndex;
- }
- }
-
- return usageId;
- }
-
-// ---------------------------------------------------------------------------
-// WriteData()
-// ---------------------------------------------------------------------------
-//
-TInt TReportUtils::WriteData(HBufC8& aData, const CField* aField,
- TInt aIndex, TInt aValue)
- {
- if ( 0 <= aIndex && aIndex < aField->Count() )
- {
- // The offset in bits from the start of the report to the value
- TInt offset = aField->Offset() + aIndex * aField->Size();
-
- // How many bits in the least significant byte are not part of the value
- TInt bitsToShift = offset & KThreeLSB;
-
- TUint mask = KValueMask >> ((KSizeOfByte * sizeof(TInt)) - aField->Size());
- mask <<= bitsToShift;
- aValue <<= bitsToShift;
-
- TPtr8 data = aData.Des();
-
- // Write out the bytes, least significant first
- for ( TInt i = offset >> KThreeLSBShift; mask && i < aData.Length(); i++ )
- {
- TUint8 maskByte = static_cast<TUint8>(mask);
-
- // The extra cast is because MSVC6 thinks that or-ing 2
- // TUint8s together gives an int.
- data[i] = static_cast<TUint8>(
- (static_cast<TUint8>(aValue) & maskByte)
- | (aData[i] & ~maskByte));
- mask >>= KSizeOfByte;
- aValue >>= KSizeOfByte;
- }
-
- return KErrNone;
- }
-
- return KErrBadControlIndex;
- }
-
-// ---------------------------------------------------------------------------
-// ReadData()
-// ---------------------------------------------------------------------------
-//
-TInt TReportUtils::ReadData(const TDesC8& aData, const CField* aField,
- TInt aIndex, TInt& aValue)
- {
- if ( 0 <= aIndex && aIndex < aField->Count() )
- {
- // The offset in bits from the start of the report to the value
- TInt offset = aField->Offset() + aIndex * aField->Size();
-
- // How many bits in the least significant byte are not part of
- // the value
- TInt bitsToShift = offset & KThreeLSB;
-
- // How many consecutive bytes we need to read to get the whole
- // value. According to the HID spec, a value cannot span more
- // than 4 bytes in a report
- TInt bytesToRead = (bitsToShift + aField->Size() + KThreeLSB) / KSizeOfByte;
-
- // Make sure we don't read past the end of the data
- if ( (offset >> KThreeLSBShift) + bytesToRead > aData.Length() )
- {
- bytesToRead = aData.Length() - (offset >> KThreeLSBShift);
- }
-
- TInt value = 0;
-
- // Read in the bytes, most significant first
- for ( TInt i = bytesToRead - 1; i >= 0; i-- )
- {
- value = (value << KSizeOfByte) | aData[(offset >> KThreeLSBShift) + i];
- }
-
- value >>= bitsToShift;
-
- // Make masks for the whole value and just the sign bit
- TUint valueMask = KValueMask >> ((KSizeOfByte * sizeof(TInt)) - aField->Size());
- TUint signMask = KSignBitMask >> ((KSizeOfByte * sizeof(TInt)) - aField->Size());
-
- if ( aField->LogicalMin() < 0 && (value & signMask) )
- {
- // The value is negative, so the leading bits should be 1s
- aValue = value | ~valueMask;
- }
- else
- {
- // The value is positive, so the leading bits should be 0s
- aValue = value & valueMask;
- }
-
- return KErrNone;
- }
-
- return KErrBadControlIndex;
- }
--- a/localconnectivityservice/generichid/src/hidreportgenerator.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID retport generator
-*
-*/
-
-
-
-#include "hidreportgenerator.h"
-#include "hidreportroot.h"
-#include "hidinterfaces.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLC()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CReportGenerator* CReportGenerator::NewLC(const CReportRoot*
- aReportRoot, TInt aReportId, CField::TType aType)
- {
- CReportGenerator* self = new (ELeave) CReportGenerator(aReportId, aType);
- CleanupStack::PushL(self);
- self->ConstructL(aReportRoot);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CReportGenerator* CReportGenerator::NewL(const CReportRoot*
- aReportRoot, TInt aReportId, CField::TType aType)
- {
- CReportGenerator* self =
- CReportGenerator::NewLC(aReportRoot, aReportId, aType);
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CReportGenerator::CReportGenerator(TInt aReportId, CField::TType aType)
- : iReportId(aReportId), iType(aType)
- {
- // Nothing else to do
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CReportGenerator::ConstructL(const CReportRoot* aReportRoot)
- {
- User::LeaveIfNull(const_cast<CReportRoot*>(aReportRoot));
- iReportRoot = aReportRoot;
-
- // Allocate the buffer, initialise to all zeros, and fill in the
- // report ID if used. Zero should be a null value for all array fields
- // according to the HID parser error checking spec.
- iBuf = HBufC8::NewMaxL(aReportRoot->ReportSizeBytes(iReportId, iType));
- TPtr8 bufptr = iBuf->Des();
- bufptr.FillZ();
- if ( 0 != iReportId )
- {
- bufptr[0] = static_cast<TUint8>(iReportId);
- }
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CReportGenerator::~CReportGenerator()
- {
- delete iBuf;
- }
-
-// ---------------------------------------------------------------------------
-// SetField()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt CReportGenerator::SetField(const CField* aField,
- TInt aUsageId, TInt aValue, TInt aControlOffset /*= 0*/)
- {
- TInt usageIndex;
-
- if ( aField && TReportUtils::GetIndexOfUsage(aField, aUsageId, usageIndex) )
- {
- if ( aField->IsArray() )
- {
- // Convert usage ID to logical value
- TInt logicalValue = usageIndex + aField->LogicalMin();
-
- // Find unused position in the array and write the logical
- // value to it
- for ( TInt i = 0; i < aField->Count(); i++ )
- {
- TInt value;
- TInt error = TReportUtils::ReadData(*iBuf, aField, i, value);
-
- if ( KErrNone != error )
- {
- return error;
- }
-
- if ( value == logicalValue )
- {
- // The array already contains this usage
- return KErrNone;
- }
- else if ( 0 == value || value < aField->LogicalMin() ||
- aField->LogicalMax() < value )
- {
- // This is an unused position
- //
- // NOTE: The comparison with zero is because the buffer is
- // initialised to all zeros, and some reports erroneously
- // include zero in the logical range.
- //
- return TReportUtils::WriteData(*iBuf, aField, i, logicalValue);
- }
- }
-
- return KErrNoSpaceInArray;
- }
- else
- {
- // Check the value to set is valid
- if ( aValue < aField->LogicalMin() ||
- aField->LogicalMax() < aValue )
- {
- return KErrValueOutOfRange;
- }
-
- return TReportUtils::WriteData(*iBuf, aField,
- usageIndex + aControlOffset, aValue);
- }
- }
-
- return KErrUsageNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// SetField()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TPtr8 CReportGenerator::Report()
- {
- return iBuf->Des();
- }
--- a/localconnectivityservice/generichid/src/hidreportroot.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Reportroot implementation
-*
-*/
-
-
-#include <e32debug.h>
-
-#include "hidreportroot.h"
-#include "debug.h"
-
-const TInt KSevenBits = 7;
-
-// ======== MEMBER FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// NewLC()
-// -----------------------------------------------------------------------------
-//
-CReportRoot* CReportRoot::NewLC()
- {
- CReportRoot* self = new (ELeave) CReportRoot();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-// -----------------------------------------------------------------------------
-// NewL()
-// -----------------------------------------------------------------------------
-//
-CReportRoot* CReportRoot::NewL()
- {
- CReportRoot* self = NewLC();
- CleanupStack::Pop(self);
- return self;
- }
-// -----------------------------------------------------------------------------
-// ~CReportRoot()
-// -----------------------------------------------------------------------------
-//
-CReportRoot::~CReportRoot()
- {
- iSizes.Reset();
- iSizes.Close();
- }
-// -----------------------------------------------------------------------------
-// CReportRoot()
-// -----------------------------------------------------------------------------
-//
-CReportRoot::CReportRoot()
- {
- // Nothing to do here
- }
-
-
-
-// -----------------------------------------------------------------------------
-// IncrementReportSizeL()
-// Manage the report ID <-> size "map":
-// -----------------------------------------------------------------------------
-//
-void CReportRoot::IncrementReportSizeL(TInt aReportId,
- CField::TType aType, TInt aIncrement)
- {
- TInt index = FindReportSizeIndex(aReportId, aType);
-
- if ( index == KErrNotFound )
- {
- // Add a new entry for this report ID to the "map":
- User::LeaveIfError(iSizes.Append(TReportSize(aReportId, aType)));
- index = iSizes.Count() - 1;
-
- TRACE_INFO((_L("Adding size record for report %d:%d (%d)\n"),
- aReportId, aType, iSizes[index].iSize));
- }
- TRACE_INFO((_L("Size for report %d:%d changes %d + %d\n"),
- aReportId, aType, iSizes[index].iSize, aIncrement));
- iSizes[index].iSize += aIncrement;
- }
-
-// -----------------------------------------------------------------------------
-// NumberOfReports()
-// -----------------------------------------------------------------------------
-//
-TInt CReportRoot::NumberOfReports() const
- {
- return iSizes.Count();
- }
-// -----------------------------------------------------------------------------
-// ReportSize()
-// -----------------------------------------------------------------------------
-//
-TInt CReportRoot::ReportSize(TInt aIndex) const
- {
- TInt size = 0;
-
- if (aIndex < iSizes.Count())
- {
- size = iSizes[aIndex].iSize;
- }
-
- return size;
- }
-// -----------------------------------------------------------------------------
-// ReportSize()
-// -----------------------------------------------------------------------------
-//
-TInt CReportRoot::ReportSize(TInt aReportId, CField::TType aType) const
- {
- TInt offset = 0;
-
- TInt index = FindReportSizeIndex(aReportId, aType);
- if (index != KErrNotFound && index < iSizes.Count() )
- {
- offset = iSizes[index].iSize;
- }
- return offset;
- }
-
-// -----------------------------------------------------------------------------
-// ReportSizeBytes()
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CReportRoot::ReportSizeBytes(TInt aReportId,
- CField::TType aType) const
- {
- TInt reportBytes = (ReportSize(aReportId, aType) + KSevenBits) / KSizeOfByte;
-
- // Add an extra byte if the report ID is used
- return ( aReportId ) ? reportBytes + 1 : reportBytes;
- }
-
-// -----------------------------------------------------------------------------
-// FindReportSizeIndex()
-// -----------------------------------------------------------------------------
-//
-TInt CReportRoot::FindReportSizeIndex(TInt aReportId, CField::TType aType) const
- {
- TIdentityRelation<TReportSize> matcher(TReportSize::Match);
- TInt index = iSizes.Find(TReportSize(aReportId, aType), matcher);
-
- TRACE_INFO((_L("FindReportSizeIndex(%d, %d) = %d\n"),
- aReportId, aType, index));
- return index;
- }
--- a/localconnectivityservice/generichid/src/hidreporttranslator.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Report base class implementation
-*
-*/
-
-
-#include <e32std.h>
-
-#include "hidtranslate.h"
-#include "hidreportroot.h"
-#include "hidinterfaces.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TReportTranslator::TReportTranslator(
- const TDesC8& aData,
- const CField *aField)
- : iData(aData), iField(aField)
- {
- }
-
-// ---------------------------------------------------------------------------
-// GetValue()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::GetValue(TInt& aValue, TInt aUsageId,
- TInt aControlOffset /*= 0*/) const
- {
- TInt usageIndex = 0;
-
- if ( iField && TReportUtils::GetIndexOfUsage(iField, aUsageId, usageIndex) )
- {
- if ( iField->IsArray() )
- {
- // Convert usage ID to logical value
- TInt logicalValue = usageIndex + iField->LogicalMin();
-
- // Find logical value in the array
- for ( TInt i = 0; i < iField->Count(); i++ )
- {
- TInt value = 0;
- TInt error = TReportUtils::ReadData(iData, iField, i, value);
-
- if ( KErrNone != error )
- {
- return error;
- }
-
- if ( value == logicalValue )
- {
- aValue = ETrue;
- return KErrNone;
- }
- }
-
- aValue = EFalse;
- return KErrNone;
- }
- else
- {
- return TReportUtils::ReadData(iData, iField, usageIndex + aControlOffset, aValue);
- }
- }
-
- return KErrUsageNotFound;
- }
-
-// ---------------------------------------------------------------------------
-// ValueL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::ValueL(TInt aUsageId,
- TInt aControlOffset /*= 0*/) const
- {
- TInt value = 0;
-
- User::LeaveIfError(GetValue(value, aUsageId, aControlOffset));
-
- return value;
- }
-
-// ---------------------------------------------------------------------------
-// GetUsageId()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::GetUsageId(TInt& aUsageId, TInt aIndex) const
- {
- TInt logicalValue = 0;
- TInt error = KErrNoMemory;
-
- if ( iField )
- {
- error = TReportUtils::ReadData(iData, iField, aIndex, logicalValue);
-
- if ( KErrNone == error )
- {
- if ( iField->IsArray() )
- {
- // The logical value is a usage index
- aUsageId = TReportUtils::UsageAtIndex(iField, logicalValue -
- iField->LogicalMin());
- }
- else
- {
- // Treat the logical value as an on/off control for the usage
- aUsageId = ( logicalValue ) ? TReportUtils::UsageAtIndex(iField,
- aIndex) : 0;
- }
- }
- }
-
- return error;
- }
-
-// ---------------------------------------------------------------------------
-// GetUsageId()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::UsageIdL(TInt aIndex) const
- {
- TInt usageId = 0;
-
- User::LeaveIfError(GetUsageId(usageId, aIndex));
-
- return usageId;
- }
-
-// ---------------------------------------------------------------------------
-// RawValueL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::RawValueL(TInt aIndex) const
- {
- TInt value = 0;
- User::LeaveIfNull(const_cast<CField*>(iField));
- User::LeaveIfError(TReportUtils::ReadData(iData, iField, aIndex, value));
- return value;
- }
-
-// ---------------------------------------------------------------------------
-// Count()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TReportTranslator::Count() const
- {
- TInt count = 0;
-
- if (iField)
- {
- count = iField->Count();
- }
-
- return count;
- }
--- a/localconnectivityservice/generichid/src/hidsearch.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID field search
-*
-*/
-
-#include <e32std.h>
-#include <e32svr.h>
-
-#include "hidreportroot.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// SearchL()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void THidFieldSearch::SearchL(const CReportRoot* aReportRoot,
- MHidFieldFinder* aFinder)
- {
- iFinder = aFinder;
-
- if (aReportRoot)
- {
- TBool done = EFalse;
- for (TInt i=0; (i < aReportRoot->CollectionCount()) && !done; ++i)
- {
- done = !DoSearchL(aReportRoot->CollectionByIndex(i));
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// DoSearchL()
-// ---------------------------------------------------------------------------
-//
-TBool THidFieldSearch::DoSearchL(const CCollection* aCollection)
- {
- if (iFinder->BeginCollection(aCollection))
- {
- TInt i;
-
- for (i=0; i < aCollection->FieldCount(); ++i)
- {
- iFinder->Field(aCollection->FieldByIndex(i));
- }
-
- for (i=0; i < aCollection->CollectionCount(); ++i)
- {
- if (!DoSearchL(aCollection->CollectionByIndex(i)))
- {
- return EFalse;
- }
- }
- }
-
- return iFinder->EndCollection(aCollection);
- }
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/Bmarm/GenericHidTestU.DEF Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/Bwins/GenericHidTestU.DEF Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/conf/GenericHidTest.cfg Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1749 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Test script config file
-*
-*/
-
-[StifSettings]
-CapsModifier= GenericHidTest.exe
-[EndStifSettings]
-
-// GenericHidTest Module - total ... tc
-
-// GenericHidTest Api Tests (... tc)
-/*
- [Test]
- title Example Api Test
- create GenericHidTest tester
- tester ExecuteApiTestBlock ExampleTestL API option 1 a
- delete tester
- [Endtest]
-*/
-// Add new api tests here
-// ...
-
-
-// GenericHidTest Module Tests (... tc)
-/*
- [Test]
- title Example Module Test
- create GenericHidTest tester
- tester ExecuteModuleTestBlock ExampleTestL MODULE option 2 b
- delete tester
- [Endtest]
-*/
-// Add new module tests here
-// ...
-
-
-// GenericHidTest Branch Tests (... tc)
-
-[Test]
-title Connect/Disconnect
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Connect Unsupported
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\dummyconnect.hid
-delete tester
-[Endtest]
-
-[Test]
-title Multiple Connect wiht same id
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Headset Data In
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\headsetvolumeup.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Usage PoC Data In
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\UsagePoC.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Multipage Connect/Disconnect
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\multipagec.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Multipage Data In
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\multipagec.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\headsetvolumeupm.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Next track
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Next after next track
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-tester ExecuteBranchTestBlock Wait BRANCH 2
-delete tester
-[Endtest]
-
-[Test]
-title Stop Alarm when playing music
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock AddAlarm BRANCH 1000
-tester ExecuteBranchTestBlock Wait BRANCH 70
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-tester ExecuteBranchTestBlock DeleteAlarm BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Volume up
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\volup.hid
-tester ExecuteBranchTestBlock Wait BRANCH 6
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Volume down
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\voldown.hid
-tester ExecuteBranchTestBlock Wait BRANCH 6
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Mute
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\mute.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Short next
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 10
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\next.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Long press next
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 10
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\next.hid
-tester ExecuteBranchTestBlock Wait BRANCH 3
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Long press back
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 10
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\prev.hid
-tester ExecuteBranchTestBlock Wait BRANCH 3
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Short press back
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetcon2.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\play.hid
-tester ExecuteBranchTestBlock Wait BRANCH 10
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\prev.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\empty.hid
-tester ExecuteBranchTestBlock Wait BRANCH 20
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\stop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Connect/Disconnect ad83
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock Wait BRANCH 10
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Contry code
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CountryCode BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Vendor id
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock VendorId BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Product ID
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock ProductId BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Set Protocol
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock SetProtocol BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Get Protocol
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock GetProtocol BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Get Report
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock GetReport BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Set Report
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock SetReport BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Data out
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock DataOut BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Get idle
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock GetIdle BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Set idle
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock SetIdle BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Command Result
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock CommandResult BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Report Descriptor
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock ReportDescriptor BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Translator GetValue
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetValue BRANCH Ok
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Translator GetValue Field Null
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_FieldNull BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetValue BRANCH NotFound
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator GetValue NotArray
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_NotArray BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetValue BRANCH Ok
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator GetValue FieldCountZero
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_FieldCountZero BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetValue BRANCH Ok
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Translator Value
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorValue BRANCH
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Translator GetUsageId
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetUsageId BRANCH Ok
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator GetUsageId BadIndex
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetUsageId BRANCH BadIndex
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator GetUsageId Field Null
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_FieldNull BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetUsageId BRANCH Error
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator GetUsageId NotArray
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_NotArray BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorGetUsageId BRANCH Ok
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator UsageId
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorUsageId BRANCH
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator Raw value
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorRawValue BRANCH
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator Count
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorCount BRANCH NotZero
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Translator Count Field Null
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportTranslator_FieldNull BRANCH c:\data\others\multipagein.hid
-tester ExecuteBranchTestBlock ReportTranslatorCount BRANCH Zero
-tester ExecuteBranchTestBlock DeleteReportTranslator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Collection type
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock Collectiontype BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsPhysical
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsPhysical BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsLogical
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsLogical BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsReport BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsNamedArray
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsNamedArray BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsUsageSwitch
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsUsageSwitch BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsUsageModifier
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsUsageModifier BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection IsApplication
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionIsApplication BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection UsagePage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionUsagePage BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection Usage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionUsage BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection CollectionCount
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionCollectionCount BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection FieldCount
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionFieldCount BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection CollectionByIndex Present
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionCollectionByIndex BRANCH Present
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection CollectionByIndex NotPresent
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionCollectionByIndex BRANCH NotPresent
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Collection FieldByIndex
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CollectionFieldByIndex BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportSizeBytes
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock ReportrootReportSizeBytes BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Logical Max
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldLogicalMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Physical min
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldPhysicalMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Physical max
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldPhysicalMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Unit
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUnit BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Unit Exponent
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUnitExponent BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Count
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldCount BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Size
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSize BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Offset SetReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldOffset BRANCH SetReport
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Offset NotSetReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldOffset BRANCH NotSetReport
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Report Id
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldReportId BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Is In Report
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsInReport BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Designator Index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldDesignatorIndex BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field String Index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldStringIndex BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Usage Page
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUsagePage BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field HasUsage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldHasUsage BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Usage Array
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUsageArray BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Usage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUsage BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Usage Count
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldUsageCount BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Clear Usage List
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldClearUsageList BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Last Usage Empty
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldLastUsage BRANCH Empty
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Last Usage NotEmpty
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldLastUsage BRANCH NotEmpty
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Attributes
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldAttributes BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field Type
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldType BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field IsVariable
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsVariable BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Field IsArray
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsArray BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-
-[Test]
-title Field IsConstant
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsConstant BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Field IsData
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsData BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Field SetLogicalMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetLogicalMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetLogicalMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetLogicalMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetPhysicalMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetPhysicalMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetPhysicalMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetPhysicalMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetDesignatorMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetDesignatorMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetDesignatorMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetDesignatorMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetUsageMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetUsageMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetUsageMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetUsageMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetStringMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetStringMin BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetStringMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetStringMax BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetLogicalRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetLogicalRange BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetUsageRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetUsageRange BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetPhysicalRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetPhysicalRange BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetStringRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetStringRange BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field SetDesignatorRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldSetDesignatorRange BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field IsInput
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsInput BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Field IsOutput
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsOutput BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Field IsFeature
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock FieldIsFeature BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title ReportGeneratorReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorReport BRANCH
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField Array
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH Array
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField NotArray
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH NotArray
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField NotArrayOutOfRange
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH NotArrayOutOfRange
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title ReportGeneratorReport SetField FieldNull
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH FieldNull
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField FieldCountZero
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH FieldCountZero
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField NotExistingUsage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH NotExistingUsage
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title ReportGeneratorReport SetField NotExistingUsage2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH NotExistingUsage2
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title ReportGeneratorReport SetField BadIndex
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\connectad83.hid
-tester ExecuteBranchTestBlock CreateReportGenerator BRANCH
-tester ExecuteBranchTestBlock ReportGeneratorSetField BRANCH BadIndex
-tester ExecuteBranchTestBlock DeleteReportGenerator BRANCH
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title OutputReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\output.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title FeautureReport
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\feature.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global physical
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\physicalmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Unit
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\unit.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Unit exponent
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\unitexponent.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Designator limit test
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\designator.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Delimiter test
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\delimiter.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title String limit test
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\string.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Push whitout pop
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\push.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Pop whitout push
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\pop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title String index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\stringindex.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Designator index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\designatorindex.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Designator index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdesignatorindex.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Designator minimum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdesignatorminimum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Designator maximum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdesignatormaximum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local String index
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localstringindex.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local String minimum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localstringminimum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local String maximum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localstringmaximum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-
-[Test]
-title Local Delimiter - unknown delimiter
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdelimiter.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Delimiter - lonely delimiter
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdelimiter_lonelydelimiter.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Delimiter - nested delimiter
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localdelimiter_nesteddelimiter.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Usage
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localusage.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Usage minimum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localusageminimum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local Usage maximum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localusagemaximum.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Local item - unknown
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\localitem_unknown.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Physical minimum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalphysicalmin.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Physical maximum
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalphysicalmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Unit
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalunit.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Unit small value
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalunit_smallvalue.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Unit exponent
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalunitexponent.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global Unit exponent2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalunitexponent2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global push
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalpush.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global pop
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalpop.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global pop without push
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globalpop_withoutpush.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Global item - unknown
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\globaitem_unknown.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Main Output Tag
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\mainoutputtag.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Main Feature
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\mainfeature.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Long Item
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\longitem.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Handle Item - within delimiter
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\handleitem_withindelimiter.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Main Item - unknown
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\mainitem_unknown.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check usage min and max - LonelyUsageMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkusageminandmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check usage min and max - LonelyUsageMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkusageminandmax2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check usage min and max - UsageMinExceedsMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkusageminandmax3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check designator min and max - LonelyDesignatorMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkdesignatorminandmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check designator min and max - LonelyDesignatorMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkdesignatorminandmax2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check designator min and max - DesignatorMinExceedsMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkdesignatorminandmax3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check string min and max - LonelyStringMin
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkstringminandmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check string min and max - LonelyStringMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkstringminandmax2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check string min and max - StringMinExceedsMax
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkstringminandmax3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check mandatory field existence
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkmandatoryfieldexistence.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check mandatory field existence2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkmandatoryfieldexistence2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check mandatory field existence3
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkmandatoryfieldexistence3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for field errors
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkforfielderrors.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for field errors2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkforfielderrors2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check logical min and max
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checklogicalminandmax.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check field bit needed
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkfieldbitneeded.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for main errors
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkformainerrors.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for main errors2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkformainerrors2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for main errors3
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkformainerrors3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for main errors3
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkformainerrors3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check parse errors
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkparseerrors.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check parse errors2
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkparseerrors2.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check parse errors3
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkparseerrors3.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title check for collection errors
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\checkforcollectionerrors.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-/////////////////////////////////
-[Test]
-title Hangup
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock Wait BRANCH 2
-tester ExecuteBranchTestBlock CreateCall BRANCH +48607939016 //+358405695587
-tester ExecuteBranchTestBlock Wait BRANCH 5
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Redial
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock Wait BRANCH 2
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 1
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Wait BRANCH 2
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Snooze Alarm
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock AddAlarm BRANCH 1
-tester ExecuteBranchTestBlock Wait BRANCH 80
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-tester ExecuteBranchTestBlock DeleteAlarm BRANCH
-delete tester
-[Endtest]
-
-[Test]
-title Stop Alarm
-create GenericHidTest tester
-tester ExecuteBranchTestBlock Connect BRANCH c:\data\others\headsetconnect.hid
-tester ExecuteBranchTestBlock AddAlarm BRANCH 1
-tester ExecuteBranchTestBlock Wait BRANCH 80
-tester ExecuteBranchTestBlock DataIn BRANCH c:\data\others\hook.hid
-tester ExecuteBranchTestBlock Disconnect BRANCH
-tester ExecuteBranchTestBlock DeleteAlarm BRANCH
-delete tester
-[Endtest]
-//
-// Add new branch tests here
-// ...
-
-//Field SetLogicalRange
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/E000B181.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#include <RegistryInfo.rh>
-
-// Declares info for two implementations
-RESOURCE REGISTRY_INFO theInfo
- {
- // UID for the DLL
- dll_uid = 0xE000B181;
- // Declare array of interface info
- interfaces =
- {
- INTERFACE_INFO
- {
- // UID of interface that is implemented
- interface_uid = 0x10201d26;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0xE000B187;
- version_no = 1;
- display_name = "CHidDriverPlugin";
- default_data = "";
- opaque_data = "";
- }
- };
- }
- };
- }
-
-//
-// End of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/UsagePoC.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
- 0x33, 0x01
-
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x49, 0x00, //define designator minimum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x59, 0x00, //define designator maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x49, 0x10, //define designator minimum
-0x59, 0x00, //define designator maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkfieldbitneeded.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-//0x91, 0x00, // main output tag - create field
-0x91, 0x41, // main output tag - create field KNullStateFlag
-
-
-//tests for BitsToRepresentRange
-0x15, 0x10, //define logical minimum
-0x25, 0x10, //define logical maximum
-0x91, 0x01, // main output tag - create field
-
-0x15, 0x05, //define logical minimum
-0x25, 0x10, //define logical maximum
-0x91, 0x01, // main output tag - create field
-
-
-0x17, 0xFF, 0xFF, 0xFF, 0xFF, //define logical minimum - negative minimum
-0x25, 0x10, //define logical maximum
-0x91, 0x01, // main output tag - create field
-
-0x15, 0x05, //define logical minimum
-0x25, 0x10, //define logical maximum
-
-//0x75, 0x00, // set iGlobal.iSize to 0
-0x77, 0xFF, 0xFF, 0xFF, 0xFF, // set iGlobal.iSize to -1
-
-0x91, 0x01, // main output tag - create field
-
-0x75, 0x00, // set iGlobal.iSize to 0
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforcollectionerrors.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-0xA1, 0x81, //main collection
-0xC0, //end collection
-
-0xA1, 0x07, //main collection
-0xC0, //end collection
-
-0x09, 0xc8, // add local usage
-0x05, 0xc8, // add local usage page
-
-0xA1, 0x01, //main collection
-0xC0, //end collection
-
-0x79, 0xc8, //local string index - KUnusedLocalItemsMask
-
-0xA1, 0x01, //main collection
-0xC0, //end collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforfielderrors.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x15, 0x10, //define logical minimum
-0x25, 0x00, //define logical maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforfielderrors2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x35, 0x10, //define physical minimum
-0x45, 0x00, //define physical maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-0x35, 0x10, //define physical minimum
-0x45, 0x00, //define physical maximum
-
-0xA1, 0x01, //main collection
-0xC0 //end collection
-
-0x15, 0x10, //define logical minimum
-0x25, 0x00, //define logical maximum
-0xA1, 0x01, //main collection
-0xC0 //end collection
-
-0x15, 0x00, //define logical minimum
-0x25, 0x10, //define logical maximum
-0xA1, 0x01, //main collection
-0xC0 //end collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x35, 0x00, //define physical minimum
-
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x45, 0x00, //define physical maximum
-
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checklogicalminandmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-//0x91, 0x01, // main output tag - create field
-//0x91, 0xf0, // main output tag - create field
-
-0x25, 0x20, //define logical maximum
-0x15, 0x10, //define logical minimum - wrong for array
-0x91, 0x03, // main output tag - create field ELogicalMinInvalidForArray
-
-0x09, 0xc8, // add local usage
-0x91, 0x03 // main output tag - create field ELogicalMinInvalidForArray
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x91, 0x00 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xB1, 0x00 // main feature - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x81, 0x00 // main input tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xa9, 0x01 // begin delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xA1, 0x01 //main collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xA4 //global push - no data
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x89, 0x00, // define string minimum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x99, 0x00, // define string maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x89, 0x10, // define string minimum
-0x99, 0x00, // define string maximum
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x19, 0x00, //define usage min to 0
-0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x29, 0x00, //define usage max to 0
-0x91, 0x01 // main output tag - create field
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax3.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0x19, 0x10, //define usage min to 0
-0x29, 0x00, //define usage max to 0
-0x91, 0x01 // main output tag - create field
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/connectad83.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-0x05, 0x0C,
-0x09, 0x01,
-0xA1, 0x01,
-0x15, 0x00,
-0x25, 0x01,
-0x75, 0x01,
-0x09, 0xE9,
-0x09, 0xEA,
-0x95, 0x02,
-0x81, 0x02,
-0x05, 0x0B,
-0x09, 0x2F,
-0x95, 0x01,
-0x81, 0x06,
-0x09, 0x20,
-0x81, 0x02,
-0x06, 0x00, 0xFF,
-0x09, 0x01,
-0x09, 0x02,
-0x95, 0x02,
-0x81, 0x02,
-0x95, 0x02,
-0x81, 0x01,
-0x05, 0x0C,
-0x09, 0xB0,
-0x09, 0xB3,
-0x09, 0xB4,
-0x09, 0xB7,
-0x09, 0xB5,
-0x09, 0xB6,
-0x09, 0xB9,
-0x95, 0x07,
-0x81, 0x06,
-0x95, 0x01,
-0x81, 0x01,
-0xC0
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/delimiter.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Filename: delimiter1.hid.txt
-// A valid delimiter Open and Close
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0xA9, 0x01, // DELIMITER (OPEN)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0xA9, 0x00, // DELIMITER (CLOSE)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/designator.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-// File: DesignatorMin1.hid.txt
-// Designator Min defined, but no Designator Max
-
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
-// Designator Min defined, but no Designator Max
- 0x49, 0x01, // DESIGNATOR_MINIMUM (1)
- 0x59, 0x20 // DESIGNATOR_MAXIMUM (32)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/designatorindex.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-// File: DesignatorMin1.hid.txt
-// Designator Min defined, but no Designator Max
-
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
-// Designator Min defined, but no Designator Max
- 0x49, 0x01, // DESIGNATOR_MINIMUM (1)
- 0x59, 0x20 // DESIGNATOR_MAXIMUM (32)
- 0x39, 0x14 // DESIGNATOR_INDEX
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/dummyconnect.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-0x05, 0x02, //Global usage page 12
-0x09, 0x01, //Local usage page 1
-0xa1, 0x01, //Collection Application
-0x15, 0x00, //Global Locgical minimium
-0x25, 0x01, //Global Logical maxim
-0x75, 0x01, //Global Report size 1
-0x09, 0xE9, //Local usage Volume up
-0x09, 0xEA, //Local usage Volume down
-0x95, 0x02, //Global Report Count 2
-0x81, 0x02, //Input 2 First field
-0x05, 0x03, //Global usage page 11
-0x09, 0x2F, //Local usage mute
-0x95, 0x01, //Global Report Count 1
-0x81, 0x06, //Input 6 2. field
-0x09, 0x20, //Local usage hook
-0x95, 0x01, //Global Report Count 1
-0x81, 0x02, //Input 2 3. field
-0x05, 0x02, //Global usage page 12 (consumer)
-0x09, 0xCD, //Local usage play/pause
-0x09, 0xb5, //Local usage 0xb5 ScanNext
-0x09, 0xb6, //Local usage 0xb6 ScanPrev
-0x09, 0xb7, //Local usage 0xb7 Stop
-0x95, 0x04, //Global Report Count 4
-0x81, 0x02, //Input 2 6. field
-0xc0
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/empty.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x0
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/feature.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// File: Feature1.hid.txt
-// A Feature item defined with no Global or Local items defined
-
- 0xa1, 0x02, // COLLECTION (Logical)
- 0xa1, 0x02, // COLLECTION (Logical)
-// No global or Local items defined
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0x09, 0x47, // USAGE (Usage Indicator Color)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x48, // USAGE (Red)
- 0x09, 0x49, // USAGE (Green)
- 0x09, 0x4a, // USAGE (Amber)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0xc0, // END_COLLECTION
- 0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
- 0x19, 0xb7, // USAGE_MINIMUM (Stop)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x09, 0x3c, // USAGE (Usage Multi Mode Indicator)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x3d, // USAGE (Indicator On)
- 0x09, 0x3f, // USAGE (Indicator Slow Blink)
- 0x09, 0x41, // USAGE (Indicator Off)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0x09, 0x47, // USAGE (Usage Indicator Color)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x48, // USAGE (Red)
- 0x09, 0x49, // USAGE (Green)
- 0x09, 0x4a, // USAGE (Amber)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0xc0 // END_COLLECTION
-//};
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/feature1.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-// File: Feature1.hid.txt
-// A Feature item defined with no Global or Local items defined
-
- 0xa1, 0x02, // COLLECTION (Logical)
- 0xa1, 0x02, // COLLECTION (Logical)
-// No global or Local items defined
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0x09, 0x47, // USAGE (Usage Indicator Color)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x48, // USAGE (Red)
- 0x09, 0x49, // USAGE (Green)
- 0x09, 0x4a, // USAGE (Amber)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0xc0, // END_COLLECTION
- 0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
- 0x19, 0xb7, // USAGE_MINIMUM (Stop)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x09, 0x3c, // USAGE (Usage Multi Mode Indicator)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x3d, // USAGE (Indicator On)
- 0x09, 0x3f, // USAGE (Indicator Slow Blink)
- 0x09, 0x41, // USAGE (Indicator Off)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0x09, 0x47, // USAGE (Usage Indicator Color)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x09, 0x48, // USAGE (Red)
- 0x09, 0x49, // USAGE (Green)
- 0x09, 0x4a, // USAGE (Amber)
- 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
- 0xc0, // END_COLLECTION
- 0xc0 // END_COLLECTION
-//};
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globaitem_unknown.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xF5, 0x01 // global item - unknown
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalphysicalmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x45, 0xc8, //global physical maximum (200)
-0x45, 0xc8 //global physical maximum (200)
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalphysicalmin.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x35, 0xc8, //global physical minimum (200)
-0x35, 0xc8 //global physical minimum (200)
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpop.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-0xA4, //global push - no data
-0xB4, // global pop
-0xA4, //global push - no data
-0xB5, 0x01 // global pop with data
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpop_withoutpush.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xB4 // global pop
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpush.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0xA4, //global push - no data
-0xB4, // global pop
-0xA5, 0x01 // global push with data
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunit.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x65, 0x06, //global unit
-0x65, 0x06 //global unit
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunit_smallvalue.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x65, 0x02 //global unit
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunitexponent.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x55, 0x00, //global unit exponent
-0x55, 0x00 //global unit exponent
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunitexponent2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x55, 0xff //global unit exponent
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/handleitem_withindelimiter.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-0xa9, 0x01, // begin delimiter - set iWithinDelimiter
-0xB1, 0xff, // main feature
-0xa9, 0x00 // end delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetcon2.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-0x05, 0x0c, //Global usage page 12
-0x09, 0x01, //Local usage page 1
-0xa1, 0x01, //Collection Application
-0x15, 0x00, //Global Locgical minimium
-0x25, 0x01, //Global Logical maxim
-0x75, 0x01, //Global Report size 1
-0x09, 0xE9, //Local usage Volume up
-0x09, 0xEA, //Local usage Volume down
-0x95, 0x02, //Global Report Count 2
-0x81, 0x02, //Input 2 First field
-0x05, 0x0B, //Global usage page 11
-0x09, 0x2F, //Local usage mute
-0x95, 0x01, //Global Report Count 1
-0x81, 0x06, //Input 6 2. field
-0x09, 0x20, //Local usage hook
-0x95, 0x01, //Global Report Count 1
-0x81, 0x02, //Input 2 3. field
-0x05, 0x0C, //Global usage page 12 (consumer)
-0x09, 0xCD, //Local usage play/pause
-0x09, 0xb5, //Local usage 0xb5 ScanNext
-0x09, 0xb6, //Local usage 0xb6 ScanPrev
-0x09, 0xb7, //Local usage 0xb7 Stop
-0x95, 0x04, //Global Report Count 4
-0x81, 0x02, //Input 2 6. field
-0xc0
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetconnect.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
- 0x95, 0x01, //Report count 1
- 0x05, 0x0c, //Usage page telephony
- 0x09, 0x01, // Usage Phone
- 0xa1, 0x01, // COLLECTION (Application)
- 0x09, 0x01, // USAGE (Programmable Button)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0c, // USAGE_PAGE (Button)
- 0x19, 0x00, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x06, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0b, // USAGE_PAGE (Button)
- 0x19, 0x20, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x2f, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xc0 //End collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetvolumeup.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
- 0x2f
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetvolumeupm.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
- 0x01, 0x2f
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/hook.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
- 0x20, 0x01
-
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/hookconnect.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
- 0x95, 0x01, //Report count 1
- 0x05, 0x0c, //Usage page telephony
- 0x09, 0x01, // Usage Phone
- 0xa1, 0x01, // COLLECTION (Application)
- 0x09, 0x01, // USAGE (Programmable Button)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0c, // USAGE_PAGE (Button)
- 0x19, 0x00, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x06, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0b, // USAGE_PAGE (Button)
- 0x19, 0x20, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x2f, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xc0 //End collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/inputdata.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-0x01,0x48,
-0x00,0x00,
-0x00,0x00,
-0x01,0x02,
-0x02,0x03
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xa9, 0x01, // begin delimiter0xa9, 0x00, // end delimiter0xa9, 0x02, // unknown delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter_lonelydelimiter.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xa9, 0x00 // end delimiter - lonely delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter_nesteddelimiter.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xa1, 0x04, // COLLECTION (CCollection::ENamedArray) - warning 0xa9, 0x01, // begin delimiter0xa9, 0x01 // begin delimiter - nested
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatorindex.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x39, 0xc8,0x39, 0xc8,0xa9, 0x01, // begin delimiter0x39, 0xc8, // ELocalDesignatorIndex (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatormaximum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x59, 0xc8,0x59, 0xc8,0xa9, 0x01, // begin delimiter0x59, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatorminimum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x49, 0xc8,0x49, 0xc8,0xa9, 0x01, // begin delimiter0x49, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localitem_unknown.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xf9, 0x01 // unknow item
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringindex.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x79, 0xc8,0x79, 0xc8,0xa9, 0x01, // begin delimiter0x79, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringmaximum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x99, 0xc8,0x99, 0xc8,0xa9, 0x01, // begin delimiter0x99, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringminimum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x89, 0xc8,0x89, 0xc8,0xa9, 0x01, // begin delimiter0x89, 0xc8, // ELocalDesignatorIndex (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusage.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x09, 0xc8,0x09, 0x00, // zero usage0xa9, 0x01, // begin delimiter0x09, 0xc8,0x09, 0xc8,0x0B, 0xc8, 0xc9, 0xca, 0xcb, //data size - 40x0B, 0x00, 0x00, 0x00, 0x00, //data size - 40xa9, 0x00 // end delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusagemaximum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x29, 0x00,0x19, 0x00, //define usage min to 00x29, 0x00,0xa9, 0x01, // begin delimiter0x29, 0x00,0x29, 0x00,0xa9, 0x00, // end delimiter0x19, 0xc8, //set usage min to 0xc80x29, 0xca,0x2B, 0x00, 0x00, 0x00, 0x00, //data size - 4
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusageminimum.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x19, 0x00,0x29, 0x00, //define usage max to 00x19, 0x00,0xa9, 0x01, // begin delimiter0x19, 0x00,0x19, 0x00,0xa9, 0x00, // end delimiter0x29, 0xca, //set usage max to 0xca0x19, 0xc8,0x1B, 0xc8, 0xc9, 0xca, 0xcb, //data size - 4
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/longitem.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x0C //long item
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainfeature.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-0xB1, 0x01, // main feature
-
-0x39, 0xc8,
-0x39, 0xc8, //local designator index - set iLocalMultipleUse
-
-0xB1, 0x01, // main feature
-0xB2, 0xff, 0xff, // main feature - EOutputReservedBitsNonZero
-
-//0xa9, 0x01, // begin delimiter - set iWithinDelimiter
-//0xB2, 0xff, 0xff, // main feature EOutputReservedBitsNonZero
-//0xa9, 0x00 // end delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainitem_unknown.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xF0 //main item - unknown
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainoutputtag.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-0x91, 0x01, // main output tag
-
-0x39, 0xc8,
-0x39, 0xc8, //local designator index - set iLocalMultipleUse
-
-0x91, 0x01, // main output tag
-0x92, 0xff, 0xff, // main output tag EOutputReservedBitsNonZero
-
-//0xa9, 0x01, // begin delimiter - set iWithinDelimiter
-//0x91, 0x01, // main output tag
-//0xa9, 0x00 // end delimiter
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multipagec.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-
- 0x95, 0x01, //Report count 1
- 0x05, 0x0c, //Usage page telephony
- 0x09, 0x01, // Usage Phone
- 0xa1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // Report id 1
- 0x09, 0x01, // USAGE (Programmable Button)
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0c, // USAGE_PAGE (Button)
- 0x19, 0x00, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x06, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xa1, 0x02, // COLLECTION (Logical)
- 0x05, 0x0b, // USAGE_PAGE (Button)
- 0x19, 0x20, // USAGE_MINIMUM (Button 1)
- 0x29, 0x2f, // USAGE_MAXIMUM (Button 6)
- 0x75, 0x08, // REPORT_SIZE (3)
- 0x15, 0x00, // LOGICAL_MINIMUM (1)
- 0x25, 0x2f, // LOGICAL_MAXIMUM (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
- 0xc0, //End collection
-0x05, 0x01, // USAGE_PAGE (Generic Desktop)
-0x09, 0x02, // USAGE (Mouse)
-0xa1, 0x01, // COLLECTION (Application)
-0x85, 0x02, // Report id 2
-0x09, 0x01, // USAGE (Pointer)
-0xa1, 0x00, // COLLECTION (Physical)
-0x05, 0x09, // USAGE_PAGE (Button)
-0x19, 0x01, // USAGE_MINIMUM (Button 1)
-0x29, 0x03, // USAGE_MAXIMUM (Button 3)
-0x15, 0x00, // LOGICAL_MINIMUM (0)
-0x25, 0x01, // LOGICAL_MAXIMUM (1)
-0x95, 0x03, // REPORT_COUNT (3)
-0x75, 0x01, // REPORT_SIZE (1)
-0x81, 0x02, // INPUT (Data,Var,Abs)
-0x95, 0x01, // REPORT_COUNT (1)
-0x75, 0x05, // REPORT_SIZE (5)
-0x81, 0x03, // INPUT (Cnst,Var,Abs)
-0x05, 0x01, // USAGE_PAGE (Generic Desktop)
-0x09, 0x30, // USAGE (X)
-0x09, 0x31, // USAGE (Y)
-0x15, 0x81, // LOGICAL_MINIMUM (-127)
-0x25, 0x7f, // LOGICAL_MAXIMUM (127)
-0x75, 0x08, // REPORT_SIZE (8)
-0x95, 0x02, // REPORT_COUNT (2)
-0x81, 0x06, // INPUT (Data,Var,Rel)
-0xc0, // END_COLLECTION
-0xc0 // END_COLLECTION
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multipagein.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-0x01,0x48,
-0x00
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multiple_usage_page_connect.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
- 0x05, 0x0c, // Global usage page 12
- 0x09, 0x01, // Local usage page 1
- 0xa1, 0x01, // Start Application collection
- 0x15, 0x00, // Global Locgical minimium
- 0x20, 0x01, // Global Locgical maximum
- 0x75, 0x01, // Global Report size 1
- 0x09, 0xe9, // Local usage Volume up
- 0x09, 0xea, // Local usage Volume down
- 0x95, 0x02, // Global Report Count 2
- 0x81, 0x02, // Input 2 First field
- 0x05, 0x0b, // Global usage page 11
- 0x09, 0x2f, // Local usage mute
- 0x95, 0x01, // Global Report Count 1
- 0x81, 0x06m // Input 6 2. field
- 0x81, 0x20, // Local usage hook
- 0x95, 0x01, // Global Report Count 1
- 0x81, 0x02, // Input 2 3. field
- 0xc0 // End collection
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mute.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x24, 0x01
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/next.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0xE0, 0x04
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/output.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-// File: Output1.hid.txt
-// Output item with no Global or Local items defined
-
- 0xA1, 0x01, // COLLECTION (Application)
-// Output item with no Global or Local items defined
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/output1.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-// File: Output1.hid.txt
-// Output item with no Global or Local items defined
-
- 0xA1, 0x01, // COLLECTION (Application)
-// Output item with no Global or Local items defined
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/physicalmax.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-// File: PhysicalMax1.hid.txt
-// Physical Max defined, but no Physical Min
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x09, 0x04, // USAGE (Joystick)
- 0xa1, 0x01, // COLLECTION (Application)
- 0x05, 0x02, // USAGE_PAGE (Simulation Controls)
- 0x09, 0xbb, // USAGE (Throttle)
- 0x15, 0x81, // LOGICAL_MINIMUM (-127)
- 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x01, // USAGE (Pointer)
- 0xa1, 0x00, // COLLECTION (Physical)
- 0x09, 0x30, // USAGE (X)
- 0x09, 0x31, // USAGE (Y)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0, // END_COLLECTION
- 0x09, 0x39, // USAGE (Hat switch)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
-// Physical Max defined, but no Physical Min
-// 0x35, 0x00, // PHYSICAL_MINIMUM (0)
- 0x46, 0x0e, 0x01, // PHYSICAL_MAXIMUM (270)
- 0x65, 0x14, // UNIT (Eng Rot:Angular Pos)
- 0x75, 0x04, // REPORT_SIZE (4)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x09, // USAGE_PAGE (Button)
- 0x19, 0x01, // USAGE_MINIMUM (Button 1)
- 0x29, 0x04, // USAGE_MAXIMUM (Button 4)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x55, 0x00, // UNIT_EXPONENT (0)
- 0x65, 0x00, // UNIT (None)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0 // END_COLLECTION
-//};
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/play.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
- 0xB0, 0x01,
- 0x81, 0x01
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/pop.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-// File: Pop1.hid.txt
-// Pop defined with no corresponding Push
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
-// Pop defined with no corresponding Push
- 0xb4, // POP
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/prev.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
- 0x40, 0x02
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/push.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-// File: Push1.hid.txt
-// Push defined with no corresponding Pop
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
-// Push defined with no corresponding Pop
- 0xa4, // PUSH
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/stop.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
- 0xb7, 0x01
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/string.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-// File: StringMin1.hid.txt
-// String Min defined, but no String Max
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
-// String Min defined, but no String Max
- 0x89, 0x01, // STRING_MINIMUM (1)
- 0x99, 0x20, // STRING_MAXIMUM (32)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/stringindex.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-// File: StringMin1.hid.txt
-// String Min defined, but no String Max
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x08, // USAGE_PAGE (LEDs)
- 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
- 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x03, // REPORT_COUNT (3)
-// String Min defined, but no String Max
- 0x89, 0x01, // STRING_MINIMUM (1)
- 0x99, 0x20, // STRING_MAXIMUM (32)
- 0x79, 0x01, // STRING_MINIMUM (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x09, 0x4B, // USAGE (Generic indicator)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x91, 0x02, // OUTPUT (Data,Var,Abs)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
- 0x19, 0xE0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xE7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x19, 0x00, // USAGE_MINIMUM (No event)
- 0x29, 0x91, // USAGE_MAXIMUM (Keyboard LANG2)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x1C, // REPORT_COUNT (28)
- 0x09, 0xE2, // USAGE (Mute)
- 0x09, 0xB7, // USAGE (Stop)
- 0x09, 0xCD, // USAGE (Play/pause)
- 0x09, 0xEA, // USAGE (Volume Down)
- 0x09, 0xE9, // USAGE (Volume Up)
- 0x09, 0xB6, // USAGE (Scan Previous Track)
- 0x09, 0xB5, // USAGE (Scan Next Track)
- 0x0A, 0x83, 0x01, // USAGE (Control config)
- 0x0A, 0x1A, 0x02, // USAGE (Undo)
- 0x0A, 0x79, 0x02, // USAGE (Redo)
- 0x0A, 0xAB, 0x01, // USAGE (Spell check)
- 0x0A, 0x08, 0x02, // USAGE (Print)
- 0x0A, 0x02, 0x02, // USAGE (Open)
- 0x0A, 0x03, 0x02, // USAGE (Close)
- 0x0A, 0x07, 0x02, // USAGE (Save)
- 0x0A, 0x01, 0x02, // USAGE (New)
- 0x0A, 0x92, 0x01, // USAGE (Calculator)
- 0x0A, 0x9C, 0x01, // USAGE (Logoff)
- 0x09, 0x95, // USAGE (Help)
- 0x0A, 0x23, 0x02, // USAGE (Home)
- 0x0A, 0x89, 0x02, // USAGE (Reply)
- 0x0A, 0x8B, 0x02, // USAGE (Sendto
- 0x0A, 0x8C, 0x02, // USAGE (Send)
- 0x0A, 0x8A, 0x01, // USAGE (Email
- 0x0A, 0x99, 0x01, // USAGE (Chat)
- 0x0A, 0xA7, 0x01, // USAGE (Documents)
- 0x0A, 0xB6, 0x01, // USAGE (Unknown 0x01b6)
- 0x0A, 0xB7, 0x01, // USAGE (Unknown 0x01b7)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x0A, 0x02, 0xFF, // USAGE (Unknown 0xff02)
- 0x26, 0xFF, 0x00, // LOGICAL_MAXIMUM (255)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x80, // USAGE (System Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x03, // REPORT_ID (3)
- 0x19, 0x81, // USAGE_MINIMUM (System Power Down)
- 0x29, 0x83, // USAGE_MAXIMUM (System Wake Up)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x05, // REPORT_COUNT (5)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x04, // REPORT_ID (4)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x0A, 0x01, 0xFE, // USAGE (Unknown 1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0x05, // REPORT_ID (5)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x06, // USAGE (Keyboard)
- 0xA1, 0x02, // COLLECTION (Logical)
- 0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x0A, 0x03, 0xFE, // USAGE (Unknown 0xfe03)
- 0x0A, 0x04, 0xFE, // USAGE (Unknown 0xfe04)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0, // END_COLLECTION
- 0xC0, // END_COLLECTION
- //... //
- 0x05, 0x0C, // USAGE_PAGE (Consumer Devices)
- 0x09, 0x01, // USAGE (Consumer Control)
- 0xA1, 0x01, // COLLECTION (Application)
- 0x85, 0xFF, // REPORT_ID (255)
- 0x05, 0x06, // USAGE_PAGE (Generic Device Controls)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x02, // REPORT_SIZE (2)
- 0x19, 0x24, // USAGE_MINIMUM (Unknown 0x24)
- 0x29, 0x26, // USAGE_MAXIMUM (Unknown 0x26)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x75, 0x06, // REPORT_SIZE (6)
- 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
- 0xC0 // END_COLLECTION
-// };
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/unit.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-// File: UnitExponent1.hid.txt
-// Unit Exponent with non-zero data in the reserved field
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x09, 0x04, // USAGE (Joystick)
- 0xa1, 0x01, // COLLECTION (Application)
- 0x05, 0x02, // USAGE_PAGE (Simulation Controls)
- 0x09, 0xbb, // USAGE (Throttle)
- 0x15, 0x81, // LOGICAL_MINIMUM (-127)
- 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x01, // USAGE (Pointer)
- 0xa1, 0x00, // COLLECTION (Physical)
- 0x09, 0x30, // USAGE (X)
- 0x09, 0x31, // USAGE (Y)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0, // END_COLLECTION
- 0x09, 0x39, // USAGE (Hat switch)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x35, 0x00, // PHYSICAL_MINIMUM (0)
- 0x46, 0x0e, 0x01, // PHYSICAL_MAXIMUM (270)
- 0x65, 0x14, // UNIT (Eng Rot:Angular Pos)
- 0x75, 0x04, // REPORT_SIZE (4)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x09, // USAGE_PAGE (Button)
- 0x19, 0x01, // USAGE_MINIMUM (Button 1)
- 0x29, 0x04, // USAGE_MAXIMUM (Button 4)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
- 0x55, 0x00, // UNIT_EXPONENT (16)
-// Non-zero data in the Reserved field
-// 0x65, 0x00, // UNIT (None)
- 0x67, 0x00, 0x00, 0x00, 0x80, // UNIT (Non-zero value in reserverd)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0 // END_COLLECTION
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/unitexponent.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-// File: UnitExponent1.hid.txt
-// Unit Exponent with non-zero data in the reserved field
-
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x09, 0x04, // USAGE (Joystick)
- 0xa1, 0x01, // COLLECTION (Application)
- 0x05, 0x02, // USAGE_PAGE (Simulation Controls)
- 0x09, 0xbb, // USAGE (Throttle)
- 0x15, 0x81, // LOGICAL_MINIMUM (-127)
- 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x01, // USAGE (Pointer)
- 0xa1, 0x00, // COLLECTION (Physical)
- 0x09, 0x30, // USAGE (X)
- 0x09, 0x31, // USAGE (Y)
- 0x95, 0x02, // REPORT_COUNT (2)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0, // END_COLLECTION
- 0x09, 0x39, // USAGE (Hat switch)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x03, // LOGICAL_MAXIMUM (3)
- 0x35, 0x00, // PHYSICAL_MINIMUM (0)
- 0x46, 0x0e, 0x01, // PHYSICAL_MAXIMUM (270)
- 0x65, 0x14, // UNIT (Eng Rot:Angular Pos)
- 0x75, 0x04, // REPORT_SIZE (4)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x05, 0x09, // USAGE_PAGE (Button)
- 0x19, 0x01, // USAGE_MINIMUM (Button 1)
- 0x29, 0x04, // USAGE_MAXIMUM (Button 4)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x95, 0x04, // REPORT_COUNT (4)
-// Non-zero data in the Reserved field
- 0x55, 0x10, // UNIT_EXPONENT (16)
- 0x65, 0x00, // UNIT (None)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0xc0 // END_COLLECTION
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/voldown.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x22, 0x01
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/data/volup.hid Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-0x21,0x01
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/eabi/GenericHidTestU.def Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/CHidDriverPlugin.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <platform_paths.hrh>
-
-//CAPABILITY CAP_ECOM_PLUGIN
-CAPABILITY CAP_APPLICATION CommDD ProtServ
-
-VENDORID VID_DEFAULT
-
-TARGET chiddriverplugin.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0xE000B181
-
-SOURCEPATH ../src
-SOURCE CHidDriverPluginProxy.cpp
-SOURCE CHidDriverPlugin.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-
-START RESOURCE ../data/E000B181.RSS
-TARGET chiddriverplugin.rsc
-END
-
-LIBRARY ECom.lib
-LIBRARY euser.lib
-LIBRARY generichid.lib
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*TYPE TESTCLASS*/
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#if defined(__S60_)
- // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
- #include <platform_paths.hrh>
-#endif
-
-TARGET GenericHidTest.dll
-TARGETTYPE dll
-UID 0x1000008D 0x101FB3E3
-
-//CAPABILITY ALL -TCB
-CAPABILITY CAP_APPLICATION CommDD ProtServ
-
-DEFFILE GenericHidTest.def
-
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc
-
-SOURCEPATH ../src
-SOURCE GenericHidTest.cpp
-SOURCE GenericHidTestBlocks.cpp
-SOURCE tGenericHIDAPI.cpp
-SOURCE tdialclient.cpp
-SOURCE alarmcontrol.cpp
-SOURCE timer.cpp
-SOURCE CHidDriverPlugin.cpp
-
-LIBRARY euser.lib
-LIBRARY stiftestinterface.lib
-LIBRARY stiftestengine.lib
-
-LIBRARY sysutil.lib
-LIBRARY efsrv.lib
-LIBRARY generichid.lib
-LIBRARY etel3rdparty.lib
-LIBRARY alarmclient.lib
-LIBRARY alarmshared.lib
-
-
-LANG SC
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_ats.pkg Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-;
-; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-;
-
-; Languages
-&EN
-
-; Provide value for uid
-#{"STIF"},(0x00000000),1,1,0,TYPE=SA
-
-; Series60 product id for S60 5.1
-[0x10283160], 0, 0, 0, {"Series60ProductID"}
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Logo
-; None
-
-; Package signature - Optional
-; None
-
-; Start of Package body
-
-; Condition blocks
-; None
-
-; Options list
-; None
-
-; Install files
-"\epoc32\release\armv5\udeb\GenericHidTest.dll"-"c:\Sys\Bin\GenericHidTest.dll"
-"\epoc32\release\armv5\udeb\GenericHidTest.exe" - "C:\Sys\Bin\GenericHidTest.exe"
-
-"\epoc32\release\armv5\udeb\chiddriverplugin.dll"-"C:\Sys\Bin\chiddriverplugin.dll"
-"\epoc32\data\Z\resource\plugins\chiddriverplugin.rsc"-"C:\resource\plugins\chiddriverplugin.rsc"
-
-"..\init\GenericHidTest_ats.ini"-"e:\testing\init\GenericHidTest.ini"
-"..\conf\GenericHidTest.cfg"-"e:\testing\conf\GenericHidTest.cfg"
-
-"..\data\connectad83.hid"-"c:\data\others\connectad83.hid"
-"..\data\delimiter.hid"-"c:\data\others\delimiter.hid"
-"..\data\designator.hid"-"c:\data\others\designator.hid"
-"..\data\designatorindex.hid"-"c:\data\others\designatorindex.hid"
-"..\data\dummyconnect.hid"-"c:\data\others\dummyconnect.hid"
-"..\data\empty.hid"-"c:\data\others\empty.hid"
-"..\data\feature.hid"-"c:\data\others\feature.hid"
-"..\data\feature1.hid"-"c:\data\others\feature1.hid"
-"..\data\headsetcon2.hid"-"c:\data\others\headsetcon2.hid"
-"..\data\headsetconnect.hid"-"c:\data\others\headsetconnect.hid"
-"..\data\headsetvolumeup.hid"-"c:\data\others\headsetvolumeup.hid"
-"..\data\headsetvolumeupm.hid"-"c:\data\others\headsetvolumeupm.hid"
-"..\data\hook.hid"-"c:\data\others\hook.hid"
-"..\data\hookconnect.hid"-"c:\data\others\hookconnect.hid"
-"..\data\inputdata.hid"-"c:\data\others\inputdata.hid"
-"..\data\multipagec.hid"-"c:\data\others\multipagec.hid"
-"..\data\multipagein.hid"-"c:\data\others\multipagein.hid"
-"..\data\multiple_usage_page_connect.hid"-"c:\data\others\multiple_usage_page_connect.hid"
-"..\data\mute.hid"-"c:\data\others\mute.hid"
-"..\data\next.hid"-"c:\data\others\next.hid"
-"..\data\output.hid"-"c:\data\others\output.hid"
-"..\data\output1.hid"-"c:\data\others\output1.hid"
-"..\data\physicalmax.hid"-"c:\data\others\physicalmax.hid"
-"..\data\play.hid"-"c:\data\others\play.hid"
-"..\data\pop.hid"-"c:\data\others\pop.hid"
-"..\data\prev.hid"-"c:\data\others\prev.hid"
-"..\data\push.hid"-"c:\data\others\push.hid"
-"..\data\stop.hid"-"c:\data\others\stop.hid"
-"..\data\string.hid"-"c:\data\others\string.hid"
-"..\data\stringindex.hid"-"c:\data\others\stringindex.hid"
-"..\data\unit.hid"-"c:\data\others\unit.hid"
-"..\data\unitexponent.hid"-"c:\data\others\unitexponent.hid"
-"..\data\voldown.hid"-"c:\data\others\voldown.hid"
-"..\data\volup.hid"-"c:\data\others\volup.hid"
-
-"..\data\localdesignatorindex.hid"-"c:\data\others\localdesignatorindex.hid"
-"..\data\localdesignatorminimum.hid"-"c:\data\others\localdesignatorminimum.hid"
-"..\data\localdesignatormaximum.hid"-"c:\data\others\localdesignatormaximum.hid"
-
-"..\data\localstringindex.hid"-"c:\data\others\localstringindex.hid"
-"..\data\localstringminimum.hid"-"c:\data\others\localstringminimum.hid"
-"..\data\localstringmaximum.hid"-"c:\data\others\localstringmaximum.hid"
-
-"..\data\localdelimiter.hid"-"c:\data\others\localdelimiter.hid"
-"..\data\localdelimiter_lonelydelimiter.hid"-"c:\data\others\localdelimiter_lonelydelimiter.hid"
-"..\data\localdelimiter_nesteddelimiter.hid"-"c:\data\others\localdelimiter_nesteddelimiter.hid"
-
-"..\data\localusage.hid"-"c:\data\others\localusage.hid"
-"..\data\localusageminimum.hid"-"c:\data\others\localusageminimum.hid"
-"..\data\localusagemaximum.hid"-"c:\data\others\localusagemaximum.hid"
-
-"..\data\localitem_unknown.hid"-"c:\data\others\localitem_unknown.hid"
-
-"..\data\globalphysicalmin.hid"-"c:\data\others\globalphysicalmin.hid"
-"..\data\globalphysicalmax.hid"-"c:\data\others\globalphysicalmax.hid"
-"..\data\globalunit.hid"-"c:\data\others\globalunit.hid"
-"..\data\globalunit_smallvalue.hid"-"c:\data\others\globalunit_smallvalue.hid"
-"..\data\globalunitexponent.hid"-"c:\data\others\globalunitexponent.hid"
-"..\data\globalunitexponent2.hid"-"c:\data\others\globalunitexponent2.hid"
-"..\data\globalpush.hid"-"c:\data\others\globalpush.hid"
-"..\data\globalpop.hid"-"c:\data\others\globalpop.hid"
-"..\data\globalpop_withoutpush.hid"-"c:\data\others\globalpop_withoutpush.hid"
-"..\data\globaitem_unknown.hid"-"c:\data\others\globaitem_unknown.hid"
-
-"..\data\mainoutputtag.hid"-"c:\data\others\mainoutputtag.hid"
-"..\data\mainfeature.hid"-"c:\data\others\mainfeature.hid"
-
-"..\data\longitem.hid"-"c:\data\others\longitem.hid"
-"..\data\handleitem_withindelimiter.hid"-"c:\data\others\handleitem_withindelimiter.hid"
-
-"..\data\mainitem_unknown.hid"-"c:\data\others\mainitem_unknown.hid"
-
-"..\data\checkusageminandmax.hid"-"c:\data\others\checkusageminandmax.hid"
-"..\data\checkusageminandmax2.hid"-"c:\data\others\checkusageminandmax2.hid"
-"..\data\checkusageminandmax3.hid"-"c:\data\others\checkusageminandmax3.hid"
-
-"..\data\checkdesignatorminandmax.hid"-"c:\data\others\checkdesignatorminandmax.hid"
-"..\data\checkdesignatorminandmax2.hid"-"c:\data\others\checkdesignatorminandmax2.hid"
-"..\data\checkdesignatorminandmax3.hid"-"c:\data\others\checkdesignatorminandmax3.hid"
-
-"..\data\checkstringminandmax.hid"-"c:\data\others\checkstringminandmax.hid"
-"..\data\checkstringminandmax2.hid"-"c:\data\others\checkstringminandmax2.hid"
-"..\data\checkstringminandmax3.hid"-"c:\data\others\checkstringminandmax3.hid"
-
-"..\data\checkmandatoryfieldexistence.hid"-"c:\data\others\checkmandatoryfieldexistence.hid"
-"..\data\checkmandatoryfieldexistence2.hid"-"c:\data\others\checkmandatoryfieldexistence2.hid"
-"..\data\checkmandatoryfieldexistence3.hid"-"c:\data\others\checkmandatoryfieldexistence3.hid"
-
-"..\data\checkforfielderrors.hid"-"c:\data\others\checkforfielderrors.hid"
-"..\data\checkforfielderrors2.hid"-"c:\data\others\checkforfielderrors2.hid"
-
-"..\data\checklogicalminandmax.hid"-"c:\data\others\checklogicalminandmax.hid"
-
-"..\data\checkfieldbitneeded.hid"-"c:\data\others\checkfieldbitneeded.hid"
-
-"..\data\checkformainerrors.hid"-"c:\data\others\checkformainerrors.hid"
-"..\data\checkformainerrors2.hid"-"c:\data\others\checkformainerrors2.hid"
-"..\data\checkformainerrors3.hid"-"c:\data\others\checkformainerrors3.hid"
-
-"..\data\checkparseerrors.hid"-"c:\data\others\checkparseerrors.hid"
-"..\data\checkparseerrors2.hid"-"c:\data\others\checkparseerrors2.hid"
-"..\data\checkparseerrors3.hid"-"c:\data\others\checkparseerrors3.hid"
-
-"..\data\checkforcollectionerrors.hid"-"c:\data\others\checkforcollectionerrors.hid"
-
-; Embedded SIS
-; None
-
-; End of Package body
-
-; PKG dependencies
-; None
-
-; PKG capabilities
-; None
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_exe.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*TYPE TESTCLASS*/
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#if defined(__S60_)
- #include <platform_paths.hrh>
-#endif
-
-TARGET GenericHidTest.exe
-TARGETTYPE exe
-UID 0 0xEF4892C6
-
-CAPABILITY LocalServices CommDD
-
-
-MW_LAYER_SYSTEMINCLUDE
-
-SOURCEPATH ../src
-
-SOURCE GenericHidTest_exe.cpp
-
-LIBRARY euser.lib
-LIBRARY stiftestinterface.lib
-
-EPOCSTACKSIZE 40960
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_phone.pkg Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-;
-; Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-;
-
-; Languages
-&EN
-
-; Provide value for uid
-#{"STIF"},(0x00000000),1,1,0,TYPE=SA
-
-; Series60 product id for S60 5.1
-[0x10283160], 0, 0, 0, {"Series60ProductID"}
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Logo
-; None
-
-; Package signature - Optional
-; None
-
-; Start of Package body
-
-; Condition blocks
-; None
-
-; Options list
-; None
-
-; Install files
-"\epoc32\release\armv5\udeb\GenericHidTest.dll"-"c:\Sys\Bin\GenericHidTest.dll"
-"\epoc32\release\armv5\udeb\GenericHidTest.exe" - "C:\Sys\Bin\GenericHidTest.exe"
-
-"\epoc32\release\armv5\udeb\chiddriverplugin.dll"-"C:\Sys\Bin\chiddriverplugin.dll"
-"\epoc32\data\Z\resource\plugins\chiddriverplugin.rsc"-"C:\resource\plugins\chiddriverplugin.rsc"
-
-"..\init\GenericHidTest_phone.ini"-"c:\testframework\testframework.ini"
-"..\conf\GenericHidTest.cfg"-"c:\testframework\GenericHidTest.cfg"
-
-"..\data\connectad83.hid"-"c:\data\others\connectad83.hid"
-"..\data\delimiter.hid"-"c:\data\others\delimiter.hid"
-"..\data\designator.hid"-"c:\data\others\designator.hid"
-"..\data\designatorindex.hid"-"c:\data\others\designatorindex.hid"
-"..\data\dummyconnect.hid"-"c:\data\others\dummyconnect.hid"
-"..\data\empty.hid"-"c:\data\others\empty.hid"
-"..\data\feature.hid"-"c:\data\others\feature.hid"
-"..\data\feature1.hid"-"c:\data\others\feature1.hid"
-"..\data\headsetcon2.hid"-"c:\data\others\headsetcon2.hid"
-"..\data\headsetconnect.hid"-"c:\data\others\headsetconnect.hid"
-"..\data\headsetvolumeup.hid"-"c:\data\others\headsetvolumeup.hid"
-"..\data\headsetvolumeupm.hid"-"c:\data\others\headsetvolumeupm.hid"
-"..\data\hook.hid"-"c:\data\others\hook.hid"
-"..\data\hookconnect.hid"-"c:\data\others\hookconnect.hid"
-"..\data\inputdata.hid"-"c:\data\others\inputdata.hid"
-"..\data\multipagec.hid"-"c:\data\others\multipagec.hid"
-"..\data\multipagein.hid"-"c:\data\others\multipagein.hid"
-"..\data\multiple_usage_page_connect.hid"-"c:\data\others\multiple_usage_page_connect.hid"
-"..\data\mute.hid"-"c:\data\others\mute.hid"
-"..\data\next.hid"-"c:\data\others\next.hid"
-"..\data\output.hid"-"c:\data\others\output.hid"
-"..\data\output1.hid"-"c:\data\others\output1.hid"
-"..\data\physicalmax.hid"-"c:\data\others\physicalmax.hid"
-"..\data\play.hid"-"c:\data\others\play.hid"
-"..\data\pop.hid"-"c:\data\others\pop.hid"
-"..\data\prev.hid"-"c:\data\others\prev.hid"
-"..\data\push.hid"-"c:\data\others\push.hid"
-"..\data\stop.hid"-"c:\data\others\stop.hid"
-"..\data\string.hid"-"c:\data\others\string.hid"
-"..\data\stringindex.hid"-"c:\data\others\stringindex.hid"
-"..\data\unit.hid"-"c:\data\others\unit.hid"
-"..\data\unitexponent.hid"-"c:\data\others\unitexponent.hid"
-"..\data\voldown.hid"-"c:\data\others\voldown.hid"
-"..\data\volup.hid"-"c:\data\others\volup.hid"
-"..\data\UsagePoC.hid"-"c:\data\others\UsagePoC.hid"
-
-"..\data\localdesignatorindex.hid"-"c:\data\others\localdesignatorindex.hid"
-"..\data\localdesignatorminimum.hid"-"c:\data\others\localdesignatorminimum.hid"
-"..\data\localdesignatormaximum.hid"-"c:\data\others\localdesignatormaximum.hid"
-
-"..\data\localstringindex.hid"-"c:\data\others\localstringindex.hid"
-"..\data\localstringminimum.hid"-"c:\data\others\localstringminimum.hid"
-"..\data\localstringmaximum.hid"-"c:\data\others\localstringmaximum.hid"
-
-"..\data\localdelimiter.hid"-"c:\data\others\localdelimiter.hid"
-"..\data\localdelimiter_lonelydelimiter.hid"-"c:\data\others\localdelimiter_lonelydelimiter.hid"
-"..\data\localdelimiter_nesteddelimiter.hid"-"c:\data\others\localdelimiter_nesteddelimiter.hid"
-
-"..\data\localusage.hid"-"c:\data\others\localusage.hid"
-"..\data\localusageminimum.hid"-"c:\data\others\localusageminimum.hid"
-"..\data\localusagemaximum.hid"-"c:\data\others\localusagemaximum.hid"
-
-"..\data\localitem_unknown.hid"-"c:\data\others\localitem_unknown.hid"
-
-"..\data\globalphysicalmin.hid"-"c:\data\others\globalphysicalmin.hid"
-"..\data\globalphysicalmax.hid"-"c:\data\others\globalphysicalmax.hid"
-"..\data\globalunit.hid"-"c:\data\others\globalunit.hid"
-"..\data\globalunit_smallvalue.hid"-"c:\data\others\globalunit_smallvalue.hid"
-"..\data\globalunitexponent.hid"-"c:\data\others\globalunitexponent.hid"
-"..\data\globalunitexponent2.hid"-"c:\data\others\globalunitexponent2.hid"
-"..\data\globalpush.hid"-"c:\data\others\globalpush.hid"
-"..\data\globalpop.hid"-"c:\data\others\globalpop.hid"
-"..\data\globalpop_withoutpush.hid"-"c:\data\others\globalpop_withoutpush.hid"
-"..\data\globaitem_unknown.hid"-"c:\data\others\globaitem_unknown.hid"
-
-"..\data\mainoutputtag.hid"-"c:\data\others\mainoutputtag.hid"
-"..\data\mainfeature.hid"-"c:\data\others\mainfeature.hid"
-
-"..\data\longitem.hid"-"c:\data\others\longitem.hid"
-"..\data\handleitem_withindelimiter.hid"-"c:\data\others\handleitem_withindelimiter.hid"
-
-"..\data\mainitem_unknown.hid"-"c:\data\others\mainitem_unknown.hid"
-
-"..\data\checkusageminandmax.hid"-"c:\data\others\checkusageminandmax.hid"
-"..\data\checkusageminandmax2.hid"-"c:\data\others\checkusageminandmax2.hid"
-"..\data\checkusageminandmax3.hid"-"c:\data\others\checkusageminandmax3.hid"
-
-"..\data\checkdesignatorminandmax.hid"-"c:\data\others\checkdesignatorminandmax.hid"
-"..\data\checkdesignatorminandmax2.hid"-"c:\data\others\checkdesignatorminandmax2.hid"
-"..\data\checkdesignatorminandmax3.hid"-"c:\data\others\checkdesignatorminandmax3.hid"
-
-"..\data\checkstringminandmax.hid"-"c:\data\others\checkstringminandmax.hid"
-"..\data\checkstringminandmax2.hid"-"c:\data\others\checkstringminandmax2.hid"
-"..\data\checkstringminandmax3.hid"-"c:\data\others\checkstringminandmax3.hid"
-
-"..\data\checkmandatoryfieldexistence.hid"-"c:\data\others\checkmandatoryfieldexistence.hid"
-"..\data\checkmandatoryfieldexistence2.hid"-"c:\data\others\checkmandatoryfieldexistence2.hid"
-"..\data\checkmandatoryfieldexistence3.hid"-"c:\data\others\checkmandatoryfieldexistence3.hid"
-
-"..\data\checkforfielderrors.hid"-"c:\data\others\checkforfielderrors.hid"
-"..\data\checkforfielderrors2.hid"-"c:\data\others\checkforfielderrors2.hid"
-
-"..\data\checklogicalminandmax.hid"-"c:\data\others\checklogicalminandmax.hid"
-
-"..\data\checkfieldbitneeded.hid"-"c:\data\others\checkfieldbitneeded.hid"
-
-"..\data\checkformainerrors.hid"-"c:\data\others\checkformainerrors.hid"
-"..\data\checkformainerrors2.hid"-"c:\data\others\checkformainerrors2.hid"
-"..\data\checkformainerrors3.hid"-"c:\data\others\checkformainerrors3.hid"
-
-"..\data\checkparseerrors.hid"-"c:\data\others\checkparseerrors.hid"
-"..\data\checkparseerrors2.hid"-"c:\data\others\checkparseerrors2.hid"
-"..\data\checkparseerrors3.hid"-"c:\data\others\checkparseerrors3.hid"
-
-"..\data\checkforcollectionerrors.hid"-"c:\data\others\checkforcollectionerrors.hid"
-
-; Embedded SIS
-; None
-
-; End of Package body
-
-; PKG dependencies
-; None
-
-; PKG capabilities
-; None
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build file
-*
-*/
-
-
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_TESTEXPORTS
-
-PRJ_EXPORTS
-
-PRJ_TESTMMPFILES
-GenericHidTest.mmp
-GenericHidTest_exe.mmp
-CHidDriverPlugin.mmp
-
-
-PRJ_MMPFILES
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/build_sis_ats.bat Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-@rem
-@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem Description: Test script config file
-@rem
-@rem
-
-
-call bldmake bldfiles
-call abld test build armv5
-call makesis GenericHidTest_ats.pkg
-call signsis GenericHidTest_ats.sis GenericHidTest_ats.sisx rd.cer rd-key.pem
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/build_sis_phone.bat Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-@rem
-@rem Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem Description: Test script config file
-@rem
-@rem
-
-rd /q /s x:\epoc32\build
-del GenericHidTest_phone.sisx
-
-call bldmake bldfiles
-call abld test build armv5 udeb
-call makesis GenericHidTest_phone.pkg
-call signsis GenericHidTest_phone.sis GenericHidTest_phone.sisx rd.cer rd-key.pem
-
-del GenericHidTest_phone.sis
-call pause
\ No newline at end of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/CHidDriverPlugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef REFERENCE_HIDDRIVER_IMPL_H
-#define REFERENCE_HIDDRIVER_IMPL_H
-
-#include <hidinterfaces.h>
-
-NONSHARABLE_CLASS(CHidDriverPlugin) : public CHidDriver
- {
- public:
-
- /**
- * Two-phased constructor.
- */
- static CHidDriverPlugin* NewL(MDriverAccess* aHid);
-
- TInt CanHandleReportL(CReportRoot* aReportDescriptor);
-
- TInt DataIn(CHidTransport::THidChannelType aChannel,
- const TDesC8& aPayload);
-
- void Disconnected(TInt aReason);
- void InitialiseL(TInt aConnectionId);
- void StartL(TInt aConnectionId);
- void Stop();
- void CommandResult(TInt aCmdAck);
- TInt SupportedFieldCount();
- void SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg);
-
-private:
- CHidDriverPlugin();
-
-private: // Data
-
- };
-
-#endif // REFERENCE_HIDDRIVER_IMPL_H
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/GenericHidTest.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,377 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-
-#ifndef GENERICHIDTEST_H
-#define GENERICHIDTEST_H
-
-// INCLUDES
-#include <StifLogger.h>
-#include <TestScripterInternal.h>
-#include <StifTestModule.h>
-#include <TestclassAssert.h>
-
-#include "hidparser.h"
-
-// CONSTANTS
-//const ?type ?constant_var = ?constant;
-
-// MACROS
-//#define ?macro ?macro_def
-#define TEST_CLASS_VERSION_MAJOR 0
-#define TEST_CLASS_VERSION_MINOR 0
-#define TEST_CLASS_VERSION_BUILD 0
-
-#ifdef STIF_LOG
-#undef STIF_LOG
-#endif
-
-#define STIF_LOG( s )\
- {\
- TBuf<KMaxLogData> traceBuf;\
- traceBuf.Append( _L( "[STIF_LOG] " ) );\
- traceBuf.Append( _L( s ) );\
- iLog->Log( _L( s ) );\
- RDebug::Print( traceBuf );\
- }
-
-#define STIF_LOG1( s, v ) \
- {\
- TBuf<KMaxLogData> traceBuf;\
- traceBuf.Append( _L( "[STIF_LOG] " ) );\
- traceBuf.Append( _L( s ) );\
- iLog->Log( _L( s ), v );\
- RDebug::Print( traceBuf, v );\
- }
-
-#define STIF_LOG2( s, v1, v2 ) \
- {\
- TBuf<KMaxLogData> traceBuf;\
- traceBuf.Append( _L( "[STIF_LOG] " ) );\
- traceBuf.Append( _L( s ) );\
- iLog->Log( _L( s ), v1, v2 );\
- RDebug::Print( traceBuf, v1, v2 );\
- }
-
-#define STIF_LOG3( s, v1, v2, v3 ) \
- {\
- TBuf<KMaxLogData> traceBuf;\
- traceBuf.Append( _L( "[STIF_LOG] " ) );\
- traceBuf.Append( _L( s ) );\
- iLog->Log( _L( s ), v1, v2, v3 );\
- RDebug::Print( traceBuf, v1, v2, v3 );\
- }
-
-// Logging path
-//_LIT( KGenericHidTestLogPath, "\\logs\\testframework\\GenericHidTest\\" );
-
-// Logging path for ATS - for phone builds comment this line
-_LIT( KGenericHidTestLogPath, "e:\\testing\\stiflogs\\" );
-
-// Log file
-_LIT( KGenericHidTestLogFile, "GenericHidTest.txt" );
-_LIT( KGenericHidTestLogFileWithTitle, "GenericHidTest_[%S].txt" );
-
-// FUNCTION PROTOTYPES
-//?type ?function_name(?arg_list);
-
-// FORWARD DECLARATIONS
-//class ?FORWARD_CLASSNAME;
-class CGenericHidTest;
-
-class CHidTestLogger;
-class CtGenericHIDAPI;
-//class CMediaControl;
-class CDialClient;
-class CAlarmControl;
-
-// DATA TYPES
-//enum ?declaration
-
-enum TGenericHidTestResult
- {
- ETestCasePassed,
- ETestCaseFailed
- };
-
-//typedef ?declaration
-//extern ?data_type;
-
-// CLASS DECLARATION
-
-NONSHARABLE_CLASS( TGenericHidTestBlockParams )
- {
- public:
- TPtrC iTestBlockName;
-
- TPtrC iTestOption1;
- TPtrC iTestOption2;
- TPtrC iTestOption3;
-
- TInt iTestIntOption1;
- TInt iTestIntOption2;
-
- TChar iTestCharOption1;
- TChar iTestCharOption2;
- };
-
-/**
-* CGenericHidTest test class for STIF Test Framework TestScripter.
-* ?other_description_lines
-*
-* @lib ?library
-* @since ?Series60_version
-*/
-NONSHARABLE_CLASS( CGenericHidTest ) : public CScriptBase
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CGenericHidTest* NewL( CTestModuleIf& aTestModuleIf );
-
- /**
- * Destructor.
- */
- virtual ~CGenericHidTest();
-
- public: // New functions
-
- /**
- * ?member_description.
- * @since ?Series60_version
- * @param ?arg1 ?description
- * @return ?description
- */
- //?type ?member_function( ?type ?arg1 );
-
- public: // Functions from base classes
-
- /**
- * From CScriptBase Runs a script line.
- * @since ?Series60_version
- * @param aItem Script line containing method name and parameters
- * @return Symbian OS error code
- */
- virtual TInt RunMethodL( CStifItemParser& aItem );
-
- protected: // New functions
-
- /**
- * ?member_description.
- * @since ?Series60_version
- * @param ?arg1 ?description
- * @return ?description
- */
- //?type ?member_function( ?type ?arg1 );
-
- protected: // Functions from base classes
-
- /**
- * From ?base_class ?member_description
- */
- //?type ?member_function();
-
- private:
-
- /**
- * C++ default constructor.
- */
- CGenericHidTest( CTestModuleIf& aTestModuleIf );
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
- // Prohibit copy constructor if not deriving from CBase.
- // ?classname( const ?classname& );
- // Prohibit assigment operator if not deriving from CBase.
- // ?classname& operator=( const ?classname& );
-
- /**
- * Frees all resources allocated from test methods.
- * @since ?Series60_version
- */
- void Delete();
-
- /**
- * Test methods are listed below.
- */
-
- virtual TInt ExecuteApiTestBlock( CStifItemParser& aItem );
- virtual TInt ExecuteModuleTestBlock( CStifItemParser& aItem );
- virtual TInt ExecuteBranchTestBlock( CStifItemParser& aItem );
-
- /**
- * Method used to log version of test class
- */
- void SendTestClassVersion();
-
- //ADD NEW METHOD DEC HERE
- //[TestMethods] - Do not remove
-
- void GetTestBlockParamsL( CStifItemParser& aItem );
-
- void DoExecuteApiTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult );
- void DoExecuteModuleTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult );
- void DoExecuteBranchTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult );
-
- void ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
- TInt aTestIntOption, TInt aTestCharOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt ConnectL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt DisconnectL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt DataIn( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt WaitL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateCallL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt AddAlarmL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult );
- virtual TInt DeleteAlarm( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CountryCodeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt VendorIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ProductIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt SetProtocolL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt GetProtocoL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt GetReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt SetReportL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt DataOutL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult);
- virtual TInt GetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt SetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt CommandResultL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportDescriptorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt DeleteReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportGeneratorReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportGeneratorSetFieldL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateReportTranslatorL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateReportTranslator_FieldNullL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateReportTranslator_NotArrayL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt CreateReportTranslator_FieldCountZeroL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt DeleteReportTranslatorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorGetValueL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorGetUsageIdL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorUsageIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorRawValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt ReportTranslatorCountL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt CollectiontypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsPhysicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsLogicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsNamedArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsUsageSwitchL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionIsUsageModifierL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt CollectionIsApplicationL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionCollectionCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionFieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionCollectionByIndexL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt CollectionFieldByIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt ReportrootReportSizeBytes( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldUnitL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldUnitExponentL( TPtrC aTestOption, TGenericHidTestResult& aTestResult);
-
- virtual TInt FieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSizeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldOffsetL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldReportIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsInReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldDesignatorIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldStringIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldHasUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldUsageArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldUsageCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldClearUsageListL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldLastUsageL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldAttributesL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldTypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsVariableL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsConstantL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsDataL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetLogicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetDesignatorMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetDesignatorMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetUsageMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetUsageMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetStringMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetStringMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldSetLogicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetUsageRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetPhysicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetStringRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldSetDesignatorRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsInputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- virtual TInt FieldIsOutputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
- virtual TInt FieldIsFeatureL( TPtrC aTestOption, TGenericHidTestResult& aTestResult );
-
- HBufC8* ConvertArray(const TPtrC& aFilename);
- TUint ConvSingleItem(TBuf8<2>& singleItem);
-
- public: // Data
- // ?one_line_short_description_of_data
- //?data_declaration;
-
- protected: // Data
- // ?one_line_short_description_of_data
- //?data_declaration;
-
- private: // Data
- TGenericHidTestBlockParams iTestBlockParams;
-
- CtGenericHIDAPI* iGenericHIDTest;
- CDialClient* iDialClient;
- CAlarmControl* iAlarmControl;
-
- CParser* iParser;
- // Reserved pointer for future extension
- //TAny* iReserved;
-
- public: // Friend classes
- //?friend_class_declaration;
- protected: // Friend classes
- //?friend_class_declaration;
- private: // Friend classes
- //?friend_class_declaration;
-
- };
-
-#endif // GENERICHIDTEST_H
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/alarmcontrol.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dialhandling class for hid test application
-*
-*/
-
-
-#ifndef C_ALARMCONTROL_H
-#define C_ALARMCONTROL_H
-
-#include <e32base.h>
-#include <ASCliSession.h>
-#include <TestScripterInternal.h>
-#include <StifLogger.h>
-#include "GenericHidTest.h"
-
-// RDebug
-#include <e32debug.h>
-
-NONSHARABLE_CLASS ( CAlarmControl ): public CBase
-{
-public:
- static CAlarmControl* NewL(CStifLogger* aLogger);
- static CAlarmControl* NewLC(CStifLogger* aLogger);
-
- void CreateClockAlarm( TInt aTime );
- void DeleteAlarm();
-public:
-
- virtual ~CAlarmControl();
-
-private:
- CAlarmControl(CStifLogger* aLogger);
- void ConstructL();
-
- RASCliSession iAlarmServer;
- TInt iAlarmID;
- CStifLogger * iLog;
-};
-
-#endif /*ALARMCONTROL_H*/
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/hidreports.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID field descriptor definition
-*
-*/
-
-#ifndef __HIDREPORTS_H
-#define __HIDREPORTS_H
-
-
-#include <e32base.h>
-#include <e32cmn.h>
-
-const TUint headsetconnnection[]={
- 0x95, 0x01, //Report count 1
- 0x05, 0x0b, //Usage page telephony
- 0x09, 0x01, // Usage Phone
- 0xa1, 0x02, // Collection (logical)
- 0x05, 0x09, //Usage button
- 0xc0 //End collection
-};
-
-#endif
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/tdialclient.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dialhandling class for hid test application
-*
-*/
-
-
-#ifndef TDIALCLIENT_H_
-#define TDIALCLIENT_H_
-
-#include <e32base.h>
-#include <Etel3rdParty.h>
-
-NONSHARABLE_CLASS ( CDialClient ): public CActive
- {
-
-public:
-
- static CDialClient* NewL();
- static CDialClient* NewLC();
-
- void ConstructL();
- ~CDialClient();
-
- void CreateCall(const TDesC& aNumber);
- void HangUp();
-
-
-private:
- void RunL();
- void DoCancel();
-
-private:
- CDialClient();
-
- private:
- CTelephony* iTelephony;
- CTelephony::TCallId iCallId;
- CTelephony::TCallParamsV1 iCallParams;
- CTelephony::TCallParamsV1Pckg iCallParamsPckg;
- CActiveSchedulerWait iSyncWaiter;
- TBool iCallStarted;
- };
-
-#endif /*TDIALCLIENT_H_*/
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/tgenerichidapi.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,340 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID generic api test class
-*
-*/
-
-#ifndef __TESTGEHERICHIDAPI_H
-#define __TESTGEHERICHIDAPI_H
-
-
-#include <e32base.h>
-#include <hidinterfaces.h>
-#include <hidgeneric.h>
-#include "hidreportgenerator.h"
-#include "hidtranslate.h"
-
-#include "CHidDriverPlugin.h"
-#include "hiduids.h"
-
-
-/**
- * HID generic api test class
- *
- * @lib
- * @since S60 v.3.2
- */
-NONSHARABLE_CLASS(CtGenericHIDAPI): public CBase, public MTransportLayer
- {
- public:
- static CtGenericHIDAPI* NewL();
- static CtGenericHIDAPI* NewLC();
-
- /**
- * Destructor.
- */
- virtual ~CtGenericHIDAPI();
-
- public:
-
- /**
- * Connect
- *
- * @since S60 v.3.2
- * @param aConnectionId connection id
- * @param aDescriptor report descriptor
- * @return None
- */
- void ConnectL(TInt aConnectionId, const TDesC8& aDescriptor);
-
- /**
- * Disconnect
- *
- * @since S60 v.3.2
- * @param aConnectionId a connection id
- * @return None
- */
- void DisconnectL(TInt aConnectionId);
-
- /**
- * DataIn
- *
- * @since S60 v.3.2
- * @param aConnectionId connection id
- * @param aDescriptor report descriptor
- * @return error code
- */
- TInt DataInL(TInt aConnectionId, const TDesC8& aDescriptor);
-
- TInt RunCountryCodeL();
-
- TInt RunVendorIdL();
-
- TInt RunProductIdL( );
-
- TInt RunSetProtocolL();
-
- TInt RunGetProtocoL( );
-
- TInt RunGetReportL( );
-
- TInt RunSetReportL(const TDesC8& aDescriptor );
-
- TInt RunDataOutL( const TDesC8& aDescriptor );
-
- TInt GetGetIdleL( );
-
- TInt RunSetIdleL( );
-
- TInt GetCommandResultL( );
-
- TInt GetReportDescriptorL();
-
- TInt CreateReportGeneratorL();
-
- TInt DeleteReportGeneratorL();
-
- TInt ReportGeneratorReport();
-
- TInt ReportGeneratorSetFieldL( TBool aIsArray, TBool aOutOfRange, TBool aFieldNull, TBool aFieldCountZero, TBool aExistingUsageId, TBool aBadIndex );
-
- TInt CreateReportTranslatorL( const TDesC8& aDescriptor, TBool aIsArray, TBool aFieldNull, TBool aFieldCountZero);
-
- //TInt CreateReportTranslator_FieldNullL( const TDesC8& aDescriptor );
-
- TInt DeleteReportTranslatorL( );
-
- TInt ReportTranslatorGetValueL( );
-
- TInt ReportTranslatorValueL( );
-
- TInt ReportTranslatorGetUsageIdL( TBool aBadControlIndex );
-
- TInt ReportTranslatorUsageIdL( );
-
- TInt ReportTranslatorRawValueL( );
-
- TInt ReportTranslatorCountL( );
-
- TInt CollectiontypeL( );
- TInt CollectionIsPhysicalL( );
- TInt CollectionIsLogicalL( );
- TInt CollectionIsReportL( );
- TInt CollectionIsNamedArrayL( );
- TInt CollectionIsUsageSwitchL( );
- TInt CollectionIsUsageModifierL( );
-
- TInt CollectionIsApplicationL( );
- TInt CollectionUsagePageL( );
- TInt CollectionUsageL( );
- TInt CollectionCollectionCountL( );
- TInt CollectionFieldCountL( );
- TInt CollectionCollectionByIndexL( TBool aPresent );
- TInt CollectionFieldByIndexL( );
-
- TInt ReportrootReportSizeBytes( );
-
-
- TInt FieldLogicalMaxL( );
- TInt FieldPhysicalMinL( );
- TInt FieldPhysicalMaxL( );
- TInt FieldUnitL( );
- TInt FieldUnitExponentL( );
- TInt FieldCountL( );
- TInt FieldSizeL( );
- TInt FieldOffsetL( TBool setReport );
- TInt FieldReportIdL( );
- TInt FieldIsInReportL( );
- TInt FieldUsagePageL( );
- TInt FieldDesignatorIndexL( );
- TInt FieldStringIndexL( );
- TInt FieldHasUsageL( );
- TInt FieldUsageArrayL( );
- TInt FieldUsageL( );
- TInt FieldUsageCountL( );
- TInt FieldClearUsageListL( );
- TInt FieldLastUsageL( TBool empty );
- TInt FieldAttributesL( );
- TInt FieldTypeL( );
- TInt FieldIsArrayL( );
- TInt FieldIsVariableL( );
- TInt FieldIsConstantL( );
- TInt FieldIsDataL( );
- TInt FieldSetLogicalMinL();
- TInt FieldSetLogicalMaxL( );
- TInt FieldSetPhysicalMinL( );
- TInt FieldSetPhysicalMaxL( );
- TInt FieldSetDesignatorMinL( );
- TInt FieldSetDesignatorMaxL( );
- TInt FieldSetUsageMinL( );
- TInt FieldSetUsageMaxL( );
- TInt FieldSetStringMinL( );
- TInt FieldSetStringMaxL( );
- TInt FieldSetLogicalRangeL( );
- TInt FieldSetUsageRangeL( );
- TInt FieldSetPhysicalRangeL( );
- TInt FieldSetStringRangeL( );
- TInt FieldSetDesignatorRangeL( );
- TInt FieldIsInputL( );
- TInt FieldIsOutputL( );
- TInt FieldIsFeatureL( );
-
-
-
-private: //from MTransportLayer
-
- /**
- * Request for the country code of the given device.
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @return country code.
- */
- TUint CountryCodeL(TInt aConnID);
-
- /**
- * Request for the vendor identifier for the given device.
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @return vendor id.
- */
- TUint VendorIdL(TInt aConnID);
-
- /**
- * Request for the product identifier for the given device.
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @return product id.
- */
- TUint ProductIdL(TInt aConnID);
-
- /**
- * Request for the current device report protocol. The protocol will be
- * received as a control report via the CHidTransport::DataIn function
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aInterface The interface we want to get the protocol from
- * @return None.
- */
- void GetProtocolL(TInt aConnID, TUint16 aInterface);
-
- /**
- * Request to put the device in the specified protocol
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aValue The requested protocol for the device (boot or report)
- * @param aInterface The interface we want to set the protocol for
- * @return None.
- */
- void SetProtocolL(TInt aConnID, TUint16 aValue,
- TUint16 aInterface);
-
- /**
- * Request for a device report. The data will be received as a control report
- * via the CHidTransport::DataIn function
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aReportType The type of report (input/output/feature) requested
- * @param aReportID The specific report required
- * @param aInterface The interface we want the report from
- * @param aLength The expected length of the report buffer
- * @return None.
- */
- void GetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID,
- TUint16 aInterface, TUint16 aLength);
-
- /**
- * Request to send a report to a device. The response will be reported via the
- * CHidTransport::CommandResult function
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aReportType The type of report (input/output/feature) requested
- * @param aReportID The specific report required to set
- * @param aInterface The interface we want to send the report to
- * @param aReport The report payload to be sent to the device
- * @return None.
- */
- void SetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID,
- TUint16 aInterface, const TDesC8& aReport);
-
- /**
- * Request to send data to a device. There are no responses to this report from device.
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param @param aReportID The specific report required
- * @param aInterface The interface we want to send the report to
- * @param aReport The report payload to be sent to the device
- * @return None.
- */
- void DataOutL(TInt aConnID, TUint8 aReportID,
- TUint16 aInterface, const TDesC8& aReport);
-
- /**
- * Request for the current idle rate of a report from the device. The response
- * will be recevied via the CHidTransport::DataIn function
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aReportID The specific report to be queried
- * @param aInterface The interface we want to query for idle rate
- * @return None.
- */
- void GetIdleL(TInt aConnID, TUint8 aReportID,
- TUint16 aInterface);
-
- /**
- * Request to set the current idle rate for a report on the device.
- * The response will be received via the CHidTransport::CommandResult function
- *
- * @since S60 v3.2
- * @param aConnID The device identifier
- * @param aReportID The specific report to be queried
- * @param aDuration The time period between idle reports (4ms per bit. An
- * interval of 0 disables idle reports so that Interrupt reports are only ever
- * received when the reported data has changed
- * @param aReportID The specific report to be queried
- * @param aInterface The interface we want to query for idle rate
- * @return None.
- */
- void SetIdleL(TInt aConnID, TUint8 aDuration, TUint8 aReportID,
- TUint16 aInterface);
-
-
-private:
- CtGenericHIDAPI();
- void ConstructL();
-
- const CField* CreateConstCFieldL();
- CField* CreateCFieldL();
-
-private:
- CGenericHid* iGenHID;
- MDriverAccess* iDriverAcces;
- CReportGenerator* iReportGenerator;
- TReportTranslator* iTranslator;
-
- CHidDriver* iHidDriver;
-
- RPointerArray<CField> iFieldList;
- };
-#endif
-
-
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/timer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid timeout timer
-*
-*/
-
-#ifndef C_TIMER_H
-#define C_TIMER_H
-
-#include <e32base.h>
-
-
-/**
- * HID headset driver class
- *
- * This class will notify an object after a specified timeout.
- *
- * @since S60 v3.2
- */
-NONSHARABLE_CLASS ( CWaitTimer ) : public CTimer
- {
-public:
- /**
- * Two-phased constructor.
- * @param aPriority priority to use for this timer
- * @param aTimeOutNotify object to notify of timeout event
- */
- static CWaitTimer* NewL( TTimeIntervalMicroSeconds32 aTimeOutTime );
-
- /**
- * Two-phased constructor.
- * @param aPriority priority to use for this timer
- * @param aTimeOutNotify object to notify of timeout event
- */
- static CWaitTimer* NewLC(TTimeIntervalMicroSeconds32 aTimeOutTime );
-
- /**
- * Destructor
- */
- ~CWaitTimer();
-
-protected:
-
- /**
- * From CTimer
- * Invoked when a timeout occurs
- *
- * @since S60 v3.2
- * @return None.
- */
- virtual void RunL();
-
-private:
- CWaitTimer();
- void ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime );
-
-private: // Member variables
- CActiveSchedulerWait iSyncWaiter;
-
- };
-#endif // C_TIMER_H
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/init/GenericHidTest_ats.ini Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-#
-# This is STIF initialization file
-# Comment lines start with '#'-character.
-# See STIF TestFramework users guide.doc for instructions
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set following test engine settings:
-# - Set Test Reporting mode. TestReportMode's possible values are:
-# + 'Summary': Summary of the tested test cases.
-# + 'Environment': Hardware and software info.
-# + 'TestCases': Test case report.
-# + 'FullReport': Set of all above ones.
-# + Example 'TestReportMode= Summary TestCases'
-#
-# - CreateTestReport setting controls report creation mode
-# + YES, Test report will created.
-# + NO, No Test report.
-#
-# - File path indicates the base path of the test report.
-# - File name indicates the name of the test report.
-#
-# - File format indicates the type of the test report.
-# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
-# + HTML, Test report will be html type, for example 'TestReport.html'.
-# + XML, Test report will be xml type, for example 'TestReport.xml'.
-# Note, that xml format is available only when output is set to FILE.
-#
-# - File output indicates output source of the test report.
-# + FILE, Test report logging to file.
-# + RDEBUG, Test report logging to using rdebug.
-#
-# - File Creation Mode indicates test report overwriting if file exist.
-# + OVERWRITE, Overwrites if the Test report file exist.
-# + APPEND, Continue logging after the old Test report information if
-# report exist.
-# - Sets a device reset module's dll name(Reboot).
-# + If Nokia specific reset module is not available or it is not correct one
-# StifHWResetStub module may use as a template for user specific reset
-# module.
-# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
-# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
-#
-
-[Engine_Defaults]
-
-TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
- 'TestCases' or 'FullReport'
-
-CreateTestReport= YES # Possible values: YES or NO
-
-TestReportFilePath= e:\testing\logs\
-TestReportFileName= GenericHidTest_TestReport
-
-TestReportFormat= TXT # Possible values: TXT, HTML or XML
-TestReportOutput= FILE # Possible values: FILE or RDEBUG
-TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
-
-DisableMeasurement= stifmeasurementdisablenone # Possible values are:
- # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
- # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
- # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
- # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
-
-Timeout= 0 # Default timeout value for each test case. In milliseconds
-UITestingSupport= YES # Possible values: YES or NO
-#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
-[End_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Module configurations start
-# Modules are added between module tags
-# tags. Module name is specified after ModuleName= tag, like
-# ModuleName= GenericHidTestGenericHidTestGenericHidTest
-# Modules might have initialisation file, specified as
-# IniFile= c:\testframework\YYYYYY
-# Modules might have several configuration files, like
-# TestCaseFile= c:\testframework\NormalCases.txt
-# TestCaseFile= c:\testframework\SmokeCases.txt
-# TestCaseFile= c:\testframework\ManualCases.txt
-
-# (TestCaseFile is synonym for old term ConfigFile)
-
-# Following case specifies demo module settings. Demo module
-# does not read any settings from file, so tags
-# IniFile and TestCaseFile are not used.
-# In the simplest case it is enough to specify only the
-# name of the test module when adding new test module
-
-[New_Module]
-ModuleName= testscripter
-TestCaseFile= e:\testing\conf\GenericHidTest.cfg
-[End_Module]
-
-
-# Load testmoduleGenericHidTest, optionally with initialization file and/or test case files
-#[New_Module]
-#ModuleName= testmodulexxx
-
-#TestModuleGenericHidTest used initialization file
-#IniFile= c:\testframework\init.txt
-
-#TestModuleGenericHidTest used configuration file(s)
-#TestCaseFile= c:\testframework\testcases1.cfg
-#TestCaseFile= c:\testframework\testcases2.cfg
-#TestCaseFile= c:\testframework\manualtestcases.cfg
-
-#[End_Module]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set STIF logging overwrite parameters for Logger.
-# Hardware and emulator environment logging path and styles can
-# be configured from here to overwrite the Logger's implemented values.
-#
-# Settings description:
-# - Indicates option for creation log directory/directories. If log directory/directories
-# is/are not created by user they will make by software.
-# + YES, Create log directory/directories if not allready exist.
-# + NO, Log directory/directories not created. Only created one is used.
-#
-# - Overwrite emulator path setting.
-# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
-# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
-# will be 'C:\LOGS\TestFramework\LOGS\Module\'
-#
-# - Overwrite emulator's logging format.
-# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
-# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
-#
-# - Overwrited emulator logging output source.
-# + FILE, Logging to file(s).
-# + RDEBUG, Logging to using rdebug(s).
-#
-# - Overwrite hardware path setting (Same description as above in emulator path).
-# - Overwrite hardware's logging format(Same description as above in emulator format).
-# - Overwrite hardware's logging output source(Same description as above in emulator output).
-#
-# - File Creation Mode indicates file overwriting if file exist.
-# + OVERWRITE, Overwrites if file(s) exist.
-# + APPEND, Continue logging after the old logging information if file(s) exist.
-#
-# - Will thread id include to the log filename.
-# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
-# + NO, No thread id to log file(s), Example filename 'Module.txt'.
-#
-# - Will time stamps include the to log file.
-# + YES, Time stamp added to each line in log file(s). Time stamp is
-# for example'12.Nov.2003 115958 LOGGING INFO'
-# + NO, No time stamp(s).
-#
-# - Will line breaks include to the log file.
-# + YES, Each logging event includes line break and next log event is in own line.
-# + NO, No line break(s).
-#
-# - Will event ranking include to the log file.
-# + YES, Event ranking number added to each line in log file(s). Ranking number
-# depends on environment's tics, for example(includes time stamp also)
-# '012 12.Nov.2003 115958 LOGGING INFO'
-# + NO, No event ranking.
-#
-# - Will write log file in unicode format.
-# + YES, Log file will be written in unicode format
-# + NO, Log will be written as normal, not unicode, file.
-#
-
-[Logger_Defaults]
-
-#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
-#NOTE: TestEngine and TestServer logging settings cannot change here
-
-#CreateLogDirectories= YES # Possible values: YES or NO
-
-#EmulatorBasePath= C:\LOGS\TestFramework\
-#EmulatorFormat= HTML # Possible values: TXT or HTML
-#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
-
-#HardwareBasePath= D:\LOGS\TestFramework\
-#HardwareFormat= HTML # Possible values: TXT or HTML
-#HardwareOutput= FILE # Possible values: FILE or RDEBUG
-
-#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-#ThreadIdToLogFile= YES # Possible values: YES or NO
-#WithTimeStamp= YES # Possible values: YES or NO
-#WithLineBreak= YES # Possible values: YES or NO
-#WithEventRanking= YES # Possible values: YES or NO
-
-#FileUnicode= YES # Possible values: YES or NO
-#AddTestCaseTitle= YES # Possible values: YES or NO
-[End_Logger_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set filters to be used by ConsoleUI.
-# If you want to use filter with ConsoleUI, simply remove comments
-# from section below and provide valid filter entries.
-# Each filter line has to start with "filter= " keyword.
-# Filter can contain special wildcard characters:
-# * which stands for none or any literal;
-# ? which stands for single character.
-# Filters are not case-sensitive.
-
-#[Filters]
-#filter= *math*
-#filter= *radio*
-#[End_Filters]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-# End of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/init/GenericHidTest_phone.ini Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-#
-# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-#
-# This is STIF initialization file
-# Comment lines start with '#'-character.
-# See STIF TestFramework users guide.doc for instructions
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set following test engine settings:
-# - Set Test Reporting mode. TestReportMode's possible values are:
-# + 'Summary': Summary of the tested test cases.
-# + 'Environment': Hardware and software info.
-# + 'TestCases': Test case report.
-# + 'FullReport': Set of all above ones.
-# + Example 'TestReportMode= Summary TestCases'
-#
-# - CreateTestReport setting controls report creation mode
-# + YES, Test report will created.
-# + NO, No Test report.
-#
-# - File path indicates the base path of the test report.
-# - File name indicates the name of the test report.
-#
-# - File format indicates the type of the test report.
-# + TXT, Test report file will be txt type, for example 'TestReport.txt'.
-# + HTML, Test report will be html type, for example 'TestReport.html'.
-# + XML, Test report will be xml type, for example 'TestReport.xml'.
-# Note, that xml format is available only when output is set to FILE.
-#
-# - File output indicates output source of the test report.
-# + FILE, Test report logging to file.
-# + RDEBUG, Test report logging to using rdebug.
-#
-# - File Creation Mode indicates test report overwriting if file exist.
-# + OVERWRITE, Overwrites if the Test report file exist.
-# + APPEND, Continue logging after the old Test report information if
-# report exist.
-# - Sets a device reset module's dll name(Reboot).
-# + If Nokia specific reset module is not available or it is not correct one
-# StifHWResetStub module may use as a template for user specific reset
-# module.
-# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
-# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
-#
-
-[Engine_Defaults]
-
-TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
- 'TestCases' or 'FullReport'
-
-CreateTestReport= YES # Possible values: YES or NO
-
-TestReportFilePath= c:\logs\testframework\GenericHidTest\
-TestReportFileName= testreport
-
-TestReportFormat= TXT # Possible values: TXT, HTML or XML
-TestReportOutput= FILE # Possible values: FILE or RDEBUG
-TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
-
-DisableMeasurement= stifmeasurementdisablenone # Possible values are:
- # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
- # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
- # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
- # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
-
-Timeout= 0 # Default timeout value for each test case. In milliseconds
-UITestingSupport= YES # Possible values: YES or NO
-#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
-[End_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Module configurations start
-# Modules are added between module tags
-# tags. Module name is specified after ModuleName= tag, like
-# ModuleName= GenericHidTestGenericHidTestGenericHidTest
-# Modules might have initialisation file, specified as
-# IniFile= c:\testframework\YYYYYY
-# Modules might have several configuration files, like
-# TestCaseFile= c:\testframework\NormalCases.txt
-# TestCaseFile= c:\testframework\SmokeCases.txt
-# TestCaseFile= c:\testframework\ManualCases.txt
-
-# (TestCaseFile is synonym for old term ConfigFile)
-
-# Following case specifies demo module settings. Demo module
-# does not read any settings from file, so tags
-# IniFile and TestCaseFile are not used.
-# In the simplest case it is enough to specify only the
-# name of the test module when adding new test module
-
-[New_Module]
-ModuleName= testscripter
-TestCaseFile= c:\testframework\GenericHidTest.cfg
-[End_Module]
-
-
-# Load testmoduleGenericHidTest, optionally with initialization file and/or test case files
-#[New_Module]
-#ModuleName= testmodulexxx
-
-#TestModuleGenericHidTest used initialization file
-#IniFile= c:\testframework\init.txt
-
-#TestModuleGenericHidTest used configuration file(s)
-#TestCaseFile= c:\testframework\testcases1.cfg
-#TestCaseFile= c:\testframework\testcases2.cfg
-#TestCaseFile= c:\testframework\manualtestcases.cfg
-
-#[End_Module]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set STIF logging overwrite parameters for Logger.
-# Hardware and emulator environment logging path and styles can
-# be configured from here to overwrite the Logger's implemented values.
-#
-# Settings description:
-# - Indicates option for creation log directory/directories. If log directory/directories
-# is/are not created by user they will make by software.
-# + YES, Create log directory/directories if not allready exist.
-# + NO, Log directory/directories not created. Only created one is used.
-#
-# - Overwrite emulator path setting.
-# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined
-# Logger's path 'D:\\LOGS\\Module\\' with those definition the path
-# will be 'C:\LOGS\TestFramework\LOGS\Module\'
-#
-# - Overwrite emulator's logging format.
-# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
-# + HTML, Log file(s) will be html type(s), for example 'Module.html'.
-#
-# - Overwrited emulator logging output source.
-# + FILE, Logging to file(s).
-# + RDEBUG, Logging to using rdebug(s).
-#
-# - Overwrite hardware path setting (Same description as above in emulator path).
-# - Overwrite hardware's logging format(Same description as above in emulator format).
-# - Overwrite hardware's logging output source(Same description as above in emulator output).
-#
-# - File Creation Mode indicates file overwriting if file exist.
-# + OVERWRITE, Overwrites if file(s) exist.
-# + APPEND, Continue logging after the old logging information if file(s) exist.
-#
-# - Will thread id include to the log filename.
-# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
-# + NO, No thread id to log file(s), Example filename 'Module.txt'.
-#
-# - Will time stamps include the to log file.
-# + YES, Time stamp added to each line in log file(s). Time stamp is
-# for example'12.Nov.2003 115958 LOGGING INFO'
-# + NO, No time stamp(s).
-#
-# - Will line breaks include to the log file.
-# + YES, Each logging event includes line break and next log event is in own line.
-# + NO, No line break(s).
-#
-# - Will event ranking include to the log file.
-# + YES, Event ranking number added to each line in log file(s). Ranking number
-# depends on environment's tics, for example(includes time stamp also)
-# '012 12.Nov.2003 115958 LOGGING INFO'
-# + NO, No event ranking.
-#
-# - Will write log file in unicode format.
-# + YES, Log file will be written in unicode format
-# + NO, Log will be written as normal, not unicode, file.
-#
-
-[Logger_Defaults]
-
-#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
-#NOTE: TestEngine and TestServer logging settings cannot change here
-
-#CreateLogDirectories= YES # Possible values: YES or NO
-
-#EmulatorBasePath= C:\LOGS\TestFramework\
-#EmulatorFormat= HTML # Possible values: TXT or HTML
-#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
-
-#HardwareBasePath= D:\LOGS\TestFramework\
-#HardwareFormat= HTML # Possible values: TXT or HTML
-#HardwareOutput= FILE # Possible values: FILE or RDEBUG
-
-#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
-
-#ThreadIdToLogFile= YES # Possible values: YES or NO
-#WithTimeStamp= YES # Possible values: YES or NO
-#WithLineBreak= YES # Possible values: YES or NO
-#WithEventRanking= YES # Possible values: YES or NO
-
-#FileUnicode= YES # Possible values: YES or NO
-#AddTestCaseTitle= YES # Possible values: YES or NO
-[End_Logger_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set filters to be used by ConsoleUI.
-# If you want to use filter with ConsoleUI, simply remove comments
-# from section below and provide valid filter entries.
-# Each filter line has to start with "filter= " keyword.
-# Filter can contain special wildcard characters:
-# * which stands for none or any literal;
-# ? which stands for single character.
-# Filters are not case-sensitive.
-
-#[Filters]
-#filter= *math*
-#filter= *radio*
-#[End_Filters]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-# End of file
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/CHidDriverPlugin.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-#include "CHidDriverPlugin.h"
-
-CHidDriverPlugin* CHidDriverPlugin::NewL(MDriverAccess* /*aHid*/)
- {
- CHidDriverPlugin* self = new (ELeave) CHidDriverPlugin();
- return self;
- }
-
-
-CHidDriverPlugin::CHidDriverPlugin() : CHidDriver()
- {
- }
-
-TInt CHidDriverPlugin::CanHandleReportL(CReportRoot* aReportDescriptor)
- {
- return KErrNone;
- }
-
-TInt CHidDriverPlugin::DataIn(CHidTransport::THidChannelType aChannel,
- const TDesC8& aPayload)
- {
- return KErrNone;
- }
-
-void CHidDriverPlugin::Disconnected(TInt aReason)
- {
-
- }
-void CHidDriverPlugin::InitialiseL(TInt aConnectionId)
- {
-
- }
-void CHidDriverPlugin::StartL(TInt aConnectionId)
- {
-
- }
-void CHidDriverPlugin::Stop()
- {
-
- }
-void CHidDriverPlugin::CommandResult(TInt aCmdAck)
- {
-
- }
-TInt CHidDriverPlugin::SupportedFieldCount()
- {
- return KErrNone;
- }
-void CHidDriverPlugin::SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg)
- {
- ///////todo!!
- aHandlingReg->AddHandledEvent(1,1);
- TBool allowed = aHandlingReg->AllowedToHandleEvent(1,1);
- if(allowed == EFalse)
- {
- //User::Leave(1);
- }
- allowed = aHandlingReg->AllowedToHandleEvent(2,2);
- if(allowed != EFalse)
- {
- //User::Leave(1);
- }
-
- }
-
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/CHidDriverPluginProxy.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-#ifndef REFERENCE_HIDDRIVER_H
-#define REFERENCE_HIDDRIVER_H
-
-#include <e32base.h>
-#include <ECom/ImplementationProxy.h>
-#include "CHidDriverPlugin.h"
-
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY(0xE000B187, CHidDriverPlugin::NewL),
- };
-
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
- {
- aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-
- return ImplementationTable;
- }
-
-#endif //REFERENCE_HIDDRIVER_H
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTest.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-
-// INCLUDE FILES
-#include <Stiftestinterface.h>
-#include "GenericHidTest.h"
-#include <SettingServerClient.h>
-
-//#include "testlogger.h"
-
-// EXTERNAL DATA STRUCTURES
-//extern ?external_data;
-
-// EXTERNAL FUNCTION PROTOTYPES
-//extern ?external_function( ?arg_type,?arg_type );
-
-// CONSTANTS
-//const ?type ?constant_var = ?constant;
-
-// MACROS
-//#define ?macro ?macro_def
-
-// LOCAL CONSTANTS AND MACROS
-//const ?type ?constant_var = ?constant;
-//#define ?macro_name ?macro_def
-
-// MODULE DATA STRUCTURES
-//enum ?declaration
-//typedef ?declaration
-
-// LOCAL FUNCTION PROTOTYPES
-//?type ?function_name( ?arg_type, ?arg_type );
-
-// FORWARD DECLARATIONS
-//class ?FORWARD_CLASSNAME;
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// ?function_name ?description.
-// ?description
-// Returns: ?value_1: ?description
-// ?value_n: ?description_line1
-// ?description_line2
-// -----------------------------------------------------------------------------
-//
-/*
-?type ?function_name(
- ?arg_type arg, // ?description
- ?arg_type arg) // ?description
- {
-
- ?code // ?comment
-
- // ?comment
- ?code
- }
-*/
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CGenericHidTest
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CGenericHidTest::CGenericHidTest(
- CTestModuleIf& aTestModuleIf ):
- CScriptBase( aTestModuleIf )
- {
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CGenericHidTest::ConstructL()
- {
- //iTestLogger = CHidTestLogger::NewL( &TestModuleIf() );
-
- //Read logger settings to check whether test case name is to be
- //appended to log file name.
- RSettingServer settingServer;
- TInt ret = settingServer.Connect();
- if(ret != KErrNone)
- {
- User::Leave(ret);
- }
- // Struct to StifLogger settigs.
- TLoggerSettings loggerSettings;
- // Parse StifLogger defaults from STIF initialization file.
- ret = settingServer.GetLoggerSettings(loggerSettings);
- if(ret != KErrNone)
- {
- User::Leave(ret);
- }
- // Close Setting server session
- settingServer.Close();
-
- TFileName logFileName;
-
- if(loggerSettings.iAddTestCaseTitle)
- {
- TName title;
- TestModuleIf().GetTestCaseTitleL(title);
- logFileName.Format(KGenericHidTestLogFileWithTitle, &title);
- }
- else
- {
- logFileName.Copy(KGenericHidTestLogFile);
- }
-
- iLog = CStifLogger::NewL( KGenericHidTestLogPath,
- logFileName,
- CStifLogger::ETxt,
- CStifLogger::EFile,
- EFalse );
-
- SendTestClassVersion();
-
- iParser = CParser::NewL();
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CGenericHidTest* CGenericHidTest::NewL(
- CTestModuleIf& aTestModuleIf )
- {
- CGenericHidTest* self = new (ELeave) CGenericHidTest( aTestModuleIf );
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
-
- }
-
-// Destructor
-CGenericHidTest::~CGenericHidTest()
- {
-
- // Delete resources allocated from test methods
- Delete();
-
- // Delete logger
- delete iLog;
-
- delete iParser;
-
- }
-
-//-----------------------------------------------------------------------------
-// CGenericHidTest::SendTestClassVersion
-// Method used to send version of test class
-//-----------------------------------------------------------------------------
-//
-void CGenericHidTest::SendTestClassVersion()
- {
- TVersion moduleVersion;
- moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
- moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
- moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
-
- TFileName moduleName;
- moduleName = _L("GenericHidTest.dll");
-
- TBool newVersionOfMethod = ETrue;
- TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
- }
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-
-// -----------------------------------------------------------------------------
-// LibEntryL is a polymorphic Dll entry point.
-// Returns: CScriptBase: New CScriptBase derived object
-// -----------------------------------------------------------------------------
-//
-EXPORT_C CScriptBase* LibEntryL(
- CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
- {
-
- return ( CScriptBase* ) CGenericHidTest::NewL( aTestModuleIf );
-
- }
-
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTestBlocks.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2839 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-
-
-// [INCLUDE FILES] - do not remove
-#include <e32svr.h>
-#include <StifParser.h>
-#include <Stiftestinterface.h>
-#include "GenericHidTest.h"
-
-#include "hidreports.h"
-#include "tGenericHIDAPI.h"
-#include "tdialclient.h"
-#include "alarmcontrol.h"
-#include "timer.h"
-
-// EXTERNAL DATA STRUCTURES
-//extern ?external_data;
-
-// EXTERNAL FUNCTION PROTOTYPES
-//extern ?external_function( ?arg_type,?arg_type );
-
-// CONSTANTS
-//const ?type ?constant_var = ?constant;
-
-// MACROS
-//#define ?macro ?macro_def
-
-// LOCAL CONSTANTS AND MACROS
-//const ?type ?constant_var = ?constant;
-//#define ?macro_name ?macro_def
-
-// MODULE DATA STRUCTURES
-//enum ?declaration
-//typedef ?declaration
-
-// LOCAL FUNCTION PROTOTYPES
-//?type ?function_name( ?arg_type, ?arg_type );
-
-// FORWARD DECLARATIONS
-//class ?FORWARD_CLASSNAME;
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// ?function_name ?description.
-// ?description
-// Returns: ?value_1: ?description
-// ?value_n: ?description_line1
-// ?description_line2
-// -----------------------------------------------------------------------------
-//
-/*
-?type ?function_name(
- ?arg_type arg, // ?description
- ?arg_type arg) // ?description
- {
-
- ?code // ?comment
-
- // ?comment
- ?code
- }
-*/
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::Delete
-// Delete here all resources allocated and opened from test methods.
-// Called from destructor.
-// -----------------------------------------------------------------------------
-//
-void CGenericHidTest::Delete()
- {
- if ( iGenericHIDTest )
- {
- delete iGenericHIDTest;
- iGenericHIDTest = NULL;
- }
-
- if ( iDialClient )
- {
- delete iDialClient;
- iDialClient = NULL;
- }
-
- if ( iAlarmControl )
- {
- delete iAlarmControl;
- iAlarmControl = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::RunMethodL
-// Run specified method. Contains also table of test mothods and their names.
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::RunMethodL(
- CStifItemParser& aItem )
- {
-
- static TStifFunctionInfo const KFunctions[] =
- {
- //ADD NEW ENTRY HERE
- // [test cases entries] - Do not remove
- ENTRY( "ExecuteApiTestBlock", CGenericHidTest::ExecuteApiTestBlock ),
- ENTRY( "ExecuteModuleTestBlock", CGenericHidTest::ExecuteModuleTestBlock ),
- ENTRY( "ExecuteBranchTestBlock", CGenericHidTest::ExecuteBranchTestBlock ),
- };
-
- const TInt count = sizeof( KFunctions ) /
- sizeof( TStifFunctionInfo );
-
- return RunInternalL( KFunctions, count, aItem );
-
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::GetTestBlockParamsL
-// -----------------------------------------------------------------------------
-
-void CGenericHidTest::GetTestBlockParamsL( CStifItemParser& aItem )
- {
- STIF_LOG( ">>> GetTestBlockParamsL" );
-
- // Add new test block branches below, get all required test parameters
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );
- User::LeaveIfError( aItem.GetNextChar( iTestBlockParams.iTestCharOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Connect" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Disconnect" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DataIn" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Wait" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateCall" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "AddAlarm" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextInt( iTestBlockParams.iTestIntOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteAlarm" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CountryCode" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "VendorId" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ProductId" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetProtocol" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetProtocol" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetReport" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetReport" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DataOut" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetIdle" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetIdle" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CommandResult" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportDescriptor" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportGenerator" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteReportGenerator" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportGeneratorReport" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportGeneratorSetField" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_FieldNull" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_NotArray" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_FieldCountZero" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteReportTranslator" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorGetValue" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorValue" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorGetUsageId" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorUsageId" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorRawValue" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorCount" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Collectiontype" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsPhysical" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsLogical" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsReport" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsNamedArray" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsUsageSwitch" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsUsageModifier" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsApplication" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionUsagePage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionUsage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionCollectionCount" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionFieldCount" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionCollectionByIndex" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionFieldByIndex" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportrootReportSizeBytes" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldLogicalMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldPhysicalMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldPhysicalMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUnit" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUnitExponent" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldCount" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSize" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldOffset" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldReportId" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsInReport" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldDesignatorIndex" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldStringIndex" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsagePage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldHasUsage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsageArray" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsageCount" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldClearUsageList" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldLastUsage" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption2 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldAttributes" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldType" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsVariable" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsArray" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsConstant" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsData" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringMin" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringMax" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalRange" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageRange" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalRange" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringRange" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorRange" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsInput" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsOutput" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsFeature" ) ) )
- {
- User::LeaveIfError( aItem.GetNextString( iTestBlockParams.iTestOption1 ) );
- }
- else
- {
- STIF_LOG( "GetTestBlockParamsL, Test type: not found" );
- User::Leave( KErrNotFound );
- }
- STIF_LOG( "<<< GetTestBlockParams" );
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ExecuteApiTestBlock
-// -----------------------------------------------------------------------------
-
-TInt CGenericHidTest::ExecuteApiTestBlock( CStifItemParser& aItem )
- {
- STIF_LOG( ">>>ExecuteApiTestBlock" );
-
- TInt res;
- TGenericHidTestResult testResult;
-
- TRAP( res, DoExecuteApiTestBlockL( aItem, testResult ) );
- if ( res != KErrNone )
- {
- STIF_LOG1( "DoExecuteApiTestBlockL error: %d", res );
- return res;
- }
-
- STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
- STIF_LOG( "Test case passed" );
- STIF_LOG( "<<<ExecuteApiTestBlock" );
-
- return KErrNone;
- }
-
-
-void CGenericHidTest::DoExecuteApiTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( ">>>DoExecuteApiTestBlock" );
-
- User::LeaveIfError( aItem.GetString( _L( "ExecuteApiTestBlock" ), iTestBlockParams.iTestBlockName ) );
- STIF_LOG1( "Api test type: %S", &iTestBlockParams.iTestBlockName );
-
- GetTestBlockParamsL( aItem );
-
- // Add new API test block branches with optional test parameters here
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
- iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
- }
- else
- {
- STIF_LOG( "Test type: not found" );
- User::Leave( KErrNotFound );
- }
-
- STIF_LOG( "<<<DoExecuteApiTestBlockL" );
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ExecuteModuleTestBlock
-// -----------------------------------------------------------------------------
-
-TInt CGenericHidTest::ExecuteModuleTestBlock( CStifItemParser& aItem )
- {
- STIF_LOG( "[STIF_LOG] >>>ExecuteModuleTestBlock" );
-
- TInt res;
- TGenericHidTestResult testResult;
-
- TRAP( res, DoExecuteModuleTestBlockL( aItem, testResult ) );
- if ( res != KErrNone )
- {
- STIF_LOG1( "DoExecuteModuleTestBlockL error: %d", res );
- return res;
- }
-
- STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
- STIF_LOG( "[STIF_LOG] Test case passed" );
- STIF_LOG( "[STIF_LOG] <<<ExecuteModuleTestBlock" );
- return KErrNone;
- }
-
-
-void CGenericHidTest::DoExecuteModuleTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( "[STIF_LOG] >>>DoExecuteModuleTestBlockL" );
-
- User::LeaveIfError( aItem.GetString( _L( "ExecuteModuleTestBlock" ), iTestBlockParams.iTestBlockName ) );
- STIF_LOG1( "Module test type: %S", &iTestBlockParams.iTestBlockName );
-
- GetTestBlockParamsL( aItem );
-
- // Add new module test block branches with optional test parameters here
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
- iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
- }
- else
- {
- STIF_LOG( "Test type: not found" );
- User::Leave( KErrNotFound );
- }
-
- STIF_LOG( "[STIF_LOG] <<<DoExecuteModuleTestBlockL" );
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ExecuteBranchTestBlock
-// -----------------------------------------------------------------------------
-
-TInt CGenericHidTest::ExecuteBranchTestBlock( CStifItemParser& aItem )
- {
- STIF_LOG( "[STIF_LOG] >>>ExecuteBranchTestBlock" );
-
- TInt res;
- TGenericHidTestResult testResult = ETestCaseFailed;
-
- TRAP( res, DoExecuteBranchTestBlockL( aItem, testResult ) );
- if ( res != KErrNone )
- {
- STIF_LOG1( "DoExecuteBranchTestBlockL error: %d", res );
- return res;
- }
-
- STIF_ASSERT_EQUALS( ETestCasePassed, testResult );
- STIF_LOG( "[STIF_LOG] Test case passed" );
- STIF_LOG( "[STIF_LOG] <<<ExecuteBranchTestBlock" );
- return KErrNone;
- }
-
-
-void CGenericHidTest::DoExecuteBranchTestBlockL( CStifItemParser& aItem, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( "[STIF_LOG] >>>DoExecuteBranchTestBlockL" );
-
- User::LeaveIfError( aItem.GetString( _L( "ExecuteBranchTestBlock" ), iTestBlockParams.iTestBlockName ) );
- STIF_LOG1( "Branch test type: %S", &iTestBlockParams.iTestBlockName );
-
- GetTestBlockParamsL( aItem );
-
- // Add new branch test block branches with optional test parameters here
- if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ExampleTestL" ) ) )
- {
- ExampleTestL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2,
- iTestBlockParams.iTestIntOption1, iTestBlockParams.iTestCharOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Connect" ) ) )
- {
- ConnectL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Disconnect" ) ) )
- {
- DisconnectL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DataIn" ) ) )
- {
- DataIn( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Wait" ) ) )
- {
- WaitL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestIntOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateCall" ) ) )
- {
- CreateCallL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "AddAlarm" ) ) )
- {
- AddAlarmL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestIntOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteAlarm" ) ) )
- {
- DeleteAlarm( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CountryCode" ) ) )
- {
- CountryCodeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "VendorId" ) ) )
- {
- VendorIdL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ProductId" ) ) )
- {
- ProductIdL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetProtocol" ) ) )
- {
- SetProtocolL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetProtocol" ) ) )
- {
- GetProtocoL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetReport" ) ) )
- {
- GetReportL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetReport" ) ) )
- {
- SetReportL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DataOut" ) ) )
- {
- DataOutL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "GetIdle" ) ) )
- {
- GetIdleL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "SetIdle" ) ) )
- {
- SetIdleL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CommandResult" ) ) )
- {
- CommandResultL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportDescriptor" ) ) )
- {
- ReportDescriptorL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportGenerator" ) ) )
- {
- CreateReportGeneratorL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteReportGenerator" ) ) )
- {
- DeleteReportGeneratorL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportGeneratorReport" ) ) )
- {
- ReportGeneratorReportL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportGeneratorSetField" ) ) )
- {
- ReportGeneratorSetFieldL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator" ) ) )
- {
- CreateReportTranslatorL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_FieldNull" ) ) )
- {
- CreateReportTranslator_FieldNullL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_NotArray" ) ) )
- {
- CreateReportTranslator_NotArrayL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CreateReportTranslator_FieldCountZero" ) ) )
- {
- CreateReportTranslator_FieldCountZeroL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "DeleteReportTranslator" ) ) )
- {
- DeleteReportTranslatorL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorGetValue" ) ) )
- {
- ReportTranslatorGetValueL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorValue" ) ) )
- {
- ReportTranslatorValueL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorGetUsageId" ) ) )
- {
- ReportTranslatorGetUsageIdL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorUsageId" ) ) )
- {
- ReportTranslatorUsageIdL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorRawValue" ) ) )
- {
- ReportTranslatorRawValueL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportTranslatorCount" ) ) )
- {
- ReportTranslatorCountL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "Collectiontype" ) ) )
- {
- CollectiontypeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsPhysical" ) ) )
- {
- CollectionIsPhysicalL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsLogical" ) ) )
- {
- CollectionIsLogicalL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsReport" ) ) )
- {
- CollectionIsReportL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsNamedArray" ) ) )
- {
- CollectionIsNamedArrayL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsUsageSwitch" ) ) )
- {
- CollectionIsUsageSwitchL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsUsageModifier" ) ) )
- {
- CollectionIsUsageModifierL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionIsApplication" ) ) )
- {
- CollectionIsApplicationL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionUsagePage" ) ) )
- {
- CollectionUsagePageL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionUsage" ) ) )
- {
- CollectionUsageL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionCollectionCount" ) ) )
- {
- CollectionFieldCountL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionFieldCount" ) ) )
- {
- CollectionFieldCountL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionCollectionByIndex" ) ) )
- {
- CollectionCollectionByIndexL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "CollectionFieldByIndex" ) ) )
- {
- CollectionFieldByIndexL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "ReportrootReportSizeBytes" ) ) )
- {
- ReportrootReportSizeBytes( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldLogicalMax" ) ) )
- {
- FieldLogicalMaxL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldPhysicalMin" ) ) )
- {
- FieldPhysicalMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldPhysicalMax" ) ) )
- {
- FieldPhysicalMaxL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUnit" ) ) )
- {
- FieldUnitL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUnitExponent" ) ) )
- {
- FieldUnitExponentL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldCount" ) ) )
- {
- FieldCountL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSize" ) ) )
- {
- FieldSizeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldOffset" ) ) )
- {
- FieldOffsetL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldReportId" ) ) )
- {
- FieldReportIdL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsInReport" ) ) )
- {
- FieldIsInReportL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldDesignatorIndex" ) ) )
- {
- FieldDesignatorIndexL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldStringIndex" ) ) )
- {
- FieldStringIndexL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsagePage" ) ) )
- {
- FieldUsagePageL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldHasUsage" ) ) )
- {
- FieldHasUsageL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsageArray" ) ) )
- {
- FieldUsageArrayL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsage" ) ) )
- {
- FieldUsageL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldUsageCount" ) ) )
- {
- FieldUsageCountL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldClearUsageList" ) ) )
- {
- FieldClearUsageListL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldLastUsage" ) ) )
- {
- FieldLastUsageL( iTestBlockParams.iTestOption1, iTestBlockParams.iTestOption2, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldAttributes" ) ) )
- {
- FieldAttributesL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldType" ) ) )
- {
- FieldTypeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsVariable" ) ) )
- {
- FieldIsVariableL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsArray" ) ) )
- {
- FieldIsArrayL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsConstant" ) ) )
- {
- FieldIsConstantL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsData" ) ) )
- {
- FieldIsDataL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalMin" ) ) )
- {
- FieldSetLogicalMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalMax" ) ) )
- {
- FieldSetPhysicalMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalMin" ) ) )
- {
- FieldSetPhysicalMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalMax" ) ) )
- {
- FieldSetPhysicalMaxL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorMin" ) ) )
- {
- FieldSetDesignatorMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorMax" ) ) )
- {
- FieldSetUsageMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageMin" ) ) )
- {
- FieldSetUsageMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageMax" ) ) )
- {
- FieldSetUsageMaxL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringMin" ) ) )
- {
- FieldSetStringMinL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringMax" ) ) )
- {
- FieldSetStringMaxL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetLogicalRange" ) ) )
- {
- FieldSetLogicalRangeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetUsageRange" ) ) )
- {
- FieldSetUsageRangeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetPhysicalRange" ) ) )
- {
- FieldSetPhysicalRangeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetStringRange" ) ) )
- {
- FieldSetStringRangeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldSetDesignatorRange" ) ) )
- {
- FieldSetDesignatorRangeL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsInput" ) ) )
- {
- FieldIsInputL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsOutput" ) ) )
- {
- FieldIsOutputL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else if ( !iTestBlockParams.iTestBlockName.Compare( _L( "FieldIsFeature" ) ) )
- {
- FieldIsFeatureL( iTestBlockParams.iTestOption1, aTestResult );
- }
- else
- {
- STIF_LOG( "DoExecuteBranchTestBlockL; Test type: not found" );
- User::Leave( KErrNotFound );
- }
-
- STIF_LOG( "[STIF_LOG] <<<DoExecuteBranchTestBlock" );
- }
-
-// Add test block methods implementation here
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ExampleTestL
-// -----------------------------------------------------------------------------
-
-void CGenericHidTest::ExampleTestL( TPtrC aTestOption, TPtrC aTestSubOption,
- TInt aTestIntOption, TInt aTestCharOption, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( ">>>ExampleTest" );
-
- if ( !aTestOption.Compare( _L( "API" ) ) )
- {
- STIF_LOG1( "Api test option: %S", &aTestOption );
- STIF_LOG1( "Api test sub-option: %S", &aTestSubOption );
- STIF_LOG1( "Api test int option: %d", aTestIntOption );
- STIF_LOG1( "Api test char option: %c", aTestCharOption );
- }
- else if ( !aTestOption.Compare( _L( "MODULE" ) ) )
- {
- STIF_LOG1( "Module test option: %S", &aTestOption );
- STIF_LOG1( "Module test sub-option: %S", &aTestSubOption );
- STIF_LOG1( "Module test int option: %d", aTestIntOption );
- STIF_LOG1( "Module test char option: %c", aTestCharOption );
- }
- else if ( !aTestOption.Compare( _L( "BRANCH" ) ) )
- {
- STIF_LOG1( "Branch test option: %S", &aTestOption );
- STIF_LOG1( "Branch test sub-option: %S", &aTestSubOption );
- STIF_LOG1( "Branch test int option: %d", aTestIntOption );
- STIF_LOG1( "Branch test char option: %c", aTestCharOption );
- }
- else
- {
- STIF_LOG( "Invalid test parameter" );
- User::Leave( KErrNotFound );
- }
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "<<<ExampleTest" );
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ConnectL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ConnectL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( "Connect" );
-
- if ( !iGenericHIDTest )
- {
- iGenericHIDTest = CtGenericHIDAPI::NewL();
- }
- HBufC8* report = ConvertArray(aTestSubOption);
-
- CleanupStack::PushL( report );
- iGenericHIDTest->ConnectL(0,*report);
- CleanupStack::PopAndDestroy();
-
- STIF_LOG( "Connect passed" );
-
- aTestResult = ETestCasePassed;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::DisconnectL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DisconnectL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->DisconnectL(0);
- delete iGenericHIDTest;
- iGenericHIDTest = NULL;
-
- STIF_LOG( "Disconnect passed" );
-
- aTestResult = ETestCasePassed;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::DataIn
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DataIn( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt retVal = KErrNone;
- HBufC8* report = ConvertArray(aTestSubOption);
- TInt firstByte = (*report)[0];
- STIF_LOG1("aTestSubOption >> report: %d", firstByte);
-
- retVal = iGenericHIDTest->DataInL(0,*report);
- STIF_LOG1( "DataInL return value: %d" , retVal);
-
- delete report;
- report = NULL;
-
- STIF_LOG( "Test case passed" );
-
- aTestResult = ETestCasePassed;
-
- return retVal;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::Wait
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::WaitL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult )
- {
- CWaitTimer* timer = CWaitTimer::NewLC(aTestIntOption * 1000000);
- CleanupStack::PopAndDestroy(timer);
-
- STIF_LOG( "Test case passed" );
-
- aTestResult = ETestCasePassed;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CreateCallL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CreateCallL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt err = KErrNone;
-
- if ( iDialClient )
- {
- delete iDialClient;
- iDialClient = NULL;
- }
- iDialClient = CDialClient::NewL();
-
- iDialClient->CreateCall( aTestSubOption );
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::AddAlarm
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::AddAlarmL( TPtrC aTestOption, TInt aTestIntOption, TGenericHidTestResult& aTestResult )
- {
- STIF_LOG( ">>AddAlarmL" );
-
- if ( !iAlarmControl )
- {
- iAlarmControl = CAlarmControl::NewL( iLog );
- }
-
- STIF_LOG( "Create alarm" );
-
- iAlarmControl->CreateClockAlarm( aTestIntOption );
-
- STIF_LOG( "Test case passed" );
-
- aTestResult = ETestCasePassed;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::DeleteAlarm
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DeleteAlarm( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iAlarmControl->DeleteAlarm();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CountryCodeL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CountryCodeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->RunCountryCodeL();
- STIF_LOG2( "RunCountryCodeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::VendorIdL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::VendorIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->RunVendorIdL();
- STIF_LOG2( "RunVendorIdL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ProductIdL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ProductIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->RunProductIdL();
- STIF_LOG2( "RunProductIdL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::SetProtocol
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::SetProtocolL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->RunSetProtocolL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::GetProtocoL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::GetProtocoL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->RunGetProtocoL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::GetReportL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::GetReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->RunGetReportL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::SetReportL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::SetReportL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->RunSetReportL( *report );
- CleanupStack::PopAndDestroy();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::DataOutL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DataOutL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->RunDataOutL( *report );
- CleanupStack::PopAndDestroy();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::GetIdleL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::GetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->GetGetIdleL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::SetIdleL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::SetIdleL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->RunSetIdleL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CommandResultL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CommandResultL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->GetCommandResultL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportDescriptorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportDescriptorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->GetReportDescriptorL();
- STIF_LOG2( "GetReportDescriptorL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportDescriptorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CreateReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->CreateReportGeneratorL();
- STIF_LOG2( "CreateReportGeneratorL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportDescriptorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DeleteReportGeneratorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->DeleteReportGeneratorL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportDescriptorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportGeneratorReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->ReportGeneratorReport();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportGeneratorSetFieldL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportGeneratorSetFieldL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
- TInt expectedResult = KErrNone;
-
- if ( !aTestSubOption.Compare( _L( "Array" ) ) )
- {
- iLog -> Log( _L("Test type: Array") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( ETrue, EFalse, EFalse, EFalse, ETrue, EFalse );
- }
- else if ( !aTestSubOption.Compare( _L( "NotArray" ) ) )
- {
- iLog -> Log( _L("Test type: NotArray") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( EFalse, EFalse, EFalse, EFalse, ETrue, EFalse );
- }
- else if ( !aTestSubOption.Compare( _L( "NotArrayOutOfRange" ) ) )
- {
- iLog -> Log( _L("Test type: NotArrayOutOfRange") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( EFalse, ETrue, EFalse, EFalse, ETrue, EFalse );
- expectedResult = KErrValueOutOfRange;
- }
- else if ( !aTestSubOption.Compare( _L( "FieldNull" ) ) )
- {
- iLog -> Log( _L("Test type: FieldNull") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( EFalse, EFalse, ETrue, EFalse, ETrue, EFalse );
- expectedResult = KErrUsageNotFound;
- }
- else if ( !aTestSubOption.Compare( _L( "FieldCountZero" ) ) )
- {
- iLog -> Log( _L("Test type: FieldCountZero") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( ETrue, EFalse, EFalse, ETrue, ETrue, EFalse );
- expectedResult = KErrNoSpaceInArray;
- }
- else if ( !aTestSubOption.Compare( _L( "NotExistingUsage" ) ) )
- {
- iLog -> Log( _L("Test type: NotExistingUsage") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( ETrue, EFalse, EFalse, ETrue, EFalse, EFalse );//getIndexOfUsage
- expectedResult = KErrUsageNotFound;
- }
- else if ( !aTestSubOption.Compare( _L( "NotExistingUsage2" ) ) )
- {
- iLog -> Log( _L("Test type: NotExistingUsage2") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( ETrue, EFalse, EFalse, EFalse, EFalse, EFalse );//getIndexOfUsage
- expectedResult = KErrUsageNotFound;
- }
- else if ( !aTestSubOption.Compare( _L( "BadIndex" ) ) )
- {
- iLog -> Log( _L("Test type: BadIndex") );
- ret = iGenericHIDTest->ReportGeneratorSetFieldL( EFalse, EFalse, EFalse, EFalse, ETrue, ETrue );
- expectedResult = KErrBadControlIndex;
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
-
- STIF_LOG2( "ReportGeneratorSetFieldL return value: %d, expected: %d" , ret, expectedResult);
- STIF_ASSERT_EQUALS(ret, expectedResult);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CreateReportTranslatorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CreateReportTranslatorL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->CreateReportTranslatorL( *report , ETrue, EFalse, EFalse);
- CleanupStack::PopAndDestroy();
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CreateReportTranslator_FieldNullL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->CreateReportTranslatorL( *report, EFalse, ETrue, EFalse );
- CleanupStack::PopAndDestroy();
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CreateReportTranslator_NotArrayL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->CreateReportTranslatorL( *report , EFalse, EFalse, EFalse);
- CleanupStack::PopAndDestroy();
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CreateReportTranslator_FieldCountZeroL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- HBufC8* report = ConvertArray(aTestSubOption);
- CleanupStack::PushL( report );
- iGenericHIDTest->CreateReportTranslatorL( *report , ETrue, EFalse, ETrue);
- CleanupStack::PopAndDestroy();
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::DeleteReportTranslatorL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::DeleteReportTranslatorL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->DeleteReportTranslatorL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::ReportTranslatorGetValueL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
- TInt expectedResult = KErrNone;
-
- if ( !aTestSubOption.Compare( _L( "Ok" ) ) )
- {
- iLog -> Log( _L("Test type: Ok") );
- }
- else if ( !aTestSubOption.Compare( _L( "NotFound" ) ) )
- {
- iLog -> Log( _L("Test type: NotFound") );
- expectedResult = KErrUsageNotFound;
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- ret = iGenericHIDTest->ReportTranslatorGetValueL();
- STIF_LOG2( "ReportTranslatorGetValueL return value: %d, expected: %d" , ret, expectedResult);
- STIF_ASSERT_EQUALS(ret, expectedResult);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportTranslatorValueL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportTranslatorValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->ReportTranslatorValueL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportTranslatorGetUsageIdL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportTranslatorGetUsageIdL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
- TInt expectedResult = KErrNone;
- TInt badIndex = EFalse;
-
- if ( !aTestSubOption.Compare( _L( "Ok" ) ) )
- {
- iLog -> Log( _L("Test type: Ok") );
- }
- else if ( !aTestSubOption.Compare( _L( "Error" ) ) )
- {
- iLog -> Log( _L("Test type: Error") );
- expectedResult = KErrNoMemory;
- }
- else if ( !aTestSubOption.Compare( _L( "BadIndex" ) ) )
- {
- iLog -> Log( _L("Test type: BadIndex") );
- badIndex = ETrue;
- expectedResult = KErrBadControlIndex;
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- ret = iGenericHIDTest->ReportTranslatorGetUsageIdL( badIndex );
- STIF_LOG2( "ReportTranslatorGetUsageIdL return value: %d, expected: %d" , ret, expectedResult);
- STIF_ASSERT_EQUALS(ret, expectedResult);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportTranslatorUsageIdL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportTranslatorUsageIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->ReportTranslatorUsageIdL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportTranslatorRawValueL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportTranslatorRawValueL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->ReportTranslatorRawValueL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportTranslatorCountL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportTranslatorCountL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult)
- {
- TInt zeroExpected = EFalse;
-
- if ( !aTestSubOption.Compare( _L( "Zero" ) ) )
- {
- iLog -> Log( _L("Test type: Zero") );
- zeroExpected = ETrue;
- }
- else if ( !aTestSubOption.Compare( _L( "NotZero" ) ) )
- {
- iLog -> Log( _L("Test type: NotZero") );
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- TInt count = iGenericHIDTest->ReportTranslatorCountL();
-
- STIF_LOG1( "ReportTranslatorCountL return value: %d" , count);
- if(zeroExpected != EFalse)
- {
- STIF_ASSERT_EQUALS(0, count)
- }
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectiontypeL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectiontypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectiontypeL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsPhysicalL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsPhysicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsPhysicalL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsLogicalL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsLogicalL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsLogicalL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsReportL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsReportL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsNamedArrayL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsNamedArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsNamedArrayL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsUsageSwitchL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsUsageSwitchL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsUsageSwitchL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::CollectionIsUsageModifierL
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::CollectionIsUsageModifierL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsUsageModifierL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionIsApplicationL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionIsApplicationL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-
-TInt CGenericHidTest::CollectionUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionUsagePageL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionUsageL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionCollectionCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionCollectionCountL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionFieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->CollectionFieldCountL();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionCollectionByIndexL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
-
- if ( !aTestSubOption.Compare( _L( "Present" ) ) )
- {
- iLog -> Log( _L("Test type: Present") );
- ret = iGenericHIDTest->CollectionCollectionByIndexL(ETrue);
- }
- else if ( !aTestSubOption.Compare( _L( "NotPresent" ) ) )
- {
- iLog -> Log( _L("Test type: NotPresent") );
- ret = iGenericHIDTest->CollectionCollectionByIndexL(EFalse);
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- STIF_LOG2( "CollectionCollectionByIndexL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::CollectionFieldByIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->CollectionFieldByIndexL();
- STIF_LOG2( "CollectionFieldByIndexL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ReportrootReportSizeBytes
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::ReportrootReportSizeBytes( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- iGenericHIDTest->ReportrootReportSizeBytes();
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldLogicalMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldLogicalMaxL();
- STIF_LOG2( "FieldLogicalMaxL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldPhysicalMin
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldPhysicalMinL();
- STIF_LOG2( "FieldPhysicalMinL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldPhysicalMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldPhysicalMaxL();
- STIF_LOG2( "FieldPhysicalMaxL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldUnit
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldUnitL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUnitL();
- STIF_LOG2( "FieldUnitL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldUnitExponent
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldUnitExponentL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUnitExponentL();
- STIF_LOG2( "FieldUnitExponentL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldCountL();
- STIF_LOG2( "FieldCountL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSizeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSizeL();
- STIF_LOG2( "FieldSizeL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldOffsetL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
-
- if ( !aTestSubOption.Compare( _L( "SetReport" ) ) )
- {
- iLog -> Log( _L("Test type: SetReport") );
- ret = iGenericHIDTest->FieldOffsetL(ETrue);
- }
- else if ( !aTestSubOption.Compare( _L( "NotSetReport" ) ) )
- {
- iLog -> Log( _L("Test type: NotSetReport") );
- ret = iGenericHIDTest->FieldOffsetL(EFalse);
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- STIF_LOG2( "FieldOffsetL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldReportIdL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldReportIdL();
- STIF_LOG2( "FieldReportIdL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldIsInReportL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsInReportL();
- STIF_LOG2( "FieldIsInReportL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldDesignatorIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldDesignatorIndexL();
- STIF_LOG2( "FieldDesignatorIndexL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldStringIndexL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldStringIndexL();
- STIF_LOG2( "FieldStringIndexL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldUsagePageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUsagePageL();
- STIF_LOG2( "FieldUsagePageL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldHasUsage
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldHasUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldHasUsageL();
- STIF_LOG2( "FieldHasUsageL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldUsageArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUsageArrayL();
- STIF_LOG2( "FieldUsageArrayL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldUsageL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUsageL();
- STIF_LOG2( "FieldUsageL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldUsageCountL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldUsageCountL();
- STIF_LOG2( "FieldUsageCountL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldClearUsageListL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldClearUsageListL();
- STIF_LOG2( "FieldClearUsageListL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldLastUsageL( TPtrC aTestOption, TPtrC aTestSubOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret;
-
- if ( !aTestSubOption.Compare( _L( "Empty" ) ) )
- {
- iLog -> Log( _L("Test type: Empty") );
- ret = iGenericHIDTest->FieldLastUsageL( ETrue );
- }
- else if ( !aTestSubOption.Compare( _L( "NotEmpty" ) ) )
- {
- iLog -> Log( _L("Test type: NotEmpty") );
- ret = iGenericHIDTest->FieldLastUsageL( EFalse );
- }
- else
- {
- iLog -> Log( _L("Test type: not supported") );
- return KErrNotFound;
- }
-
- STIF_LOG2( "FieldLastUsageL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldAttributes
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldAttributesL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldAttributesL();
- STIF_LOG2( "FieldAttributesL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldType
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldTypeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldTypeL();
- STIF_LOG2( "FieldTypeL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldIsVariable
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldIsVariableL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsVariableL();
- STIF_LOG2( "FieldIsVariableL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldIsArrayL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsArrayL();
- STIF_LOG2( "FieldIsArrayL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldIsConstant
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldIsConstantL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsConstantL();
- STIF_LOG2( "FieldIsConstantL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldIsDataL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsDataL();
- STIF_LOG2( "FieldIsDataL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetLogicalMin
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetLogicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetLogicalMinL();
- STIF_LOG2( "FieldSetLogicalMinL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetLogicalMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetLogicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetLogicalMaxL();
- STIF_LOG2( "FieldSetLogicalMaxL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetPhysicalMin
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetPhysicalMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetPhysicalMinL();
- STIF_LOG2( "FieldSetPhysicalMinL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetPhysicalMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetPhysicalMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetPhysicalMaxL();
- STIF_LOG2( "FieldSetPhysicalMaxL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetDesignatorMin
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetDesignatorMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetDesignatorMinL();
- STIF_LOG2( "FieldSetDesignatorMinL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetDesignatorMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetDesignatorMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetDesignatorMaxL();
- STIF_LOG2( "FieldSetDesignatorMaxL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetUsageMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetUsageMinL();
- STIF_LOG2( "FieldSetUsageMinL return value: %d, expected: %d" , ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetUsageMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetUsageMaxL();
- STIF_LOG2( "FieldSetUsageMaxL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetStringMin
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetStringMinL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetStringMinL();
- STIF_LOG2( "FieldSetStringMinL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldSetStringMax
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldSetStringMaxL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetStringMaxL();
- STIF_LOG2( "FieldSetStringMaxL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetLogicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetLogicalRangeL();
- STIF_LOG2( "FieldSetLogicalRangeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetUsageRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetUsageRangeL();
- STIF_LOG2( "FieldSetUsageRangeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetPhysicalRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetPhysicalRangeL();
- STIF_LOG2( "FieldSetPhysicalRangeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetStringRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetStringRangeL();
- STIF_LOG2( "FieldSetStringRangeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldSetDesignatorRangeL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldSetDesignatorRangeL();
- STIF_LOG2( "FieldSetDesignatorRangeL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-TInt CGenericHidTest::FieldIsInputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsInputL();
- STIF_LOG2( "FieldIsInputL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldIsOutput
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldIsOutputL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsOutputL();
- STIF_LOG2( "FieldIsOutputL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::FieldIsFeature
-// -----------------------------------------------------------------------------
-//
-TInt CGenericHidTest::FieldIsFeatureL( TPtrC aTestOption, TGenericHidTestResult& aTestResult )
- {
- TInt ret = iGenericHIDTest->FieldIsFeatureL();
- STIF_LOG2( "FieldIsFeatureL return value: %d, expected: %d", ret, KErrNone);
- STIF_ASSERT_EQUALS(ret, KErrNone);
-
- aTestResult = ETestCasePassed;
-
- STIF_LOG( "Test case passed" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ConvSingleItem
-// -----------------------------------------------------------------------------
-//
-TUint CGenericHidTest::ConvSingleItem(TBuf8<2>& singleItem)
- {
- TLex8 lex(singleItem);
- TUint value;
- lex.Val(value,EHex);
- singleItem.Delete(0,2);
- return value;
- }
-
-// -----------------------------------------------------------------------------
-// CGenericHidTest::ConvertArray
-// -----------------------------------------------------------------------------
-//
-HBufC8* CGenericHidTest::ConvertArray( const TPtrC& aFilename )
- {
- RFs theFs;
-
- RFile someFile;
- if(theFs.Connect() != KErrNone)
- {
- return NULL;
- }
- TInt error = someFile.Open(theFs, aFilename, EFileShareExclusive);
-
- RArray<TUint> arrDesc;
- if (!error)
- {
- TBool seekEOL = EFalse;
- TBuf8<2> singleItem;
-
- TInt hexByte = 0;
-
- TBool bTerminator = EFalse;
-
- TBuf8<1> oneChar;
- someFile.Read(oneChar, 1);
-
- while ( (!error) && (oneChar.Size()) )
- {
- switch ( oneChar[0] )
- {
- case 10:
- case 13:
- seekEOL = EFalse;
- break;
-
- case '/':
- seekEOL = ETrue;
- // Comments are special case terminators
- // interntional drop through to the next case line
- case ' ':
- case '\t':
- case ',':
- // whitespace - ignore, unless we've started storing a value
- // (in which case treat the char as a terminator)
- bTerminator = ETrue;
- break;
-
- default:
- if (!seekEOL)
- {
- if (4==hexByte)
- {
- error = KErrGeneral; // Can't store more than two digits
- }
- else if (hexByte>1)
- {
- singleItem.Append(oneChar);
- }
-
- hexByte++;
- }
- break;
- }
-
- if ( bTerminator && singleItem.Size() )
- {
- TUint value = ConvSingleItem(singleItem);
- arrDesc.Append(value);
- hexByte = 0;
- }
-
- bTerminator = EFalse;
-
- someFile.Read(oneChar, 1);
- }
-
- if (singleItem.Size())
- {
- TUint value = ConvSingleItem(singleItem);
- arrDesc.Append(value);
- }
-
- someFile.Close();
- }
-
- theFs.Close();
-
- HBufC8* theDesc = 0;
-
- if (!error)
- {
- TInt size = arrDesc.Count();
- TRAPD( error, theDesc = HBufC8::NewL(size) );
- if ( error != KErrNone )
- {
- return NULL;
- }
- TPtr8 des = theDesc->Des();
- for(TInt x=0; x<size; x++)
- {
- des.Append(TUint8(arrDesc[x]));
- }
- }
- arrDesc.Close();
- return theDesc;
- }
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-// None
-
-// [End of File] - Do not remove
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTest_exe.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation
- *
-*/
-
-
-
-// INCLUDE FILES
-#include <e32base.h>
-#include <e32svr.h>
-#include <StifTestInterface.h>
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// ================= OTHER EXPORTED FUNCTIONS =================================
-
-/*
--------------------------------------------------------------------------------
-
- Class: -
-
- Method: E32Main
-
- Description:
-
- Parameters: None
-
- Return Values: TInt: Symbian error code
-
- Errors/Exceptions: None
-
- Status: Draft
-
--------------------------------------------------------------------------------
-*/
-GLDEF_C TInt E32Main()
- {
- _LIT( KProcessMsgStart, "New process starting" );
- RDebug::Print( KProcessMsgStart );
-
-
- // This starts a new session that get capabilites that is used in
- // GenericHidTest_exe.mmp file.
- TInt r = StartSession();
-
- _LIT( KProcessMsgEnd, "New process ends" );
- RDebug::Print( KProcessMsgEnd );
-
- return r;
-
- }
-
-// End of File
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/alarmcontrol.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dialhandling class for hid test application
-*
-*/
-
-
-#include "alarmcontrol.h"
-#include "ASShdAlarm.h"
-#include "asshddefs.h"
-
-_LIT(KSoundName, "a"); // For the alarm alert note.
-const TUid KAlarmClockOne = { 0x101F793A };
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CAlarmControl* CAlarmControl::NewL( CStifLogger* aLogger )
- {
- CAlarmControl* self = CAlarmControl::NewLC(aLogger);
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CAlarmControl* CAlarmControl::NewLC( CStifLogger* aLogger )
- {
- CAlarmControl* self = new( ELeave ) CAlarmControl(aLogger);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CAlarmControl::CAlarmControl( CStifLogger* aLogger ):
-iLog(aLogger)
- {
- }
-
-// ---------------------------------------------------------------------------
-// destructor
-// ---------------------------------------------------------------------------
-//
-CAlarmControl::~CAlarmControl()
- {
- if (iAlarmServer.Handle() != KNullHandle)
- {
- iAlarmServer.Close();
- }
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CAlarmControl::ConstructL()
- {
- User::LeaveIfError(iAlarmServer.Connect());
- }
-// ---------------------------------------------------------------------------
-// CreateClockAlarm
-// ---------------------------------------------------------------------------
-//
-void CAlarmControl::CreateClockAlarm( TInt aTime )
- {
- STIF_LOG("CreateClockAlarm");
- TInt minute;
- TTime tmp;
- tmp.HomeTime();
- TDateTime alarmdtime = tmp.DateTime();
- minute = alarmdtime.Minute();
- minute = minute+aTime;
- alarmdtime.SetMinute(minute);
-
- STIF_LOG("CreateClockAlarm solve minutes");
- TASShdAlarm alarm;
- alarm.Category() = KAlarmClockOne;
- alarm.RepeatDefinition() = EAlarmRepeatDefintionRepeatOnce;
- alarm.OriginalExpiryTime() = alarmdtime;
- alarm.NextDueTime() = alarmdtime;
- alarm.SoundName() = KSoundName;
-
- STIF_LOG("CreateClockAlarm solve data");
- alarm.ClientFlags().Set( 0 );
-
- STIF_LOG("CreateClockAlarm solve add alarm");
- iAlarmServer.AlarmAdd(alarm);
- iAlarmID = alarm.Id();
-
- STIF_LOG("CreateClockAlarm solve add activate alarm");
- iAlarmServer.SetAlarmStatus(iAlarmID, EAlarmStatusEnabled);
-
- STIF_LOG("CreateClockAlarm completed");
- }
-
-// ---------------------------------------------------------------------------
-// CreateClockAlarm
-// ---------------------------------------------------------------------------
-//
-void CAlarmControl::DeleteAlarm()
- {
- iAlarmServer.AlarmDelete(iAlarmID);
- }
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/tdialclient.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Dialhandling class for hid test application
-*
-*/
-
-
-#include "tdialclient.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-
-// ---------------------------------------------------------------------------
-// ?description_if_needed
-// ---------------------------------------------------------------------------
-//
-CDialClient* CDialClient::NewL()
- {
- CDialClient* self = CDialClient::NewLC();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// ?description_if_needed
-// ---------------------------------------------------------------------------
-//
-CDialClient* CDialClient::NewLC()
- {
- CDialClient* self = new( ELeave ) CDialClient;
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CDialClient::CDialClient()
-: CActive(EPriorityNormal), iCallParamsPckg(iCallParams),
- iCallStarted(EFalse)
- {
- CActiveScheduler::Add(this);
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CDialClient::ConstructL()
- {
- iTelephony = CTelephony::NewL();
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CDialClient::~CDialClient()
- {
- Cancel();
- delete iTelephony;
- }
-
-// ---------------------------------------------------------------------------
-// RunL
-// ---------------------------------------------------------------------------
-//
-void CDialClient::RunL()
- {
- if ( iSyncWaiter.IsStarted() )
- {
- iSyncWaiter.AsyncStop();
- }
- }
-
-// ---------------------------------------------------------------------------
-// DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CDialClient::DoCancel()
- {
-
- }
-// ---------------------------------------------------------------------------
-// CreateCall()
-// ---------------------------------------------------------------------------
-//
-void CDialClient::CreateCall(const TDesC& aNumber)
- {
- if ( IsActive() )
- {
- return;
- }
- CTelephony::TTelNumber telNumber(aNumber);
- iCallParams.iIdRestrict = CTelephony::ESendMyId;
- iTelephony->DialNewCall(iStatus, iCallParamsPckg, telNumber, iCallId);
-
- SetActive();
- iSyncWaiter.Start();
- }
-
-// ---------------------------------------------------------------------------
-// HangUp()
-// ---------------------------------------------------------------------------
-//
-void CDialClient::HangUp()
- {
- iTelephony->Hangup( iStatus , iCallId );
- }
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/tgenerichidapi.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1540 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID field search
-*
-*/
-
-#include <e32std.h>
-
-#include "tGenericHIDAPI.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CtGenericHIDAPI* CtGenericHIDAPI::NewLC()
- {
- CtGenericHIDAPI* self = new (ELeave) CtGenericHIDAPI();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CtGenericHIDAPI* CtGenericHIDAPI::NewL()
- {
- CtGenericHIDAPI* self = NewLC();
- CleanupStack::Pop();
- return self;
- }
-// ---------------------------------------------------------------------------
-// Constructor
-// ---------------------------------------------------------------------------
-//
-CtGenericHIDAPI::CtGenericHIDAPI()
- {
- }
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CtGenericHIDAPI::~CtGenericHIDAPI()
- {
- delete iHidDriver;
- iFieldList.Close();
- delete iGenHID;
- }
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::ConstructL()
- {
- iGenHID = CGenericHid::NewL( this );
- iDriverAcces=iGenHID;
-
- iHidDriver = CHidDriver::NewL(TUid::Uid(0xE000B187),iGenHID);
- }
-// ---------------------------------------------------------------------------
-// ConnectL()
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::ConnectL(TInt aConnectionId, const TDesC8& aDescriptor)
- {
- TInt16 ret = iGenHID->ConnectedL( aConnectionId, aDescriptor );
- ret = iGenHID->DriverActive( aConnectionId , CHidTransport::EActive);
-
- //todo retval
- }
-
-// ---------------------------------------------------------------------------
-// DisconnectL()
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::DisconnectL(TInt aConnectionId )
- {
- TInt16 ret = iGenHID->Disconnected( aConnectionId );
- //todo retval
- }
-
-// ---------------------------------------------------------------------------
-// DataInL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::DataInL(TInt aConnectionId, const TDesC8& aDescriptor)
- {
- TInt16 ret = iGenHID->DataIn(aConnectionId, CHidTransport::EHidChannelInt, aDescriptor);
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// RunCountryCodeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunCountryCodeL()
- {
- TInt16 countryCode = iGenHID->CountryCodeL(0);
- if(countryCode != 0)
- return KErrNotFound;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunVendorIdL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunVendorIdL()
- {
- TUint vendorId = iGenHID->VendorIdL(0);
- if(vendorId != 0x0421)
- return KErrNotFound;
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunProductIdL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunProductIdL()
- {
- TUint productId = iGenHID->ProductIdL(0);
- if(productId != 0x0083)
- return KErrNotFound;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunSetProtocol()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunSetProtocolL()
- {
- iGenHID->SetProtocolL(0,0,MDriverAccess::EReport,iHidDriver);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunGetProtocoL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunGetProtocoL()
- {
- iGenHID->GetProtocolL(0,0);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunGetReportL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunGetReportL()
- {
- iGenHID->GetReportL(0, 0 ,0 , 0);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunSetReportL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunSetReportL(const TDesC8& aDescriptor)
- {
- iGenHID->SetReportL(0,0, MDriverAccess::EOutput, aDescriptor,0, iHidDriver);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// GetDataOutL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunDataOutL(const TDesC8& aDescriptor)
- {
- iGenHID->DataOutL( 0, 0, aDescriptor, 0);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// GetGetIdleL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::GetGetIdleL()
- {
- iGenHID->GetIdleL(0, 0, 0);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// RunSetIdleL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::RunSetIdleL()
- {
- iGenHID->SetIdleL(0, 10, 0, 0, iHidDriver);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// GetCommandResultL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::GetCommandResultL()
- {
- iGenHID->CommandResult(0, 1);
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// GetReportDescriptorL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::GetReportDescriptorL()
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- if(tmp == NULL)
- return KErrNotFound;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CreateReportGeneratorL
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CreateReportGeneratorL()
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
-
- if(tmp == NULL)
- return KErrNotFound;
-
- iReportGenerator = CReportGenerator::NewL(tmp, 0, CField::EInput);
-
- if(iReportGenerator == NULL)
- return KErrNotFound;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// DeleteReportGeneratorL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::DeleteReportGeneratorL()
- {
- delete iReportGenerator;
- iReportGenerator = NULL;
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// ReportGeneratorReport()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportGeneratorReport()
- {
- iReportGenerator->Report();
- //todo check return value???
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// ReportGeneratorReport()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportGeneratorSetFieldL( TBool aIsArray, TBool aOutOfRange, TBool aFieldNull, TBool aFieldCountZero, TBool aExistingUsageId, TBool aBadIndex )
- {
- CField* field = CreateCFieldL();
-
- TInt usageId = EConsumerUsageVolumeInc;//233;//0xE9
- TInt indexOffset = 0;
-
- if(aBadIndex != EFalse)
- {
- indexOffset = 1000;
- }
-
- if(aExistingUsageId == EFalse)
- {
- usageId = EConsumerUsagePlayPause;//205
- field->SetUsageRange(0,255);
- }
-
- if(aIsArray == EFalse)
- {
- field->SetAttributes(KFieldAttributeVariable);
- if(field->IsArray() != EFalse)
- {
- return KErrGeneral;
- }
- }
- else
- {
- field->SetAttributes(!KFieldAttributeVariable);
- if(field->IsArray() == EFalse)
- {
- return KErrGeneral;
- }
- }
-
- field->SetLogicalMax(10);
- if(aOutOfRange != EFalse)
- {
- field->SetLogicalMin(5);
- }
-
- if(aFieldCountZero != EFalse)
- {
- field->SetCount(0);
- }
-
- const CField* constField;
- if(aFieldNull == EFalse)
- {
- constField = (const CField*)field;
- }
- else
- {
- constField = NULL;
- }
- TInt16 ret = iReportGenerator->SetField(constField, usageId, 1, indexOffset);
- return ret;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CreateReportTranslatorL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CreateReportTranslatorL( const TDesC8& aDescriptor, TBool aIsArray, TBool aFieldNull, TBool aFieldCountZero)
- {
- CField* field = CreateCFieldL();
-
-
- if(aIsArray == EFalse)
- {
- field->SetAttributes(KFieldAttributeVariable);
- if(field->IsArray() != EFalse)
- {
- return KErrGeneral;
- }
- }
- else
- {
- field->SetAttributes(!KFieldAttributeVariable);
- if(field->IsArray() == EFalse)
- {
- return KErrGeneral;
- }
- }
-
- /* field->SetLogicalMax(10);
- if(aOutOfRange != EFalse)
- {
- field->SetLogicalMin(5);
- }*/
-
- if(aFieldCountZero != EFalse)
- {
- field->SetCount(0);
- }
-
- const CField* constField;
- if(aFieldNull == EFalse)
- {
- constField = (const CField*)field;
- }
- else
- {
- constField = NULL;
- }
-
-
-
-
- //const CField* field = CreateConstCFieldL();
- iTranslator = new (ELeave) TReportTranslator(aDescriptor, constField);
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CreateReportTranslator_FieldNullL
-// -----------------------------------------------------------------------------
-//
-/*TInt CtGenericHIDAPI::CreateReportTranslator_FieldNullL( const TDesC8& aDescriptor )
- {
- const CField* field = NULL;
- iTranslator = new (ELeave) TReportTranslator(aDescriptor, field);
- return KErrNone;
- }*/
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::DeleteReportTranslatorL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::DeleteReportTranslatorL( )
- {
- delete iTranslator;
- iTranslator =NULL;
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorGetValueL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorGetValueL()
- {
- //todo if
- TInt value = 0;
- TInt res = iTranslator->GetValue(value,EConsumerUsageVolumeInc);
-
- return res;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorValueL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorValueL()
- {
- TInt value = iTranslator->ValueL(EConsumerUsageVolumeInc);
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorGetUsageIdL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorGetUsageIdL( TBool aBadControlIndex )
- {
- TInt id;
- TInt index = 0;
-
- if(aBadControlIndex != EFalse)
- {
- index = -1;//bad index
- }
- //todo if
- TInt ret = iTranslator->GetUsageId(id,index);
-
- return ret;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorUsageIdL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorUsageIdL( )
- {
- TInt value = iTranslator->UsageIdL(0);
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorRawValueL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorRawValueL( )
- {
- TInt value = iTranslator->RawValueL(0);
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportTranslatorCountL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportTranslatorCountL( )
- {
- TInt count =iTranslator->Count();
- //todo if, retval
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectiontypeL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectiontypeL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TUint32 type=tmp->Type();
- //todo check type?
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsPhysicalL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsPhysicalL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TBool result=tmp->IsPhysical();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsLogicalL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsLogicalL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TBool result=tmp->IsLogical();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsReportL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsReportL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TBool result=tmp->IsReport();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsNamedArrayL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsNamedArrayL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TBool result =tmp->IsNamedArray();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsUsageSwitchL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsUsageSwitchL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TBool resul = tmp->IsUsageSwitch();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsUsageModifierL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsUsageModifierL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->IsUsageModifier();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionIsApplicationL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionIsApplicationL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->IsApplication();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionUsagePageL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionUsagePageL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->UsagePage();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionUsageL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionUsageL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->Usage();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionCollectionCountL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionCollectionCountL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->CollectionCount();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionFieldCountL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionFieldCountL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt result = tmp->FieldCount();
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionCollectionByIndexL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionCollectionByIndexL( TBool aPresent )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt index;
-
- index = (aPresent != EFalse) ? 0 : -1;
-
- const CCollection* result = tmp->CollectionByIndex(index);
-
- if(aPresent != EFalse && result == NULL)
- return KErrGeneral;
-
- if(aPresent == EFalse && result != NULL)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::CollectionFieldByIndexL
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::CollectionFieldByIndexL( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- const CField* result = tmp->FieldByIndex(-1);
-
- if(result != NULL)
- return KErrGeneral;
- //todo if
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CtGenericHid::ReportrootReportSizeBytes
-// -----------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::ReportrootReportSizeBytes( )
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- TInt16 size = tmp->ReportSizeBytes(0,CField::EInput);
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldLogicalMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldLogicalMaxL( )//todo remove
- {
- CField* field = CreateCFieldL();
- const TInt max = 5;
- field->SetLogicalMax(max);
- TInt ret = field->LogicalMax();
- if(ret != max)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldPhysicalMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldPhysicalMinL( )//todo remove
- {
- CField* field = CreateCFieldL();
- const TInt min = 0;
- field->SetPhysicalMin(min);
- TInt ret = field->PhysicalMin();
- if(ret != min)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldPhysicalMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldPhysicalMaxL( )//todo remove
- {
- CField* field = CreateCFieldL();
- const TInt max = 5;
- field->SetPhysicalMax(max);
- TInt ret=field->PhysicalMax();
- if(ret != max)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUnitL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUnitL( )
- {
- CField* field = CreateCFieldL();
- TInt unit = 5;
- field->SetUnit(unit);
- TInt ret = field->Unit();
- if(ret != unit)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUnitExponentL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUnitExponentL( )
- {
- CField* field = CreateCFieldL();
- TInt unitExponent = 5;
- field->SetUnitExponent(unitExponent);
- TInt ret = field->UnitExponent();
- if(ret != unitExponent)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldCountL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldCountL( )
- {
- CField* field = CreateCFieldL();
- TInt count = 5;
- field->SetCount(count);
- TInt ret = field->Count();
- if(ret != count)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSizeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSizeL( )
- {
- CField* field = CreateCFieldL();
- TInt size = 5;
- field->SetSize(size);
- TInt ret = field->Size();
- if(ret != size)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldOffsetL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldOffsetL(TBool setReport )
- {
- CField* field = CreateCFieldL();
-
- if(setReport != EFalse)
- {
- field->SetReportId(5);
- }
-
- TInt offset = 5;
- field->SetOffset(offset);
- TInt ret = field->Offset();
-
- if(setReport != EFalse)
- {
- offset += KSizeOfByte;
- }
-
- if(ret != offset)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldReportIdL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldReportIdL( )
- {
- CField* field = CreateCFieldL();
- TInt reportId = 5;
- field->SetReportId(reportId);
- TInt ret = field->ReportId();
- if(ret != reportId)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsInReportL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsInReportL( )
- {
- CField* field = CreateCFieldL();
- TInt reportId = 5;
- field->SetReportId(reportId);
- TBool ret = field->IsInReport(reportId);
- if(!ret)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldDesignatorIndexL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldDesignatorIndexL( )
- {
- CField* field = CreateCFieldL();
- TInt designatorIndex = 5;
- field->SetDesignatorIndex(designatorIndex);
- TInt ret = field->DesignatorIndex();
- if(ret != designatorIndex)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldStringIndexL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldStringIndexL( )
- {
- CField* field = CreateCFieldL();
- TInt stringIndex = 5;
- field->SetStringIndex(stringIndex);
- TInt ret = field->StringIndex();
- if(ret != stringIndex)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUsagePageL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUsagePageL( )
- {
- CField* field = CreateCFieldL();
- TInt usagePage = 5;
- field->SetUsagePage(usagePage);
- TInt ret = field->UsagePage();
- if(ret != usagePage)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldHasUsageL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldHasUsageL( )
- {
- CField* field = CreateCFieldL();
- TInt usage = 233;
- field->AddUsageL(usage);
- TBool ret = field->HasUsage(usage);
- if(!ret)
- return KErrGeneral;
- //todo check EFalse
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUsageArrayL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUsageArrayL( )
- {
- CField* field = CreateCFieldL();
- TInt usage = 233;
- field->AddUsageL(usage);
- TArray<TInt> usageArray = field->UsageArray();
-
- if(usageArray[0] != usage)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUsageL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUsageL( )
- {
- CField* field = CreateCFieldL();
- TInt usage = 233;
- field->AddUsageL(usage);
- TInt ret = field->Usage(0);
-
- if(ret != usage)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldUsageCountL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldUsageCountL( )
- {
- CField* field = CreateCFieldL();
- TInt firstCount = field->UsageCount();
- TInt usage = 233;
- field->AddUsageL(usage);
- TInt secondCount = field->UsageCount();
-
- if(secondCount != firstCount+1)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldClearUsageListL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldClearUsageListL( )
- {
- CField* field = CreateCFieldL();
- TInt usage = 233;
- field->AddUsageL(usage);
- TInt ret = field->UsageCount();
-
- if(ret == 0)
- return KErrGeneral;
-
- field->ClearUsageList();
- ret = field->UsageCount();
- if(ret != 0)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldLastUsageL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldLastUsageL( TBool empty )
- {
- CField* field = CreateCFieldL();
- //todo if - without add
- TInt usage = 233;
-
- if(empty != EFalse)
- {
- field->ClearUsageList();
- usage = 0;
- }
- else
- {
- field->AddUsageL(usage);
- }
-
- TInt ret = field->LastUsage();
-
- if(ret != usage)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldAttributesL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldAttributesL( )
- {
- CField* field = CreateCFieldL();
- TUint32 attributes = KFieldAttributeConstant;
- field->SetAttributes(attributes);
- TUint32 ret = field->Attributes();
- if(ret != attributes)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldTypeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldTypeL( )
- {
- CField* field = CreateCFieldL();
- CField::TType type = CField::EInput;
- field->SetType(type);
- CField::TType ret = field->Type();
- if(ret != type)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsVariableL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsVariableL( )
- {
- CField* field = CreateCFieldL();
- TUint32 attributes = KFieldAttributeVariable;
- field->SetAttributes(attributes);
- TBool ret = field->IsVariable();
- if(!ret)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsArrayL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsArrayL( )
- {
- CField* field = CreateCFieldL();
- TUint32 attributes = KFieldAttributeVariable;
- field->SetAttributes(attributes);
- TBool ret = field->IsArray();
- if(ret)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsConstantL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsConstantL( )
- {
- CField* field = CreateCFieldL();
- TUint32 attributes = KFieldAttributeConstant;
- field->SetAttributes(attributes);
- TBool ret = field->IsConstant();
- if(!ret)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsDataL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsDataL( )
- {
- CField* field = CreateCFieldL();
- TUint32 attributes = KFieldAttributeConstant;
- field->SetAttributes(attributes);
- TBool ret = field->IsData();
- if(ret)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetLogicalMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetLogicalMinL()
- {
- CField* field = CreateCFieldL();
-
- TInt value = 0;
- field->SetLogicalMin(value);
-
- TInt ret = field->LogicalMin();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetLogicalMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetLogicalMaxL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 10;
- field->SetLogicalMax(value);
-
- TInt ret = field->LogicalMax();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetPhysicalMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetPhysicalMinL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 0;
- field->SetPhysicalMin(value);
- TInt ret = field->PhysicalMin();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetPhysicalMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetPhysicalMaxL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 2;
- field->SetPhysicalMax(value);
- TInt ret = field->PhysicalMax();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetDesignatorMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetDesignatorMinL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 0;
- field->SetDesignatorMin(value);
- TInt ret = field->DesignatorMin();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetDesignatorMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetDesignatorMaxL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 2;
- field->SetDesignatorMax(value);
- TInt ret = field->DesignatorMax();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetUsageMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetUsageMinL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 0;
- field->SetUsageMin(value);
- TInt ret = field->UsageMin();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetUsageMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetUsageMaxL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 2;
- field->SetUsageMax(value);
- TInt ret = field->UsageMax();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetStringMinL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetStringMinL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 0;
- field->SetStringMin(value);
- TInt ret = field->StringMin();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// FieldSetStringMaxL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetStringMaxL( )
- {
- CField* field = CreateCFieldL();
- TInt value = 2;
- field->SetStringMax(value);
- TInt ret = field->StringMax();
- if(ret != value)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetLogicalRangeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetLogicalRangeL( )
- {
- CField* field = CreateCFieldL();
- TInt min = 0;
- TInt max = 5;
- field->SetLogicalRange(min,max);
- TInt retMin = field->LogicalMin();
- TInt retMax = field->LogicalMax();
- if(min != retMin || max != retMax)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetUsageRangeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetUsageRangeL( )
- {
- CField* field = CreateCFieldL();
- TInt min = 0;
- TInt max = 5;
- field->SetUsageRange(min,max);
- TInt retMin = field->UsageMin();
- TInt retMax = field->UsageMax();
- if(min != retMin || max != retMax)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetPhysicalRangeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetPhysicalRangeL( )
- {
- CField* field = CreateCFieldL();
- TInt min = 0;
- TInt max = 5;
- field->SetPhysicalRange(min,max);
- TInt retMin = field->PhysicalMin();
- TInt retMax = field->PhysicalMax();
- if(min != retMin || max != retMax)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetStringRangeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetStringRangeL( )
- {
- CField* field = CreateCFieldL();
- TInt min = 0;
- TInt max = 5;
- field->SetStringRange(min,max);
- TInt retMin = field->StringMin();
- TInt retMax = field->StringMax();
- if(min != retMin || max != retMax)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldSetDesignatorRangeL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldSetDesignatorRangeL( )
- {
- CField* field = CreateCFieldL();
- TInt min = 0;
- TInt max = 5;
- field->SetDesignatorRange(min,max);
- TInt retMin = field->DesignatorMin();
- TInt retMax = field->DesignatorMax();
- if(min != retMin || max != retMax)
- return KErrGeneral;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsInputL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsInputL( )
- {
- CField* field = CreateCFieldL();
- CField::TType type = CField::EInput;
- field->SetType(type);
- TBool ret = field->IsInput();
- if(!ret)
- return KErrGeneral;
- //todo check EFalse
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsOutputL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsOutputL( )
- {
- CField* field = CreateCFieldL();
- CField::TType type = CField::EOutput;
- field->SetType(type);
- TBool ret = field->IsOutput();
- if(!ret)
- return KErrGeneral;
- //todo check EFalse
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// FieldIsFeatureL()
-// ---------------------------------------------------------------------------
-//
-TInt CtGenericHIDAPI::FieldIsFeatureL( )
- {
- CField* field = CreateCFieldL();
- CField::TType type = CField::EFeature;
- field->SetType(type);
- TBool ret = field->IsFeature();
- if(!ret)
- return KErrGeneral;
- //todo check EFalse
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CountryCodeL()
-// ---------------------------------------------------------------------------
-//
-TUint CtGenericHIDAPI::CountryCodeL(TInt /*aConnID*/)
- {
- return 0;
- }
-
-// ---------------------------------------------------------------------------
-// VendorIdL
-// ---------------------------------------------------------------------------
-//
-TUint CtGenericHIDAPI::VendorIdL(TInt /*aConnID*/)
- {
- return 0x0421;
- }
-
-// ---------------------------------------------------------------------------
-// ProductIdL
-// ---------------------------------------------------------------------------
-//
-TUint CtGenericHIDAPI::ProductIdL(TInt /*aConnID*/)
- {
- return 0x0083;
- }
-
-// ---------------------------------------------------------------------------
-// GetProtocolL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::GetProtocolL(TInt /*aConnID*/, TUint16 /*aInterface*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// SetProtocolL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::SetProtocolL(TInt /*aConnID*/, TUint16 /*aValue*/,
- TUint16 /*aInterface*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// GetReportL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::GetReportL(TInt /*aConnID*/, TUint8 /*aReportType*/,
- TUint8 /*aReportID*/, TUint16 /*aInterface*/, TUint16 /*aLength*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// SetReportL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::SetReportL(TInt /*aConnID*/, TUint8 /*aReportType*/,TUint8 /*aReportID*/,
- TUint16 /*aInterface*/, const TDesC8& /*aReport*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// DataOutL()
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::DataOutL(TInt /*aConnID*/, TUint8 /*aReportID*/,
- TUint16 /*aInterface*/, const TDesC8& /*aReport*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// GetIdleL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::GetIdleL(TInt /*aConnID*/, TUint8 /*aReportID*/,
- TUint16 /*aInterface*/)
- {
- }
-
-// ---------------------------------------------------------------------------
-// SetIdleL
-// ---------------------------------------------------------------------------
-//
-void CtGenericHIDAPI::SetIdleL(TInt /*aConnID*/, TUint8 /*aDuration*/, TUint8 /*aReportID*/,
- TUint16 /*aInterface*/)
- {
- }
-
-const CField* CtGenericHIDAPI::CreateConstCFieldL()
- {
- CReportRoot* tmp=iGenHID->ReportDescriptor(0);
- User::LeaveIfNull(tmp);
- const CCollection* collection = tmp->CollectionByIndex(0);
- if(collection == NULL)
- User::Leave(KErrGeneral);
- const CField* field=collection->FieldByIndex(0);
- return field;
- }
-
-CField* CtGenericHIDAPI::CreateCFieldL()
- {
- return (CField*)CreateConstCFieldL();
- }
--- a/localconnectivityservice/generichid/tsrc/GenericHidTest/src/timer.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID Heaset plugin timeouttimer
-*
-*/
-
-
-#include "timer.h"
-
-// ======== MEMBER FUNCTIONS ========
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CWaitTimer* CWaitTimer::NewL( TTimeIntervalMicroSeconds32 aTimeOutTime )
- {
- CWaitTimer* self = CWaitTimer::NewLC( aTimeOutTime );
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CWaitTimer* CWaitTimer::NewLC( TTimeIntervalMicroSeconds32 aTimeOutTime )
- {
- CWaitTimer* self = new (ELeave) CWaitTimer();
- CleanupStack::PushL(self);
- self->ConstructL( aTimeOutTime );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CTimeOutTimer()
-// ---------------------------------------------------------------------------
-//
-CWaitTimer::CWaitTimer():
- CTimer( EPriorityStandard )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CWaitTimer::~CWaitTimer()
- {
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CWaitTimer::ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime )
- {
- CTimer::ConstructL();
- CActiveScheduler::Add(this);
- After( aTimeOutTime );
- iSyncWaiter.Start();
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive
-// RunL()
-// ---------------------------------------------------------------------------
-//
-void CWaitTimer::RunL()
- {
- // Timer request has completed, so notify the timer's owner
- iSyncWaiter.AsyncStop();
- }
--- a/localconnectivityservice/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build information file for project ?myapp
-*
-*/
-
-
-PRJ_PLATFORMS
-DEFAULT
-
-#include "../locod/group/bld.inf"
-#include "../dun/group/bld.inf"
-#include "../generichid/group/bld.inf"
-#include "../headset/group/bld.inf"
-
-PRJ_EXPORTS
-
-
-PRJ_MMPFILES
-
-PRJ_TESTMMPFILES
-
-PRJ_TESTEXPORTS
--- a/localconnectivityservice/headset/data/hidheadset.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ECOM plugin resource file for headset driver.
-*
-*/
-
-#include <ecom/registryinfo.rh>
-#include "headsetuids.h"
-
-RESOURCE REGISTRY_INFO theInfo
- {
- dll_uid = HEADSET_UID;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = DRIVER_PLUGIN_IF;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = HEADSET_DRIVER_IMP;
- version_no = 1;
- display_name = "HID Headset Driver Plugin";
- }
- };
- }
- };
- }
--- a/localconnectivityservice/headset/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build information file for project headset
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_MMPFILES
-hidheadset.mmp
-
-PRJ_PLATFORMS
-WINSCW ARMV5
-
-#include "../hidremconbearer/group/bld.inf"
-
-PRJ_EXPORTS
-../rom/hidheadset.iby CORE_MW_LAYER_IBY_EXPORT_PATH(hidheadset.iby)
\ No newline at end of file
--- a/localconnectivityservice/headset/group/headset.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component headset
-
-source \sf\mw\remoteconn\localconnectivityservice\headset
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/localconnectivityservice/headset/group/hidheadset.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project hidheadset
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include "../inc/headsetuids.h"
-
-TARGET hidheadset.dll
-TARGETTYPE PLUGIN
-UID ECOM_UID HEADSET_UID
-
-CAPABILITY CAP_APPLICATION CommDD ProtServ
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE headset.cpp
-SOURCE finder.cpp
-SOURCE hidheadsetdriverproxy.cpp
-SOURCE keypresstimer.cpp
-
-START RESOURCE ../data/hidheadset.rss
- TARGET hidheadset.rsc
-END // ECOM resource definition
-
-#ifdef NO101APPDEPFIXES
-APP_LAYER_SYSTEMINCLUDE
-#else //NO101APPDEPFIXES
-MW_LAYER_SYSTEMINCLUDE
-#endif //NO101APPDEPFIXES
-
-USERINCLUDE ../inc ../hidremconbearer/inc
-USERINCLUDE ../../../inc
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY generichid.lib
-LIBRARY etel3rdparty.lib
-LIBRARY alarmclient.lib
-LIBRARY mpxplaybackutility.lib
-LIBRARY mpxcommon.lib
-
-
--- a/localconnectivityservice/headset/hidremconbearer/data/hidremconbearer.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Resource definitions for project hidremconbearer
-*
-*/
-
-
-// INCLUDES
-#include <ecom/registryinfov2.rh>
-#include "headsetuids.h"
-
-// RESOURCE DEFINITIONS
-// -----------------------------------------------------------------------------
-//
-// REGISTRY_INFO theInfo
-// Information needed for Ecom Plugin
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE REGISTRY_INFO theInfo
- {
- resource_format_version = RESOURCE_FORMAT_VERSION_2;
- dll_uid = HIDREMCON_UID;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = REMCON_PLUGIN_IF;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = HIDREMCON_IMP;
- version_no = 1;
- display_name = "HidRemconBearer";
- default_data = "";
- opaque_data = "";
- }
- };
- }
- };
- }
-
--- a/localconnectivityservice/headset/hidremconbearer/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build information file for project hidremconbearer
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-hidremconbearer.mmp
-
--- a/localconnectivityservice/headset/hidremconbearer/group/hidremconbearer.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project hidremconbearer
-*
-*/
-
-#include <data_caging_paths.hrh>
-#include <remcon/remconservercaps.mmh>
-#include <platform_paths.hrh>
-#include "../../inc/headsetuids.h"
-
-
-TARGET hidremconbearer.dll
-
-// CAPABILITY CAP_ECOM_PLUGIN
-// capabilities are required as that of remconbearerplugin.dll
-// getting it from #include <remcon/remconservercaps.mmh>
-
-TARGETTYPE PLUGIN
-UID 0x10009d8d HIDREMCON_UID
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE hidremconbearermain.cpp
-SOURCE hidremconbearerimplementation.cpp
-SOURCE hidremconbearerobserver.cpp
-
-
-START RESOURCE ../data/hidremconbearer.rss
-TARGET hidremconbearer.rsc
-END // ECOM resource definition
-
-
-USERINCLUDE . ../inc ../../inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY remconbearerplugin.lib
-LIBRARY remcontypes.lib
-
--- a/localconnectivityservice/headset/hidremconbearer/inc/debug.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Logging definition
-*
-*/
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include "debugconfig.h"
-
-#ifdef PRJ_ENABLE_TRACE
-
-#ifdef PRJ_FILE_TRACE
-#include <flogger.h>
-#else
-#include <e32debug.h>
-#endif
-
-const TInt KMaxLogLineLength = 512;
-
-#define KPRINTERROR 0x00000001 // Tracing level: error
-#define KPRINTINFO 0x00000002 // Tracing level: function trace
-#define KPRINTSTATE 0x00000004 // Tracing level: state machine info
-#define KPRINTWARNING 0x00000008 // Tracing level: warning
-
-const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING;
-
-NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
- {
-public:
- void Overflow(TDes16& /*aDes*/) {}
- };
-
-NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
- {
-public:
- void Overflow(TDes8& /*aDes*/) {}
- };
-
-inline void Trace(TRefByValue<const TDesC16> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list,aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TBuf16<KMaxLogLineLength> theFinalString;
- theFinalString.Append(KTracePrefix16);
- TOverflowTruncate16 overflow;
- theFinalString.AppendFormatList(aFmt,list,&overflow);
- RDebug::Print(theFinalString);
-#endif
- }
-
-inline void Trace(TRefByValue<const TDesC8> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list, aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TOverflowTruncate8 overflow;
- TBuf8<KMaxLogLineLength> buf8;
- buf8.Append(KTracePrefix8);
- buf8.AppendFormatList(aFmt, list, &overflow);
- TBuf16<KMaxLogLineLength> buf16(buf8.Length());
- buf16.Copy(buf8);
- TRefByValue<const TDesC> tmpFmt(_L("%S"));
- RDebug::Print(tmpFmt, &buf16);
-#endif
- }
-
-inline void TracePanic(
- char* aFile,
- TInt aLine,
- TInt aPanicCode,
- const TDesC& aPanicCategory)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KPanicPrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName);
- Trace(buf);
- User::Panic(aPanicCategory, aPanicCode);
- }
-
-inline void TraceLeave(char* aFile, TInt aLine, TInt aReason)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KLeavePrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName);
- Trace(buf);
- User::LeaveIfError(aReason);
- }
-
-#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
-
-#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
-
-#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
-
-#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
-
-#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
-
-#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
-
-#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
-
-#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
-
-#define TRACE_FUNC_ENTRY_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
-
-#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
-
-#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
-
-#define TRACE_FUNC_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
-
-#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
-
-#else // PRJ_ENABLE_TRACE not defined
-
-#define TRACE_INFO(p)
-
-#define TRACE_ERROR(p)
-
-#define TRACE_STATE(p)
-
-#define TRACE_WARNING(p)
-
-#define TRACE_INFO_SEG(p)
-
-#define TRACE_ASSERT(GUARD, CODE)
-
-#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
-
-#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
-
-#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
-
-#define TRACE_FUNC_ENTRY
-
-#define TRACE_FUNC_ENTRY_THIS
-
-#define TRACE_FUNC_EXIT
-
-#define TRACE_FUNC
-
-#define TRACE_FUNC_THIS
-
-#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
-#endif // PRJ_ENABLE_TRACE
-
-#endif // PRJ_LOGGING_H
--- a/localconnectivityservice/headset/hidremconbearer/inc/debugconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-#ifndef DEBUGCONFIG_H
-#define DEBUGCONFIG_H
-
-#include "prjconfig.h"
-
-
-/**
- * Custom logging variations.
- */
-#ifdef PRJ_FILE_TRACE
-_LIT(KLogFile,"hidremcon.txt");
-_LIT(KLogDir,"hidremcon");
-#endif
-
-#ifdef PRJ_ENABLE_TRACE
-_LIT(KTracePrefix16, "[hidremcon] ");
-_LIT8(KTracePrefix8, "[hidremcon] ");
-_LIT8(KFuncFormat8, "><%S");
-_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
-_LIT8(KFuncEntryFormat8, ">%S");
-_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
-_LIT8(KFuncExitFormat8, "<%S");
-
-_LIT(KPanicCategory, "hidremcon");
-_LIT8(KPanicPrefix8, "PANIC code ");
-_LIT8(KLeavePrefix8, "LEAVE code ");
-#endif
-
-#endif // REMCONBEARER_DEBUGCONFIG_H
--- a/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerimplementation.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of class CHidRemconBearer.
- *
-*/
-
-
-#ifndef C_HIDREMCONBEARER_H
-#define C_HIDREMCONBEARER_H
-
-#include <e32base.h>
-#include <c32comm.h>
-#include <e32property.h>
-#include <remcon/remconbearerplugin.h>
-#include <remcon/remconbearerinterface.h>
-#include <remcon/messagetype.h>
-#include <AknCapServerClient.h>
-
-#include "hidremconbearerobserver.h"
-
-//CONSTANTS
-const TInt KDataBufferSize = 10;
-
-/**
- * CHidRemconBearer
- * Implementation of the Rem Con Bearer Plugin
- *
- */
-class CHidRemconBearer : public CRemConBearerPlugin,
- public MRemConBearerInterface,
- public MCallBackReceiver
- {
-public:
-
- /**
- * Two-phased constructor.
- * @param aParams required for the CRemConBearerPlugin
- * @return hidremconbearer plugin
- */
- static CHidRemconBearer* NewL( TBearerParams& aParams );
-
- /**
- * Destructor.
- */
- virtual ~CHidRemconBearer();
-
-private:
-
- /**
- * Constructor
- * @param aParams bearer parameters
- */
- CHidRemconBearer( TBearerParams& aParams );
-
- /**
- * Two - phase construction.
- */
- void ConstructL();
-
-private:
- // from CRemConBearerPlugin
-
- /**
- * From class CRemConBearerPlugin
- * Called by RemCon server to get a pointer to an object which implements
- * the bearer API with UID aUid. This is a mechanism for allowing future
- * change to the bearer API without breaking BC in existing (non-updated)
- * bearer plugins.
- *
- * @param aUid Inteface uid
- * @return Return pointer to interface
- */
- TAny* GetInterface( TUid aUid );
-
-private:
- // from MRemConBearerInterface
-
- /**
- * From class MRemConBearerInterface
- * Called by RemCon to retrieve a response on a connection.
- *
- * @param aInterfaceUid Inteface uid
- * @param aTransactionId Transaction id
- * @param aOperationId operation ID
- * @param aData API-specific message data.
- * @param aAddr The connection.
- * @return Error code
- */
- TInt GetResponse( TUid& aInterfaceUid, TUint& aTransactionId,
- TUint& aOperationId, RBuf8& aData, TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Send Remcon command
- *
- * @param aInterfaceUid Inteface uid
- * @param aCommand command id
- * @param aTransactionId Transaction id
- * @param aData API-specific message data.
- * @param aAddr The connection.
- * @return Error code
- */
- TInt SendCommand( TUid aInterfaceUid, TUint aCommand,
- TUint aTransactionId, RBuf8& aData, const TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Get Remcon command
- *
- * @param aInterfaceUid Inteface uid
- * @param aTransactionId Transaction id
- * @param aCommand command id
- * @param aData API-specific message data.
- * @param aAddr The connection.
- * @return Error code
- */
- TInt GetCommand( TUid& aInterfaceUid, TUint& aTransactionId,
- TUint& aCommand, RBuf8& aData, TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Send Response
- *
- * @param aInterfaceUid Inteface uid
- * @param aOperationID operation id
- * @param aTransactionId Transaction id
- * @param aData API-specific message data.
- * @param aAddr The connection.
- * @return Error code
- */
- TInt SendResponse( TUid aInterfaceUid, TUint aOperationId,
- TUint aTransactionId, RBuf8& aData, const TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Connect request
- *
- * @param aAddr The connection.
- */
- void ConnectRequest( const TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Disconnect request
- *
- * @param aAddr The connection.
- */
- void DisconnectRequest( const TRemConAddress& aAddr );
-
- /**
- * From class MRemConBearerInterface
- * Clientstatus
- *
- * @param aControllerPresent Controllerpresent status
- * @param aTargetPresent Target present status
- */
- void ClientStatus( TBool aControllerPresent, TBool aTargetPresent );
-
- /**
- * From class MRemConBearerInterface
- * Return security policy
- *
- * @return Security policy
- */
- TSecurityPolicy SecurityPolicy() const;
-
-private:
- // from MCallBackReceiver
-
- /**
- * From class MCallBackReceiver
- * Return security policy
- *
- * @param aScanCode a scancode
- * @param aKeyType a Keytype
- */
- void ReceivedKeyEvent( TInt aScanCode, TInt aKeyType );
-
-private:
- /**
- * From class MCallBackReceiver
- * Set SVK Operation ID and Data
- *
- * @param aEnumValue OperationID and data field
- */
- void SetSVKOperationIdAndData( TInt aEnumValue );
-
- /**
- * From class MCallBackReceiver
- * Set Mute Operation ID and Data
- *
- * @param aEnumValue OperationID and data field
- */
- void SetMuteKeyOperationIdAndData( TInt aEnumValue );
-
- /**
- * From class MCallBackReceiver
- * Set Media key Operation ID and Data
- *
- * @param aEnumValue OperationID and data field
- */
- void SetMediaKeyOperationIdAndData( TInt aEnumValue );
-
- /**
- * From class MCallBackReceiver
- * Set Media key Operation ID and Data
- *
- * @param aEnumValue OperationID and data field
- */
- void SetPhoneKeyOperationIdAndData( TInt aEnumValue );
-
- /**
- * RestartExpired observer
- *
- * @param aKeyType type of key
- */
- void RestartKeyObeserver( TInt aKeyType );
-
- /**
- * Restart Expired observer
- *
- * @param aEnumValue a value of key
- * @param aKeyType A type of key
- */
- void HandleKeyOperation( TInt aEnumValue, TInt aKeyType );
-
-private:
- // Data
-
- /**
- * Interface uid of last correct-decoded message
- */
- TUid iInterfaceUid;
-
- /**
- * Operation uid of last correct-decoded message
- */
- TUint iOperationId;
-
- /**
- * Data of last correct-decoded message
- */
- TBuf8<KDataBufferSize> iData;
-
- /**
- * Transactionid uid of last correct-decoded message
- */
- TUint iTransactionId;
-
- /**
- * Media key observer
- * Own.
- */
- CHidRemconBearerObserver* iMediaKeyObserver;
-
- /**
- * Accessory volume key observer
- * Own.
- */
- CHidRemconBearerObserver* iAccessoryVolKeyObserver;
-
- /**
- * Mute key observer
- * Own.
- */
- CHidRemconBearerObserver* iMuteKeyObserver;
-
- /**
- * Phone key observer
- * Own.
- */
- CHidRemconBearerObserver* iHookKeyObserver;
-
- };
-
-#endif // HIDREMCONBEARERIMPLEMENTATION_H
--- a/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerinternalpskeys.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HidRemconBearer internal Publish & Subscribe keys.
- *
-*/
-
-
-#ifndef HIDREMCONBEARERINTERNALPSKEYS_H
-#define HIDREMCONBEARERINTERNALPSKEYS_H
-
-const TUid KPSUidHidEventNotifier =
- {
- 0x101f9067
- /*0x10282c19*/}; // hid event publisher uid
-
-// Media Keys Notification API
-
-const TUint32 KHidControlKeyEvent = 0x00000001;
-const TUint32 KHidAccessoryVolumeEvent = 0x00000002;
-const TUint32 KHidMuteKeyEvent = 0x00000003;
-const TUint32 KHidHookKeyEvent = 0x00000004;
-
-#endif // __HIDREMCONBEARERINTERNALPSKEYS_H__
--- a/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerobserver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declaration of class CHidRemconBearerObserver
- *
-*/
-
-
-#ifndef C_HIDREMCONBEAREROBSERVER_H
-#define C_HIDREMCONBEAREROBSERVER_H
-
-#include <e32svr.h>
-#include <e32property.h>
-
-/**
- * Observer key types
- */
-enum TObserverKeyType
- {
- EMediaKeys = 0,
- EAccessoryVolumeKeys,
- EMuteKey,
- EHookKeys
- };
-
-/**
- * Call Back Receiver
- * On receiving event from the P & S, CHidRemconBearerObserver calls
- * this function
- *
- */
-class MCallBackReceiver
- {
-public:
- /**
- * Called when event has arrived from P&S.
- *
- * @param aEnumValue Enum value representing the key and action
- * @param aKeyType will indicate whether it is Volume key or Media key
- */
- virtual void ReceivedKeyEvent( TInt aEnumValue, TInt aKeyType ) = 0;
- };
-
-/**
- * Hid remcon bearer observer
- * This class inplements the Active Object. There will be two instance
- * of this ,one for handling Volume keys and other for Media Keys
- *
- */
-class CHidRemconBearerObserver : public CActive
- {
-public:
- // Constructors and destructor
-
- /**
- * Two-phased constructor.
- * @param aCallback reference of the class which implements
- * MCallBackReceiver for handling call back
- * functions
- * @param aKeyType Indiacates whether it is side volume key or
- * media key
- * @return remconbearer observer
- */
- static CHidRemconBearerObserver* NewL( MCallBackReceiver& aCallback,
- TInt aKeyType );
- /**
- * Destructor.
- */
- virtual ~CHidRemconBearerObserver();
-
-public:
- /**
- * Start remconbearer observer key events
- *
- * @return Error code
- */
- TInt Start();
-
- /**
- * Stop remconbearer observer key events
- *
- */
- void Stop();
-
-private:
- /**
- * Two-phased constructor.
- * @param aCallback reference of the class which implements
- * MCallBackReceiver for handling call back
- * functions
- */
- CHidRemconBearerObserver( MCallBackReceiver& aCallback );
-
- /**
- * Two-phased constructor.
- * @param aKeyType Indiacates whether it is side volume key or
- * media key
- */
- void ConstructL( TInt aKeyType );
-
-private:
- // From Base class CActive
-
- /**
- * From CActive
- * Handles an active object's request completion event.
- *
- */
- void RunL();
-
- /**
- * From CActive
- * Canceling outstanding request
- *
- */
- void DoCancel();
-
-private:
- // Data
- /**
- * RProperty for key subscribing key values
- */
- RProperty iProperty;
-
- /**
- * Callback to request handler
- */
- MCallBackReceiver& iCallback;
-
- /**
- * Key type
- */
- TInt iKeyType; // Vol key or media Key
- };
-
-#endif // HIDREMCONBEAREROBSERVER_H
-// End of file
--- a/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerscancodes.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid remconbearer scan codes
- *
-*/
-
-
-#ifndef HIDREMCONBEARERBEARERSCANCODES_H
-#define HIDREMCONBEARERBEARERSCANCODES_H
-
-/**
- * Side volume Key Codes
- */
-const TInt KPSVolumeDownReleased = -3;
-const TInt KPSVolumeDownPressed = -2;
-const TInt KPSVolumeDownClicked = -1;
-const TInt KPSVolumeNoKey = 0;
-const TInt KPSVolumeUpClicked = 1;
-const TInt KPSVolumeUpPressed = 2;
-const TInt KPSVolumeUpReleased = 3;
-const TInt KPSMuteClicked = 4;
-const TInt KPSMutePressed = 5;
-const TInt KPSMuteReleased = 6;
-// Hook keys keys
-const TInt KPSAnsweClicked = 1;
-const TInt KPSHangUpClicked = 2;
-const TInt KPSRedial = 3;
-const TInt KPSVoiceDial = 4;
-
-/**
- * Media Key codes
- */
-enum TMediaKeyValues
- {
- EPlayReleased = 0,
- EPlayPressed,
- EPlayClicked,
- EStopReleased,
- EStopPressed,
- EStopClicked,
- EForwardReleased,
- EForwardPressed,
- EForwardClicked,
- ERewindReleased,
- ERewindPressed,
- ERewindClicked,
- EFastForwardReleased,
- EFastForwardPressed,
- EFastForwardClicked,
- EBackwardReleased,
- EBackwardPressed,
- EBackwardClicked,
- EMuteReleased,
- EMutePressed,
- EMuteClicked
- };
-
-#endif // HIDREMCONBEARERBEARERSCANCODE_H
-//End of File
--- a/localconnectivityservice/headset/hidremconbearer/inc/prjconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef PRJCONFIG_H
-#define PRJCONFIG_H
-
-/**
- * Traces are enabled via RDebug::Print() in UDEB build, by default.
- */
-#ifdef _DEBUG
-#define PRJ_ENABLE_TRACE
-#endif
-
-/**
- * Traces will be written to file if this is defined.
- */
-//#define PRJ_FILE_TRACE
-
-
-/**
- * build the project for module test purpose if this is defined
- */
-//#define PRJ_MODULETEST_BUILD
-
-/**
- * build the project using stubs to replace the dependencies if this is defined
- */
-//#define PRJ_USE_STUB
-
-#endif // PRJCONFIG_H
--- a/localconnectivityservice/headset/hidremconbearer/src/hidremconbearerimplementation.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,522 +0,0 @@
-/*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Bearer plugin API Implementation file
- *
-*/
-
-#include <e32def.h>
-#include <remcon/remconbearerobserver.h>
-#include <remcon/remconconverterplugin.h>
-#include <remconaddress.h>
-#include <remconcoreapi.h>
-#include <RemConExtensionApi.h>
-#include <PSVariables.h> // Property values
-#include <coreapplicationuisdomainpskeys.h>
-#include "hidremconbearerinternalpskeys.h"
-#include "hidremconbearerscancodes.h"
-#include "hidremconbearerimplementation.h"
-#include "hidremconbearerobserver.h"
-#include "debug.h"
-
-_LIT8(KFormatString,"%c");
-_LIT8(KVoiceFormatString,"%d");
-_LIT_SECURITY_POLICY_C1(KHidRemconBearerReadPolicy, ECapability_None);
-_LIT_SECURITY_POLICY_C1(KHidRemconBearerWritePolicy, ECapability_None);
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::NewL()
-// Description: Factory function.
-// return: Ownership of a new CHidRemconBearer.
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearer* CHidRemconBearer::NewL( TBearerParams& aParams )
- {
- CHidRemconBearer* self = new ( ELeave ) CHidRemconBearer( aParams );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::~CHidRemconBearer()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearer::~CHidRemconBearer()
- {
- delete iMediaKeyObserver;
- delete iAccessoryVolKeyObserver;
- delete iMuteKeyObserver;
- delete iHookKeyObserver;
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::CHidRemconBearer()
-// construction.
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearer::CHidRemconBearer( TBearerParams& aParams ) :
- CRemConBearerPlugin( aParams )
- {
- //Pass
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::ConstructL()
-// 2nd-phase construction.
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::ConstructL()
- {
- TRACE_FUNC_ENTRY
- // throw an indication up to RemCon.
- TRemConAddress addr;
- addr.BearerUid() = Uid();
- TInt err = Observer().ConnectIndicate( addr );
-
- //Define the P&S for Volume keys and Media Keys
- RProperty::Define( KPSUidHidEventNotifier, KHidControlKeyEvent,
- RProperty::EInt, KHidRemconBearerReadPolicy,
- KHidRemconBearerWritePolicy );
- // Define P&S Key for Volume keys from Accessory device
- RProperty::Define( KPSUidHidEventNotifier, KHidAccessoryVolumeEvent,
- RProperty::EInt, KHidRemconBearerReadPolicy,
- KHidRemconBearerWritePolicy );
- // Define P&S Key for Mute key from Accessory device
- RProperty::Define( KPSUidHidEventNotifier, KHidMuteKeyEvent,
- RProperty::EInt, KHidRemconBearerReadPolicy,
- KHidRemconBearerWritePolicy );
-
- // Define P&S Key for phone keys from Accessory device
- RProperty::Define( KPSUidHidEventNotifier, KHidHookKeyEvent,
- RProperty::EInt, KHidRemconBearerReadPolicy,
- KHidRemconBearerWritePolicy );
-
- // Start Active object for listening key events from P&S
-
- iMediaKeyObserver = CHidRemconBearerObserver::NewL( *this, EMediaKeys );
- iAccessoryVolKeyObserver = CHidRemconBearerObserver::NewL( *this,
- EAccessoryVolumeKeys );
-
- iMuteKeyObserver = CHidRemconBearerObserver::NewL( *this, EMuteKey );
-
- iHookKeyObserver = CHidRemconBearerObserver::NewL( *this, EHookKeys );
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::ConnectRequest()
-// Rem Con server send connect request to Bearer Plugin
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::ConnectRequest( const TRemConAddress& /*aAddr*/)
- {
- TRACE_FUNC
- // Pass
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::DisconnectRequest()
-// Rem Con server send disconnect request to Bearer Plugin
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::DisconnectRequest( const TRemConAddress& /*aAddr*/)
- {
- TRACE_FUNC
- // Pass
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SendResponse()
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHidRemconBearer::SendResponse( TUid /* aInterfaceUid */,
- TUint /*aOperationId*/,
- TUint /*aTransactionId*/, // we don't care about this transaction ID
- RBuf8& aData,
- const TRemConAddress& /*aAddr*/)
- {
- TRACE_FUNC
- aData.Close();
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SendCommand()
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHidRemconBearer::SendCommand( TUid /* aInterfaceUid */,
- TUint /* aOperationId */, TUint /* aTransactionId */,
- RBuf8& /* aData */, const TRemConAddress& /*aAddr*/)
- {
- TRACE_FUNC
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::GetResponse()
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHidRemconBearer::GetResponse( TUid& /* aInterfaceUid */,
- TUint& /* aTransactionId*/, TUint& /* aOperationId */,
- RBuf8& /* aData */, TRemConAddress& /*aAddr */)
- {
- TRACE_FUNC
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::GetCommand()
-//
-// ---------------------------------------------------------------------------
-//
-TInt CHidRemconBearer::GetCommand( TUid& aInterfaceUid,
- TUint& aTransactionId, TUint& aOperationId, RBuf8& aData,
- TRemConAddress& aAddr )
- {
- TRACE_FUNC
- aInterfaceUid = iInterfaceUid;
- aOperationId = iOperationId;
- // Pass ownership of this to RemCon.
- TRAPD(retTrap, aData.CreateL(iData));
- if ( retTrap != KErrNone )
- {
- return retTrap;
- }
- aAddr.BearerUid() = Uid();
- aAddr.Addr() = KNullDesC8();
- aTransactionId = iTransactionId;
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SetSVKOperationIdAndData()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::SetSVKOperationIdAndData( TInt aEnumValue )
- {
- TRACE_FUNC
- // 1. Interface ID is required when Getcommand is called
- iInterfaceUid = TUid::Uid( KRemConCoreApiUid ); // from Remconcoreapi.h
- switch ( aEnumValue )
- {
- case KPSVolumeUpPressed:
- iOperationId = ERemConCoreApiVolumeUp;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case KPSVolumeUpReleased:
- iOperationId = ERemConCoreApiVolumeUp;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case KPSVolumeUpClicked:
- iOperationId = ERemConCoreApiVolumeUp;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case KPSVolumeDownPressed:
- iOperationId = ERemConCoreApiVolumeDown;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case KPSVolumeDownReleased:
- iOperationId = ERemConCoreApiVolumeDown;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case KPSVolumeDownClicked:
- iOperationId = ERemConCoreApiVolumeDown;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case KPSVolumeNoKey: // This should never execute
- break;
- default:
- iOperationId = aEnumValue;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SetMuteKeyOperationIdAndData
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::SetMuteKeyOperationIdAndData( TInt aEnumValue )
- {
- TRACE_INFO((_L("[HID]\tCHidRemconBearer::SetMuteKeyOperation \
- IdAndData( %d )"), aEnumValue));
- // 1. Interface ID is required when Getcommand is called
- iInterfaceUid = TUid::Uid( KRemConCoreApiUid ); // from Remconcoreapi.h
- switch ( aEnumValue )
- {
- case KPSMutePressed:
- iOperationId = ERemConCoreApiMute;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case KPSMuteReleased:
- iOperationId = ERemConCoreApiMute;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case KPSMuteClicked:
- iOperationId = ERemConCoreApiMute;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- default:
- TRACE_INFO(_L("CHidRemconBearer::SetMuteKeyOperationIdAndData : \
- Not supported"))
- ;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SetMediaKeyOperationIdAndData()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::SetMediaKeyOperationIdAndData( TInt aEnumValue )
- {
- TRACE_FUNC
- // 1. Interface ID is required when Getcommand is called
- iInterfaceUid = TUid::Uid( KRemConCoreApiUid ); // from Remconcoreapi.h
- switch ( aEnumValue )
- {
- case EPlayReleased:
- iOperationId = ERemConCoreApiPausePlayFunction;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case EPlayPressed:
- iOperationId = ERemConCoreApiPausePlayFunction;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case EPlayClicked:
- iOperationId = ERemConCoreApiPausePlayFunction;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case EStopReleased:
- iOperationId = ERemConCoreApiStop;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case EStopPressed:
- iOperationId = ERemConCoreApiStop;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case EStopClicked:
- iOperationId = ERemConCoreApiStop;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case EForwardReleased:
- iOperationId = ERemConCoreApiForward;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case EForwardPressed:
- iOperationId = ERemConCoreApiForward;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case EForwardClicked:
- iOperationId = ERemConCoreApiForward;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case ERewindReleased:
- iOperationId = ERemConCoreApiRewind;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case ERewindPressed:
- iOperationId = ERemConCoreApiRewind;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case ERewindClicked:
- iOperationId = ERemConCoreApiRewind;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case EFastForwardReleased:
- iOperationId = ERemConCoreApiFastForward;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case EFastForwardPressed:
- iOperationId = ERemConCoreApiFastForward;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case EFastForwardClicked:
- iOperationId = ERemConCoreApiFastForward;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case EBackwardReleased:
- iOperationId = ERemConCoreApiBackward;
- iData.Format( KFormatString, ERemConCoreApiButtonRelease );
- break;
- case EBackwardPressed:
- iOperationId = ERemConCoreApiBackward;
- iData.Format( KFormatString, ERemConCoreApiButtonPress );
- break;
- case EBackwardClicked:
- iOperationId = ERemConCoreApiBackward;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- // This should never execute
- default:
- iOperationId = aEnumValue;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
-
- }
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::ReceivedKeyEvent()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::SetPhoneKeyOperationIdAndData( TInt aEnumValue )
- {
- TRACE_FUNC_ENTRY
- iInterfaceUid = TUid::Uid( KRemConExtCallHandlingApiUid );
- switch ( aEnumValue )
- {
- case KPSAnsweClicked:
- TRACE_INFO((_L("[HID]\tCHidRemconBearer::SetPhoneKey \
- OperationIdAndData Answer")));
- iOperationId = ERemConExtAnswerCall;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case KPSHangUpClicked:
- iOperationId = ERemConExtEndCall;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case KPSRedial:
- iOperationId = ERemConExtLastNumberRedial;
- iData.Format( KFormatString, ERemConCoreApiButtonClick );
- break;
- case KPSVoiceDial:
- iOperationId = ERemConExtVoiceDial;
- iData.Format( KVoiceFormatString, ERemConCoreApiButtonRelease );
- break;
- default:
- TRACE_INFO(_L("CHidRemconBearer::SetPhoneKeyOperationIdAndData \
- : Not supported")); }
- TRACE_FUNC_EXIT
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::ReceivedKeyEvent()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::ReceivedKeyEvent( TInt aEnumValue, TInt aKeyType )
- {
- TRACE_INFO((_L("[HID]\tCHidRemconBearer::ReceivedKeyEvent: value %d, \
- type %d )"), aEnumValue, aKeyType));
-
- /* To keep the background light on */
- User::ResetInactivityTime();
-
- // 2. Transaction ID
- iTransactionId = Observer().NewTransactionId();
-
- // 3. Addr
- TRemConAddress addr;
- addr.BearerUid() = Uid();
- addr.Addr() = KNullDesC8();
-
- // 4 & 5. Operation ID and Data
- HandleKeyOperation( aEnumValue, aKeyType );
-
- // Msgtype is ERemConCommand
- TInt error = Observer().NewCommand( addr );
- TRACE_INFO((_L("[HID]\tCHidRemconBearer::ReceivedKeyEvent: error %d )"),
- error));
- //Start the listener once again
- RestartKeyObeserver( aKeyType );
-
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::RestartKeyObeserver
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::RestartKeyObeserver( TInt aKeyType )
- {
- TRACE_FUNC_ENTRY
- switch ( aKeyType )
- {
- case EMediaKeys:
- iMediaKeyObserver->Start();
- break;
- case EAccessoryVolumeKeys:
- iAccessoryVolKeyObserver->Start();
- break;
- case EMuteKey:
- iMuteKeyObserver->Start();
- break;
- case EHookKeys:
- iHookKeyObserver->Start();
- break;
- default:
- TRACE_INFO(_L("CHidRemconBearer::RestartKeyObeserver : Not supported"))
- ;
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::RestartObexserver
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::HandleKeyOperation( TInt aEnumValue, TInt aKeyType )
- {
- TRACE_FUNC_ENTRY
- switch ( aKeyType )
- {
- case EAccessoryVolumeKeys:
- SetSVKOperationIdAndData( aEnumValue );
- break;
- case EMuteKey:
- SetMuteKeyOperationIdAndData( aEnumValue );
- break;
- case EMediaKeys:
- SetMediaKeyOperationIdAndData( aEnumValue );
- break;
- case EHookKeys:
- SetPhoneKeyOperationIdAndData( aEnumValue );
- break;
- default:
- TRACE_INFO(_L("CHidRemconBearer::HandleKeyOperation : Not \
- supported"))
- ;
- }
- TRACE_FUNC_EXIT
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::SecurityPolicy()
-// ---------------------------------------------------------------------------
-//
-TSecurityPolicy CHidRemconBearer::SecurityPolicy() const
- {
- return TSecurityPolicy( ECapabilityLocalServices );
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::ClientStatus()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearer::ClientStatus( TBool /*aControllerPresent*/, TBool /*aTargetPresent*/)
- {
- //Pass
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// CHidRemconBearer::GetInterface()
-// ---------------------------------------------------------------------------
-//
-TAny* CHidRemconBearer::GetInterface( TUid aUid )
- {
- TRACE_FUNC
- TAny* ret = NULL;
- if ( aUid == TUid::Uid( KRemConBearerInterface1 ) )
- {
- ret = reinterpret_cast<TAny*> (
- static_cast<MRemConBearerInterface*> ( this ) );
- }
- return ret;
- }
--- a/localconnectivityservice/headset/hidremconbearer/src/hidremconbearermain.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Bearer plugin implementation proxy
- *
-*/
-
-
-#include <ecom/implementationproxy.h>
-#include "hidremconbearerimplementation.h"
-#include "headsetuids.h"
-
-/**
- * Implementation table
- */
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY(HIDREMCON_IMP, CHidRemconBearer::NewL),
- };
-
-// ---------------------------------------------------------------------------
-// ImplementationGroupProxy ()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
- {
- aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
- return ImplementationTable;
- }
--- a/localconnectivityservice/headset/hidremconbearer/src/hidremconbearerobserver.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Remcon bearer observer implementation
- *
-*/
-
-
-//INCLUDE
-#include <e32def.h>
-#include <e32cmn.h>
-#include <coreapplicationuisdomainpskeys.h>
-
-#include "hidremconbearerinternalpskeys.h"
-#include "hidremconbearerobserver.h"
-#include "debug.h"
-// ======== MEMBER FUNCTIONS ========
-//
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::NewL()
-// Constructs a new entry with given values.
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearerObserver* CHidRemconBearerObserver::NewL(
- MCallBackReceiver& aCallback, TInt aKeyType )
- {
- CHidRemconBearerObserver* self = new ( ELeave ) CHidRemconBearerObserver(
- aCallback );
- CleanupStack::PushL( self );
- self->ConstructL( aKeyType );
- CleanupStack::Pop();
- return self;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::CHidRemconBearerObserver()
-// C++ constructor
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearerObserver::CHidRemconBearerObserver(
- MCallBackReceiver& aCallback ) :
- CActive( EPriorityStandard ), iCallback( aCallback )
- {
- //Pass
- TRACE_FUNC
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::CHidRemconBearerObserver()
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CHidRemconBearerObserver::~CHidRemconBearerObserver()
- {
- TRACE_FUNC
- Stop();
- if ( iProperty.Handle() != KNullHandle )
- {
- iProperty.Close();
- }
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::ConstructL()
-// Symbian OS default constructor
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearerObserver::ConstructL( TInt aKeyType )
- {
- TRACE_FUNC
- iKeyType = aKeyType;
- // Add this active object to the scheduler.
- CActiveScheduler::Add( this );
- switch ( iKeyType )
- {
- case EMediaKeys:
- User::LeaveIfError( iProperty.Attach( KPSUidHidEventNotifier,
- KHidControlKeyEvent ) );
- break;
- case EAccessoryVolumeKeys:
- User::LeaveIfError( iProperty.Attach( KPSUidHidEventNotifier,
- KHidAccessoryVolumeEvent ) );
- break;
- case EMuteKey:
- User::LeaveIfError( iProperty.Attach( KPSUidHidEventNotifier,
- KHidMuteKeyEvent ) );
- break;
- case EHookKeys:
- User::LeaveIfError( iProperty.Attach( KPSUidHidEventNotifier,
- KHidHookKeyEvent ) );
- break;
- default:
- User::Leave( KErrArgument );
- }
- Start();
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::Start()
-// Starts listening KUidCurrentCall event
-// ---------------------------------------------------------------------------
-//
-TInt CHidRemconBearerObserver::Start()
- {
- TRACE_FUNC
- if ( IsActive() )
- {
- return KErrInUse;
- }
- iStatus = KRequestPending;
- iProperty.Subscribe( iStatus );
- SetActive();
- return KErrNone;
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::Stop()
-// Stops listening KUidCurrentCall event
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearerObserver::Stop()
- {
- TRACE_FUNC
- Cancel();
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::RunL()
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearerObserver::RunL()
- {
- TInt scanCode;
- TInt ret = 0;
- ret = iProperty.Get( scanCode );
- if ( ret == KErrNone )
- {
- // If this Active Object is for receiving the USB MTP status, the
- // scanCode varibale contains the status whether transfer is
- // happening now(active) or not(not active).
- iCallback.ReceivedKeyEvent( scanCode, iKeyType );
- }
- }
-// ---------------------------------------------------------------------------
-// CHidRemconBearerObserver::DoCancel()
-// Cancels event listening
-// ---------------------------------------------------------------------------
-//
-void CHidRemconBearerObserver::DoCancel()
- {
- iProperty.Cancel();
- }
--- a/localconnectivityservice/headset/inc/debug.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Logging definition
- *
-*/
-
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include "debugconfig.h"
-
-#ifdef PRJ_ENABLE_TRACE
-
-#ifdef PRJ_FILE_TRACE
-#include <flogger.h>
-#else
-#include <e32debug.h>
-#endif
-
-const TInt KMaxLogLineLength = 512;
-
-#define KPRINTERROR 0x00000001 // Tracing level: error
-#define KPRINTINFO 0x00000002 // Tracing level: function trace
-#define KPRINTSTATE 0x00000004 // Tracing level: state machine info
-#define KPRINTWARNING 0x00000008 // Tracing level: warning
-const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE
- | KPRINTWARNING;
-
-NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
- {
-public:
- void Overflow( TDes16& /*aDes*/)
- {
- }
- };
-
-NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
- {
-public:
- void Overflow( TDes8& /*aDes*/)
- {
- }
- };
-
-inline void Trace( TRefByValue<const TDesC16> aFmt, ... )
- {
- VA_LIST list;
- VA_START(list,aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TBuf16<KMaxLogLineLength> theFinalString;
- theFinalString.Append( KTracePrefix16 );
- TOverflowTruncate16 overflow;
- theFinalString.AppendFormatList( aFmt, list, &overflow );
- RDebug::Print( theFinalString );
-#endif
- }
-
-inline void Trace( TRefByValue<const TDesC8> aFmt, ... )
- {
- VA_LIST list;
- VA_START(list, aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TOverflowTruncate8 overflow;
- TBuf8<KMaxLogLineLength> buf8;
- buf8.Append( KTracePrefix8 );
- buf8.AppendFormatList( aFmt, list, &overflow );
- TBuf16<KMaxLogLineLength> buf16( buf8.Length() );
- buf16.Copy( buf8 );
- TRefByValue<const TDesC> tmpFmt( _L("%S"));
- RDebug::Print( tmpFmt, &buf16 );
-#endif
- }
-
-inline void TracePanic( char* aFile, TInt aLine, TInt aPanicCode,
- const TDesC& aPanicCategory )
- {
- TPtrC8 fullFileName( (const TUint8*) aFile );
- TPtrC8 fileName( fullFileName.Ptr() + fullFileName.LocateReverse( '\\' )
- + 1 );
- TBuf8<KMaxLogLineLength> buf;
- buf.Append( KPanicPrefix8 );
- buf.AppendFormat( _L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName );
- Trace( buf );
- User::Panic( aPanicCategory, aPanicCode );
- }
-
-inline void TraceLeave( char* aFile, TInt aLine, TInt aReason )
- {
- TPtrC8 fullFileName( (const TUint8*) aFile );
- TPtrC8 fileName( fullFileName.Ptr() + fullFileName.LocateReverse( '\\' )
- + 1 );
- TBuf8<KMaxLogLineLength> buf;
- buf.Append( KLeavePrefix8 );
- buf.AppendFormat( _L8("%d at line %d in file %S"), aReason, aLine, &fileName );
- Trace( buf );
- User::LeaveIfError( aReason );
- }
-
-#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
-
-#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
-
-#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
-
-#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
-
-#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
-
-#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
-
-#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
-
-#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
-
-#define TRACE_FUNC_ENTRY_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
-
-#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
-
-#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
-
-#define TRACE_FUNC_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
-
-#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
-
-#else // PRJ_ENABLE_TRACE not defined
-#define TRACE_INFO(p)
-
-#define TRACE_ERROR(p)
-
-#define TRACE_STATE(p)
-
-#define TRACE_WARNING(p)
-
-#define TRACE_INFO_SEG(p)
-
-#define TRACE_ASSERT(GUARD, CODE)
-
-#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
-
-#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
-
-#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
-
-#define TRACE_FUNC_ENTRY
-
-#define TRACE_FUNC_ENTRY_THIS
-
-#define TRACE_FUNC_EXIT
-
-#define TRACE_FUNC
-
-#define TRACE_FUNC_THIS
-
-#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
-#endif // PRJ_ENABLE_TRACE
-#endif // PRJ_LOGGING_H
--- a/localconnectivityservice/headset/inc/debugconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef DEBUGCONFIG_H
-#define DEBUGCONFIG_H
-
-#include "prjconfig.h"
-
-
-/**
- * Custom logging variations.
- */
-#ifdef PRJ_FILE_TRACE
-_LIT(KLogFile,"headset.txt");
-_LIT(KLogDir,"headset");
-#endif
-
-#ifdef PRJ_ENABLE_TRACE
-_LIT(KTracePrefix16, "[headset] ");
-_LIT8(KTracePrefix8, "[headset] ");
-_LIT8(KFuncFormat8, "><%S");
-_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
-_LIT8(KFuncEntryFormat8, ">%S");
-_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
-_LIT8(KFuncExitFormat8, "<%S");
-
-_LIT(KPanicCategory, "headsetS");
-_LIT8(KPanicPrefix8, "PANIC code ");
-_LIT8(KLeavePrefix8, "LEAVE code ");
-#endif
-
-#endif // HEADSET_DEBUGCONFIG_H
--- a/localconnectivityservice/headset/inc/finder.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid headset field finder
- *
-*/
-
-#ifndef T_FINDER_H
-#define T_FINDER_H
-
-#include <e32std.h>
-#include "hidreportroot.h"
-
-/**
- * Headset finder
- *
- * Field finder for the consumer/multimedia keys field.
- *
- */
-class THeadsetFinder : public MHidFieldFinder
- {
-public:
- // From MHidFieldFinder
- /**
- * From MHidFieldFinder
- * Called by THidFieldSearch::SearchL() during traversal of the
- * report descriptor tree when a CCollection is encountered. It
- * will be called once, and only once, for every CCollection in the
- * descriptor. It is not called for the root collection
- * (the CReportRoot).
- *
- * @param aCollection A pointer to the collection object.
- * @return ETrue if the contents of this collection (any child CField
- * or CCollection objects) should be examined. A driver would return
- * EFalse if a collection was not of a compatible type, for
- * example if the usage page was inappropriate.
- */
- virtual TBool BeginCollection( const CCollection *aCollection );
-
- /**
- * From MHidFieldFinder
- * Called by THidFieldSearch::SearchL() during traversal of the
- * report descriptor tree when all CFields and child CCollections
- * of a CCollection have been examined. It will be called once,
- * and only once, for every CCollection in the descriptor. It is
- * not called for the root collection (the CReportRoot).
- *
- * @param aCollection Collection pointer
- * @return ETrue if the search (tree traversal) should
- * continue. A driver returns EFalse if it has finished examining
- * the whole descriptor, in general this will be if it has
- * established that it is compatible with the report descriptor.
- */
- virtual TBool EndCollection( const CCollection *aCollection );
-
- /**
- * From MHidFieldFinder
- * Called once for each CField in a CCollection by
- * THidFieldSearch::SearchL() during the traversal of a report
- * descriptor tree.
- *
- * @param aField THe pointer to field
- */
- virtual void Field( const CField* aField );
-
-public:
-
- /**
- * Constructor
- */
- THeadsetFinder();
-
- /**
- * Check whether supported fields has been found.
- *
- * @return ETrue if it has.
- */
- TBool Found() const;
-
- /**
- * Check whether a given field contains the consumer usages.
- *
- * @param aField Pointer to the field to test.
- * @return ETrue if it does.
- */
- TBool IsConsumer( const CField* aField ) const;
-
- /**
- * Check whether a given field contains the telephony usages.
- *
- * @param aField Pointer to the field to test.
- * @return ETrue if it does.
- */
- TBool IsTelephony( const CField* aField ) const;
-
- /**
- * Reset the field pointer array
- *
- */
- void EmptyList();
-
- /**
- * Returns number of supported fields.
- *
- * @return Field count
- */
- TInt FieldCount();
-
- /**
- * Read the field pointer from array at specified index
- *
- * @param aIndex Index to the field pointer array
- * @return Pointer to the desired field
- */
- CField* GetFieldAtIndex( TInt aIndex );
-
-private:
-
- /**
- * Pointer to the top level application collection being searched.
- * Not own.
- */
- const CCollection* iAppCollection;
-
- /**
- * Array of field pointers:
- * Not own.
- */
- RPointerArray<CField> iFieldList;
- };
-#endif
--- a/localconnectivityservice/headset/inc/headset.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,523 +0,0 @@
-/*
-* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid headset driver
- *
-*/
-
-
-#ifndef C_HIDHEADSETDRIVER_H
-#define C_HIDHEADSETDRIVER_H
-
-#include <e32std.h>
-#include <asclisession.h>
-#include <mpxplaybackutility.h>
-#include <mpxplaybackobserver.h>
-#include <mpxmessage.h>
-#include <hidinterfaces.h>
-#include <hidtranslate.h>
-#include "keypresstimer.h"
-
-class CField;
-class CHidHeadsetDriver;
-class CTelephony;
-
-/**
- * Scan status
- */
-enum TScanStatus
- {
- EScanNotPressed, EScanPressed, EScanLongPress
- };
-
-/**
- * HID headset driver class
- *
- * HidDriver interface for handlign headset related
- * functionality.
- *
- */
-
-class CHidHeadsetDriver : public CHidDriver,
- public MTimerNotifier,
- public MMPXPlaybackObserver
- {
-
-private:
- /**
- * Initialisation states
- */
- enum THeadsetDriverState
- {
- EUninitialised, // Driver has not been initialised
- EInitialised, // Driver is initialised
- EDisabled
- // The driver will not respond to interrupt data
- };
-
- /**
- * Hook handling
- */
- enum THookHandling
- {
- EOnHook, EOffHook, ENoHook
- };
-public:
-
- /**
- * Two-phased constructor.
- * @param aHid The generic HID layer that requested the driver
- */
- static CHidHeadsetDriver* NewL( MDriverAccess* aHid );
-
- /**
- * Two-phased constructor.
- * @param aHid The generic HID layer that requested the driver
- */
- static CHidHeadsetDriver* NewLC( MDriverAccess* aHid );
-
- /**
- * Destructor
- */
- virtual ~CHidHeadsetDriver();
-
-private:
-
- // from base class CHidDriver
- /**
- * From class CHidDriver
- * Called by the Generic HID layer to see if the driver can is able to
- * use reports from a newly-connected device. Supported hid fields van
- * be later request with SupportedFieldCount function
- *
- * @param aReportRoot HID report descriptor
- * @return KErrNone The driver will handle reports from the report
- * descriptor and KErrHidUnrecognised The driver cannot
- * handle reports from the device
- */
- TInt CanHandleReportL( CReportRoot* aReportRoot );
-
- /**
- * From class CHidDriver
- * Called by the Generic HID layer when a device has been removed, prior
- * to the driver being removed. This allows the driver to notify any
- * applications of disconnection, if required
- *
- * @param aReason The reason for device disconnection
- */
- void Disconnected( TInt aReason );
-
- /**
- * From class CHidDriver
- * Called by the Generic HID layer when data has been received from the
- * device handled by this driver.
- *
- * @param aChannel The channel on which the data was received
- * (as defined by the transport layer)
- * @param aPayload A pointer to the data buffer
- */
- TInt DataIn( CHidTransport::THidChannelType aChannel,
- const TDesC8& aPayload );
-
- /**
- * From class CHidDriver
- * Called by the transport layers to inform the generic HID of the
- * success of the last Set... command.
- *
- * @param aCmdAck Status of the last Set... command
- */
- void CommandResult( TInt aCmdAck );
-
- /**
- * From class CHidDriver
- * Called after a driver is sucessfully created by the Generic HID, when
- * a device is connected
- *
- * @param aConnectionId An number used to identify the device in
- * subsequent calls from the driver to the
- * generic HI
- */
- void InitialiseL( TInt aConnectionId );
-
- /**
- * From class CHidDriver
- * Resets the internal state of the driver (any pressed keys are released)
- * and enables the driver
- *
- * @param aConnectionId An number used to identify the device in
- * subsequent calls from the driver to the
- * generic HI
- */
- void StartL( TInt aConnectionId );
-
- /**
- * From class CHidDriver
- * Cancels all pressed keys and disables the driver (so it will not
- * process interrupt data)
- *
- */
- void Stop();
-
- /**
- * From class CHidDriver
- * Return count of supported fields
- *
- * @return Number of supported fields
- */
- TInt SupportedFieldCount();
-
- /**
- * From class CHidDriver
- * Set input handling registy
- *
- * @param aHandlingReg a Input handling registry
- */
- void SetInputHandlingReg( CHidInputDataHandlingReg* aHandlingReg );
-
- // from base class MTimerNotifier
- /**
- * From class MTimerNotifier
- * The function to be called when a timeout occurs.
- *
- * @param aTimerType a Type of timer
- */
- void TimerExpired( TTimerType aTimerType );
-
- /**
- * From class MMPXPlaybackObserver
- * Handle playback message.
- *
- * @param aMsg playback message, ownership not transferred.
- * Please check aMsg is not NULL before using it. If aErr is not
- * KErrNone, plugin might still call back with more info in the
- * aMsg.
- * @param aErr system error code.
- */
- void HandlePlaybackMessage( CMPXMessage* aMsg, TInt /*aErr*/);
-
-private:
- /**
- * Constructor
- * @param aHid The generic HID layer that requested the driver
- */
- CHidHeadsetDriver( MDriverAccess* aHid );
- /**
- * ConstructL
- */
- void ConstructL();
-
-private:
-
- /**
- * Called from within DataIn to handle interrupt and control channel data
- *
- * @param aPayload a Payload data
- * @return error if data can't be handled
- */
- TInt InterruptData( const TDesC8& aPayload );
-
- /**
- * Handles the report
- *
- * @param aReport HID report descriptor
- * @param aField HID field
- * @return KErrNotSupported if report can't be handled
- */
- TInt HandleReport( const TDesC8& aReport, const CField* aField );
-
- /**
- * Handles the report
- *
- * @param aReportTranslator Report Translator
- */
- void ReleasePressedKeys( TReportTranslator& aReportTranslator );
-
- /**
- * Handle hook key pres
- *
- * @param aStatus Hook key status
- */
- void HookKeyPres( TBool aStatus );
-
- /**
- * Release hook key
- *
- */
- void ReleaseHookKey();
-
- /**
- * Get Hook Status
- *
- * @return hook handling status.
- */
- THookHandling HookStatus();
-
- /**
- * Get alarm status
- *
- * @return ETrue if ui is showing alarm, EFalse if not.
- */
- TBool AlarmStatus();
-
- /**
- * MusicPlayingStatus
- *
- * @return ETrue if plyaer is playing, EFalse if not.
- */
- TBool MusicPlayingStatus();
-
- /**
- * HandleNoneHookPress
- * Handle hook press when there are phone call is in idle state
- *
- */
- void HandleNoneHookPressL();
-
- /**
- * ReleasePressedVolumeKeys
- * Release volume keys if they are pressed
- *
- * @param aReportTranslator HID report translator
- */
- void ReleasePressedVolumeKeys( TReportTranslator& aReportTranslator );
-
- /**
- * ReleasePressedScanKeys
- * Release scan keys if they are pressed
- *
- * @param aReportTranslator HID report report translator
- */
- void ReleasePressedScanKeys( TReportTranslator& aReportTranslator );
- /**
- * HandleAlarmHookReleaseL
- * Handle hook release when phone is alarming
- *
- */
- void HandleAlarmHookReleaseL();
-
- /**
- * HandleIdleHookReleaseL
- * Handle hook release when phone is not alarming
- * and call is in idle state
- *
- */
- void HandleIdleHookReleaseL();
-
- /**
- * Handle doubleclick timer expiration
- *
- */
- void ExpiredDoubleClickTimer();
-
- /**
- * Handle long press timer expiration
- *
- */
- void ExpiredLongClickTimer();
-
- /**
- * Handle scan next pressed
- *
- */
- void HandleScanNextPressL();
-
- /**
- * Handle scan prev pressed
- *
- */
- void HandleScanPrevPressL();
-
- /**
- * Handle scan next release
- *
- * @param aKeyCode a Key id
- * @param aValue a Key value
- */
- void HandleScanNextRelease( TUint& aKeyCode, TInt& aValue );
-
- /**
- * Handle scan previous release
- *
- * @param aKeyCode a Key id
- * @param aValue a Key value
- */
- void HandleScanPreviousRelease( TUint& aKeyCode, TInt& aValue );
-
- /**
- * Handle telephony usage page
- *
- * @param aReport a Report translator
- * @return KErrNone if report can be handled.
- */
- TInt HandleTelephonyUsage( TReportTranslator& aReport );
-
- /**
- * Handle controller usage page
- *
- * @param aReport a Report translator
- * @return KErrNone if report can be handled.
- */
- TInt HandleControlUsage( TReportTranslator& aReport );
-
- /**
- * Handle volume usage
- *
- * @param aReport a Report translator
- * @return KErrNone if report can be handled.
- */
- TInt HandleVolumeUsage( TReportTranslator& aReport );
-
-private:
-
- /**
- * The Generic HID layer
- * Not own.
- */
- MDriverAccess *iGenericHid;
-
- /**
- * Field list array
- * Own.
- */
- RPointerArray<CField> iFieldList;
-
- /**
- * Driver state
- */
- THeadsetDriverState iDriverState;
-
- /**
- * Connection id
- */
- TInt iConnectionId;
-
- /**
- * Application menu id
- */
- TInt iAppMenuId;
-
- /**
- * On hook status
- */
- TBool iOnHookPressed;
-
- /**
- * Off hook
- */
- TBool iOffHookPressed;
-
- /**
- * No active calls
- */
- TBool iNoneHookPressed;
-
- /**
- * Telephony service
- * Own.
- */
- CTelephony* iTelephony;
-
- /**
- * Double click timer
- * Own.
- */
- CKeyPressTimer* iDoubleClicktimer;
-
- /**
- * Long click timer
- * Own.
- */
- CKeyPressTimer* iLongClicktimer;
-
- /**
- * Long click timer
- */
- TBool iLongPress;
-
- /**
- * Alarm server session
- */
- RASCliSession iAlarmServerSession;
-
- /**
- * Incoming call status
- */
- TBool iIncomingCallStatus;
-
- /**
- * Alarm statusd
- */
- TBool iAlarmStatus;
-
- /**
- * Music player utility
- * Own.
- */
- MMPXPlaybackUtility* iMusicPlayer;
-
- /**
- * Playing status
- */
- TBool iPlayingStatus;
-
- /**
- * Double next Click status
- */
- TBool iDoubleNextClick;
-
- /**
- * Count of supported fields
- */
- TInt iSupportedFieldCount;
-
- /**
- * Volume up key pressed down
- */
- TBool iVolumeUpPressed;
-
- /**
- * Volume down key pressed down
- */
- TBool iVolumeDownPressed;
-
- /**
- * Forward press status
- */
- TScanStatus iForwardStatus;
-
- /**
- * Backward press status
- */
- TScanStatus iBackwardStatus;
-
- /**
- * Scan next timer
- * Own.
- */
- CKeyPressTimer* iScanNextTimer;
-
- /**
- * Scan previous timer
- * Own.
- */
- CKeyPressTimer* iScanPreviousTimer;
-
- /**
- * Input handling reg
- * Not own.
- */
- CHidInputDataHandlingReg* iInputHandlingReg;
-
- };
-
-#endif
--- a/localconnectivityservice/headset/inc/headsetuids.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid headset driver
- *
-*/
-
-
-#ifndef HEADSETUIDS_H
-#define HEADSETUIDS_H
-
-#define ECOM_UID 0x10009d8d
-#define REMCON_PLUGIN_IF 0x10204546
-#define HEADSET_UID 0x10282c15
-#define HEADSET_DRIVER_IMP 0x10282c16
-#define HIDREMCON_UID 0x10282c17
-#define HIDREMCON_IMP 0x10282c18
-#define DRIVER_PLUGIN_IF 0x10201d26
-
-#endif
--- a/localconnectivityservice/headset/inc/keypresstimer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Hid timeout timer
- *
-*/
-
-#ifndef C_KEYPRESSTIMER_H
-#define C_KEYPRESSTIMER_H
-
-#include <e32base.h>
-
-enum TTimerType
- {
- EDoubleClickTimer,
- ELongPressTimer,
- EScanNextPressTimer,
- EScanPrevPressTimer
- };
-
-/**
- * HID headset driver class
- *
- * This class specifies the function to be called when a timeout occurs.
- * Used in conjunction with CTimeOutTimer class
- *
- */
-class MTimerNotifier
- {
-public:
- /**
- * The function to be called when a timeout occurs.
- *
- * @param aTimerType a Type of timer
- */
- virtual void TimerExpired( TTimerType aTimerType ) = 0;
- };
-
-/**
- * HID headset driver class
- *
- * This class will notify an object after a specified timeout.
- *
- */
-class CKeyPressTimer : public CTimer
- {
-public:
- /**
- * Two-phased constructor.
- * @param aTimeOutNotify object to notify of timeout event
- * @param aTimeOutTime a Timeout time
- * @paran aTimerType a Type of timer
- * @return keypress timer
- */
- static CKeyPressTimer* NewL( MTimerNotifier* aTimeOutNotify,
- TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
-
- /**
- * Two-phased constructor.
- * @param aTimeOutNotify object to notify of timeout event
- * @param aTimeOutTime a Timeout time
- * @paran aTimerType a Type of timer
- * @return keypress timer
- */
- static CKeyPressTimer* NewLC( MTimerNotifier* aTimeOutNotify,
- TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
-
- /**
- * Destructor
- */
- virtual ~CKeyPressTimer();
-
-protected:
-
- /**
- * From CTimer
- * Invoked when a timeout occurs
- *
- */
- virtual void RunL();
-
-private:
-
- /**
- * Constructor
- * @param aTimeOutNotify object to notify of timeout event
- * @paran aTimerType a Type of timer
- */
- CKeyPressTimer( MTimerNotifier* aTimeOutNotify, TTimerType aTimerType );
- /**
- * Two-phased constructor.
- * @param aTimeOutTime a Timeout time
- */
- void ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime );
-
-private:
- // Member variables
-
- /**
- * The observer for this objects events
- * Not own.
- */
- MTimerNotifier* iNotify;
-
- /**
- * Type of timer
- */
- TTimerType iTimerType;
- };
-#endif // C_KEYPRESSTIMER_H
--- a/localconnectivityservice/headset/inc/prjconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
- *
-*/
-
-
-#ifndef PRJCONFIG_H
-#define PRJCONFIG_H
-
-/**
- * Traces are enabled via RDebug::Print() in UDEB build, by default.
- */
-#ifdef _DEBUG
-#define PRJ_ENABLE_TRACE
-#endif
-
-/**
- * Traces will be written to file if this is defined.
- */
-//#define PRJ_FILE_TRACE
-
-
-/**
- * build the project for module test purpose if this is defined
- */
-//#define PRJ_MODULETEST_BUILD
-
-/**
- * build the project using stubs to replace the dependencies if this is defined
- */
-//#define PRJ_USE_STUB
-
-#endif // OBEXSM_PRJCONFIG_H
--- a/localconnectivityservice/headset/rom/hidheadset.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Image description file for project generichid
-*
-*/
-
-
-#ifndef HIDHEADSET_IBY__
-#define HIDHEADSET_IBY__
-
-ECOM_PLUGIN(hidheadset.dll, hidheadset.rsc)
-ECOM_PLUGIN(hidremconbearer.dll, hidremconbearer.rsc)
-
-
-#endif
\ No newline at end of file
--- a/localconnectivityservice/headset/src/finder.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Generic hid finder implementation
- *
-*/
-
-
-#include <e32std.h>
-#include <e32svr.h>
-
-#include "finder.h"
-#include "debug.h"
-
-// ----------------------------------------------------------------------
-
-// Define this for additional debug output (this file only):
-#define EXTRA_DEBUG
-
-#ifdef EXTRA_DEBUG
-#define DBG(a) a;
-#else
-#define DBG(a)
-#endif
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// THeadsetFinder()
-// ---------------------------------------------------------------------------
-//
-THeadsetFinder::THeadsetFinder() :
- iAppCollection( 0 ), iFieldList()
- {
- // Nothing else to do
- }
-
-// --------------------------------------------------------------------------
-// From class MHidFieldFinder
-// BeginCollection()
-// --------------------------------------------------------------------------
-//
-TBool THeadsetFinder::BeginCollection( const CCollection* aCollection )
- {
- TBool examineCollection = ETrue;
-
- const TInt KConsumerControl = 0x01;
-
- // Only look at top-level application (consumer devices: consumer
- // control) collections:
- //
-
- if ( ( aCollection->IsApplication() ) && ( iAppCollection == 0 ) )
- {
- // Top-level application collection.
-
- if ( ( aCollection->UsagePage() == EUsagePageConsumer )
- && ( aCollection->Usage() == KConsumerControl ) )
- {
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::BeginCollection: this is \
- consumer collection "));
- // Collection is a consumer device:
- iAppCollection = aCollection;
- iFieldList.Reset();
- }
- else
- {
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::BeginCollection: not \
- consumer collection"));
- // Skip other types of top-level application collection:
- examineCollection = EFalse;
- }
- }
- return examineCollection;
-
- }
-
-// ---------------------------------------------------------------------------
-// From class MHidFieldFinder
-// EndCollection()
-// ---------------------------------------------------------------------------
-//
-TBool THeadsetFinder::EndCollection( const CCollection* aCollection )
- {
- TBool continueSearch = ETrue;
-
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::EndCollection"));
- if ( aCollection == iAppCollection )
- {
- // Top-level application(Consumer Devices:Consumer Control) finished:
- //
- iAppCollection = 0;
-
- // Stop if we've found a device we can use in this
- // application collection:
- //
- continueSearch = !Found();
- }
-
- return continueSearch;
- }
-
-// ---------------------------------------------------------------------------
-// From class MHidFieldFinder
-// Field()
-// ---------------------------------------------------------------------------
-//
-void THeadsetFinder::Field( const CField* aField )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::Field( 0x%08x)"),aField));
- TInt error = KErrNone;
- if ( iAppCollection )
- {
-
- if ( IsTelephony( aField ) )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::Field, telephony")));
- error = iFieldList.Append( aField );
- if ( error != KErrNone )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::Field, telephony \
- failed")));
- }
- }
- else if ( IsConsumer( aField ) )
- {
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::Field, consumer"));
- error = iFieldList.Append( aField );
- if ( error != KErrNone )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::Field, telephony \
- failed")));
- }
- }
- else
- {
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::Field, other, or empty \
- field"));
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// IsConsumer()
-// ---------------------------------------------------------------------------
-//
-TBool THeadsetFinder::IsConsumer( const CField* aField ) const
- {
- TBool found = EFalse;
-
- if ( aField->IsInput() && aField->IsData() && ( aField->UsagePage()
- == EUsagePageConsumer ) )
- {
-#ifdef _DEBUG
- for ( TInt i = 0; i < aField->UsageCount(); i++ )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::IsConsumer: Usage %d: \
- %02x"),i,aField->Usage(i)));
- }
-#endif
- // *** Add usage test here ***
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::IsConsumer: Consumer keys \
- field found\r\n"));
- found = ETrue;
- }
- return found;
- }
-
-// ---------------------------------------------------------------------------
-// IsTelephony()
-// ---------------------------------------------------------------------------
-//
-TBool THeadsetFinder::IsTelephony( const CField* aField ) const
- {
- TBool found = EFalse;
-
- if ( aField->IsInput() && aField->IsData() && ( aField->UsagePage()
- == EUsagePageTelephony ) )
- {
- const TInt KHookSwitch = 0x20;
- const TInt KPhoneMute = 0x2F;
-#ifdef _DEBUG
- for ( TInt i = 0; i < aField->UsageCount(); i++ )
- {
- TRACE_INFO((_L("[HID]\tTHeadsetFinder::IsTelephony: \
- Usage %d: %02x"),i,aField->Usage(i)));
- }
-#endif
- if ( ( aField->UsageMin() <= KPhoneMute ) && ( aField->UsageMax()
- >= KHookSwitch ) )
- {
- TRACE_INFO(_L("[HID]\tTHeadsetFinder::IsTelephony: Telephony \
- field found"));
- found = ETrue;
- }
- }
- return found;
- }
-
-// ---------------------------------------------------------------------------
-// EmptyList()
-// ---------------------------------------------------------------------------
-//
-void THeadsetFinder::EmptyList()
- {
- iFieldList.Reset();
- }
-
-// ---------------------------------------------------------------------------
-// FieldCount()
-// ---------------------------------------------------------------------------
-//
-TInt THeadsetFinder::FieldCount()
- {
- return iFieldList.Count();
- }
-
-// ---------------------------------------------------------------------------
-// GetFieldAtIndex()
-// ---------------------------------------------------------------------------
-//
-CField* THeadsetFinder::GetFieldAtIndex( TInt aIndex )
- {
- return iFieldList[aIndex];
- }
-
-// ---------------------------------------------------------------------------
-// Found()
-// ---------------------------------------------------------------------------
-//
-TBool THeadsetFinder::Found() const
- {
- return ( iFieldList.Count() != 0 );
- }
--- a/localconnectivityservice/headset/src/headset.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1222 +0,0 @@
-/*
-* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Generic hid implementation
- *
-*/
-
-
-#include <etel3rdparty.h>
-#include <e32std.h>
-#include <e32svr.h>
-#include <coedef.h>
-#include <eiksvdef.h>
-#include <apgcli.h>
-#include <apgtask.h>
-#include <e32property.h>
-#ifdef NO101APPDEPFIXES
-#include <alarmuidomainpskeys.h>
-#else //NO101APPDEPFIXES
-const TUid KPSUidAlarmExtCntl = { 0x102072D4 }; // reusing an AlarmUI dll UID
-const TUint32 KAlarmStopKey = 0x00000001;
-enum TAlarmUIStopAlarm
- {
- EAlarmUIStopAlarmUninitialized = 0,
- EAlarmUIStopAlarm
- };
-const TUint32 KAlarmSnoozeKey = 0x00000002;
-enum TAlarmUISnoozeAlarm
- {
- EAlarmUISnoozeAlarmUninitialized = 0,
- EAlarmUISnoozeAlarm
- };
-#endif //NO101APPDEPFIXES
-
-#include <mpxplaybackmessage.h>
-#include <mpxmessagegeneraldefs.h>
-#include <mpxplaybackmessagedefs.h>
-
-#include "hidremconbearerinternalpskeys.h"
-#include "hidremconbearerscancodes.h"
-#include "headset.h"
-#include "finder.h"
-
-#include "debug.h"
-
-const TInt KHidUndefinedKeyCode = 0;
-const TInt KHidNotSetKeyValue = 0;
-const TInt KDoubleClickTimeout = 900000; // 0,9 seconds
-const TInt KDoubleClickTimeoutRing = 500000; // 0,5 seconds
-const TInt KScanClickTimeout = 500000; // 0,5 seconds
-const TInt KLongClickTimeout = 3000000; // 3 seconds
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CHidHeadsetDriver()
-// ---------------------------------------------------------------------------
-//
-CHidHeadsetDriver::CHidHeadsetDriver( MDriverAccess* aGenericHid ) :
- iGenericHid( aGenericHid ), iFieldList(), iDriverState( EUninitialised ),
- iConnectionId( 0 ), iSupportedFieldCount( 0 ), iForwardStatus(
- EScanNotPressed ), iBackwardStatus( EScanNotPressed )
- {
- TRACE_FUNC_ENTRY_THIS
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CHidHeadsetDriver* CHidHeadsetDriver::NewLC( MDriverAccess* aGenericHid )
- {
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::NewLC(0x%08x)"), aGenericHid));
- CHidHeadsetDriver* self = new ( ELeave ) CHidHeadsetDriver( aGenericHid );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CHidHeadsetDriver* CHidHeadsetDriver::NewL( MDriverAccess* aGenericHid )
- {
- CHidHeadsetDriver* self = CHidHeadsetDriver::NewLC( aGenericHid );
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ConstructL()
- {
- TRACE_FUNC_THIS
- iTelephony = CTelephony::NewL();
- User::LeaveIfError( iAlarmServerSession.Connect() );
- iMusicPlayer = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
- iMusicPlayer->AddObserverL( *this );
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CHidHeadsetDriver::~CHidHeadsetDriver()
- {
- TRACE_FUNC_THIS
- iAlarmServerSession.Close();
- delete iTelephony;
- iFieldList.Reset();
- iFieldList.Close();
- delete iDoubleClicktimer;
- if ( iMusicPlayer )
- {
- iMusicPlayer->Close();
- }
- delete iScanPreviousTimer;
- delete iScanNextTimer;
- delete iLongClicktimer;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// StartL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::StartL( TInt /*aConnectionId*/)
- {
- TRACE_FUNC
- // Ready to process headset events:
- iDriverState = EInitialised;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// InitialiseL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::InitialiseL( TInt aConnectionId )
- {
- TRACE_FUNC
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::InitialiseL(%d)"),
- aConnectionId));
- // Store the connection ID:
- iConnectionId = aConnectionId;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// Stop()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::Stop()
- {
- TRACE_FUNC
- iDriverState = EDisabled;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// DataIn()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::DataIn( CHidTransport::THidChannelType aChannel,
- const TDesC8& aPayload )
- {
- TInt retVal = KErrNone;
- switch ( aChannel )
- {
- case CHidTransport::EHidChannelInt:
- if ( EInitialised == iDriverState )
- {
- retVal = InterruptData( aPayload );
- }
- break;
-
- case CHidTransport::EHidChannelCtrl:
- retVal = KErrNotSupported;
- break;
-
- default:
- retVal = KErrNotSupported;
- break;
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// CommandResult()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::CommandResult( TInt /*aCmdAck*/)
- {
- // No implementation as we don't issue any requests to be acknowledged
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// Disconnected()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::Disconnected( TInt aReason )
- {
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::Disconnected(%d)"), aReason));
- aReason = aReason;
- Stop();
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// SetInputHandlingReg()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::SetInputHandlingReg(
- CHidInputDataHandlingReg* aHandlingReg )
- {
- iInputHandlingReg = aHandlingReg;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// InterruptData()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::InterruptData( const TDesC8& aPayload )
- {
- // If the report has a report ID, it is in the first byte.
- // If not, this value is ignored (see CField::IsInReport()).
- //
- TInt retVal = KErrNone;
- TInt ret = KErrNotSupported;
- TInt firstByte = aPayload[0];
-
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::InterruptData(), report \
- 0x%x (%d), length %d"),firstByte, firstByte, aPayload.Length()));
-
- if ( iFieldList.Count() == 0 )
- {
- retVal = KErrNotSupported;
- }
- for ( TInt i = 0; i < iFieldList.Count(); i++ )
- {
- if ( iFieldList[i]->IsInReport( firstByte ) )
- {
- ret = HandleReport( aPayload, iFieldList[i] );
- if ( ret == KErrNone )
- {
- retVal = KErrNone;
- }
- }
- else
- {
- retVal = KErrNotSupported;
- }
- }
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleReport()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::HandleReport( const TDesC8& aReport,
- const CField* aField )
- {
- TRACE_FUNC_ENTRY
- TReportTranslator report( aReport, aField );
- TInt retVal = KErrNotSupported;
-
- // release if key if it pressed and relased
- ReleasePressedKeys( report );
-
- if ( HandleTelephonyUsage( report ) == KErrNone )
- {
- retVal = KErrNone;
- }
-
- if ( HandleControlUsage( report ) == KErrNone )
- {
- retVal = KErrNone;
- }
-
- if ( HandleVolumeUsage( report ) == KErrNone )
- {
- retVal = KErrNone;
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleTelephonyUsage()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::HandleTelephonyUsage( TReportTranslator& aReport )
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrNotSupported;
- TInt hookSwitch = 0;
- TInt mute = 0;
- TInt poc = 0;
-
- // P&S key variables
- TUint key = KHidUndefinedKeyCode;
- TInt value = KHidNotSetKeyValue;
-
- if ( aReport.GetValue( mute, ETelephonyUsagePhoneMute ) == KErrNone
- && mute == 1 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send mute \
- command"));
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageTelephony,
- ETelephonyUsagePhoneMute ) )
- {
- key = KHidMuteKeyEvent;
- value = KPSMuteClicked;
- iInputHandlingReg->AddHandledEvent( EUsagePageTelephony,
- ETelephonyUsagePhoneMute );
- }
- }
- else if ( aReport.GetValue( hookSwitch, ETelephonyUsageHookSwitch )
- == KErrNone && hookSwitch == 1 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send hook \
- switch command (disabled)"));
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageTelephony,
- ETelephonyUsageHookSwitch ) )
- {
- HookKeyPres( ETrue );
- iInputHandlingReg->AddHandledEvent( EUsagePageTelephony,
- ETelephonyUsageHookSwitch );
- }
- }
- else if ( aReport.GetValue( poc, ETelephonyUsagePoC ) == KErrNone && poc
- == 1 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send PoC \
- command (disabled)"));
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageTelephony,
- ETelephonyUsagePoC ) )
- {
- key = KHidMuteKeyEvent;
- value = KPSMuteClicked;
- iInputHandlingReg->AddHandledEvent( EUsagePageTelephony,
- ETelephonyUsagePoC );
- }
- }
- if ( key != KHidUndefinedKeyCode && value != KHidNotSetKeyValue )
- {
- TInt err = RProperty::Set( KPSUidHidEventNotifier, key, value );
- retVal = KErrNone;
- }
-
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleTelephonyUsage()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::HandleControlUsage( TReportTranslator& aReport )
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrNotSupported;
- TInt playPause = 0;
- TInt scanNext = 0;
- TInt scanPrev = 0;
- TInt stop = 0;
-
- // P&S key variables
- TUint key = KHidUndefinedKeyCode;
- TInt value = KHidNotSetKeyValue;
-
- if ( aReport.GetValue( playPause, EConsumerUsagePlayPause ) == KErrNone
- && playPause )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsagePlayPause ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send \
- play/pause command (currently only play)"));
- key = KHidControlKeyEvent;
- value = EPlayClicked;
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsagePlayPause );
- }
- }
- else if ( aReport.GetValue( scanNext, EConsumerUsageScanNext )
- == KErrNone && scanNext )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageScanNext ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send \
- scan next command"));
- TRAP_IGNORE( HandleScanNextPressL() );
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageScanNext );
- }
- }
- else if ( aReport.GetValue( scanPrev, EConsumerUsageScanPrev )
- == KErrNone && scanPrev )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageScanPrev ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Scan \
- prev command"));
- TRAP_IGNORE( HandleScanPrevPressL());
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageScanPrev );
- }
- }
- else if ( aReport.GetValue( stop, EConsumerUsageStop ) == KErrNone
- && stop )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageStop ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send \
- stop command"));
- key = KHidControlKeyEvent;
- value = EStopClicked;
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageScanPrev );
- }
- }
- if ( key != KHidUndefinedKeyCode && value != KHidNotSetKeyValue )
- {
- TInt err = RProperty::Set( KPSUidHidEventNotifier, key, value );
- retVal = KErrNone;
- }
-
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleVolumeUsage()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::HandleVolumeUsage( TReportTranslator& aReport )
- {
- TRACE_FUNC_ENTRY
- TInt retVal = KErrNotSupported;
-
- TInt volUp = 0;
- TInt volDown = 0;
- TInt speakermute = 0;
-
- // P&S key variables
- TUint key = KHidUndefinedKeyCode;
- TInt value = KHidNotSetKeyValue;
-
- if ( aReport.GetValue( volUp, EConsumerUsageVolumeInc ) == KErrNone
- && volUp )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageVolumeInc ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): \
- Send volume up command"));
- key = KHidAccessoryVolumeEvent;
- iVolumeUpPressed = ETrue;
- value = KPSVolumeUpPressed;
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageScanPrev );
- }
- }
- else if ( aReport.GetValue( volDown, EConsumerUsageVolumeDec )
- == KErrNone && volDown )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageVolumeDec ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send \
- volume down command"));
- key = KHidAccessoryVolumeEvent;
- iVolumeDownPressed = ETrue;
- value = KPSVolumeDownPressed;
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageVolumeDec );
- }
- }
- else if ( ( aReport.GetValue( speakermute, EConsumerUsageMute )
- == KErrNone && speakermute == 1 ) )
- {
- if ( iInputHandlingReg->AllowedToHandleEvent( EUsagePageConsumer,
- EConsumerUsageMute ) )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Send \
- mute command"));
- key = KHidMuteKeyEvent;
- value = KPSMuteClicked;
- iInputHandlingReg->AddHandledEvent( EUsagePageConsumer,
- EConsumerUsageMute );
- }
- }
-
- if ( key != KHidUndefinedKeyCode && value != KHidNotSetKeyValue )
- {
- TInt err = RProperty::Set( KPSUidHidEventNotifier, key, value );
- retVal = KErrNone;
- }
-
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandleScanNextPressL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleScanNextPressL()
- {
- TRACE_FUNC_ENTRY
- iForwardStatus = EScanPressed;
-
- delete iScanNextTimer;
- iScanNextTimer = NULL;
-
- /**
- * Scan key has two different behaviour if you are short click buttun or long
- * click button. In short press next track command is sent and whit long press
- * is sending seek forward command. iScanNextTimer is used to detect if click
- * is long click or short click.
- */
-
- iScanNextTimer = CKeyPressTimer::NewL( this, TTimeIntervalMicroSeconds32(
- KScanClickTimeout ), EScanNextPressTimer );
-
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleScanNextPressL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleScanPrevPressL()
- {
- TRACE_FUNC_ENTRY
- iBackwardStatus = EScanPressed;
-
- delete iScanPreviousTimer;
- iScanPreviousTimer = NULL;
-
- /**
- * Scan key has two different behaviour if you are short click buttun or
- * long click button. In short press previous track command is sent and
- * whit long press is sending seek forward command. iScanPreviousTimer
- * is used to detect if click is long click or short click.
- */
- iScanPreviousTimer = CKeyPressTimer::NewL( this,
- TTimeIntervalMicroSeconds32( KScanClickTimeout ),
- EScanPrevPressTimer );
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// ReleasePressedVolumeKeys
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ReleasePressedVolumeKeys(
- TReportTranslator& aReportTranslator )
- {
- TInt volUp = 0;
- TInt volDown = 0;
- TUint key = KHidUndefinedKeyCode;
- TInt value = KHidNotSetKeyValue;
-
- if ( iVolumeUpPressed )
- {
- if ( aReportTranslator.GetValue( volUp, EConsumerUsageVolumeInc )
- == KErrNone && volDown == 0 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::ReleasepressedKeys(): \
- Volume up released"));
- key = KHidAccessoryVolumeEvent;
- iVolumeUpPressed = EFalse;
- value = KPSVolumeUpReleased;
- }
- }
- else if ( iVolumeDownPressed )
- {
- if ( aReportTranslator.GetValue( volDown, EConsumerUsageVolumeDec )
- == KErrNone && volDown == 0 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::ReleasepressedKeys(): \
- Volume downkey realeased"));
- key = KHidAccessoryVolumeEvent;
- iVolumeDownPressed = EFalse;
- value = KPSVolumeDownReleased;
- }
- }
- if ( key != KHidUndefinedKeyCode && value != KHidNotSetKeyValue )
- {
- TInt err = RProperty::Set( KPSUidHidEventNotifier, key, value );
-
- }
- }
-
-// ---------------------------------------------------------------------------
-// ReleasePressedScanKeys()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ReleasePressedScanKeys(
- TReportTranslator& aReportTranslator )
- {
- TInt scanNext = 0;
- TInt scanPrev = 0;
- TUint key = KHidUndefinedKeyCode;
- TInt value = KHidNotSetKeyValue;
-
- if ( iForwardStatus != EScanNotPressed )
- {
- if ( aReportTranslator.GetValue( scanNext, EConsumerUsageScanNext )
- == KErrNone && scanNext == 0 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Scan \
- next command released"));
- HandleScanNextRelease( key, value );
- }
- }
- else if ( iBackwardStatus != EScanNotPressed )
- {
- if ( aReportTranslator.GetValue( scanPrev, EConsumerUsageScanPrev )
- == KErrNone && scanPrev == 0 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Scan \
- prev command released"));
- HandleScanPreviousRelease( key, value );
- }
- }
- if ( key != KHidUndefinedKeyCode && value != KHidNotSetKeyValue )
- {
- TInt err = RProperty::Set( KPSUidHidEventNotifier, key, value );
- }
- }
-// ---------------------------------------------------------------------------
-// ReleasePressedKeys()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ReleasePressedKeys(
- TReportTranslator& aReportTranslator )
- {
- TRACE_FUNC_ENTRY
-
- TInt hookSwitch = 0;
- /*
- * Check hook key release here, because hook key long press
- * is handled different way.
- */
- if ( iOnHookPressed || iOffHookPressed || iNoneHookPressed )
- {
- if ( aReportTranslator.GetValue( hookSwitch,
- ETelephonyUsageHookSwitch ) == KErrNone && hookSwitch == 0 )
- {
- ReleaseHookKey();
- }
- }
- ReleasePressedVolumeKeys( aReportTranslator );
-
- ReleasePressedScanKeys( aReportTranslator );
-
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleScanNextRelease()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleScanNextRelease( TUint& aKeyCode, TInt& aValue )
- {
- TRACE_FUNC_ENTRY
- aKeyCode = KHidControlKeyEvent;
- if ( iForwardStatus == EScanPressed )
- {
- aValue = EForwardClicked;
- }
- else //long press
- {
- aValue = EFastForwardReleased;
- }
- iForwardStatus = EScanNotPressed;
-
- delete iScanNextTimer;
- iScanNextTimer = NULL;
-
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleScanPreviousRelease()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleScanPreviousRelease( TUint& aKeyCode,
- TInt& aValue )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::HandleReport(): Scan prev \
- command released"));
- aKeyCode = KHidControlKeyEvent;
- if ( iBackwardStatus == EScanPressed )
- {
- aValue = EBackwardClicked;
- }
- else //long press
- {
- aValue = ERewindReleased;
- }
- iBackwardStatus = EScanNotPressed;
-
- delete iScanPreviousTimer;
- iScanPreviousTimer = NULL;
-
- TRACE_FUNC_EXIT
- }
-// ---------------------------------------------------------------------------
-// HookKeyPres()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HookKeyPres( TBool aStatus )
- {
- TRACE_FUNC_ENTRY
-
- THookHandling hookStatus = HookStatus();
- if ( !iAlarmStatus )
- {
- iAlarmStatus = AlarmStatus();
- }
-
- iPlayingStatus = MusicPlayingStatus();
-
- if ( aStatus )
- {
- switch ( hookStatus )
- {
- case EOnHook:
- if ( !iIncomingCallStatus )
- {
- // For the first click, trigger the timer
- // single click is handled in ExpiredDoubleClickTimer
- if ( iDoubleClicktimer )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- }
- TRAP_IGNORE( iDoubleClicktimer = CKeyPressTimer::NewL( this,
- TTimeIntervalMicroSeconds32( KDoubleClickTimeoutRing ),
- EDoubleClickTimer ) );
- if ( iDoubleClicktimer )
- {
- iIncomingCallStatus = ETrue;
- }
- else // If fail to create timer, handle as single click,
- // for double click case, the next click will hang off
- {
- iIncomingCallStatus = EFalse;
- iOnHookPressed = ETrue;
- }
- break; // switch
- }
- else
- {
- iIncomingCallStatus = EFalse;
- if ( iDoubleClicktimer )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- }
- // This is the double click case, handle as EOffHook
- }
- // No break here
- case EOffHook:
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook Off Pressed"));
- iOffHookPressed = ETrue;
- break;
- case ENoHook:
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook None Pressed"));
- TRAP_IGNORE( HandleNoneHookPressL() );
- break;
- default:
- TRACE_INFO(_L("CHidHeadsetDriver::HookKeyPres : Not \
- supported"));
- }
- }
- else
- {
- ReleaseHookKey();
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// ReleaseHookKey()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ReleaseHookKey()
- {
- TRACE_FUNC_ENTRY
-
- if ( iOnHookPressed )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook On released"));
- iOnHookPressed = EFalse;
- // Incoming call
- RProperty::Set( KPSUidHidEventNotifier, KHidHookKeyEvent,
- KPSAnsweClicked );
- }
- if ( iOffHookPressed )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook Off released"));
- iOffHookPressed = EFalse;
- // Disconnect connected call
- RProperty::Set( KPSUidHidEventNotifier, KHidHookKeyEvent,
- KPSHangUpClicked );
- }
- if ( iNoneHookPressed && !iAlarmStatus )
- {
- TRAP_IGNORE( HandleIdleHookReleaseL() );
- }
- if ( iNoneHookPressed && iAlarmStatus )
- {
- TRAP_IGNORE( HandleAlarmHookReleaseL() );
- }
- if ( iLongClicktimer )
- {
- iLongPress = EFalse;
- }
- delete iLongClicktimer;
- iLongClicktimer = NULL;
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleNoneHook()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleNoneHookPressL()
- {
- TRACE_FUNC_ENTRY
- /** Start long press timer is alarm is ongoing, or phone
- * is not alarming and thre are no hook key press whitout
- * release
- */
- if ( iAlarmStatus || ( !iNoneHookPressed && !iAlarmStatus ) )
- {
- iNoneHookPressed = ETrue;
- iLongPress = EFalse;
-
- delete iLongClicktimer;
- iLongClicktimer = NULL;
-
- iLongClicktimer = CKeyPressTimer::NewL( this,
- TTimeIntervalMicroSeconds32( KLongClickTimeout ),
- ELongPressTimer );
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleAlarmHookReleaseL()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleAlarmHookReleaseL()
- {
- TRACE_FUNC_ENTRY
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook None released"));
- /**
- * Hook key is released when there is active alarm. Start double
- * click timer for monitoring double click.
- */
- if ( !iDoubleClicktimer && !iLongPress )
- {
- iDoubleClicktimer = CKeyPressTimer::NewL( this,
- TTimeIntervalMicroSeconds32( KDoubleClickTimeout ),
- EDoubleClickTimer );
- }
- /**
- * Stot alar when hook key is pressed long time during alarm.
- */
- else if ( iLongPress )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Stop alarm"));
- RProperty::Set( KPSUidAlarmExtCntl, KAlarmStopKey,
- EAlarmUIStopAlarm );
- iAlarmStatus = EFalse;
- iLongPress = EFalse;
- }
- /**
- * Double click timer exsist and is it not long press, so
- * this is double click release. Then snooze alarm.
- */
- else if ( !iLongPress )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- iAlarmStatus = EFalse;
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Snooze"));
- RProperty::Set( KPSUidAlarmExtCntl, KAlarmSnoozeKey,
- EAlarmUISnoozeAlarm );
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// HandleIdleHookReleaseL
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandleIdleHookReleaseL()
- {
- TRACE_FUNC_ENTRY
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Hook None released"));
- iNoneHookPressed = EFalse;
- /**
- * Hook key is released when there is music playing ongoing. Start double
- * click timer for monitoring double click.
- */
- if ( !iDoubleClicktimer && !iLongPress )
- {
- iDoubleClicktimer = CKeyPressTimer::NewL( this,
- TTimeIntervalMicroSeconds32( KDoubleClickTimeout ),
- EDoubleClickTimer );
- }
- /**
- * Hook key is released when there is not music playing ongoing.
- * Because double click timer is active this is second release in
- * short beriod and redial needs to be issued.
- */
- else if ( !iLongPress && !iPlayingStatus )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver Redial"));
- RProperty::Set( KPSUidHidEventNotifier, KHidHookKeyEvent,
- KPSRedial );
- }
- /**
- * Hook key is released when there is music playing ongoing.
- * Because double click timer is active, is send forward command sent
- * and DoubleNextClick set to true for sending next command.
- */
- else if ( iPlayingStatus && !iLongPress )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver next after next"));
- if ( !iLongPress )
- {
- iDoubleNextClick = ETrue; //set to true and when player change
- //track press next again
- }
- RProperty::Set( KPSUidHidEventNotifier, KHidControlKeyEvent,
- EForwardClicked ); //next after next
- }
- /**
- * Long press release when there are no actie calls, alarms, and music
- * playing is stopped, activates voice dialing.
- */
- else if ( iLongPress )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver VoiceDial"));
- RProperty::Set( KPSUidHidEventNotifier, KHidHookKeyEvent,
- KPSVoiceDial );
- iLongPress = EFalse;
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// GetHookStatus()
-// ---------------------------------------------------------------------------
-//
-CHidHeadsetDriver::THookHandling CHidHeadsetDriver::HookStatus()
- {
- TRACE_FUNC_ENTRY
- THookHandling retVal = EOffHook;
- TInt ret = KErrNone;
- CTelephony::TCallStatusV1 callStatusV1;
- CTelephony::TCallStatusV1Pckg callStatusV1Pckg( callStatusV1 );
- ret = iTelephony->GetLineStatus( CTelephony::EVoiceLine,
- callStatusV1Pckg );
- if ( ret != KErrNone )
- {
- retVal = ENoHook;
- }
- CTelephony::TCallStatus voiceLineStatus = callStatusV1.iStatus;
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver GetHookStatus voiceline \
- status %d"), voiceLineStatus));
-
- if ( voiceLineStatus == CTelephony::EStatusHold || voiceLineStatus
- == CTelephony::EStatusRinging )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver GetHookStatus on hook"));
- retVal = EOnHook;
- }
- else if ( voiceLineStatus == CTelephony::EStatusUnknown
- || voiceLineStatus == CTelephony::EStatusIdle )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver GetHookStatus no hook"));
- retVal = ENoHook;
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// CanHandleReportL()
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::CanHandleReportL( CReportRoot* aReportRoot )
- {
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::CanHandleReport(0x%08x)"),
- aReportRoot));
-
- THidFieldSearch search;
-
- THeadsetFinder headsetFinder;
- search.SearchL( aReportRoot, &headsetFinder );
-
- iSupportedFieldCount = headsetFinder.FieldCount();
- for ( TInt i = 0; i < headsetFinder.FieldCount(); i++ )
- {
- User::LeaveIfError( iFieldList.Append( headsetFinder.GetFieldAtIndex(
- i ) ) );
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::CanHandleReportL, field \
- pointer: 0x%08x"), iFieldList[i]));
- }
-
- TInt valid = KErrHidUnrecognised;
-
- if ( headsetFinder.Found() )
- {
- valid = KErrNone;
- }
- // empty finder's field list before going out of scope.
- headsetFinder.EmptyList();
-
- TRACE_INFO((_L("[HID]\tCHidHeadsetDriver::CanHandleReport() returning \
- %d"), valid));
- return valid;
- }
-
-// ---------------------------------------------------------------------------
-// From class CHidDriver
-// SupportedFieldCount
-// ---------------------------------------------------------------------------
-//
-TInt CHidHeadsetDriver::SupportedFieldCount()
- {
- return iSupportedFieldCount;
- }
-// ---------------------------------------------------------------------------
-// From class MTimerNotifier
-// TimerExpired()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::TimerExpired( TTimerType aTimerType )
- {
- TRACE_FUNC_ENTRY
- switch ( aTimerType )
- {
- case EDoubleClickTimer:
- ExpiredDoubleClickTimer();
- break;
- case ELongPressTimer:
- ExpiredLongClickTimer();
- break;
- case EScanNextPressTimer:
- iForwardStatus = EScanLongPress;
- RProperty::Set( KPSUidHidEventNotifier, KHidControlKeyEvent,
- EFastForwardPressed );
- break;
- case EScanPrevPressTimer:
- iBackwardStatus = EScanLongPress;
- RProperty::Set( KPSUidHidEventNotifier, KHidControlKeyEvent,
- ERewindPressed );
- break;
- default:
- TRACE_INFO(_L("CHidHeadsetDriver::TimerExpired : Not supported"))
- ;
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// ExpiredDoubleClickTimer()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ExpiredDoubleClickTimer()
- {
- TRACE_FUNC_ENTRY
- if ( iDoubleClicktimer )
- {
- delete iDoubleClicktimer;
- iDoubleClicktimer = NULL;
-
- if ( iIncomingCallStatus )
- {
- iIncomingCallStatus = EFalse;
- iOnHookPressed = ETrue;
- ReleaseHookKey();
- }
- if ( iAlarmStatus )
- {
- RProperty::Set( KPSUidAlarmExtCntl, KAlarmStopKey,
- EAlarmUIStopAlarm );
- iAlarmStatus = EFalse;
- }
- if ( iPlayingStatus )
- {
- RProperty::Set( KPSUidHidEventNotifier, KHidControlKeyEvent,
- EForwardClicked );
- iPlayingStatus = EFalse;
- }
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// ExpiredLongClickTimer()
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::ExpiredLongClickTimer()
- {
- TRACE_FUNC_ENTRY
- if ( iLongClicktimer )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::TimerExpired long click"));
- delete iLongClicktimer;
- iLongClicktimer = NULL;
- iLongPress = ETrue;
- ReleaseHookKey();
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// AlarmStatus()
-// ---------------------------------------------------------------------------
-//
-TBool CHidHeadsetDriver::AlarmStatus()
- {
- TRACE_FUNC_ENTRY
- TInt activealarmcount = 0;
- TBool retVal = EFalse;
- activealarmcount = iAlarmServerSession.AlarmCountByState(
- EAlarmStateNotifying );
- if ( activealarmcount > 0 )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::AlarmStatus active alarms"));
- retVal = ETrue;
- }
- else
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::AlarmStatus no active \
- alarms"));
- retVal = EFalse;
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// AlarmStatus()
-// ---------------------------------------------------------------------------
-//
-TBool CHidHeadsetDriver::MusicPlayingStatus()
- {
- TRACE_FUNC_ENTRY
- TBool retVal = EFalse;
- TMPXPlaybackState state = EPbStateNotInitialised;
- TRAPD( err, state = iMusicPlayer->StateL() );
- if ( state == EPbStatePlaying && err == KErrNone )
- {
- TRACE_INFO(_L("[HID]\tCHidHeadsetDriver::MusicPlayingStatus play \
- active"));
- retVal = ETrue;
- }
- TRACE_FUNC_EXIT
- return retVal;
- }
-
-// ---------------------------------------------------------------------------
-// HandlePlaybackMessage
-// ---------------------------------------------------------------------------
-//
-void CHidHeadsetDriver::HandlePlaybackMessage( CMPXMessage* aMsg, TInt /*aErr*/)
- {
- TRACE_FUNC_ENTRY
-
- TMPXMessageId id( aMsg->ValueTObjectL<TMPXMessageId> (
- KMPXMessageGeneralId ) );
- // send nect track whit double hook click when track is changed
- if ( id == KMPXMessagePbMediaChanged && iDoubleNextClick )
- {
- TRACE_INFO(_L("[HID]\tHandlePlaybackMessage: PbMediaChangeg"));
- RProperty::Set( KPSUidHidEventNotifier, KHidControlKeyEvent,
- EForwardClicked );
- iDoubleNextClick = EFalse;
- }
- TRACE_FUNC_EXIT
- }
-
--- a/localconnectivityservice/headset/src/hidheadsetdriverproxy.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Heaset plugin implementation table
- *
-*/
-
-
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-#include "headset.h"
-#include "headsetuids.h"
-
-// Constantshrr
-//
-const TImplementationProxy KHidHeadsetDriverProxy[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( HEADSET_DRIVER_IMP, CHidHeadsetDriver::NewL )
- };
-
-// ---------------------------------------------------------------------------
-// ImplementationGroupProxy
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
- TInt& aTableCount )
- {
- aTableCount = sizeof( KHidHeadsetDriverProxy )
- / sizeof(TImplementationProxy);
- return KHidHeadsetDriverProxy;
- }
--- a/localconnectivityservice/headset/src/keypresstimer.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID Heaset plugin timeouttimer
- *
-*/
-
-
-#include "keypresstimer.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CKeyPressTimer* CKeyPressTimer::NewL( MTimerNotifier* aTimeOutNotify,
- TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType )
- {
- CKeyPressTimer* self = CKeyPressTimer::NewLC( aTimeOutNotify,
- aTimeOutTime, aTimerType );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CKeyPressTimer* CKeyPressTimer::NewLC( MTimerNotifier* aTimeOutNotify,
- TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType )
- {
- CKeyPressTimer* self = new ( ELeave ) CKeyPressTimer( aTimeOutNotify,
- aTimerType );
- CleanupStack::PushL( self );
- self->ConstructL( aTimeOutTime );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CTimeOutTimer()
-// ---------------------------------------------------------------------------
-//
-CKeyPressTimer::CKeyPressTimer( MTimerNotifier* aTimeOutNotify,
- TTimerType aTimerType ) :
- CTimer( EPriorityStandard ), iNotify( aTimeOutNotify ), iTimerType(
- aTimerType )
- {
- }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CKeyPressTimer::~CKeyPressTimer()
- {
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CKeyPressTimer::ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime )
- {
- TRACE_FUNC
- CTimer::ConstructL();
- CActiveScheduler::Add( this );
- After( aTimeOutTime );
- }
-
-// ---------------------------------------------------------------------------
-// From class CActive
-// RunL()
-// ---------------------------------------------------------------------------
-//
-void CKeyPressTimer::RunL()
- {
- TRACE_FUNC
- // Timer request has completed, so notify the timer's owner
- if ( iNotify )
- {
- iNotify->TimerExpired( iTimerType );
- }
- }
--- a/localconnectivityservice/locod/commoninc/locodbearer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines the LCD Bearer Plugin identifier.
-*
-*/
-
-
-#ifndef T_LOCODBEARER_H
-#define T_LOCODBEARER_H
-
-#include <e32base.h>
-
-/** bearer value in LC */
-enum TLocodBearer
- {
- ELocodBearerBT = 0x0001,
- ELocodBearerIR = 0x0010,
- ELocodBearerUSB = 0x0100,
- };
-
-#endif // T_LOCODBEARER_H
--- a/localconnectivityservice/locod/commoninc/locodbearerplugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin base class declaration.
-*
-*/
-
-
-#ifndef C_LOCODBEARERPLUGIN_H
-#define C_LOCODBEARERPLUGIN_H
-
-#include <e32base.h>
-#include "locodbearerpluginparams.h"
-
-/**
- * Bearer Plugin base class
- *
- * This is the base class from which bearer plugins inherit.
- *
- * See locodplugin.hrh for the resource registration definitions.
- *
- * @lib euser.lib
- * @since S60 v3.2
- */
-class CLocodBearerPlugin : public CBase
- {
-public:
-
- static CLocodBearerPlugin* NewL(TLocodBearerPluginParams& aParams);
-
- virtual ~CLocodBearerPlugin();
-
- /**
- * Gets the implementation uid of this plugin
- *
- * @since S60 v3.2
- * @return The implementation uid
- */
- TUid ImplementationUid() const;
-
-protected:
-
- CLocodBearerPlugin(TLocodBearerPluginParams& aParams);
-
- /**
- * Gets the observer interface object associated with this plugin
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodBearerPluginObserver& Observer() const;
-
-private: // data
-
- /**
- * UID set by ECOM when the instance is created. Used when the instance
- * is destroyed.
- */
- TUid iInstanceUid;
-
- /**
- * Implementation UID of the concrete instance.
- */
- TUid iImplementationUid;
-
- /**
- * Holds the observer object which will be notified when the operations
- * complete
- * Not own.
- */
- MLocodBearerPluginObserver& iObserver;
-
- };
-
-#include "locodbearerplugin.inl"
-
-#endif // C_LOCODBEARERPLUGIN_H
--- a/localconnectivityservice/locod/commoninc/locodbearerplugin.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-#include <ecom/ecom.h>
-
-// -----------------------------------------------------------------------------
-// Creates the bearer plug ins and return it to caller
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin* CLocodBearerPlugin::NewL(TLocodBearerPluginParams& aParams)
- {
- CLocodBearerPlugin* self = reinterpret_cast<CLocodBearerPlugin*>(
- REComSession::CreateImplementationL(
- aParams.ImplementationUid(),
- _FOFF(CLocodBearerPlugin, iInstanceUid),
- (TAny*)&aParams)
- );
-
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin::~CLocodBearerPlugin()
- {
- REComSession::DestroyedImplementation(iInstanceUid);
- }
-
-// -----------------------------------------------------------------------------
-// Return the implemtation uid
-// -----------------------------------------------------------------------------
-//
-inline TUid CLocodBearerPlugin::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin::CLocodBearerPlugin(TLocodBearerPluginParams& aParams)
- : iImplementationUid(aParams.ImplementationUid()),
- iObserver(aParams.Observer())
- {
- }
-
-// -----------------------------------------------------------------------------
-// Return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodBearerPluginObserver& CLocodBearerPlugin::Observer() const
- {
- return iObserver;
- }
--- a/localconnectivityservice/locod/commoninc/locodbearerpluginobserver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin observer interface definition.
-*
-*/
-
-
-#ifndef M_LOCODBEARERPLUGINOBSERVER_H
-#define M_LOCODBEARERPLUGINOBSERVER_H
-
-#include "locodbearer.h"
-
-/**
- * LCD Bearer Plugin Observer interface class
- *
- * This is the bearer plugin observer interface definition used by LCD
- * Bearer Plugins to inform the daemon about the plugin's event.
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class MLocodBearerPluginObserver
- {
-public:
-
- /**
- * This is a callback function used by the plugins to inform when the
- * bearer's availability changes.
- *
- * @since S60 v3.2
- * @param aBearer the bearer which calls this nothification
- * @param aStatus the status of this bearer, ETrue if it is available;
- * EFalse otherwise.
- */
- virtual void NotifyBearerStatus(TLocodBearer aBearer, TBool aStatus) = 0;
- };
-
-#endif // M_LOCODBEARERPLUGINOBSERVER_H
--- a/localconnectivityservice/locod/commoninc/locodbearerpluginparams.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-#ifndef T_LOCODBEARERPLUGINPARAMS_H
-#define T_LOCODBEARERPLUGINPARAMS_H
-
-class MLocodBearerPluginObserver;
-
-/**
- * LCD Bearer Plugin Callback construction parameters
- *
- * This interface class is used to pass construction parameters to the
- * plugins. These parameters include the callback interface and the ECOM
- * plugin implementation UID
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class TLocodBearerPluginParams
- {
-public:
-
- /**
- * Constructor.
- *
- * @since S60 v3.2
- * @param aUid Implementation UID of the plugin being constructed
- * @param aObserver Callback interface object
- */
- TLocodBearerPluginParams(const TUid aUid, MLocodBearerPluginObserver& aObserver);
-
- /**
- * Gets the implementation UID of the plugin
- *
- * @since S60 v3.2
- * @return Implementaion UID
- */
- TUid ImplementationUid() const;
-
- /**
- * Gets the observer interface object
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodBearerPluginObserver& Observer() const;
-
-private: // data
-
- /**
- * The implementation UID
- */
- const TUid iImplementationUid;
-
- /**
- * Reference to the observer object
- */
- MLocodBearerPluginObserver& iObserver;
-
- };
-
-#include "locodbearerpluginparams.inl"
-
-#endif // T_LOCODBEARERPLUGINPARAMS_H
--- a/localconnectivityservice/locod/commoninc/locodbearerpluginparams.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline TLocodBearerPluginParams::TLocodBearerPluginParams(const TUid aUid, MLocodBearerPluginObserver& aObserver)
- : iImplementationUid(aUid),
- iObserver(aObserver)
- {
- }
-
-// -----------------------------------------------------------------------------
-// returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid TLocodBearerPluginParams::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// returns the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodBearerPluginObserver& TLocodBearerPluginParams::Observer() const
- {
- return iObserver;
- }
--- a/localconnectivityservice/locod/commoninc/locodplugin.hrh Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for plugin resource registration.
-*
-*/
-
-
-#ifndef LOCODPLUGIN_HRH
-#define LOCODPLUGIN_HRH
-
-/**
- * This file contains the defintions for plugin resource registration.
- *
- * All plugins should use version 2 registration resource file and set the
- * rom_only field to 1 to prevent it from being overridden by RAM-based plugins.
- *
- * All bearer plugins should use KLOCODBEARERINTERFACEUID as the interface UID.
- *
- * A bearer plugin should use its corresponding feature ID (from features.hrh) as the
- * implementation UID, that is,
- * Implementation UID of IR bearer is KFeatureIdIrda,
- * Implementation UID of BT bearer is KFeatureIdBt,
- * Implementation UID of USB bearer is KFeatureIdUsb.
- *
- * All service plugins should use KLOCODSERVICEINTERFACEUID as the interface UID.
- *
- * A service plugin should use its corresponding feature ID (from features.hrh) as the
- * implementation UID, that is,
- * Implementation UID of Dun is KFeatureIdDun, (not exist yet, CR created)
- * Implementation UID of Obex is KFeatureIdSrcs,
- *
- */
-
-// Interface UID of bearer plugins
-#define KLOCODBEARERINTERFACEUID 0x20002771
-
-// Interface UID of service plugins
-#define KLOCODSERVICEINTERFACEUID 0x20002772
-
-#endif // LOCODPLUGIN_HRH
--- a/localconnectivityservice/locod/commoninc/locodserviceplugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin base class declaration.
-*
-*/
-
-
-#ifndef C_LOCODSERVICEPLUGIN_H
-#define C_LOCODSERVICEPLUGIN_H
-
-#include <e32base.h>
-
-#include "locodservicepluginparams.h"
-#include "locodbearer.h"
-
-/**
- * Service Plugin base class
- *
- * This is the base class from which service plugins inherit.
- *
- * When a service plugin is constructed, it should not start any service by default.
- * A service is started on demand when the bearer is available.
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class CLocodServicePlugin : public CBase
- {
-public:
-
- static CLocodServicePlugin* NewL(TLocodServicePluginParams& aParams);
-
- virtual ~CLocodServicePlugin();
-
- /**
- * Tell service plugin which service should be enabled or disabled according to
- * specified bearer and its status.
- *
- * On completion, the plugin should call
- * MLocodServicePluginObserver::ManageServiceCompleted() to inform the result.
- *
- * @since S60 v3.2
- * @param aBearer the bearer identification
- * @param aStatus the status of this bearer, ETrue if it is available;
- * EFalse otherwise.
- */
- virtual void ManageService(TLocodBearer aBearer, TBool aStatus) = 0;
-
- TUid ImplementationUid() const;
-
-protected:
-
- CLocodServicePlugin(TLocodServicePluginParams& aParams);
-
- /**
- * Gets the observer interface object associated with this plugin
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodServicePluginObserver& Observer() const;
-
-private: // data
-
- /**
- * UID set by ECOM when the instance is created. Used when the instance
- * is destroyed.
- */
- TUid iInstanceUid;
-
- /**
- * Implementation UID of the concrete instance.
- */
- const TUid iImplementationUid;
-
- /**
- * Holds the observer object which will be notified when the operations
- * complete
- * Not own.
- */
- MLocodServicePluginObserver& iObserver;
-
- };
-
-#include <locodserviceplugin.inl>
-
-#endif // C_LOCODSERVICEPLUGIN_H
--- a/localconnectivityservice/locod/commoninc/locodserviceplugin.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-#include <ecom/ecom.h>
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin* CLocodServicePlugin::NewL(TLocodServicePluginParams& aParams)
- {
- CLocodServicePlugin* self = reinterpret_cast<CLocodServicePlugin*>(
- REComSession::CreateImplementationL(
- aParams.ImplementationUid(),
- _FOFF(CLocodServicePlugin, iInstanceUid),
- (TAny*)&aParams)
- );
-
- return self;
- }
-
-
-// -----------------------------------------------------------------------------
-// Service plug ins destructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin::~CLocodServicePlugin()
- {
- REComSession::DestroyedImplementation(iInstanceUid);
- }
-
-// -----------------------------------------------------------------------------
-// returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid CLocodServicePlugin::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// CLocodServicePlugin C++ constructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin::CLocodServicePlugin(TLocodServicePluginParams& aParams)
- : iImplementationUid(aParams.ImplementationUid()),
- iObserver(aParams.Observer())
- {
- }
-
-// -----------------------------------------------------------------------------
-// return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodServicePluginObserver& CLocodServicePlugin::Observer() const
- {
- return iObserver;
- }
-
--- a/localconnectivityservice/locod/commoninc/locodservicepluginobserver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin observer interface definition.
-*
-*/
-
-
-#ifndef M_LOCODSERVICEPLUGINOBSERVER_H
-#define M_LOCODSERVICEPLUGINOBSERVER_H
-
-#include "locodbearer.h"
-
-/**
- * LCD Service Plugin Observer interface class
- *
- * This is the service plugin observer interface definition used by LCD
- * Service Plugins to inform the daemon when an action is complete.
- *
- * @lib
- * @since S60 v3.2
- */
-class MLocodServicePluginObserver
- {
-public:
-
- /**
- * This is a callback function used by the plugins to inform when
- * managing the service have completed. The parameters passed should be
- * identical to the ones used when the plugin's ManageService() was called,
- * plus this service plugin's implemnetation UID and the completion status.
- *
- * @since S60 v3.2
- * @param aBearer the bearer identification passed in ManageService()
- * @param aStatus the status of this bearer passed in ManageService()
- * @param aServiceImplUid, the implementation UID of this service plugin.
- * @param err KErrNone if the operation succeeded; otherwise a Symbian
- * error code.
- */
- virtual void ManageServiceCompleted(
- TLocodBearer aBearer,
- TBool aStatus,
- TUid aServiceImplUid,
- TInt err) = 0;
- };
-
-#endif // M_LOCODSERVICEPLUGINOBSERVER_H
--- a/localconnectivityservice/locod/commoninc/locodservicepluginparams.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-#ifndef T_LOCODSERVICEPLUGINPARAMS_H
-#define T_LOCODSERVICEPLUGINPARAMS_H
-
-class MLocodServicePluginObserver;
-
-/**
- * LCD Service Plugin Callback construction parameters
- *
- * This interface class is used to pass construction parameters to the
- * plugins. These parameters include the callback interface (usually
- * implemented by the LCD) and the ECOM plugin implementation UID
- *
- * @lib ?library
- * @since S60 v3.2
- */
-class TLocodServicePluginParams
- {
-public:
- /**
- * Constructor.
- *
- * @since S60 v3.2
- * @param aUid Implementation UID of the plugin being constructed
- * @param aObserver Callback interface object
- */
- TLocodServicePluginParams(TUid aUid, MLocodServicePluginObserver& aObserver);
-
- /**
- * Gets the implementation UID of the plugin
- *
- * @since S60 v3.2
- * @return Implementaion UID
- */
- TUid ImplementationUid() const;
-
- /**
- * Gets the observer interface object
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodServicePluginObserver& Observer() const;
-
-private: // data
-
- /**
- * The implementation UID
- */
- const TUid iImplementationUid;
-
- /**
- * Reference to the observer object
- */
- MLocodServicePluginObserver& iObserver;
-
- };
-
-#include "locodservicepluginparams.inl"
-
-#endif // T_LOCODSERVICEPLUGINPARAMS_H
--- a/localconnectivityservice/locod/commoninc/locodservicepluginparams.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline TLocodServicePluginParams::TLocodServicePluginParams(TUid aUid, MLocodServicePluginObserver& aObserver)
- : iImplementationUid(aUid),
- iObserver(aObserver)
- {
- }
-
-// -----------------------------------------------------------------------------
-// Returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid TLocodServicePluginParams::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodServicePluginObserver& TLocodServicePluginParams::Observer() const
- {
- return iObserver;
- }
--- a/localconnectivityservice/locod/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Build information file for project Local Connectivity Daemon.
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-locod.mmp
-
-PRJ_TESTMMPFILES
-
-PRJ_EXPORTS
-../commoninc/locodbearer.h |../../../inc/locodbearer.h
-../commoninc/locodplugin.hrh |../../../inc/locodplugin.hrh
-../commoninc/locodbearerplugin.h |../../../inc/locodbearerplugin.h
-../commoninc/locodbearerplugin.inl |../../../inc/locodbearerplugin.inl
-../commoninc/locodbearerpluginobserver.h |../../../inc/locodbearerpluginobserver.h
-../commoninc/locodbearerpluginparams.h |../../../inc/locodbearerpluginparams.h
-../commoninc/locodbearerpluginparams.inl |../../../inc/locodbearerpluginparams.inl
-../commoninc/locodserviceplugin.h |../../inc/locodserviceplugin.h
-../commoninc/locodserviceplugin.inl |../../inc/locodserviceplugin.inl
-../commoninc/locodservicepluginobserver.h |../../inc/locodservicepluginobserver.h
-../commoninc/locodservicepluginparams.h |../../inc/locodservicepluginparams.h
-../commoninc/locodservicepluginparams.inl |../../inc/locodservicepluginparams.inl
-../rom/locod.iby CORE_MW_LAYER_IBY_EXPORT_PATH(locod.iby)
-
--- a/localconnectivityservice/locod/group/locod.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project definition file for project Local Connectivity Daemon.
-*
-*/
-
-#include <platform_paths.hrh>
-#include "../inc/prjconfig.h"
-
-TARGET locod.exe
-TARGETTYPE exe
-
-UID 0x1000008d 0x2000276D
-
-VENDORID VID_DEFAULT
-
-CAPABILITY LocalServices ReadDeviceData NetworkControl WriteDeviceData ReadUserData WriteUserData NetworkServices
-
-SOURCEPATH ../src
-SOURCE locodmain.cpp
-SOURCE locodaemon.cpp
-SOURCE locodserviceman.cpp
-SOURCE locodservice.cpp
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc ../../../inc
-
-MW_LAYER_SYSTEMINCLUDE
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY featmgr.lib
-LIBRARY centralrepository.lib
-LIBRARY cenrepnotifhandler.lib
-
-#ifdef PRJ_FILE_TRACE
-LIBRARY flogger.lib
-#endif
-
-
--- a/localconnectivityservice/locod/group/locod.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component locod
-
-source \sf\mw\remoteconn\localconnectivityservice\locod
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/localconnectivityservice/locod/inc/debug.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Logging definition
-*
-*/
-
-
-#ifndef PRJ_LOGGING_H
-#define PRJ_LOGGING_H
-
-#include <e32base.h>
-#include "debugconfig.h"
-
-#ifdef PRJ_ENABLE_TRACE
-
-#ifdef PRJ_FILE_TRACE
-#include <flogger.h>
-#else
-#include <e32debug.h>
-#endif
-
-NONSHARABLE_CLASS(TOverflowTruncate16) : public TDes16Overflow
- {
-public:
- void Overflow(TDes16& /*aDes*/) {}
- };
-
-NONSHARABLE_CLASS(TOverflowTruncate8) : public TDes8Overflow
- {
-public:
- void Overflow(TDes8& /*aDes*/) {}
- };
-
-inline void Trace(TRefByValue<const TDesC16> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list,aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TBuf16<KMaxLogLineLength> theFinalString;
- theFinalString.Append(KTracePrefix16);
- TOverflowTruncate16 overflow;
- theFinalString.AppendFormatList(aFmt,list,&overflow);
- RDebug::Print(theFinalString);
-#endif
- }
-
-inline void Trace(TRefByValue<const TDesC8> aFmt, ...)
- {
- VA_LIST list;
- VA_START(list, aFmt);
-#ifdef PRJ_FILE_TRACE
- RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, aFmt, list);
-#else
- TOverflowTruncate8 overflow;
- TBuf8<KMaxLogLineLength> buf8;
- buf8.Append(KTracePrefix8);
- buf8.AppendFormatList(aFmt, list, &overflow);
- TBuf16<KMaxLogLineLength> buf16(buf8.Length());
- buf16.Copy(buf8);
- TRefByValue<const TDesC> tmpFmt(_L("%S"));
- RDebug::Print(tmpFmt, &buf16);
-#endif
- }
-
-inline void TracePanic(
- char* aFile,
- TInt aLine,
- TInt aPanicCode,
- const TDesC& aPanicCategory)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KPanicPrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aPanicCode, aLine, &fileName);
- Trace(buf);
- User::Panic(aPanicCategory, aPanicCode);
- }
-
-inline void TraceLeave(char* aFile, TInt aLine, TInt aReason)
- {
- TPtrC8 fullFileName((const TUint8*)aFile);
- TPtrC8 fileName(fullFileName.Ptr()+fullFileName.LocateReverse('\\')+1);
- TBuf8<KMaxLogLineLength> buf;
- buf.Append(KLeavePrefix8);
- buf.AppendFormat(_L8("%d at line %d in file %S"), aReason, aLine, &fileName);
- Trace(buf);
- User::LeaveIfError(aReason);
- }
-
-#define TRACE_INFO(p) {if(KTraceMask & KPRINTINFO) Trace p;}
-
-#define TRACE_ERROR(p) {if(KTraceMask & KPRINTERROR) Trace p;}
-
-#define TRACE_STATE(p) {if(KTraceMask & KPRINTSTATE) Trace p;}
-
-#define TRACE_WARNING(p) {if(KTraceMask & KPRINTWARNING) Trace p;}
-
-#define TRACE_INFO_SEG(p) {if(KTraceMask & KPRINTINFO) p;}
-
-#define TRACE_ASSERT(GUARD, CODE) {if (!(GUARD)) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory);}
-
-#define PANIC(CODE) TracePanic(__FILE__, __LINE__, CODE, KPanicCategory)
-
-#define LEAVE_IF_ERROR(REASON) {if (REASON) TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define LEAVE(REASON) {TraceLeave(__FILE__, __LINE__, REASON);}
-
-#define TRACE_FUNC_ENTRY {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryFormat8, &ptr8);}}
-
-#define TRACE_FUNC_ENTRY_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncEntryThisFormat8, &ptr8, this);}}
-
-#define TRACE_FUNC_EXIT {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncExitFormat8, &ptr8);}}
-
-#define TRACE_FUNC {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncFormat8, &ptr8);}}
-
-#define TRACE_FUNC_THIS {if(KTraceMask & KPRINTINFO) { TPtrC8 ptr8((TUint8*)__PRETTY_FUNCTION__); Trace(KFuncThisFormat8, &ptr8, this);}}
-
-#define RETURN_IF_ERR(ERR) {if(ERR) {TPtrC8 ptr8((TUint8*)__FILE__); Trace(_L8(" RETURN %d at file %S line %d"), ERR, &ptr8, __LINE__); return ERR;}}
-
-#else // PRJ_ENABLE_TRACE not defined
-
-#define TRACE_INFO(p)
-
-#define TRACE_ERROR(p)
-
-#define TRACE_STATE(p)
-
-#define TRACE_WARNING(p)
-
-#define TRACE_INFO_SEG(p)
-
-#define TRACE_ASSERT(GUARD, CODE)
-
-#define PANIC(CODE) {User::Panic(KPanicCategory, CODE);}
-
-#define LEAVE_IF_ERROR(REASON) {static_cast<void>(User::LeaveIfError(REASON));}
-
-#define LEAVE(REASON) {static_cast<void>(User::Leave(REASON));}
-
-#define TRACE_FUNC_ENTRY
-
-#define TRACE_FUNC_ENTRY_THIS
-
-#define TRACE_FUNC_EXIT
-
-#define TRACE_FUNC
-
-#define TRACE_FUNC_THIS
-
-#define RETURN_IF_ERR(ERR) {if(ERR) return ERR;}
-#endif // PRJ_ENABLE_TRACE
-
-#endif // PRJ_LOGGING_H
--- a/localconnectivityservice/locod/inc/debugconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef LOCOD_DEBUGCONFIG_H
-#define LOCOD_DEBUGCONFIG_H
-
-#include "prjconfig.h"
-
-/**
- * Custom logging variations.
- */
-#ifdef PRJ_FILE_TRACE
-_LIT(KLogFile,"locod.txt");
-_LIT(KLogDir,"locod");
-#endif
-
-#ifdef PRJ_ENABLE_TRACE
-_LIT(KTracePrefix16, "[Locod] ");
-_LIT8(KTracePrefix8, "[Locod] ");
-_LIT8(KFuncFormat8, "><%S");
-_LIT8(KFuncThisFormat8, "><%S, [0x%08X]");
-_LIT8(KFuncEntryFormat8, ">%S");
-_LIT8(KFuncEntryThisFormat8, ">%S, [0x%08X]");
-_LIT8(KFuncExitFormat8, "<%S");
-
-_LIT(KPanicCategory, "LC Daemon");
-_LIT8(KPanicPrefix8, "PANIC code ");
-_LIT8(KLeavePrefix8, "LEAVE code ");
-#endif
-
-const TInt KMaxLogLineLength = 512;
-
-#define KPRINTERROR 0x00000001 // Tracing level: error
-#define KPRINTINFO 0x00000002 // Tracing level: function trace
-#define KPRINTSTATE 0x00000004 // Tracing level: state machine info
-#define KPRINTWARNING 0x00000008 // Tracing level: warning
-
-const TInt KTraceMask = KPRINTERROR | KPRINTINFO | KPRINTSTATE | KPRINTWARNING;
-
-#endif // LOCOD_DEBUGCONFIG_H
--- a/localconnectivityservice/locod/inc/locodaemon.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines the Daemon class.
-*
-*/
-
-
-#ifndef T_LOCODAEMON_H
-#define T_LOCODAEMON_H
-
-#include <e32base.h>
-#include <e32property.h>
-class CLocodBearerPlugin;
-class CLocodServiceMan;
-
-/**
- * The root of Daemon.
- *
- * It monitors system state, constructs service manager and loads all bearer
- * plugins when system is up.
- * It unloads all bearer and service plugins when system is shuting down.
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class CLocoDaemon : public CActive
- {
-public:
-
- /**
- * Factory method, leave the object in cleanupstack.
- * @since S60 v3.2
- */
- static CLocoDaemon* NewLC();
-
- ~CLocoDaemon();
-
-private:
-
- // From CActive
-
- void RunL();
-
- void DoCancel();
-
- TInt RunError(TInt aReason);
-
-private:
-
- CLocoDaemon();
-
- void ConstructL();
-
- /**
- * Loads the bearer plug ins
- * @since S60 v3.2
- */
- void LoadBearesL();
-
-private: // data
-
- // the bearer plugins
- RPointerArray<CLocodBearerPlugin> iBearers;
-
- // the service manager
- CLocodServiceMan* iServiceMan;
-
- // for system state monitoring
- RProperty iSystemPS;
- TInt iSystemState;
- };
-
-
-#endif // T_LOCODAEMON_H
--- a/localconnectivityservice/locod/inc/locodservice.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: A service which constains a service plugin and its status.
-*
-*/
-
-
-#ifndef C_LOCODSERVICE_H
-#define C_LOCODSERVICE_H
-
-#include <e32base.h>
-#include <startupdomainpskeys.h>
-#include <locodbearerpluginobserver.h>
-#include <locodservicepluginobserver.h>
-
-class CLocodServicePlugin;
-class TLocodServiceRequest;
-
-/**
- * Specific service that is managed by locod
- * Locod creates all service and add it to
- * a an array
- * @ euser.lib
- * @since S60 3.2
- */
-class CLocodService : public CBase
- {
-public:
-
- /**
- * Factory function
- * @since S60 3.2
- * @param aPlugin the sevice plug ins that will be managed (for example DUN, obex)
- * @return an instance of CLocodService
- */
- static CLocodService* NewL(CLocodServicePlugin& aPlugin);
-
- ~CLocodService();
-
- CLocodServicePlugin& Plugin();
-
- /**
- * Called to manage service when the bearer status has been changed
- * @since S60 3.2
- * @param aBearer the bearer whose status has been changed
- * @param aStatus status of the bearer connected, disconnected or on or off
- * @return TInt
- */
- TInt ManageService(TLocodBearer aBearer,
- TBool aStatus);
-
- /**
- * Called when the service has been managed by service plug ins
- * @since S60 3.2
- * @param aBearer the bearer whose service has been managed
- * @param aStatus status of the bearer connected, disconnected or on or off
- * @param err error code that may occured during managing the service
- * @return TInt
- */
- void ManageServiceCompleted(TLocodBearer aBearer,
- TBool aStatus,
- TInt err);
-
- /**
- * Check if there are any service pending
- * @since S60 3.2
- * @return TBool if there are service pending
- */
- TBool HasServiceToManage() const;
-
-private:
-
- CLocodService(CLocodServicePlugin& aPlugin);
-
- void ConstructL();
-
-private:
- // the service plugin, owned
- CLocodServicePlugin* iPlugin;
-
- // The latest status of this service plugin
- TInt iServiceStatus;
-
- // Queue of ManageService request
- RArray<TLocodServiceRequest> iRequests;
- };
-
-/**
- * A ManageService request
- */
-class TLocodServiceRequest
- {
-public:
-
- TLocodServiceRequest(TLocodBearer aBearer, TBool aStatus);
-
- // The bearer whose status has changed
- TLocodBearer iBearer;
-
- // The new bearer status
- TBool iStatus;
-
- // The request status
- TBool iRequesting;
- };
-
-#endif // C_LOCODSERVICE_H
--- a/localconnectivityservice/locod/inc/locodserviceman.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines the service manager class.
-*
-*/
-
-
-#ifndef T_LOCODSERVICEMAN_H
-#define T_LOCODSERVICEMAN_H
-
-#include <e32base.h>
-#include <cenrepnotifyhandler.h>
-#include <CoreApplicationUIsSDKCRKeys.h>
-#include <startupdomainpskeys.h>
-#include <locodbearerpluginobserver.h>
-#include <locodservicepluginobserver.h>
-
-class CLocodService;
-
-/**
- * The service plugin manager.
- *
- * It loads, unloads service plugins on demand and manages a service availability
- * according to bearer status.
- * @euser.lib
- * @since S60 v3.2
- */
-class CLocodServiceMan :
- public CActive,
- public MLocodBearerPluginObserver,
- public MLocodServicePluginObserver
- {
-public:
-
- /**
- * Factory method, leave the object in cleanupstack.
- *
- * @lib ?library
- * @since S60 v3.2
- */
- static CLocodServiceMan* NewL();
-
- ~CLocodServiceMan();
-
-public:
-
-private:
-
- // From CActive
-
- void RunL();
-
- void DoCancel();
-
- TInt RunError(TInt aReason);
-
-private:
-
- // From MLocodBearerPluginObserver
- /**
- * This is a callback function used by the plugins to inform when the
- * bearer's availability changes.
- *
- * @since S60 v3.2
- * @param aBearer the bearer which calls this nothification
- * @param aStatus the status of this bearer, ETrue if it is available;
- * EFalse otherwise.
- */
- void NotifyBearerStatus(TLocodBearer aBearer,
- TBool aStatus);
-
- // From MLocodServicePluginObserver
- /**
- * This is a callback function used by the plugins to inform when
- * managing the service have completed. The parameters passed should be
- * identical to the ones used when the plugin's ManageService() was called,
- * plus this service plugin's implemnetation UID and the completion status.
- *
- * @since S60 v3.2
- * @param aBearer the bearer identification passed in ManageService()
- * @param aStatus the status of this bearer passed in ManageService()
- * @param aServiceImplUid, the implementation UID of this service plugin.
- * @param err KErrNone if the operation succeeded; otherwise a Symbian
- * error code.
- */
- void ManageServiceCompleted(TLocodBearer aBearer,
- TBool aStatus,
- TUid aServiceImplUid,
- TInt err);
-
-private:
-
- CLocodServiceMan();
-
- void ConstructL();
-
- void LoadServicesL();
-
-private: // data
- RPointerArray<CLocodService> iServices;
- TInt iBearerStatus;
- TUid iUidDun; // DUN id
- };
-
-
-#endif // T_LOCODSERVICEMAN_H
--- a/localconnectivityservice/locod/inc/prjconfig.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Project configure file.
-*
-*/
-
-
-#ifndef LOCOD_PRJCONFIG_H
-#define LOCOD_PRJCONFIG_H
-
-/**
- * Traces are enabled in _DEBUG build, by default.
- */
-#ifdef _DEBUG
-#define PRJ_ENABLE_TRACE
-#endif
-
-/**
- * traces to file if this is defined.
- */
-//#define PRJ_FILE_TRACE
-
-
-/**
- * build the project for module test purpose if this is defined
- */
-//#define PRJ_MODULETEST_BUILD
-
-/**
- * build the project using stubs to replace the dependencies if this is defined
- */
-//#define PRJ_USE_STUB
-
-
-#endif // LOCOD_PRJCONFIG_H
--- a/localconnectivityservice/locod/inc/utils.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines utility functions.
-*
-*/
-
-
-#ifndef LOCODUTIL_H
-#define LOCODUTIL_H
-
-#include <e32base.h>
-
-template <class T>
-class CleanupResetDestroyClose
- {
-public:
- inline static void PushL(T& aRef)
- {
- CleanupStack::PushL(TCleanupItem(&ResetDestroyClose,&aRef));
- }
-private:
- static void ResetDestroyClose(TAny *aPtr)
- {
- static_cast<T*>(aPtr)->ResetAndDestroy();
- static_cast<T*>(aPtr)->Close();
- }
- };
-
-/**
- * Pushes an object into CleanupStack and specifies the cleanup
- * function as ResetAndDestroy() and Close().
-*/
-template <class T>
-inline void CleanupResetDestroyClosePushL(T& aRef)
- {CleanupResetDestroyClose<T>::PushL(aRef);}
-
-#endif // LOCODUTIL_H
--- a/localconnectivityservice/locod/rom/locod.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef LOCALCONNECTIVITYDAEMON_IBY
-#define LOCALCONNECTIVITYDAEMON_IBY
-
-file=ABI_DIR\BUILD_DIR\locod.exe PROGRAMS_DIR\locod.exe
-
-#endif
--- a/localconnectivityservice/locod/src/locodaemon.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Daemon class implementation.
-*
-*/
-
-
-#include <startupdomainpskeys.h>
-
-#include <featmgr.h>
-#include <locodplugin.hrh>
-#include <locodbearerplugin.h>
-
-#include "locodaemon.h"
-#include "locodserviceman.h"
-#include "utils.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CLocoDaemon* CLocoDaemon::NewLC()
- {
- CLocoDaemon* self = new (ELeave) CLocoDaemon();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// C++ destrctor
-// ---------------------------------------------------------------------------
-//
-CLocoDaemon::~CLocoDaemon()
- {
- FeatureManager::UnInitializeLib();
- Cancel();
- iSystemPS.Close();
- delete iServiceMan;
- iBearers.ResetAndDestroy();
- iBearers.Close();
- REComSession::FinalClose();
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// Called when the status of system pubsub keys are
-// changed. Normally this is called after the system boot.
-// ---------------------------------------------------------------------------
-//
-void CLocoDaemon::RunL()
- {
- TRACE_INFO((_L(" RunL %d"), iStatus.Int()))
- if (iStatus == KErrNone)
- {
- iSystemPS.Subscribe(iStatus);
- SetActive();
-
- TRACE_INFO((_L(" [SYSTEM] prev %d"), iSystemState))
- LEAVE_IF_ERROR(iSystemPS.Get(iSystemState));
- TRACE_INFO((_L(" [SYSTEM] now %d"), iSystemState))
-
- if (iSystemState == ESwStateNormalRfOn ||
- iSystemState == ESwStateNormalRfOff ||
- iSystemState == ESwStateCharging ||
- iSystemState == ESwStateNormalBTSap)
- { // System is up, construct service man and load bearers.
- if(!iServiceMan)
- {
- iServiceMan = CLocodServiceMan::NewL();
- }
- if (!iBearers.Count())
- {
- LoadBearesL();
- }
- }
- /*
- ESwStateShuttingDown and ESWStateShuttingDown event is received when
- the device is about to shut down
- */
- else if (iSystemState == ESwStateShuttingDown)
- {
- TRACE_INFO((_L(" [SYSTEM] Shuting down and deleting")))
- delete iServiceMan;
- iServiceMan = NULL;
- iBearers.ResetAndDestroy();
- return;
- }
- }
- RProcess::Rendezvous(KErrNone);
- }
-
-// ---------------------------------------------------------------------------
-// CActive method cancel listening pubsub keys
-// ---------------------------------------------------------------------------
-//
-void CLocoDaemon::DoCancel()
- {
- TRACE_FUNC
- iSystemPS.Cancel();
- }
-
-// ---------------------------------------------------------------------------
-// CActive method
-// ---------------------------------------------------------------------------
-//
-TInt CLocoDaemon::RunError(TInt /*aReason*/)
- {
- TRACE_FUNC
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// C++ Constructor
-// ---------------------------------------------------------------------------
-//
-CLocoDaemon::CLocoDaemon() : CActive(CActive::EPriorityStandard)
- {
- CActiveScheduler::Add(this);
- TRACE_FUNC_THIS
- }
-
-// ---------------------------------------------------------------------------
-// 2nd phase construction
-// ---------------------------------------------------------------------------
-//
-void CLocoDaemon::ConstructL()
- {
- FeatureManager::InitializeLibL();
- LEAVE_IF_ERROR(iSystemPS.Attach(KPSUidStartup, KPSGlobalSystemState));
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus* sta = &iStatus;
- User::RequestComplete(sta, KErrNone);
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// LoadBearesL Loads the bearer plug ins
-// ---------------------------------------------------------------------------
-//
-void CLocoDaemon::LoadBearesL()
- {
- TRACE_FUNC_ENTRY
- TRACE_INFO((_L("Load interface 0x%08X"), KLOCODBEARERINTERFACEUID))
- const TUid KBearerPluginInterface = TUid::Uid(KLOCODBEARERINTERFACEUID);
- RImplInfoPtrArray implementations;
- const TEComResolverParams noResolverParams;
- REComSession::ListImplementationsL(KBearerPluginInterface,
- noResolverParams,
- KRomOnlyResolverUid,
- implementations);
- CleanupResetDestroyClosePushL(implementations);
- const TUint count = implementations.Count();
- TRACE_INFO((_L(" Bearer count = %d"), count))
- for ( TUint ii = 0 ; ii < count ; ++ii )
- {
- CImplementationInformation* impl = implementations[ii];
- TRACE_INFO((_L("Bearer: feature %d, name '%S', ROM only %d"),
- impl->ImplementationUid().iUid, &(impl->DisplayName()), impl->RomOnly()))
- if (FeatureManager::FeatureSupported(impl->ImplementationUid().iUid))
- {
- TRACE_INFO((_L("Feature found")))
- TLocodBearerPluginParams params(impl->ImplementationUid(), *iServiceMan);
- CLocodBearerPlugin* bearer = CLocodBearerPlugin::NewL(params);
- CleanupStack::PushL(bearer);
- iBearers.AppendL(bearer);
- CleanupStack::Pop(bearer);
- }
- }
- CleanupStack::PopAndDestroy(&implementations);
- TRACE_FUNC_EXIT
- }
-
--- a/localconnectivityservice/locod/src/locodmain.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Global functions for Local Connectivity Daemon.
-*
-*/
-
-
-#include "locodaemon.h"
-#include "debug.h"
-
-_LIT( KLocodName, "LocalConnectivityDaemon" );
-
-static void StartDaemonL();
-
-// ======== LOCAL FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// E32Main.
-// Entry-point for LCD.
-// ---------------------------------------------------------------------------
-//
-TInt E32Main()
- {
- TInt ret;
- User::RenameThread( KLocodName );
-
- __UHEAP_MARK;
-
- // create clean-up stack
- CTrapCleanup* cleanup = CTrapCleanup::New();
- TRAP( ret, StartDaemonL() );
- delete cleanup; // destroy clean-up stack
- __UHEAP_MARKEND;
-
- return ret;
- }
-
-// ----------------------------------------------------------------------------
-// StartDaemonL().
-// Constructs and installs the active scheduler, constructs Daemon object.
-// ----------------------------------------------------------------------------
-//
-static void StartDaemonL()
- {
- TRACE_FUNC
-
- // Construct and install the active scheduler
- CActiveScheduler *myScheduler = new ( ELeave ) CActiveScheduler();
-
- // Push onto the cleanup stack
- CleanupStack::PushL( myScheduler );
-
- // Install as the active scheduler
- CActiveScheduler::Install( myScheduler );
-
- CLocoDaemon* daemon = NULL;
- daemon = CLocoDaemon::NewLC();
- CActiveScheduler::Start();
-
- CleanupStack::PopAndDestroy( daemon );
- CleanupStack::PopAndDestroy( myScheduler );
- }
-
--- a/localconnectivityservice/locod/src/locodservice.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The implementation of LCD service
-*
-*/
-
-
-#include <locodserviceplugin.h>
-
-#include "locodservice.h"
-#include "debug.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Creates a service object based on the service plug in objects
-// ---------------------------------------------------------------------------
-//
-CLocodService* CLocodService::NewL(CLocodServicePlugin& aPlugin)
- {
- CLocodService* self = new (ELeave) CLocodService(aPlugin);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// C++ destructor
-// ---------------------------------------------------------------------------
-//
-CLocodService::~CLocodService()
- {
- delete iPlugin;
- iRequests.Close();
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// return the plugin instance
-// ---------------------------------------------------------------------------
-//
-CLocodServicePlugin& CLocodService::Plugin()
- {
- return *iPlugin;
- }
-
-
-// ---------------------------------------------------------------------------
-// A request is sent to service plug in to manage their services
-// ---------------------------------------------------------------------------
-//
-TInt CLocodService::ManageService(TLocodBearer aBearer, TBool aStatus)
- {
- TRACE_INFO((_L("[Srvc %d] [SrvcState 0x%04x]"), iPlugin->ImplementationUid().iUid, iServiceStatus))
-
- // if there is an outstanding request which has the same bearer,
- // remove all later enqueued request, and
- // enqueue this request if the bearer status is different from the ongoing one.
- TInt count = iRequests.Count();
- for (TInt i = 0; i < count; i++)
- {
- if (iRequests[i].iBearer == aBearer && iRequests[i].iRequesting)
- {
- for (TInt j = count - 1; j > i; j--)
- {
- if (iRequests[j].iBearer == aBearer)
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc] Remove buffered request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, iRequests[j].iStatus))
- iRequests.Remove(j);
- }
- }
- if ((!iRequests[i].iStatus && aStatus) || (iRequests[i].iStatus && !aStatus))
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc] Buffer request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, aStatus))
- return iRequests.Append(TLocodServiceRequest(aBearer, aStatus));
- }
- else
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc] Request(Bearer 0x%04x status %d) discarded"),
- iPlugin->ImplementationUid().iUid, aBearer, aStatus))
- return KErrNone;
- }
- }
- }
-
- // else if the latest bearer status in this service plugin is different,
- // Start ManageService()
- if ( aStatus && !(iServiceStatus & aBearer) ||
- !aStatus && (iServiceStatus & aBearer))
- {
- TLocodServiceRequest request(aBearer, aStatus);
- request.iRequesting = ETrue;
- TInt err = iRequests.Append(request);
- TRACE_INFO((_L("[Srvc %d] [ManSrvc] Issue request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, aStatus))
- if (!err)
- {
- iPlugin->ManageService(aBearer, aStatus);
- }
- return err;
- }
-
- // else the latest bearer status in this service plugin is the same,
- // do nothing
- TRACE_INFO((_L("[Srvc %d] [ManSrvc] Request(Bearer 0x%04x status %d) discarded"),
- iPlugin->ImplementationUid().iUid, aBearer, aStatus))
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Based on the status of bearer either the request is removed or a new manage
-// service is issued
-// ---------------------------------------------------------------------------
-//
-void CLocodService::ManageServiceCompleted(TLocodBearer aBearer,
- TBool aStatus, TInt err)
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc complete] (Bearer 0x%04x status %d) return %d"),
- iPlugin->ImplementationUid().iUid, aBearer, aStatus, err))
- // Save the latest status of this bearer
- if (!err)
- {
- if (aStatus)
- {
- iServiceStatus |= aBearer;
- }
- else
- {
- iServiceStatus &= (~aBearer);
- }
- TRACE_INFO((_L("[Srvc %d] [SrvcState 0x%04x]"), iPlugin->ImplementationUid().iUid, iServiceStatus))
- }
-
- // Find the completed request and remove it from the request list.
- TInt count = iRequests.Count();
- for (TInt i = 0; i < count; i++)
- {
- if (iRequests[i].iBearer == aBearer && iRequests[i].iRequesting)
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc completed] Remove completed request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, iRequests[i].iStatus))
- iRequests.Remove(i);
- break;
- }
- }
-
- // Find the next request and start ManageService if the status is changed.
- count = iRequests.Count();
- for (TInt i = 0; i < count; i++)
- {
- if (iRequests[i].iBearer == aBearer)
- {
- if ( (iRequests[i].iStatus && !(iServiceStatus & aBearer)) ||
- (!iRequests[i].iStatus && (iServiceStatus & aBearer)))
- {
- iRequests[i].iRequesting = ETrue;
- TRACE_INFO((_L("[Srvc %d] [ManSrvc completed] Issue buffered request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, iRequests[i].iStatus))
- iPlugin->ManageService(iRequests[i].iBearer, iRequests[i].iStatus);
- }
- else
- {
- TRACE_INFO((_L("[Srvc %d] [ManSrvc completed] Remove buffered request(Bearer 0x%04x status %d)"),
- iPlugin->ImplementationUid().iUid, aBearer, iRequests[i].iStatus))
- iRequests.Remove(i);
- }
- break;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// return if there are request pending
-// ---------------------------------------------------------------------------
-//
-TBool CLocodService::HasServiceToManage() const
- {
- return iRequests.Count();
- }
-
-// ---------------------------------------------------------------------------
-// C++ default constructor
-// ---------------------------------------------------------------------------
-//
-CLocodService::CLocodService(CLocodServicePlugin& aPlugin) : iPlugin(&aPlugin)
- {
- TRACE_FUNC_THIS
- }
-
-// ---------------------------------------------------------------------------
-// C++ 2nd phase construction
-// ---------------------------------------------------------------------------
-//
-void CLocodService::ConstructL()
- {
- }
-
-// ---------------------------------------------------------------------------
-// C++ default constructor
-// ---------------------------------------------------------------------------
-//
-TLocodServiceRequest::TLocodServiceRequest(TLocodBearer aBearer, TBool aStatus)
-: iBearer(aBearer), iStatus(aStatus), iRequesting(EFalse)
- {
- }
-
--- a/localconnectivityservice/locod/src/locodserviceman.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Daemon class implementation.
-*
-*/
-
-
-#include <featmgr.h>
-#include <locodplugin.hrh>
-#include <locodserviceplugin.h>
-
-#include "locodserviceman.h"
-#include "locodservice.h"
-#include "debug.h"
-#include "utils.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CLocodServiceMan* CLocodServiceMan::NewL()
- {
- CLocodServiceMan* self = new (ELeave) CLocodServiceMan();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// C++ destructor
-// ---------------------------------------------------------------------------
-//
-CLocodServiceMan::~CLocodServiceMan()
- {
- Cancel();
- iServices.ResetAndDestroy();
- iServices.Close();
-
- TRACE_FUNC
- }
-
-// ---------------------------------------------------------------------------
-// CActive method, the request is only completed when there is no service
-// to manage, so all the service plugins are destroyed
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::RunL()
- {
- TRACE_FUNC_ENTRY
- if(iStatus ==KErrNone)
- {
- iServices.ResetAndDestroy();
- }
- TRACE_FUNC_EXIT
- }
-
-// ---------------------------------------------------------------------------
-// CActive method
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::DoCancel()
- {
-
- }
-
-// ---------------------------------------------------------------------------
-// CActive method
-// ---------------------------------------------------------------------------
-//
-TInt CLocodServiceMan::RunError(TInt/* aReason */)
- {
- return KErrNone;
- }
-
-
-// ---------------------------------------------------------------------------
-// NotifyBearerStatus
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::NotifyBearerStatus(TLocodBearer aBearer, TBool aStatus)
- {
- TRACE_INFO((_L(" [BRRST] status of 0x%04x changes to %d"), aBearer, aStatus))
- TInt oldStatus = iBearerStatus;
- if (aStatus)
- {
- iBearerStatus |= aBearer;
- }
- else
- {
- iBearerStatus &= (~aBearer);
- }
- TRACE_INFO((_L(" [BRRST] [OLD] 0x%08x [NEW] 0x%08x"), oldStatus, iBearerStatus))
- if (iBearerStatus && !iServices.Count())
- {
- TRAP_IGNORE(LoadServicesL());
- }
- TInt count = iServices.Count();
- for (TInt i = 0; i < count; i++)
- {
- if(iBearerStatus != oldStatus)
- {
- iServices[i]->ManageService(aBearer, aStatus);
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Call back method from service plugins. This is called when the services has been
-// managed by the plug ins.
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::ManageServiceCompleted(TLocodBearer aBearer,
- TBool aStatus, TUid aServiceImplUid, TInt err)
- {
- TInt count = iServices.Count();
- for (TInt i = 0; i < count; i++)
- {
- if (iServices[i]->Plugin().ImplementationUid() == aServiceImplUid)
- {
- iServices[i]->ManageServiceCompleted(aBearer, aStatus, err);
- break;
- }
- }
-
- if (!iBearerStatus)
- {
- for (TInt i = 0; i < count; i++)
- {
- if (iServices[i]->HasServiceToManage())
- {
- return;
- }
- }
-
- if(!IsActive())
- {
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus* status = &iStatus;
- User::RequestComplete(status, KErrNone);
- }
-
- }
- }
-
-// ---------------------------------------------------------------------------
-// c++ constructor
-// ---------------------------------------------------------------------------
-//
-CLocodServiceMan::CLocodServiceMan() : CActive(CActive::EPriorityStandard),iUidDun(TUid::Uid(KFeatureIdDialupNetworking))
- {
- CActiveScheduler::Add(this);
- TRACE_FUNC_THIS
- }
-
-// ---------------------------------------------------------------------------
-// 2nd phase construction
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::ConstructL()
- {
-
- }
-
-// ---------------------------------------------------------------------------
-// Loaded all service plug ins who has implemented the KLOCODSERVICEINTERFACEUID
-// ---------------------------------------------------------------------------
-//
-void CLocodServiceMan::LoadServicesL()
- {
- TRACE_FUNC_ENTRY
- TRACE_INFO((_L("Load interface 0x%08X"), KLOCODSERVICEINTERFACEUID))
- const TUid KServicePluginInterface = TUid::Uid(KLOCODSERVICEINTERFACEUID);
- RImplInfoPtrArray implementations;
- const TEComResolverParams noResolverParams;
- REComSession::ListImplementationsL(KServicePluginInterface,
- noResolverParams,
- KRomOnlyResolverUid,
- implementations);
- CleanupResetDestroyClosePushL(implementations);
- const TUint count = implementations.Count();
- TRACE_INFO((_L(" [BRRST] Service Plug in found %d"), count))
- for ( TUint ii = 0 ; ii < count ; ++ii )
- {
- CImplementationInformation* impl = implementations[ii];
- TRACE_INFO((_L("Service: feature %d, name '%S', ROM only %d"),
- impl->ImplementationUid().iUid, &(impl->DisplayName()), impl->RomOnly()))
- if (FeatureManager::FeatureSupported(impl->ImplementationUid().iUid))
- {
- TRACE_INFO((_L("Feature found")))
- TLocodServicePluginParams params(impl->ImplementationUid(), *this);
- CLocodServicePlugin* srvcplugin = CLocodServicePlugin::NewL(params);
- CleanupStack::PushL(srvcplugin);
- CLocodService* service = CLocodService::NewL(*srvcplugin);
- CleanupStack::Pop(srvcplugin);
- CleanupStack::PushL(service);
- iServices.AppendL(service);
- CleanupStack::Pop(service);
- }
- }
- CleanupStack::PopAndDestroy(&implementations);
- TRACE_FUNC_EXIT
- }
-
-
-
--- a/localconnectivityservice/locod/src/utils.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: utility function implementation.
-*
-*/
-
-
-#include "utils.h"
-#include "debug.h"
-
-
--- a/mtpdataproviders/mtpfileandfolderdp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpfileandfolderdp/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -24,7 +24,7 @@
PRJ_PLATFORMS
PRJ_EXPORTS
-mtp_filedp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_filedp.iby)
+mtp_filedp.iby /epoc32/rom/include/mtp_filedp.iby
../inc/mtpfiledp_config.rh SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(mtp/mtpfiledp_config.rh)
PRJ_MMPFILES
--- a/mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.iby Wed Sep 01 12:20:56 2010 +0100
@@ -16,7 +16,7 @@
#ifndef MTP_FILEDP_IBY
#define MTP_FILEDP_IBY
-#if defined(__MTP_PROTOCOL_SUPPORT)
+#if !defined(SYMBIAN_EXCLUDE_MTP)
#include <mtp_framework.iby>
@@ -26,7 +26,7 @@
// MTP plugin registration resource file
data=EPOCROOT##epoc32\data\Z\resource\mtp\102827B0.rsc resource\mtp\102827B0.rsc
-#endif // __MTP_PROTOCOL_SUPPORT
+#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_FILEDP_IBY
--- a/mtpdataproviders/mtpimagedp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -31,8 +31,10 @@
PRJ_EXPORTS
// Note: these files are exported for testing and techview only. Not used in a device
2001fca2.txt /epoc32/data/z/private/10202be9/2001fca2.txt
+2001fca2.txt /epoc32/release/winscw/udeb/z/private/10202be9/2001fca2.txt
+2001fca2.txt /epoc32/release/winscw/urel/z/private/10202be9/2001fca2.txt
-../group/mtp_imagedp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_imagedp.iby)
+../group/mtp_imagedp.iby /epoc32/rom/include/mtp_imagedp.iby
// ConfML files
../conf/mtp_imagedp.confml MW_LAYER_EXPORTS_CONFML(mtp_imagedp.confml)
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Wed Sep 01 12:20:56 2010 +0100
@@ -58,7 +58,7 @@
public:
CMTPImageDpObjectPropertyMgr& PropertyMgr()const;
- CMTPImageDpThumbnailCreator* ThumbnailManager();
+ CMTPImageDpThumbnailCreator& ThumbnailManager() const;
CRepository& Repository() const;
TMTPFormatCode FindFormat(const TDesC& aExtension);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -96,6 +96,8 @@
{
__FLOG_OPEN(KMTPSubsystem, KComponent);
__FLOG(_L8(">> CMTPImageDataProvider::ConstructL"));
+
+ iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this);
iNewPicNotifier = CMTPImageDpNewPicturesNotifier::NewL();
//Setup central repository connection
@@ -452,14 +454,11 @@
__FLOG(_L8("<< NotifyStorageEnumerationCompleteL"));
}
-CMTPImageDpThumbnailCreator* CMTPImageDataProvider::ThumbnailManager()
- {
- if(NULL == iThumbnailManager)
- {
- TRAP_IGNORE(iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this));
- }
- return iThumbnailManager;
- }
+CMTPImageDpThumbnailCreator& CMTPImageDataProvider::ThumbnailManager() const
+ {
+ __ASSERT_DEBUG(iThumbnailManager, User::Invariant());
+ return *iThumbnailManager;
+ }
CMTPImageDpObjectPropertyMgr& CMTPImageDataProvider::PropertyMgr()const
{
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -45,7 +45,7 @@
const TMTPRequestElementInfo KMTPCopyObjectPolicy[] =
{
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
};
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -111,26 +111,21 @@
TEntry fileEntry;
User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry));
-
- CMTPImageDpThumbnailCreator* tnc = imgDp.ThumbnailManager();
- if(tnc != NULL)
+ imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+ if(fileEntry.FileSize() > KFileSizeMax)
{
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
- if(fileEntry.FileSize() > KFileSizeMax)
- {
- __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
- }
-
- tnc->GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
- imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
+ __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
+ imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
}
- //Transfer ownership of thumbnailData to Property Manager
+
+ imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
+ User::LeaveIfError(err);
+ User::LeaveIfNull(thumbnailData);
+
+ //Transfer ownership of thumbnailData to Property Manager
+ imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
}
- if(thumbnailData != NULL)
- {
- iThumb->Write(*thumbnailData);
- }
+ iThumb->Write(*thumbnailData);
SendDataL(*iThumb);
__FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL"));
}
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -454,23 +454,21 @@
*/
TEntry fileEntry;
TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
- CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
- if (err == KErrNone && tnc != NULL)
+ if (err == KErrNone)
{
-
if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
{
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+ iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
}
else
{
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+ iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
}
/**
* trap the leave to avoid return general error when PC get object property list
*/
- TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
+ TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
if (err == KErrNone)
{
iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);
@@ -486,10 +484,6 @@
}
}
}
- else
- {
- aValue = KThumbCompressedSize;
- }
}
break;
@@ -605,23 +599,22 @@
*/
TEntry fileEntry;
TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
- CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
- if (err == KErrNone && tnc != NULL)
+ if (err == KErrNone)
{
if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
{
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+ iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
}
else
{
- tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+ iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
}
/**
* trap the leave to avoid return general error when PC get object property list
*/
- TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
+ TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
if (err == KErrNone)
{
iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -752,9 +752,6 @@
{
__FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry"));
TBool result(ETrue);
-
- delete iFileReceived;
- iFileReceived = NULL;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
TInt64 objectsize = 0;
@@ -762,10 +759,8 @@
TInt objectsize = 0;
#endif
- TEntry entry;
- User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry));
- objectsize = entry.FileSize();
-
+ iFileReceived->File().Size(objectsize);
+
if (objectsize != iObjectSize)
{
__FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize));
@@ -794,31 +789,34 @@
if (iProtectionStatus == EMTPProtectionNoProtection ||
iProtectionStatus == EMTPProtectionReadOnly)
{
- entry.iAtt &= ~(KEntryAttNormal | KEntryAttReadOnly);
+ TUint attValue = 0;
+ User::LeaveIfError(iFileReceived->File().Att(attValue));
+ attValue &= ~(KEntryAttNormal | KEntryAttReadOnly);
+
if (iProtectionStatus == EMTPProtectionNoProtection)
{
- entry.iAtt |= KEntryAttNormal;
+ attValue |= KEntryAttNormal;
}
else
{
- entry.iAtt |= KEntryAttReadOnly;
+ attValue |= KEntryAttReadOnly;
}
- User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
+ User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue));
}
-
TTime modifiedTime;
//update datemodified property.
if(iDateMod != NULL && iDateMod->Length())
{
iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime);
+ User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
}
else if(iDateCreated != NULL && iDateCreated->Length())
{
iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime);
+ User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
}
- User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
-
- iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
+
+ iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
//The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList
//to be followed by a SendObject. An object is reserved in the ObjectStore on
@@ -829,8 +827,10 @@
CleanUndoList();
SendResponseL(EMTPRespCodeOK);
- }
+ }
+ delete iFileReceived;
+ iFileReceived = NULL;
iSuccessful = result;
__FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit"));
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -68,7 +68,7 @@
delete iBitmap;
delete iObjectSource;
delete iThumbMgr;
- if(iActiveSchedulerWait != NULL && iActiveSchedulerWait->IsStarted())
+ if(iActiveSchedulerWait->IsStarted())
{
*iCreationErr = KErrNotReady;
iActiveSchedulerWait->AsyncStop();
--- a/mtpdataproviders/mtppictbridgedp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtppictbridgedp/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -24,8 +24,9 @@
PRJ_EXPORTS
-../inc/rptp.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(rptp.h)
-./mtppictbridgedp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtppictbridgedp.iby)
-./rptp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(rptp.iby)
+../inc/rptp.h SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(rptp.h)
+./mtppictbridgedp.iby /epoc32/rom/include/mtppictbridgedp.iby
+./rptp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(rptp.iby)
+
#endif
--- a/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Wed Sep 01 12:20:56 2010 +0100
@@ -24,7 +24,7 @@
#include <e32base.h>
-#include <platform/mw/usbwatcherinternalpskeys.h>
+#include <platform/mw/UsbWatcherInternalPSKeys.h>
#include <platform/mw/usbpersonalityids.h>
#include <pathinfo.h>
#include <featmgr/featmgr.h>
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/BWINS/pictbridgeU.DEF Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-EXPORTS
- ?CancelDpsEventNotify@CDpsEngine@@QAEXXZ @ 1 NONAME ; void CDpsEngine::CancelDpsEventNotify(void)
- ?CancelDpsRequest@CDpsEngine@@QAEXXZ @ 2 NONAME ; void CDpsEngine::CancelDpsRequest(void)
- ?CancelPrintMode@CDpsEngine@@QAEXXZ @ 3 NONAME ; void CDpsEngine::CancelPrintMode(void)
- ?ConnectStateNotify@CDpsEngine@@QAEXAAVTRequestStatus@@@Z @ 4 NONAME ; void CDpsEngine::ConnectStateNotify(class TRequestStatus &)
- ?CreateReqScriptL@TDpsGetCapability@@EAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 5 NONAME ; void TDpsGetCapability::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
- ?CreateReqScriptL@TDpsStartJob@@EAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 6 NONAME ; void TDpsStartJob::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
- ?CreateReqScriptL@TMDpsOperation@@MAEXABV?$RArray@UTDpsArg@@@@ABV?$RArray@UTDpsEle@@@@IAAVRWriteStream@@PAVCDpsTransaction@@@Z @ 7 NONAME ; void TMDpsOperation::CreateReqScriptL(class RArray<struct TDpsArg> const &, class RArray<struct TDpsEle> const &, unsigned int, class RWriteStream &, class CDpsTransaction *)
- ?Delete@CDpsEngine@@QAEXXZ @ 8 NONAME ; void CDpsEngine::Delete(void)
- ?DoDpsRequestL@CDpsEngine@@QAEXPAVTMDpsOperation@@AAVTRequestStatus@@@Z @ 9 NONAME ; void CDpsEngine::DoDpsRequestL(class TMDpsOperation *, class TRequestStatus &)
- ?DpsEventNotify@CDpsEngine@@QAEXAAVTDpsEvents@@AAVTRequestStatus@@@Z @ 10 NONAME ; void CDpsEngine::DpsEventNotify(class TDpsEvents &, class TRequestStatus &)
- ?DpsFolder@CDpsEngine@@QBEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CDpsEngine::DpsFolder(void) const
- ?FillRepArgs@TDpsConfigPrintService@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 12 NONAME ; int TDpsConfigPrintService::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
- ?FillRepArgs@TDpsGetCapability@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 13 NONAME ; int TDpsGetCapability::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
- ?FillRepArgs@TDpsGetJobStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 14 NONAME ; int TDpsGetJobStatus::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
- ?FillRepArgs@TDpsGetPrinterStatus@@EAEHABV?$RArray@UTDpsArg@@@@PAVCDpsTransaction@@@Z @ 15 NONAME ; int TDpsGetPrinterStatus::FillRepArgs(class RArray<struct TDpsArg> const &, class CDpsTransaction *)
- ?FillReqArgs@TDpsAbortJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 16 NONAME ; int TDpsAbortJob::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
- ?FillReqArgs@TDpsConfigPrintService@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 17 NONAME ; int TDpsConfigPrintService::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
- ?FillReqArgs@TDpsGetCapability@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 18 NONAME ; int TDpsGetCapability::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
- ?FillReqArgs@TDpsStartJob@@EAEHAAV?$RArray@UTDpsArg@@@@AAV?$RArray@UTDpsEle@@@@AAIPAVCDpsTransaction@@@Z @ 19 NONAME ; int TDpsStartJob::FillReqArgs(class RArray<struct TDpsArg> &, class RArray<struct TDpsEle> &, unsigned int &, class CDpsTransaction *)
- ?GetDpsConfigL@CDpsEngine@@QAEXAAVTDpsConfigPrintReq@@@Z @ 20 NONAME ; void CDpsEngine::GetDpsConfigL(class TDpsConfigPrintReq &)
- ?GetEngineL@CDpsEngine@@SAPAV1@XZ @ 21 NONAME ; class CDpsEngine * CDpsEngine::GetEngineL(void)
- ?GetParamNum@TDpsStartJobReq@@QAEHXZ @ 22 NONAME ; int TDpsStartJobReq::GetParamNum(void)
- ?Reset@TDpsJobStatusRep@@QAEXXZ @ 23 NONAME ; void TDpsJobStatusRep::Reset(void)
- ?Reset@TDpsPrintInfo@@QAEXXZ @ 24 NONAME ; void TDpsPrintInfo::Reset(void)
- ?SetPrintMode@CDpsEngine@@QAEXAAVTRequestStatus@@@Z @ 25 NONAME ; void CDpsEngine::SetPrintMode(class TRequestStatus &)
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/eabi/pictbridgeU.DEF Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-EXPORTS
- _ZN10CDpsEngine10GetEngineLEv @ 1 NONAME
- _ZN10CDpsEngine12SetPrintModeER14TRequestStatus @ 2 NONAME
- _ZN10CDpsEngine13DoDpsRequestLEP14TMDpsOperationR14TRequestStatus @ 3 NONAME
- _ZN10CDpsEngine13GetDpsConfigLER18TDpsConfigPrintReq @ 4 NONAME
- _ZN10CDpsEngine14DpsEventNotifyER10TDpsEventsR14TRequestStatus @ 5 NONAME
- _ZN10CDpsEngine15CancelPrintModeEv @ 6 NONAME
- _ZN10CDpsEngine16CancelDpsRequestEv @ 7 NONAME
- _ZN10CDpsEngine18ConnectStateNotifyER14TRequestStatus @ 8 NONAME
- _ZN10CDpsEngine20CancelDpsEventNotifyEv @ 9 NONAME
- _ZN10CDpsEngine6DeleteEv @ 10 NONAME
- _ZN12TDpsAbortJob11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 11 NONAME
- _ZN12TDpsStartJob11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 12 NONAME
- _ZN12TDpsStartJob16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 13 NONAME
- _ZN13TDpsPrintInfo5ResetEv @ 14 NONAME
- _ZN14TMDpsOperation16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 15 NONAME
- _ZN15TDpsStartJobReq11GetParamNumEv @ 16 NONAME
- _ZN16TDpsGetJobStatus11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 17 NONAME
- _ZN16TDpsJobStatusRep5ResetEv @ 18 NONAME
- _ZN17TDpsGetCapability11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 19 NONAME
- _ZN17TDpsGetCapability11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 20 NONAME
- _ZN17TDpsGetCapability16CreateReqScriptLERK6RArrayI7TDpsArgERKS0_I7TDpsEleEjR12RWriteStreamP15CDpsTransaction @ 21 NONAME
- _ZN20TDpsGetPrinterStatus11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 22 NONAME
- _ZN22TDpsConfigPrintService11FillRepArgsERK6RArrayI7TDpsArgEP15CDpsTransaction @ 23 NONAME
- _ZN22TDpsConfigPrintService11FillReqArgsER6RArrayI7TDpsArgERS0_I7TDpsEleERjP15CDpsTransaction @ 24 NONAME
- _ZNK10CDpsEngine9DpsFolderEv @ 25 NONAME
- _ZTI12TDpsAbortJob @ 26 NONAME ; #<TI>#
- _ZTI12TDpsStartJob @ 27 NONAME ; #<TI>#
- _ZTI14TMDpsOperation @ 28 NONAME ; #<TI>#
- _ZTI16TDpsGetJobStatus @ 29 NONAME ; #<TI>#
- _ZTI17TDpsGetCapability @ 30 NONAME ; #<TI>#
- _ZTI20TDpsGetPrinterStatus @ 31 NONAME ; #<TI>#
- _ZTI22TDpsConfigPrintService @ 32 NONAME ; #<TI>#
- _ZTV12TDpsAbortJob @ 33 NONAME ; #<VT>#
- _ZTV12TDpsStartJob @ 34 NONAME ; #<VT>#
- _ZTV14TMDpsOperation @ 35 NONAME ; #<VT>#
- _ZTV16TDpsGetJobStatus @ 36 NONAME ; #<VT>#
- _ZTV17TDpsGetCapability @ 37 NONAME ; #<VT>#
- _ZTV20TDpsGetPrinterStatus @ 38 NONAME ; #<VT>#
- _ZTV22TDpsConfigPrintService @ 39 NONAME ; #<VT>#
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
-* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the build info file for PictBridge engine.
-*
-*/
-
-
-#include <platform_paths.hrh>
-PRJ_MMPFILES
-pictbridge.mmp
-
-PRJ_EXPORTS
-../rom/pictbridge.iby CORE_MW_LAYER_IBY_EXPORT_PATH(pictbridge.iby)
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/pictbridge.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the project file for PictBridge engine
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET pictbridge.dll
-TARGETTYPE dll
-UID 0x1000008d 0x10274798
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-USERINCLUDE ../inc
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/xml
-
-SOURCEPATH ../src
-SOURCE pictbridge.cpp
-SOURCE dpsxmlstring.cpp
-SOURCE dpsxmlparser.cpp
-SOURCE dpsxmlgenerator.cpp
-SOURCE dpsstatemachine.cpp
-SOURCE dpsoperation.cpp
-SOURCE dpsparam.cpp
-SOURCE dpstransaction.cpp
-SOURCE dpsstate.cpp
-SOURCE dpsfile.cpp
-SOURCE dpsusbnotifier.cpp
-SOURCE dpsscriptsender.cpp
-SOURCE dpsscriptreceiver.cpp
-SOURCE dpsptpnotifier.cpp
-SOURCE dpsconnectnotifier.cpp
-
-START RESOURCE dps.rss
-TARGETPATH resource
-HEADER
-END
-
-LIBRARY euser.lib xmlframework.lib efsrv.lib bafl.lib platformenv.lib
-LIBRARY rptp.lib usbman.lib usbwatcher.lib centralrepository.lib estor.lib
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/pictbridgeengine.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component pictbridgeengine
-
-source \sf\mw\remoteconn\localconnectivityservice\pictbridgeengine
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dps.rh Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The resource header file for Dps configuration.
-*
-*/
-
-
-STRUCT dps_configuration
- {
- BYTE numOfVersions = 1;
- BYTE versionMajor = 1;
- BYTE versionMinor = 0;
- LTEXT vendorName = "Nokia";
- BYTE vendorSpecificVersionMajor = 1;
- BYTE vendorSpecificVersionMinor = 0;
- LTEXT productName = "S60";
- LTEXT serialNo = "0123456";
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsconnectnotifier.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines functions of the notification of the
-* PTP printer connction and disconnection.
-*
-*/
-
-
-#ifndef DPSCONNECTNOTIFIER_H
-#define DPSCONNECTNOTIFIER_H
-
-#include <e32base.h>
-#include <usbstates.h>
-
-class CDpsUsbNotifier;
-
-/**
-* Class for monitoring usb cable connection/disconnection
-*/
-NONSHARABLE_CLASS(CDpsConnectNotifier) : public CActive
- {
- public:
- /**
- * Two phase constructor
- * @param aParent the pointer to UsbNotifier object
- * @return a new created ConnectNotifier object
- */
- static CDpsConnectNotifier* NewL(CDpsUsbNotifier* aParent);
-
- /**
- * Destructor
- */
- ~CDpsConnectNotifier();
-
- /**
- * Called by UsbNotifier to subscribe connection notification
- */
- void ConnectNotify();
-
- private: // Functions derived from CActive.
- /**
- * @see CActive
- */
- void RunL();
-
- /**
- * @see CActive
- */
- void DoCancel();
-
- /**
- * @see CActive
- */
- TInt RunError(TInt aError);
-
- private:
- /**
- * Second phase constructor
- */
- void ConstructL();
-
- /**
- * Default constructor
- */
- CDpsConnectNotifier(CDpsUsbNotifier* aParent);
-
- private:
- // not owned by this class
- CDpsUsbNotifier* iNotifier;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsconst.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps constance.
-*
-*/
-
-
-
-#ifndef DPSCONST_H
-#define DPSCONST_H
-#include <e32base.h>
-#include <usbpersonalityids.h>
-
-_LIT(KDpsEnginePanicCat, "Dps Engine");
-const TInt KShiftLength = 16;
-const TInt KFullWordWidth = 8;
-
-// <dps><input|output><operation|event|result></result|/event|/operation>
-// </output|/input></dps>
-enum TDpsXmlAction
- {
- EDpsXmlEmpty = 0,
- EDpsXmlStart,
- EDpsXmlInput,
- EDpsXmlOutput,
- EDpsXmlOperation,
- EDpsXmlEvent,
- EDpsXmlResult
- };
-
-enum TDpsOperation
- {
- EDpsOpEmpty = 0,
- EDpsOpConfigPrintService,
- EDpsOpGetCapability,
- EDpsOpGetJobStatus,
- EDpsOpGetDeviceStatus,
- EDpsOpStartJob,
- EDpsOpAbortJob,
- EDpsOpContinueJob,
- EDpsOpGetFileID,
- EDpsOpGetFileInfo,
- EDpsOpGetFile,
- EDpsOpGetPartialFile,
- EDpsOpGetFileList,
- EDpsOpGetThumb,
- EDpsOpMax
- };
-
-_LIT8(KDpsXmlResult, "result");
-_LIT8(KDpsXmlInput, "input");
-_LIT8(KDpsXmlOutput, "output");
-_LIT8(KDpsXmlPaperTypes, "paperTypes");
-_LIT8(KDpsXmlLayouts, "layouts");
-_LIT8(KDpsXmlPaperSize, "paperSize");
-_LIT8(KDpsXml, "dps");
-
-_LIT8(KDpsXmlHeader, "<?xml version=\"1.0\"?>");
-_LIT8(KDpsXmlNS, "<dps xmlns=\"http://www.cipa.jp/dps/schema/\">");
-_LIT8(KDpsXmlBraceOpen, "<");
-_LIT8(KDpsXmlBraceClose, ">");
-_LIT8(KDpsXmlSlash, "/");
-_LIT8(KDpsXmlSpace, " ");
-_LIT8(KDpsXmlEqual, "=");
-_LIT8(KDpsXmlQuote, "\"");
-
-const TUint KSlash = 0x2F;
-const TUint KBackSlash = 0x5C;
-const TUint KSOH = 0x1;
-const TUint KSpace = 0x20;
-
-const TUint32 KDpsMajorMask = 0xffff0000;
-const TUint32 KDpsMinorMask = 0x0000ffff;
-
-
-_LIT8(KDpsLowZero, "0000");
-_LIT(KDpsScriptFile, ".DPS" );
-_LIT(KDpsDeviceResponseFileName, "DRSPONSE.DPS");
-_LIT(KDpsDeviceRequestFileName, "DREQUEST.DPS");
-_LIT(KDpsHostResponseFileName, "HRSPONSE.DPS");
-_LIT(KDpsHostRequestFileName, "HREQUEST.DPS");
-_LIT8(KDpsXmlMimeType, "text/xml");
-
-const TInt KDpsResourceVersion = 0;
-_LIT(KDpsResource, "resource\\dps.rsc");
-
-
-#endif // DPSDEFS_H
-
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsdefs.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,483 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps definations.
-*
-*/
-
-
-#ifndef DPSDEFS_H
-#define DPSDEFS_H
-
-#include <e32base.h>
-
-const TInt KMaxArgLen = 256;
-const TInt KDateLen = 32;
-
-// special element which has sub-elements, only startJob and
-// getCapability have this field
-enum TDpsElement
- {
- EDpsEleEmpty = 0,
- EDpsCapability,
- EDpsJobConfig,
- EDpsPrintInfo,
- KDpsEleMax
- };
-
-enum TDpsEvent
- {
- EDpsEvtEmpty = 0,
- EDpsEvtNotifyJobStatus,
- EDpsEvtNotifyDeviceStatus,
- KDpsEvtMax
- };
-
-enum TDpsArgument
- {
- EDpsArgDpsVersions = 0,
- EDpsArgVendorName,
- EDpsArgVendorSpecificVersion,
- EDpsArgProductName,
- EDpsArgSerialNo,
- EDpsArgPrintServiceAvailable,
- EDpsArgQualities,
- EDpsArgPaperSizes,
- EDpsArgPaperTypes,
- EDpsArgFileTypes,
- EDpsArgDatePrints,
- EDpsArgFileNamePrints,
- EDpsArgImageOptimizes,
- EDpsArgLayouts,
- EDpsArgFixedSizes,
- EDpsArgChroppings,
- EDpsArgPrtPID,
- EDpsArgFilePath,
- EDpsArgCopyID,
- EDpsArgProgress,
- EDpsArgImagePrinted,
- EDpsArgDpsPrintServiceStatus,
- EDpsArgJobEndReason,
- EDpsArgErrorStatus,
- EDpsArgErrorReason,
- EDpsArgDisconnectEnable,
- EDpsArgCapabilityChanged,
- EDpsArgNewJobOk,
- EDpsArgQuality,
- EDpsArgPaperSize,
- EDpsArgPaperType,
- EDpsArgFileType,
- EDpsArgDatePrint,
- EDpsArgFileNamePrint,
- EDpsArgImageOptimize,
- EDpsArgLayout,
- EDpsArgFixedSize,
- EDpsArgCropping,
- EDpsArgCroppingArea,
- EDpsArgFileID,
- EDpsArgFileName,
- EDpsArgDate,
- EDpsArgCopies,
- EDpsArgAbortStyle,
- EDpsArgImagesPrinted,
- EDpsArgBasePathID,
- EDpsArgFileSize,
- EDpsArgThumbFormat,
- EDpsArgThumbSize,
- EDpsArgBytesRead,
- EDpsArgOffset,
- EDpsArgMaxSize,
- EDpsArgParentFileID,
- EDpsArgMaxNumIDs,
- EDpsArgFileIDs,
- EDpsArgNumIDs,
- EDpsArgMax
- };
-
-// define the DPS action result
-// ref: DPS spec page 52
-// high bits
-enum TDpsResultMajorCode
- {
- EDpsResultOk = 0x1000,
- EDpsResultNotExecuted = 0x1001,
- EDpsResultNotSupported = 0x1002,
- EDpsResultNotRecognized = 0x1003
- };
-
-// define the DPS action result minor code
-// ref: DPS spec page 52
-// low bits
-enum TDpsResultMinorCode
- {
- EDpsResultNone = 0x0000,
- EDpsResultUnrecognizedParam = 0x0001,
- EDpsResultillegalParam = 0x0002,
- EDpsResultMissingParam = 0x0003,
- EDpsResultBufferOverflow = 0x0004
- };
-
-// define the DPS service availability
-// ref: DPS spec page 53
-// only high bits are useful
-enum TDpsServiceAvailability
- {
- EDpsPrintServiceAvailableFalse = 0x3000,
- EDpsPrintServiceAvailableTrue = 0x3001
- };
-
-// define printing qualities
-// ref: DPS spec page 54
-// only high bits are useful
-enum TDpsPrintQuality
- {
- EDpsPrintQualityDefault = 0x5000,
- EDpsPrintQualityNormal = 0x5001,
- EDpsPrintQualityDraft = 0x5002,
- EDpsPrintQualityFine = 0x5003
- };
-
-// define paper sizes
-// ref: DPS spec page 54
-// only high bits are useful
-enum TDpsPaperSizes
- {
- EDpsPaperSizeDefault = 0x5100,
- EDpsPaperSizeL = 0x5101,
- EDpsPaperSize2L = 0x5102,
- EDpsPaperSizePostcard = 0x5103,
- EDpsPaperSizeCard = 0x5104,
- EDpsPaperSize100x150 = 0x5105,
- EDpsPaperSize4x6 = 0x5106,
- EDpsPaperSize8x10 = 0x5107,
- EDpsPaperSizeLetter = 0x5108,
- EDpsPaperSize11x17 = 0x510A,
- EDpsPaperSizeA0 = 0x5110,
- EDpsPaperSizeA1 = 0x5111,
- EDpsPaperSizeA2 = 0x5112,
- EDpsPaperSizeA3 = 0x5113,
- EDpsPaperSizeA4 = 0x5114,
- EDpsPaperSizeA5 = 0x5115,
- EDpsPaperSizeA6 = 0x5116,
- EDpsPaperSizeA7 = 0x5117,
- EDpsPaperSizeA8 = 0x5118,
- EDpsPaperSizeA9 = 0x5119,
- EDpsPaperSizeB0 = 0x5120,
- EDpsPaperSizeB1 = 0x5121,
- EDpsPaperSizeB2 = 0x5122,
- EDpsPaperSizeB3 = 0x5123,
- EDpsPaperSizeB4 = 0x5124,
- EDpsPaperSizeB5 = 0x5125,
- EDpsPaperSizeB6 = 0x5126,
- EDpsPaperSizeB7 = 0x5127,
- EDpsPaperSizeB8 = 0x5128,
- EDpsPaperSizeB9 = 0x5129,
- EDpsPaperSize89 = 0x5181,
- EDpsPaperSize127 = 0x5182,
- EDpsPaperSize100 = 0x5186,
- EDpsPaperSize210 = 0x5194
- };
-// define paper types
-// ref: DPS spec page 54
-// only high bits are useful
-enum TDpsPaperTypeMajor
- {
- EDpsPaperTypeDefault = 0x5200,
- EDpsPaperTypePlainPaper = 0x5201,
- EDpsPaperTypePhotoPaper = 0x5202,
- EDpsPaperTypeFastPhotopaper = 0x5203
- };
-
-enum TDpsPaperTypeMinor
- {
- EDpsPaperTypeStationery = 1,
- EDpsPaperTypeStationeryCoated,
- EDpsPaperTypeStationeryInkjet,
- EDpsPaperTypeStationeryPreprinted,
- EDpsPaperTypeStationeryLetterhead,
- EDpsPaperTypeStationeryPrepunched,
- EDpsPaperTypeStationeryFine,
- EDpsPaperTypeStationeryHeavyweight,
- EDpsPaperTypeStationeryLightweight,
- EDpsPaperTypeTransparency,
- EDpsPaperTypeEnvelope,
- EDpsPaperTypeEnvelopePlain,
- EDpsPaperTypeEnvelopeWindow,
- EDpsPaperTypeContinuous,
- EDpsPaperTypeContinuousLong,
- EDpsPaperTypeContinuousShort,
- EDpsPaperTypeTabStock,
- EDpsPaperTypePreCutTabs,
- EDpsPaperTypeFullCutTabs,
- EDpsPaperTypeMultiPartForm,
- EDpsPaperTypeLabels,
- EDpsPaperTypeMultiLayer,
- EDpsPaperTypeScreen,
- EDpsPaperTypeScreenPaged,
- EDpsPaperTypePhotographic,
- EDpsPaperTypePhotographicGlossy,
- EDpsPaperTypePhotographicHighGloss,
- EDpsPaperTypePhotographicSemiGloss,
- EDpsPaperTypePhotographicSatin,
- EDpsPaperTypePhotographicMatte,
- EDpsPaperTypePhotographicFilm,
- EDpsPaperTypeBackPrintFilm,
- EDpsPaperTypeCardStock
- };
-
-struct TDpsPaperType
- {
- TDpsPaperTypeMajor iMajor;
- TDpsPaperTypeMinor iMinor;
- };
-
-// define file types
-// ref: DPS sepc page 55
-// only high bits are useful
-enum TDpsFileType
- {
- EDpsFileTypeDefault = 0x5300,
- EDpsFileTypeEXIF = 0x5301,
- EDpsFileTypeJPEG = 0x5303
- };
-
-// define date print
-// ref: DPS sepc page 55
-// only high bits are useful
-enum TDpsDatePrint
- {
- EDpsDatePrintDefault = 0x5400,
- EDpsDatePrintOff = 0x5401,
- EDpsDatePrintOn = 0x5402
- };
-
-// define fle name print
-// ref: DPS sepc page 56
-// only high bits are useful
-enum TDpsFileNamePrint
- {
- EDpsFileNamePrintDefault = 0x5500,
- EDpsFileNamePrintOff = 0x5501,
- EDpsFileNamePrintOn = 0x5503
- };
-
-// define image optimization
-// ref: DPS sepc page 56
-// only high bits are useful
-enum TDpsImageOptimize
- {
- EDpsImageOptimizeDefault = 0x5600,
- EDpsImageOptimizeOff = 0x5601,
- EDpsImageOptimizeOn = 0x5603
- };
-
-// define layouts
-// ref: DPS sepc page 56
-// only high bits are useful
-enum TDpsLayout
- {
- EDpsLayoutDefault = 0x5700,
- EDpsLayout1Up = 0x5701,
- EDpsLayout2Up = 0x5702,
- EDpsLayout3Up = 0x5703,
- EDpsLayout4Up = 0x5704,
- EDpsLayout5Up = 0x5705,
- EDpsLayout6Up = 0x5706,
- EDpsLayout7Up = 0x5707,
- EDpsLayout8Up = 0x5708,
- EDpsLayout9Up = 0x5709,
- EDpsLayoutIndex = 0x57FE,
- EDpsLayoutBorderless = 0x57FF
- };
-
-// define fixed sizes
-// ref: DPS sepc page 57
-// only high bits are useful
-enum TDpsFixedSizes
- {
- EDpsFixedSizeDefault = 0x5800,
- EDpsFixedSize4x6 = 0x5803,
- EDpsFixedSize5x7 = 0x5804,
- EDpsFixedSizeA4 = 0x5811,
- EDpsFixedSizeLetter = 0x5812
- };
-
-// define croppings
-// ref: DPS sepc page 57
-// only high bits are useful
-enum TDpsCropping
- {
- EDpsCroppingDefault = 0x5900,
- EDpsCroppingOff = 0x5901,
- EDpsCroppingOn = 0x5902
- };
-
-// define Device status
-// ref: DPS sepc page 61
-// only high bits are useful
-// 1. Print service status
-enum TDpsPrintServiceStatus
- {
- EDpsPrintServiceStatusInit = 0,
- EDpsPrintServiceStatusPrinting = 0x7000,
- EDpsPrintServiceStatusIdle = 0x7001,
- EDpsPrintServiceStatusPaused = 0x7002
- };
-
-enum TDpsJobStatus
- {
- // 2. Job end reasons
- EDpsJobStatusNotEnded = 0x7100,
- EDpsJobStatusEndedOk = 0x7101,
- EDpsJobStatusEndedAbortImmediately = 0x7102,
- EDpsJobStatusEndedAbortCompleteCurrent = 0x7103,
- EDpsJobStatusEndedOther = 0x7104
- };
-
- // 3. Error status
-enum TDpsErrorStatus
- {
- EDpsErrorStatusOk = 0x7200,
- EDpsErrorStatusWarning = 0x7201,
- EDpsErrorStatusFatal = 0x7202
- };
-
-enum TDpsJobEndReasonMajor
- {
- // 4. Job end reasons
- EDpsJobErrorNone = 0x7300,
- EDpsJobErrorPaper = 0x7301,
- EDpsJobErrorInk = 0x7302,
- EDpsJobErrorHardware = 0x7303,
- EDpsJobErrorFile = 0x7304
- };
-
-enum TDpsJobEndReasonPaper
- {
- EDpsPaperDefault = 0,
- EDpsPaperEmpty = 0x0100,
- EDpsPaperLoad = 0x200,
- EDpsPaperEject = 0x300,
- EDpsPaperMedia = 0x400,
- EDpsPaperJam = 0x500,
- EDpsPaperNearlyEmpty = 0x600,
- EDpsPaperTypeSizeNoMatch = 0x700
- };
-
-enum TDpsJobEndReasonInk
- {
- EDpsInkDefault = 0,
- EDpsInkEmpty = 0x100,
- EDpsInkLow = 0x200,
- EDpsInkWaste = 0x300
- };
-
-enum TDpsJobEndReasonHard
- {
- EDpsHardDefault = 0,
- EDpsHardFatal = 0x0100,
- EDpsHardServiceCall = 0x0200,
- EDpsHardNotAvailable = 0x0300,
- EDpsHardBusy = 0x0400,
- EDpsHardLever = 0x0500,
- EDpsHardCoverOpen = 0x0600,
- EDpsHardNoMarkingHead = 0x0700,
- EDpsHardInkCoverOpen = 0x0800,
- EDpsHardNoInkCartridge = 0x0900
- };
-
-enum TDpsJobEndReasonFile
- {
- EDpsFileDefault = 0,
- EDpsFilePrintInfo = 0x0100,
- EDpsFileDecode = 0x0200
- };
-
-struct TDpsJobEndReason
- {
- TDpsJobEndReasonMajor iMajor;
- TDpsJobEndReasonPaper iPaperMinor;
- TDpsJobEndReasonInk iInkMinor;
- TDpsJobEndReasonHard iHardMinor;
- TDpsJobEndReasonFile iFileMinor;
- };
-
-enum TDpsDisconnectEnable
- {
- // 5. Disconnect Enable
- EDpsDisconnectEnableFalse = 0x7400,
- EDpsDisconnectEnableTrue = 0x7401
- };
-
-enum TDpsCapabilityChanged
- {
- // 6. Capability changes
- EDpsCapabilityChangedFalse = 0x7500,
- EDpsCapabilityChangedTrue = 0x7501
- };
-
-enum TDpsNewJobOk
- {
- // 7. New Job Ok
- EDpsNewJobOkFalse = 0x7600,
- EDpsNewJobOkTrue = 0x7601
- };
-
-
-// define error reason minor codes
-// ref: DPS sepc page 62
-enum TDpsErrorMinorCode
- {
- EDpsErrorPaperEmpty = 0x0100,
- EDpsErrorPaperJam = 0x0500,
- EDpsErrorPaperUnsupport = 0x0700,
- EDpsErrorInkEmpty = 0x0100
- };
-
-// define About style
-// ref: DPS spec page 68
-// only high bits are useful
-enum TDpsAbortStyle
- {
- EDpsAbortStyleImmediately = 0x9000,
- EDpsAbortStyleCompleteCurrent = 0x9001
- };
-
-typedef TUint TDpsAttribute;
-
-struct TDpsEle
- {
- TDpsElement iElement;
- // number of arguments included in this element
- TInt iNum;
- };
-
-typedef RArray<TDpsEle> TDpsEleArray;
-
-struct TDpsArg
- {
- TDpsArgument iElement;
- TBuf8<KMaxArgLen> iContent;
- };
-
-// used for get DPS respond
-typedef RArray<TDpsArg> TDpsArgArray;
-
-struct TDpsResult
- {
- TDpsResultMajorCode iMajorCode;
- TDpsResultMinorCode iMinorCode;
- };
-
-#endif
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class reads and writes the file content.
-*
-*/
-
-
-#ifndef DPSFILE_H
-#define DPSFILE_H
-
-#include <e32base.h>
-#include <f32file.h>
-
-/**
-* This class creates, reads, writes and deletes dps files.
-*/
-NONSHARABLE_CLASS(CDpsFile) : public CBase
- {
-public:
- /**
- * Two-phased constructor.
- * @return An instance of CDpsFile.
- */
- static CDpsFile* NewL();
-
- /**
- * C++ destructor.
- */
- ~CDpsFile();
-
-public:
- /**
- * Creates the dps script file
- * @param aFileName the script file name
- * @param aScript the script file content
- * @aFileSize the file size
- * @return KErrNone if successful or systme wide error if failed
- */
- TInt CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript,
- const TInt aFileSize);
-
- /**
- * Gets the content of the script file
- * @param aFileName the file name
- * @param aScript the file content. It has the valid content after this
- * call is returned.
- * @return KErrNone if successful or systme wide error if failed
- */
- void GetContentL(const TDesC& aFileName, TDes8& aScript);
-
- /**
- * Deletes the file
- * @param aFileName the name of the file to be delted.
- * @return KErrNone if successful or systme wide error if failed
- */
- TInt Delete(const TDesC& aFileName);
-
- /**
- * @return RFs& the reference to the file server session, which
- * is shared by the whole component (dps engine binary)
- */
- inline RFs& FileSession();
-
- void FileSizeL(const TDesC& aFileName, TInt& aSize);
-
-private:
-
- /**
- * Second phase constructor
- */
- void ConstructL();
-
-private:
- // file server session, owned by this class
- RFs iFs;
- };
-
-#include "dpsfile.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class reads and writes the file content.
-*
-*/
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-RFs& CDpsFile::FileSession()
- {
- return iFs;
- }
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsoperation.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This classes define dps operations requests and replys.
-*
-*/
-
-
-#ifndef DPSOPERATION_H
-#define DPSOPERATION_H
-
-#include <s32file.h>
-#include "dpsparam.h"
-
-class CDpsTransaction;
-/**
-* This is the base class for all dps operations.
-*/
-class TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- inline TMDpsOperation();
- /**
- * Fills in dps operation request parameters. Dps engine must
- * call this function to fill the dps operation request parameters.
- * @param aArgs the dps operation request arguments
- * @param aElems the dps operation elements
- * @param aAttrib the dps operation attributes
- * @param aTrader the pointer to CDpsTransaction object for filling
- * the request arguments for Dps Engine
- * @return TInt KErrNone if successful or other system error if failed
- */
-
- protected:
- inline virtual TInt FillReqArgs(TDpsArgArray& aArgs,
- TDpsEleArray& aElems,
- TDpsAttribute& aAttrib,
- CDpsTransaction* aTrader);
-
-
- /**
- * Fills in the dps operation reply parameters. Dps engine uses this
- * function after the dps operation gets responsed. After this call,
- * dps engine will call RequestComplete() to inform the client the
- * completion of the dps operation.
- * @param aArgs dps operation reply arguments.
- * @param aParam the pointer to CDpsTransacton object for filling
- * the reply arguments for the client (print UI engine)
- * @return TInt KErrNone if successful or other system error if failed
- */
- inline virtual TInt FillRepArgs(const TDpsArgArray& aArguments,
- CDpsTransaction* aTrader);
-
-
- /**
- * Creates the Dps request script
- * @param aArgs the arguments of the Dps request
- * @param aElements the elements of the Dps request
- * @param aAttribute the attribute of the Dps request
- * @param aScript the buffer of the script
- * @param aTrader the pointer to the CDpsTransaction object for
- * creating the Dps script
- */
- IMPORT_C virtual void CreateReqScriptL(const TDpsArgArray& aArguments,
- const TDpsEleArray& aElements,
- TDpsAttribute aAttribute,
- RWriteStream& aScript,
- CDpsTransaction* aTrader);
-
-
- public:
- // the dps operation result
- TDpsResult iResult;
- // the dps operaton enumeration
- TDpsSupportedOp iOperation;
- };
-
-/**
-* The class for dps startJob operation
-*/
-class TDpsStartJob : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsStartJob();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
- TDpsAttribute& aAttrib,
- CDpsTransaction* aTrader);
-
- /**
- * @see TMDpsOperation
- */
- IMPORT_C void CreateReqScriptL(const TDpsArgArray& aArgs,
- const TDpsEleArray& aElements,
- TDpsAttribute aAttribute,
- RWriteStream& aScript,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsStartJobReq iReqParam;
-
- };
-
-/**
-* The class for dps abortJob operation
-*/
-class TDpsAbortJob : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsAbortJob();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
- TDpsAttribute& aAttrib,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsAbortJobReq iReqParam;
-
- };
-
-/**
-* The class for dps continueJob operation
-*/
-class TDpsContinueJob : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsContinueJob();
- };
-
-/**
-* The class for dps continueJob operation
-*/
-class TDpsGetJobStatus : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsGetJobStatus();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsJobStatusRep iRepParam;
-
- };
-
-/**
-* The class for dps continueJob operation
-*/
-class TDpsGetPrinterStatus : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsGetPrinterStatus();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsPrinterStatusRep iRepParam;
-
- };
-
-/**
-* The class for dps continueJob operation
-*/
-class TDpsGetCapability : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsGetCapability();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
- TDpsAttribute& aAttrib,
- CDpsTransaction* aTrader);
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aParam);
-
- /**
- * @see TMDpsOperation
- */
- IMPORT_C void CreateReqScriptL(const TDpsArgArray& aArgs,
- const TDpsEleArray& aElements,
- TDpsAttribute aAttribute,
- RWriteStream& aScript,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsCapReq iReqParam;
- // the request operation parameter which needed to be filled by
- // the client
- TDpsCapRep iRepParam;
-
- };
-
-/**
-* The class for dps continueJob operation
-*/
-class TDpsConfigPrintService : public TMDpsOperation
- {
- friend class CDpsTransaction;
- public:
- /**
- * Default constructor
- */
- inline TDpsConfigPrintService();
-
- private:
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillReqArgs(TDpsArgArray& aArgs, TDpsEleArray& aElems,
- TDpsAttribute& aAttrib,
- CDpsTransaction* aTrader);
- /**
- * @see TMDpsOperation
- */
- IMPORT_C TInt FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader);
-
- public:
- // the request operation parameter which needed to be filled by
- // the client
- TDpsConfigPrintReq iReqParam;
-
- // the request operation parameter which needed to be filled by
- // the client
- TDpsConfigPrintRep iRepParam;
-
- };
-
-/**
-* The class defines dps events
-*/
-NONSHARABLE_CLASS(TDpsEvents)
- {
- public:
- // the event enumeration
- TDpsEvent iEvent;
- // jobStatus event
- TDpsGetJobStatus iJobEvent;
- // printerStatus event
- TDpsGetPrinterStatus iPrinterEvent;
- };
-
-#include "dpsoperation.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsoperation.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: inline functions of TMDpsOperation
-*
-*/
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TMDpsOperation::TMDpsOperation()
- {
- iOperation = EDpsEmptyRequest;
- iResult.iMajorCode = EDpsResultOk;
- iResult.iMinorCode = EDpsResultNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt TMDpsOperation::FillReqArgs(TDpsArgArray&, TDpsEleArray&,
- TDpsAttribute&, CDpsTransaction*)
- {
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt TMDpsOperation::FillRepArgs(const TDpsArgArray&, CDpsTransaction*)
- {
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsStartJob::TDpsStartJob() : TMDpsOperation()
- {
- iOperation = EDpsStartJob;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsAbortJob::TDpsAbortJob() : TMDpsOperation()
- {
- iOperation = EDpsAbortJob;
- iReqParam.iAbortStyle = EDpsAbortStyleImmediately;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsContinueJob::TDpsContinueJob() : TMDpsOperation()
- {
- iOperation = EDpsContinueJob;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsGetJobStatus::TDpsGetJobStatus() : TMDpsOperation()
- {
- iOperation = EDpsGetJobStatus;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsGetPrinterStatus::TDpsGetPrinterStatus() : TMDpsOperation()
- {
- iOperation = EDpsGetPrinterStatus;
- iRepParam = TDpsPrinterStatusRep();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsGetCapability::TDpsGetCapability() : TMDpsOperation()
- {
- iOperation = EDpsGetCapability;
- iReqParam = TDpsCapReq();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsConfigPrintService::TDpsConfigPrintService() : TMDpsOperation()
- {
- iOperation = EDpsConfigPrintService;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsparam.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: These classes define the dps operation parameters.
-*
-*/
-
-
-#ifndef DPSPARAM_H
-#define DPSPARAM_H
-
-#include "dpsdefs.h"
-
-enum TDpsSupportedOp
- {
- EDpsEmptyRequest = 0,
- EDpsConfigPrintService,
- EDpsGetCapability,
- EDpsGetJobStatus,
- EDpsGetPrinterStatus,
- EDpsStartJob,
- EDpsAbortJob,
- EDpsContinueJob
- };
-
-struct TDpsArgsInt
- {
- TDpsArgument iElement;
- TUint32 iContent;
- };
-
-/**
-* The class defines the print job information which is needed by
-* startJob operation
-*/
-NONSHARABLE_CLASS(TDpsPrintInfo)
- {
-public:
- /**
- *
- */
- inline TDpsPrintInfo();
-
- /**
- * Resets all parameters
- */
- IMPORT_C void Reset();
-
- // the file name
- TBuf<KMaxArgLen> iFile;
-
- TBool isDPOF;
- // this is 0 when UI passed it to dps. Dps engine must find the ID
- // for this file by asking ptp server
- TUint32 iFileID;
- // if don't need to print file name, this is EFalse
- TBool iFileName;
- // if don't need to print date, this is empty
- TBuf<KDateLen> iDate;
- // if only one cope, this is emtpy
- TInt iCopies;
- // if not DPOF, this is emtpy
- TInt iPrtPID;
- // if not DPOF, this is emtpy
- TInt iCopyID;
- };
-
-/**
-* Dps version defination
-*/
-NONSHARABLE_CLASS(TDpsVersion)
- {
- public:
- TInt iMajor;
- TInt iMinor;
- };
-
-/**
-* AbortJob request
-*/
-NONSHARABLE_CLASS(TDpsAbortJobReq)
- {
- public:
- TInt iAbortStyle;
- };
-
-/**
-* ConfigurePrintService request
-*/
-class TDpsConfigPrintReq
- {
- public:
- RArray<TDpsVersion> iDpsVersions;
- TBuf8<KMaxArgLen> iVendorName;
- TDpsVersion iVendorVersion;
- TBuf8<KMaxArgLen> iProductName;
- TBuf8<KMaxArgLen> iSerialNo;
-
- /**
- * Destructor. Declared as virtual so that it will be called by
- * its derived class.
- */
- inline virtual ~TDpsConfigPrintReq();
-
- /**
- * Resets all class variables.
- */
- inline void Reset();
- };
-
-/**
-* ConfigurePrintService reply
-*/
-NONSHARABLE_CLASS(TDpsConfigPrintRep) : public TDpsConfigPrintReq
- {
- public:
- TInt iPrintAvailable;
- };
-
-/**
-* GetCapability request.
-*/
-NONSHARABLE_CLASS(TDpsCapReq)
- {
- public:
- TDpsArgument iCap;
- // layouts and paperTypes requests attributes
- TDpsAttribute iAttribute;
- };
-
-/**
-* GetCapability reply
-*/
-NONSHARABLE_CLASS(TDpsCapRep) : public TDpsCapReq
- {
- public:
- RArray<TUint> iContent;
- RArray<TDpsPaperType> iPaperType;
- /**
- * Destructor
- */
- inline ~TDpsCapRep();
-
- /**
- * Resets all class variables
- */
- inline void Reset();
- };
-
-/**
-* StartJob request has printInfo and jobConfig parameters.
-*/
-NONSHARABLE_CLASS(TDpsStartJobReq)
- {
- public:
- /**
- * Resets all member variables
- */
- inline void Reset();
-
- /**
- * Gets the number of all parameters, including ones under elements
- * @return the number of parameters
- */
- IMPORT_C TInt GetParamNum();
-
- /**
- * Destructor
- */
- inline ~TDpsStartJobReq();
- RArray<TDpsArgsInt> iJobConfig;
- //there might be multiple printInfo in case of several pictures are
- //selected to be printed
- RArray<TDpsPrintInfo> iPrintInfo;
- };
-
-/**
-* This class is for job status reply
-*/
-NONSHARABLE_CLASS(TDpsJobStatusRep)
- {
- public:
-
- /**
- *
- */
- inline TDpsJobStatusRep();
- /**
- * Resets all memeber variables
- */
- IMPORT_C void Reset();
-
- TInt iProgress;
- TInt iImagesPrinted;
- TFileName iFilePath;
- TInt iPrtPID;
- TInt iCopyID;
- };
-
-/**
-* This class is for device status reply
-*/
-NONSHARABLE_CLASS(TDpsPrinterStatusRep)
- {
- public:
- TDpsPrintServiceStatus iPrintStatus;
- TDpsJobStatus iJobStatus;
- TDpsErrorStatus iErrorStatus;
- TDpsJobEndReason iJobEndReason;
- TBool iDisconnectEnable;
- TBool iCapabilityChange;
- TBool iNewJobOk;
- };
-#include "dpsparam.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsparam.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: inline functions of dps parameter.
-*
-*/
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsPrintInfo::TDpsPrintInfo()
- {
- Reset();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsConfigPrintReq::Reset()
- {
- iDpsVersions.Reset();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsConfigPrintReq::~TDpsConfigPrintReq()
- {
- iDpsVersions.Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsCapRep::~TDpsCapRep()
- {
- Reset();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsStartJobReq::Reset()
- {
- iJobConfig.Reset();
- iPrintInfo.Reset();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsStartJobReq::~TDpsStartJobReq()
- {
- iJobConfig.Close();
- iPrintInfo.Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsCapRep::Reset()
- {
- iContent.Reset();
- iPaperType.Close();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsJobStatusRep::TDpsJobStatusRep()
- {
- Reset();
- }
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsptpnotifier.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines functions of setting personality to
-* PTP.
-*
-*/
-
-
-#ifndef DPSPTPNOTIFIER_H
-#define DPSPTPNOTIFIER_H
-
-#include <e32base.h>
-
-class CDpsUsbNotifier;
-
-/**
-* Class for monitoring Ptp personality setting
-*/
-NONSHARABLE_CLASS(CDpsPtpNotifier) : public CActive
- {
- public:
- /**
- * Two phase constructor
- * @param aParent the pointer to UsbNotifier object
- * @return a new created PtpNotifier object
- */
- static CDpsPtpNotifier* NewL(CDpsUsbNotifier* aParent);
-
- /**
- * Destructor
- */
- ~CDpsPtpNotifier();
-
- /**
- * Called by UsbNotifier to subscribe set personality notification
- */
- void ChangePtpPersonality();
-
- private: // Functions derived from CActive.
- /**
- * @see CActive
- */
- void RunL();
-
- /**
- * @see CActive
- */
- void DoCancel();
-
- /**
- * @see CActive
- */
- TInt RunError(TInt aError);
-
- private:
- /**
- * Default constructor
- */
- CDpsPtpNotifier(CDpsUsbNotifier* aParent);
-
- private:
- // not owned by this class
- CDpsUsbNotifier* iNotifier;
-
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsscriptreceiver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps script receiving function.
-*
-*/
-
-
-#ifndef DPSSCRIPTRECEIVER_H
-#define DPSSCRIPTRECEIVER_H
-
-#include <e32base.h>
-
-class CDpsEngine;
-class CDpsStateMachine;
-
-/**
-* This class is an active object. It listens on the ptp server
-* object receiving notification.
-*/
-NONSHARABLE_CLASS(CDpsScriptReceiver) : public CActive
- {
- public:
- /**
- * Two phase constructor
- *
- * @param aOperator the pointer to the dps state machine
- * @return a CDpsScriptReceiver instance
- */
- static CDpsScriptReceiver* NewL(CDpsStateMachine* aOperator);
-
- /**
- * Destructor
- */
- ~CDpsScriptReceiver();
-
- /**
- * Issues the request of receiving.
- */
- void WaitForReceive();
-
- /**
- * @return the file name of the object been received
- */
- const TDesC& FileNameAndPath();
-
- private: // Functions derived from CActive.
- /**
- * @see CActive
- */
- void RunL();
-
- /**
- * @see CActive
- */
- void DoCancel();
-
- /**
- * @see CActive
- */
- TInt RunError(TInt aError);
-
- private:
-
- /**
- * Default constructor
- *
- * @param aOperator the pointer to the dps state machine
- */
- CDpsScriptReceiver(CDpsStateMachine* aOperator);
-
- /**
- * Gets the file name from the full filename
- * @param aFileName the full filename including file path
- * @return KErrNone if Ok, otherwise the system wide error
- */
- TInt GetFileName(TDes& aFileName);
-
- private:
-
- // not owned by this class
- CDpsStateMachine* iOperator;
- // file name of received script file
- TFileName iFileNameAndPath;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsscriptsender.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps script sending function.
-*
-*/
-
-
-#ifndef DPSSCRIPTSENDER_H
-#define DPSSCRIPTSENDER_H
-
-#include <e32base.h>
-
-class CDpsEngine;
-class CDpsStateMachine;
-
-/**
-* This class is an active object. It sends the script to ptp server and
-* listens on the ptp server for notification of sending result.
-*/
-NONSHARABLE_CLASS(CDpsScriptSender) : public CActive
- {
- public:
- /**
- * Two phase constructor
- *
- * @param aOperator the pointer to the dps state machine
- * @return a CDpsScriptSender instance
- */
- static CDpsScriptSender* NewL(CDpsStateMachine* aOperator);
-
- /**
- * Destructor
- */
- ~CDpsScriptSender();
-
- /**
- * Issues sending request
- * @param aReply ETrue is the script is the reply, EFalse if the
- * script is the request.
- */
- TInt SendScript(TBool aReply);
-
- private: // Functions derived from CActive.
- /**
- * @see CActive
- */
- void RunL();
-
- /**
- * @see CActive
- */
- void DoCancel();
-
- /**
- * @see CActive
- */
- TInt RunError(TInt aError);
-
- private:
- /**
- * Default constructor
- *
- * @param aOperator the pointer to the dps state machine
- */
- CDpsScriptSender(CDpsStateMachine* aOperator);
-
- private:
-
- // not owned by this class
- CDpsStateMachine* iOperator;
-
- // telling if the current sending session is a reply or a request
- TBool iReply;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstate.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: These classes define the dps states.
-*
-*/
-
-
-#ifndef DPSSTATE_H
-#define DPSSTATE_H
-
-#include <e32base.h>
-class CDpsStateMachine;
-
-/**
-* This class is the base classes for all dps state classes.
-* We follow state design pattern here so the state class defines all
-* transactions among states as member functions.
-*/
-class MDpsState
- {
- public:
-
- /**
- * Script sent notification
- */
- virtual void ScriptSentNotifyL(TBool aReply) = 0;
-
- /**
- * Script received notification
- */
- virtual void ScriptReceivedNotifyL(TBool aReply) = 0;
-
- /**
- * Error handling of the transaction
- */
- virtual void Error(TInt aErr) = 0;
- };
-
-/**
-* Idle state class
-*/
-NONSHARABLE_CLASS(TDpsIdleState) : public MDpsState
- {
- public:
- /**
- * Constructor
- */
- TDpsIdleState(CDpsStateMachine* aStateMachine);
- public:
-
- /**
- * @see MDpsState
- */
- void ScriptSentNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void ScriptReceivedNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void Error(TInt aErr);
-
-
- private:
- CDpsStateMachine* iStateMachine;
- };
-
-/**
-* Sending Request state class. Device sending request starts form this state
-*/
-NONSHARABLE_CLASS(TDpsSendingReqState) : public MDpsState
- {
- public:
- /**
- * Constructor
- */
- TDpsSendingReqState(CDpsStateMachine* aStateMachine);
-
- public:
-
- /**
- * @see MDpsState
- */
- void ScriptSentNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void ScriptReceivedNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void Error(TInt aErr);
-
- private:
- CDpsStateMachine* iStateMachine;
- };
-
-/**
-* Waiting Reply state class (script has been sent)
-*/
-NONSHARABLE_CLASS(TDpsWaitingRepState) : public MDpsState
- {
- public:
- /**
- * Constructor
- */
- TDpsWaitingRepState(CDpsStateMachine* aStateMachine);
-
- public:
-
- /**
- * @see MDpsState
- */
- void ScriptSentNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void ScriptReceivedNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void Error(TInt aErr);
-
- private:
- CDpsStateMachine* iStateMachine;
- };
-
-/**
-* Sending Reply state class. The device starts replying the host request
-* in this state.
-*/
-NONSHARABLE_CLASS(TDpsSendingRepState) : public MDpsState
- {
- public:
- /**
- * Constructor
- */
- TDpsSendingRepState(CDpsStateMachine* aStateMachine);
-
- public:
-
- /**
- * @see MDpsState
- */
- void ScriptSentNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void ScriptReceivedNotifyL(TBool aReply);
-
- /**
- * @see MDpsState
- */
- void Error(TInt aErr);
-
- private:
- CDpsStateMachine* iStateMachine;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstatemachine.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps state machine.
-*
-*/
-
-
-#ifndef DPSSTATEMACHINE_H
-#define DPSSTATEMACHINE_H
-
-#include "dpsconst.h"
-#include "dpsdefs.h"
-
-class CDpsTransaction;
-class CDpsEngine;
-class CDpsScriptReceiver;
-class MDpsState;
-class TMDpsOperation;
-class CDpsScriptSender;
-
-/**
-* This class defines the dps state machine using the state design pattern
-*/
-NONSHARABLE_CLASS(CDpsStateMachine) : public CBase
- {
-
- public:
- /**
- * Two phase constructor
- * @param aEngine a pointer to dps engine object
- * @return the CDpsOperator instance
- */
- static CDpsStateMachine* NewL(CDpsEngine *aEngine);
-
- /**
- * Destructor
- */
- ~CDpsStateMachine();
-
- /**
- * Creates the dps transaction. It further calls CreateRequest()
- * to create dps device request script.
- * @param aParam the dps operation object, passed from UI
- */
- void StartTransactionL(TMDpsOperation* aOperation);
-
- /**
- * Initializes the state machine
- */
- void Initialize();
-
- /**
- * Handles errors
- */
- inline void Error(TInt err);
-
- /**
- * Notifies script sent
- */
- inline void ScriptSentNotifyL(TBool aReply);
-
- /**
- * Notifies script received
- */
- inline void ScriptReceivedNotifyL(TBool aReply);
-
- /**
- * Sets the current state
- * @param aState the state to be set
- */
- inline void SetState(MDpsState* aState);
-
- /**
- * Gets the idle state
- */
- inline MDpsState* IdleState() const;
-
- /**
- * @return the sending request state object
- */
- inline MDpsState* SendingReqState() const;
-
- /**
- * @return the waiting for reply state object
- */
- inline MDpsState* WaitingRepState() const;
-
- /**
- * @return the sending reply state object
- */
- inline MDpsState* SendingRepState() const;
-
- /**
- * @return the CDpsScriptReceiver object
- */
- inline CDpsScriptReceiver* ScriptReceiver() const;
-
- /**
- * @return CDpsScriptSender pointer
- */
- inline CDpsScriptSender* ScriptSender() const;
-
- /**
- * @return the CDpsTransaction object
- */
- inline CDpsTransaction* Trader() const;
-
- /**
- * @return the current Dps operation enum
- */
- inline TDpsOperation Operation() const;
-
- /**
- * Sets the current Dps operation enum
- * @param aOp the Dps operation enum to be set
- */
- inline void SetOperation(TDpsOperation aOp);
-
- /**
- * @return the Dps operation object
- */
- inline TMDpsOperation* MOperation() const;
-
- /**
- * @return the Dps event enum
- */
- inline TDpsEvent Event() const;
-
- /**
- * Sets the current Dps event
- * @param aEvent the Dps event to be set
- */
- inline void SetEvent(TDpsEvent aEvent);
-
- /**
- * @return the current state.
- */
- inline MDpsState* CurState() const;
-
- /**
- * @return the dps engine object.
- */
- inline CDpsEngine* DpsEngine() const;
-
- /**
- *
- */
- inline TInt CurError() const;
-
- private:
- /**
- * Default constructor
- * @param aEngine a pointer to dps engine object
- */
- CDpsStateMachine(CDpsEngine* aEngine);
-
- /**
- * Two phase constructor. The functions which called in constructor
- * and might leave should be called here
- */
- void ConstructL();
-
-
- private:
- // owned by this class
- MDpsState* iIdleState;
- // owned by this class
- MDpsState* iSendingReqState;
- // owned by this class
- MDpsState* iWaitingRepState;
- // owned by this class
- MDpsState* iSendingRepState;
- // pointer to the current state object
- MDpsState* iCurState;
- // not owned by this class
- TMDpsOperation* iMOperation;
-
- // not owned by this class
- CDpsEngine *iEngine;
- // the current dps operation, can be empty
- TDpsOperation iOperation;
- // the current dps event, can be empty
- TDpsEvent iEvent;
- // the pointer to dps operation object, which takes
- // care of creating and parsing dps script
- // owned by this class
- CDpsTransaction *iTrader;
- // the pointer to dps script receiving notifier
- // owned by this class
- CDpsScriptReceiver* iScriptReceiver;
-
- // the pointer to script sender object, owned by this class
- CDpsScriptSender* iScriptSender;
- TInt iCurError;
- };
-
-#include "dpsstatemachine.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstatemachine.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: inline functions of CDpsStatemachine
-*
-*/
-
-
-#include "dpsstate.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::ScriptSentNotifyL(TBool aReply)
- {
- iCurState->ScriptSentNotifyL(aReply);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::ScriptReceivedNotifyL(TBool aReply)
- {
- iCurState->ScriptReceivedNotifyL(aReply);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::Error(TInt err)
- {
- iCurError = err;
- iCurState->Error(err);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::SetState(MDpsState* aState)
- {
- iCurState = aState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-MDpsState* CDpsStateMachine::IdleState() const
- {
- return iIdleState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-MDpsState* CDpsStateMachine::SendingReqState() const
- {
- return iSendingReqState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-MDpsState* CDpsStateMachine::WaitingRepState() const
- {
- return iWaitingRepState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-MDpsState* CDpsStateMachine::SendingRepState() const
- {
- return iSendingRepState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptReceiver* CDpsStateMachine::ScriptReceiver() const
- {
- return iScriptReceiver;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptSender* CDpsStateMachine::ScriptSender() const
- {
- return iScriptSender;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsTransaction* CDpsStateMachine::Trader() const
- {
- return iTrader;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsOperation CDpsStateMachine::Operation() const
- {
- return iOperation;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::SetOperation(TDpsOperation aOp)
- {
- iOperation = aOp;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TMDpsOperation* CDpsStateMachine::MOperation() const
- {
- return iMOperation;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsEvent CDpsStateMachine::Event() const
- {
- return iEvent;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::SetEvent(TDpsEvent aEvent)
- {
- iEvent = aEvent;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-MDpsState* CDpsStateMachine::CurState() const
- {
- return iCurState;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsEngine* CDpsStateMachine::DpsEngine() const
- {
- return iEngine;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsStateMachine::CurError() const
- {
- return iCurError;
- }
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpstransaction.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class creates and parses dps operations.
-*
-*/
-
-
-#ifndef DPSTRANSACTION_H
-#define DPSTRANSACTION_H
-
-#include <e32base.h>
-#include "dpsdefs.h"
-#include "dpsoperation.h"
-
-class CDpsFile;
-class CDpsEngine;
-class CDpsXmlGenerator;
-class CDpsXmlParser;
-class CDpsScriptSender;
-class TDpsVersion;
-class CDpsStateMachine;
-class TMDpsOperation;
-
-/**
-* This class creates and parses dps operation (request and reply)
-*/
-NONSHARABLE_CLASS(CDpsTransaction) : public CBase
- {
- public:
- /**
- * Two phase constructor
- *
- * @param iOperator the pointer to dps operation object
- * @return the dps transaction instance
- */
- static CDpsTransaction* NewL(CDpsStateMachine* iOperator);
-
- /**
- * Destructor
- */
- ~CDpsTransaction();
-
- public:
- /**
- * Creates the dps operation request
- * @param aParam the dps operation parameters
- */
- void CreateRequestL(TMDpsOperation* aOperation);
-
- /**
- * Parses dps operation script
- * @param aReply if the script is the reply from the host
- * aReply is ETrue, otherwise the script must be the request
- * from the device and aReply is EFalse
- */
- void ParseScriptL(TBool aReply);
-
- /**
- * @return ETrue if the script is the reply from the host,
- * EFalse if the script is the request from the host
- */
- inline TBool IsReply();
-
- /**
- * @return the CDpsXmlParser object
- */
- inline CDpsXmlParser* Parser();
-
- /**
- * @return the CDpsXmlGenerator object
- */
- inline CDpsXmlGenerator* Generator();
-
- /**
- * @return the CDpsEngine object
- */
- inline CDpsEngine* Engine();
-
-
- /**
- * Converts the version in descriptor tpye to TDpsVersion type
- * @param aParser the version in descriptor
- * @param aVersoin the version in TDpsVersion and will be returned
- * @return KErrNone if OK, other system error if failed
- */
- TInt ConvertVersion(TLex8& aParser, TDpsVersion& aVersion);
-
- /**
- * @return CDpsStateMachine pointer to dps state machine object
- */
- inline CDpsStateMachine* Operator();
-
- /**
- * Parses the string of percentage to integer
- * @param aPer the string of percentage to be parsed
- * @return TInt the percentage in integer
- */
- TInt ParsePercentage(const TDes8& aPer);
-
- /**
- * @return the error of result in integer
- */
- inline TInt ResultErr();
-
-
- /**
- * @return CDpsFile pointer to dps file object
- */
- inline CDpsFile* FileHandle();
-
- /**
- *
- */
- void HandleHostRequestError(TInt aErr);
-
- private:
- /**
- * Default constructor
- *
- * @param iOperator the pointer to the dps operator
- */
- CDpsTransaction(CDpsStateMachine* iOperator);
-
- /**
- * Second phase constructor.
- */
- void ConstructL();
-
- /**
- * Creates the dps event reply.
- * @param aArguments dps event arguments
- * @param aResult the result of the reply. See Dps spec for
- * detail result value
- */
- void CreateEventReplyL(TDpsEvent aEvent, const TDpsResult& aResult);
-
- /**
- * Creates the dps request reply based on host dps request.
- * There is only one dps request from host (others are from device) -
- * GetFileID
- * @param aArgs the dps argument from the dps xml script
- * @param aResult the reply result to be filling to the dps xml script
- */
- void CreateRequestReplyL(const TDpsArgArray& aArgs,
- const TDpsResult& result);
-
- /**
- * Removes the unprintable chars (LF, CR, TAB and spaces) between
- * two XML attributes. It seems
- * sybmian XML framework does filter out these character even though
- * they are not belong to the attribute. Some printers (Cannon) send
- * Dps request (XML script) in human readable format, e.g. including
- * LF, CR and spaces among XML attributes.
- * @param aScript the XML script to be filtered out
- */
- void Filter(TDes8& aScript);
-
- /**
- * Changes the file path for GetFileID request
- *
- */
- void SubstitutePath(TDes8& aPath);
-
- private:
-
- // the pointer to dps operator object
- // not owned by this class
- CDpsStateMachine* iOperator;
- // the pointer to xml generator object, owned by this class
- CDpsXmlGenerator *iXmlGen;
- // the pointer to xml parser object, owned by this class
- CDpsXmlParser *iXmlPar;
- // the pointer to file generator object, owned by this class
- CDpsFile *iFile;
-
- // the current parsed script is reply or request
- TBool iReply;
- };
-
-#include "dpstransaction.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpstransaction.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class creates and parses dps operations.
-*
-*/
-
-#include "dpsstatemachine.h"
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TBool CDpsTransaction::IsReply()
- {
- return iReply;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlParser* CDpsTransaction::Parser()
- {
- return iXmlPar;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsEngine* CDpsTransaction::Engine()
- {
- return iOperator->DpsEngine();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlGenerator* CDpsTransaction::Generator()
- {
- return iXmlGen;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsStateMachine* CDpsTransaction::Operator()
- {
- return iOperator;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsFile* CDpsTransaction::FileHandle()
- {
- return iFile;
- }
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsusbnotifier.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements functions of set ptp personality, the
-* notification of the PTP printer connection and the
-* notification of the PTP printer disconnection.
-*
-*/
-
-
-#ifndef DPSUSBNOTIFIER_H
-#define DPSUSBNOTIFIER_H
-
-#include <e32base.h>
-#include <usbstates.h>
-#include "pictbridge.h"
-#include <usbman.h>
-#include <usbwatcher.h>
-
-class CDpsPtpNotifier;
-class CDpsConnectNotifier;
-class CDpsPersonalityWatcher;
-
-/**
-* Class for monitoring the usb personality change and cable
-* connection/disconnectin
-*/
-NONSHARABLE_CLASS(CDpsUsbNotifier) : public CActive
- {
- friend class CDpsPtpNotifier;
- friend class CDpsConnectNotifier;
- friend class CDpsPersonalityWatcher;
-
- public:
- /**
- * Two phase constructor
- * @param aEngine the pointer to the dps engine object
- * @param the CDpsUsbNotifier instance
- */
- static CDpsUsbNotifier* NewL(CDpsEngine* aEngine);
-
- /**
- * Destructor
- */
- ~CDpsUsbNotifier();
-
- /**
- * Issues the request for printer connection notification
- */
- void WaitForPrinterNotify();
-
- /**
- * Cancels the request for printer connection notification
- */
- void CancelPrinterNotify();
-
- /**
- * Issues the request for printer connect/disconnect notification
- */
- void ConnectNotify();
-
- /**
- * @return TBool Checks if the PTP printer is connected
- */
- TBool IsConfigured() const;
-
- /**
- *
- */
- TBool IsSetPrintModeIssued();
-
- private:
- /**
- * Second phase constructor
- */
- void ConstructL();
-
- /**
- * Default constructor
- * @param aEngine the pointer to the dps engine
- */
- CDpsUsbNotifier(CDpsEngine *aEngine);
-
- /**
- * Called by PtpNotifier to indicate a ptp printer/pc is connected
- */
- void PtpNotify(TInt aErr);
-
- /**
- *
- */
- void PersonalityChanged();
-
- /**
- * Called by ConnectNotifier to indeicate the cable disconnect
- */
- void DisconnectNotify(TUsbDeviceState aState);
-
- /**
- * Updates the current device state
- * @return ETrue if OK, EFalse if failed
- */
- TInt ConnectState();
-
- /**
- * Changes back to the previous personality
- */
- void Rollback();
-
- private: // from CActive
- /**
- * @See CActive::RunL
- */
- void RunL();
-
- /**
- * @See CActive::RunError
- */
- TInt RunError(TInt aErr);
-
- /**
- * @See CActive::DoCancel
- */
- void DoCancel();
-
- private:
- // not owned by this class
- CDpsEngine* iEngine;
- // owned by this class
- CDpsPtpNotifier* iPtpP;
- // owned by this class
- CDpsConnectNotifier* iConnectP;
- // owned by this class
- CDpsPersonalityWatcher* iPersonalityWatcher;
- TInt iPersonality;
- TUsbDeviceState iConnectState;
- // indication of whether the PTP printer has connected
- TBool iConfigured;
- CDpsEngine::TConnectionStatus iConnection;
- // owned by this class
- RUsbWatcher iUsbW;
- // owned by this class
- RUsb iUsbM;
- // if rollback to previous personality is needed when application quits
- TBool iRollback;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlgenerator.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class creates the dps xml script.
-*
-*/
-
-
-#ifndef DPSXMLGENERATOR_H
-#define DPSXMLGENERATOR_H
-
-#include <e32base.h>
-#include <s32file.h>
-#include "dpsdefs.h"
-#include "dpsconst.h"
-
-class CDpsEngine;
-
-/**
-* This class creates dps scripts.
-*/
-NONSHARABLE_CLASS(CDpsXmlGenerator) : public CBase
- {
- public:
- /**
- * Two phase constructor
- * @param aEngine a pointer to dps engine
- * @return a CDpsXmlGenerator instance
- */
- static CDpsXmlGenerator* NewL(CDpsEngine* aEngine);
-
- /**
- * Destructor
- */
- ~CDpsXmlGenerator();
-
- /**
- * Creates the Dps result script
- * @param aEvent a dps event, can be empty
- * @param aScript dps script content. after this function is
- * returned, aScript has the valid content
- * @param aResult the operation result
- */
- void CreateResultScriptL(TDpsEvent aEvent,
- RWriteStream& aScript,
- const TDpsResult& aResult) const;
-
- /**
- * Creates the dps reply script
- */
- void CreateReplyScriptL(TDpsOperation aOperation,
- RWriteStream& aScript,
- const TDpsResult& aResult,
- const TDpsArg& aArg) const;
-
- private:
- /**
- * Default constructor
- * @param aEngine a pointer to dps engine
- */
- CDpsXmlGenerator(CDpsEngine* aEngine);
-
- public:
- /**
- * Fillin the start part of a script
- * @param aScript the content of a script
- */
- void StartDocumentL(RWriteStream& aScript) const;
-
- /**
- * Fillin the end part of a script
- * @param aScript the content of a script
- */
- void EndDocumentL(RWriteStream& aScript) const;
-
- /**
- * Fillin the start part of a input in the script
- * @param aScript the content of a script
- */
- void StartInputL(RWriteStream& aScript) const;
-
- /**
- * Fillin the end part of a input in the script
- * @param aScript the content of a script
- */
- void EndInputL(RWriteStream& aScript) const;
-
- /**
- * Fillin the start part of the result in the script
- * @param aScript the content of a script
- * @param aResult the result to be filled
- */
- void StartResultL(RWriteStream& aScript, const TDpsResult& aResult) const;
-
- /**
- * Fillin the end part of the result in the script
- * @param aScript the content of a script
- */
- void EndResultL(RWriteStream& aScript) const;
-
- /**
- * Fillin the start part of the operation in the script
- * @param aOperation the operation enumeration
- * @param aScript the content of a script
- * @param aEnd ETrue if the operation does not have an argument,
- * EFalse otherwise
- */
- void StartOperationL(TDpsOperation aOperation, RWriteStream& aScript,
- TBool aEnd = EFalse) const;
-
- /**
- * Fillin the end part of the operation in the script
- * @param aOperation the operation enumeration
- * @param aScript the content of a script
- */
- void EndOperationL(TDpsOperation aOperation, RWriteStream& aScript) const;
-
- /**
- * Fillin the event parameter in the script
- * @param aScript the content of a script.
- * @param aEvent the event enumeration
- */
- void CreateEventL(RWriteStream& aScript, TDpsEvent aEvent) const;
-
- /**
- * Fillin the arguments
- * @param aScript the content of a script
- * @param aArgument arguments to be used to fill the script
- * @param aAttrib the attribute
- */
- void CreateArgL(RWriteStream& aScript, const TDpsArg& aArgument,
- TDpsAttribute aAttrib = 0) const;
-
- /**
- * Fillin the start part of an element
- * @param aElement the element enumeration
- * @param aScript the content of a script
- */
- void StartElementL(TDpsElement aElement, RWriteStream& aScript) const;
-
- /**
- * Fillin the end part of an element
- * @param aElement the element enumeration
- * @param aScript the content of a script
- */
- void EndElementL(TDpsElement aElement, RWriteStream& aScript) const;
-
- private:
- // not owned by this class
- CDpsEngine* iEngine;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlparser.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class parses the dps xml script.
-*
-*/
-
-
-#ifndef DPSXMLPARSER_H
-#define DPSXMLPARSER_H
-
-#include <e32base.h>
-#include <xml/wbxmlextensionhandler.h>
-#include <contenthandler.h>
-#include "dpsdefs.h"
-#include "dpsconst.h"
-
-using namespace Xml;
-
-class CDpsEngine;
-
-/**
-* The interface acts as a hook between the xml framework and the detailed
-* implementation
-*/
-class MDpsExtensionHandler
- {
- public:
- enum
- {
- // dps engine dll uid
- EInterfaceUid = 0x10274798
- };
- };
-
-/**
-* The parser for dps script
-*/
-NONSHARABLE_CLASS(CDpsXmlParser) : public CBase, public MContentHandler,
- public MDpsExtensionHandler
- {
- public:
- /**
- * Two phase constructor
- * @param aEngine the dps engine pointer
- * @return a CDpsXmlParaser instance
- */
- static CDpsXmlParser* NewL(CDpsEngine* aEngine);
-
- /**
- * Destructor
- */
- ~CDpsXmlParser();
-
- /**
- * @return ETrue if the script is a dps notification,
- * otherwise EFalse
- */
- inline TBool IsEvent() const;
-
- /**
- * Gets the dps operation result from the parser and sets it to the
- * dps reply
- * @param aResult the dps operatoin result
- */
- inline void SetOperationResult(TDpsResult& aResult) const;
-
- /**
- * Gets the dps operation enumeration of this script
- * @return the dps operation enumeration
- */
- inline TDpsOperation Operation() const;
-
- /**
- * Sets the dps operation arguments
- * @param aParams the arguments to be set
- */
- inline void SetParameters(TDpsArgArray& aParams);
-
- /**
- * Gets the dps event of this script
- * @return the dps event enumeration
- */
- inline TDpsEvent Event() const;
-
- /**
- * Gets the dps attribute
- * @param aAttrib the attribute got
- */
- inline void GetAttribute(TDpsAttribute& aAttrib) const;
-
- /**
- * @return ETrue if this dps operation has attribue, othewise EFalse
- */
- inline TBool HasAttribute() const;
-
- /**
- * Gets the dps arguments
- * @param aParams the arguments to be returned
- */
- inline void GetParameters(TDpsArgArray& aParams) const;
-
- /**
- * Resets the member variables
- */
- void Reset();
-
-
- private:
- // From MContentHandler
- /**
- * @see MContentHandler
- */
- void OnStartDocumentL(const RDocumentParameters& aDocParam,
- TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnEndDocumentL(TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnStartElementL(const RTagInfo& aElement,
- const RAttributeArray& aAttributes,
- TInt aErrCode);
-
- /**
- * @see MContentHandler
- */
- void OnEndElementL(const RTagInfo& aElement, TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnContentL(const TDesC8& aBytes, TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnStartPrefixMappingL(const RString& aPrefix,
- const RString& aUri,
- TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnEndPrefixMappingL(const RString& aPrefix, TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnIgnorableWhiteSpaceL(const TDesC8& aBytes, TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnSkippedEntityL(const RString& aName, TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnProcessingInstructionL(const TDesC8& aTarget, const TDesC8& aData,
- TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- void OnError(TInt aErrorCode);
-
- /**
- * @see MContentHandler
- */
- TAny* GetExtendedInterface(const TInt32 aUid);
-
- private:
- /**
- * Default constructor
- * @param aEngine a pointer to the dps engine
- */
- CDpsXmlParser(CDpsEngine* aEngine);
-
- /**
- *
- */
- void ParseAttributesL(const RAttributeArray& aAttributes,
- const TDesC8& aTag);
-
-
- private:
- TDpsXmlAction iAction;
- TDpsAttribute iAttrib;
-
- TDpsEvent iDpsEvent;
- TDpsOperation iDpsOperation;
- TDpsResult iDpsResult;
- // only one
- TDpsElement iElement;
- TDpsArgArray iDpsArgs;
- // not owned by this class
- CDpsEngine* iEngine;
- };
-#include "dpsxmlparser.inl"
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlparser.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class parses the dps xml script.
-*
-*/
-
-
-#ifdef _DEBUG
-# define __IF_DEBUG(t) {RDebug::t;}
-#else
-# define __IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::GetAttribute(TDpsAttribute& aAttrib) const
- {
- aAttrib = iAttrib;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TBool CDpsXmlParser::HasAttribute() const
- {
- return iAttrib != 0;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsOperation CDpsXmlParser::Operation() const
- {
- return iDpsOperation;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsEvent CDpsXmlParser::Event() const
- {
- return iDpsEvent;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::GetParameters(TDpsArgArray& aParams) const
- {
- aParams = iDpsArgs;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TBool CDpsXmlParser::IsEvent() const
- {
- return iDpsEvent != EDpsEvtEmpty;
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::SetParameters(TDpsArgArray& aParams)
- {
- iDpsArgs = aParams;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::SetOperationResult(TDpsResult& aResult) const
- {
- aResult.iMajorCode = iDpsResult.iMajorCode;
- aResult.iMinorCode = iDpsResult.iMinorCode;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlstring.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines the dps constant strings.
-*
-*/
-
-
-#ifndef DPSXMLSTRING_H
-#define DPSXMLSTRING_H
-
-#include <e32base.h>
-
-typedef RArray<TPtrC8> TDpsStrings;
-
-/**
-* The class for the dps string
-*/
-class TDpsXmlString
- {
- public:
- /**
- *
- */
- static TDpsXmlString* NewL();
-
- /**
- *
- */
- ~TDpsXmlString();
-
- private:
- /**
- *
- */
- void ConstructL();
-
- /**
- *
- */
- TDpsXmlString();
-
- public:
- TDpsStrings iDpsOperationStrings;
- TDpsStrings iDpsElementStrings;
- TDpsStrings iDpsEventStrings;
- TDpsStrings iDpsArgStrings;
- };
-
-#endif
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/pictbridge.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines and implements the API for UI engine.
-*
-*/
-
-
-#ifndef PICTBRIDGE_H
-#define PICTBRIDGE_H
-
-#include "dpsdefs.h"
-#include <rptp.h>
-
-class TDpsXmlString;
-class CDpsUsbNotifier;
-class TMDpsOperation;
-class TDpsEvents;
-class CDpsStateMachine;
-class TDpsConfigPrintReq;
-
-NONSHARABLE_CLASS(CDpsEngine) : public CBase
- {
- public:
- enum TConnectionStatus
- {
- ENotConnected = 1,
- // ptp printer is connected
- EPrinterConnected,
- // ptp printer is disconnected
- EPrinterDisconnected,
- // in ptp personality, but device other than printer connected
- EOtherConnected,
- // in personality other than ptp and device is connected
- EWrongPrintModeConnected
- };
-
- public:
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * The client should always call this function to get the Dps
- * engine object.
- * This function guarantees there is only one engine in the
- * thread, a singleton.
- * @return CDpsEngine* the only Dps Engine instance in a thread
- *
- */
- IMPORT_C static CDpsEngine* GetEngineL();
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Deletes the dps engine object.
- */
- IMPORT_C void Delete();
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Sets the personality to PTP. This must be the first call after
- * the client has got the CDpsEngine object and should only be
- * called once.
- * @param aStatus the asynchronous request and it has the connect
- * state after returned. The client can use this value to get the
- * current connect status.
- */
- IMPORT_C void SetPrintMode(TRequestStatus& aStatus);
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Cancels the SetPrintMode request
- */
- IMPORT_C void CancelPrintMode();
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Registers connection notification. This function can inform
- * the connection and the disconnect, two states. Connection: the
- * personality has been set to PTP by SetPrintMode, but the cable
- * is not connected at the moment. The connection will be informed
- * by this function.
- * Disconnect: the user has unplugged the cable or changed
- * personality.
- *
- * @param aStatus the asynchronous request status and it has the
- * connect state after returned.
- */
- IMPORT_C void ConnectStateNotify(TRequestStatus& aStatus);
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Registers Dps event notification. There are two events: jobStatus
- * and deviceStatus. This function is called immediately after
- * ConnecSatetNotify call. After this call, the client should issue
- * ConfigPrintService request to configure the printer.
- * @param aParam this parameter serves as out parameter. After
- * processing the event from the printer, Dps engine will put
- * the correct value to this parameter. As the result, the client
- * can get the event by accessing this parameter after this request
- * gets answered. So the client should have it as a class variable
- * @param aStatus the asynchronous status.
- */
- IMPORT_C void DpsEventNotify(TDpsEvents& aParam,
- TRequestStatus& aStatus);
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Cancels Dps event notification. The client only needs to call
- * this to reset the state of the dps engine and it must be called
- * after CancelDpsRequest().
- */
- IMPORT_C void CancelDpsEventNotify();
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Starts a Dps operation.
- * If this function returned with error, e.g. leaving, the client
- * should call CancelDpsRequest(), to cancel the pending request.
- * @param aRequest the Dps operation. It includes both request and
- * reply. The client should fill in the request parameter and the
- * Dps engine will fill in the reply paramter when this operation
- * is finished. The client should declare it as a class variable.
- * @param aStatus the asynchronous status
- */
- IMPORT_C void DoDpsRequestL(TMDpsOperation* aRequest,
- TRequestStatus& aStatus);
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Cancels the dps operation. Calling this will reset the state of
- * the dps engine, either because of error happened or the client
- * wants to do this on purpose. In most cases, the client never need
- * to cancel the ongoing request because the request will end very
- * quick, normally within several million seconds. The client normally
- * waits until the request is finished, either succesfully or
- * failed indicated by timeout.
- */
- IMPORT_C void CancelDpsRequest();
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Reads the phone dps configuration from the resource file
- * @param aConfig the dps configuration is returned by this parameter
- */
- IMPORT_C void GetDpsConfigL(TDpsConfigPrintReq& aConfig);
-
- /**
- * @since 3.2
- * @lib pictbridge.lib
- *
- * Gets the folder where the printer configure file should be kept.
- * The print App needs a file to store the printer configure when it
- * first calls configPrintService Dps request. The print app can
- * quit at anytime while the ptpserver (stack) is still running.
- * Since the ptpstack is keeping the session with the printer, the
- * printer always does not excute the second onward
- * configPrintService request. As the result, the restarted print app
- * cannot get the printer configure. So there must be a file for
- * keeping this information and it will be deleted by ptpserver when
- * it quits, e.g. when the connection with the printer is lost.
- * @return TDesC& the folder descriptor
- */
- IMPORT_C const TDesC& DpsFolder() const;
-
- /**
- * Gets the Dps event object
- * @return TDpsEvents* the pointer to the Dps event.
- */
- TDpsEvents* Event() const;
-
- /**
- * Gets the ptp server reference
- * @return RPtp& the reference to ptp server.
- */
- RPtp& Ptp();
-
- /**
- * Gets the dps constant strings
- * @return TDpsGlobalData* the pointer to dps constant strings.
- */
- TDpsXmlString* DpsParameters() const;
-
- /**
- * @return dps event notify AO status
- *
- */
- TRequestStatus*& EventRequest();
-
- /**
- * @return dps request AO status
- */
- TRequestStatus*& OperationRequest();
-
- /**
- * @return connection notify AO status
- */
- TRequestStatus*& PrinterConnectRequest();
-
- /**
- * Sets the Dps file folder.
- * @param aFolder the foler location, readed from Ptp server/stack
- */
- void SetDpsFolder(const TDesC& aFolder);
-
-
- private:
-
- /**
- * Prohibits the destructor called by the client. To delete engine object
- * Delete() must be called
- */
- ~CDpsEngine();
-
- /**
- * Second phase constructor. Operations which might leave should
- * be called here
- */
- void ConstructL();
-
- private:
- // string constant, owned by this class
- TDpsXmlString* iDpsParameters;
- // dps engine state machine, owned by this class
- CDpsStateMachine *iDpsOperator;
- // dps operation AO request, owned by this class
- TRequestStatus* iDpsOperationRequest;
- // dps event AO request, owned by this class
- TRequestStatus* iDpsEventRequest;
- // printer connection/disconnection AO request, owned by this class
- TRequestStatus* iPrinterConnectRequest;
-
- // usb cable connection/disconnection notifier, owned by this class
- CDpsUsbNotifier *iUsbNotifier;
-
- // out parameter for events (NotifyJobStatus and
- // NotifyDeviceStauts), it is
- // passed from UI engine, not owned by this class
- TDpsEvents* iOutEvent;
-
- // Ptp Server session, owned by this class
- RPtp iPtp;
- // the folder where all dps releated files should be stored
- TFileName iDpsFolder;
- };
-
-#endif
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/rom/pictbridge.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: iby file for pictbrige engine
-*
-*/
-
-#ifndef __PICTBRIDGE_IBY
-#define __PICTBRIDGE_IBY
-#ifdef __USB_PICTBRIDGE
-file=ABI_DIR\BUILD_DIR\pictbridge.dll SHARED_LIB_DIR\pictbridge.dll
-
-data=DATAZ_\RESOURCE_FILES_DIR\dps.RSC RESOURCE_FILES_DIR\dps.RSC
-#endif __USB_PICTBRIDGE
-#endif __PICTBRIDGE_IBY
\ No newline at end of file
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dps.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: The dps resource file.
-*
-*/
-
-
-#include <badef.rh>
-#include "dps.rh"
-
-
-RESOURCE BA_RSS_SIGNATURE
- {
- signature = 1;
- }
-
-RESOURCE dps_configuration dps_config
- {
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsconnectnotifier.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements functions of the notification of the
-* PTP printer connction and disconnection.
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsconnectnotifier.h"
-#include "dpsusbnotifier.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TUint KUsbAllStates = 0xFFFFFFFF;
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsConnectNotifier* CDpsConnectNotifier::NewL(CDpsUsbNotifier* aParent)
- {
- IF_DEBUG(Print(_L("CDpsConnectNotifier::NewL")));
- CDpsConnectNotifier* self = new(ELeave) CDpsConnectNotifier(aParent);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsConnectNotifier::CDpsConnectNotifier(CDpsUsbNotifier* aParent) :
- CActive(EPriorityNormal), iNotifier(aParent)
- {
- IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::Ctor")));
- CActiveScheduler::Add(this);
- IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsConnectNotifier::~CDpsConnectNotifier()
- {
- IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::~")));
- Cancel();
- IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::~")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsConnectNotifier::ConnectNotify()
- {
- IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::ConnectNotify")));
- if (!IsActive())
- {
- iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates,
- iNotifier->iConnectState,
- iStatus);
- SetActive();
- }
- IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::ConnectNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsConnectNotifier::RunL()
- {
- IF_DEBUG(Print(_L
- (">>>CDpsConnectNotifier::RunL %x"), iNotifier->iConnectState));
- if (KErrNone == iStatus.Int())
- {
-
- // notify connect (by set personality)
- if (iNotifier->iConnectState == EUsbDeviceStateConfigured &&
- !iNotifier->iConfigured)
- {
- iNotifier->PtpNotify(KErrNone);
- }
- // Notify disconnect on cable disconnection and for compatible printer
- // also when other device state than configured or suspended is entered.
- else if ( (iNotifier->iConnectState == EUsbDeviceStateUndefined) ||
- ( iNotifier->IsConfigured() &&
- (iNotifier->iConnectState != EUsbDeviceStateConfigured) &&
- (iNotifier->iConnectState != EUsbDeviceStateSuspended) ) )
- {
- iNotifier->DisconnectNotify(iNotifier->iConnectState);
- }
- else // not the state we are interested, keep on listening
- {
- iNotifier->iUsbM.DeviceStateNotification(KUsbAllStates,
- iNotifier->iConnectState,
- iStatus);
- SetActive();
- }
-
- }
- else
- {
- IF_DEBUG(Print(_L("\tthe iStatus is wrong!!!")));
- }
- IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::RunL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsConnectNotifier::DoCancel()
- {
- IF_DEBUG(Print(_L(">>>CDpsConnectNotifier::DoCancel")));
- iNotifier->iUsbM.DeviceStateNotificationCancel();
- IF_DEBUG(Print(_L("<<<CDpsConnectNotifier::DoCancel")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsConnectNotifier::RunError(TInt aErr)
- {
- IF_DEBUG(Print(_L("CDpsConnectNotifier::RunError is %d"), aErr));
- return aErr;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsfile.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class reads and writes the file content.
-*
-*/
-
-
-#include "dpsfile.h"
-#include "dpsdefs.h"
-#include "dpsconst.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-
-// --------------------------------------------------------------------------
-//
-// --------------------------------------------------------------------------
-//
-CDpsFile* CDpsFile::NewL()
- {
- IF_DEBUG(Print(_L("CDpsFile::NewL")));
- CDpsFile* self = new (ELeave) CDpsFile();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// --------------------------------------------------------------------------
-//
-// --------------------------------------------------------------------------
-//
-void CDpsFile::ConstructL()
- {
- IF_DEBUG(Print(_L(">>>CDpsFile::ConstructL")));
- User::LeaveIfError(iFs.Connect());
- IF_DEBUG(Print(_L("<<<CDpsFile::ConstructL")));
- }
-
-// --------------------------------------------------------------------------
-//
-// --------------------------------------------------------------------------
-//
-CDpsFile::~CDpsFile()
- {
- IF_DEBUG(Print(_L(">>>CDpsFile::~")));
- iFs.Close();
- IF_DEBUG(Print(_L("<<<CDpsFile::~")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsFile::CreateScriptFile(const TDesC& aFileName, const TDesC8& aScript,
- const TInt aFileSize)
- {
- IF_DEBUG(Print(_L(">>>CDpsFile::CreateScriptFile size %d"), aFileSize));
- RFile file;
- TInt err = file.Replace(iFs, aFileName, EFileShareExclusive);
- IF_DEBUG(Print(_L("---the error is %d"), err));
- if (err != KErrNone)
- {
- return err;
- }
-
- TInt fileSize = aScript.Size();
- if (!fileSize)
- {
- err = file.Write(_L8(""), 0);
- }
- else if ( fileSize <= aFileSize)
- {
- err = file.Write(aScript, fileSize);
- }
- else
- {
- err = file.Write(aScript, aFileSize);
- }
-
- file.Close();
- IF_DEBUG(Print(_L("<<<CDpsFile::CreateScriptFile %d"), err));
- return err;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsFile::GetContentL(const TDesC& aFileName, TDes8& aScript)
- {
- IF_DEBUG(Print(_L(">>>CDpsFile::GetContent %S"), &aFileName));
- RFile file;
- CleanupClosePushL(file);
- User::LeaveIfError(file.Open(iFs, aFileName, EFileRead));
- User::LeaveIfError(file.Read(aScript));
- CleanupStack::PopAndDestroy();
- IF_DEBUG(Print(_L("<<<CDpsFile::GetContent")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsFile::FileSizeL(const TDesC& aFileName, TInt& aSize)
- {
- IF_DEBUG(Print(_L(">>>CDpsFile::FileSize %S"), &aFileName));
- RFile file;
- CleanupClosePushL(file);
- User::LeaveIfError(file.Open(iFs, aFileName, EFileRead));
- User::LeaveIfError(file.Size(aSize));
- CleanupStack::PopAndDestroy();
- IF_DEBUG(Print(_L("<<<CDpsFile::FileSize %d"), aSize));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsFile::Delete(const TDesC& aFileName)
- {
- IF_DEBUG(Print(_L("CDpsFile::Delete")));
- return iFs.Delete(aFileName);
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsoperation.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,957 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: These classes implement dps operations replies.
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsoperation.h"
-#include "dpsconst.h"
-#include "dpstransaction.h"
-#include "pictbridge.h"
-#include "dpsxmlparser.h"
-#include "dpsxmlgenerator.h"
-#include "dpsstatemachine.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TInt KConfigPrintService = 5;
-const TInt KCopyFileWidth = 3;
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void TMDpsOperation::CreateReqScriptL(
- const TDpsArgArray& aArguments,
- const TDpsEleArray& /*aElements*/,
- TDpsAttribute /*aAttribute*/,
- RWriteStream& aScript,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TMDpsOperation::CreateReqScript")));
- CDpsXmlGenerator* g = aTrader->Generator();
- g->StartDocumentL(aScript);
- g->StartInputL(aScript);
- TInt count = aArguments.Count();
- if (!count)
- {
- g->StartOperationL((TDpsOperation)iOperation, aScript, ETrue);
- }
- else
- {
- g->StartOperationL((TDpsOperation)iOperation, aScript);
- for (TInt i = 0; i < count; i++)
- {
- g->CreateArgL(aScript, aArguments[i]);
- }
- g->EndOperationL((TDpsOperation)iOperation, aScript);
- }
-
- g->EndInputL(aScript);
- g->EndDocumentL(aScript);
- IF_DEBUG(Print(_L("<<<TMDpsOperation::CreateReqScript")));
- }
-
-// ---------------------------------------------------------------------------
-// Some request parameters should be checked
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsStartJob::FillReqArgs(TDpsArgArray& aArgs,
- TDpsEleArray& aElements,
- TDpsAttribute& /*aAttrib*/,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsStartJob::FillReqArgs")));
- TInt imageCount = iReqParam.iPrintInfo.Count();
- if (!imageCount)
- {
- return KErrUnknown;
- }
- TUint32* objectHandles = new TUint32[imageCount];
- if (!objectHandles)
- {
- return KErrNoMemory;
- }
- for (TInt i = 0; i < imageCount; i++)
- {
- TInt err = aTrader->Engine()->Ptp().
- GetObjectHandleByName(
- iReqParam.iPrintInfo[i].iFile, objectHandles[i], ETrue);
- if (err != KErrNone)
- {
- IF_DEBUG(Print(_L("---error %d"), err));
-
- delete[] objectHandles;
- return err;
- }
- }
- TDpsArg* argsP = new TDpsArg[iReqParam.GetParamNum()];
- if (!argsP)
- {
- delete[] objectHandles;
- return KErrNoMemory;
- }
- TDpsEle* elemsP = new TDpsEle[1 + imageCount];
- if (!elemsP)
- {
- delete[] argsP;
- delete[] objectHandles;
- return KErrNoMemory;
- }
- // jobConfig
- TInt count = iReqParam.iJobConfig.Count();
-
- elemsP[0].iElement = EDpsJobConfig;
- elemsP[0].iNum = count;
- aElements.Append(elemsP[0]);
- for (TInt i = 0; i < count; i++)
- {
- argsP[i].iElement = iReqParam.iJobConfig[i].iElement;
- // the parameter only has high bytes (0x1234)
- argsP[i].iContent.AppendNumUC(iReqParam.iJobConfig[i].iContent, EHex);
- // we have to append the low bytes (0000)
- argsP[i].iContent.Append(KDpsLowZero);
- aArgs.Append(argsP[i]);
- IF_DEBUG(Print(_L("the element is %d"), argsP[i].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[i].iContent)));
- }
-
- // printInfo
- for (TInt j = 0; j < imageCount; j++)
- {
- // there is at least one argument for fileID
- TInt k = 1;
- elemsP[j + 1].iElement = EDpsPrintInfo;
- argsP[count].iElement = EDpsArgFileID;
- argsP[count].iContent.AppendNumFixedWidth(objectHandles[j], EHex,
- KFullWordWidth);
- aArgs.Append(argsP[count]);
-
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
- count++;
-
- // not empty
- if (iReqParam.iPrintInfo[j].iFileName)
- {
- argsP[count].iElement = EDpsArgFileName;
- argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iFile);
- aArgs.Append(argsP[count]);
-
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
-
- k++; count++;
- }
- // not empty
- if (iReqParam.iPrintInfo[j].iDate.Size())
- {
- argsP[count].iElement = EDpsArgDate;
- argsP[count].iContent.Copy(iReqParam.iPrintInfo[j].iDate);
- aArgs.Append(argsP[count]);
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
- k++; count++;
- }
- if (iReqParam.iPrintInfo[j].iCopies != 0)
- {
- argsP[count].iElement = EDpsArgCopies;
- argsP[count].iContent.AppendNumFixedWidthUC(
- iReqParam.iPrintInfo[j].iCopies, EDecimal, KCopyFileWidth);
- aArgs.Append(argsP[count]);
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
- k++; count++;
- }
- if (iReqParam.iPrintInfo[j].iPrtPID != 0)
- {
- argsP[count].iElement = EDpsArgPrtPID;
- argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iPrtPID);
- aArgs.Append(argsP[count]);
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
- k++; count++;
- }
- if (iReqParam.iPrintInfo[j].iCopyID != 0)
- {
- argsP[count].iElement = EDpsArgCopyID;
- argsP[count].iContent.AppendNumUC(iReqParam.iPrintInfo[j].iCopyID);
- aArgs.Append(argsP[count]);
- IF_DEBUG(Print(_L("the element is %d"), argsP[count].iElement));
- IF_DEBUG(Print(_L("the content is %S"), &(argsP[count].iContent)));
- k++; count++;
- }
-
- elemsP[j + 1].iNum = k;
- aElements.Append(elemsP[j + 1]);
- }
-
- delete[] objectHandles;
- delete[] argsP;
- delete[] elemsP;
- IF_DEBUG(Print(_L("<<<TDpsStartJob::FillReqArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void TDpsStartJob::CreateReqScriptL(const TDpsArgArray& aArguments,
- const TDpsEleArray& aElements,
- TDpsAttribute /*aAttribute*/,
- RWriteStream& aScript,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsStartJob::CreateReqScript")));
- CDpsXmlGenerator* g = aTrader->Generator();
- g->StartDocumentL(aScript);
- g->StartInputL(aScript);
- g->StartOperationL((TDpsOperation)iOperation, aScript);
- TInt count = aElements.Count();
- TInt limit = 0;
- for (TInt i = 0; i < count; i++)
- {
- g->StartElementL(aElements[i].iElement, aScript);
- TInt init = limit;
- limit = (i == 0 ? aElements[0].iNum : limit + aElements[i].iNum);
- for (TInt j = init; j < limit; j++)
- {
- g->CreateArgL(aScript,aArguments[j]);
- }
- g->EndElementL(aElements[i].iElement, aScript);
- }
- g->EndOperationL((TDpsOperation)iOperation, aScript);
- g->EndInputL(aScript);
- g->EndDocumentL(aScript);
- IF_DEBUG(Print(_L("<<<TDpsStartJob::CreateReqScript")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsAbortJob::FillReqArgs(TDpsArgArray& aArgs,
- TDpsEleArray& /*aElems*/,
- TDpsAttribute& /*aAttrib*/,
- CDpsTransaction* /*aParam*/)
- {
- IF_DEBUG(Print(_L(">>>TDpsAbortJob::FillReqArgs")));
- TDpsArg arg;
- arg.iElement = EDpsArgAbortStyle;
- arg.iContent.AppendNumUC(iReqParam.iAbortStyle, EHex);
- arg.iContent.Append(KDpsLowZero);
- aArgs.Append(arg);
- IF_DEBUG(Print(_L("<<<TDpsAbortJob::FillReqArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Some request parameters should be checked
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsGetCapability::FillReqArgs(TDpsArgArray& aArgs,
- TDpsEleArray& aElements,
- TDpsAttribute& aAttrib,
- CDpsTransaction* /*aParam*/)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillReqArgs")));
- // only one element
- TDpsEle elems;
- elems.iElement = EDpsCapability;
- elems.iNum = 1;
- aElements.Append(elems);
-
- // only one parameter
- TDpsArg argsP;
- argsP.iElement = iReqParam.iCap;
- aArgs.Append(argsP);
- if (EDpsArgPaperTypes == iReqParam.iCap || EDpsArgLayouts == iReqParam.iCap)
- {
- if (iReqParam.iAttribute != 0)
- {
- aAttrib = iReqParam.iAttribute;
- }
- }
- IF_DEBUG(Print(_L("<<<TDpsGetCapability::FillReqArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void TDpsGetCapability::CreateReqScriptL(
- const TDpsArgArray& aArguments,
- const TDpsEleArray& aElements,
- TDpsAttribute aAttribute,
- RWriteStream& aScript,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetCapability::CreateReqScript")));
- CDpsXmlGenerator* g = aTrader->Generator();
- g->StartDocumentL(aScript);
- g->StartInputL(aScript);
- g->StartOperationL((TDpsOperation)iOperation, aScript);
- g->StartElementL(aElements[0].iElement, aScript);
- const TInt count = aArguments.Count();
- for (TInt i = 0; i < count; i++)
- {
- g->CreateArgL(aScript, aArguments[i], aAttribute);
- }
- g->EndElementL(aElements[0].iElement, aScript);
- g->EndOperationL((TDpsOperation)iOperation, aScript);
- g->EndInputL(aScript);
- g->EndDocumentL(aScript);
- IF_DEBUG(Print(_L("<<<TDpsGetCapability::CreateReqScript")));
- }
-
-// ---------------------------------------------------------------------------
-// Some request parameters should be checked
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsConfigPrintService::FillReqArgs(TDpsArgArray& aArgs,
- TDpsEleArray& /*aElems*/,
- TDpsAttribute& /*aAttrib*/,
- CDpsTransaction* /*aParam*/)
- {
- IF_DEBUG(Print(_L(">>>TDpsConfigPrintService::FillReqArgs")));
- TDpsArg* argsP = new TDpsArg[KConfigPrintService];
- if (!argsP)
- {
- return KErrNoMemory;
- }
- TInt count;
- for (TInt i = 0; i < KConfigPrintService; i++)
- {
- switch (i)
- {
- // there might be several versions
- case EDpsArgDpsVersions:
- argsP[i].iElement = EDpsArgDpsVersions;
- count = iReqParam.iDpsVersions.Count();
- for (TInt j = 0; j < count; j++)
- {
- argsP[i].iContent.AppendNumUC
- (iReqParam.iDpsVersions[j].iMajor);
- argsP[i].iContent.Append(_L("."));
- argsP[i].iContent.AppendNumUC
- (iReqParam.iDpsVersions[j].iMinor);
- }
- aArgs.Append(argsP[i]);
- break;
-
- case EDpsArgVendorName: // vender name
-
- argsP[i].iElement = EDpsArgVendorName;
- argsP[i].iContent.Append(iReqParam.iVendorName);
- aArgs.Append(argsP[i]);
-
- break;
-
- case EDpsArgVendorSpecificVersion: // vender version (optional)
- if (iReqParam.iVendorVersion.iMajor &&
- iReqParam.iVendorVersion.iMinor)
- {
- argsP[i].iElement = EDpsArgVendorSpecificVersion;
- argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMajor);
- argsP[i].iContent.Append(_L("."));
- argsP[i].iContent.AppendNumUC(iReqParam.iVendorVersion.iMinor);
- aArgs.Append(argsP[i]);
- }
-
- break;
-
- case EDpsArgProductName: // produce name
- argsP[i].iElement = EDpsArgProductName;
- argsP[i].iContent.Append(iReqParam.iProductName);
- aArgs.Append(argsP[i]);
- break;
-
- case EDpsArgSerialNo: // serialNo (optional)
- if (iReqParam.iSerialNo.Length())
- {
- argsP[i].iElement = EDpsArgSerialNo;
- argsP[i].iContent.Append(iReqParam.iSerialNo);
- aArgs.Append(argsP[i]);
- }
-
- break;
-
- default:
- IF_DEBUG(Print(_L("***Wrong parameter")));
- delete[] argsP;
- return KErrArgument;
- }
-
- }
- delete[] argsP;
- IF_DEBUG(Print(_L("<<<TDpsConfigPrintService::FillReqArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Not all parameters are checked. If the invalid parameter can pass the
-// the complaint test, it should not be checked. Instead, the client will see
-// it as unknown error. Otherwise, there might be unnecessary code and the
-// client cannot be informed.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsGetCapability::FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetCapability::FillRepArgs")));
- CDpsXmlParser* XmlPar = aTrader->Parser();
-
- if (aArgs.Count())
- {
- if (EDpsArgPaperTypes == aArgs[0].iElement ||
- EDpsArgLayouts == aArgs[0].iElement)
- {
- if (XmlPar->HasAttribute())
- {
- TDpsAttribute attrib;
- XmlPar->GetAttribute(attrib);
- iRepParam.iContent.Append(attrib);
- }
- else
- {
- iRepParam.iContent.Append(0);
- }
- }
- TUint32 value;
- TLex8 converter;
- TLex8 parser(aArgs[0].iContent);
- parser.SkipSpace();
- while (!parser.Eos())
- {
- parser.Mark();
- parser.SkipCharacters();
- if (KFullWordWidth == parser.TokenLength())
- {
- TPtrC8 token = parser.MarkedToken();
- converter.Assign(token);
- parser.SkipSpace();
- }
- else
- {
- IF_DEBUG(Print(_L("***Wrong argument")));
- return KErrArgument;
- }
- TInt error = converter.Val(value, EHex);
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("convert error %d"), error));
- return error;
- }
- if (EDpsArgPaperTypes == aArgs[0].iElement)
- {
- TDpsPaperType paperType;
- TInt major = value >> KShiftLength;
- paperType.iMajor = (TDpsPaperTypeMajor)major;
- paperType.iMinor = (TDpsPaperTypeMinor)(value & KDpsMinorMask);
- iRepParam.iPaperType.Append(paperType);
- }
- else
- {
- // remove the extra zeros
- value = value >> KShiftLength;
- iRepParam.iContent.Append(value);
- IF_DEBUG(Print(_L("the value is %x"), value));
- }
-
- }
- iRepParam.iCap = aArgs[0].iElement;
-
- }
-
- IF_DEBUG(Print(_L("<<<TDpsGetCapability::FillRepArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Not all parameters are checked. If the invalid parameter can pass the
-// the complaint test, it should not be checked. Instead, the client will see
-// it as unknown error. Otherwise, there might be unnecessary code and the
-// client cannot be informed.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsConfigPrintService::FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsConfigPrintService::FillRepArgs")));
- TInt error = KErrNone;
- TLex8 converter, parser;
- const TInt count = aArgs.Count();
-
- for (TInt i = 0; i < count; i++)
- {
- switch (aArgs[i].iElement)
- {
- case EDpsArgPrintServiceAvailable:
- converter.Assign(aArgs[i].iContent);
- TInt64 result;
- error = converter.Val(result, EHex);
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("*** convert error")));
- return error;
- }
- // removes the low four bytes zeros.
- IF_DEBUG(Print(_L("--Printer available is %x"), result));
- result = result >> KShiftLength;
- iRepParam.iPrintAvailable = result;
- break;
-
- case EDpsArgDpsVersions:
- TDpsVersion version;
-
- parser.Assign(aArgs[i].iContent);
- while (!parser.Eos())
- {
- parser.Mark();
- parser.SkipCharacters();
- if (parser.TokenLength())
- {
- TPtrC8 token = parser.MarkedToken();
- converter.Assign(token);
- parser.SkipSpace();
- }
- else
- {
- IF_DEBUG(Print(_L("***wrong !!!")));
- return KErrArgument;
- }
- error = aTrader->ConvertVersion(converter, version);
- if (error != KErrNone)
- {
- return error;
- }
- iRepParam.iDpsVersions.Append(version);
- }
- break;
-
- case EDpsArgVendorName:
- iRepParam.iVendorName.Copy(aArgs[i].iContent);
- IF_DEBUG(Print(_L
- ("vendor name is %S"), &iRepParam.iVendorName));
- break;
-
- case EDpsArgVendorSpecificVersion:
- parser.Assign(aArgs[i].iContent);
- aTrader->ConvertVersion(parser, version);
- iRepParam.iVendorVersion = version;
- IF_DEBUG(Print(_L
- ("vendor version is %x"), iRepParam.iVendorVersion));
- break;
-
- case EDpsArgProductName:
- iRepParam.iProductName.Copy(aArgs[i].iContent);
- IF_DEBUG(Print(_L
- ("product name is %S"), &iRepParam.iProductName));
- break;
-
- case EDpsArgSerialNo:
- iRepParam.iSerialNo.Copy(aArgs[i].iContent);
- IF_DEBUG(Print(_L("SerialNo is %S"), &iRepParam.iSerialNo));
- break;
-
- default:
- IF_DEBUG(Print(_L("--Unknown param!!")));
- return KErrArgument;
- }
- }
-
- IF_DEBUG(Print(_L("<<<TDpsConfigPrintService::FillRepArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Not all parameters are checked. If the invalid parameter can pass the
-// the complaint test, it should not be checked. Instead, the client will see
-// it as unknown error. Otherwise, there might be unnecessary code and the
-// client cannot be informed.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsGetJobStatus::FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetJobStatus::FillRepArgs")));
- TInt value, error, per;
- TBuf<KMaxArgLen> fileName;
- TLex8 converter;
- TInt count = aArgs.Count();
- TBool reply = aTrader->IsReply();
- if (!reply)
- {
- aTrader->Engine()->Event()->iEvent = EDpsEvtNotifyJobStatus;
- }
- else
- {
- aTrader->Engine()->Event()->iEvent = EDpsEvtEmpty;
- }
- for (TInt i = 0; i < count; i++)
- {
- switch (aArgs[i].iElement)
- {
- case EDpsArgPrtPID:
- converter.Assign(aArgs[i].iContent);
- error = converter.Val(value);
- if (error != KErrNone)
- {
- return error;
- }
- if (reply)
- {
- iRepParam.iPrtPID = value;
- }
- else
- {
- aTrader->Engine()->Event()->iJobEvent.iRepParam.iPrtPID =
- value;
- }
- break;
-
- case EDpsArgFilePath:
- if (reply)
- {
- iRepParam.iFilePath.Copy(aArgs[i].iContent);
- }
- else
- {
- aTrader->Engine()->Event()->iJobEvent.iRepParam.iFilePath.
- Copy(aArgs[i].iContent);
- }
- break;
-
- case EDpsArgCopyID:
- converter.Assign(aArgs[i].iContent);
- error = converter.Val(value);
- if (error != KErrNone)
- {
- return error;
- }
- if (reply)
- {
- iRepParam.iCopyID = value;
- }
- else
- {
- aTrader->Engine()->Event()->iJobEvent.iRepParam.iCopyID =
- value;
- }
- break;
-
- case EDpsArgProgress:
- per = aTrader->ParsePercentage(aArgs[i].iContent);
- if (per < KErrNone)
- {
- return per;
- }
-
- if (reply)
- {
- iRepParam.iProgress = per;
- }
- else
- {
- aTrader->Engine()->Event()->iJobEvent.iRepParam.iProgress =
- per;
- }
- break;
-
- case EDpsArgImagesPrinted:
- converter.Assign(aArgs[i].iContent);
- error = converter.Val(value);
- if (error != KErrNone)
- {
- return error;
- }
- if (reply)
- {
- iRepParam.iImagesPrinted = value;
- }
- else
- {
- aTrader->Engine()->Event()->iJobEvent.iRepParam.
- iImagesPrinted = value;
- }
- break;
-
- default:
- IF_DEBUG(Print(_L("***wrong param!!!")));
- return KErrArgument;
- }
- }
- IF_DEBUG(Print(_L("<<<TDpsGetJobStatus::FillRepArgs")));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// Not all parameters are checked. If the invalid parameter can pass the
-// the complaint test, it should not be checked. Instead, the client will see
-// it as unknown error. Otherwise, there might be unnecessary code and the
-// client cannot be informed.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsGetPrinterStatus::FillRepArgs(const TDpsArgArray& aArgs,
- CDpsTransaction* aTrader)
- {
- IF_DEBUG(Print(_L(">>>TDpsGetPrinterStatus::FillRepArgs")));
- // if UI has not pass the event pointer, we do need to fill in it
- if (!aTrader->Engine()->Event())
- {
- return KErrNone;
- }
- TLex8 converter;
- TDpsPrinterStatusRep param;
- const TInt count = aArgs.Count();
- TUint32 value, temp;
- TBool reply = aTrader->IsReply();
- if (!reply)
- {
- aTrader->Engine()->Event()->iEvent = EDpsEvtNotifyDeviceStatus;
- }
- else
- {
- aTrader->Engine()->Event()->iEvent = EDpsEvtEmpty;
- }
- for (TInt i = 0; i < count; i++)
- {
- converter.Assign(aArgs[i].iContent);
- TInt error = converter.Val(value, EHex);
- if (error != KErrNone)
- {
- return error;
- }
- IF_DEBUG(Print(_L("--the value is %x"), value));
-
- switch (aArgs[i].iElement)
- {
- case EDpsArgDpsPrintServiceStatus:
- value = value >> KShiftLength;
- if (EDpsPrintServiceStatusPrinting == value ||
- EDpsPrintServiceStatusIdle == value ||
- EDpsPrintServiceStatusPaused == value)
- {
- if (reply)
- {
- iRepParam.iPrintStatus =
- (TDpsPrintServiceStatus)(value);
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iPrintStatus = (TDpsPrintServiceStatus)(value);
- }
- }
- else
- {
- return KErrArgument;
- }
-
- break;
-
- case EDpsArgJobEndReason:
- value = value >> KShiftLength;
- if (EDpsJobStatusNotEnded == value ||
- EDpsJobStatusEndedOk == value ||
- EDpsJobStatusEndedAbortImmediately == value ||
- EDpsJobStatusEndedAbortCompleteCurrent == value ||
- EDpsJobStatusEndedOther == value)
- {
- if (reply)
- {
- iRepParam.iJobStatus = (TDpsJobStatus)(value);
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iJobStatus = (TDpsJobStatus)(value);
- }
- }
- else
- {
- return KErrArgument;
- }
-
- break;
-
- case EDpsArgErrorStatus:
- value = value >> KShiftLength;
- if (EDpsErrorStatusOk == value ||
- EDpsErrorStatusWarning == value ||
- EDpsErrorStatusFatal == value)
- {
- if (reply)
- {
- iRepParam.iErrorStatus = (TDpsErrorStatus)(value);
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iErrorStatus = (TDpsErrorStatus)(value);
- }
- }
- else
- {
- return KErrArgument;
- }
-
- break;
-
- case EDpsArgErrorReason:
- temp = value >> KShiftLength;
- if (EDpsJobErrorNone == temp ||
- EDpsJobErrorPaper == temp ||
- EDpsJobErrorInk == temp ||
- EDpsJobErrorHardware == temp ||
- EDpsJobErrorFile == temp)
- {
- param.iJobEndReason.iMajor =
- (TDpsJobEndReasonMajor)(temp);
- IF_DEBUG(Print(_L("the end reason is %x"), temp));
- value = value & KDpsMinorMask;
- switch (param.iJobEndReason.iMajor)
- {
- case EDpsJobErrorPaper:
- param.iJobEndReason.iPaperMinor =
- (TDpsJobEndReasonPaper)(value);
- break;
-
- case EDpsJobErrorInk:
- param.iJobEndReason.iInkMinor =
- (TDpsJobEndReasonInk)(value);
- break;
-
- case EDpsJobErrorHardware:
- param.iJobEndReason.iHardMinor =
- (TDpsJobEndReasonHard)(value);
- break;
-
- case EDpsJobErrorFile:
- param.iJobEndReason.iFileMinor =
- (TDpsJobEndReasonFile)(value);
- break;
-
- default:
- IF_DEBUG(Print(_L("no minor error")));
- break;
- }
- if (reply)
- {
- iRepParam.iJobEndReason = param.iJobEndReason;
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iJobEndReason = param.iJobEndReason;
- }
- }
- else
- {
- return KErrArgument;
- }
-
- break;
-
- case EDpsArgDisconnectEnable:
- value = value >> KShiftLength;
- if (EDpsDisconnectEnableFalse == value)
- {
- param.iDisconnectEnable = EFalse;
- }
- else if (EDpsDisconnectEnableTrue == value)
- {
- param.iDisconnectEnable = ETrue;
- }
- else
- {
- return KErrArgument;
- }
- if (reply)
- {
- iRepParam.iDisconnectEnable = param.iDisconnectEnable;
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iDisconnectEnable = param.iDisconnectEnable;
- }
- break;
-
- case EDpsArgCapabilityChanged:
- value = value >> KShiftLength;
- if (EDpsCapabilityChangedFalse == value)
- {
- param.iCapabilityChange = EFalse;
- }
- else if (EDpsCapabilityChangedTrue == value)
- {
- param.iCapabilityChange = ETrue;
- }
- else
- {
- return KErrArgument;
- }
- if (reply)
- {
- iRepParam.iCapabilityChange = param.iCapabilityChange;
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iCapabilityChange = param.iCapabilityChange;
- }
- break;
-
- case EDpsArgNewJobOk:
- value = value >> KShiftLength;
- if (EDpsNewJobOkTrue == value)
- {
- param.iNewJobOk = ETrue;
- }
- else if (EDpsNewJobOkFalse == value)
- {
- param.iNewJobOk = EFalse;
- }
- else
- {
- return KErrArgument;
- }
- if (reply)
- {
- iRepParam.iNewJobOk = param.iNewJobOk;
- }
- else
- {
- aTrader->Engine()->Event()->iPrinterEvent.iRepParam.
- iNewJobOk = param.iNewJobOk;
- }
- break;
-
- default:
- IF_DEBUG(Print(_L("***wrong param")));
- return KErrArgument;
- }
- }
-
- IF_DEBUG(Print(_L("<<<TDpsGetPrinterStatus::FillRepArgs")));
- return KErrNone;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsparam.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: inline functions of dps parameter.
-*
-*/
-
-
-#include "dpsparam.h"
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void TDpsPrintInfo::Reset()
- {
- isDPOF = EFalse; iFileID = 0; iFileName = EFalse; iDate.Zero();
- iCopies = 0; iPrtPID = 0; iCopyID = 0;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TInt TDpsStartJobReq::GetParamNum()
- {
- TInt num = iJobConfig.Count(), count = iPrintInfo.Count();
- for (TInt i = 0; i < count; i++)
- {
- // there is always fileID field
- num++;
- if (iPrintInfo[i].iFileName)
- {
- num++;
- }
- if (iPrintInfo[i].iDate.Size())
- {
- num++;
- }
- if (iPrintInfo[i].iCopies !=0)
- {
- num++;
- }
- if (iPrintInfo[i].iPrtPID != 0)
- {
- num++;
- }
-
- if (iPrintInfo[i].iCopyID != 0)
- {
- num++;
- }
- }
- return num;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void TDpsJobStatusRep::Reset()
- {
- iProgress = 0; iImagesPrinted = 0; iFilePath.Zero();
- iPrtPID = 0; iCopyID = 0;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsptpnotifier.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements functions of setting personality to
-* MTP.
-* Version : %version: 1 %
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsptpnotifier.h"
-#include "dpsusbnotifier.h"
-#include "dpsconst.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsPtpNotifier* CDpsPtpNotifier::NewL(CDpsUsbNotifier* aParent)
- {
- IF_DEBUG(Print(_L("CDpsPtpNotifier::NewL")));
- CDpsPtpNotifier* self = new(ELeave) CDpsPtpNotifier(aParent);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsPtpNotifier::CDpsPtpNotifier(CDpsUsbNotifier* aParent) :
- CActive(EPriorityNormal), iNotifier(aParent)
- {
- IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::Ctor")));
- CActiveScheduler::Add(this);
- IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsPtpNotifier::~CDpsPtpNotifier()
- {
- IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::")));
- Cancel();
- IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::~")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsPtpNotifier::ChangePtpPersonality()
- {
- IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::ChangePtpPersonality")));
- if (!IsActive())
- {
- TInt personalityId = KUsbPersonalityIdMTP;
- iNotifier->iUsbM.GetCurrentPersonalityId(personalityId);
- IF_DEBUG(Print(_L("CDpsPtpNotifier::ChangePtpPersonality, current personality= %d"), personalityId));
- if(KUsbPersonalityIdPCSuiteMTP == personalityId)
- {
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete(statusPtr, KErrNone);
- SetActive();
- }
- else
- {
- iNotifier->iUsbW.SetPersonality(iStatus, KUsbPersonalityIdMTP, ETrue);
- SetActive();
- }
- }
- IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::ChangePtpPersonality")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsPtpNotifier::RunL()
- {
- IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::RunL %d"), iStatus.Int()));
- if (KErrNone == iStatus.Int())
- {
- iNotifier->iPersonality = KUsbPersonalityIdMTP;
- TInt ret = iNotifier->ConnectState();
- if (ret != KErrNone)
- {
- IF_DEBUG(Print(_L("error happened %d"), ret));
- }
- }
- iNotifier->PtpNotify(iStatus.Int());
- IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::RunL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsPtpNotifier::DoCancel()
- {
- IF_DEBUG(Print(_L(">>>CDpsPtpNotifier::DoCancel")));
- iNotifier->iUsbW.CancelSetPersonality();
- IF_DEBUG(Print(_L("<<<CDpsPtpNotifier::DoCancel")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsPtpNotifier::RunError(TInt aErr)
- {
- IF_DEBUG(Print(_L("CDpsPtpNotifier::RunError")));
- return aErr;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsscriptreceiver.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements the dps script receiving function.
-*
-*/
-
-
-#include <e32debug.h>
-#include <f32file.h>
-#include "dpsscriptreceiver.h"
-#include "dpsstatemachine.h"
-#include "pictbridge.h"
-#include "dpsconst.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptReceiver* CDpsScriptReceiver::NewL(CDpsStateMachine* aOperator)
- {
- IF_DEBUG(Print(_L("CDpsScriptReceiver::NewL")));
- CDpsScriptReceiver* self = new(ELeave) CDpsScriptReceiver(aOperator);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptReceiver::CDpsScriptReceiver(CDpsStateMachine* aOperator) :
- CActive(EPriorityNormal), iOperator(aOperator),
- iFileNameAndPath(KDpsHostResponseFileName)
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::Ctor")));
- CActiveScheduler::Add(this);
- WaitForReceive();
- IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptReceiver::~CDpsScriptReceiver()
- {
- IF_DEBUG(Print(_L(">>>~CDpsScriptReceiver")));
- Cancel();
- IF_DEBUG(Print(_L("<<<~CDpsScriptReceiver")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsScriptReceiver::WaitForReceive()
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::WaitForReceive")));
- if (!IsActive())
- {
- iOperator->DpsEngine()->Ptp().ObjectReceivedNotify(KDpsScriptFile,
- iFileNameAndPath, iStatus, EFalse);
- SetActive();
- }
- IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::WaitForReceive")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsScriptReceiver::GetFileName(TDes& aFileName)
- {
- TParse p;
- TInt err = p.Set(iFileNameAndPath, NULL, NULL);
- if (KErrNone == err)
- {
- aFileName.Copy(p.NameAndExt());
- }
- return err;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-const TDesC& CDpsScriptReceiver::FileNameAndPath()
- {
- return iFileNameAndPath;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsScriptReceiver::RunL()
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::RunL %S"), &iFileNameAndPath));
- // in the certain error case, it is possible that the printer sending
- // the device status before the UI is ready to receive this event.
- // in this case, pictbridge engine still does not get the ptp folder
- // setting from the stack.
- // if we receive script from host, the stack has started. so we check if
- // we already get the ptp folder here.
- if (!iOperator->DpsEngine()->DpsFolder().Length())
- {
- iOperator->DpsEngine()->SetDpsFolder(
- iOperator->DpsEngine()->Ptp().PtpFolder());
- }
- if (KErrNone == iStatus.Int())
- {
- TFileName receive;
- User::LeaveIfError(GetFileName(receive));
- IF_DEBUG(Print(_L("received file is %S"), &receive));
- // reply from Host is received
- if (!receive.Compare(KDpsHostResponseFileName))
- {
- iOperator->ScriptReceivedNotifyL(ETrue);
- }
- // request from Host is received
- else if (!receive.Compare(KDpsHostRequestFileName))
- {
- iOperator->ScriptReceivedNotifyL(EFalse);
- }
- WaitForReceive();
- }
- else
- {
- IF_DEBUG(Print(_L("the iStatus is wrong!!! %d"), iStatus.Int()));
- iOperator->Error(iStatus.Int());
- }
- IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::RunL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsScriptReceiver::DoCancel()
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::DoCancel")));
- iOperator->DpsEngine()->Ptp().CancelObjectReceivedNotify();
- IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::DoCancel")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsScriptReceiver::RunError(TInt aError)
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptReceiver::RunError is %d"), aError));
- // if error happened cancel the outstanding request
- Cancel();
- iOperator->Error(aError);
- IF_DEBUG(Print(_L("<<<CDpsScriptReceiver::RunError")));
- return KErrNone;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsscriptsender.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements the dps script sending function.
-*
-*/
-
-
-#include <e32debug.h>
-#include <f32file.h>
-#include "dpsscriptsender.h"
-#include "dpsstatemachine.h"
-#include "pictbridge.h"
-#include "dpstransaction.h"
-#include "dpsfile.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptSender* CDpsScriptSender::NewL(CDpsStateMachine* aOperator)
- {
- IF_DEBUG(Print(_L("CDpsScriptSender::NewL")));
- CDpsScriptSender* self = new(ELeave) CDpsScriptSender(aOperator);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptSender::CDpsScriptSender(CDpsStateMachine* aOperator) :
- CActive(EPriorityNormal), iOperator(aOperator),
- iReply(EFalse)
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptSender::Ctor")));
- CActiveScheduler::Add(this);
- IF_DEBUG(Print(_L("<<<CDpsScriptSender::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsScriptSender::~CDpsScriptSender()
- {
- IF_DEBUG(Print(_L(">>>~CDpsScriptSender")));
- Cancel();
- IF_DEBUG(Print(_L("<<<~CDpsScriptSender")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsScriptSender::SendScript(TBool aReply)
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptSender::SendScript")));
- if (!IsActive())
- {
- iReply = aReply;
- TFileName file(iOperator->DpsEngine()->DpsFolder());
- RFile script;
- if (aReply)
- {
- file.Append(KDpsDeviceResponseFileName);
- }
- else
- {
- file.Append(KDpsDeviceRequestFileName);
- }
- TInt err = script.Open(iOperator->Trader()->
- FileHandle()->FileSession(), file, EFileRead);
- if (err != KErrNone)
- {
- return err;
- }
- TInt size;
- script.Size(size);
- script.Close();
- if (aReply)
- {
- iOperator->DpsEngine()->
- Ptp().SendObject(file, iStatus, EFalse, size);
- }
- else
- {
- iOperator->DpsEngine()->
- Ptp().SendObject(file, iStatus, ETrue, size);
- }
- SetActive();
- IF_DEBUG(Print(_L("<<<CDpsScriptSender::SendScript")));
- return KErrNone;
- }
- else
- {
- return KErrInUse;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsScriptSender::RunL()
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptSender::RunL")));
-
- if (KErrNone == iStatus.Int())
- {
- // the device request is sent
- if (!iReply)
- {
- iOperator->ScriptSentNotifyL(EFalse);
- }
- // the device response is sent
- else
- {
- iOperator->ScriptSentNotifyL(ETrue);
- }
- }
- else
- {
- IF_DEBUG(Print(_L("the iStatus is wrong %d!!!"), iStatus.Int()));
- iOperator->Error(iStatus.Int());
- }
- IF_DEBUG(Print(_L("<<<CDpsScriptSender::RunL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsScriptSender::DoCancel()
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptSender::DoCancel")));
- iOperator->DpsEngine()->Ptp().CancelSendObject();
- IF_DEBUG(Print(_L("<<<CDpsScriptSender::DoCancel")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsScriptSender::RunError(TInt aError)
- {
- IF_DEBUG(Print(_L(">>>CDpsScriptSender::RunError is %d"), aError));
- Cancel();
- iOperator->Error(aError);
- IF_DEBUG(Print(_L("<<<CDpsScriptSender::RunError")));
- return KErrNone;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsstate.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: These classes implement dps states.
-*
-*/
-
-#include <e32debug.h>
-#include "dpsstate.h"
-#include "dpsstatemachine.h"
-#include "dpstransaction.h"
-#include "dpsscriptreceiver.h"
-#include <pictbridge.h>
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsIdleState::TDpsIdleState(CDpsStateMachine* aStateMachine) :
- iStateMachine(aStateMachine) {}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsIdleState::ScriptSentNotifyL(TBool /*aReply*/)
- {
- IF_DEBUG(Print(_L("TDpsIdleState::ScriptSentNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsIdleState::ScriptReceivedNotifyL(TBool aReply)
- {
- if (!aReply)
- {
- IF_DEBUG(Print(_L("TDpsIdleState::ScriptReceived request got")));
- iStateMachine->Trader()->ParseScriptL(aReply);
- iStateMachine->SetState(iStateMachine->SendingRepState());
- }
- else
- {
- IF_DEBUG(Print(_L(
- "TDpsIdleState::ScriptReceived should not get reply!!!")));
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsIdleState::Error(TInt aErr)
- {
- IF_DEBUG(Print(_L("TDpsIdleState::Error %d"), aErr));
- if ((aErr != KErrCancel) && (aErr != KErrNotReady))
- {
- iStateMachine->Trader()->HandleHostRequestError(aErr);
- iStateMachine->SetState(iStateMachine->SendingRepState());
- }
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsSendingReqState::TDpsSendingReqState(CDpsStateMachine* aStateMachine) :
- iStateMachine(aStateMachine) {}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingReqState::ScriptSentNotifyL(TBool aReply)
- {
- if (!aReply)
- {
- IF_DEBUG(Print(_L("TDpsSendingReqState::ScriptSent request")));
- iStateMachine->SetState(iStateMachine->WaitingRepState());
- }
- else
- {
- IF_DEBUG(Print(_L(
- "TDpsSendingReqState::ScriptSent should not get reply!!")));
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingReqState::ScriptReceivedNotifyL(TBool /*aReply*/)
- {
- IF_DEBUG(Print(_L("TDpsSendingReqState::ScriptReceived")));
- IF_DEBUG(Print(_L("**should not reply to the request/reply from host")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingReqState::Error(TInt aErr)
- {
- User::RequestComplete(iStateMachine->DpsEngine()->OperationRequest(),
- aErr);
- iStateMachine->Initialize();
- return;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsWaitingRepState::TDpsWaitingRepState(CDpsStateMachine* aStateMachine) :
- iStateMachine(aStateMachine) {}
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsWaitingRepState::ScriptSentNotifyL(TBool /*aReply*/)
- {
- IF_DEBUG(Print(_L("TDpsWaitingRepState::ScriptSent")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsWaitingRepState::ScriptReceivedNotifyL(TBool aReply)
- {
- if (aReply)
- {
- IF_DEBUG(Print(_L("WaitingRepState reply")))
-
- iStateMachine->Trader()->ParseScriptL(aReply);
- User::RequestComplete(
- iStateMachine->DpsEngine()->OperationRequest(), KErrNone);
- iStateMachine->Initialize();
- }
- else
- {
- IF_DEBUG(Print(_L("WaitingRepState should not get request")));
- // collision happened, we do nothing because the host will
- // eventually handle this by sending the correct response. but we need
- // to subscribe for the event again.
- iStateMachine->ScriptReceiver()->WaitForReceive();
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsWaitingRepState::Error(TInt aErr)
- {
- // this is not tested
- User::RequestComplete(iStateMachine->DpsEngine()->OperationRequest(),
- aErr);
- iStateMachine->Initialize();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsSendingRepState::TDpsSendingRepState(CDpsStateMachine* aStateMachine) :
- iStateMachine(aStateMachine) {}
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingRepState::ScriptSentNotifyL(TBool aReply)
- {
- if (aReply)
- {
- IF_DEBUG(Print(_L("TDpsSendingRepState::ScriptSent reply")));
- if (KErrNone == iStateMachine->CurError())
- {
- // this is the normal situation, inform the client
- User::RequestComplete(iStateMachine->DpsEngine()->EventRequest(),
- KErrNone);
- }
- else
- {
- // this is the error situation, do not inform the client. and
- // we need to subscribe for the new event.
- iStateMachine->ScriptReceiver()->WaitForReceive();
- }
- iStateMachine->Initialize();
- }
- else
- {
- IF_DEBUG(Print(_L(
- "TDpsSendingRepState::ScriptSent shoul not get request!!!")));
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingRepState::ScriptReceivedNotifyL(TBool /*aReply*/)
- {
- IF_DEBUG(Print(_L("TDpsSendingRepState::ScriptReceived")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsSendingRepState::Error(TInt /*aErr*/)
- {
- return;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsstatemachine.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements the dps state machine.
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsstatemachine.h"
-#include "dpsscriptreceiver.h"
-#include "dpsscriptsender.h"
-#include "dpstransaction.h"
-#include "dpsconst.h"
-#include "pictbridge.h"
-#include "dpsparam.h"
-#include "dpsoperation.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsStateMachine* CDpsStateMachine::NewL(CDpsEngine* aEngine)
- {
- IF_DEBUG(Print(_L("CDpsStateMachine::NewL")));
- CDpsStateMachine* self = new(ELeave) CDpsStateMachine(aEngine);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsStateMachine::~CDpsStateMachine()
- {
- IF_DEBUG(Print(_L(">>>~CDpsStateMachine")));
- delete iTrader;
- iTrader = NULL;
- delete iScriptReceiver;
- iScriptReceiver = NULL;
- delete iScriptSender;
- iScriptSender = NULL;
-
- delete iIdleState; iIdleState = NULL;
- delete iSendingReqState; iSendingReqState = NULL;
- delete iWaitingRepState; iWaitingRepState = NULL;
- delete iSendingRepState; iSendingRepState = NULL;
- IF_DEBUG(Print(_L("<<<~CDpsStateMachine")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsStateMachine::CDpsStateMachine(CDpsEngine* aEngine) :
- iEngine(aEngine),iOperation(EDpsOpEmpty), iEvent(EDpsEvtEmpty),
- iCurError(KErrNone)
- {
- IF_DEBUG(Print(_L(">>>CDpsStateMachine::Ctor")));
-
- IF_DEBUG(Print(_L("<<<CDpsStateMachine::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::ConstructL()
- {
- IF_DEBUG(Print(_L(">>>CDpsStateMachine::ConstructL")));
- iIdleState = new(ELeave) TDpsIdleState(this);
- iSendingReqState = new(ELeave) TDpsSendingReqState(this);
- iWaitingRepState = new(ELeave) TDpsWaitingRepState(this);
- iSendingRepState = new(ELeave) TDpsSendingRepState(this);
- iCurState = iIdleState;
- iTrader = CDpsTransaction::NewL(this);
- iScriptReceiver = CDpsScriptReceiver::NewL(this);
- iScriptSender = CDpsScriptSender::NewL(this);
- IF_DEBUG(Print(_L("<<<CDpsOperator::ConstructL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::StartTransactionL(TMDpsOperation* aRequest)
- {
- IF_DEBUG(Print(_L(">>>CDpsStateMachine::StartTransaction")));
- iMOperation = aRequest;
- iOperation = (TDpsOperation)iMOperation->iOperation;
- iTrader->CreateRequestL(aRequest);
- iCurState = iSendingReqState;
- IF_DEBUG(Print(_L("<<<CDpsStateMachine::StartTransaction")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsStateMachine::Initialize()
- {
- IF_DEBUG(Print(_L(">>>CDpsStateMachine::Initialize")));
- iOperation = EDpsOpEmpty;
- iEvent = EDpsEvtEmpty;
- iCurError = KErrNone;
- if (CurState() != IdleState())
- {
- SetState(IdleState());
- }
- IF_DEBUG(Print(_L("<<<CDpsStateMachine::Initialize")));
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpstransaction.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class creates and parses dps operations.
-*
-*/
-
-
-#include <e32base.h>
-#include <e32debug.h>
-#include <pathinfo.h>
-#include <s32file.h>
-#include "dpstransaction.h"
-#include "dpsscriptsender.h"
-#include "dpsdefs.h"
-#include "dpsxmlparser.h"
-#include "dpsxmlgenerator.h"
-#include "dpsconst.h"
-#include "dpsfile.h"
-#include "dpsstatemachine.h"
-#include "dpsscriptreceiver.h"
-#include "pictbridge.h"
-#include <xml/parser.h>
-#include "dpsparam.h"
-#include "dpsoperation.h"
-#include "dpsxmlstring.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TInt KPathLength = 3;
-const TInt KPercentagePosition = 3;
-const TInt KPercentage = 100;
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsTransaction* CDpsTransaction::NewL(CDpsStateMachine* aOperator)
- {
- IF_DEBUG(Print(_L("CDpsTransaction::NewL")));
- CDpsTransaction* self = new(ELeave) CDpsTransaction(aOperator);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsTransaction::CDpsTransaction(CDpsStateMachine* aOperator) :
- iOperator(aOperator), iReply(EFalse)
- {
- IF_DEBUG(Print(_L("CDpsTransaction::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::ConstructL()
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::ConstructL")));
- iFile = CDpsFile::NewL();
- iXmlGen = CDpsXmlGenerator::NewL(iOperator->DpsEngine());
- iXmlPar = CDpsXmlParser::NewL(iOperator->DpsEngine());
- IF_DEBUG(Print(_L("<<<CDpsTransaction::ConstructL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsTransaction::~CDpsTransaction()
- {
- IF_DEBUG(Print(_L(">>>~CDpsTransaction")));
- delete iXmlPar;
- iXmlPar = NULL;
-
- delete iXmlGen;
- iXmlGen = NULL;
-
- delete iFile;
- iFile = NULL;
-
- IF_DEBUG(Print(_L("<<<~CDpsTransaction")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::CreateRequestL(TMDpsOperation* aOperation)
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateRequest ")));
- IF_DEBUG(Print(_L(" the request is %d"), aOperation->iOperation));
- TDpsArgArray args;
- TDpsEleArray elements;
- TDpsAttribute attrib = 0;
- CleanupClosePushL(args);
- CleanupClosePushL(elements);
- RFileWriteStream writer;
- writer.PushL();
- TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
- defaultPath.Append(KDpsDeviceRequestFileName);
- User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath,
- EFileWrite));
- IF_DEBUG(Print(_L("*** file created ")));
- User::LeaveIfError(aOperation->FillReqArgs(args, elements, attrib, this));
- aOperation->CreateReqScriptL(args, elements, attrib, writer, this);
- writer.CommitL();
- writer.Pop();
- writer.Release();
- User::LeaveIfError(iOperator->ScriptSender()->SendScript(EFalse));
- CleanupStack::PopAndDestroy(&elements);
- CleanupStack::PopAndDestroy(&args);
- IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateRequest ")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::Filter(TDes8& aScript)
- {
- TInt size = aScript.Size();
- IF_DEBUG(Print(_L(">>>CDpsTransaction::Filter size %d"), size));
-
- for (TInt i = 0; i < size; )
- {
- // removes any unprintalbe char between two XML attributes, e.g.
- // between > and <
- if (aScript[i] >= KSOH && aScript[i] <= KSpace && aScript[i -1] == '>')
- {
- aScript.Delete(i, 1);
- size--;
- }
- else
- {
- i++;
- }
- }
- IF_DEBUG(Print(_L("<<<CDpsTransaction::Filter size %d"), size));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::ParseScriptL(TBool aReply)
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::ParseScript")));
- iReply = aReply;
- TInt size;
- iFile->FileSizeL(iOperator->ScriptReceiver()->FileNameAndPath(), size);
- HBufC8* script = HBufC8::NewLC(size);
- TPtr8 ptr_script = script->Des();
- iFile->GetContentL(iOperator->ScriptReceiver()->FileNameAndPath(),
- ptr_script);
- Filter(ptr_script);
- iXmlPar->Reset();
- CParser* parser = CParser::NewLC(KDpsXmlMimeType, *iXmlPar);
- Xml::ParseL(*parser, ptr_script);
- TDpsArgArray args; iXmlPar->GetParameters(args);
-
-#ifdef _DEBUG
- //print what we get now
- TBuf<KMaxArgLen> print;
- for (TInt i = 0; i < args.Count(); i++)
- {
- print.Copy(args[i].iContent);
- IF_DEBUG(Print(_L("element %d content %S"),
- args[i].iElement, &print));
- }
-#endif
-
- if (aReply)
- {
- TMDpsOperation* op = iOperator->MOperation();
- User::LeaveIfError(op->FillRepArgs(args, this));
- iXmlPar->SetOperationResult(op->iResult);
- }
- else
- {
- TDpsResult result;
- result.iMajorCode = EDpsResultOk;
- result.iMinorCode = EDpsResultNone;
- if (iXmlPar->IsEvent())
- {
- TDpsEvent event = iXmlPar->Event();
- iOperator->SetEvent(event);
- if (event == EDpsEvtNotifyJobStatus)
- {
- User::LeaveIfError(iOperator->DpsEngine()->Event()->
- iJobEvent.FillRepArgs(args, this));
- }
- else
- {
- User::LeaveIfError(iOperator->DpsEngine()->Event()->
- iPrinterEvent.FillRepArgs(args, this));
- }
- CreateEventReplyL(event, result);
- }
- else
- {
- // the request from the host is only this one:
- // GetFileID and used by DPOF printing
- TDpsOperation ope = iXmlPar->Operation();
- iOperator->SetOperation(ope);
- if (iOperator->Operation() != EDpsOpGetFileID)
- {
- User::Leave(KErrNotSupported);
- }
- CreateRequestReplyL(args, result);
- }
- }
- CleanupStack::PopAndDestroy(parser);
- CleanupStack::PopAndDestroy(script);
- IF_DEBUG(Print(_L("<<<CDpsTransaction::ParseScript")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::HandleHostRequestError(TInt aErr)
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::HandleHostRequestError %d"), aErr));
- TDpsResult result;
- // here we need to map the aErr to Dps standard error
- switch (aErr)
- {
- case KErrNotSupported:
- result.iMajorCode = EDpsResultNotRecognized;
- result.iMinorCode = EDpsResultNone;
- break;
-
- case KErrArgument:
- result.iMajorCode = EDpsResultNotSupported;
- result.iMinorCode = EDpsResultillegalParam;
- break;
-
- default:
- IF_DEBUG(Print(_L("unknown err")));
- return;
- }
- TRAP_IGNORE(CreateEventReplyL(iXmlPar->Event(), result));
-
- IF_DEBUG(Print(_L("<<<CDpsTransaction::HandleHostRequestError")));
- return;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsTransaction::ConvertVersion(TLex8& aParser, TDpsVersion& aVersion)
- {
- aParser.Mark();
- while (!aParser.Eos())
- {
- TChar c = aParser.Peek();
- if (!c.IsDigit())
- {
- break;
- }
- aParser.Inc();
- }
- TPtrC8 token = aParser.MarkedToken();
- TLex8 converter(token);
- TInt error = converter.Val(aVersion.iMajor);
-
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("\t convert error 1")));
- return error;
- }
- IF_DEBUG(Print(_L("verion major %d"), aVersion.iMajor));
- aParser.Inc();
- TPtrC8 tokenDe = aParser.Remainder();
- converter.Assign(tokenDe);
- error = converter.Val(aVersion.iMinor);
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("\t convert error 2")));
- return error;
- }
- IF_DEBUG(Print(_L("verion minor %d"), aVersion.iMinor));
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsTransaction::ParsePercentage(const TDes8& aPer)
- {
- TLex8 parser(aPer);
- parser.Mark();
- parser.Inc(KPercentagePosition);
- TPtrC8 digital = parser.MarkedToken();
- TLex8 converter(digital);
- TInt num1;
- TInt error = converter.Val(num1);
- if (error != KErrNone)
- {
- return error;
- }
-
- parser.Inc(1);
- parser.Mark();
- parser.Inc(KPercentagePosition);
- digital.Set(parser.MarkedToken());
- converter.Assign(digital);
- TInt num2;
- error = converter.Val(num2);
- if (error != KErrNone)
- {
- return error;
- }
-
- TReal per = (TReal)num1 / (TReal)num2 * KPercentage;
- return (TInt)per;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::CreateEventReplyL(TDpsEvent aEvent,
- const TDpsResult& aResult)
-
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateReply")));
- IF_DEBUG(Print(_L
- (" the operation reply is %d"), iOperator->Operation()));
- IF_DEBUG(Print(_L("\t the event reply is %d"), iOperator->Event()));
- RFileWriteStream writer;
- writer.PushL();
- TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
- defaultPath.Append(KDpsDeviceResponseFileName);
- User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath,
- EFileWrite));
- IF_DEBUG(Print(_L("*** file created ")));
- iXmlGen->CreateResultScriptL(aEvent, writer, aResult);
- writer.CommitL();
- writer.Pop();
- writer.Release();
- User::LeaveIfError(iOperator->ScriptSender()->SendScript(ETrue));
- IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateReply")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::CreateRequestReplyL(const TDpsArgArray& aArgs,
- const TDpsResult& aResult)
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::CreateRequestReply")));
- TInt count = aArgs.Count();
- TInt basePathId;
- TBuf8<KMaxArgLen> filePath;
- TLex8 converter;
-
- for (TInt i = 0; i < count; i++)
- {
- switch (aArgs[i].iElement)
- {
- case EDpsArgBasePathID:
- converter.Assign(aArgs[i].iContent);
- User::LeaveIfError(converter.Val(basePathId));
- break;
-
- case EDpsArgFilePath:
- filePath.Copy(aArgs[i].iContent);
- break;
-
- default:
- __IF_DEBUG(Print(_L("***wrong args")));
- User::Leave(KErrArgument);
- break;
- }
- TUint32 fileId;
-
- SubstitutePath(filePath);
- TBuf<KMaxArgLen> file;
- file.Copy(filePath);
- User::LeaveIfError(iOperator->DpsEngine()->
- Ptp().GetObjectHandleByName(file, fileId));
- TDpsArg arg;
- arg.iElement = EDpsArgFileID;
- arg.iContent.AppendNumFixedWidth(fileId, EHex, KFullWordWidth);
- RFileWriteStream writer;
- writer.PushL();
- TFileName defaultPath = iOperator->DpsEngine()->DpsFolder();
- defaultPath.Append(KDpsDeviceResponseFileName);
- User::LeaveIfError(writer.Replace(iFile->FileSession(), defaultPath,
- EFileWrite));
- IF_DEBUG(Print(_L("*** file created ")));
- iXmlGen->CreateReplyScriptL(EDpsOpGetFileID, writer, aResult, arg);
- User::LeaveIfError(iOperator->ScriptSender()->SendScript(ETrue));
- writer.CommitL();
- writer.Pop();
- writer.Release();
- }
- IF_DEBUG(Print(_L("<<<CDpsTransaction::CreateRequestReply")));
- }
-
-// ---------------------------------------------------------------------------
-// The aPath is not the full file path, at least the
-// driver letter is not included. The structure of the DPOF filePath is
-// ../path/childpath/imagePrinted.jpg and GetObjectHandleByName
-// requires the full path file as e:\images\image1.jpg
-// the basePathId is not useful because it is always the fileId
-// of AUTPRINT.MRK. But since DPOF is always used for the removable
-// media, we assume that images are only stored in removable media.
-// If the assumption is true (must be true), we need here first to
-// get the removable drive (hopefully only one). Then substitute
-// the / by the \ in the filePath. Finally, insert the removable drive
-// letter and : at the beginning of the filePath. The new full path
-// file can be used by GetObjectHandleByName
-// ---------------------------------------------------------------------------
-//
-void CDpsTransaction::SubstitutePath(TDes8& aPath)
- {
- IF_DEBUG(Print(_L(">>>CDpsTransaction::SubstitutePath %S"), &aPath));
- TInt size = aPath.Size();
- for (TInt i = 0; i < size; i++)
- {
- if (aPath[i] == KSlash)
- {
- aPath[i] = KBackSlash;
- }
- }
- TBuf<KPathLength> driveEWide = PathInfo::MemoryCardRootPath();
- TBuf8<KPathLength> driveENarrow;
- driveENarrow.Copy(driveEWide);
- aPath.Replace(0, KPathLength - 1, driveENarrow);
- IF_DEBUG(Print(_L("<<<CDpsTransaction::SubstitutePath %S"), &aPath));
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsusbnotifier.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,329 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements functions of set mtp personality, the
-* notification of the MTP printer connection and the
-* notification of the MTP printer disconnection.
-*
-*/
-
-
-#include <e32debug.h>
-#include <usbstates.h>
-#include <rptp.h>
-#include "dpsusbnotifier.h"
-#include "dpsconst.h"
-#include "dpsptpnotifier.h"
-#include "dpsconnectnotifier.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TInt KUnknownPersonality = 0;
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsUsbNotifier* CDpsUsbNotifier::NewL(CDpsEngine* aEngine)
- {
- IF_DEBUG(Print(_L("CDpsUsbNotifier::NewL")));
- CDpsUsbNotifier* self = new(ELeave) CDpsUsbNotifier(aEngine);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsUsbNotifier::CDpsUsbNotifier(CDpsEngine* aEngine) :
- CActive(EPriorityNormal), iEngine(aEngine),
- iPersonality(KUnknownPersonality),
- iConnectState(EUsbDeviceStateUndefined), iConfigured(EFalse),
- iConnection(CDpsEngine::ENotConnected), iRollback(EFalse)
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::Ctor")));
- CActiveScheduler::Add(this);
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsUsbNotifier::~CDpsUsbNotifier()
- {
- IF_DEBUG(Print(_L(">>>~CDpsUsbNotifier")));
- Cancel();
- Rollback();
- delete iPtpP; iPtpP = NULL;
- delete iConnectP; iConnectP = NULL;
- iUsbM.Close();
- iUsbW.Close();
- IF_DEBUG(Print(_L("<<<~CDpsUsbNotifier")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::ConstructL()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConstructL")));
- User::LeaveIfError(iUsbM.Connect());
- User::LeaveIfError(iUsbW.Connect());
- iPtpP = CDpsPtpNotifier::NewL(this);
- iConnectP = CDpsConnectNotifier::NewL(this);
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConstructL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::WaitForPrinterNotify()
- {
- IF_DEBUG(Print(_L("CDpsUsbNotifier::WaitForPrinterNotify")));
- iPtpP->ChangePtpPersonality();
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::CancelPrinterNotify()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::CancelPrinterNotify")));
- if (CDpsEngine::ENotConnected == iConnection)
- {
- iPtpP->Cancel();
- iConfigured = EFalse;
- }
- else if (CDpsEngine::EPrinterConnected == iConnection)
- {
- iConnectP->Cancel();
- }
- // if the request is replied through RunL before the cancel
- // iPrinterConnectRequest will be NULL and we don't need to cancel anything
- if (iEngine->PrinterConnectRequest())
- {
- User::RequestComplete(iEngine->PrinterConnectRequest(), KErrCancel);
- }
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::CancelWaitForPrinterNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::ConnectNotify()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConnectNotify")));
- iConnectP->ConnectNotify();
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConnectNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::Rollback()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::Rollback")));
- // only when the personality has changed, we switch back to the previous
- // personality
- if (iPersonality)
- {
- TInt personalityId = KUsbPersonalityIdMTP;
- iUsbM.GetCurrentPersonalityId(personalityId);
- IF_DEBUG(Print(_L("CDpsUsbNotifier::Rollback, current personality= %d"), personalityId));
- if(KUsbPersonalityIdPCSuiteMTP != personalityId)
- {
- if (!iConfigured || iRollback)
- {
- iUsbW.SetPreviousPersonality();
- }
- else
- {
- iUsbW.SetPreviousPersonalityOnDisconnect();
- }
- }
- }
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::Rollback")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::PtpNotify(TInt aErr)
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PtpNotify %x %d"),
- iConnectState, aErr));
- if (aErr == KErrNone)
- {
- // personality changed to MTP, but cable is not connected
- if (iConnectState != EUsbDeviceStateUndefined)
- {
- if (!IsActive())
- {
- iEngine->Ptp().IsDpsPrinter(iStatus);
- SetActive();
- }
- }
- else
- {
- iConnection = CDpsEngine::ENotConnected;
- User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);
- }
- }
- else
- {
- iConnection = CDpsEngine::EWrongPrintModeConnected;
- User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);
- }
-
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::PtpNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::PersonalityChanged()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PersonalityChanged %x"),
- iPersonality));
- if (iPersonality != KUsbPersonalityIdMTP)
- {
- iConnection = CDpsEngine::EWrongPrintModeConnected;
- iConfigured = EFalse;
- if (iEngine->PrinterConnectRequest())
- {
- User::RequestComplete(iEngine->PrinterConnectRequest(),
- iConnection);
- }
- }
- // when UI gets this notification, it must quit. As the result, the dps
- // engine will be deleted so we do not need to care the further change.
-
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::PersonalityChanged ")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::RunL()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::RunL")));
-
- if (EPrinterAvailable == iStatus.Int())
- {
- iConnection = CDpsEngine::EPrinterConnected;
- iConfigured = ETrue;
- iEngine->SetDpsFolder(iEngine->Ptp().PtpFolder());
- }
- else if (iStatus.Int() != KErrCancel)
- {
- iConnection = CDpsEngine::EOtherConnected;
- }
- User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);
-
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::RunL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::DoCancel()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DoCancel")));
- iEngine->Ptp().CancelIsDpsPrinter();
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DoCancel")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsUsbNotifier::RunError(TInt aErr)
- {
- IF_DEBUG(Print(_L("CDpsUsbNotifier::RunError is %d"), aErr));
- return aErr;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsUsbNotifier::DisconnectNotify(TUsbDeviceState aState)
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::DisconnectNotify %d"), aState));
- if (iConfigured)
- {
- iConnection = CDpsEngine::EPrinterDisconnected;
- }
- else
- {
- iConnection = CDpsEngine::ENotConnected;
- }
- iConfigured = EFalse;
- if (EUsbDeviceStateUndefined == aState)
- {
- iRollback = ETrue;
- }
- if (iEngine->PrinterConnectRequest())
- {
- User::RequestComplete(iEngine->PrinterConnectRequest(), iConnection);
- }
-
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::DisconnectNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TInt CDpsUsbNotifier::ConnectState()
- {
- IF_DEBUG(Print(_L(">>>CDpsUsbNotifier::ConnectState")));
- TInt ret = iUsbM.GetDeviceState(iConnectState);
- IF_DEBUG(Print(_L("<<<CDpsUsbNotifier::ConnectState %x"), iConnectState));
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TBool CDpsUsbNotifier::IsSetPrintModeIssued()
- {
- return (iPersonality != KUnknownPersonality);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TBool CDpsUsbNotifier::IsConfigured() const
- {
- return iConfigured;
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlgenerator.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class creates the dps xml script.
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsxmlgenerator.h"
-#include "pictbridge.h"
-#include "dpsconst.h"
-#include "dpsxmlstring.h"
-#include <e32debug.h>
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TInt KCodeSize = 4;
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlGenerator* CDpsXmlGenerator::NewL(CDpsEngine* aEngine)
- {
- IF_DEBUG(Print(_L("CDpsXmlGenerator::NewL")));
- CDpsXmlGenerator* self= new (ELeave) CDpsXmlGenerator(aEngine);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlGenerator::~CDpsXmlGenerator()
- {
- IF_DEBUG(Print(_L("~CDpsXmlGenerator")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlGenerator::CDpsXmlGenerator(CDpsEngine* aEngine) :
- iEngine(aEngine)
- {
- IF_DEBUG(Print(_L("CDpsXmlGenerator::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::CreateResultScriptL(TDpsEvent aEvent,
- RWriteStream& aScript,
- const TDpsResult& aResult) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreateResultScript")));
- StartDocumentL(aScript);
- StartResultL(aScript, aResult);
- if (aEvent != EDpsEvtEmpty)
- {
- CreateEventL(aScript, aEvent);
- }
- EndResultL(aScript);
- EndDocumentL(aScript);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreateResultScript")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::CreateReplyScriptL(TDpsOperation aOperation,
- RWriteStream& aScript,
- const TDpsResult& aResult,
- const TDpsArg& aArg) const
- {
- StartDocumentL(aScript);
- StartResultL(aScript, aResult);
- StartOperationL(aOperation, aScript);
- CreateArgL(aScript, aArg);
- EndOperationL(aOperation, aScript);
- EndResultL(aScript);
- EndDocumentL(aScript);
- }
-
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::StartDocumentL(RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StatrDocument")));
- aScript.WriteL(KDpsXmlHeader);
- aScript.WriteL(KDpsXmlNS);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartDocument")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::EndDocumentL(RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndDocument")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(KDpsXml);
- aScript.WriteL(KDpsXmlBraceClose);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndDocument")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::StartInputL(RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartInput")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlInput);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartInput")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::EndInputL(RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndInput")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(KDpsXmlInput);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndInput")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::StartResultL(RWriteStream& aScript,
- const TDpsResult& aResult) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartResult")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlOutput);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlResult);
- aScript.WriteL(KDpsXmlBraceClose);
- TBuf8<KCodeSize> major;
- major.NumUC(aResult.iMajorCode, EHex);
- aScript.WriteL(major);
- major.Zero();
- major.NumFixedWidthUC(aResult.iMinorCode, EHex, KCodeSize);
- aScript.WriteL(major);
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(KDpsXmlResult);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartResult")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::EndResultL(RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndResult")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(KDpsXmlOutput);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndResult")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::StartOperationL(TDpsOperation aOperation,
- RWriteStream& aScript,
- TBool aEnd) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartOperation %d"), aOperation));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsOperationStrings[aOperation - 1]);
- if (aEnd)
- {
- aScript.WriteL(KDpsXmlSlash);
- }
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartOperation")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::EndOperationL(TDpsOperation aOperation,
- RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndOperation")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(KDpsXmlSlash);
- // there is an empty op in the op enum so we must reduce one
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsOperationStrings[aOperation - 1]);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndOperation")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::CreateEventL(RWriteStream& aScript, TDpsEvent aEvent) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreatEvent")));
- aScript.WriteL(KDpsXmlBraceOpen);
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsEventStrings[aEvent - 1]);
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(KDpsXmlBraceClose);
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreatEvent")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::CreateArgL(RWriteStream& aScript,
- const TDpsArg& aArgument,
- TDpsAttribute aAttribute) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::CreatArg")));
- aScript.WriteL(KDpsXmlBraceOpen); //<
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsArgStrings[aArgument.iElement]);
- if (aAttribute != 0)
- {
- aScript.WriteL(KDpsXmlSpace); // space
- aScript.WriteL(KDpsXmlPaperSize); // paperSize
- aScript.WriteL(KDpsXmlEqual); // =
- aScript.WriteL(KDpsXmlQuote); // "
- // patch the lower four bytes zero
- aAttribute = aAttribute << KShiftLength;
- TBuf8<KFullWordWidth> string;
- string.AppendNumUC(aAttribute, EHex);
- aScript.WriteL(string); // 12345678
- aScript.WriteL(KDpsXmlQuote); // "
- }
- if (!aArgument.iContent.Compare(KNullDesC8))
- {
- aScript.WriteL(KDpsXmlSlash); // /
- aScript.WriteL(KDpsXmlBraceClose); // >
- }
- else
- {
- aScript.WriteL(KDpsXmlBraceClose); // >
- aScript.WriteL(aArgument.iContent); // 123 345 567
- aScript.WriteL(KDpsXmlBraceOpen); // <
- aScript.WriteL(KDpsXmlSlash); // /
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsArgStrings[aArgument.iElement]);
- aScript.WriteL(KDpsXmlBraceClose); // >
- }
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::CreatArg")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::StartElementL(TDpsElement aElement,
- RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::StartElement")));
- aScript.WriteL(KDpsXmlBraceOpen); //<
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsElementStrings[aElement - 1]);
- aScript.WriteL(KDpsXmlBraceClose); // >
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::StartElement")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlGenerator::EndElementL(TDpsElement aElement,
- RWriteStream& aScript) const
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlGenerator::EndElement")));
- aScript.WriteL(KDpsXmlBraceOpen); //<
- aScript.WriteL(KDpsXmlSlash);
- aScript.WriteL(iEngine->DpsParameters()->
- iDpsElementStrings[aElement - 1]);
- aScript.WriteL(KDpsXmlBraceClose); // >
- aScript.WriteL(KDpsXmlSpace);
- IF_DEBUG(Print(_L("<<<CDpsXmlGenerator::EndElement")));
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlparser.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class parses the dps xml script.
-*
-*/
-
-
-#include <e32debug.h>
-#include "dpsxmlparser.h"
-#include "dpsconst.h"
-#include "pictbridge.h"
-#include "dpsxmlstring.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-# define PRINT_DES(t)\
- {TBuf<KMaxArgLen> _buf; _buf.Copy(t);RDebug::Print(_L("---%S"), &_buf);}
-#else
-# define IF_DEBUG(t)
-# define PRINT_DES(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlParser* CDpsXmlParser::NewL(CDpsEngine* aEngine)
- {
- IF_DEBUG(Print(_L("CDpsXmlParser::NewL")));
- CDpsXmlParser* self = new (ELeave) CDpsXmlParser(aEngine);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlParser::~CDpsXmlParser()
- {
- IF_DEBUG(Print(_L(">>>~CDpsXmlParser")));
- iDpsArgs.Close();
- __IF_DEBUG(Print(_L("<<<~CDpsXmlParser")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsXmlParser::CDpsXmlParser(CDpsEngine* aEngine) : iEngine(aEngine)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::Ctor")));
- Reset();
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::Ctor")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnStartDocumentL(
- const RDocumentParameters& /*aDocParam*/, TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartDocumentL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("---, error code is %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartDocumentL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnEndDocumentL(TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndDocumentL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("---, error code is %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
-
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndDocumentL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnStartElementL(const RTagInfo& aElement,
- const RAttributeArray& aAttributes,
- TInt aErrCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartElementL")));
-
- if (aErrCode != KErrNone)
- {
- IF_DEBUG(Print(_L("---, error code is %d"), aErrCode));
- User::Leave(aErrCode);
- }
- if (aAttributes.Count() > 1)
- {
- IF_DEBUG(Print(_L("---cannot have more than one attribute!")));
- User::Leave(KErrArgument);
- }
-
- // Gets the name of the tag
- const TDesC8& name = aElement.LocalName().DesC();
-
- IF_DEBUG(Print(_L("---Start"))); PRINT_DES(name);
-
- //Checks the element
- // this is the first layer <dps>
- if (!name.Compare(KDpsXml))
- {
- iAction = EDpsXmlStart;
- }
- // this is the second layer <input|output>
- else if (!name.Compare(KDpsXmlOutput))
- {
- iAction = EDpsXmlOutput;
- }
- else if (!name.Compare(KDpsXmlInput))
- {
- // operation and event cannot be distiguised here
- iAction = EDpsXmlInput;
- }
- // this is the third layer <operation|event|result>
- else if (iAction == EDpsXmlOutput && !name.Compare(KDpsXmlResult))
- {
- // output must be result
- iAction = EDpsXmlResult;
- }
- else if (iAction == EDpsXmlInput &&
- (!name.Compare(iEngine->DpsParameters()->iDpsEventStrings[0]) ||
- !name.Compare(iEngine->DpsParameters()->iDpsEventStrings[1])))
- {
- if (!name.Compare(iEngine->DpsParameters()->iDpsEventStrings[0]))
- {
- iDpsEvent = EDpsEvtNotifyJobStatus;
- }
- else
- {
- iDpsEvent = EDpsEvtNotifyDeviceStatus;
- }
- iAction = EDpsXmlEvent;
- }
- else if (iAction == EDpsXmlInput || iAction == EDpsXmlResult)
- {
- iAction = EDpsXmlOperation;
- for (TInt i= 0; i < EDpsOpMax-1; i++) //i=0 as AppendL() method adds item on first free position in array
- {
- if (!name.Compare(iEngine->DpsParameters()->iDpsOperationStrings[i]))
- {
- IF_DEBUG(Print(_L("---found the operation")));
- PRINT_DES(name);
- iDpsOperation = (TDpsOperation)(i+1);// i+1 to by pass first operation EDpsOpEmpty in enum which is not added to array
- break;
- }
- }
- }
-
- // below is the fourth layer, e.g. the argument list/element. there
- // could be many arugments, but only one element
- else if (iAction == EDpsXmlOperation || iAction == EDpsXmlEvent)
- {
- // only element in output is capability
- if (!name.Compare(iEngine->DpsParameters()->iDpsElementStrings[0]))
- {
- IF_DEBUG(Print(_L("---the element is")));
- PRINT_DES(name);
- iElement = EDpsCapability;
- }
- else
- {
- for (TInt i = 0; i < EDpsArgMax; i++)
- {
- if (!name.Compare(iEngine->DpsParameters()->iDpsArgStrings[i]))
- {
- IF_DEBUG(Print(_L("---the argument is ")));
- PRINT_DES(name);
- TDpsArg arg;
- arg.iElement = (TDpsArgument)i;
- arg.iContent.Copy(_L(""));
- iDpsArgs.Append(arg);
- break;
- }
- }
- }
-
- }
- else
- {
- // something wrong
- IF_DEBUG(Print(_L("--- non-PB element! %S"), &name));
- User::Leave(KErrNotSupported);
- }
- if (aAttributes.Count() == 1)
- {
- ParseAttributesL(aAttributes, name);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartElementL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::ParseAttributesL(const RAttributeArray& aAttributes,
- const TDesC8& tag)
- {
- // element
- const TDesC8& name = aAttributes[0].Attribute().LocalName().DesC();
- // only "layouts" and "paperTypes" have attributes
- if (tag.Compare(KDpsXmlPaperTypes) && tag.Compare(KDpsXmlLayouts))
- {
- // error
- IF_DEBUG(Print(_L("--- this tag have no attribute")));
- PRINT_DES(name);
- User::Leave(KErrArgument);
- }
- // the element of the attributes must be "paperSize"
- if (name.Compare(KDpsXmlPaperSize))
- {
- // error
- IF_DEBUG(Print(_L("--- wrong attribute")))
- PRINT_DES(name);
- User::Leave(KErrArgument);
- }
- // value
- HBufC8* value = aAttributes[0].Value().DesC().AllocLC();
- TUint32 result;
- TLex8 converter(*value);
- TInt error = converter.Val(result, EHex);
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("--- convert error %d"), error));
- User::Leave(error);
- }
- iAttrib = result >> KShiftLength;
- CleanupStack::PopAndDestroy(value);
- IF_DEBUG(Print(_L("--- attribte value %x"), result));
-
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnEndElementL(const RTagInfo& aElement,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndElementL")));
-
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code is %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
-
- // Get the name of the tag
- const TDesC8& name = aElement.LocalName().DesC();
- PRINT_DES(name);
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndElementL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnContentL(const TDesC8& aBytes, TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnContentL content is")));
- PRINT_DES(aBytes);
-
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- if (aBytes[0] >= KSOH && aBytes[0] <= KSpace)
- {
- IF_DEBUG(Print(_L("the unprintable char %d"), aBytes[0]));
- return;
- }
- // parses the result
- if (iAction == EDpsXmlResult)
- {
- TUint32 value;
- TLex8 converter(aBytes);
- TInt error = converter.Val(value, EHex);
- if (error != KErrNone)
- {
- IF_DEBUG(Print(_L("--- convert error %d"), error));
- User::Leave(error);
- }
- IF_DEBUG(Print(_L("--- result %x"), value));
- // we have got the result
- iDpsResult.iMajorCode =
- static_cast<TDpsResultMajorCode>(value >> KShiftLength);
- iDpsResult.iMinorCode =
- static_cast<TDpsResultMinorCode>(value & KDpsMinorMask);
- }
- // gets the argument
- else if (iAction == EDpsXmlOperation || iAction == EDpsXmlEvent)
- {
- iDpsArgs[iDpsArgs.Count() - 1].iContent.Copy(aBytes);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnContentL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnStartPrefixMappingL(const RString& /*aPrefix*/,
- const RString& /*aUri*/,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnStartPrefixMappingL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnStartPrefixMappingL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnEndPrefixMappingL(const RString& /*aPrefix*/,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnEndPrefixMappingL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnEndPrefixMappingL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnIgnorableWhiteSpaceL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("---error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnIgnorableWhiteSpaceL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnSkippedEntityL(const RString& /*aName*/,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnSkippedEntityL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnSkippedEntityL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/,
- const TDesC8& /*aData*/,
- TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnProcessingInstructionL")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("--- error code %d"), aErrorCode));
- User::Leave(aErrorCode);
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnProcessingInstructionL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::OnError(TInt aErrorCode)
- {
- IF_DEBUG(Print(_L(">>>CDpsXmlParser::OnError()")));
- if (aErrorCode != KErrNone)
- {
- IF_DEBUG(Print(_L("---error code %d"), aErrorCode));
- }
- IF_DEBUG(Print(_L("<<<CDpsXmlParser::OnError()")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-
-TAny* CDpsXmlParser::GetExtendedInterface(const TInt32 aUid)
- {
- return aUid == MDpsExtensionHandler::EInterfaceUid ?
- static_cast<MDpsExtensionHandler*>(this) : 0;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsXmlParser::Reset()
- {
- iDpsArgs.Reset();
- iAction = EDpsXmlEmpty;
- iDpsEvent = EDpsEvtEmpty;
- iDpsOperation = EDpsOpEmpty;
- iElement = EDpsEleEmpty;
- iAttrib = 0;
- }
-
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlstring.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class implements the dps constant strings.
-*
-*/
-
-
-#include "dpsxmlstring.h"
-#include "dpsdefs.h"
-#include "dpsconst.h"
-#include <e32debug.h>
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsXmlString* TDpsXmlString::NewL()
- {
- TDpsXmlString* self = new (ELeave) TDpsXmlString();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsXmlString::TDpsXmlString()
- {
- iDpsOperationStrings = TDpsStrings(EDpsOpMax - 1);
- iDpsElementStrings = TDpsStrings(KDpsEleMax - 1);
- iDpsEventStrings = TDpsStrings(KDpsEvtMax - 1);
- iDpsArgStrings = TDpsStrings(EDpsArgMax);
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void TDpsXmlString::ConstructL()
- {
- // define Print Service Operations
- // ref: DPS spec page 14
- for (TInt i = 1; i < EDpsOpMax; i++)
- {
- switch (i)
- {
- case EDpsOpConfigPrintService:
- iDpsOperationStrings.AppendL(_L8("configurePrintService"));
- break;
-
- case EDpsOpGetCapability:
- iDpsOperationStrings.AppendL(_L8("getCapability"));
- break;
-
- case EDpsOpGetJobStatus:
- iDpsOperationStrings.AppendL(_L8("getJobStatus"));
- break;
-
- case EDpsOpGetDeviceStatus:
- iDpsOperationStrings.AppendL(_L8("getDeviceStatus"));
- break;
-
- case EDpsOpStartJob:
- iDpsOperationStrings.AppendL(_L8("startJob"));
- break;
-
- case EDpsOpAbortJob:
- iDpsOperationStrings.AppendL(_L8("abortJob"));
- break;
-
- // define Storage Service Operation
- // ref: DPS spec page 34
- case EDpsOpContinueJob:
- iDpsOperationStrings.AppendL(_L8("continueJob"));
- break;
-
- case EDpsOpGetFileID:
- iDpsOperationStrings.AppendL(_L8("getFileID"));
- break;
-
- case EDpsOpGetFileInfo:
- iDpsOperationStrings.AppendL(_L8("getFileInfo"));
- break;
-
- case EDpsOpGetFile:
- iDpsOperationStrings.AppendL(_L8("getFile"));
- break;
-
- case EDpsOpGetPartialFile:
- iDpsOperationStrings.AppendL(_L8("getPartialFile"));
- break;
-
- case EDpsOpGetFileList:
- iDpsOperationStrings.AppendL(_L8("getFileList"));
- break;
-
- case EDpsOpGetThumb:
- iDpsOperationStrings.AppendL(_L8("getThumb"));
- break;
-
- default:
- IF_DEBUG(Print(_L("wrong in OperationString")));
- User::Leave(KErrArgument);
- break;
- }
- }
-
- // define the special element which includes other elements
- for (TInt i = 1; i < KDpsEleMax; i++)
- {
- switch(i)
- {
- case EDpsCapability:
- iDpsElementStrings.AppendL(_L8("capability"));
- break;
-
- case EDpsJobConfig:
- iDpsElementStrings.AppendL(_L8("jobConfig"));
- break;
-
- case EDpsPrintInfo:
- iDpsElementStrings.AppendL(_L8("printInfo"));
- break;
-
- default:
- IF_DEBUG(Print(_L("wrong in ElementString")));
- User::Leave(KErrArgument);
- break;
- }
- }
-
- // define Print Service Event Notification
- // ref: DPS spec page 14
- for (TInt i = 1; i < KDpsEvtMax; i++)
- {
- switch(i)
- {
- case EDpsEvtNotifyJobStatus:
- iDpsEventStrings.AppendL(_L8("notifyJobStatus"));
- break;
-
- case EDpsEvtNotifyDeviceStatus:
- iDpsEventStrings.AppendL(_L8("notifyDeviceStatus"));
- break;
-
- default:
- IF_DEBUG(Print(_L("wrong in Event String")));
- User::Leave(KErrArgument);
- break;
- }
- }
-
- for (TInt i = 0; i < EDpsArgMax; i++)
- {
- switch (i)
- {
- case EDpsArgDpsVersions:
- iDpsArgStrings.AppendL(_L8("dpsVersions"));
- break;
-
- case EDpsArgVendorName:
- iDpsArgStrings.AppendL(_L8("vendorName"));
- break;
-
- case EDpsArgVendorSpecificVersion:
- iDpsArgStrings.AppendL(_L8("vendorSpecificVersion"));
- break;
-
- case EDpsArgProductName:
- iDpsArgStrings.AppendL(_L8("productName"));
- break;
-
- case EDpsArgSerialNo:
- iDpsArgStrings.AppendL(_L8("serialNo"));
- break;
-
- case EDpsArgPrintServiceAvailable:
- iDpsArgStrings.AppendL(_L8("printServiceAvailable"));
- break;
-
- case EDpsArgQualities:
- iDpsArgStrings.AppendL(_L8("qualities"));
- break;
-
- case EDpsArgPaperSizes:
- iDpsArgStrings.AppendL(_L8("paperSizes"));
- break;
-
- case EDpsArgPaperTypes:
- iDpsArgStrings.AppendL(_L8("paperTypes"));
- break;
-
- case EDpsArgFileTypes:
- iDpsArgStrings.AppendL(_L8("fileTypes"));
- break;
-
- case EDpsArgDatePrints:
- iDpsArgStrings.AppendL(_L8("datePrints"));
- break;
-
- case EDpsArgFileNamePrints:
- iDpsArgStrings.AppendL(_L8("fileNamePrints"));
- break;
-
- case EDpsArgImageOptimizes:
- iDpsArgStrings.AppendL(_L8("imageOptimizes"));
- break;
-
- case EDpsArgLayouts:
- iDpsArgStrings.AppendL(_L8("layouts"));
- break;
-
- case EDpsArgFixedSizes:
- iDpsArgStrings.AppendL(_L8("fixedSizes"));
- break;
-
- case EDpsArgChroppings:
- iDpsArgStrings.AppendL(_L8("chroppings"));
- break;
-
- case EDpsArgPrtPID:
- iDpsArgStrings.AppendL(_L8("prtPID"));
- break;
-
- case EDpsArgFilePath:
- iDpsArgStrings.AppendL(_L8("filePath"));
- break;
-
- case EDpsArgCopyID:
- iDpsArgStrings.AppendL(_L8("copyID"));
- break;
-
- case EDpsArgProgress:
- iDpsArgStrings.AppendL(_L8("progress"));
- break;
-
- case EDpsArgImagePrinted:
- iDpsArgStrings.AppendL(_L8("imagePrinted"));
- break;
-
- case EDpsArgDpsPrintServiceStatus:
- iDpsArgStrings.AppendL(_L8("dpsPrintServiceStatus"));
- break;
-
- case EDpsArgJobEndReason:
- iDpsArgStrings.AppendL(_L8("jobEndReason"));
- break;
-
- case EDpsArgErrorStatus:
- iDpsArgStrings.AppendL(_L8("errorStatus"));
- break;
-
- case EDpsArgErrorReason:
- iDpsArgStrings.AppendL(_L8("errorReason"));
- break;
-
- case EDpsArgDisconnectEnable:
- iDpsArgStrings.AppendL(_L8("disconnectEnable"));
- break;
-
- case EDpsArgCapabilityChanged:
- iDpsArgStrings.AppendL(_L8("capabilityChanged"));
- break;
-
- case EDpsArgNewJobOk:
- iDpsArgStrings.AppendL(_L8("newJobOK"));
- break;
-
- case EDpsArgQuality:
- iDpsArgStrings.AppendL(_L8("quality"));
- break;
-
- case EDpsArgPaperSize:
- iDpsArgStrings.AppendL(_L8("paperSize"));
- break;
-
- case EDpsArgPaperType:
- iDpsArgStrings.AppendL(_L8("paperType"));
- break;
-
- case EDpsArgFileType:
- iDpsArgStrings.AppendL(_L8("fileType"));
- break;
-
- case EDpsArgDatePrint:
- iDpsArgStrings.AppendL(_L8("datePrint"));
- break;
-
- case EDpsArgFileNamePrint:
- iDpsArgStrings.AppendL(_L8("fileNamePrint"));
- break;
-
- case EDpsArgImageOptimize:
- iDpsArgStrings.AppendL(_L8("imageOptimize"));
- break;
-
- case EDpsArgLayout:
- iDpsArgStrings.AppendL(_L8("layout"));
- break;
-
- case EDpsArgFixedSize:
- iDpsArgStrings.AppendL(_L8("fixedSize"));
- break;
-
- case EDpsArgCropping:
- iDpsArgStrings.AppendL(_L8("cropping"));
- break;
-
- case EDpsArgCroppingArea:
- iDpsArgStrings.AppendL(_L8("croppingArea"));
- break;
-
- case EDpsArgFileID:
- iDpsArgStrings.AppendL(_L8("fileID"));
- break;
-
- case EDpsArgFileName:
- iDpsArgStrings.AppendL(_L8("fileName"));
- break;
-
- case EDpsArgDate:
- iDpsArgStrings.AppendL(_L8("date"));
- break;
-
- case EDpsArgCopies:
- iDpsArgStrings.AppendL(_L8("copies"));
- break;
-
- case EDpsArgAbortStyle:
- iDpsArgStrings.AppendL(_L8("abortStyle"));
- break;
-
- case EDpsArgImagesPrinted:
- iDpsArgStrings.AppendL(_L8("imagesPrinted"));
- break;
-
- case EDpsArgBasePathID:
- iDpsArgStrings.AppendL(_L8("basePathID"));
- break;
-
- case EDpsArgFileSize:
- iDpsArgStrings.AppendL(_L8("fileSize"));
- break;
-
- case EDpsArgThumbFormat:
- iDpsArgStrings.AppendL(_L8("thumbFormat"));
- break;
-
- case EDpsArgThumbSize:
- iDpsArgStrings.AppendL(_L8("thumbSize"));
- break;
-
- case EDpsArgBytesRead:
- iDpsArgStrings.AppendL(_L8("bytesRead"));
- break;
-
- case EDpsArgOffset:
- iDpsArgStrings.AppendL(_L8("offset"));
- break;
-
- case EDpsArgMaxSize:
- iDpsArgStrings.AppendL(_L8("maxSize"));
- break;
-
- case EDpsArgParentFileID:
- iDpsArgStrings.AppendL(_L8("parentFileID"));
- break;
-
- case EDpsArgMaxNumIDs:
- iDpsArgStrings.AppendL(_L8("maxNumIDs"));
- break;
-
- case EDpsArgFileIDs:
- iDpsArgStrings.AppendL(_L8("fileIDs"));
- break;
-
- case EDpsArgNumIDs:
- iDpsArgStrings.AppendL(_L8("numIDs"));
- break;
-
- default:
- IF_DEBUG(Print(_L("wrong in ArgString")));
- User::Leave(KErrArgument);
- break;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsXmlString::~TDpsXmlString()
- {
- iDpsArgStrings.Close();
- iDpsElementStrings.Close();
- iDpsEventStrings.Close();
- iDpsOperationStrings.Close();
- }
--- a/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/pictbridge.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +0,0 @@
-/*
-* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This class defines and implements the API for UI engine.
-*
-*/
-
-
-#include <e32base.h>
-#include <e32debug.h>
-#include <dps.rsg>
-#include <f32file.h>
-#include <barsc.h>
-#include <barsread.h>
-#include <bautils.h>
-#include <pathinfo.h>
-
-#include "pictbridge.h"
-#include "dpsdefs.h"
-#include "dpsxmlstring.h"
-#include "dpsconst.h"
-#include "dpsstatemachine.h"
-#include "dpsscriptreceiver.h"
-#include "dpsusbnotifier.h"
-#include "dpsparam.h"
-#include "dpsscriptsender.h"
-#include "dpstransaction.h"
-#include "dpsfile.h"
-
-#ifdef _DEBUG
-# define IF_DEBUG(t) {RDebug::t;}
-#else
-# define IF_DEBUG(t)
-#endif
-
-const TInt KResource = 32;
-const TInt KDriver = 3;
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CDpsEngine* CDpsEngine::GetEngineL()
- {
- IF_DEBUG(Print(_L("CDpsEngine::GetEngineL")));
- CDpsEngine* me;
- me = static_cast<CDpsEngine*>(Dll::Tls());
- if (!me)
- {
- CDpsEngine* self = new(ELeave) CDpsEngine();
-
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop();
- User::LeaveIfError(Dll::SetTls(self));
- return self;
- }
- else
- {
- return me;
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::Delete()
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::Delete")));
- CDpsEngine *me; me = static_cast<CDpsEngine*>(Dll::Tls());
- if (me)
- {
- delete me;
- Dll::SetTls(NULL);
- }
- IF_DEBUG(Print(_L("<<<DpsEngine::Delete")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsEngine::ConstructL()
- {
- IF_DEBUG(Print(_L(">>>CDpsEngine::ConstructL")));
- iDpsParameters = TDpsXmlString::NewL();
- User::LeaveIfError(iPtp.Connect());
- iDpsOperator = CDpsStateMachine::NewL(this);
- iUsbNotifier = CDpsUsbNotifier::NewL(this);
- IF_DEBUG(Print(_L("<<<DpsEngine::ConstructL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-CDpsEngine::~CDpsEngine()
- {
- IF_DEBUG(Print(_L(">>>~CDpsEngine")));
-
- delete iDpsOperator;
- iDpsOperator = NULL;
-
- delete iUsbNotifier;
- iUsbNotifier = NULL;
-
- if (iDpsOperationRequest)
- {
- User::RequestComplete(iDpsOperationRequest, KErrCancel);
- }
- if (iDpsEventRequest)
- {
- User::RequestComplete(iDpsEventRequest, KErrCancel);
- }
- if (iPrinterConnectRequest)
- {
- User::RequestComplete(iPrinterConnectRequest, KErrCancel);
- }
- delete iDpsParameters;
- iDpsParameters = NULL;
- iPtp.Close();
- IF_DEBUG(Print(_L("<<<~CDpsEngine")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::SetPrintMode(TRequestStatus& aStatus)
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::SearchPrinter")));
-
- iPrinterConnectRequest = &aStatus;
- *iPrinterConnectRequest = KRequestPending;
- iUsbNotifier->WaitForPrinterNotify();
- IF_DEBUG(Print(_L("<<<DpsEngine::SearchPrinter")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::CancelPrintMode()
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::CancelSearchPrinter")));
- iUsbNotifier->CancelPrinterNotify();
- IF_DEBUG(Print(_L("<<<DpsEngine::CancelSearchPrinter")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::ConnectStateNotify(TRequestStatus& aStatus)
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::ConnectStateNotifyL")));
- // SetPrintMode must be finished
- if (!iUsbNotifier->IsSetPrintModeIssued())
- {
- TRequestStatus* status = &aStatus;
- User::RequestComplete(status, KErrNotReady);
- return;
- }
-
- iPrinterConnectRequest = &aStatus;
- *iPrinterConnectRequest = KRequestPending;
- iUsbNotifier->ConnectNotify();
- IF_DEBUG(Print(_L("<<<DpsEngine::ConnecStatetNotifyL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::DoDpsRequestL(TMDpsOperation* aRequest,
- TRequestStatus& aStatus)
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::DoDpsRequestL")));
- // the ptp printer must be connected and registered for the dps event
- if (!iUsbNotifier->IsConfigured() || !iDpsEventRequest)
- {
- TRequestStatus* status = &aStatus;
- User::RequestComplete(status, KErrNotReady);
- return;
- }
-
- // there is a request from the host received and the reply has been
- // sending out, but the host has not received it yet. we can not send
- // the device request now
- IF_DEBUG(Print(_L("curState is %x, idleState is %x"),
- iDpsOperator->CurState(), iDpsOperator->IdleState()));
- if (iDpsOperator->CurState() != iDpsOperator->IdleState())
- {
- TRequestStatus* status = &aStatus;
- User::RequestComplete(status, KErrInUse);
- return;
- }
-
- iDpsOperator->StartTransactionL(aRequest);
- iDpsOperationRequest = &aStatus;
- *iDpsOperationRequest = KRequestPending;
- IF_DEBUG(Print(_L("<<<DpsEngine::DoDpsRequestL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::CancelDpsRequest()
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::CancelDpsOperation")));
- if (iDpsOperationRequest)
- {
- iDpsOperator->ScriptSender()->Cancel();
- User::RequestComplete(iDpsOperationRequest, KErrCancel);
- }
- iDpsOperator->Initialize();
- IF_DEBUG(Print(_L("<<<DpsEngine::CancelDpsOperation")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::DpsEventNotify(TDpsEvents& aParam,
- TRequestStatus& aStatus)
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::DpsEventNotify")));
- // the PTP printer must be connected and registered for the disconnect
- if (!iUsbNotifier->IsConfigured() || !iPrinterConnectRequest)
- {
- TRequestStatus* status = &aStatus;
- User::RequestComplete(status, KErrNotReady);
- return;
- }
-
- iOutEvent = &aParam;
- iDpsEventRequest = &aStatus;
- *iDpsEventRequest = KRequestPending;
- iDpsOperator->ScriptReceiver()->WaitForReceive();
- IF_DEBUG(Print(_L("<<<DpsEngine::DpsEventNotify")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::CancelDpsEventNotify()
- {
- IF_DEBUG(Print(_L("DpsEngine::CancelDpsEventNotify")));
- if (iDpsEventRequest)
- {
- User::RequestComplete(iDpsEventRequest, KErrCancel);
- iDpsOperator->ScriptReceiver()->Cancel();
- }
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C void CDpsEngine::GetDpsConfigL(TDpsConfigPrintReq& aConfig)
- {
- IF_DEBUG(Print(_L(">>>DpsEngine::GetDpsConfigL")));
-
- RFs fs = iDpsOperator->Trader()->FileHandle()->FileSession();
- RResourceFile resource;
-
- TBuf<KResource> resourceFile(PathInfo::RomRootPath());
- TBuf<KResource> length(KDpsResource);
- resourceFile.SetLength(KDriver + length.Length());
- resourceFile.Replace(KDriver, length.Length(), KDpsResource);
- IF_DEBUG(Print(_L("file is %S"), &resourceFile));
- resource.OpenL(fs, resourceFile);
- CleanupClosePushL(resource);
- resource.ConfirmSignatureL(KDpsResourceVersion);
- HBufC8* id = resource.AllocReadLC(DPS_CONFIG);
- TResourceReader reader;
- reader.SetBuffer(id);
- TInt count = static_cast<TInt>(reader.ReadUint8());
- for (TInt i = 0; i < count; i++)
- {
- TDpsVersion version;
- version.iMajor = static_cast<TInt>(reader.ReadUint8());
- version.iMinor = static_cast<TInt>(reader.ReadUint8());
- aConfig.iDpsVersions.Append(version);
- }
- TPtrC vendorString = reader.ReadTPtrC();
- aConfig.iVendorName.Copy(vendorString);
- TDpsVersion vendorVersion;
- vendorVersion.iMajor = static_cast<TInt>(reader.ReadUint8());
- vendorVersion.iMinor = static_cast<TInt>(reader.ReadUint8());
- aConfig.iVendorVersion = vendorVersion;
- TPtrC productString = reader.ReadTPtrC();
- aConfig.iProductName.Copy(productString);
- TPtrC SerialNo = reader.ReadTPtrC();
- aConfig.iSerialNo.Copy(SerialNo);
- CleanupStack::PopAndDestroy(id);
- CleanupStack::PopAndDestroy(&resource);
- IF_DEBUG(Print(_L("<<<DpsEngine::GetDpsConfigL")));
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CDpsEngine::DpsFolder() const
- {
- return iDpsFolder;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsEvents* CDpsEngine::Event() const
- {
- return iOutEvent;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-RPtp& CDpsEngine::Ptp()
- {
- return iPtp;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TDpsXmlString* CDpsEngine::DpsParameters() const
- {
- return iDpsParameters;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TRequestStatus*& CDpsEngine::EventRequest()
- {
- return iDpsEventRequest;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TRequestStatus*& CDpsEngine::OperationRequest()
- {
- return iDpsOperationRequest;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-TRequestStatus*& CDpsEngine::PrinterConnectRequest()
- {
- return iPrinterConnectRequest;
- }
-
-// ---------------------------------------------------------------------------
-//
-// ---------------------------------------------------------------------------
-//
-void CDpsEngine::SetDpsFolder(const TDesC& aFolder)
- {
- iDpsFolder.Copy(aFolder);
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-mtp_playbackcontroldp.iby /epoc32/rom/include/mtp_playbackcontroldp.iby
-
-PRJ_MMPFILES
-mtpplaybackcontroldp.mmp
--- a/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.iby Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MTP_PLAYBACKCONTROL_IBY
-#define MTP_PLAYBACKCONTROL_IBY
-
-#if !defined(SYMBIAN_EXCLUDE_MTP)
-
-#ifdef FF_AUTOMOTIVESTACK
-// MTP Playback Control Data Provider
-ECOM_PLUGIN(mtpplaybackcontroldp.dll, mtpplaybackcontroldp.rsc)
-
-// MTP plugin registration resource file
-data=EPOCROOT##epoc32\data\Z\resource\mtp\2002EA99.rsc resource\mtp\2002EA99.rsc
-#endif
-
-
-
-#endif //SYMBIAN_EXCLUDE_MTP
-
-#endif //MTP_PLAYBACKCONTROL_IBY
--- a/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-component mtp_playbackdp
-source \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp
-
-binary \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group all
-exports \sf\mw\remoteconn\mtpdataproviders\mtpplaybackcontroldp\group
-
-notes_source \component_defs\release.src
-
-ipr E
--- a/mtpdataproviders/mtpplaybackcontroldp/group/mtpplaybackcontroldp.mmp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <comms-infras/commsdebugutility.mmh>
-
-TARGET mtpplaybackcontroldp.dll
-TARGETTYPE PLUGIN
-UID 0x10009D8D 0x2002EA98
-VENDORID 0x70000001
-
-CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData
-
-MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../mtpfws/mtpfw/dataproviders/dputility/inc
-USERINCLUDE ../../../mtpfws/mtpfw/common/inc
-USERINCLUDE ../../../mtpfws/mtpfw/inc
-
-USERINCLUDE ../mtpplaybackinterface/inc
-USERINCLUDE ../mtpplaybackmpximplementation/inc
-
-SOURCEPATH ../src
-SOURCE cmtppbcgetdevicepropdesc.cpp
-SOURCE cmtppbcgetdevicepropvalue.cpp
-SOURCE cmtppbcsetdevicepropvalue.cpp
-SOURCE cmtppbcresetdevicepropvalue.cpp
-SOURCE cmtpplaybackcontroldp.cpp
-SOURCE mtpplaybackcontroldpimplproxy.cpp
-SOURCE mtpplaybackcontroldpprocessor.cpp
-SOURCE cmtpplaybackmap.cpp
-SOURCE cmtpplaybackproperty.cpp
-SOURCE cmtppbcskip.cpp
-
-SOURCEPATH ../mtpplaybackinterface/src
-SOURCE mmtpplaybackinterface.cpp
-SOURCE cmtpplaybackcommand.cpp
-SOURCE cmtpplaybackevent.cpp
-SOURCE cmtpplaybackparam.cpp
-
-SOURCEPATH ../mtpplaybackmpximplementation/src
-SOURCE cmtpplaybackcontrolimpl.cpp
-SOURCE cmtpplaybackplaylisthelper.cpp
-SOURCE cmtpplaybackresumehelper.cpp
-SOURCE cmtpplaybackcommandchecker.cpp
-
-SOURCEPATH ../src
-START RESOURCE mtpplaybackcontroldp.rss
-TARGET mtpplaybackcontroldp.rsc
-END
-
-// Data provider configuration resource file.
-// The target filename corresponds to the implementation UID.
-START RESOURCE mtpplaybackcontroldp_config.rss
-TARGETPATH /resource/mtp
-TARGET 2002EA99.rsc
-END
-
-
-
-
-LIBRARY euser.lib
-LIBRARY efsrv.lib
-LIBRARY ecom.lib
-
-LIBRARY mtpdatatypes.lib
-LIBRARY mtpdataproviderapi.lib
-LIBRARY mtpdataproviderutility.lib
-LIBRARY mtpframework.lib
-
-LIBRARY mpxplaybackutility.lib
-LIBRARY mpxcommon.lib
-LIBRARY mpxcollectionhelper.lib
-LIBRARY mpxcollectionutility.lib
-LIBRARY platformenv.lib
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropdesc.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
- */
-
-#ifndef CMTPPBCGETPBDEVICEPROPDESC_H
-#define CMTPPBCGETPBDEVICEPROPDESC_H
-
-#include "cmtprequestprocessor.h"
-#include "mtpdebug.h"
-#include "cmtpplaybackmap.h"
-
-class CMTPTypeDevicePropDesc;
-class CMTPPlaybackControlDataProvider;
-
-/**
-Implements the device data provider GetDevicePropDesc request processor.
-@internalComponent
-*/
-class CMTPPbcGetDevicePropDesc : public CMTPRequestProcessor, public MMTPPlaybackCallback
- {
-
-public:
-
- static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- ~CMTPPbcGetDevicePropDesc();
-
-protected:
- // From CMTPRequestProcessor
- virtual TMTPResponseCode CheckRequestL();
-
-private: // From CMTPRequestProcessor
- void ServiceL();
-
-private: //From MMTPPlaybackCallback
- void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
-
-private:
- CMTPPbcGetDevicePropDesc(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-private: // Owned.
-
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- CMTPPlaybackControlDataProvider& iPlaybackControlDp;
-
- CMTPTypeDevicePropDesc* iPropDesc;
- CMTPPlaybackCommand* iPbCmd;
- };
-
-#endif //CMTPPBCGETPBDEVICEPROPDESC_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropvalue.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPBCGETPBDEVICEPROPVALUE_H
-#define CMTPPBCGETPBDEVICEPROPVALUE_H
-
-#include "cmtprequestprocessor.h"
-#include "cmtpplaybackmap.h"
-
-class CMTPPlaybackControlDataProvider;
-
-/**
-Implements the device data provider GetDevicePropValue request processor.
-@internalComponent
-*/
-class CMTPPbcGetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
- {
-
-public:
-
- static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- ~CMTPPbcGetDevicePropValue();
-
-private: // From CMTPRequestProcessor
- TMTPResponseCode CheckRequestL();
- void ServiceL();
-
-private: //From MMTPPlaybackCallback
- void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
-
-private:
- CMTPPbcGetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-private: // Owned
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- CMTPPlaybackControlDataProvider& iPlaybackControlDp;
- CMTPPlaybackCommand* iPbCmd;
- TMTPTypeInt32 iInt32;
- TMTPTypeUint32 iUint32;
- };
-
-#endif // CMTPPBCGETPBDEVICEPROPVALUE_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcresetdevicepropvalue.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPCBRESETPBDEVICEPROPVALUE_H
-#define CMTPPCBRESETPBDEVICEPROPVALUE_H
-
-#include "cmtppbcgetdevicepropdesc.h"
-#include "mtpdebug.h"
-#include "cmtpplaybackmap.h"
-
-class CMTPTypeString;
-/**
-Implements the device data provider ResetDevicePropValue request processor.
-@internalComponent
-*/
-class CMTPPbcResetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
- {
-
-public:
-
- static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- ~CMTPPbcResetDevicePropValue();
-
-private: //From MMTPPlaybackCallback
- void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
-
-private:
-
- CMTPPbcResetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-private: // From CMTPRequestProcessor
-
- TMTPResponseCode CheckRequestL();
- void ServiceL();
-
-private:
- TMTPTypeGuid* GetGUIDL( const TUint aKey);
- void SaveGUID( const TUint aKey, TMTPTypeGuid& aValue );
-
-private: // Owned
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- CMTPPlaybackControlDataProvider& iPlaybackControlDp;
- TMTPPbCtrlData iData;
- CMTPPlaybackCommand* iPbCmd;
- };
-
-#endif // CMTPPCBRESETPBDEVICEPROPVALUE_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcsetdevicepropvalue.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPBCSETPBDEVICEPROPVALUE_H
-#define CMTPPBCSETPBDEVICEPROPVALUE_H
-
-#include "cmtprequestprocessor.h"
-#include "cmtpplaybackmap.h"
-
-class CMTPTypeString;
-class CMTPPlaybackControlDataProvider;
-
-/**
-Implements the device data provider SetDevicePropValue request processor.
-@internalComponent
-*/
-class CMTPPlaybackCommand;
-
-class CMTPPbcSetDevicePropValue : public CMTPRequestProcessor, public MMTPPlaybackCallback
- {
-
-public:
-
- static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- ~CMTPPbcSetDevicePropValue();
-
-private: // From CMTPRequestProcessor
- TMTPResponseCode CheckRequestL();
- void ServiceL();
- TBool DoHandleResponsePhaseL();
-
-private: //From MMTPPlaybackCallback
- void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
-
-private:
- CMTPPbcSetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-private: // Owned
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- CMTPPlaybackControlDataProvider& iPlaybackControlDp;
- TMTPPbCtrlData iData;
- CMTPPlaybackCommand* iPbCmd;
- };
-
-#endif // CMTPPBCSETPBDEVICEPROPVALUE_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcskip.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPBCSKIP_H
-#define CMTPPBCSKIP_H
-
-#include "cmtprequestprocessor.h"
-#include "mmtpplaybackinterface.h"
-
-class CMTPPlaybackCommand;
-class CMTPPlaybackControlDataProvider;
-
-/**
-Implements the device data provider GetDevicePropValue request processor.
-@internalComponent
-*/
-class CMTPPbcSkip : public CMTPRequestProcessor, public MMTPPlaybackCallback
- {
-
-public:
-
- static MMTPRequestProcessor* NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- ~CMTPPbcSkip();
-
-private: //From MMTPPlaybackCallback
- void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr);
-
-private: // From CMTPRequestProcessor
- TMTPResponseCode CheckRequestL();
- void ServiceL();
-
-private:
- CMTPPbcSkip(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-private: // Owned
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- CMTPPlaybackControlDataProvider& iPlaybackControlDp;
- CMTPPlaybackCommand* iPbCmd;
- };
-
-#endif // CMTPPBCSKIP_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackcontroldp.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKCONTROLDP_H
-#define CMTPPLAYBACKCONTROLDP_H
-
-#include <mtp/cmtpdataproviderplugin.h>
-#include <mtp/tmtptypeevent.h>
-
-#include "mtpplaybackcontroldpconst.h"
-#include "mtpdebug.h"
-#include "mmtpplaybackinterface.h"
-
-class MMTPRequestProcessor;
-class CMTPPlaybackMap;
-class MMTPPlaybackControl;
-class CMTPPlaybackProperty;
-class CMTPPlaybackEvent;
-
-/**
-Implements the MTP playback control data provider plug-in.
-@internalComponent
-*/
-class CMTPPlaybackControlDataProvider : public CMTPDataProviderPlugin, public MMTPPlaybackObserver
- {
-public:
-
- static TAny* NewL(TAny* aParams);
- ~CMTPPlaybackControlDataProvider();
-
- CMTPPlaybackMap& GetPlaybackMap() const;
- CMTPPlaybackProperty& GetPlaybackProperty() const;
- MMTPPlaybackControl& GetPlaybackControlL();
- void RequestToResetPbCtrl();
-
-private: // From CMTPDataProviderPlugin
-
- void Cancel();
- void ProcessEventL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection);
- void ProcessNotificationL(TMTPNotification aNotification, const TAny* aParams);
- void ProcessRequestPhaseL(TMTPTransactionPhase aPhase, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
- void StartObjectEnumerationL(TUint32 aStorageId, TBool aPersistentFullEnumeration);
- void StartStorageEnumerationL();
- void Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const;
-
-private: //From MMTPPlaybackObserver
-
- void HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr);
-
-private:
-
- CMTPPlaybackControlDataProvider(TAny* aParams);
- void ConstructL();
-
- TInt LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
- void SessionClosedL(const TMTPNotificationParamsSessionChange& aSession);
- void SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession);
- void SendEventL(TMTPDevicePropertyCode aPropCode);
-
-private: // Owned
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER_MUTABLE;
-
- /**
- The event dataset.
- */
- TMTPTypeEvent iEvent;
-
- /**
- The active request processors table. Multiple request processors may be
- active in a multi-session MTP environment.
- */
- RPointerArray<MMTPRequestProcessor> iActiveProcessors;
- TInt iActiveProcessor;
- TBool iActiveProcessorRemoved;
-
- /**
- The iPlaybackMap map the device property or operation to valid playback command
- */
- CMTPPlaybackMap* iPlaybackMap;
-
- /**
- The iPlaybackProperty is a container for playback properties.
- */
- CMTPPlaybackProperty* iPlaybackProperty;
-
- /**
- The checker map the device property or operation to valid playback command
- */
- MMTPPlaybackControl* iPlaybackControl;
-
- TBool iRequestToResetPbCtrl;
- };
-
-#endif // CMTPPLAYBACKCONTROLDP_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackmap.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKMAP_H
-#define CMTPPLAYBACKMAP_H
-
-#include <mtp/tmtptypeint32.h>
-#include <mtp/tmtptypeuint32.h>
-#include "mtpplaybackcontroldpconst.h"
-#include "mmtpplaybackinterface.h"
-#include "mtpdebug.h"
-
-class CMTPPlaybackCommand;
-class CMTPPlaybackProperty;
-class MMTPDataProviderFramework;
-
-class TMTPPbCtrlData
- {
-public:
- TMTPOperationCode iOptCode;
- TMTPDevicePropertyCode iDevPropCode;
- TMTPTypeUint32 iPropValUint32;
- TMTPTypeInt32 iPropValInt32;
- };
-
-
-/**
-Implements CMTPPlaybackMap.
-@internalComponent
-*/
-class CMTPPlaybackMap : public CBase
- {
-
-public:
-
- static CMTPPlaybackMap* NewL(MMTPDataProviderFramework& aFramework, CMTPPlaybackProperty& aProperty);
- ~CMTPPlaybackMap();
-
- /**
- Factory meothod, map the MTP playback control data to playback control command,
- @param aData TMTPPbCtrlData,
- @param aCmd output the valid playback command if the return value if KErrNone
- @return KErrNone if request is valid, else an error code.
- */
- TInt GetPlaybackControlCommand(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
-
- /**
- Map the playback state to MTP playback rate,
- @param aState TMTPPlaybackState
- @return the playback rate.
- */
- TInt32 PlaybackRateL(TMTPPlaybackState aState);
-
- /**
- Map the playback state to MTP playback rate,
- @param aSuid SUID
- @return the playback object handle.
- */
- TUint32 ObjectHandleL(const TDesC& aSuid);
-
-private:
- CMTPPlaybackMap(MMTPDataProviderFramework& aFramework, CMTPPlaybackProperty& aProperty);
- void ConstructL();
-
- TInt HandleSetDevicePropValue(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- void HandleSetDevicePropValueL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- TInt HandleGetDevicePropValue(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- void HandleGetDevicePropValueL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- TInt HandleSkip(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- void HandleSkipL(const TMTPPbCtrlData& aData, CMTPPlaybackCommand** aCmd);
- void GetObjecInfoFromHandleL(TUint32 aHandle, TDes& aSuid, TUint& aFormat) const;
-
-private: // Owned.
-
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- MMTPDataProviderFramework& iFramework;
- CMTPPlaybackProperty& iProperty;
- };
-
-#endif //CMTPPLAYBACKMAP_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackproperty.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKPROPERTY_H
-#define CMTPPLAYBACKPROPERTY_H
-
-#include "mtpplaybackcontroldpconst.h"
-#include "mtpdebug.h"
-#include "cmtpplaybackcommand.h"
-
-class CMTPPlaybackControlDataProvider;
-class TMTPPbCtrlData;
-
-/**
-Implements the CMTPPlaybackProperty.
-@internalComponent
-*/
-class CMTPPlaybackProperty : public CBase
- {
-
-public:
-
- static CMTPPlaybackProperty* NewL();
- ~CMTPPlaybackProperty();
-
- /**
- Get the devide property value by property code,
- @param aProp, DevicePropertyCode,
- @param aValue, Return value of the property,
- */
- void GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TInt32& aValue);
-
- /**
- Get the devide property value by property code,
- @param aProp, DevicePropertyCode,
- @param aValue, Return value of the property,
- */
- void GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TUint32& aValue);
-
- /**
- Get the default devide property value,
- @param aValue, Value of the property,
- */
- void GetDefaultPropertyValueL(TMTPPbCtrlData& aValue);
-
- /**
- Get the default volume data set,
- @param aValue, Value of the property,
- */
- void GetDefaultVolSet(TMTPPbDataVolume& aValue);
-
- /**
- Set the default volume data set,
- @param aValue, Value of the property,
- */
- void SetDefaultVolSetL(const TMTPPbDataVolume& aValue);
-
- /**
- Check if the input is equalt to the default devide property value,
- @param aValue, Value of the property,
- @return ETrue if equal.
- */
- TBool IsDefaultPropertyValueL(const TMTPPbCtrlData& aValue) const;
-
-private:
- CMTPPlaybackProperty();
- void ConstructL();
-
-private: // Owned.
-
- __FLOG_DECLARATION_MEMBER_MUTABLE;
- TMTPPbDataVolume* iPlaybackVolumeData;
- };
-
-#endif //CMTPPLAYBACKPROPERTY_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpconst.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MTPPLAYBACKCONTROLDPCONST_H
-#define MTPPLAYBACKCONTROLDPCONST_H
-
-#include <mtp/mtpprotocolconstants.h>
-
-/**
-define all the operations that are supported by the device data provider
-*/
-static const TUint16 KMTPPlaybackControlDpSupportedOperations[] =
- {
- EMTPOpCodeGetDevicePropDesc,
- EMTPOpCodeGetDevicePropValue,
- EMTPOpCodeSetDevicePropValue,
- EMTPOpCodeResetDevicePropValue,
- EMTPOpCodeSkip
- };
-
-/**
-define all the device properties supported by the device data provider
-*/
-static const TUint16 KMTPPlaybackControlDpSupportedProperties[] =
- {
- EMTPDevicePropCodeVolume,
- EMTPDevicePropCodePlaybackRate,
- EMTPDevicePropCodePlaybackObject,
- EMTPDevicePropCodePlaybackContainerIndex,
- EMTPDevicePropCodePlaybackPosition
- };
-
-static const TUint16 KMTPPlaybackControlDpSupportedEvents[] =
- {
- EMTPEventCodeDevicePropChanged
- };
-
-#endif // MTPPLAYBACKCONTROLDPCONST_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpprocessor.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MTPPLAYBACKCONTROLDPPROCESSOR_H
-#define MTPPLAYBACKCONTROLDPPROCESSOR_H
-
-//forward declaration
-class MMTPConnection;
-class TMTPTypeRequest;
-class CMTPDataProviderPlugin;
-class MMTPDataProviderFramework;
-class MMTPRequestProcessor;
-class CMTPPlaybackControlDataProvider;
-/**
-Defines device data provider request processor
-
-@internalTechnology
-*/
-class MTPPlaybackControlDpProcessor
- {
-public:
- static MMTPRequestProcessor* CreateL(
- MMTPDataProviderFramework& aFramework,
- const TMTPTypeRequest& aRequest,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
- };
-
-#endif //MTPPLAYBACKCONTROLDPPROCESSOR_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontrolpanic.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MTPPLAYBACKCONTROLPANIC_H
-#define MTPPLAYBACKCONTROLPANIC_H
-
-#include <e32std.h>
-
-enum TMTPPlaybackControlPanic
- {
- EMTPPBReserved = 0,
- EMTPPBCollectionErrMsg = 1,
- EMTPPBCallbackInvalid = 2,
- EMTPPBCollectionErrCall = 3,
- EMTPPBDataTypeErr = 4,
- EMTPPBArgumentErr = 5,
- EMTPPBDataNullErr = 6,
- };
-
-inline void Panic( TMTPPlaybackControlPanic aCode )
- {
- User::Panic( _L("MTPPlaybackControl"), aCode );
- };
-
-#endif //MTPPLAYBACKCONTROLPANIC_H
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackcommand.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKCOMMAND_H
-#define CMTPPLAYBACKCOMMAND_H
-
-#include "mtpdebug.h"
-#include "mmtpplaybackinterface.h"
-#include "cmtpplaybackparam.h"
-
-class TMTPPbDataVolume
- {
-public:
- TMTPPbDataVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep);
- TMTPPbDataVolume(const TMTPPbDataVolume& aVol);
-
- void SetVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep);
- void operator =(const TMTPPbDataVolume& aVol);
- TUint32 MaxVolume() const;
- TUint32 MinVolume() const;
- TUint32 DefaultVolume() const;
- TUint32 CurrentVolume() const;
- TUint32 Step() const;
-
-private:
- TUint32 iMaxVolume;
- TUint32 iMinVolume;
- TUint32 iDefaultVolume;
- TUint32 iCurrentVolume;
- TUint32 iStep;
- };
-
-/**
-* Encapsulates parameter for command EPlaybackCmdInitObject
-*/
-class CMTPPbCmdParam : public CMTPPbParamBase
- {
-public:
- static CMTPPbCmdParam* NewL(TMTPPbCategory aCategory, const TDesC& aSuid);
- static CMTPPbCmdParam* NewL(TInt32 aValue);
- static CMTPPbCmdParam* NewL(TUint32 aValue);
- static CMTPPbCmdParam* NewL(const CMTPPbCmdParam& aParam);
- static CMTPPbCmdParam* NewL(const TMTPPbDataVolume& aVolume);
- ~CMTPPbCmdParam();
-
-public:
- const TMTPPbDataVolume& VolumeSetL() const;
-
-private:
- /**
- * The constuctor.
- * @param aCategory, category of object for initialization,
- */
- CMTPPbCmdParam();
- CMTPPbCmdParam(TMTPPbCategory aCategory, const TDesC& aSuid);
- CMTPPbCmdParam(TInt32 aValue);
- CMTPPbCmdParam(TUint32 aValue);
- CMTPPbCmdParam(const TMTPPbDataVolume& aVolume);
-
- void ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid);
- void ConstructL(TInt32 aValue);
- void ConstructL(TUint32 aValue);
- void ConstructL(const TMTPPbDataVolume& aVolume);
- void ConstructL(const CMTPPbCmdParam& aParam);
- };
-
-
-/**
-Implements the CMTPPlaybackCommand.
-@internalComponent
-*/
-class CMTPPlaybackCommand : public CBase
- {
-public:
- static CMTPPlaybackCommand* NewL(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam);
- static CMTPPlaybackCommand* NewL(const CMTPPlaybackCommand& aCmd);
-
- void SetParam(CMTPPbCmdParam* aParam);
- const CMTPPbCmdParam& ParamL() const;
- TMTPPlaybackCommand PlaybackCommand() const;
- TBool HasParam() const;
-
- ~CMTPPlaybackCommand();
-
-private:
- CMTPPlaybackCommand(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam);
- void ConstructL(const CMTPPlaybackCommand& aParam);
- void ConstructL();
-
-private: // Owned.
- __FLOG_DECLARATION_MEMBER;
- const TMTPPlaybackCommand iPbCmd;
- CMTPPbCmdParam* iParam;
- };
-
-#endif //CMTPPLAYBACKCOMMAND_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackevent.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKEVENT_H
-#define CMTPPLAYBACKEVENT_H
-
-#include "mtpdebug.h"
-#include "mmtpplaybackinterface.h"
-#include "cmtpplaybackparam.h"
-
-/**
-* Encapsulates parameter for command EPlaybackCmdInitObject
-*/
-class CMTPPbEventParam : public CMTPPbParamBase
- {
-public:
- static CMTPPbEventParam* NewL(TMTPPbCategory aCategory, const TDesC& aSuid);
- static CMTPPbEventParam* NewL(TInt32 aValue);
- static CMTPPbEventParam* NewL(TUint32 aValue);
- ~CMTPPbEventParam();
-
-private:
- /**
- * The constuctor.
- * @param aCategory, category of object for initialization,
- */
- CMTPPbEventParam(TMTPPbCategory aCategory, const TDesC& aSuid);
- CMTPPbEventParam(TInt32 aValue);
- CMTPPbEventParam(TUint32 aValue);
- };
-
-
-/**
-Implements the CMTPPlaybackCommand.
-@internalComponent
-*/
-class CMTPPlaybackEvent : public CBase
- {
-public:
-
- static CMTPPlaybackEvent* NewL(TMTPPlaybackEvent aCmd, CMTPPbEventParam* aParam);
-
- void SetParam(CMTPPbEventParam* aParam);
- const CMTPPbEventParam& ParamL();
- TMTPPlaybackEvent PlaybackEvent();
-
- ~CMTPPlaybackEvent();
-
-private:
- CMTPPlaybackEvent(TMTPPlaybackEvent aCmd, CMTPPbEventParam* aParam);
- void ConstructL();
-
-private: // Owned.
- __FLOG_DECLARATION_MEMBER;
- const TMTPPlaybackEvent iPbEvent;
- CMTPPbEventParam* iParam;
- };
-
-#endif //CMTPPLAYBACKEVENT_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackparam.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKPARAM_H
-#define CMTPPLAYBACKPARAM_H
-
-#include "mtpdebug.h"
-
-/**
- Category identifier
-*/
-enum TMTPPbCategory
- {
- /** Init value **/
- EMTPPbCatNone=0,
- /** SingleMusic **/
- EMTPPbCatMusic=1,
- /** PlayList**/
- EMTPPbCatPlayList = 2,
- /** Ablum **/
- EMTPPbCatAlbum = 3
- };
-
-enum TMTPPbDataType
- {
- EMTPPbTypeNone,
- EMTPPbInt32,
- EMTPPbUint32,
- EMTPPbSuidSet,
- EMTPPbVolumeSet,
- EMTPPbTypeEnd
- };
-
-class TMTPPbDataSuid
- {
-public:
- TMTPPbDataSuid(TMTPPbCategory aCategory, const TDesC& aSuid);
-
- TMTPPbCategory Category() const;
- const TDesC& Suid() const;
-
-private:
- //The category
- TMTPPbCategory iPlayCategory;
- //The suid of object for initialization
- TFileName iSuid;
- };
-
-/**
-* Encapsulates parameter for playback commands and events.
-*/
-class CMTPPbParamBase : public CBase
- {
-public:
- virtual const TMTPPbDataSuid& SuidSetL() const;
- virtual TInt32 Int32L() const;
- virtual TUint32 Uint32L() const;
- virtual ~CMTPPbParamBase();
- TMTPPbDataType Type() const;
-
-protected:
- /**
- * The constuctor.
- * @param aCategory, category of object for initialization,
- */
- CMTPPbParamBase();
- CMTPPbParamBase(TInt32 aValue);
- CMTPPbParamBase(TUint32 aValue);
- CMTPPbParamBase(TMTPPbCategory aCategory, const TDesC& aSuid);
-
- void ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid);
- void ConstructL(TInt32 aValue);
- void ConstructL(TUint32 aValue);
- void ConstructL(const CMTPPbParamBase& aParam);
- void SetType(TMTPPbDataType);
- TAny* GetData() const;
- void SetData(TAny* aData);
-
-private:
- __FLOG_DECLARATION_MEMBER;
-
- TMTPPbDataType iParamType;
- TAny* iData;
- };
-
-#endif //CMTPPLAYBACKPARAM_H
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/mmtpplaybackinterface.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MMTPPLAYBACKINTERFACE_H
-#define MMTPPLAYBACKINTERFACE_H
-
-const TInt KPlaybackErrNone = 0;
-const TInt KPlaybackErrDeviceBusy = (-8000);
-const TInt KPlaybackErrDeviceUnavailable = (-8001);
-const TInt KPlaybackErrParamInvalid = (-8002);
-const TInt KPlaybackErrContextInvalid = (-8003);
-
-/** Playback status */
-enum TMTPPlaybackState
- {
- /** Playing */
- EPlayStatePlaying,
- /** Pause */
- EPlayStatePaused,
- /** Forward seeking */
- EPlayStateForwardSeeking,
- /** Backward seeking */
- EPlayStateBackwardSeeking,
- /** error state */
- EPlayStateError
- };
-
-/** Playback events */
-enum TMTPPlaybackEvent
- {
- EPlaybackEventNone,
- /** playback volume update */
- EPlaybackEventVolumeUpdate,
- /** playback object update */
- EPlaybackEventObjectUpdate,
- /** playback object index update */
- EPlaybackEventObjectIndexUpdate,
- /** player state update */
- EPlaybackEventStateUpdate,
- /** Last Event */
- EPlaybackEventEnd
- };
-
-/** Playback command */
-enum TMTPPlaybackCommand
- {
- EPlaybackCmdNone,
- EPlaybackCmdInitObject,
- EPlaybackCmdInitIndex,
- EPlaybackCmdPlay,
- EPlaybackCmdPause,
- EPlaybackCmdStop,
- EPlaybackCmdSkip,
- EPlaybackCmdSeekForward,
- EPlaybackCmdSeekBackward,
- EPlaybackCmdGetVolume,
- EPlaybackCmdGetVolumeSet,
- EPlaybackCmdSetVolume,
- EPlaybackCmdGetPosition,
- EPlaybackCmdSetPosition,
- EPlaybackCmdGetDuration,
- EPlaybackCmdGetState,
- EPlaybackCmdGetObject,
- EPlaybackCmdGetIndex,
- EPlaybackCmdEnd
- };
-
-class CMTPPlaybackCommand;
-class CMTPPlaybackEvent;
-
-class MMTPPlaybackObserver
- {
-public:
- /**
- * Called when playback object is updated or
- * playback object's position is updated
- * in the active player instance.
- */
- virtual void HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr = KPlaybackErrNone) = 0;
- };
-
-class MMTPPlaybackCallback
- {
-public:
- /**
- * Called when playback command is completed
- *
- * @param aErr Complete error
- * @param aCmd Complete command
- */
- virtual void HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr = KPlaybackErrNone) = 0;
- };
-
-class MMTPPlaybackControl
- {
-public:
- /**
- * Create an Instance of MMTPPlaybackControl's implementation.
- */
- static MMTPPlaybackControl* NewL(MMTPPlaybackObserver& aObserver);
-
- /**
- * Frees resource, and destroy the object itself.
- */
- virtual void Close()=0;
-
- /**
- * Issue player commands, with optional data.
- * @param aCmd the command
- * @param aCallback Call back function
- */
- virtual void CommandL(CMTPPlaybackCommand& aCmd, MMTPPlaybackCallback* aCallback = NULL) = 0;
- };
-
-#endif // MMTPPLAYBACKINTERFACE_H
-// End of File
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackcommand.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"CMtpPbCmd");)
-
-/*********************************************
- class TMTPPbDataVolume
-**********************************************/
-TMTPPbDataVolume::TMTPPbDataVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep):
- iMaxVolume(aMax),iMinVolume(aMin), iDefaultVolume(aDefault), iCurrentVolume(aCurrent), iStep(aStep)
- {
- __ASSERT_DEBUG((aMin < aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aMin <= aDefault && aDefault <= aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aMin <= aCurrent && aCurrent <= aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aStep <= (aMax-aMin)), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aStep != 0), Panic(EMTPPBArgumentErr));
- }
-
-TMTPPbDataVolume::TMTPPbDataVolume(const TMTPPbDataVolume& aVol):
- iMaxVolume(aVol.MaxVolume()),
- iMinVolume(aVol.MinVolume()),
- iDefaultVolume(aVol.DefaultVolume()),
- iCurrentVolume(aVol.CurrentVolume()),
- iStep(aVol.Step())
- {
-
- }
-
-void TMTPPbDataVolume::SetVolume(TUint32 aMax, TUint32 aMin, TUint32 aDefault, TUint32 aCurrent, TUint32 aStep)
- {
- __ASSERT_DEBUG((aMin < aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aMin <= aDefault && aDefault <= aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aMin <= aCurrent && aCurrent <= aMax), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aStep <= (aMax-aMin)), Panic(EMTPPBArgumentErr));
- __ASSERT_DEBUG((aStep != 0), Panic(EMTPPBArgumentErr));
- iMaxVolume = aMax;
- iMinVolume = aMin;
- iDefaultVolume = aDefault;
- iCurrentVolume = aCurrent,
- iStep = aStep;
- }
-
-void TMTPPbDataVolume::operator =(const TMTPPbDataVolume& aVol)
- {
- iMaxVolume = aVol.MaxVolume();
- iMinVolume = aVol.MinVolume();
- iDefaultVolume = aVol.DefaultVolume();
- iCurrentVolume = aVol.CurrentVolume();
- iStep = aVol.Step();
- }
-
-TUint32 TMTPPbDataVolume::MaxVolume() const
- {
- return iMaxVolume;
- }
-
-TUint32 TMTPPbDataVolume::MinVolume() const
- {
- return iMinVolume;
- }
-
-TUint32 TMTPPbDataVolume::DefaultVolume() const
- {
- return iDefaultVolume;
- }
-
-TUint32 TMTPPbDataVolume::CurrentVolume() const
- {
- return iCurrentVolume;
- }
-
-TUint32 TMTPPbDataVolume::Step() const
- {
- return iStep;
- }
-
-/*********************************************
- class CMTPPbCmdParam
-**********************************************/
-
-CMTPPbCmdParam* CMTPPbCmdParam::NewL(TMTPPbCategory aCategory, const TDesC& aSuid)
- {
- CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aCategory, aSuid);
- CleanupStack::PushL(self);
- self->ConstructL(aCategory, aSuid);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbCmdParam* CMTPPbCmdParam::NewL(TInt32 aValue)
- {
- CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aValue);
- CleanupStack::PushL(self);
- self->ConstructL(aValue);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbCmdParam* CMTPPbCmdParam::NewL(TUint32 aValue)
- {
- CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aValue);
- CleanupStack::PushL(self);
- self->ConstructL(aValue);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbCmdParam* CMTPPbCmdParam::NewL(const TMTPPbDataVolume& aVolume)
- {
- CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam(aVolume);
- CleanupStack::PushL(self);
- self->ConstructL(aVolume);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbCmdParam* CMTPPbCmdParam::NewL(const CMTPPbCmdParam& aParam)
- {
- CMTPPbCmdParam* self = new (ELeave) CMTPPbCmdParam();
- CleanupStack::PushL(self);
- self->ConstructL(aParam);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbCmdParam::~CMTPPbCmdParam()
- {
-
- }
-
-CMTPPbCmdParam::CMTPPbCmdParam():
- CMTPPbParamBase()
- {
-
- }
-
-CMTPPbCmdParam::CMTPPbCmdParam(TMTPPbCategory aCategory, const TDesC& aSuid):
- CMTPPbParamBase(aCategory, aSuid)
- {
-
- }
-
-CMTPPbCmdParam::CMTPPbCmdParam(TInt32 aValue):
- CMTPPbParamBase(aValue)
- {
-
- }
-
-CMTPPbCmdParam::CMTPPbCmdParam(TUint32 aValue):
- CMTPPbParamBase(aValue)
- {
-
- }
-
-CMTPPbCmdParam::CMTPPbCmdParam(const TMTPPbDataVolume& /*aVolume*/):
- CMTPPbParamBase()
- {
- CMTPPbParamBase::SetType(EMTPPbVolumeSet);
- }
-
-void CMTPPbCmdParam::ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid)
- {
- CMTPPbParamBase::ConstructL(aCategory, aSuid);
- }
-
-void CMTPPbCmdParam::ConstructL(TInt32 aValue)
- {
- CMTPPbParamBase::ConstructL(aValue);
- }
-
-void CMTPPbCmdParam::ConstructL(TUint32 aValue)
- {
- CMTPPbParamBase::ConstructL(aValue);
- }
-
-void CMTPPbCmdParam::ConstructL(const TMTPPbDataVolume& aVolume)
- {
- TMTPPbDataVolume* val = new (ELeave) TMTPPbDataVolume(aVolume);
- CMTPPbParamBase::SetData(static_cast<TAny*>(val));
- }
-
-void CMTPPbCmdParam::ConstructL(const CMTPPbCmdParam& aParam)
- {
- TMTPPbDataType type(aParam.Type());
-
- __ASSERT_DEBUG((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), User::Leave(KErrArgument));
-
- if(type == EMTPPbVolumeSet)
- {
- TMTPPbDataVolume* val = new (ELeave) TMTPPbDataVolume(aParam.VolumeSetL());
- CMTPPbParamBase::SetData(static_cast<TAny*>(val));
- CMTPPbParamBase::SetType(type);
- }
- else
- {
- CMTPPbParamBase::ConstructL(aParam);
- }
- }
-
-const TMTPPbDataVolume& CMTPPbCmdParam::VolumeSetL() const
- {
- __ASSERT_DEBUG((CMTPPbParamBase::Type() == EMTPPbVolumeSet), Panic(EMTPPBDataTypeErr));
- __ASSERT_ALWAYS((CMTPPbParamBase::Type() == EMTPPbVolumeSet), User::Leave(KErrArgument));
- return *static_cast<TMTPPbDataVolume*>(CMTPPbParamBase::GetData());
- }
-
-/*********************************************
- class CMTPPlaybackCommand
-**********************************************/
-CMTPPlaybackCommand* CMTPPlaybackCommand::NewL(TMTPPlaybackCommand aCmd, CMTPPbCmdParam* aParam)
- {
- __ASSERT_DEBUG((aCmd > EPlaybackCmdNone && aCmd < EPlaybackCmdEnd), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((aCmd > EPlaybackCmdNone && aCmd < EPlaybackCmdEnd), User::Leave(KErrArgument));
-
- CMTPPlaybackCommand* self = new (ELeave) CMTPPlaybackCommand(aCmd, aParam);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPlaybackCommand* CMTPPlaybackCommand::NewL(const CMTPPlaybackCommand& aCmd)
- {
- CMTPPlaybackCommand* self = new (ELeave) CMTPPlaybackCommand(aCmd.PlaybackCommand(), NULL);
- CleanupStack::PushL(self);
- self->ConstructL(aCmd);
- CleanupStack::Pop(self);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPlaybackCommand::~CMTPPlaybackCommand()
- {
- __FLOG(_L8("~CMTPPlaybackCommand - Entry"));
- delete iParam;
- __FLOG(_L8("~CMTPPlaybackCommand - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPlaybackCommand::CMTPPlaybackCommand(TMTPPlaybackCommand aCmd,
- CMTPPbCmdParam* aParam):
- iPbCmd(aCmd),iParam(aParam)
- {
- }
-
-/**
-Second-phase constructor.
-*/
-void CMTPPlaybackCommand::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Entry"));
- __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Exit"));
- }
-
-/**
-Second-phase constructor.
-*/
-void CMTPPlaybackCommand::ConstructL(const CMTPPlaybackCommand& aCmd)
- {
- __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Entry"));
- if(aCmd.HasParam())
- {
- iParam = CMTPPbCmdParam::NewL(aCmd.ParamL());
- }
- __FLOG(_L8("CMTPPlaybackCommand: ConstructL - Exit"));
- }
-
-TMTPPlaybackCommand CMTPPlaybackCommand::PlaybackCommand() const
- {
- __ASSERT_DEBUG((iPbCmd > EPlaybackCmdNone && iPbCmd < EPlaybackCmdEnd), Panic(EMTPPBArgumentErr));
- return iPbCmd;
- }
-
-TBool CMTPPlaybackCommand::HasParam() const
- {
- TBool result(iParam != NULL);
- return result;
- }
-
-const CMTPPbCmdParam& CMTPPlaybackCommand::ParamL() const
- {
- __ASSERT_DEBUG((iParam != NULL), Panic(EMTPPBDataNullErr));
- __ASSERT_ALWAYS((iParam != NULL), User::Leave(KErrArgument));
- return *iParam;
- }
-
-void CMTPPlaybackCommand::SetParam(CMTPPbCmdParam* aParam)
- {
- delete iParam;
- iParam = aParam;
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackevent.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackevent.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"CMtpPbEvent");)
-
-CMTPPbEventParam* CMTPPbEventParam::NewL(TMTPPbCategory aCategory, const TDesC& aSuid)
- {
- CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aCategory, aSuid);
- CleanupStack::PushL(self);
- self->ConstructL(aCategory, aSuid);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbEventParam* CMTPPbEventParam::NewL(TInt32 aValue)
- {
- CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
- CleanupStack::PushL(self);
- self->ConstructL(aValue);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbEventParam* CMTPPbEventParam::NewL(TUint32 aValue)
- {
- CMTPPbEventParam* self = new (ELeave) CMTPPbEventParam(aValue);
- CleanupStack::PushL(self);
- self->ConstructL(aValue);
- CleanupStack::Pop(self);
- return self;
- }
-
-CMTPPbEventParam::~CMTPPbEventParam()
- {
-
- }
-
-CMTPPbEventParam::CMTPPbEventParam(TMTPPbCategory aCategory, const TDesC& aSuid):
- CMTPPbParamBase(aCategory, aSuid)
- {
-
- }
-
-CMTPPbEventParam::CMTPPbEventParam(TInt32 aValue):
- CMTPPbParamBase(aValue)
- {
-
- }
-
-CMTPPbEventParam::CMTPPbEventParam(TUint32 aValue):
- CMTPPbParamBase(aValue)
- {
-
- }
-
-/**
-Two-phase constructor.
-*/
-CMTPPlaybackEvent* CMTPPlaybackEvent::NewL(TMTPPlaybackEvent aEvent, CMTPPbEventParam* aParam)
- {
- __ASSERT_DEBUG((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((aEvent > EPlaybackEventNone && aEvent < EPlaybackEventEnd), User::Leave(KErrArgument));
-
- CMTPPlaybackEvent* self = new (ELeave) CMTPPlaybackEvent(aEvent, aParam);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPlaybackEvent::~CMTPPlaybackEvent()
- {
- __FLOG(_L8("~CMTPPlaybackEvent - Entry"));
- delete iParam;
- __FLOG(_L8("~CMTPPlaybackEvent - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPlaybackEvent::CMTPPlaybackEvent(TMTPPlaybackEvent aEvent,
- CMTPPbEventParam* aParam):
- iPbEvent(aEvent),iParam(aParam)
- {
- }
-
-/**
-Second-phase constructor.
-*/
-void CMTPPlaybackEvent::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Entry"));
- __FLOG(_L8("CMTPPlaybackEvent: ConstructL - Exit"));
- }
-
-void CMTPPlaybackEvent::SetParam(CMTPPbEventParam* aParam)
- {
- delete iParam;
- iParam = aParam;
- }
-
-TMTPPlaybackEvent CMTPPlaybackEvent::PlaybackEvent()
- {
- __ASSERT_DEBUG((iPbEvent > EPlaybackEventNone && iPbEvent < EPlaybackEventEnd), Panic(EMTPPBArgumentErr));
- return iPbEvent;
- }
-
-const CMTPPbEventParam& CMTPPlaybackEvent::ParamL()
- {
- __ASSERT_DEBUG((iParam != NULL), Panic(EMTPPBDataNullErr));
- __ASSERT_ALWAYS((iParam != NULL), User::Leave(KErrArgument));
-
- return *iParam;
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackparam.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackparam.h"
-#include "mtpplaybackcontrolpanic.h"
-
-
-/*********************************************
- class TMTPPbDataSuid
-**********************************************/
-TMTPPbCategory TMTPPbDataSuid::Category() const
- {
- return iPlayCategory;
- }
-
-const TDesC& TMTPPbDataSuid::Suid() const
- {
- return iSuid;
- }
-
-TMTPPbDataSuid::TMTPPbDataSuid(TMTPPbCategory aCategory, const TDesC& aSuid):
- iPlayCategory(aCategory),
- iSuid(aSuid)
- {
-
- }
-
-/*********************************************
- class CMTPPbParamBase
-**********************************************/
-
-CMTPPbParamBase::~CMTPPbParamBase()
- {
- delete iData;
- }
-
-CMTPPbParamBase::CMTPPbParamBase():
- iParamType(EMTPPbTypeNone)
- {
-
- }
-
-CMTPPbParamBase::CMTPPbParamBase(TMTPPbCategory /*aCategory*/, const TDesC& /*aSuid*/):
- iParamType(EMTPPbSuidSet)
- {
-
- }
-
-CMTPPbParamBase::CMTPPbParamBase(TInt32 /*aValue*/):
- iParamType(EMTPPbInt32)
- {
-
- }
-
-CMTPPbParamBase::CMTPPbParamBase(TUint32 /*aValue*/):
- iParamType(EMTPPbUint32)
- {
-
- }
-
-void CMTPPbParamBase::ConstructL(TMTPPbCategory aCategory, const TDesC& aSuid)
- {
- TMTPPbDataSuid* val = new (ELeave) TMTPPbDataSuid(aCategory, aSuid);
- iData = static_cast<TAny*>(val);
- }
-
-void CMTPPbParamBase::ConstructL(TInt32 aValue)
- {
- TInt32* val = new (ELeave) TInt32();
- *val = aValue;
- iData = static_cast<TAny*>(val);
- }
-
-void CMTPPbParamBase::ConstructL(TUint32 aValue)
- {
- TUint32* val = new (ELeave) TUint32();
- *val = aValue;
- iData = static_cast<TAny*>(val);
- }
-
-void CMTPPbParamBase::ConstructL(const CMTPPbParamBase& aParam)
- {
- TMTPPbDataType type(aParam.Type());
- __ASSERT_DEBUG((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((type > EMTPPbTypeNone && type < EMTPPbTypeEnd), User::Leave(KErrArgument));
-
- switch(type)
- {
- case EMTPPbSuidSet:
- {
- ConstructL(aParam.SuidSetL().Category(), aParam.SuidSetL().Suid());
- }
- break;
- case EMTPPbInt32:
- {
- ConstructL(aParam.Int32L());
- }
- break;
- case EMTPPbUint32:
- {
- ConstructL(aParam.Uint32L());
- }
- break;
- default:
- User::Leave(KErrArgument);
- break;
- }
-
- iParamType = type;
- }
-
-TMTPPbDataType CMTPPbParamBase::Type() const
- {
- __ASSERT_DEBUG((iParamType > EMTPPbTypeNone && iParamType < EMTPPbTypeEnd),
- Panic(EMTPPBDataTypeErr));
- return iParamType;
- }
-
-void CMTPPbParamBase::SetType(TMTPPbDataType aType)
- {
- __ASSERT_DEBUG((iParamType == EMTPPbTypeNone), Panic(EMTPPBDataTypeErr));
- __ASSERT_DEBUG((aType > EMTPPbTypeNone && aType < EMTPPbTypeEnd), Panic(EMTPPBDataTypeErr));
- iParamType = aType;
- }
-
-TAny* CMTPPbParamBase::GetData() const
- {
- __ASSERT_DEBUG((iData != NULL), Panic(EMTPPBDataNullErr));
- return iData;
- }
-
-void CMTPPbParamBase::SetData(TAny* aData)
- {
- __ASSERT_DEBUG((aData != NULL), Panic(EMTPPBDataNullErr));
- iData = aData;
- }
-
-const TMTPPbDataSuid& CMTPPbParamBase::SuidSetL() const
- {
- __ASSERT_DEBUG((iParamType == EMTPPbSuidSet), Panic(EMTPPBDataTypeErr));
- __ASSERT_ALWAYS((iParamType == EMTPPbSuidSet), User::Leave(KErrArgument));
-
- return *static_cast<TMTPPbDataSuid*>(iData);
- }
-
-TInt32 CMTPPbParamBase::Int32L() const
- {
- __ASSERT_DEBUG((iParamType == EMTPPbInt32), Panic(EMTPPBDataTypeErr));
- __ASSERT_ALWAYS((iParamType == EMTPPbInt32), User::Leave(KErrArgument));
-
- return *static_cast<TInt32*>(iData);
- }
-
-TUint32 CMTPPbParamBase::Uint32L() const
- {
- __ASSERT_DEBUG((iParamType == EMTPPbUint32), Panic(EMTPPBDataTypeErr));
- __ASSERT_ALWAYS((iParamType == EMTPPbUint32), User::Leave(KErrArgument));
-
- return *static_cast<TUint32*>(iData);
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/mmtpplaybackinterface.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include"cmtpplaybackcontrolimpl.h"
-
-// ---------------------------------------------------------------------------
-// Create the playback control object
-// ---------------------------------------------------------------------------
-
-MMTPPlaybackControl* MMTPPlaybackControl::NewL( MMTPPlaybackObserver& aObserver )
- {
- return CMTPPlaybackControlImpl::NewL( aObserver );
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcommandchecker.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKCOMMANDCHECKER_H_
-#define CMTPPLAYBACKCOMMANDCHECKER_H_
-
-#include "cmtpplaybackcommand.h"
-#include "mtpdebug.h"
-
-class CMTPPlaybackControlImpl;
-
-NONSHARABLE_CLASS( CMTPPlaybackCommandChecker ) : public CBase
- {
-public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CMTPPlaybackCommandChecker* NewL( CMTPPlaybackControlImpl& aControlImpl );
- /**
- * Destructor.
- */
- virtual ~CMTPPlaybackCommandChecker();
-
-public:
-
- /**
- * Check playback command context
- */
- void CheckPlaybackCommandContextL( TMTPPlaybackCommand aMTPPBCommand );
-
- /**
- *Check and update playback param
- */
- void CheckAndUpdatePlaybackParamL( CMTPPlaybackCommand& aMTPPPBSourceCmd, CMTPPbCmdParam** aMTPPPBTargetParam );
-
-private:
-
- /**
- * C++ default constructor.
- */
- CMTPPlaybackCommandChecker( CMTPPlaybackControlImpl& aControlImpl );
-
-private:
-
- /**
- * Return instance of CMTPPlaybackControlImpl.
- */
- CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
-
-private:
-
- /**
- The handle of the owner
- */
- CMTPPlaybackControlImpl& iMTPPlaybackControl;
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER;
- };
-
-#endif /* CMTPPLAYBACKCOMMANDCHECKER_H_ */
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcontrolimpl.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKCONTROLIMPL_H
-#define CMTPPLAYBACKCONTROLIMPL_H
-
-#include <mpxplaybackobserver.h>
-
-#include "mmtpplaybackinterface.h"
-#include "mtpplaybackcontrolconst.h"
-#include "mtpdebug.h"
-
-class MMPXPlaybackUtility;
-class CMPXCollectionPath;
-class CMPXCollectionPlaylist;
-
-class CMTPPlaybackCommandChecker;
-class CMTPPlaybackPlaylistHelper;
-class CMTPPlaybackResumeHelper;
-class CMTPPlaybackCommand;
-class CMTPPbCmdParam;
-
-
-NONSHARABLE_CLASS( CMTPPlaybackControlImpl ) : public CActive,
- public MMPXPlaybackObserver,
- public MMPXPlaybackCallback,
- public MMTPPlaybackControl
- {
-private:
-
- friend class CMTPPlaybackCommandChecker;
- friend class CMTPPlaybackPlaylistHelper;
- friend class CMTPPlaybackResumeHelper;
-
-public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CMTPPlaybackControlImpl* NewL( MMTPPlaybackObserver& aObserver );
- /**
- * Frees resource, and destroy the object itself.
- */
- void Close();
- /**
- * Destructor.
- */
- virtual ~CMTPPlaybackControlImpl();
-
-public:
- /**
- * From MMTPPlaybackControl
- * @param aCmd, refer to CMTPPlaybackCommand
- * @param aCallback, refer to MMTPPlaybackCallback
- */
- void CommandL( CMTPPlaybackCommand& aCmd,
- MMTPPlaybackCallback* aCallback = NULL);
-
-private:
-
- /**
- * From MMPXPlaybackObserver
- * See mpxplaybackobserver.h for detailed description.
- */
- void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
-
- /**
- * From MMPXPlaybackCallback
- * See mpxplaybackobserver.h for detailed description.
- */
- void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
-
- /**
- * From MMPXPlaybackCallback
- * See mpxplaybackobserver.h for detailed description.
- */
- void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
-
- /**
- * From MMPXPlaybackCallback
- * See mpxplaybackobserver.h for detailed description.
- */
- void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
-
-private:// From CActive
-
- /**
- * DoCancel.
- */
- void DoCancel();
-
- /**
- * RunL.
- */
- void RunL();
-
-private:
-
- /**
- * C++ default constructor.
- */
- CMTPPlaybackControlImpl( MMTPPlaybackObserver& aObserver );
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
-private:
-
- /**
- * Get Playlist from collection complete..
- */
- void GetPlaylistFromCollectionCompleteL( const CMPXCollectionPlaylist& aPlaylist );
-
- /**
- * Deactive other player so that we can play
- */
- void DeActiveOtherPlayerL();
-
- /**
- * Check playback command and cache
- */
- void CheckPlaybackCmdAndCacheL( CMTPPlaybackCommand& aCmd );
-
- /**
- * UpdateCommandArrary
- */
- void UpdateCommandArray();
-
- /**
- * Require current media
- */
- void RequestMediaL();
-
- /**
- * Handle commandL
- */
- void DoCommandL();
-
- /**
- * Handle playback message
- *
- * @param aMessage playback message
- */
- void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
-
- /**
- * Handle playback property
- *
- * @param aProperty the property
- * @param aValue the value of the property
- */
- void DoHandlePropertyL( TInt aProperty, TInt aValue );
-
- /**
- * Handle playback state changed.
- *
- * @param aState New Playback state
- */
- void DoHandleStateChangedL( TMPXPlaybackState aState );
-
- /**
- * Handle request media.
- */
- void DoHandleMediaL( const CMPXMedia& aMedia );
-
- /**
- * Handle Media changed.
- *
- */
- void DoHandleMediaChangedL();
-
- /**
- * Handle Initialize Complete.
- *
- */
- void DoHandleInitializeCompleteL();
-
- /**
- * Handle error.
- *
- */
- void DoHandleError( TInt aErr );
-
- /**
- * Compare two path
- * @param aPathBase the base path
- * @param aPathNew the new path
- * @param aLevel compare level
- */
- TBool IfEqual( const CMPXCollectionPath& aPathBase, const CMPXCollectionPath& aPathNew, TUint aLevel );
-
- /**
- * Map states from TMPXPlaybackState to TMPlayerState
- *
- * @param aState State in TMPXPlaybackState format
- * @return State in TMPlayerState format
- */
- TMTPPlaybackState MapState( TMPXPlaybackState aState );
-
- /**
- * Map error from TInt to the error defined in interface
- */
- TInt MapError( TInt error );
-
- /**
- *Complete a sync request
- */
- void CompleteSelf( TInt aCompletionCode );
-
- /*
- * Initiate MPX Playback Command
- */
- void InitiateMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
-
- /*
- * SendMPXPlaybackCommandL
- */
- void SendMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility );
-
-
- /*
- * SendPlaybackCommandCompleteL
- */
- void SendPlaybackCommandCompleteL();
-
- /*
- * SendPlaybackEventL
- */
- void SendPlaybackEventL( TMTPPlaybackEvent aEvt );
-
- /**
- * Reset playback command
- */
- void ResetPlaybackCommand();
-
-private:
-
- /**
- * return current state.
- */
- TMPXPlaybackState CurrentState() const;
-
- /**
- * return previous state.
- */
- TMPXPlaybackState PreviousState() const;
-
- /**
- * return song count.
- */
- TInt32 SongCount() const;
-
- /**
- * return song index.
- */
- TInt32 SongIndex() const;
-
- /**
- * Cache mtp playback command.
- */
- void SetMTPPBCmd( TMTPPlaybackCommand aMTPPBCmd );
-
- /**
- * return mtp playback command.
- */
- TMTPPlaybackCommand MTPPBCmdHandling() const;
-
-private:
-
- MMTPPlaybackObserver* iObserver;// Not owned
- MMTPPlaybackCallback* iCallback;// Not owned
-
- MMPXPlaybackUtility* iPlaybackUtility;// Owned
- MMPXPlaybackUtility* iNowActivePlaybackUtility;// Owned
-
- CMTPPlaybackCommandChecker* iPlaybackCommandChecker;//Owned
- CMTPPlaybackPlaylistHelper* iPlaybackPlaylistHelper;//Owned
- CMTPPlaybackResumeHelper* iPlaybackResumeHelper;
-
- CMPXCollectionPlaylist* iPlayList; //Owned
- RResumeCmdArray iPrepareCmdArray;//Owned
- RResumeCmdArray iResumeCmdArray;//Owned
- CMTPPbCmdParam* iCmdParam;
-
- TMTPPlaybackCommand iMTPPBCmd;
- TMPXPlaybackState iPreState;
- TMPXPlaybackState iState;
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER;
- };
-
-#endif // CMTPPLAYBACKCONTROLIMPL_H
-// End of File
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackplaylisthelper.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKPLAYLISTHELPER_H_
-#define CMTPPLAYBACKPLAYLISTHELPER_H_
-
-#include <mpxcollectionobserver.h>
-#include <mpxcollectionuihelperobserver.h>
-
-#include "mtpdebug.h"
-#include "cmtpplaybackparam.h"
-
-class MMPXCollectionUiHelper;
-class MMPXCollectionHelper;
-class MMPXCollectionUtility;
-
-class TMTPPbDataSuid;
-class CMTPPlaybackControlImpl;
-
-NONSHARABLE_CLASS( CMTPPlaybackPlaylistHelper ) : public CBase,
- public MMPXCollectionObserver
- {
-public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CMTPPlaybackPlaylistHelper* NewL( CMTPPlaybackControlImpl& aControlImpl );
-
- /**
- * Destructor.
- */
- virtual ~CMTPPlaybackPlaylistHelper();
-
-public:
-
- /**
- * Get playlist from collection server
- * @param aPlayObject, refer to TMTPPbDataSuid
- */
- void GetPlayListFromCollectionL( const TMTPPbDataSuid& aPlayObject );
-
- /**
- * Get playlist from collection server
- * @param aIndex, song index
- */
- void GetPlayListFromCollectionL( TInt aIndex );
-
- /**
- * Get suid from collection server
- * @param aPlaylist, current collection playlist
- */
- TMTPPbDataSuid GetMTPPBSuidFromCollectionL(
- const CMPXCollectionPlaylist& aPlaylist );
-
- /**
- * Get category
- */
- TMTPPbCategory MTPPbCategory() const;
-
- /**
- * Get suid
- */
- TFileName MTPPbSuid() const;
-
-private:
-
- //from base class MMPXCollectionObserver
- /**
- * Handle collection message
- *
- * @param aMsg collection message, ownership not transferred.
- * Please check aMsg is not NULL before using it.
- * If aErr is not KErrNone, plugin might still call back with more
- * info in the aMsg.
- * @param aErr system error code.
- */
- void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
-
- /**
- * Handles the collection entries being opened. Typically called
- * when client has Open()'d a folder.
- *
- * @param aEntries collection entries opened
- * @param aIndex focused entry
- * @param aComplete ETrue no more entries. EFalse more entries
- * expected
- * @param aError error code
- */
- void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete,
- TInt aError );
-
- /**
- * Handles the item being opened. Typically called
- * when client has Open()'d an item. Client typically responds by
- * 'playing' the item via the playlist.
- *
- * @param aPlaylist collection playlist
- * @param aError error code
- */
- void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
-
- /**
- * From MMPXCollectionMediaObserver
- * It handles MediaL event.
- *
- * @param aMedia object containing collection's informations
- * @param aError error code
- */
- void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
-
-private:
-
- /**
- * C++ default constructor.
- */
- CMTPPlaybackPlaylistHelper( CMTPPlaybackControlImpl& aControlImpl );
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
-private:
-
- /**
- * Handle collection message
- */
- void DoHandleCollectionMessageL( const CMPXMessage& aMsg );
-
- /**
- * Handle OpenL
- */
- void DoHandleOpenL( const CMPXMedia& aEntries );
-
- /**
- * Open the root path of playlist
- */
- void OpenMusicPlayListPathL();
-
- /**
- * Open the root path of album
- */
- void OpenMusicAblumPathL();
-
- /**
- * Reset play source
- */
- void ResetPlaySource();
-
- /**
- *Update path index according to iPlayObject
- */
- void UpdatePlaylistPathIndexL( const CMPXMedia& aEntries );
-
- /**
- *Got the collectionHelperL
- */
- MMPXCollectionHelper* CollectionHelperL();
-
- /**
- * Map uri to ItemId
- */
- const TMPXItemId UriToItemIdL();
-
- /**
- * Map uri to ItemId
- */
- const TFileName ItemIdToUriL( const TMPXItemId& aId );
-
- /**
- * Find Album Songs
- */
- CMPXMedia* FindAlbumSongsL( const TMPXItemId& aAlbumId );
-
- /*
- * UpdatePathAndOpenL
- */
- void UpdateAlbumPathAndOpenL();
-
- /*
- * UpdatePathAndOpenL
- */
- void UpdatePathAndOpenL();
-
- /**
- * Return instance of CMTPPlaybackControlImpl.
- *
- */
- CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
-
-private:
-
- MMPXCollectionUiHelper* iCollectionUiHelper;//Owned
- MMPXCollectionHelper* iCollectionHelper;//Owned
- MMPXCollectionUtility* iCollectionUtil;//Owned
- HBufC* iPlayObject; //Owned
-
- CMTPPlaybackControlImpl& iMTPPlaybackControl;// Not owned
-
- TMTPPbCategory iPlayCategory;
- TInt iSongIndex;
- TInt iPathIndex;
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER;
- };
-
-#endif /* CMTPPLAYBACKPLAYLISTHELPER_H_ */
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackresumehelper.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef CMTPPLAYBACKRESUMEHELPER_H_
-#define CMTPPLAYBACKRESUMEHELPER_H_
-
-#include "mtpplaybackcontrolconst.h"
-#include "mmtpplaybackinterface.h"
-#include "mtpdebug.h"
-
-class CMTPPlaybackControlImpl;
-
-NONSHARABLE_CLASS( CMTPPlaybackResumeHelper ) : public CBase
- {
-public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CMTPPlaybackResumeHelper* NewL( CMTPPlaybackControlImpl& aControlImpl );
-
- /**
- * Destructor.
- */
- virtual ~CMTPPlaybackResumeHelper();
-
-public:
-
- /**
- Map the CMTPPlaybackCommand to MPXCommand,
- */
- void UpdatePrepareCmdArray( TMTPPlaybackCommand aMTPPPBCmd, RResumeCmdArray& aMTPPBMPXCmd );
-
- /**
- Map the CMTPPlaybackCommand to MPXCommand,
- */
- void UpdateResumeCmdArray( TMTPPlaybackCommand aMTPPPBCmd, RResumeCmdArray& aMTPPBMPXCmd );
-
-private:
-
- /**
- * C++ default constructor.
- */
- CMTPPlaybackResumeHelper( CMTPPlaybackControlImpl& aControlImpl );
-
-private:
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdInitObject( RResumeCmdArray& aMTPPBMPXCmdArray );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdInitIndex( RResumeCmdArray& aMTPPBMPXCmdArray );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdPlay( RResumeCmdArray& aMTPPBMPXCmdArray );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdPause( RResumeCmdArray& aMTPPBMPXCmdArray );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdSeekForward( RResumeCmdArray& aMTPPBMPXCmd );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdSeekBackward( RResumeCmdArray& aMTPPBMPXCmd );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdSkip( RResumeCmdArray& aMTPPBMPXCmd );
-
- /**
- * Map PlaybackCmd to PlaybackMPXCmd.
- */
- void HandlePlaybackCmdSetPosition( RResumeCmdArray& aMTPPBMPXCmd );
-
- /**
- * Return instance of CMTPPlaybackControlImpl.
- */
- CMTPPlaybackControlImpl& MTPPlaybackControlImpl();
-
-private:
-
- /**
- The handle of the owner
- */
- CMTPPlaybackControlImpl& iMTPPlaybackControl;
-
- TBool iIfParepareArray;
-
- /**
- FLOGGER debug trace member variable.
- */
- __FLOG_DECLARATION_MEMBER;
- };
-
-#endif /* CMTPPLAYBACKRESUMEHELPER_H_ */
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/mtpplaybackcontrolconst.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-
-/**
- @file
- @internalComponent
-*/
-
-#ifndef MTPPLAYBACKCONTROLCONST_H_
-#define MTPPLAYBACKCONTROLCONST_H_
-
-#include <mpxplaybackutility.h>
-
-/**
-Used by test db existed
-*/
-const TInt KMTPPlaybackInvalidSongID = 0x1FFFFFFF;
-const TInt KStorageRootMaxLength = 10;
-
-/**
-The volume step of mtp playback
-*/
-const TUint32 KMTPPlaybackVolumeStep = 1;
-
-/**
-The playlist or album level of collection path
-*/
-const TInt KMTPPlaybackPlaylistAblumLevel = 2;
-
-/**
-The album id of collection path
-*/
-const TInt KMPXCollectionArtistAlbum = 3;
-
-/**
-iMPXCommand is the mpx command
-iMPXExpectState is the expected state
-*/
-struct TMPXComandElement
- {
- TMPXPlaybackCommand iMPXCommand;
- TMPXPlaybackState iMPXExpectState;
- };
-
-typedef RArray<TMPXComandElement> RResumeCmdArray;
-
-/**
-The uid of playback control dp
-*/
-const TUid KMTPPlaybackControlDpUid = { 0x2002EA9A };
-
-#endif /* MTPPLAYBACKCONTROLCONST_H_ */
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcommandchecker.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackcommandchecker.h"
-#include "cmtpplaybackcontrolimpl.h"
-
-// Constants
-__FLOG_STMT(_LIT8(KComponent,"PlaybackCommandChecker");)
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::NewL
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackCommandChecker* CMTPPlaybackCommandChecker::NewL(
- CMTPPlaybackControlImpl& aControlImpl )
- {
- CMTPPlaybackCommandChecker* self = new ( ELeave )
- CMTPPlaybackCommandChecker( aControlImpl );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker()
- {
- __FLOG(_L8("+CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker"));
- __FLOG(_L8("-CMTPPlaybackCommandChecker::~CMTPPlaybackCommandChecker"));
- __FLOG_CLOSE;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL( TMTPPlaybackCommand aMTPPBCommand )
- {
- __FLOG(_L8("+CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL"));
-
- MTPPlaybackControlImpl().SetMTPPBCmd( aMTPPBCommand );
-
- switch ( aMTPPBCommand )
- {
- case EPlaybackCmdInitObject:
- case EPlaybackCmdGetVolumeSet:
- case EPlaybackCmdGetVolume:
- case EPlaybackCmdGetState:
- case EPlaybackCmdSetVolume:
- {
- __FLOG(_L8("no context check for init object command"));
- }
- break;
- case EPlaybackCmdInitIndex:
- case EPlaybackCmdSkip:
- case EPlaybackCmdGetIndex:
- {
- if ( MTPPlaybackControlImpl().SongCount() < 0 )
- {
- User::Leave( KPlaybackErrContextInvalid );
- }
- }
- break;
- case EPlaybackCmdPlay:
- case EPlaybackCmdPause:
- case EPlaybackCmdStop:
- case EPlaybackCmdSeekForward:
- case EPlaybackCmdSeekBackward:
- case EPlaybackCmdGetObject:
- case EPlaybackCmdSetPosition:
- case EPlaybackCmdGetPosition:
- {
- switch ( MTPPlaybackControlImpl().CurrentState())
- {
- case EPbStateNotInitialised:
- {
- User::Leave( KPlaybackErrContextInvalid );
- }
- default:
- break;
- }
- }
- break;
- default:
- {
- __FLOG(_L8("Not support command!"));
- User::Leave( KPlaybackErrParamInvalid );
- }
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackCommandChecker::CheckPlaybackCommandContextL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL( CMTPPlaybackCommand& aMTPPPBSourceCmd,
- CMTPPbCmdParam** aMTPPPBTargetParam )
- {
- __FLOG(_L8("+CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL"));
-
- delete *aMTPPPBTargetParam;
- *aMTPPPBTargetParam = NULL;
-
- switch ( aMTPPPBSourceCmd.PlaybackCommand())
- {
- case EPlaybackCmdInitObject:
- {
- const TMTPPbCategory category = aMTPPPBSourceCmd.ParamL().SuidSetL().Category();
- TFileName suid = aMTPPPBSourceCmd.ParamL().SuidSetL().Suid();
- *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( category, suid );
- }
- break;
- case EPlaybackCmdInitIndex:
- {
- TUint32 songIndex = aMTPPPBSourceCmd.ParamL().Uint32L();
- if ( songIndex > ( MTPPlaybackControlImpl().SongCount()-1 ))
- {
- User::Leave( KPlaybackErrParamInvalid );
- }
- *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( songIndex );
- }
- break;
- case EPlaybackCmdSkip:
- {
- TInt32 songIndex = MTPPlaybackControlImpl().SongIndex() + aMTPPPBSourceCmd.ParamL().Int32L();
- TUint32 songCount = MTPPlaybackControlImpl().SongCount();
-
- if ( songIndex < 0 )
- {
- songIndex = ( - songIndex ) % songCount;
- songIndex = ( songCount - songIndex ) % songCount;
- }
- else
- {
- songIndex = songIndex % songCount;
- }
-
- *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( songIndex);
- }
- break;
- case EPlaybackCmdSetVolume:
- {
- TUint32 volume = aMTPPPBSourceCmd.ParamL().Uint32L();
- if( volume > KPbPlaybackVolumeLevelMax )
- {
- User::Leave( KPlaybackErrParamInvalid );
- }
- *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( volume );
- }
- break;
- case EPlaybackCmdSetPosition:
- {
- TUint32 position= aMTPPPBSourceCmd.ParamL().Uint32L();
- *aMTPPPBTargetParam = CMTPPbCmdParam::NewL( position );
- }
- break;
- default:
- {
- __FLOG(_L8("No param, just cache command"));
- }
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackCommandChecker::CheckAndUpdatePlaybackParamL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::CMTPPlaybackCommandChecker
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackCommandChecker::CMTPPlaybackCommandChecker(
- CMTPPlaybackControlImpl& aControlImpl )
- : iMTPPlaybackControl( aControlImpl )
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackCommandChecker::MTPPlaybackControlImpl
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl& CMTPPlaybackCommandChecker::MTPPlaybackControlImpl()
- {
- return iMTPPlaybackControl;
- }
-
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcontrolimpl.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1097 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mpxmessagegeneraldefs.h>
-#include <mpxplaybackutility.h>
-#include <mpxplaybackmessage.h>
-#include <mpxplaybackmessagedefs.h>
-#include <mpxcommandgeneraldefs.h>
-
-#include <mpxcollectionplaylist.h>
-#include <mpxcollectionpath.h>
-
-#include "cmtpplaybackcontrolimpl.h"
-#include "cmtpplaybackplaylisthelper.h"
-#include "cmtpplaybackcommandchecker.h"
-#include "cmtpplaybackresumehelper.h"
-#include "mtpplaybackcontrolpanic.h"
-#include "cmtpplaybackcommand.h"
-#include "cmtpplaybackevent.h"
-
-// Constants
-__FLOG_STMT(_LIT8(KComponent,"PlaybackControlImpl");)
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::NewL
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl* CMTPPlaybackControlImpl::NewL(
- MMTPPlaybackObserver& aObserver )
- {
- CMTPPlaybackControlImpl* self = new ( ELeave )
- CMTPPlaybackControlImpl( aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::Close()
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::Close()
- {
- delete this;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl"));
-
- if ( iPlaybackUtility )
- {
- TRAP_IGNORE( SendMPXPlaybackCommandL( EPbCmdClose, ETrue ) );
- TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
- iPlaybackUtility->Close();
- }
-
- if ( iNowActivePlaybackUtility )
- {
- TRAP_IGNORE( SendMPXPlaybackCommandL( EPbCmdClose, EFalse ) );
- iNowActivePlaybackUtility->Close();
- }
-
- delete iPlaybackCommandChecker;
- delete iPlaybackPlaylistHelper;
- delete iPlaybackResumeHelper;
- delete iPlayList;
- iPrepareCmdArray.Reset();
- iPrepareCmdArray.Close();
- iResumeCmdArray.Reset();
- iResumeCmdArray.Close();
- delete iCmdParam;
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::~CMTPPlaybackControlImpl"));
- __FLOG_CLOSE;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::CommandL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::CommandL( CMTPPlaybackCommand& aCmd, MMTPPlaybackCallback* aCallback )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::CommandL"));
- __FLOG_1(_L8("The command code is 0x%X"), aCmd.PlaybackCommand() );
-
- iCallback = aCallback;
-
- TRAPD( err, CheckPlaybackCmdAndCacheL( aCmd ));
-
- if ( KErrNone == err )
- {
- UpdateCommandArray();
- DoCommandL();
- }
- else
- {
- CompleteSelf( err );
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::CommandL"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXPlaybackObserver
-// Handle playback message.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::HandlePlaybackMessage( CMPXMessage* aMessage,
- TInt aError )
- {
- __FLOG_1(_L8("+CMTPPlaybackControlImpl::HandlePlaybackMessage( %d ) "), aError );
-
- if (( KErrNone == aError ) && aMessage )
- {
- TRAP( aError, DoHandlePlaybackMessageL( *aMessage ) );
- }
-
- if ( KErrNone != aError )
- {
- DoHandleError( MapError( aError ));
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePlaybackMessage"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXPlaybackCallback
-// Handle playback property.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::HandlePropertyL( TMPXPlaybackProperty aProperty,
- TInt aValue, TInt aError )
- {
- __FLOG_VA((_L8("+CMTPPlaybackControlImpl::HandlePropertyL( aProperty = 0x%X, aValue = 0x%X, aError = %d ) "), aProperty, aValue, aError ));
-
- if ( KErrNone == aError )
- {
- TRAP( aError, DoHandlePropertyL( aProperty, aValue ));
- }
-
- if ( KErrNone != aError )
- {
- DoHandleError( MapError( aError ) );
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePropertyL"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXPlaybackCallback
-// Method is called continously until aComplete=ETrue, signifying that
-// it is done and there will be no more callbacks
-// Only new items are passed each time
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::HandleSubPlayerNamesL(
- TUid /* aPlayer */,
- const MDesCArray* /* aSubPlayers */,
- TBool /* aComplete */,
- TInt /* aError */ )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::HandleSubPlayerNamesL"));
- __FLOG(_L8("-CMTPPlaybackControlImpl::HandleSubPlayerNamesL"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXPlaybackCallback
-// Handle media
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::HandleMediaL( const CMPXMedia& aMedia,
- TInt aError )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::HandleMediaL"));
-
- if (( KErrNone == aError ) && ( aMedia.IsSupported( KMPXMediaGeneralUri )))
- {
- TRAP( aError, DoHandleMediaL( aMedia ));
- }
-
- if ( KErrNone != aError )
- {
- DoHandleError( MapError( aError ));
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::HandleMediaL"));
- }
-
-// ---------------------------------------------------------------------------
-// From CActive
-// CMTPPlaybackControlImpl::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoCancel()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoCancel"));
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoCancel"));
- }
-
-// ---------------------------------------------------------------------------
-// From CActive
-// CMTPPlaybackControlImpl::RunL()
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::RunL()
- {
- __FLOG(_L8("+CMTPBTConnection::RunL"));
-
- if ( KPlaybackErrNone == iStatus.Int() )
- {
- TRAPD( error, SendPlaybackCommandCompleteL());
- if ( error != KErrNone )
- {
- DoHandleError( MapError( error ) );
- }
- }
- else
- {
- DoHandleError( iStatus.Int());
- }
-
- __FLOG(_L8("-CMTPBTConnection::RunL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::CMTPPlaybackControlImpl
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl::CMTPPlaybackControlImpl(
- MMTPPlaybackObserver& aObserver )
- : CActive( EPriorityStandard ),
- iObserver( &aObserver )
- {
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("+CMTPPlaybackControlImpl::ConstructL"));
-
- iPlaybackUtility = MMPXPlaybackUtility::NewL( KMTPPlaybackControlDpUid, this );
- iNowActivePlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer );
-
- iPlaybackCommandChecker = CMTPPlaybackCommandChecker::NewL( *this );
- iPlaybackPlaylistHelper = CMTPPlaybackPlaylistHelper::NewL( *this );
- iPlaybackResumeHelper = CMTPPlaybackResumeHelper::NewL( *this );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::ConstructL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL( const CMPXCollectionPlaylist& aPlaylist )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::GetPlaylistFromCollectionCompleteL "));
-
- CMPXCollectionPlaylist* tmp =
- CMPXCollectionPlaylist::NewL( aPlaylist );
- CleanupStack::PushL( tmp );
- tmp->SetEmbeddedPlaylist( ETrue );
- tmp->SetRepeatEnabled( EFalse );
- tmp->SetShuffleEnabledL( EFalse );
- iPlaybackUtility->InitL( *tmp, ETrue );
- CleanupStack::PopAndDestroy( tmp );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::HandlePlaybackGetPlaylistCompleteL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::DeActiveOtherPlayerL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DeActiveOtherPlayerL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DeActiveOtherPlayerL()"));
-
- if ( iNowActivePlaybackUtility->StateL() != iPlaybackUtility->StateL())
- {
- SendMPXPlaybackCommandL( EPbCmdPause, EFalse );
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DeActiveOtherPlayerL()"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL( CMTPPlaybackCommand& aCmd )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL"));
-
- iPlaybackCommandChecker->CheckPlaybackCommandContextL( aCmd.PlaybackCommand());
- iPlaybackCommandChecker->CheckAndUpdatePlaybackParamL( aCmd, &iCmdParam );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::CheckPlaybackCmdAndCacheL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::UpdateCommandArrayL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::UpdateCommandArray()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::UpdateCommandArrayL"));
-
- iPlaybackResumeHelper->UpdatePrepareCmdArray( iMTPPBCmd, iPrepareCmdArray );
- iPlaybackResumeHelper->UpdateResumeCmdArray( iMTPPBCmd, iResumeCmdArray );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::UpdateCommandArrayL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::RequestMediaL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::RequestMediaL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::RequestMediaL"));
-
- if ( iPlayList )
- {
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL( iPlaybackPlaylistHelper->MTPPbCategory(),
- iPlaybackPlaylistHelper->MTPPbSuid());
- CompleteSelf( KPlaybackErrNone );
- }
- else if ( iPlaybackUtility->Source() )
- {
- //Album or Playlist
- iPlayList = iPlaybackUtility->Source()->PlaylistL();
-
- if ( iPlayList )
- {
- TMTPPbDataSuid suid( EMTPPbCatNone, KNullDesC );
- suid = iPlaybackPlaylistHelper->GetMTPPBSuidFromCollectionL( *iPlayList );
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL( suid.Category(), suid.Suid());
- CompleteSelf( KPlaybackErrNone );
- }
- else
- {
- //Single Song
- RArray<TMPXAttribute> attrs;
- CleanupClosePushL(attrs);
- attrs.Append( KMPXMediaGeneralUri );
- iPlaybackUtility->Source()->MediaL( attrs.Array(), *this );
- CleanupStack::PopAndDestroy( &attrs );
- }
- }
- else
- {
- //Not initialized
- CompleteSelf( KPlaybackErrContextInvalid );
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::RequestMediaL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::DoCommandL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoCommandL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoCommandL"));
-
- if ( iPrepareCmdArray.Count() != 0 )
- {
- InitiateMPXPlaybackCommandL( iPrepareCmdArray[0].iMPXCommand, ETrue );
- return;
- }
-
- switch ( iMTPPBCmd )
- {
- case EPlaybackCmdInitObject:
- {
- const TMTPPbCategory category = iCmdParam->SuidSetL().Category();
- if ( EMTPPbCatMusic == category )
- {
- iPlaybackUtility->InitL( iCmdParam->SuidSetL().Suid() );
- }
- else
- {
- iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->SuidSetL() );
- }
- }
- break;
- case EPlaybackCmdInitIndex:
- {
- iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->Uint32L() );
- }
- break;
- case EPlaybackCmdStop:
- {
- delete iPlayList;
- iPlayList = NULL;
- SendMPXPlaybackCommandL( EPbCmdClose, ETrue );
- CompleteSelf( KPlaybackErrNone );
- }
- break;
- case EPlaybackCmdSkip:
- {
- iPlaybackPlaylistHelper->GetPlayListFromCollectionL( iCmdParam->Int32L() );
- }
- break;
- case EPlaybackCmdSetVolume:
- {
- iPlaybackUtility->SetL( EPbPropertyVolume, iCmdParam->Uint32L() );
- }
- break;
- case EPlaybackCmdSetPosition:
- {
- iPlaybackUtility->PropertyL(*this, EPbPropertyDuration);
- }
- break;
- case EPlaybackCmdGetPosition:
- {
- iPlaybackUtility->PropertyL(*this, EPbPropertyPosition);
- }
- break;
- case EPlaybackCmdGetVolumeSet:
- case EPlaybackCmdGetVolume:
- {
- iPlaybackUtility->PropertyL(*this, EPbPropertyVolume);
- }
- break;
- case EPlaybackCmdGetState:
- {
- delete iCmdParam;
- iCmdParam = NULL;
- TMTPPlaybackState state = MapState( CurrentState());
- iCmdParam = CMTPPbCmdParam::NewL( static_cast<TUint32>( state ));
- CompleteSelf( KPlaybackErrNone );
- }
- break;
- case EPlaybackCmdGetObject:
- {
- RequestMediaL();
- }
- break;
- case EPlaybackCmdGetIndex:
- {
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL( static_cast<TUint32>( SongIndex()));
- CompleteSelf( KPlaybackErrNone );
- }
- break;
- default:
- {
- if ( iResumeCmdArray.Count() != 0 )
- {
- InitiateMPXPlaybackCommandL( iResumeCmdArray[0].iMPXCommand, ETrue );
- }
- else
- {
- CompleteSelf( KPlaybackErrNone );
- }
- }
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoCommandL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackControlImpl::DoHandlePlaybackMessageL
-// ----------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandlePlaybackMessageL"));
-
- TMPXMessageId id(
- aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
-
- if ( KMPXMessageGeneral == id )
- {
- TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
-
- switch ( event )
- {
- case TMPXPlaybackMessage::EPropertyChanged:
- {
- DoHandlePropertyL(
- aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
- aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ));
- }
- break;
- case TMPXPlaybackMessage::EStateChanged:
- {
- TMPXPlaybackState state(
- aMessage.ValueTObjectL<TMPXPlaybackState>(
- KMPXMessageGeneralType ));
- DoHandleStateChangedL( state );
- }
- break;
- case TMPXPlaybackMessage::EInitializeComplete:
- {
- DoHandleInitializeCompleteL();
- }
- break;
- case TMPXPlaybackMessage::EMediaChanged:
- {
- DoHandleMediaChangedL();
- }
- break;
- default:
- __FLOG_VA((_L8("DoHandlePlaybackMessageL( TMPXPlaybackMessage event = 0x%X ) "), event ));
- break;
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandlePlaybackMessageL"));
- }
-
-
-// ---------------------------------------------------------------------------
-// Handle playback property.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandlePropertyL( TInt aProperty, TInt aValue )
- {
- __FLOG_VA((_L8("+CMTPPlaybackControlImpl::DoHandlePropertyL( aProperty = 0x%X, aValue = 0x%X ) "), aProperty, aValue ));
-
- switch ( aProperty )
- {
- case EPbPropertyPosition:
- {
- if ( EPlaybackCmdGetPosition == MTPPBCmdHandling())
- {
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL(static_cast<TUint32>(aValue));
- SendPlaybackCommandCompleteL();
- }
- else if ( EPlaybackCmdSetPosition == MTPPBCmdHandling() )
- {
- if ( aValue == iCmdParam->Uint32L() )
- {
- SendPlaybackCommandCompleteL();
- }
- }
- }
- break;
- case EPbPropertyMute:
- {
- SendPlaybackEventL( EPlaybackEventVolumeUpdate );
- }
- break;
- case EPbPropertyVolume:
- {
- switch ( MTPPBCmdHandling() )
- {
- case EPlaybackCmdSetVolume:
- {
- SendPlaybackCommandCompleteL();
- }
- break;
- case EPlaybackCmdGetVolumeSet:
- {
- delete iCmdParam;
- iCmdParam = NULL;
- TMTPPbDataVolume volumeSet( KPbPlaybackVolumeLevelMax,
- KPbPlaybackVolumeLevelMin,
- KMPXPlaybackDefaultVolume,
- aValue,
- KMTPPlaybackVolumeStep );
- iCmdParam = CMTPPbCmdParam::NewL( volumeSet );
- SendPlaybackCommandCompleteL();
- }
- break;
- case EPlaybackCmdGetVolume:
- {
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL(static_cast<TUint32>( aValue ));
- SendPlaybackCommandCompleteL();
- }
- break;
- default:
- {
- SendPlaybackEventL( EPlaybackEventVolumeUpdate );
- }
- break;
- }
- }
- break;
- case EPbPropertyDuration:
- {
- if ( EPlaybackCmdSetPosition == MTPPBCmdHandling())
- {
- if ( iCmdParam->Uint32L() < aValue )
- {
- iPlaybackUtility->SetL( EPbPropertyPosition, iCmdParam->Uint32L() );
- }
- else
- {
- DoHandleError( KPlaybackErrParamInvalid );
- }
- }
- }
- break;
- default:
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandlePropertyL"));
- }
-
-// ---------------------------------------------------------------------------
-// Handle playback state changed.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandleStateChangedL( TMPXPlaybackState aState )
- {
- __FLOG_VA((_L8("+CMTPPlaybackControlImpl::DoHandleStateChangedL( aState = 0x%X ) "), aState ));
-
- if (( iPrepareCmdArray.Count() != 0 ) && ( iPrepareCmdArray[0].iMPXExpectState == aState ))
- {
- iPrepareCmdArray.Remove( 0 );
- DoCommandL();
- }
- else if (( iResumeCmdArray.Count() != 0 ) && ( iResumeCmdArray[0].iMPXExpectState == aState ))
- {
- iResumeCmdArray.Remove( 0 );
- SendPlaybackCommandCompleteL();
- }
- else if (( iState != aState ) && ( MapState( aState )!= MapState( iState ) ))
- {
- SendPlaybackEventL( EPlaybackEventStateUpdate );
- }
-
- if ( iState != aState )
- {
- iPreState = iState;
- iState = aState;
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleStateChangedL"));
- }
-
-// ---------------------------------------------------------------------------
-// DoHandleMediaL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandleMediaL( const CMPXMedia& aMedia )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleMediaL"));
-
- TFileName filePath(aMedia.ValueText(KMPXMediaGeneralUri) );
- delete iCmdParam;
- iCmdParam = NULL;
- iCmdParam = CMTPPbCmdParam::NewL( EMTPPbCatMusic, filePath );
- SendPlaybackCommandCompleteL();
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleMediaL"));
- }
-
-// ---------------------------------------------------------------------------
-// Handle media changed.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandleMediaChangedL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleMediaChangedL"));
-
- if (( EPbStateNotInitialised == iState ) || ( EPbStateInitialising == iState ))
- {
- if (( MTPPBCmdHandling() != EPlaybackCmdInitObject )
- && ( MTPPBCmdHandling() != EPlaybackCmdInitIndex )
- && ( MTPPBCmdHandling() != EPlaybackCmdSkip ))
- {
- //should send an event
- MMPXSource* source = iPlaybackUtility->Source();
- CMPXCollectionPlaylist* playlist = source->PlaylistL();
- if (( playlist != NULL ) && ( iPlayList != NULL ))
- {
- CleanupStack::PushL( playlist );
- //New media is a playlist or album
- TInt level = playlist->Path().Levels();
- if ( IfEqual(iPlayList->Path(), playlist->Path(), level-1 ) && !IfEqual(iPlayList->Path(), playlist->Path(), level ))
- {
- SendPlaybackEventL( EPlaybackEventObjectIndexUpdate );
-
- CleanupStack::Pop( playlist );
- delete iPlayList;
- iPlayList = playlist;
- }
- else
- {
- SendPlaybackEventL( EPlaybackEventObjectUpdate );
- SendPlaybackEventL( EPlaybackEventObjectIndexUpdate );
-
- CleanupStack::PopAndDestroy( playlist );
- delete iPlayList;
- iPlayList = NULL;
- }
- }
- else
- {
- //New media is a single song
- SendPlaybackEventL( EPlaybackEventObjectUpdate );
-
- delete iPlayList;
- iPlayList = NULL;
- }
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleMediaChangedL"));
- }
-
-// ---------------------------------------------------------------------------
-// Handle Initialize complete.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandleInitializeCompleteL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::DoHandleInitializeCompleteL"));
-
- if ( EPlaybackCmdInitObject == MTPPBCmdHandling()
- || EPlaybackCmdInitIndex == MTPPBCmdHandling()
- || EPlaybackCmdSkip == MTPPBCmdHandling())
- {
- delete iPlayList;
- iPlayList = NULL;
-
- MMPXSource* source = iPlaybackUtility->Source();
- if ( source )
- {
- iPlayList = source->PlaylistL();
- SendPlaybackCommandCompleteL();
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::DoHandleInitializeCompleteL"));
- }
-
-// ---------------------------------------------------------------------------
-// Handle error.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::DoHandleError( TInt aErr )
- {
- if ( aErr != KPlaybackErrNone )
- {
- if ( iCallback )
- {
- TRAP_IGNORE( iCallback->HandlePlaybackCommandCompleteL( NULL, aErr ));
- ResetPlaybackCommand();
- }
- else
- {
- TRAP_IGNORE( iObserver->HandlePlaybackEventL( NULL, aErr ));
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Compare two path according to level.
-// ---------------------------------------------------------------------------
-//
-TBool CMTPPlaybackControlImpl::IfEqual( const CMPXCollectionPath& aPathBase, const CMPXCollectionPath& aPathNew, TUint aLevel )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::IfEqual"));
-
- if (( aPathBase.Levels() < aLevel ) || ( aPathNew.Levels() < aLevel ))
- {
- return EFalse;
- }
- for ( TInt i = 0; i < aLevel; i++ )
- {
- if ( aPathBase.Index( i ) != aPathNew.Index( i ) )
- {
- return EFalse;
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::IfEqual"));
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Map states from TMPXPlaybackState to TMTPPlaybackState
-// ---------------------------------------------------------------------------
-//
-TMTPPlaybackState CMTPPlaybackControlImpl::MapState( TMPXPlaybackState aState )
- {
- __FLOG_VA((_L8("+CMTPPlaybackControlImpl::MapState( aState = 0x%X ) "), aState ));
-
- TMTPPlaybackState state = EPlayStateError;
-
- switch ( aState )
- {
- case EPbStatePlaying:
- {
- state = EPlayStatePlaying;
- }
- break;
- case EPbStatePaused:
- case EPbStateInitialising:
- case EPbStateInitialised:
- case EPbStateNotInitialised:
- case EPbStateStopped:
- {
- state = EPlayStatePaused;
- }
- break;
- case EPbStateSeekingForward:
- {
- state = EPlayStateForwardSeeking;
- }
- break;
- case EPbStateSeekingBackward:
- {
- state = EPlayStateBackwardSeeking;
- }
- break;
- default:
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::MapState"));
- return state;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::MapError.
-// ---------------------------------------------------------------------------
-//
-TInt CMTPPlaybackControlImpl::MapError( TInt aError )
- {
- TInt err( KPlaybackErrNone );
-
- if ( KErrHardwareNotAvailable == aError )
- {
- err = KPlaybackErrDeviceUnavailable;
- }
- else if ( KErrArgument == aError )
- {
- err = KPlaybackErrParamInvalid;
- }
- else
- {
- err = KPlaybackErrDeviceBusy;
- }
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::CompleteSelf.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::CompleteSelf( TInt aCompletionCode )
- {
- __FLOG_1(_L8("+CMTPPlaybackControlImpl::CompleteSelf( %d )"), aCompletionCode );
-
- SetActive();
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, aCompletionCode );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::CompleteSelf"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL"));
-
- switch ( aCommand )
- {
- case EPbCmdPlay:
- {
- DeActiveOtherPlayerL();
- SendMPXPlaybackCommandL( EPbCmdPlay, aIsMTPPlaybackUtility );
- }
- break;
- case EPbCmdPlayPause:
- {
- DeActiveOtherPlayerL();
- SendMPXPlaybackCommandL( EPbCmdPlayPause, aIsMTPPlaybackUtility );
- }
- break;
- default:
- {
- SendMPXPlaybackCommandL( aCommand, aIsMTPPlaybackUtility );
- }
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::InitiateMPXPlaybackCommandL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::SendMPXPlaybackCommandL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::SendMPXPlaybackCommandL( TMPXPlaybackCommand aCommand, TBool aIsMTPPlaybackUtility )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackCommandL"));
-
- CMPXCommand* cmd( CMPXCommand::NewL() );
- CleanupStack::PushL( cmd );
- cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
- cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
- cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCommand );
- cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralData, 0 );
-
- if ( aIsMTPPlaybackUtility )
- {
- iPlaybackUtility->CommandL( *cmd, this );
- }
- else
- {
- iNowActivePlaybackUtility->CommandL( *cmd );
- }
-
- CleanupStack::PopAndDestroy( cmd );
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackCommandL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL"));
-
- __ASSERT_DEBUG( iCallback, Panic( EMTPPBCallbackInvalid ));
- __ASSERT_DEBUG(( iMTPPBCmd > EPlaybackCmdNone ) && ( iMTPPBCmd < EPlaybackCmdEnd ), Panic( EMTPPBCallbackInvalid ));
-
- if ( iResumeCmdArray.Count() != 0 )
- {
- InitiateMPXPlaybackCommandL( iResumeCmdArray[0].iMPXCommand, ETrue );
- }
- else
- {
- CMTPPlaybackCommand* cmd = CMTPPlaybackCommand::NewL( iMTPPBCmd, iCmdParam );
- iCmdParam = NULL;//Ownership is handled to CMTPPlaybackCommand
- CleanupStack::PushL(cmd);
- iCallback->HandlePlaybackCommandCompleteL( cmd );
- CleanupStack::PopAndDestroy(cmd);
-
- ResetPlaybackCommand();
- }
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackCommandCompleteL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::SendPlaybackEventL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::SendPlaybackEventL( TMTPPlaybackEvent aEvt )
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::SendPlaybackEventL"));
-
- CMTPPlaybackEvent* event = CMTPPlaybackEvent::NewL( aEvt, NULL );
- CleanupStack::PushL(event);
- iObserver->HandlePlaybackEventL( event );
- CleanupStack::PopAndDestroy(event);
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::SendPlaybackEventL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackControlImpl::ResetPlaybackCommand.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::ResetPlaybackCommand()
- {
- __FLOG(_L8("+CMTPPlaybackControlImpl::ResetPlaybackCommand"));
-
- iCallback = NULL;
- iMTPPBCmd = EPlaybackCmdNone;
- iPrepareCmdArray.Reset();
- iResumeCmdArray.Reset();
- delete iCmdParam;
- iCmdParam = NULL;
-
- __FLOG(_L8("-CMTPPlaybackControlImpl::ResetPlaybackCommand"));
- }
-
-// ---------------------------------------------------------------------------
-// Return current state
-// ---------------------------------------------------------------------------
-//
-TMPXPlaybackState CMTPPlaybackControlImpl::CurrentState() const
- {
- return iState;
- }
-
-// ---------------------------------------------------------------------------
-// Return previous state
-// ---------------------------------------------------------------------------
-//
-TMPXPlaybackState CMTPPlaybackControlImpl::PreviousState() const
- {
- return iPreState;
- }
-
-// ---------------------------------------------------------------------------
-// Return song count
-// ---------------------------------------------------------------------------
-//
-TInt32 CMTPPlaybackControlImpl::SongCount() const
- {
- TInt32 songCount = -1;
- if ( iPlayList )
- {
- songCount = iPlayList->Count();
- }
- return songCount;
- }
-
-// ---------------------------------------------------------------------------
-// Return song index
-// ---------------------------------------------------------------------------
-//
-TInt32 CMTPPlaybackControlImpl::SongIndex() const
- {
- TInt32 songIndex = -1;
- if ( iPlayList )
- {
- TInt level = iPlayList->Path().Levels();
- songIndex = iPlayList->Path().Index( level-1 );
- }
- return songIndex;
- }
-
-// ---------------------------------------------------------------------------
-// Set mtp playback command
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackControlImpl::SetMTPPBCmd( TMTPPlaybackCommand aMTPPBCmd )
- {
- iMTPPBCmd = aMTPPBCmd;
- }
-
-// ---------------------------------------------------------------------------
-// Return mtp playback command which is handling
-// ---------------------------------------------------------------------------
-//
-TMTPPlaybackCommand CMTPPlaybackControlImpl::MTPPBCmdHandling() const
- {
- if ( iPrepareCmdArray.Count() == 0 )
- {
- return iMTPPBCmd;
- }
- else
- {
- return EPlaybackCmdNone;
- }
-
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackplaylisthelper.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,756 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mpxmediamusicdefs.h>
-#include <mpxmediacontainerdefs.h>
-#include <mpxmessagegeneraldefs.h>
-#include <pathinfo.h>
-
-#include <mpxcollectionhelper.h>
-#include <mpxcollectionhelperfactory.h>
-#include <mpxcollectionuihelper.h>
-#include <mpxcollectionhelperfactory.h>
-
-#include <mpxcollectionutility.h>
-#include <mpxcollectionplaylist.h>
-#include <mpxcollectionmessage.h>
-#include <mpxcollectionpath.h>
-
-#include "cmtpplaybackcontrolimpl.h"
-#include "cmtpplaybackplaylisthelper.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Constants
-__FLOG_STMT(_LIT8(KComponent,"PlaybackPlaylistHelper");)
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::NewL
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackPlaylistHelper* CMTPPlaybackPlaylistHelper::NewL( CMTPPlaybackControlImpl& aControlImpl )
- {
- CMTPPlaybackPlaylistHelper* self = new ( ELeave )
- CMTPPlaybackPlaylistHelper( aControlImpl );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper"));
-
- if( iCollectionUiHelper )
- {
- iCollectionUiHelper->Close();
- }
-
- if ( iCollectionHelper )
- {
- iCollectionHelper->Close();
- }
-
- if( iCollectionUtil )
- {
- iCollectionUtil->Close();
- }
-
- delete iPlayObject;
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::~CMTPPlaybackPlaylistHelper"));
- __FLOG_CLOSE;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL
-//// Get Playlist via aMedia
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL( const TMTPPbDataSuid& aPlayObject )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
-
- //Reset
- ResetPlaySource();
-
- iPlayCategory = aPlayObject.Category();
- iPlayObject = aPlayObject.Suid().AllocL();
-
- switch ( iPlayCategory )
- {
- case EMTPPbCatPlayList:
- {
- OpenMusicPlayListPathL();
- }
- break;
- case EMTPPbCatAlbum:
- {
- OpenMusicAblumPathL();
- }
- break;
- default:
- {
- Panic( EMTPPBCollectionErrCall );
- }
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL
-// Get Playlist via index
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL( TInt aIndex )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
-
- iSongIndex = aIndex;
-
- UpdatePathAndOpenL();
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::GetMTPPBSuidFromCollectionL
-// ---------------------------------------------------------------------------
-//
-TMTPPbDataSuid CMTPPlaybackPlaylistHelper::GetMTPPBSuidFromCollectionL(
- const CMPXCollectionPlaylist& aPlaylist )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
-
- CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL();
- if ( path->Id() == aPlaylist.Path().Id( KMTPPlaybackPlaylistAblumLevel -1 ))
- {
- iPlayCategory = EMTPPbCatPlayList;
- }
- else
- {
- iPlayCategory = EMTPPbCatAlbum;
- }
- TFileName uri = ItemIdToUriL( aPlaylist.Path().Id( KMTPPlaybackPlaylistAblumLevel ));
- TMTPPbDataSuid dataSuid( iPlayCategory, uri );
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::GetPlayListFromCollectionL"));
- return dataSuid;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::MTPPbCategory
-// ---------------------------------------------------------------------------
-//
-TMTPPbCategory CMTPPlaybackPlaylistHelper::MTPPbCategory() const
- {
- return iPlayCategory;
- }
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::MTPPbSuid
-// ---------------------------------------------------------------------------
-//
-TFileName CMTPPlaybackPlaylistHelper::MTPPbSuid() const
- {
- return TFileName( *iPlayObject );
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXCollectionObserver
-// Handle completion of a asynchronous command
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr )
- {
- __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleCollectionMessage( %d ) "), aErr );
-
- if (( KErrNone == aErr ) && aMsg )
- {
- TRAP( aErr, DoHandleCollectionMessageL( *aMsg ));
- }
-
- if ( KErrNone != aErr )
- {
- TInt error = MTPPlaybackControlImpl().MapError( aErr );
- MTPPlaybackControlImpl().DoHandleError( error );
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleCollectionMessage"));
- }
-// ---------------------------------------------------------------------------
-// From MMPXCollectionObserver
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::HandleOpenL( const CMPXMedia& aEntries,
- TInt /*aIndex*/, TBool /*aComplete*/, TInt aError )
- {
- __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleOpenL( %d )"), aError );
-
- if ( KErrNone == aError )
- {
- TRAP( aError, DoHandleOpenL( aEntries ));
- }
-
- if ( KErrNone != aError )
- {
- TInt error = MTPPlaybackControlImpl().MapError( aError );
- MTPPlaybackControlImpl().DoHandleError( error );
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleOpenL"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXCollectionObserver
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
- TInt aError )
- {
- __FLOG_1(_L8("+CMTPPlaybackPlaylistHelper::HandleOpenL( aPlaylist, aError = %d )"), aError );
-
- if ( KErrNone == aError )
- {
- TRAP( aError, MTPPlaybackControlImpl().GetPlaylistFromCollectionCompleteL( aPlaylist ));
- }
-
- if ( KErrNone != aError )
- {
- TInt error = MTPPlaybackControlImpl().MapError( aError );
- MTPPlaybackControlImpl().DoHandleError( error );
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleOpenL( aPlaylist, aError )"));
- }
-
-// ---------------------------------------------------------------------------
-// From MMPXCollectionMediaObserver
-// ---------------------------------------------------------------------------
-void CMTPPlaybackPlaylistHelper::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::HandleCollectionMediaL"));
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::HandleCollectionMediaL"));
- }
-
-//
-// CMTPPlaybackPlaylistHelper::CMTPPlaybackPlaylistHelper
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackPlaylistHelper::CMTPPlaybackPlaylistHelper( CMTPPlaybackControlImpl& aControlImpl )
- : iCollectionUiHelper( NULL ),
- iCollectionHelper( NULL ),
- iCollectionUtil( NULL ),
- iPlayObject( NULL ),
- iMTPPlaybackControl( aControlImpl )
- {
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ConstructL"));
-
- iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
- iCollectionUtil = MMPXCollectionUtility::NewL( this, KMcModeDefault );
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ConstructL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::DoHandleCollectionMessageL( const CMPXMessage& aMsg )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage"));
-
- TMPXMessageId id( aMsg.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
-
- if ( KMPXMessageGeneral == id )
- {
- TInt event( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
- TInt type( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
- TInt data( aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
-
- __FLOG_VA((_L8("Event code is 0x%X, type code is 0x%X"), event, type ));
- __FLOG_1(_L8("Data code is 0x%X"), data );
-
- if ( event == TMPXCollectionMessage::EPathChanged &&
- type == EMcPathChangedByOpen &&
- data == EMcContainerOpened )
- {
- iCollectionUtil->Collection().OpenL();
- }
- else if ( event == TMPXCollectionMessage::EPathChanged &&
- type == EMcPathChangedByOpen &&
- data == EMcItemOpened )
- {
- iCollectionUtil->Collection().OpenL();
- }
- else if ( event == TMPXCollectionMessage::ECollectionChanged )
- {
- __FLOG(_L8("Ignore this event"));
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::DoHandleCollectionMessage"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackPlaylistHelper::DoHandleOpenL
-// ----------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia& aEntries )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia )"));
-
- if ( EMTPPbCatAlbum == iPlayCategory )
- {
- UpdateAlbumPathAndOpenL();
- }
- else
- {
- //playlist
- if ( -1 == iPathIndex )
- {
- //first, the top path
- UpdatePlaylistPathIndexL( aEntries );
-
- if ( -1 == iPathIndex )
- {
- MTPPlaybackControlImpl().DoHandleError( KPlaybackErrParamInvalid );
- }
- else
- {
- iCollectionUtil->Collection().OpenL( iPathIndex );
- }
- }
- else
- {
- //open the first song when initObject
- iCollectionUtil->Collection().OpenL( iSongIndex );
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::DoHandleOpenL( const CMPXMedia )"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL
-// ----------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL"));
-
- CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL();
- CleanupStack::PushL( path );
- iCollectionUtil->Collection().OpenL( *path );
- CleanupStack::PopAndDestroy( path );
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::OpenMusicPlayListPathL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL
-// ----------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL"));
-
- CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL();
- CleanupStack::PushL( path );
- path->AppendL(KMPXCollectionArtistAlbum);
- iCollectionUtil->Collection().OpenL( *path );
- CleanupStack::PopAndDestroy( path );
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::OpenMusicAblumPathL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackPlaylistHelper::ResetPlaySource
-// ----------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::ResetPlaySource()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ResetPlaySourceL"));
-
- iPathIndex = -1;
- iSongIndex = 0;
- delete iPlayObject;
- iPlayObject = NULL;
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ResetPlaySourceL"));
- }
-
-// ----------------------------------------------------
-// CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL
-// ----------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL( const CMPXMedia& aEntries )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL"));
- __ASSERT_DEBUG( iPlayCategory == EMTPPbCatPlayList, Panic( EMTPPBCollectionErrCall ));
-
- const CMPXMediaArray* refArray = aEntries.Value<CMPXMediaArray> ( KMPXMediaArrayContents );
- TInt count = refArray->Count();
- const TMPXItemId playlistId = UriToItemIdL();
-
- for ( TInt i=0; i<count; ++i )
- {
- CMPXMedia* container = refArray->AtL(i);
- /**
- * Try to find out the next path according to the
- * playlist's ItemId
- */
- if ( container->IsSupported( KMPXMediaGeneralId ))
- {
- const TMPXItemId tempId = container->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
- if ( tempId == playlistId )
- {
- iPathIndex = i;
- break;
- }
- }
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdatePlaylistPathIndexL"));
- }
-
-// ---------------------------------------------------------------------------
-// return instance of CollectionHelper.
-// ---------------------------------------------------------------------------
-//
-MMPXCollectionHelper* CMTPPlaybackPlaylistHelper::CollectionHelperL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::CollectionHelperL"));
-
- if ( iCollectionHelper == NULL )
- {
- iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionCachedHelperL();
-
- // Do a search for a song ID that does not exist
- RArray<TInt> contentIDs;
- CleanupClosePushL( contentIDs ); // + contentIDs
- contentIDs.AppendL( KMPXMediaIdGeneral );
-
- CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() );
- CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs
- CleanupStack::PushL( searchMedia ); // + searchMedia
-
- searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem );
- searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
- searchMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId,
- KMTPPlaybackInvalidSongID );
-
- /*
- * store root
- */
- TChar driveChar = 'c';
- TInt driveNumber;
- User::LeaveIfError( RFs::CharToDrive( driveChar, driveNumber ) );
-
- // get root path
- TBuf<KStorageRootMaxLength> storeRoot;
- User::LeaveIfError( PathInfo::GetRootPath( storeRoot, driveNumber ) );
-
- searchMedia->SetTextValueL( KMPXMediaGeneralDrive, storeRoot );
-
- RArray<TMPXAttribute> songAttributes;
- CleanupClosePushL( songAttributes ); // + songAttributes
- songAttributes.AppendL( KMPXMediaGeneralId );
-
- CMPXMedia* foundMedia = NULL;
- TRAPD( err, foundMedia = iCollectionHelper->FindAllL(
- *searchMedia,
- songAttributes.Array() ) );
-
- CleanupStack::PopAndDestroy( &songAttributes ); // - songAttributes
- CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia
-
- CleanupStack::PushL( foundMedia ); // + foundMedia
-
- if ( err != KErrNone )
- {
- iCollectionHelper->Close();
- iCollectionHelper = NULL;
- User::Leave( KErrGeneral );
- }
- CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::CollectionHelperL"));
- return iCollectionHelper;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::UriToItemIdL
-// ---------------------------------------------------------------------------
-//
-const TMPXItemId CMTPPlaybackPlaylistHelper::UriToItemIdL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UriToItemIdL"));
-
-
- TMPXItemId itemId( KMPXInvalidItemId );
- TInt error = KErrNone;
- CMPXMedia* result = NULL;
-
- RArray<TMPXAttribute> atts;
- CleanupClosePushL( atts );
- atts.AppendL( KMPXMediaGeneralId );
-
- if ( EMTPPbCatPlayList == iPlayCategory )
- {
- TRAP( error, result = CollectionHelperL()->GetL( *iPlayObject, atts.Array(), EMPXPlaylist ));
- }
- else
- {
- TRAP( error, result = CollectionHelperL()->GetL( *iPlayObject, atts.Array(), EMPXAbstractAlbum ));
- }
-
- if ( error != KErrNone )
- {
- CleanupStack::PopAndDestroy( &atts );
- }
- else
- {
- CleanupStack::PushL( result );
- itemId = result->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
- CleanupStack::PopAndDestroy( result );
- CleanupStack::PopAndDestroy( &atts );
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UriToItemIdL"));
- return itemId;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::ItemIdToUriL.
-// ---------------------------------------------------------------------------
-//
-const TFileName CMTPPlaybackPlaylistHelper::ItemIdToUriL( const TMPXItemId& aId )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::ItemIdToUriL"));
-
- TFileName itemUri( KNullDesC );
-
- RArray<TInt> contentIDs;
- CleanupClosePushL( contentIDs ); // + contentIDs
- contentIDs.AppendL( KMPXMediaIdGeneral );
-
- CMPXMedia* searchMedia = CMPXMedia::NewL( contentIDs.Array() );
- CleanupStack::PopAndDestroy( &contentIDs ); // - contentIDs
- CleanupStack::PushL( searchMedia ); // + searchMedia
-
- searchMedia->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem );
- if ( iPlayCategory == EMTPPbCatPlayList )
- {
- searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist );
- }
- else
- {
- searchMedia->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXAbstractAlbum );
- }
- searchMedia->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, aId );
-
- RArray<TMPXAttribute> resultAttributes;
- CleanupClosePushL( resultAttributes ); // + resultAttributes
- resultAttributes.AppendL( KMPXMediaGeneralUri );
-
- CMPXMedia* foundMedia = CollectionHelperL()->FindAllL(
- *searchMedia,
- resultAttributes.Array() );
-
- CleanupStack::PopAndDestroy( &resultAttributes ); // - resultAttributes
- CleanupStack::PopAndDestroy( searchMedia ); // - searchMedia
-
- CleanupStack::PushL( foundMedia ); // + foundMedia
- if ( !foundMedia->IsSupported( KMPXMediaArrayCount ))
- {
- User::Leave( KErrNotSupported );
- }
- else if ( *foundMedia->Value<TInt>( KMPXMediaArrayCount ) != 1 )
- {
- User::Leave( KErrNotSupported );
- }
-
- const CMPXMediaArray* tracksArray = foundMedia->Value<CMPXMediaArray> ( KMPXMediaArrayContents );
- CMPXMedia* item = tracksArray->AtL(0);
-
- if ( item->IsSupported( KMPXMediaGeneralUri ))
- {
- itemUri = item->ValueText(KMPXMediaGeneralUri);
- }
-
- CleanupStack::PopAndDestroy( foundMedia ); // - foundMedia
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::ItemIdToUriL"));
- return itemUri;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::FindAlbumSongsL
-// ---------------------------------------------------------------------------
-//
-CMPXMedia* CMTPPlaybackPlaylistHelper::FindAlbumSongsL( const TMPXItemId& aAlbumId )
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::FindAlbumSongsL"));
-
- // Fetch the songs for the selected album
- CMPXMedia* findCriteria = CMPXMedia::NewL();
- CleanupStack::PushL( findCriteria );
- findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
- findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
- findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, aAlbumId );
- RArray<TMPXAttribute> attrs;
- CleanupClosePushL( attrs );
- attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
- EMPXMediaGeneralTitle |
- EMPXMediaGeneralId ) );
- attrs.Append( KMPXMediaMusicAlbumTrack );
-
- CMPXMedia* foundMedia = CollectionHelperL()->FindAllL( *findCriteria,
- attrs.Array() );
- CleanupStack::PopAndDestroy( &attrs );
- CleanupStack::PopAndDestroy( findCriteria );
-
- if ( !foundMedia->IsSupported( KMPXMediaArrayCount ) )
- {
- User::Leave( KErrNotSupported );
- }
- TInt foundItemCount = *foundMedia->Value<TInt>( KMPXMediaArrayCount );
- if ( foundItemCount == 0 )
- {
- User::Leave( KErrNotFound );
- }
- if ( !foundMedia->IsSupported( KMPXMediaArrayContents ) )
- {
- User::Leave( KErrNotSupported );
- }
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::FindAlbumSongsL"));
- return foundMedia;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL.
-// aParam: const CMPXMedia& aAlbums
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL"));
-
- RArray<TMPXItemId> ids;
- CleanupClosePushL(ids);
-
- CMPXCollectionPath* cpath = iCollectionUtil->Collection().PathL();
- CleanupStack::PushL( cpath );
-
- if (cpath->Levels() == 3)
- {
- // go back one level before amending path with new levels
- cpath->Back();
- }
-
- const TMPXItemId id = UriToItemIdL();
- if ( KMPXInvalidItemId == id )
- {
- MTPPlaybackControlImpl().DoHandleError( KPlaybackErrParamInvalid );
- CleanupStack::PopAndDestroy( cpath );
- CleanupStack::PopAndDestroy(&ids);
- return;
- }
-
- ids.AppendL(id);
- cpath->AppendL( ids.Array() ); // top level items
- cpath->Set( 0 );
- ids.Reset();
-
- CMPXMedia* songs = FindAlbumSongsL( id );
- CleanupStack::PushL( songs );
- const CMPXMediaArray* tracksArray = songs->Value<CMPXMediaArray> ( KMPXMediaArrayContents );
- User::LeaveIfNull(const_cast<CMPXMediaArray*>(tracksArray));
- TUint count = tracksArray->Count();
- for (TInt i=0; i<count; ++i)
- {
- CMPXMedia* song = tracksArray->AtL(i);
- const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
- ids.AppendL(id);
- }
-
- cpath->AppendL(ids.Array()); // top level items
- cpath->Set( iSongIndex );
-
- iCollectionUtil->Collection().OpenL(*cpath);
- CleanupStack::PopAndDestroy( songs );
- CleanupStack::PopAndDestroy( cpath );
- CleanupStack::PopAndDestroy(&ids);
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdateAlbumPathAndOpenL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL.
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL()
- {
- __FLOG(_L8("+CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL()"));
-
- RArray<TMPXItemId> ids;
- CleanupClosePushL(ids);
-
- CMPXCollectionPath* cpath = iCollectionUtil->Collection().PathL();
- CleanupStack::PushL( cpath );
-
- cpath->Set( iSongIndex );
-
- iCollectionUtil->Collection().OpenL(*cpath);
- CleanupStack::PopAndDestroy( cpath );
- CleanupStack::PopAndDestroy(&ids);
-
- __FLOG(_L8("-CMTPPlaybackPlaylistHelper::UpdatePathAndOpenL( aSong Index )"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackPlaylistHelper::MTPPlaybackControlImpl.
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl& CMTPPlaybackPlaylistHelper::MTPPlaybackControlImpl()
- {
- return iMTPPlaybackControl;
- }
-
-
--- a/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackresumehelper.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,402 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackresumehelper.h"
-#include "cmtpplaybackcommand.h"
-#include "cmtpplaybackcontrolimpl.h"
-
-// Constants
-__FLOG_STMT(_LIT8(KComponent,"PlaybackResumeHelper");)
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::NewL
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackResumeHelper* CMTPPlaybackResumeHelper::NewL(
- CMTPPlaybackControlImpl& aControlImpl )
- {
- CMTPPlaybackResumeHelper* self = new ( ELeave )
- CMTPPlaybackResumeHelper( aControlImpl );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper()
- {
- __FLOG(_L8("+CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper"));
- __FLOG(_L8("-CMTPPlaybackResumeHelper::~CMTPPlaybackResumeHelper"));
- __FLOG_CLOSE;
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::UpdatePrepareCmdArray( TMTPPlaybackCommand aMTPPPBCmd,
- RResumeCmdArray& aMTPPBMPXCmd )
- {
- __FLOG(_L8("+CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL"));
-
- aMTPPBMPXCmd.Reset();
- iIfParepareArray = ETrue;
-
- switch ( aMTPPPBCmd )
- {
- case EPlaybackCmdSetPosition:
- {
- HandlePlaybackCmdSetPosition( aMTPPBMPXCmd );
- }
- break;
- default:
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackResumeHelper::UpdatePrepareCmdArrayL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::UpdateResumeCmdArrayL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::UpdateResumeCmdArray( TMTPPlaybackCommand aMTPPPBCmd,
- RResumeCmdArray& aMTPPBMPXCmd)
- {
- __FLOG(_L8("+CMTPPlaybackResumeHelper::MapMTPPBCommandToMPXCommandL"));
-
- aMTPPBMPXCmd.Reset();
- iIfParepareArray = EFalse;
-
- switch ( aMTPPPBCmd )
- {
- case EPlaybackCmdInitObject:
- {
- HandlePlaybackCmdInitObject( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdInitIndex:
- {
- HandlePlaybackCmdInitIndex( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdPlay:
- {
- HandlePlaybackCmdPlay( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdPause:
- {
- HandlePlaybackCmdPause( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdSkip:
- {
- HandlePlaybackCmdSkip( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdSeekForward:
- {
- HandlePlaybackCmdSeekForward( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdSeekBackward:
- {
- HandlePlaybackCmdSeekBackward( aMTPPBMPXCmd );
- }
- break;
- case EPlaybackCmdSetPosition:
- {
- HandlePlaybackCmdSetPosition( aMTPPBMPXCmd );
- }
- break;
- default:
- break;
- }
-
- __FLOG(_L8("-CMTPPlaybackResumeHelper::MapPlaybackControlCommandL"));
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::CMTPPlaybackResumeHelper
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackResumeHelper::CMTPPlaybackResumeHelper(
- CMTPPlaybackControlImpl& aControlImpl )
- : iMTPPlaybackControl( aControlImpl )
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObjectL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObject( RResumeCmdArray& aMTPPBMPXCmdArray )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( command );
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdInitObjectL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdInitIndex( RResumeCmdArray& aMTPPBMPXCmdArray )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( command );
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdPlayL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdPlay(RResumeCmdArray& aMTPPBMPXCmdArray )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePaused:
- case EPbStateStopped:
- case EPbStateInitialised:
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( command );
- }
- break;
- case EPbStateSeekingBackward:
- case EPbStateSeekingForward:
- {
- if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
- {
- TMPXComandElement tmp = { EPbCmdStopSeeking, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( tmp );
- }
- else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
- aMTPPBMPXCmdArray.Append( command );
- TMPXComandElement command1 = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( command1 );
- }
- }
- break;
- default:
- break;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdPauseL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdPause( RResumeCmdArray& aMTPPBMPXCmdArray )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- {
- TMPXComandElement command = { EPbCmdPlayPause, EPbStatePaused };
- aMTPPBMPXCmdArray.Append( command );
- }
- break;
- case EPbStateSeekingBackward:
- case EPbStateSeekingForward:
- {
- if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
- aMTPPBMPXCmdArray.Append( command );
- }
- else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
- aMTPPBMPXCmdArray.Append( command );
- TMPXComandElement command1 = { EPbCmdPlayPause, EPbStatePaused };
- aMTPPBMPXCmdArray.Append( command1 );
- }
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekForwardL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekForward( RResumeCmdArray& aMTPPBMPXCmd )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- case EPbStatePaused:
- {
- TMPXComandElement command = { EPbCmdStartSeekForward, EPbStateSeekingForward };
- aMTPPBMPXCmd.Append( command );
- }
- break;
- case EPbStateInitialised:
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmd.Append( command );
- TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
- aMTPPBMPXCmd.Append( command1 );
- }
- break;
- case EPbStateSeekingBackward:
- {
- if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
- aMTPPBMPXCmd.Append( command );
- TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
- aMTPPBMPXCmd.Append( command1 );
- }
- else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
- aMTPPBMPXCmd.Append( command );
- TMPXComandElement command1 = { EPbCmdStartSeekForward, EPbStateSeekingForward };
- aMTPPBMPXCmd.Append( command1 );
- }
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekBackwardL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdSeekBackward( RResumeCmdArray& aMTPPBMPXCmd )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- case EPbStatePaused:
- {
- TMPXComandElement command = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
- aMTPPBMPXCmd.Append( command );
- }
- break;
- case EPbStateSeekingForward:
- {
- if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePaused )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePaused };
- aMTPPBMPXCmd.Append( command );
- TMPXComandElement command1 = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
- aMTPPBMPXCmd.Append( command1 );
- }
- else if ( MTPPlaybackControlImpl().PreviousState() == EPbStatePlaying )
- {
- TMPXComandElement command = { EPbCmdStopSeeking, EPbStatePlaying };
- aMTPPBMPXCmd.Append( command );
- TMPXComandElement command1 = { EPbCmdStartSeekBackward, EPbStateSeekingBackward };
- aMTPPBMPXCmd.Append( command1 );
- }
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdSkipL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdSkip( RResumeCmdArray& aMTPPBMPXCmd )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmd.Append( command );
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::HandlePlaybackCmdSetPositionL
-// ---------------------------------------------------------------------------
-//
-void CMTPPlaybackResumeHelper::HandlePlaybackCmdSetPosition( RResumeCmdArray& aMTPPBMPXCmd )
- {
- switch ( MTPPlaybackControlImpl().CurrentState() )
- {
- case EPbStatePlaying:
- {
- if ( iIfParepareArray )
- {
- TMPXComandElement command = { EPbCmdPause, EPbStatePaused };
- aMTPPBMPXCmd.Append( command );
- }
- else
- {
- TMPXComandElement command = { EPbCmdPlay, EPbStatePlaying };
- aMTPPBMPXCmd.Append( command );
- }
- }
- break;
- default:
- break;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CMTPPlaybackResumeHelper::CMTPPlaybackControlImpl
-// ---------------------------------------------------------------------------
-//
-CMTPPlaybackControlImpl& CMTPPlaybackResumeHelper::MTPPlaybackControlImpl()
- {
- return iMTPPlaybackControl;
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropdesc.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,312 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/cmtptypedevicepropdesc.h>
-
-#include "cmtppbcgetdevicepropdesc.h"
-#include "mtpplaybackcontroldpconst.h"
-#include "cmtpplaybackcontroldp.h"
-#include "cmtpplaybackproperty.h"
-#include "cmtpplaybackmap.h"
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"GetPlaybackDevicePropDesc");)
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@param aFramework The data provider framework
-@param aConnection The connection from which the request comes
-@return a pointer to the created request processor object
-*/
-MMTPRequestProcessor* CMTPPbcGetDevicePropDesc::NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- CMTPPbcGetDevicePropDesc* self = new (ELeave) CMTPPbcGetDevicePropDesc(aFramework, aConnection, aDataProvider);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPbcGetDevicePropDesc::~CMTPPbcGetDevicePropDesc()
- {
- __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Entry"));
- delete iPropDesc;
- delete iPbCmd;
- __FLOG(_L8("~CMTPPbcGetDevicePropDesc - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPbcGetDevicePropDesc::CMTPPbcGetDevicePropDesc(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider) :
- CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
- iPlaybackControlDp(aDataProvider)
- {
- //Open the log system
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-/**
-GetDevicePropDesc request validator.
-@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
-*/
-TMTPResponseCode CMTPPbcGetDevicePropDesc::CheckRequestL()
- {
- __FLOG(_L8("CheckRequestL - Entry"));
- TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
- if(respCode == EMTPRespCodeOK)
- {
- respCode = EMTPRespCodeDevicePropNotSupported;
- TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
- const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
- for (TUint i(0); (i < count); i++)
- {
- if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
- {
- respCode = EMTPRespCodeOK;
- break;
- }
- }
- }
-
- __FLOG(_L8("CheckRequestL - Exit"));
- return respCode;
- }
-
-/**
-GetDevicePropDesc request handler.
-*/
-void CMTPPbcGetDevicePropDesc::ServiceL()
- {
- __FLOG(_L8("ServiceL - Entry"));
- //Destroy the previous playback command.
- delete iPbCmd;
- iPbCmd = NULL;
-
- //Get the device property code
- TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
- Uint32(TMTPTypeRequest::ERequestParameter1)));
-
- TMTPPbCtrlData data;
- data.iOptCode = EMTPOpCodeGetDevicePropDesc;
- data.iDevPropCode = propCode;
-
- //Get a new playback command.
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
-
- if(KErrNone == result)
- {
- MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
- TRAPD(err, control.CommandL(*iPbCmd, this));
- __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
- }
- else if(KErrNotSupported == result)
- {
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- }
- else
- {
- SendResponseL(EMTPRespCodeParameterNotSupported);
- }
-
- __FLOG(_L8("ServiceL - Exit"));
- }
-
-void CMTPPbcGetDevicePropDesc::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
- __FLOG_1(_L8("aErr %d"), aErr);
-
- TBool useDefault = EFalse;
- switch(aErr)
- {
- case KPlaybackErrNone:
- {
- __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
- __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((aCmd != NULL), User::Leave(KErrArgument));
- __ASSERT_ALWAYS((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), User::Leave(KErrArgument));
- __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
- }
- break;
- case KPlaybackErrContextInvalid:
- {
- useDefault = ETrue;
- }
- break;
- case KPlaybackErrDeviceUnavailable:
- {
- iPlaybackControlDp.RequestToResetPbCtrl();
- SendResponseL(EMTPRespCodeDeviceBusy);
- }
- return;
-
- default:
- {
- SendResponseL(EMTPRespCodeDeviceBusy);
- }
- return;
- }
-
- delete iPropDesc;
- iPropDesc = NULL;
-
- CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
- TMTPDevicePropertyCode propCode = static_cast<TMTPDevicePropertyCode>
- (Request().Uint32(TMTPTypeRequest::ERequestParameter1));
-
- switch (propCode)
- {
- case EMTPDevicePropCodeVolume:
- {
- TMTPPbDataVolume volSet(1,0,1,1,1);
- if(useDefault)
- {
- property.GetDefaultVolSet(volSet);
- }
- else
- {
- volSet = aCmd->ParamL().VolumeSetL();
- property.SetDefaultVolSetL(volSet);
- }
-
- CMTPTypeDevicePropDescRangeForm* form = CMTPTypeDevicePropDescRangeForm::NewLC(EMTPTypeUINT32);
- form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EMaximumValue, volSet.MaxVolume());
- form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EMinimumValue, volSet.MinVolume());
- form->SetUint32L(CMTPTypeDevicePropDescRangeForm::EStepSize, volSet.Step());
- iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode,
- CMTPTypeDevicePropDesc::EReadWrite,
- CMTPTypeDevicePropDesc::ERangeForm,
- form);
-
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, volSet.DefaultVolume());
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, volSet.CurrentVolume());
- CleanupStack::PopAndDestroy(form);
- SendDataL(*iPropDesc);
- }
- break;
-
- case EMTPDevicePropCodePlaybackRate:
- {
- CMTPTypeDevicePropDescEnumerationForm* form = CMTPTypeDevicePropDescEnumerationForm::
- NewLC(EMTPTypeINT32);
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
-
- TInt32 val = map.PlaybackRateL(EPlayStateBackwardSeeking);
- TMTPTypeInt32 value(val);
- form->AppendSupportedValueL(value);
-
- val = map.PlaybackRateL(EPlayStatePaused);
- value.Set(val);
- form->AppendSupportedValueL(value);
-
- val = map.PlaybackRateL(EPlayStatePlaying);
- value.Set(val);
- form->AppendSupportedValueL(value);
-
- val = map.PlaybackRateL(EPlayStateForwardSeeking);
- value.Set(val);
- form->AppendSupportedValueL(value);
-
- iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode,
- CMTPTypeDevicePropDesc::EReadWrite,
- CMTPTypeDevicePropDesc::EEnumerationForm,
- form);
-
- property.GetDefaultPropertyValueL(propCode, val);
- iPropDesc->SetInt32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
-
- if(!useDefault)
- {
- TMTPPlaybackState state = static_cast<TMTPPlaybackState>(aCmd->ParamL().Uint32L());
- val = map.PlaybackRateL(state);
- }
- iPropDesc->SetInt32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
- CleanupStack::PopAndDestroy(form);
-
- SendDataL(*iPropDesc);
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
- TUint32 val = 0;
- property.GetDefaultPropertyValueL(propCode, val);
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- if(!useDefault)
- {
- val = map.ObjectHandleL(aCmd->ParamL().SuidSetL().Suid());
- }
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
- SendDataL(*iPropDesc);
- }
- break;
-
- case EMTPDevicePropCodePlaybackContainerIndex:
- {
- iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
- TUint32 val = 0;
- property.GetDefaultPropertyValueL(propCode, val);
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
- if(!useDefault)
- {
- val = aCmd->ParamL().Uint32L();
- }
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
- SendDataL(*iPropDesc);
- }
- break;
-
- case EMTPDevicePropCodePlaybackPosition:
- {
- iPropDesc = CMTPTypeDevicePropDesc::NewL(propCode);
- TUint32 val = 0;
- CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
- property.GetDefaultPropertyValueL(propCode, val);
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::EFactoryDefaultValue, val);
- if(!useDefault)
- {
- val = aCmd->ParamL().Uint32L();
- }
- iPropDesc->SetUint32L(CMTPTypeDevicePropDesc::ECurrentValue, val);
- SendDataL(*iPropDesc);
- }
- break;
-
- default:
- {
- User::Leave(KErrArgument);
- }
- break;
- }
-
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropvalue.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/mmtpdataproviderframework.h>
-#include <mtp/mtpprotocolconstants.h>
-#include <mtp/tmtptyperequest.h>
-
-#include "cmtppbcgetdevicepropvalue.h"
-#include "mtpplaybackcontroldpconst.h"
-#include "cmtpplaybackcontroldp.h"
-#include "cmtpplaybackproperty.h"
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"GetPlaybackDevicePropValue");)
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@param aFramework The data provider framework
-@param aConnection The connection from which the request comes
-@return a pointer to the created request processor object.
-*/
-MMTPRequestProcessor* CMTPPbcGetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- CMTPPbcGetDevicePropValue* self = new (ELeave) CMTPPbcGetDevicePropValue(aFramework, aConnection, aDataProvider);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPbcGetDevicePropValue::~CMTPPbcGetDevicePropValue()
- {
- __FLOG(_L8("~CMTPPbcGetDevicePropValue - Entry"));
- delete iPbCmd;
- __FLOG(_L8("~CMTPPbcGetDevicePropValue - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPbcGetDevicePropValue::CMTPPbcGetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider):
- CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
- iPlaybackControlDp(aDataProvider)
- {
- //Open the log system
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-/**
-CMTPPbcGetDevicePropValue request validator.
-@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
-*/
-TMTPResponseCode CMTPPbcGetDevicePropValue::CheckRequestL()
- {
- __FLOG(_L8("CheckRequestL - Entry"));
- TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
- if(respCode == EMTPRespCodeOK)
- {
- respCode = EMTPRespCodeDevicePropNotSupported;
- TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
- const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) /
- sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
- for (TUint i(0); (i < count); i++)
- {
- if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
- {
- respCode = EMTPRespCodeOK;
- break;
- }
- }
- }
- __FLOG(_L8("CheckRequestL - Exit"));
- return respCode;
- }
-
-/**
-CMTPPbcGetDevicePropValue request handler.
-*/
-void CMTPPbcGetDevicePropValue::ServiceL()
- {
- __FLOG(_L8("ServiceL - Entry"));
- //Destroy the previous playback command.
- delete iPbCmd;
- iPbCmd = NULL;
-
- //Get the device property code
- TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
- Uint32(TMTPTypeRequest::ERequestParameter1)));
-
- TMTPPbCtrlData data;
- data.iOptCode = EMTPOpCodeGetDevicePropValue;
- data.iDevPropCode = propCode;
-
- //Get a new playback command.
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
-
- if(KErrNone == result)
- {
- MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
- TRAPD(err, control.CommandL(*iPbCmd, this));
- __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
- }
- else if(KErrNotSupported == result)
- {
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- }
- else
- {
- SendResponseL(EMTPRespCodeParameterNotSupported);
- }
- __FLOG(_L8("ServiceL - Exit"));
- }
-
-void CMTPPbcGetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
- __FLOG_1(_L8("aErr %d"), aErr);
-
- //Handle the error
- TBool useDefault = EFalse;
- switch(aErr)
- {
- case KPlaybackErrNone:
- {
- __ASSERT_DEBUG((aCmd != NULL), Panic(EMTPPBDataNullErr));
- __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
- __ASSERT_ALWAYS((aCmd != NULL), User::Leave(KErrArgument));
- __ASSERT_ALWAYS((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), User::Leave(KErrArgument));
- __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
- }
- break;
- case KPlaybackErrContextInvalid:
- {
- useDefault = ETrue;
- }
- break;
- case KPlaybackErrDeviceUnavailable:
- {
- iPlaybackControlDp.RequestToResetPbCtrl();
- SendResponseL(EMTPRespCodeDeviceBusy);
- }
- return;
- default:
- {
- SendResponseL(EMTPRespCodeDeviceBusy);
- }
- return;
- }
-
- CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
- TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>
- (Request().Uint32(TMTPTypeRequest::ERequestParameter1)));
-
- switch(propCode)
- {
- case EMTPDevicePropCodePlaybackRate:
- {
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- TInt32 val;
- if(useDefault)
- {
- property.GetDefaultPropertyValueL(propCode, val);
- }
- else
- {
- TMTPPlaybackState state = static_cast<TMTPPlaybackState>(aCmd->ParamL().Uint32L());
- val = map.PlaybackRateL(state);
- }
- iInt32.Set(val);
- SendDataL(iInt32);
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- TUint32 val;
- if(useDefault)
- {
- property.GetDefaultPropertyValueL(propCode, val);
- }
- else
- {
- val = map.ObjectHandleL(aCmd->ParamL().SuidSetL().Suid());
- }
- iUint32.Set(val);
- SendDataL(iUint32);
- }
- break;
-
- case EMTPDevicePropCodeVolume:
- case EMTPDevicePropCodePlaybackContainerIndex:
- case EMTPDevicePropCodePlaybackPosition:
- {
- TUint32 val;
- if(useDefault)
- {
- property.GetDefaultPropertyValueL(propCode, val);
- }
- else
- {
- val = aCmd->ParamL().Uint32L();
- }
- iUint32.Set(val);
- SendDataL(iUint32);
- }
- break;
-
- default:
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- break;
- }
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcresetdevicepropvalue.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtppbcresetdevicepropvalue.h"
-#include "mtpplaybackcontroldpconst.h"
-#include "cmtpplaybackcontroldp.h"
-#include "cmtpplaybackproperty.h"
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"ResetPlaybackDevicePropValue");)
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@param aFramework The data provider framework
-@param aConnection The connection from which the request comes
-@return a pointer to the created request processor object.
-*/
-MMTPRequestProcessor* CMTPPbcResetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- CMTPPbcResetDevicePropValue* self = new (ELeave) CMTPPbcResetDevicePropValue(aFramework, aConnection, aDataProvider);
- return self;
- }
-
-/**
-Destructor
-*/
-CMTPPbcResetDevicePropValue::~CMTPPbcResetDevicePropValue()
- {
- __FLOG(_L8("~CMTPPbcResetDevicePropValue - Entry"));
- delete iPbCmd;
- __FLOG(_L8("~CMTPPbcResetDevicePropValue - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Standard c++ constructor
-*/
-CMTPPbcResetDevicePropValue::CMTPPbcResetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider):
- CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
- iPlaybackControlDp(aDataProvider)
- {
- //Open the log system
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-/**
-SetDevicePropValue request validator.
-@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
-*/
-TMTPResponseCode CMTPPbcResetDevicePropValue::CheckRequestL()
- {
- __FLOG(_L8("CheckRequestL - Entry"));
- TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
- if(respCode == EMTPRespCodeOK)
- {
- respCode = EMTPRespCodeDevicePropNotSupported;
- TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
- const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
- for (TUint i(0); (i < count); i++)
- {
- if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
- {
- respCode = EMTPRespCodeOK;
- break;
- }
- }
- }
-
- __FLOG(_L8("CheckRequestL - Exit"));
- return respCode;
- }
-/**
-ResetDevicePropValue request handler.
-*/
-void CMTPPbcResetDevicePropValue::ServiceL()
- {
- __FLOG(_L8("ServiceL - Entry"));
-
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- //Destroy the previous playback command.
- delete iPbCmd;
- iPbCmd = NULL;
-
- //Get a new playback command.
- iData.iOptCode = EMTPOpCodeResetDevicePropValue;
- TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
- Uint32(TMTPTypeRequest::ERequestParameter1)));
- iData.iDevPropCode = propCode;
- CMTPPlaybackProperty& property(iPlaybackControlDp.GetPlaybackProperty());
- property.GetDefaultPropertyValueL(iData);
-
- TInt result = map.GetPlaybackControlCommand(iData, &iPbCmd);
-
- if(KErrNone == result)
- {
- MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
- TRAPD(err, control.CommandL(*iPbCmd, this));
- __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeParameterNotSupported));
- }
- else if(KErrNotSupported == result)
- {
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- }
- else
- {
- SendResponseL(EMTPRespCodeParameterNotSupported);
- }
-
- __FLOG(_L8("ServiceL - Exit"));
- }
-
-void CMTPPbcResetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
- __FLOG_1(_L8("aErr %d"), aErr);
-
- //Handle error response.
- TMTPResponseCode response;
- switch(aErr)
- {
- case KPlaybackErrNone:
- {
- response = EMTPRespCodeOK;
- }
- break;
- case KPlaybackErrDeviceUnavailable:
- {
- response = EMTPRespCodeDeviceBusy;
- iPlaybackControlDp.RequestToResetPbCtrl();
- }
- break;
- case KPlaybackErrContextInvalid:
- {
- response = EMTPRespCodeAccessDenied;
- }
- break;
- default:
- {
- response = EMTPRespCodeDeviceBusy;
- }
- break;
- }
-
- SendResponseL(response);
-
- if(aCmd != NULL)
- {
- __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
- __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
- }
-
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcsetdevicepropvalue.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/mmtpdataproviderframework.h>
-#include <mtp/mtpprotocolconstants.h>
-
-#include "cmtppbcsetdevicepropvalue.h"
-#include "mtpplaybackcontroldpconst.h"
-#include "cmtpplaybackcontroldp.h"
-#include "cmtpplaybackproperty.h"
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"SetPlaybackDevicePropValue");)
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@param aFramework The data provider framework
-@param aConnection The connection from which the request comes
-@return a pointer to the created request processor object.
-*/
-MMTPRequestProcessor* CMTPPbcSetDevicePropValue::NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- CMTPPbcSetDevicePropValue* self = new (ELeave) CMTPPbcSetDevicePropValue(aFramework, aConnection, aDataProvider);
- return self;
- }
-
-/**
-Destructor
-*/
-CMTPPbcSetDevicePropValue::~CMTPPbcSetDevicePropValue()
- {
- __FLOG(_L8("~CMTPPbcSetDevicePropValue - Entry"));
- delete iPbCmd;
- __FLOG(_L8("~CMTPPbcSetDevicePropValue - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Standard c++ constructor
-*/
-CMTPPbcSetDevicePropValue::CMTPPbcSetDevicePropValue(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider):
- CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
- iPlaybackControlDp(aDataProvider)
- {
- //Open the log system
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-/**
-CMTPPbcSetDevicePropValue request validator.
-@return EMTPRespCodeOK if request is verified, otherwise one of the error response codes
-*/
-TMTPResponseCode CMTPPbcSetDevicePropValue::CheckRequestL()
- {
- __FLOG(_L8("CheckRequestL - Entry"));
- TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
- if(respCode == EMTPRespCodeOK)
- {
- respCode = EMTPRespCodeDevicePropNotSupported;
- TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
- const TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
- for (TUint i(0); (i < count); i++)
- {
- if (propCode == KMTPPlaybackControlDpSupportedProperties[i])
- {
- respCode = EMTPRespCodeOK;
- break;
- }
- }
- }
-
- __FLOG(_L8("CheckRequestL - Exit"));
- return respCode;
- }
-
-/**
-Process the transaction response phase.
-*/
-TBool CMTPPbcSetDevicePropValue::DoHandleResponsePhaseL()
- {
- __FLOG(_L8("DoHandleResponsePhaseL - Entry"));
-
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- //Destroy the previous playback command.
- delete iPbCmd;
- iPbCmd = NULL;
-
- //Get a new playback command.
- TInt result = map.GetPlaybackControlCommand(iData, &iPbCmd);
-
- if(KErrNone == result)
- {
- MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
- TRAPD(err, control.CommandL(*iPbCmd, this));
- __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeInvalidDevicePropValue));
- }
- else if(KErrNotSupported == result)
- {
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- }
- else
- {
- SendResponseL(EMTPRespCodeInvalidDevicePropValue);
- }
-
- __FLOG(_L8("DoHandleResponsePhaseL - Exit"));
- return EFalse;
- }
-
-void CMTPPbcSetDevicePropValue::ServiceL()
- {
- __FLOG(_L8("ServiceL - Entry"));
- TMTPDevicePropertyCode propCode(static_cast<TMTPDevicePropertyCode>(Request().
- Uint32(TMTPTypeRequest::ERequestParameter1)));
- iData.iOptCode = EMTPOpCodeSetDevicePropValue;
- iData.iDevPropCode = propCode;
- switch(propCode)
- {
- case EMTPDevicePropCodePlaybackRate:
- {
- ReceiveDataL(iData.iPropValInt32);
- }
- break;
- case EMTPDevicePropCodeVolume:
- case EMTPDevicePropCodePlaybackObject:
- case EMTPDevicePropCodePlaybackContainerIndex:
- case EMTPDevicePropCodePlaybackPosition:
- {
- ReceiveDataL(iData.iPropValUint32);
- }
- break;
-
- default:
- {
- SendResponseL(EMTPRespCodeDevicePropNotSupported);
- }
- break;
- }
- __FLOG(_L8("ServiceL - Exit"));
- }
-
-void CMTPPbcSetDevicePropValue::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
- __FLOG_1(_L8("aErr %d"), aErr);
-
- //Handle error response.
- TMTPResponseCode response;
- switch(aErr)
- {
- case KPlaybackErrNone:
- {
- response = EMTPRespCodeOK;
- }
- break;
- case KPlaybackErrDeviceUnavailable:
- {
- response = EMTPRespCodeDeviceBusy;
- iPlaybackControlDp.RequestToResetPbCtrl();
- }
- break;
- case KPlaybackErrContextInvalid:
- {
- CMTPPlaybackProperty& prop(iPlaybackControlDp.GetPlaybackProperty());
- if(prop.IsDefaultPropertyValueL(iData))
- {
- response = EMTPRespCodeOK;
- }
- else
- {
- response = EMTPRespCodeAccessDenied;
- }
- }
- break;
- case KPlaybackErrParamInvalid:
- {
- response = EMTPRespCodeInvalidDevicePropValue;
- }
- break;
- default:
- {
- response = EMTPRespCodeDeviceBusy;
- }
- break;
- }
-
- SendResponseL(response);
-
- if(aCmd != NULL)
- {
- __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
- __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
- }
-
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcskip.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/mmtpdataproviderframework.h>
-#include <mtp/mtpprotocolconstants.h>
-#include <mtp/tmtptyperequest.h>
-
-#include "cmtppbcskip.h"
-#include "mtpplaybackcontroldpconst.h"
-#include "cmtpplaybackmap.h"
-#include "cmtpplaybackcontroldp.h"
-#include "cmtpplaybackproperty.h"
-#include "cmtpplaybackcommand.h"
-#include "mtpplaybackcontrolpanic.h"
-
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"Skip");)
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@param aFramework The data provider framework
-@param aConnection The connection from which the request comes
-@return a pointer to the created request processor object.
-*/
-MMTPRequestProcessor* CMTPPbcSkip::NewL(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- CMTPPbcSkip* self = new (ELeave) CMTPPbcSkip(aFramework, aConnection, aDataProvider);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPbcSkip::~CMTPPbcSkip()
- {
- __FLOG(_L8("CMTPPbcSkip - Entry"));
- delete iPbCmd;
- __FLOG(_L8("CMTPPbcSkip - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPbcSkip::CMTPPbcSkip(MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider):
- CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
- iPlaybackControlDp(aDataProvider)
- {
- //Open the log system
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- }
-
-/**
-CheckRequestL
-*/
-TMTPResponseCode CMTPPbcSkip::CheckRequestL()
- {
- __FLOG(_L8("CheckRequestL - Entry"));
- TMTPResponseCode respCode = CMTPRequestProcessor::CheckRequestL();
- if(respCode == EMTPRespCodeOK)
- {
- respCode = EMTPRespCodeInvalidParameter;
- TUint32 step = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
- if(step != 0)
- {
- respCode = EMTPRespCodeOK;
- }
- }
- __FLOG(_L8("CheckRequestL - Exit"));
- return respCode;
- }
-
-/**
-CMTPPbcSkip request handler.
-*/
-void CMTPPbcSkip::ServiceL()
- {
- __FLOG(_L8("ServiceL - Entry"));
- CMTPPlaybackMap& map(iPlaybackControlDp.GetPlaybackMap());
- MMTPPlaybackControl& control(iPlaybackControlDp.GetPlaybackControlL());
-
- TMTPPbCtrlData data;
- data.iOptCode = EMTPOpCodeSkip;
- data.iPropValInt32 = static_cast<TInt32>(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
-
- TInt result = map.GetPlaybackControlCommand(data, &iPbCmd);
-
- if(KErrNone == result)
- {
- TRAPD(err, control.CommandL(*iPbCmd, this));
- __ASSERT_ALWAYS((err == KErrNone), SendResponseL(EMTPRespCodeInvalidParameter));
- }
- else
- {
- SendResponseL(EMTPRespCodeInvalidParameter);
- }
- __FLOG(_L8("ServiceL - Exit"));
- }
-
-void CMTPPbcSkip::HandlePlaybackCommandCompleteL(CMTPPlaybackCommand* aCmd, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Entry"));
- __FLOG_1(_L8("aErr %d"), aErr);
-
- //Handle error response.
- TMTPResponseCode response;
- switch(aErr)
- {
- case KPlaybackErrNone:
- {
- response = EMTPRespCodeOK;
- }
- break;
- case KPlaybackErrDeviceBusy:
- {
- response = EMTPRespCodeDeviceBusy;
- }
- break;
- case KPlaybackErrDeviceUnavailable:
- {
- response = EMTPRespCodeDeviceBusy;
- iPlaybackControlDp.RequestToResetPbCtrl();
- }
- break;
- default:
- {
- response = EMTPRespCodeInvalidParameter;
- }
- break;
- }
-
- SendResponseL(response);
-
- if(aCmd != NULL)
- {
- __ASSERT_DEBUG((aCmd->PlaybackCommand() == iPbCmd->PlaybackCommand()), Panic(EMTPPBArgumentErr));
- __FLOG_1(_L8("aCmd %d"), aCmd->PlaybackCommand());
- }
-
- __FLOG(_L8("HandlePlaybackCommandCompleteL - Exit"));
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackcontroldp.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,392 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/mmtpconnection.h>
-#include <mtp/mmtpdataproviderframework.h>
-#include <mtp/mtpdataproviderapitypes.h>
-
-#include "cmtpplaybackcontroldp.h"
-#include "cmtprequestprocessor.h"
-#include "mtpplaybackcontroldpprocessor.h"
-#include "cmtpplaybackmap.h"
-#include "cmtpplaybackproperty.h"
-#include "mmtpplaybackinterface.h"
-#include "cmtpplaybackevent.h"
-#include "mtpplaybackcontrolpanic.h"
-
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"PlaybackControlDataProvider");)
-static const TInt KMTPPlaybackControlDpSessionGranularity(3);
-
-/**
-MTP playback control data provider plug-in factory method.
-@return A pointer to an MTP playback control data provider plug-in. Ownership IS
-transfered.
-@leave One of the system wide error codes, if a processing failure occurs.
-*/
-TAny* CMTPPlaybackControlDataProvider::NewL(TAny* aParams)
- {
- CMTPPlaybackControlDataProvider* self = new (ELeave) CMTPPlaybackControlDataProvider(aParams);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-/**
-Destructor
-*/
-CMTPPlaybackControlDataProvider::~CMTPPlaybackControlDataProvider()
- {
- __FLOG(_L8("~CMTPPlaybackControlDataProvider - Entry"));
- TInt count = iActiveProcessors.Count();
- while(count--)
- {
- iActiveProcessors[count]->Release();
- }
- iActiveProcessors.Close();
- delete iPlaybackMap;
- delete iPlaybackProperty;
- if(iPlaybackControl)
- {
- iPlaybackControl->Close();
- }
- __FLOG(_L8("~CMTPPlaybackControlDataProvider - Exit"));
- __FLOG_CLOSE;
- }
-
-void CMTPPlaybackControlDataProvider::Cancel()
- {
-
- }
-
-void CMTPPlaybackControlDataProvider::ProcessEventL(const TMTPTypeEvent& /*aEvent*/, MMTPConnection& /*aConnection*/)
- {
- __FLOG(_L8("ProcessEventL - Entry"));
- __FLOG(_L8("ProcessEventL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::ProcessNotificationL(TMTPNotification aNotification, const TAny* aParams)
- {
- __FLOG(_L8("ProcessNotificationL - Entry"));
- switch (aNotification)
- {
- case EMTPSessionClosed:
- SessionClosedL(*reinterpret_cast<const TMTPNotificationParamsSessionChange*>(aParams));
- break;
-
- case EMTPSessionOpened:
- SessionOpenedL(*reinterpret_cast<const TMTPNotificationParamsSessionChange*>(aParams));
- break;
- default:
- // Ignore all other notifications.
- break;
- }
- __FLOG(_L8("ProcessNotificationL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::ProcessRequestPhaseL(TMTPTransactionPhase aPhase, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
- {
- __FLOG(_L8("ProcessRequestPhaseL - Entry"));
- TInt index = LocateRequestProcessorL(aRequest, aConnection);
- __ASSERT_DEBUG(index != KErrNotFound, Panic(EMTPPBArgumentErr));
- MMTPRequestProcessor* processor = iActiveProcessors[index];
- iActiveProcessor = index;
- iActiveProcessorRemoved = EFalse;
- TBool result = processor->HandleRequestL(aRequest, aPhase);
- if (iActiveProcessorRemoved)
- {
- processor->Release(); // destroy the processor
- }
- else if (result)
- {
- processor->Release();
- iActiveProcessors.Remove(index);
- }
- iActiveProcessor = -1;
- __FLOG(_L8("ProcessRequestPhaseL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::Supported(TMTPSupportCategory aCategory, RArray<TUint>& aArray) const
- {
- __FLOG(_L8("Supported - Entry"));
-
- switch (aCategory)
- {
- case EDeviceProperties:
- {
- TInt count = sizeof(KMTPPlaybackControlDpSupportedProperties) / sizeof(KMTPPlaybackControlDpSupportedProperties[0]);
- for(TInt i = 0; i < count; i++)
- {
- aArray.Append(KMTPPlaybackControlDpSupportedProperties[i]);
- }
- }
- break;
-
- case EOperations:
- {
- TInt count = sizeof(KMTPPlaybackControlDpSupportedOperations) / sizeof(KMTPPlaybackControlDpSupportedOperations[0]);
- for(TInt i = 0; i < count; i++)
- {
- aArray.Append(KMTPPlaybackControlDpSupportedOperations[i]);
- }
- }
- break;
-
- case EEvents:
- {
- TInt count = sizeof(KMTPPlaybackControlDpSupportedEvents) / sizeof(KMTPPlaybackControlDpSupportedEvents[0]);
- for(TInt i = 0; i < count; i++)
- {
- aArray.Append(KMTPPlaybackControlDpSupportedEvents[i]);
- }
- }
- break;
-
- default:
- // Unrecognised category, leave aArray unmodified.
- break;
- }
- __FLOG(_L8("Supported - Exit"));
- }
-
-/**
-Constructor.
-*/
-CMTPPlaybackControlDataProvider::CMTPPlaybackControlDataProvider(TAny* aParams) :
- CMTPDataProviderPlugin(aParams),
- iActiveProcessors(KMTPPlaybackControlDpSessionGranularity),
- iActiveProcessor(-1),
- iRequestToResetPbCtrl(EFalse)
- {
-
- }
-
-/**
-Second phase constructor.
-*/
-void CMTPPlaybackControlDataProvider::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("ConstructL - Entry"));
- iPlaybackProperty = CMTPPlaybackProperty::NewL();
- iPlaybackMap = CMTPPlaybackMap::NewL(Framework(),*iPlaybackProperty);
- __FLOG(_L8("ConstructL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::SendEventL(TMTPDevicePropertyCode aPropCode)
- {
- __FLOG(_L8("SendEventL - Entry"));
- iEvent.Reset();
- iEvent.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeDevicePropChanged );
- iEvent.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
- iEvent.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdNone);
- iEvent.SetUint32(TMTPTypeEvent::EEventParameter1, aPropCode);
- Framework().SendEventL(iEvent);
- __FLOG(_L8("SendEventL - Exit"));
- }
-
-/**
-Find or create a request processor that can process the request
-@param aRequest The request to be processed
-@param aConnection The connection from which the request comes
-@return the index of the found/created request processor
-*/
-TInt CMTPPlaybackControlDataProvider::LocateRequestProcessorL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection)
- {
- __FLOG(_L8("LocateRequestProcessorL - Entry"));
- TInt index = KErrNotFound;
- TInt count = iActiveProcessors.Count();
- for(TInt i = 0; i < count; i++)
- {
- if(iActiveProcessors[i]->Match(aRequest, aConnection))
- {
- index = i;
- break;
- }
- }
- if(index == KErrNotFound)
- {
- MMTPRequestProcessor* processor = MTPPlaybackControlDpProcessor::CreateL(Framework(), aRequest, aConnection, *this);
- __ASSERT_DEBUG(processor, Panic(EMTPPBArgumentErr));
- CleanupReleasePushL(*processor);
- iActiveProcessors.AppendL(processor);
- CleanupStack::Pop();
- index = count;
- }
-
- __FLOG(_L8("LocateRequestProcessorL - Exit"));
- return index;
- }
-
-/**
-Cleans up outstanding request processors when a session is closed.
-@param aSession notification parameter block
-*/
-void CMTPPlaybackControlDataProvider::SessionClosedL(const TMTPNotificationParamsSessionChange& aSession)
- {
- __FLOG(_L8("SessionClosedL - Entry"));
- TInt count = iActiveProcessors.Count();
- while (count--)
- {
- MMTPRequestProcessor* processor = iActiveProcessors[count];
- TUint32 sessionId(processor->SessionId());
- if ((sessionId == aSession.iMTPId) && (processor->Connection().ConnectionId() == aSession.iConnection.ConnectionId()))
- {
- iActiveProcessors.Remove(count);
- if (count == iActiveProcessor)
- {
- iActiveProcessorRemoved = ETrue;
- }
- else
- {
- processor->Release();
- }
- }
- }
-
- if(iPlaybackControl)
- {
- iPlaybackControl->Close();
- iPlaybackControl = NULL;
- }
-
- __FLOG(_L8("SessionClosedL - Exit"));
- }
-
-/**
-Prepares for a newly-opened session.
-@param aSession notification parameter block
-*/
-#ifdef __FLOG_ACTIVE
-void CMTPPlaybackControlDataProvider::SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession)
-#else
-void CMTPPlaybackControlDataProvider::SessionOpenedL(const TMTPNotificationParamsSessionChange& /*aSession*/)
-#endif
- {
- __FLOG(_L8("SessionOpenedL - Entry"));
- __FLOG_VA((_L8("SessionID = %d"), aSession.iMTPId));
- __FLOG(_L8("SessionOpenedL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::StartObjectEnumerationL(TUint32 aStorageId, TBool /*aPersistentFullEnumeration*/)
- {
- __FLOG(_L8("StartObjectEnumerationL - Entry"));
- //This DP doesn't manage data.
- Framework().ObjectEnumerationCompleteL(aStorageId);
- __FLOG(_L8("StartObjectEnumerationL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::StartStorageEnumerationL()
- {
- __FLOG(_L8("StartStorageEnumerationL - Entry"));
- //This DP doesn't manage data.
- Framework().StorageEnumerationCompleteL();
- __FLOG(_L8("StartStorageEnumerationL - Exit"));
- }
-
-void CMTPPlaybackControlDataProvider::HandlePlaybackEventL(CMTPPlaybackEvent* aEvent, TInt aErr)
- {
- __FLOG(_L8("HandlePlaybackEventL - Entry"));
-
- if(aErr != KPlaybackErrNone)
- {
- if(aErr == KPlaybackErrDeviceUnavailable )
- {
- iRequestToResetPbCtrl = ETrue;
- //Report error to initiator, .
- SendEventL(EMTPDevicePropCodePlaybackObject);
- SendEventL(EMTPDevicePropCodePlaybackRate);
- SendEventL(EMTPDevicePropCodePlaybackContainerIndex);
- SendEventL(EMTPDevicePropCodePlaybackPosition);
- }
- return;
- }
-
- __ASSERT_DEBUG((aEvent != NULL), Panic(EMTPPBDataNullErr));
- __ASSERT_ALWAYS((aEvent != NULL), User::Leave(KErrArgument));
- __FLOG_1(_L8("aEvent %d"), aEvent->PlaybackEvent());
-
- switch(aEvent->PlaybackEvent())
- {
- case EPlaybackEventVolumeUpdate:
- {
- SendEventL(EMTPDevicePropCodeVolume);
- }
- break;
- case EPlaybackEventStateUpdate:
- {
- SendEventL(EMTPDevicePropCodePlaybackRate);
- }
- break;
- case EPlaybackEventObjectUpdate:
- {
- SendEventL(EMTPDevicePropCodePlaybackObject);
- }
- break;
- case EPlaybackEventObjectIndexUpdate:
- {
- SendEventL(EMTPDevicePropCodePlaybackContainerIndex);
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- break;
- }
-
- __FLOG(_L8("HandlePlaybackEventL - Exit"));
- }
-
-CMTPPlaybackMap& CMTPPlaybackControlDataProvider::GetPlaybackMap() const
- {
- __ASSERT_DEBUG((iPlaybackMap != NULL), Panic(EMTPPBDataNullErr));
- return *iPlaybackMap;
- }
-
-CMTPPlaybackProperty& CMTPPlaybackControlDataProvider::GetPlaybackProperty() const
- {
- __ASSERT_DEBUG((iPlaybackProperty != NULL), Panic(EMTPPBDataNullErr));
- return *iPlaybackProperty;
- }
-
-MMTPPlaybackControl& CMTPPlaybackControlDataProvider::GetPlaybackControlL()
- {
- __FLOG(_L8("GetPlaybackControlL - Entry"));
- if(iPlaybackControl == NULL)
- {
- iPlaybackControl = MMTPPlaybackControl::NewL(*this);
- }
- else if(iRequestToResetPbCtrl)
- {
- iRequestToResetPbCtrl = EFalse;
- iPlaybackControl->Close();
- iPlaybackControl = NULL;
- iPlaybackControl = MMTPPlaybackControl::NewL(*this);
- }
- __FLOG(_L8("GetPlaybackControlL - Exit"));
- return *iPlaybackControl;
- }
-
-void CMTPPlaybackControlDataProvider::RequestToResetPbCtrl()
- {
- iRequestToResetPbCtrl = ETrue;
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackmap.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/cmtpobjectmetadata.h>
-#include <mtp/mmtpdataproviderframework.h>
-#include <mtp/mmtpobjectmgr.h>
-
-#include "cmtpplaybackmap.h"
-#include "cmtpplaybackcommand.h"
-#include "cmtpplaybackcontroldp.h"
-#include "mtpplaybackcontrolpanic.h"
-
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"MTPPlaybackMap");)
-
-const TInt KPlaybackRatePlay = 1000;
-const TInt KPlaybackRatePause = 0;
-const TInt KPlaybackRateFF = 2000;
-const TInt KPlaybackRateREW = -2000;
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@return a pointer to the created playback checker object
-*/
-CMTPPlaybackMap* CMTPPlaybackMap::NewL(MMTPDataProviderFramework& aFramework,
- CMTPPlaybackProperty& aProperty)
- {
- CMTPPlaybackMap* self = new (ELeave) CMTPPlaybackMap(aFramework, aProperty);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPlaybackMap::~CMTPPlaybackMap()
- {
- __FLOG(_L8("~CMTPPlaybackMap - Entry"));
- __FLOG(_L8("~CMTPPlaybackMap - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPlaybackMap::CMTPPlaybackMap(MMTPDataProviderFramework& aFramework,
- CMTPPlaybackProperty& aProperty):
- iFramework(aFramework),iProperty(aProperty)
- {
- }
-
-/**
-Second-phase constructor.
-*/
-void CMTPPlaybackMap::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("CMTPPlaybackMap: ConstructL - Entry"));
- __FLOG(_L8("CMTPPlaybackMap: ConstructL - Exit"));
- }
-
-TInt CMTPPlaybackMap::GetPlaybackControlCommand(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- __FLOG(_L8("GetPlaybackControlCommand - Entry"));
- TInt result = KErrNotSupported;
- switch(aData.iOptCode)
- {
- case EMTPOpCodeSetDevicePropValue:
- case EMTPOpCodeResetDevicePropValue:
- {
- result = HandleSetDevicePropValue(aData, aCmd);
- }
- break;
- case EMTPOpCodeGetDevicePropValue:
- case EMTPOpCodeGetDevicePropDesc:
- {
- result = HandleGetDevicePropValue(aData, aCmd);
- }
- break;
- case EMTPOpCodeSkip:
- {
- result = HandleSkip(aData, aCmd);
- }
- break;
- default:
- break;
- }
- __FLOG(_L8("GetPlaybackControlCommand - Exit"));
- return result;
- }
-
-TInt CMTPPlaybackMap::HandleSetDevicePropValue(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- TRAPD(err, HandleSetDevicePropValueL(aData, aCmd));
- return err;
- }
-
-void CMTPPlaybackMap::HandleSetDevicePropValueL(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- __FLOG(_L8("HandleSetDevicePropValueL - Entry"));
- __ASSERT_DEBUG((aData.iOptCode == EMTPOpCodeSetDevicePropValue) ||
- (aData.iOptCode == EMTPOpCodeResetDevicePropValue),
- Panic(EMTPPBArgumentErr));
-
- switch(aData.iDevPropCode)
- {
- case EMTPDevicePropCodeVolume:
- {
- TUint32 val = aData.iPropValUint32.Value();
- CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(val);
- CleanupStack::PushL(param);
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSetVolume, param);
- CleanupStack::Pop(param);
- }
- break;
-
- case EMTPDevicePropCodePlaybackRate:
- {
- TInt32 val = aData.iPropValInt32.Value();
- TMTPPlaybackCommand cmd = EPlaybackCmdNone;
- switch(val)
- {
- case KPlaybackRateFF:
- cmd = EPlaybackCmdSeekForward;
- break;
- case KPlaybackRatePlay:
- cmd = EPlaybackCmdPlay;
- break;
- case KPlaybackRatePause:
- cmd = EPlaybackCmdPause;
- break;
- case KPlaybackRateREW:
- cmd = EPlaybackCmdSeekBackward;
- break;
- default:
- User::Leave(KErrArgument);
- break;
- }
- if(cmd != EPlaybackCmdNone)
- {
- *aCmd = CMTPPlaybackCommand::NewL(cmd, NULL);
- }
- else
- {
- *aCmd = NULL;
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- TUint32 handle = aData.iPropValUint32.Value();
- if(handle == 0)
- {
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdStop, NULL);
- }
- else
- {
- TFileName suid;
- TUint format;
- GetObjecInfoFromHandleL(handle, suid, format);
- TMTPPbCategory cat = EMTPPbCatNone;
- switch(format)
- {
- case 0xBA05://Abstract Audio & Video Playlist
- case 0xBA11://M3U Playlist
- cat = EMTPPbCatPlayList;
- break;
- case 0xBA03://Abstract Audio Album
- cat = EMTPPbCatAlbum;
- break;
- case 0x3009://MP3
- case 0xB903://AAC (Advance Audio Coding)
- case 0xB901://WMA (Windows Media Audio)
- case 0x3008://WAV (Waveform audio format)
- cat = EMTPPbCatMusic;
- break;
- default:
- User::Leave(KErrArgument);
- break;
- }
- if(cat != EMTPPbCatNone)
- {
- CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(cat, suid);
- CleanupStack::PushL(param);
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdInitObject, param);
- CleanupStack::Pop(param);
- }
- else
- {
- *aCmd = NULL;
- }
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackContainerIndex:
- {
- TUint32 index = aData.iPropValUint32.Value();
- CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(index);
- CleanupStack::PushL(param);
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdInitIndex, param);
- CleanupStack::Pop(param);
- }
- break;
-
- case EMTPDevicePropCodePlaybackPosition:
- {
- TUint32 position = aData.iPropValUint32.Value();
- CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(position);
- CleanupStack::PushL(param);
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSetPosition, param);
- CleanupStack::Pop(param);
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- break;
- }
- __FLOG(_L8("HandleSetDevicePropValueL - Exit"));
- }
-
-TInt CMTPPlaybackMap::HandleGetDevicePropValue(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- TRAPD(err, HandleGetDevicePropValueL(aData, aCmd));
- return err;
- }
-void CMTPPlaybackMap::HandleGetDevicePropValueL(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- __FLOG(_L8("HandleGetDevicePropValueL - Entry"));
- __ASSERT_DEBUG((aData.iOptCode == EMTPOpCodeGetDevicePropValue) ||
- (aData.iOptCode == EMTPOpCodeGetDevicePropDesc),
- Panic(EMTPPBArgumentErr));
-
- switch(aData.iDevPropCode)
- {
- case EMTPDevicePropCodeVolume:
- {
- TMTPPlaybackCommand cmd = EPlaybackCmdGetVolumeSet;
- if(aData.iOptCode == EMTPOpCodeGetDevicePropValue)
- {
- cmd = EPlaybackCmdGetVolume;
- }
- *aCmd = CMTPPlaybackCommand::NewL(cmd, NULL);
- }
- break;
-
- case EMTPDevicePropCodePlaybackRate:
- {
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetState, NULL);
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetObject, NULL);
- }
- break;
-
- case EMTPDevicePropCodePlaybackContainerIndex:
- {
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetIndex, NULL);
- }
- break;
-
- case EMTPDevicePropCodePlaybackPosition:
- {
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdGetPosition, NULL);
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- break;
- }
- __FLOG(_L8("HandleGetDevicePropValueL - Exit"));
- }
-
-TInt CMTPPlaybackMap::HandleSkip(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- TRAPD(err, HandleSkipL(aData, aCmd));
- return err;
- }
-
-void CMTPPlaybackMap::HandleSkipL(const TMTPPbCtrlData& aData,
- CMTPPlaybackCommand** aCmd)
- {
- __FLOG(_L8("HandleSkipL - Entry"));
- TInt32 step = aData.iPropValInt32.Value();
- CMTPPbCmdParam* param = CMTPPbCmdParam::NewL(step);
- CleanupStack::PushL(param);
- *aCmd = CMTPPlaybackCommand::NewL(EPlaybackCmdSkip, param);
- CleanupStack::Pop(param);
- __FLOG(_L8("HandleSkipL - Exit"));
- }
-
-TInt32 CMTPPlaybackMap::PlaybackRateL(TMTPPlaybackState aState)
- {
- __FLOG(_L8("PlaybackRate - Entry"));
- TInt32 rate = KPlaybackRatePause;
- switch(aState)
- {
- case EPlayStateForwardSeeking:
- rate = KPlaybackRateFF;
- break;
-
- case EPlayStatePlaying:
- rate = KPlaybackRatePlay;
- break;
-
- case EPlayStatePaused:
- rate = KPlaybackRatePause;
- break;
-
- case EPlayStateBackwardSeeking:
- rate = KPlaybackRateREW;
- break;
-
- default:
- User::Leave(KErrArgument);
- break;
- }
- __FLOG(_L8("PlaybackRate - Exit"));
- return rate;
- }
-
-TUint32 CMTPPlaybackMap::ObjectHandleL(const TDesC& aSuid)
- {
- __FLOG(_L8("ObjectHandleL - Entry"));
- CMTPObjectMetaData* meta(CMTPObjectMetaData::NewLC());
- TBool result = iFramework.ObjectMgr().ObjectL(aSuid, *meta);
- __ASSERT_ALWAYS(result, User::Leave(KErrBadHandle));
- __ASSERT_DEBUG(meta, Panic(EMTPPBDataNullErr));
- TUint32 handle = meta->Uint(CMTPObjectMetaData::EHandle);
- CleanupStack::PopAndDestroy(meta);
- __FLOG(_L8("ObjectHandleL - Exit"));
- return handle;
- }
-
-void CMTPPlaybackMap::GetObjecInfoFromHandleL(TUint32 aHandle, TDes& aSuid, TUint& aFormat) const
- {
- __FLOG(_L8("GetObjecInfoFromHandleL - Entry"));
- CMTPObjectMetaData* meta(CMTPObjectMetaData::NewLC());
- TBool result = iFramework.ObjectMgr().ObjectL(aHandle, *meta);
- __ASSERT_ALWAYS(result, User::Leave(KErrBadHandle));
- __ASSERT_DEBUG(meta, Panic(EMTPPBDataNullErr));
- aSuid = meta->DesC(CMTPObjectMetaData::ESuid);
- aFormat = meta->Uint(CMTPObjectMetaData::EFormatCode);
- CleanupStack::PopAndDestroy(meta);
- __FLOG(_L8("GetObjecInfoFromHandleL - Exit"));
- }
--- a/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackproperty.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackmap.h"
-#include "cmtpplaybackproperty.h"
-#include "mtpplaybackcontrolpanic.h"
-
-// Class constants.
-__FLOG_STMT(_LIT8(KComponent,"MTPPlaybackProperty");)
-
-const TInt32 KMTPDefaultPlaybackRate = 0;
-
-const TUint32 KMTPMaxPlaybackVolume = 100;
-const TUint32 KMTPMinPlaybackVolume = 0;
-const TUint32 KMTPDefaultPlaybackVolume = 40;
-const TUint32 KMTPCurrentPlaybackVolume = 40;
-const TUint32 KMTPVolumeStep = 1;
-
-const TUint32 KMTPDefaultPlaybackObject = 0;
-const TUint32 KMTPDefaultPlaybackIndex = 0;
-const TUint32 KMTPDefaultPlaybackPosition = 0;
-
-/**
-Two-phase constructor.
-@param aPlugin The data provider plugin
-@return a pointer to the created playback checker object
-*/
-CMTPPlaybackProperty* CMTPPlaybackProperty::NewL()
- {
- CMTPPlaybackProperty* self = new (ELeave) CMTPPlaybackProperty();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-/**
-Destructor.
-*/
-CMTPPlaybackProperty::~CMTPPlaybackProperty()
- {
- __FLOG(_L8("~CMTPPlaybackProperty - Entry"));
- delete iPlaybackVolumeData;
- __FLOG(_L8("~CMTPPlaybackProperty - Exit"));
- __FLOG_CLOSE;
- }
-
-/**
-Constructor.
-*/
-CMTPPlaybackProperty::CMTPPlaybackProperty()
- {
- }
-
-/**
-Second-phase constructor.
-*/
-void CMTPPlaybackProperty::ConstructL()
- {
- __FLOG_OPEN(KMTPSubsystem, KComponent);
- __FLOG(_L8("ConstructL - Entry"));
- __FLOG(_L8("ConstructL - Exit"));
- }
-
-void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TInt32& aValue)
- {
- __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
-
- __ASSERT_ALWAYS((aProp == EMTPDevicePropCodePlaybackRate), User::Leave(KErrArgument));
- aValue = KMTPDefaultPlaybackRate;
-
- __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
- }
-
-void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPDevicePropertyCode aProp, TUint32& aValue)
- {
- __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
- switch(aProp)
- {
- case EMTPDevicePropCodeVolume:
- {
- if(iPlaybackVolumeData != NULL)
- {
- aValue = iPlaybackVolumeData->DefaultVolume();
- }
- else
- {
- aValue = KMTPDefaultPlaybackVolume;
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- aValue = KMTPDefaultPlaybackObject;
- }
- break;
-
- case EMTPDevicePropCodePlaybackContainerIndex:
- {
- aValue = KMTPDefaultPlaybackIndex;
- }
- break;
-
- case EMTPDevicePropCodePlaybackPosition:
- {
- aValue = KMTPDefaultPlaybackPosition;
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- }
- __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
- }
-
-void CMTPPlaybackProperty::GetDefaultVolSet(TMTPPbDataVolume& aValue)
- {
- if(iPlaybackVolumeData == NULL)
- {
- aValue.SetVolume(KMTPMaxPlaybackVolume,
- KMTPMinPlaybackVolume,
- KMTPDefaultPlaybackVolume,
- KMTPCurrentPlaybackVolume,
- KMTPVolumeStep);
- }
- else
- {
- aValue = (*iPlaybackVolumeData);
- }
- }
-
-void CMTPPlaybackProperty::SetDefaultVolSetL(const TMTPPbDataVolume& aValue)
- {
- if(iPlaybackVolumeData == NULL)
- {
- iPlaybackVolumeData = new (ELeave) TMTPPbDataVolume(aValue);
- }
- else
- {
- (*iPlaybackVolumeData) = aValue;
- }
- }
-
-void CMTPPlaybackProperty::GetDefaultPropertyValueL(TMTPPbCtrlData& aValue)
- {
- __FLOG(_L8("GetDefaultPropertyValueL - Entry"));
- __ASSERT_DEBUG((aValue.iOptCode == EMTPOpCodeResetDevicePropValue), Panic(EMTPPBArgumentErr));
-
- switch(aValue.iDevPropCode)
- {
- case EMTPDevicePropCodePlaybackRate:
- {
- TInt32 val;
- GetDefaultPropertyValueL(aValue.iDevPropCode, val);
- aValue.iPropValInt32.Set(val);
- }
- break;
-
- case EMTPDevicePropCodeVolume:
- case EMTPDevicePropCodePlaybackObject:
- case EMTPDevicePropCodePlaybackContainerIndex:
- case EMTPDevicePropCodePlaybackPosition:
- {
- TUint32 val;
- GetDefaultPropertyValueL(aValue.iDevPropCode, val);
- aValue.iPropValUint32.Set(val);
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- }
- __FLOG(_L8("GetDefaultPropertyValueL - Exit"));
- }
-
-TBool CMTPPlaybackProperty::IsDefaultPropertyValueL(const TMTPPbCtrlData& aValue) const
- {
- __FLOG(_L8("EqualToDefaultPropertyValueL - Entry"));
-
- TInt result(EFalse);
-
- switch(aValue.iDevPropCode)
- {
- case EMTPDevicePropCodePlaybackRate:
- {
- if(aValue.iPropValInt32.Value() == KMTPDefaultPlaybackRate)
- {
- result = ETrue;
- }
- }
- break;
-
- case EMTPDevicePropCodeVolume:
- {
- if(iPlaybackVolumeData == NULL)
- {
- if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackVolume)
- {
- result = ETrue;
- }
- }
- else
- {
- if(aValue.iPropValUint32.Value() == iPlaybackVolumeData->DefaultVolume())
- {
- result = ETrue;
- }
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackObject:
- {
- if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackObject)
- {
- result = ETrue;
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackContainerIndex:
- {
- if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackIndex)
- {
- result = ETrue;
- }
- }
- break;
-
- case EMTPDevicePropCodePlaybackPosition:
- {
- if(aValue.iPropValUint32.Value() == KMTPDefaultPlaybackPosition)
- {
- result = ETrue;
- }
- }
- break;
-
- default:
- User::Leave(KErrArgument);
- }
-
- __FLOG(_L8("EqualToDefaultPropertyValueL - Exit"));
-
- return result;
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <ecom/registryinfo.rh>
-
-RESOURCE REGISTRY_INFO theInfo
- {
- dll_uid = 0x2002EA98;
- interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = 0x102827AD;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = 0x2002EA99;
- version_no = 1;
- display_name = "MTP Playback Control Data Provider plug-in.";
- default_data = "";
- opaque_data = "";
- }
- };
- }
- };
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp_config.rss Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include <mtp/mtpdataproviderconfig.rh>
-
-RESOURCE MTP_DATA_PROVIDER dpConfig
- {
- type = KMTPDataProviderTypeECOM;
- major_version = 1;
- object_enumeration_persistent = 0;
- supported_modes = KMTPModeMTP;
- server_name = "";
- server_image_name = "";
- opaque_resource = 0;
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpimplproxy.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "cmtpplaybackcontroldp.h"
-#include <ecom/implementationproxy.h>
-
-// Define the interface UIDs
-static const TImplementationProxy ImplementationTable[] =
- {
- {
- {0x2002EA99}, (TProxyNewLPtr)(CMTPPlaybackControlDataProvider::NewL)
- }
- };
-
-/**
-ECOM plugin entry point
-*/
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
- {
- aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
- return ImplementationTable;
- }
-
--- a/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpprocessor.cpp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-/**
- @file
- @internalComponent
-*/
-
-#include "mtpplaybackcontroldpprocessor.h"
-#include "cmtprequestprocessor.h"
-#include "cmtppbcgetdevicepropdesc.h"
-#include "cmtppbcgetdevicepropvalue.h"
-#include "cmtppbcsetdevicepropvalue.h"
-#include "cmtppbcresetdevicepropvalue.h"
-#include "cmtppbcskip.h"
-#include "cmtprequestunknown.h"
-
-typedef MMTPRequestProcessor*(*TMTPPlaybackRequestProcessorCreateFunc)(
- MMTPDataProviderFramework& aFramework,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider);
-
-/**
-Defines an entry which maps from operation code to the request processor
-
-@internalComponent
-*/
-typedef struct
- {
- TUint16 iOperationCode;
- TMTPPlaybackRequestProcessorCreateFunc iCreateFunc;
- } TMTPPlaybackRequestProcessorEntry;
-
-/**
-Playback control data provider mapping table from request ID to factory method of the request processor
-*/
-static const TMTPPlaybackRequestProcessorEntry KMTPRequestProcessorTable[] =
- {
- {EMTPOpCodeGetDevicePropDesc, CMTPPbcGetDevicePropDesc::NewL},
- {EMTPOpCodeGetDevicePropValue, CMTPPbcGetDevicePropValue::NewL},
- {EMTPOpCodeSetDevicePropValue, CMTPPbcSetDevicePropValue::NewL},
- {EMTPOpCodeResetDevicePropValue, CMTPPbcResetDevicePropValue::NewL},
- {EMTPOpCodeSkip, CMTPPbcSkip::NewL},
- };
-
-/**
-Create a request processor that matches the request
-@param aPlugin The reference to the data provider plugin
-@param aFramework The reference to the data provider framework
-@param aRequest The request to be processed
-@param aConnection The connection from which the request comes from
-@return a pointer to the request processor
-*/
-MMTPRequestProcessor* MTPPlaybackControlDpProcessor::CreateL(
- MMTPDataProviderFramework& aFramework,
- const TMTPTypeRequest& aRequest,
- MMTPConnection& aConnection,
- CMTPPlaybackControlDataProvider& aDataProvider)
- {
- TMTPPlaybackRequestProcessorCreateFunc createFunc = NULL;
- TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
- TInt count = sizeof(KMTPRequestProcessorTable) / sizeof(TMTPRequestProcessorEntry);
- for(TInt i = 0; i < count; i++)
- {
- if(KMTPRequestProcessorTable[i].iOperationCode == operationCode)
- {
- createFunc = KMTPRequestProcessorTable[i].iCreateFunc;
- break;
- }
- }
-
- if(!createFunc)
- {
- return CMTPRequestUnknown::NewL(aFramework, aConnection);
- }
- else
- {
- return (*createFunc)(aFramework, aConnection, aDataProvider);
- }
- }
-
-
-
--- a/mtpfws/mtpfw/common/inc/mtpdatacapture.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/common/inc/mtpdatacapture.h Wed Sep 01 12:20:56 2010 +0100
@@ -23,7 +23,13 @@
// MTP data caputre defines
+#if defined(__WINS__)
_LIT(KRequestCaptureRootDir, "c:\\test\\data\\");
+#elif defined(__SERIES60_)
+_LIT(KRequestCaptureRootDir, "f:\\test\\data\\");
+#else
+_LIT(KRequestCaptureRootDir, "e:\\test\\data\\");
+#endif
_LIT(KRequestCaptureDirPrefix, "testcase");
_LIT(KIToRDataPhaseOutputFile, "i_to_r_dataphase.dat");
Binary file mtpfws/mtpfw/conf/mtpframework.confml has changed
--- a/mtpfws/mtpfw/daemon/client/src/rmtpclient.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/daemon/client/src/rmtpclient.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -117,6 +117,15 @@
// Wait for the server start up to complete.
User::WaitForRequest(status);
ret = (server.ExitType() == EExitPanic) ? KErrGeneral : status.Int();
+#ifdef __WINSCW__
+ if ( server.ExitType() == EExitPanic )
+ {
+ TExitCategoryName exitCategory = server.ExitCategory();
+ TInt exitReason = server.ExitReason();
+ RDebug::Print( _L("The exit category is \"%S\""), &exitCategory );
+ RDebug::Print( _L("The exit Reason is %d"), exitReason );
+ }
+#endif //__WINSCW__
server.Close();
}
--- a/mtpfws/mtpfw/daemon/server/group/mtpserver.mmp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/daemon/server/group/mtpserver.mmp Wed Sep 01 12:20:56 2010 +0100
@@ -22,9 +22,14 @@
CAPABILITY CommDD PowerMgmt ReadDeviceData WriteDeviceData TrustedUI ProtServ NetworkControl NetworkServices LocalServices ReadUserData WriteUserData
+#ifdef WINSCW
+//EPOCHEAPSIZE 0x1400000 0x1400000 // 20MB
EPOCHEAPSIZE 0x80000 0x800000 // 8MB
+#else
+EPOCHEAPSIZE 0x80000 0x800000 // 8MB
+#endif
-EPOCSTACKSIZE 0x14000
+EPOCSTACKSIZE 0x5000
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/mtpfws/mtpfw/dataproviders/devdp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -30,9 +30,10 @@
#endif
mtpdevice.ico /epoc32/data/z/private/102827a2/mtpdevice.ico
+mtpdevice.ico /epoc32/winscw/c/private/102827a2/mtpdevice.ico
../inc/mtpdevicedp_config.rh SYMBIAN_MW_LAYER_PLATFORM_EXPORT_PATH(mtp/mtpdevicedp_config.rh)
-mtp_devicedp.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_devicedp.iby)
+mtp_devicedp.iby /epoc32/rom/include/mtp_devicedp.iby
PRJ_MMPFILES
mtpdevicedp.mmp
--- a/mtpfws/mtpfw/dataproviders/devdp/group/mtp_devicedp.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/group/mtp_devicedp.iby Wed Sep 01 12:20:56 2010 +0100
@@ -17,7 +17,7 @@
#ifndef MTP_DEVICEDP_IBY
#define MTP_DEVICEDP_IBY
-#if defined(__MTP_PROTOCOL_SUPPORT)
+#if !defined(SYMBIAN_EXCLUDE_MTP)
// MTP Device Data Provider
@@ -30,6 +30,6 @@
-#endif //__MTP_PROTOCOL_SUPPORT
+#endif //SYMBIAN_EXCLUDE_MTP
#endif //MTP_DEVICEDP_IBY
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Wed Sep 01 12:20:56 2010 +0100
@@ -57,7 +57,7 @@
void SetSupportedOperationsL(CMTPDataProviderController& aDpController);
void SetSupportedEventsL(CMTPDataProviderController& aDpController);
- void SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController);
+ void SetSupportedDevicePropertiesL();
void SetSupportedCaptureFormatsL(CMTPDataProviderController& aDpController);
void SetSupportedPlaybackFormatsL(CMTPDataProviderController& aDpController);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -35,7 +35,11 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"DeviceDataStore");)
+#ifdef __WINS__
+_LIT( KFileName, "c:\\private\\102827a2\\mtpdevice.ico");
+#else
_LIT( KFileName, "z:\\private\\102827a2\\mtpdevice.ico");
+#endif
// Device property datastore constants.
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -165,7 +165,7 @@
CMTPDataProviderController& dps(iSingletons.DpController());
SetSupportedOperationsL(dps);
SetSupportedEventsL(dps);
- SetSupportedDevicePropertiesL(dps);
+ SetSupportedDevicePropertiesL();
SetSupportedCaptureFormatsL(dps);
SetSupportedPlaybackFormatsL(dps);
@@ -243,42 +243,11 @@
/**
Populates the supported device properties field in the device info data set
*/
-void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
+void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL()
{
- __FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));
- TInt count = aDpController.Count();
- RArray<TUint> supportedOperations(KMTPArrayGranularity);
- CleanupClosePushL(supportedOperations);
- const TInt32 KMTPImplementationUidDeviceDp(0x102827AF);
- const TInt32 KMTPImplementationUidFileDp(0x102827B0);
- const TInt32 KMTPImplementationUidProxyDp(0x102827B1);
- const TInt32 KMTPFrameworkDpCount(3);
- TBool bOnlyInternalDpLoad = count > KMTPFrameworkDpCount ? EFalse : ETrue;
- while(count--)
- {
- TInt32 uid = aDpController.DataProviderByIndexL(count).ImplementationUid().iUid;
- // The filter is added for licencee's request which will filtrate the symbian's internal
- // dp's supported enhance mode operations to make licencee's dp work.
- // Every new internal dp need add it's implementation id here to filtrate and increase
- // the KMTPFrameworkDpCount number.
- if ((uid == KMTPImplementationUidDeviceDp ||
- uid == KMTPImplementationUidFileDp ||
- uid == KMTPImplementationUidProxyDp) && !bOnlyInternalDpLoad)
- {
- AddToArrayWithFilterL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
- }
- else
- {
- AddToArrayL(supportedOperations, aDpController.DataProviderByIndexL(count).SupportedCodes(EDeviceProperties));
- }
- }
-
- CMTPTypeArray* mtpOperationsArray = CMTPTypeArray::NewL(EMTPTypeAUINT16, supportedOperations);
- CleanupStack::PopAndDestroy(&supportedOperations);
- CleanupStack::PushL(mtpOperationsArray); //unnecessary if Set operation below does not leave,
- iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported, *mtpOperationsArray);
- CleanupStack::PopAndDestroy(mtpOperationsArray);
-
+ __FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));
+ iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported,
+ iDpSingletons.DeviceDataStore().GetSupportedDeviceProperties());
__FLOG(_L8("SetSupportedDevicePropertiesL - Exit"));
}
@@ -416,13 +385,6 @@
TInt count(aSrcArray.Count());
for (TInt i(0); (i < count); i++)
{
- // Apply filter
- if(aSrcArray[i] == EMTPOpCodeResetDevicePropValue)
- {
- __FLOG_VA((_L8("Filter ignored operation: %d"), aSrcArray[i]));
- continue;
- }
-
TInt err(aDestArray.InsertInOrder(aSrcArray[i]));
if ((err != KErrNone) && (err != KErrAlreadyExists))
{
--- a/mtpfws/mtpfw/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -31,10 +31,14 @@
PRJ_EXPORTS
// repositories exported for TechView and testing
10282FCC_ARMV5.cre /epoc32/data/z/private/10202be9/10282fcc.cre
+10282FCC_WINSCW.cre /epoc32/release/winscw/udeb/z/private/10202be9/10282fcc.cre
+10282FCC_WINSCW.cre /epoc32/release/winscw/urel/z/private/10202be9/10282fcc.cre
backup_registration.xml /epoc32/data/z/private/102827a2/backup_registration.xml
+backup_registration.xml /epoc32/release/winscw/udeb/z/private/102827a2/backup_registration.xml
+backup_registration.xml /epoc32/release/winscw/urel/z/private/102827a2/backup_registration.xml
// ConfML Files
../conf/mtpframework.confml MW_LAYER_EXPORTS_CONFML(mtpframework.confml)
../conf/mtpframework_10282fcc.crml MW_LAYER_EXPORTS_CRML(mtpframework_10282fcc.crml)
-mtp_framework.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_framework.iby)
+mtp_framework.iby /epoc32/rom/include/mtp_framework.iby
--- a/mtpfws/mtpfw/group/mtp_framework.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/group/mtp_framework.iby Wed Sep 01 12:20:56 2010 +0100
@@ -18,7 +18,7 @@
#include <mtp_devicedp.iby>
-#if defined(__MTP_PROTOCOL_SUPPORT)
+#if !defined(SYMBIAN_EXCLUDE_MTP)
// MTP Data Types Library
@@ -64,6 +64,6 @@
//MTP device icon property file
data=EPOCROOT##epoc32\data\Z\private\102827a2\mtpdevice.ico private\102827a2\mtpdevice.ico
-#endif // __MTP_PROTOCOL_SUPPORT
+#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_FRAMEWORK_IBY
--- a/mtpfws/mtpfw/inc/cmtpconnection.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/inc/cmtpconnection.h Wed Sep 01 12:20:56 2010 +0100
@@ -147,7 +147,6 @@
void EnqueueEvent(CMTPEventLink* aLink);
void DequeueEvent(CMTPEventLink* aLink);
- void DequeueAllEvents();
/**
* This method define and attach the property for publishing connection state
--- a/mtpfws/mtpfw/inc/mtpcommonconst.h Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/inc/mtpcommonconst.h Wed Sep 01 12:20:56 2010 +0100
@@ -22,7 +22,7 @@
#define MTPCOMMONCONST_H
#ifdef __SERIES60_
-#include <uiklafinternalcrkeys.h>
+#include <UiklafInternalCRKeys.h>
#else
//Following is copied from 'UiklafInternalCRKeys.h', which is
//exported from S60 sdk, in Symbian CBR, this file does not exist.
--- a/mtpfws/mtpfw/src/cmtpconnection.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -82,9 +82,17 @@
__FLOG(_L8("~CMTPConnection - Entry"));
CloseAllSessions();
- //remove all events
- DequeueAllEvents();
-
+ // Remove any events not associated
+ // with a session
+ TSglQueIter<CMTPEventLink> iter(iEventQ);
+ iter.SetToFirst();
+ CMTPEventLink* link = NULL;
+
+ while ((link = iter++) != NULL)
+ {
+ delete link;
+ }
+
iSessions.ResetAndDestroy();
if (iTransportConnection != NULL)
@@ -659,16 +667,9 @@
DequeueEvent(iEventQ.First());
if (iPendingEventCount > 0)
{
- if (NULL != iTransportConnection)
- {
- // Forward the event to the transport connection layer.
- __FLOG(_L8("Sending queued event"));
- iTransportConnection->SendEventL(iEventQ.First()->iEvent);
- }
- else
- {
- DequeueAllEvents();
- }
+ // Forward the event to the transport connection layer.
+ __FLOG(_L8("Sending queued event"));
+ iTransportConnection->SendEventL(iEventQ.First()->iEvent);
}
__FLOG(_L8("SendEventCompleteL - Exit"));
@@ -1045,19 +1046,6 @@
__FLOG(_L8("RemoveEventsForSession - Exit"));
}
-void CMTPConnection::DequeueAllEvents()
- {
- TSglQueIter<CMTPEventLink> iter(iEventQ);
- iter.SetToFirst();
- CMTPEventLink* link = NULL;
-
- while ((link = iter++) != NULL)
- {
- delete link;
- }
- iPendingEventCount = 0;
- }
-
void CMTPConnection::DequeueEvent(CMTPEventLink* aLink)
{
iEventQ.Remove(*aLink);
--- a/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Tue Aug 31 16:03:15 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Wed Sep 01 12:20:56 2010 +0100
@@ -174,9 +174,9 @@
const TInt KStartupInitValue = 1;
iAbnormalDownValue = 0;
TInt err(iRepository->Get(EAbnormalDown, iAbnormalDownValue));
- if ((KErrNone != err ) && (KErrNotFound != err))
+ if ( KErrNone != err )
{
- User::Leave(err);
+ iAbnormalDownValue = 0;
}
//Save the AbnormalDown state to ETrue
--- a/mtptransports/mtpcontroller/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpcontroller/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -22,9 +22,10 @@
PRJ_PLATFORMS
ARMV5
+WINSCW
PRJ_EXPORTS
-mtp_controller.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_controller.iby)
+mtp_controller.iby /epoc32/rom/include/mtp_controller.iby
PRJ_MMPFILES
mtpcontroller.mmp
--- a/mtptransports/mtpcontroller/group/mtp_controller.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpcontroller/group/mtp_controller.iby Wed Sep 01 12:20:56 2010 +0100
@@ -16,13 +16,13 @@
#ifndef MTP_CONTROLLER_IBY
#define MTP_CONTROLLER_IBY
-#if defined (__MTP_PROTOCOL_SUPPORT)
+#if !defined (SYMBIAN_EXCLUDE_MTP)
#include <mtp_framework.iby>
//MTP Controller LOCOD service plugin
ECOM_PLUGIN(mtpcontroller.dll, mtpcontroller.rsc)
-#endif// __MTP_PROTOCOL_SUPPORT
+#endif// SYMBIAN_EXCLUDE_MTP
#endif// MTP_CONTROLLER_IBY
--- a/mtptransports/mtpptpiptransport/group/mtp_ptpip.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpptpiptransport/group/mtp_ptpip.iby Wed Sep 01 12:20:56 2010 +0100
@@ -16,7 +16,7 @@
#ifndef MTP_PTPIP_IBY
#define MTP_PTPIP_IBY
-#if defined (__MTP_PROTOCOL_SUPPORT) && !defined(SYMBIAN_EXCLUDE_PTPTIP)
+#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_PTPTIP)
#include <mtp_framework.iby>
@@ -30,7 +30,7 @@
ECOM_PLUGIN(ptpipplugin.dll, ptpipplugin.rsc)
-#endif // __MTP_PROTOCOL_SUPPORT
+#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_PTPIP_IBY
--- a/mtptransports/mtpptpiptransport/ptpipdatatypes/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpptpiptransport/ptpipdatatypes/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -21,6 +21,7 @@
PRJ_PLATFORMS
ARMV5
+winscw
PRJ_EXPORTS
--- a/mtptransports/mtpptpiptransport/ptpipplugin/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpptpiptransport/ptpipplugin/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -21,6 +21,7 @@
PRJ_PLATFORMS
ARMV5
+winscw
PRJ_EXPORTS
--- a/mtptransports/mtpusbtransport/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpusbtransport/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -28,5 +28,5 @@
#include "../usbsic_cc/group/bld.inf"
PRJ_EXPORTS
-mtp_usbsic.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mtp_usbsic.iby)
+mtp_usbsic.iby /epoc32/rom/include/mtp_usbsic.iby
--- a/mtptransports/mtpusbtransport/group/mtp_usbsic.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpusbtransport/group/mtp_usbsic.iby Wed Sep 01 12:20:56 2010 +0100
@@ -16,7 +16,7 @@
#ifndef MTP_USBSIC_IBY
#define MTP_USBSIC_IBY
-#if defined (__MTP_PROTOCOL_SUPPORT) && defined(__USB)
+#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB)
#include <mtp_framework.iby>
@@ -29,7 +29,7 @@
//MTP USB SIC transport plugin
ECOM_PLUGIN(mtpusbsicimp.dll, mtpusbsicimp.rsc)
-#endif // __MTP_PROTOCOL_SUPPORT && __USB
+#endif // SYMBIAN_EXCLUDE_MTP
#endif // MTP_USBSIC_IBY
--- a/mtptransports/mtpusbtransport/usbsic_cc/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_cc/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -25,5 +25,6 @@
PRJ_EXPORTS
PRJ_MMPFILES
+#ifndef WINSCW
mtpusbsiccc.mmp
-
+#endif
--- a/mtptransports/mtpusbtransport/usbsic_imp/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_imp/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -25,5 +25,6 @@
PRJ_EXPORTS
PRJ_MMPFILES
+#ifndef WINSCW
mtpusbsicimp.mmp
-
+#endif
--- a/obex/obexprotocol/group/obexprotocol.iby Tue Aug 31 16:03:15 2010 +0300
+++ b/obex/obexprotocol/group/obexprotocol.iby Wed Sep 01 12:20:56 2010 +0100
@@ -63,7 +63,7 @@
REM *** Now for things which should only be included if the device
REM *** supports USB, to save ROM space...
-#ifndef __USB
+#ifdef SYMBIAN_EXCLUDE_USB
REM OBEX USB transport is not included in this ROM as it depends on USB
#else
OBEX_PLUGIN(obexusbtransportcontroller.dll,1020de87.rsc)
@@ -72,7 +72,7 @@
REM *** Now for things which should only be included if the device
REM *** supports bluetooth, to save ROM space...
-#ifndef __BT
+#ifdef SYMBIAN_EXCLUDE_BLUETOOTH
REM OBEX Bluetooth transport is not included in this ROM as it depends on BLUETOOTH
#else
OBEX_PLUGIN(obexbtrfcommtransportcontroller.dll,1020e043.rsc)
--- a/package_definition.xml Tue Aug 31 16:03:15 2010 +0300
+++ b/package_definition.xml Wed Sep 01 12:20:56 2010 +0100
@@ -1,98 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<SystemDefinition schema="3.0.0">
- <package id="remoteconn" name="Remote Connectivity" levels="plugin framework server generic specific">
- <collection id="remoteconn_plat" name="Remote Connectivity Platform Interfaces" level="specific">
- <component id="dialup_connection_status_api" name="Dialup Connection Status API" class="api" filter="s60">
- <meta rel="Api" href="remoteconn_plat/dialup_connection_status_api/dialup_connection_status_api.metaxml"/>
- <unit bldFile="remoteconn_plat/dialup_connection_status_api/group"/>
- </component>
- <component id="dun_secondary_display_notification_api" name="Dialup Secondary Display Notification API" class="api" filter="s60">
- <meta rel="Api" href="remoteconn_plat/dun_secondary_display_notification_api/dun_secondary_display_notification_api.metaxml"/>
- <unit bldFile="remoteconn_plat/dun_secondary_display_notification_api/group"/>
- </component>
- <component id="generic_hid_api" name="Generic HID API" class="api" filter="s60">
- <!-- Missing? <meta rel="Api" href="remoteconn_plat/generic_hid_api/generic_hid_api.metaxml"/> -->
- <unit bldFile="remoteconn_plat/generic_hid_api/group"/>
- </component>
- <component id="locod_bearer_plugin_api" name="Local Connectivity Daemon Bearer Plugin API" class="api" filter="s60">
- <!-- Missing? <meta rel="Api" href="remoteconn_plat/locod_bearer_plugin_api/locod_bearer_plugin_api.metaxml"/> -->
- <unit bldFile="remoteconn_plat/locod_bearer_plugin_api/group"/>
- </component>
- <component id="locod_service_plugin_api" name="Local Connectivity Daemon Service Plugin API" class="api" filter="s60">
- <!-- Missing? <meta rel="Api" href="remoteconn_plat/locod_service_plugin_api/locod_service_plugin_api.metaxml"/> -->
- <unit bldFile="remoteconn_plat/locod_service_plugin_api/group"/>
- </component>
- </collection>
- <collection id="localconnectivityservice" name="Local Connectivity Service" level="server">
- <component id="locod" name="Local Connectivity Daemon" introduced="^4" purpose="optional" filter="s60">
- <unit bldFile="localconnectivityservice/locod/group"/>
- </component>
- <component id="dun" name="Dial-Up Networking" introduced="^4" purpose="optional" filter="s60">
- <unit bldFile="localconnectivityservice/dun/group"/>
- </component>
- <component id="generichid" name="Generic Human-Interface Device" introduced="^4" purpose="optional" filter="s60">
- <unit bldFile="localconnectivityservice/generichid/group"/>
- </component>
- <component id="headset" name="Headset" introduced="^4" purpose="optional" filter="s60">
- <unit bldFile="localconnectivityservice/headset/group"/>
- </component>
- </collection>
- <collection id="mtptransports" name="MTP Transports" level="plugin">
- <component id="mtpusbtransport" name="MTP USB Transport" introduced="^2" purpose="optional" class="plugin">
- <unit bldFile="mtptransports/mtpusbtransport/group" mrp="mtptransports/mtpusbtransport/group/mtp_usbsic.mrp"/>
- </component>
- <component id="mtpptpiptransport" name="MTP PTP-IP Transport" introduced="^3" purpose="optional" class="plugin">
- <unit bldFile="mtptransports/mtpptpiptransport/group" mrp="mtptransports/mtpptpiptransport/group/mtp_ptpip.mrp"/>
- </component>
- <component id="mtpcontroller" name="MTP Controller" introduced="^3" purpose="optional" class="plugin">
- <meta rel="config">
- <defined condition="FF_MTP_CONTROLLER"/>
- </meta>
- <unit bldFile="mtptransports/mtpcontroller/group" mrp="mtptransports/mtpcontroller/group/mtpcontroller.mrp"/>
- </component>
- </collection>
- <collection id="mtpfws" name="MTP Frameworks" level="framework">
- <component id="mtpfw" name="MTP Framework" introduced="^2" purpose="optional">
- <unit bldFile="mtpfws/mtpfw/group" mrp="mtpfws/mtpfw/group/mtp_framework.mrp"/>
- </component>
- <component id="devdpextn" name="MTP Device Provider Extension" introduced="^4" purpose="optional">
- <!-- can't have a component inside another component. Need to move to mtpfws/devdpextn/group -->
- <unit bldFile="mtpfws/mtpfw/dataproviders/devdp/devdpextn/group"/>
- </component>
- </collection>
- <collection id="mtpdataproviders" name="MTP Data Providers" level="generic">
- <component id="mtpfileandfolderdp" name="MTP File and Folder Provider" introduced="^2" purpose="optional" class="plugin">
- <unit bldFile="mtpdataproviders/mtpfileandfolderdp/group" mrp="mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.mrp"/>
- </component>
- <component id="mtpimagedp" name="MTP Image Data Provider" filter="gt" introduced="^3" purpose="optional" class="plugin">
- <unit bldFile="mtpdataproviders/mtpimagedp/group" mrp="mtpdataproviders/mtpimagedp/group/mtp_imagedp.mrp"/>
- </component>
- <component id="mtppictbridgedp" name="MTP PictBridge Data Provider" introduced="^3" purpose="optional" class="plugin" filter="gt">
- <unit bldFile="mtpdataproviders/mtppictbridgedp/group" mrp="mtpdataproviders/mtppictbridgedp/group/mtp_pictbridgedp.mrp"/>
- </component>
- <component id="pictbridgeengine" name="MTP PictBridge Engine" introduced="^4" purpose="optional" filter="s60">
- <!-- can't have a component inside another component. Need to move to mtpdataproviders/pictbridgeengine/group -->
- <unit bldFile="mtpdataproviders/mtppictbridgedp/pictbridgeengine/group"/>
- </component>
- <component id="mtpplaybackcontroldp" name="MTP Playback Control Data Provider" introduced="^4" filter="s60" purpose="optional" class="plugin">
- <unit bldFile="mtpdataproviders/mtpplaybackcontroldp/group" mrp="mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.mrp"/>
- </component>
- </collection>
- <collection id="backupandrestore" name="Backup and Restore" level="specific">
- <component id="backupengine" name="Backup Engine" introduced="9.0" purpose="optional">
- <unit bldFile="backupandrestore/backupengine/group" mrp="backupandrestore/backupengine/group/connectivity_backupengine.mrp"/>
- </component>
- <component id="backuptest" name="Backup Test" introduced="^2" purpose="development">
- <unit bldFile="backupandrestore/backuptest/group" mrp="backupandrestore/backuptest/group/connectivity_backuptest.mrp"/>
- </component>
- </collection>
- <collection id="obex" name="OBEX" level="generic">
- <component id="obexprotocol" name="OBEX Protocol" introduced="9.1" purpose="optional">
- <unit bldFile="obex/obexprotocol/group" mrp="obex/obexprotocol/group/obex.mrp"/>
- </component>
- <component id="obexextensionapi" name="OBEX Extension API" introduced="9.2" purpose="optional">
- <unit bldFile="obex/obexextensionapi/group" mrp="obex/obexextensionapi/group/obex_extensionapis.mrp"/>
- </component>
- </collection>
- </package>
+ <package id="remoteconn" name="Remote Connectivity" levels="plugin framework server generic specific">
+ <collection id="connectivitymodules" name="Connectivity Modules" level="framework">
+ <component id="secon" filter="s60" name="Service Controllers">
+ <unit bldFile="connectivitymodules/secon/group"/>
+ </component>
+ </collection>
+ <collection id="remoteconn_info" name="Remote Connectivity Info" level="specific">
+ <component id="remoteconn_plat" filter="s60" name="Remote Connectivity Platform Interfaces" class="api">
+ <unit bldFile="remoteconn_plat/group"/>
+ </component>
+ <component id="remoteconn_metadata" name="Remote Connectivity Metadata" class="config" introduced="^2" purpose="development" target="desktop">
+ <unit mrp="remoteconn_info/remoteconn_metadata/remoteconn_metadata.mrp"/>
+ </component>
+ </collection>
+ <collection id="mtptransports" name="MTP Transports" level="plugin">
+ <component id="mtpusbtransport" name="MTP USB Transport" introduced="^2" purpose="optional" class="plugin">
+ <unit bldFile="mtptransports/mtpusbtransport/group" mrp="mtptransports/mtpusbtransport/group/mtp_usbsic.mrp"/>
+ </component>
+ <component id="mtpptpiptransport" name="MTP PTP-IP Transport" introduced="^3" purpose="optional" class="plugin">
+ <unit bldFile="mtptransports/mtpptpiptransport/group" mrp="mtptransports/mtpptpiptransport/group/mtp_ptpip.mrp"/>
+ </component>
+ <component id="mtpcontroller" name="MTP Controller" introduced="^3" purpose="optional" class="plugin">
+ <unit bldFile="mtptransports/mtpcontroller/group" mrp="mtptransports/mtpcontroller/group/mtpcontroller.mrp"/>
+ </component>
+ </collection>
+ <collection id="mtpfws" name="MTP Frameworks" level="framework">
+ <component id="mtpfw" name="MTP Framework" introduced="^2" purpose="optional">
+ <unit bldFile="mtpfws/mtpfw/group" mrp="mtpfws/mtpfw/group/mtp_framework.mrp"/>
+ </component>
+
+ </collection>
+ <collection id="mtpdataproviders" name="MTP Data Providers" level="generic">
+ <component id="mtpfileandfolderdp" name="MTP File and Folder Provider" introduced="^2" purpose="optional" class="plugin">
+ <unit bldFile="mtpdataproviders/mtpfileandfolderdp/group" mrp="mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.mrp"/>
+ </component>
+ </collection>
+ <collection id="backupandrestore" name="Backup and Restore" level="specific">
+ <component id="backupengine" name="Backup Engine" introduced="9.0" purpose="optional">
+ <unit bldFile="backupandrestore/backupengine/group" mrp="backupandrestore/backupengine/group/connectivity_backupengine.mrp"/>
+ </component>
+ <component id="backuptest" name="Backup Test" introduced="^2" purpose="development">
+ <unit bldFile="backupandrestore/backuptest/group" mrp="backupandrestore/backuptest/group/connectivity_backuptest.mrp"/>
+ </component>
+ </collection>
+ <collection id="obex" name="OBEX" level="generic">
+ <component id="obexprotocol" name="OBEX Protocol" introduced="9.1" purpose="optional">
+ <unit bldFile="obex/obexprotocol/group" mrp="obex/obexprotocol/group/obex.mrp"/>
+ </component>
+ <component id="obexextensionapi" name="OBEX Extension API" introduced="9.2" purpose="optional">
+ <unit bldFile="obex/obexextensionapi/group" mrp="obex/obexextensionapi/group/obex_extensionapis.mrp"/>
+ </component>
+ </collection>
+ </package>
</SystemDefinition>
--- a/package_map.xml Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-<PackageMap root="sf" layer="mw"/>
--- a/remoteconn_plat/dialup_connection_status_api/dialup_connection_status_api.metaxml Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" ?>
-<api id="9466701ce2cf18b6eb449314db5e9f97" dataversion="2.0">
- <name>Dial-up Connection Status API</name>
- <description>provides dial-up connection status info.</description>
- <type>c++</type>
- <collection>localconnectivityservice</collection>
- <libs>
- </libs>
- <release category="platform"/>
- <attributes>
- <!-- This indicates wether the api provedes separate html documentation -->
- <!-- or is the additional documentation generated from headers. -->
- <!-- If you are unsuere then the value is "no" -->
- <htmldocprovided>no</htmldocprovided>
- <adaptation>no</adaptation>
- </attributes>
-</api>
--- a/remoteconn_plat/dialup_connection_status_api/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File that exports the files belonging to
-: Dial-up Connection Status API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/dundomainpskeys.h MW_LAYER_PLATFORM_EXPORT_PATH(dundomainpskeys.h)
--- a/remoteconn_plat/dialup_connection_status_api/group/dialup_connection_status_api.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component dialup_connection_status_api
-
-source \sf\mw\remoteconn\localconnectivityservice\dialup_connection_status_api
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/remoteconn_plat/dialup_connection_status_api/inc/dundomainpskeys.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-* DUN Server P&S key definitions
-*
-*/
-
-
-#ifndef DUN_DOMAIN_PS_KEYS_H
-#define DUN_DOMAIN_PS_KEYS_H
-
-/**
-* PubSub Uid of dialup connection status
-*/
-const TUid KPSUidDialupConnStatus = {0x0100387d}; // UID of DUN server
-
-/**
-* Dialup connection status
-*
-* Possible integer values:
-* 0 (EDunUndefined) Value is not set
-* 1 (EDunInactive) Dun is inactive (no listening or active plugins)
-* 2 (EDunActive) Dun is active (at least one active plugin)
-*/
-
-const TUint KDialupConnStatus = 0x00000001;
-
-// Enumeration for DUN connection status
-enum TDialupConnStatus
- {
- EDialupUndefined,
- EDialupInactive,
- EDialupActive
- };
-
-#endif // DUN_DOMAIN_PS_KEYS_H
--- a/remoteconn_plat/dun_secondary_display_notification_api/dun_secondary_display_notification_api.metaxml Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" ?>
-<api id="2706bef70ffa514ea5a95b206e904b05" dataversion="2.0">
- <name>DUN Secondary Display Notification API</name>
- <description>defines message IDs for showing message on secondary display</description>
- <type>c++</type>
- <collection>localconnectivityservice</collection>
- <libs>
- </libs>
- <release category="platform"/>
- <attributes>
- <!-- This indicates wether the api provedes separate html documentation -->
- <!-- or is the additional documentation generated from headers. -->
- <!-- If you are unsuere then the value is "no" -->
- <htmldocprovided>no</htmldocprovided>
- <adaptation>no</adaptation>
- </attributes>
-</api>
--- a/remoteconn_plat/dun_secondary_display_notification_api/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File that exports the files belonging to
-* DUN Secondary Display Notification API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../inc/secondarydisplay/dunsecondarydisplayapi.h MW_LAYER_PLATFORM_EXPORT_PATH(SecondaryDisplay/dunsecondarydisplayapi.h)
--- a/remoteconn_plat/dun_secondary_display_notification_api/group/dun_secondary_display_notification_api.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component dun_secondary_display_notification_api
-
-source \sf\mw\remoteconn\localconnectivityservice\dun_secondary_display_notification_api
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/remoteconn_plat/dun_secondary_display_notification_api/inc/secondarydisplay/dunsecondarydisplayapi.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Contains dialog index for cover UI.
-*
-*/
-
-
-#ifndef DUNSECONDARYDISPLAYAPI_H
-#define DUNSECONDARYDISPLAYAPI_H
-
-#include <e32std.h>
-
-// Category (dunutils.dll)
-const TUid KDunNoteCategory = { 0x101F6E2A };
-
-enum TSecondaryDisplayDunDialogs
- {
- ECmdNone,
- ECmdMaxNumber
- };
-
-#endif // DUNSECONDARYDISPLAYAPI_H
--- a/remoteconn_plat/generic_hid_api/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File that exports the files belonging to
-: Generic HID API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/hidcollection.h MW_LAYER_PLATFORM_EXPORT_PATH(hidcollection.h)
-../inc/hidfield.h MW_LAYER_PLATFORM_EXPORT_PATH(hidfield.h)
-../inc/hidgeneric.h MW_LAYER_PLATFORM_EXPORT_PATH(hidgeneric.h)
-../inc/hidinterfaces.h MW_LAYER_PLATFORM_EXPORT_PATH(hidinterfaces.h)
-../inc/hidreportroot.h MW_LAYER_PLATFORM_EXPORT_PATH(hidreportroot.h)
-../inc/hidtranslate.h MW_LAYER_PLATFORM_EXPORT_PATH(hidtranslate.h)
-../inc/hidvalues.h MW_LAYER_PLATFORM_EXPORT_PATH(hidvalues.h)
--- a/remoteconn_plat/generic_hid_api/group/generic_hid_api.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component generic_hid_api
-
-source \sf\mw\remoteconn\localconnectivityservice\generic_hid_api
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/remoteconn_plat/generic_hid_api/inc/hidcollection.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares main application class.
-*
-*/
-
-
-#ifndef C_COLLECTION_H
-#define C_COLLECTION_H
-
-#include <e32std.h>
-
-class CField;
-
-
-/**
- * Collection of HID report descriptor
- * A CCollection represents an individual collection within a HID
- * report descriptor. Each collection may have a number of associated
- * report fields (CField objects) and a number of child collection
- * objects. The collections within a HID report descriptor form a tree
- * structure, with a CReportRoot collection at the root. The tree is
- * generated by CParser.
- *
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CCollection : public CBase
- {
-
-public:
-
- /**
- * An enumerations giving the possible types of collection, as
- * given in "USB Device Class Definition for Human Interface
- * Devices (HID)", Firmware Specification, Version 1.11, USB
- * Implementers' Forum, June 2001.
- *
- * Note that a TUint32 is used for CCollection::iType, as it is
- * possible to have a vendor defined collection type that isn't
- * included in this list.
- */
- enum TType
- {
- EPhysical = 0x00, //!< Physical (group of axes)
- EApplication = 0x01, //!< Application (mouse,keyboard)
- ELogical = 0x02, //!< Logical (interrelated data)
- EReport = 0x03, //!< Report
- ENamedArray = 0x04, //!< NamedArray
- EUsageSwitch = 0x05, //!< UsageSwitch
- EUsageModifier = 0x06 //!< UsageModifier
- };
-
- static CCollection* NewL();
- static CCollection* NewLC();
-
- /**
- * Destructor.
- */
- virtual ~CCollection();
-
- /**
- * Get collection type
- *
- * @since S60 v5.0
- * @return The type for this collection item
- */
- IMPORT_C TUint32 Type() const;
-
- /**
- * Get usagepage
- *
- * @since S60 v5.0
- * @return The usage page for this collection
- */
- IMPORT_C TInt UsagePage() const;
-
- /**
- * Get usagepage
- *
- * @since S60 v5.0
- * @return The usage page for this collection
- */
- IMPORT_C TInt Usage() const;
-
- /**
- * Get number of collections
- *
- * @since S60 v5.0
- * @return The number of collections that have been created so far
- */
- IMPORT_C TInt CollectionCount() const;
-
- /**
- * Gets numbers of field stored in collection
- *
- * @since S60 v5.0
- * @return The number of fields stored in for the current collection
- */
- IMPORT_C TInt FieldCount() const;
-
- /**
- * Returns a pointer to a specific collection from the list of collections
- *
- * @since S60 v5.0
- * @param aIndex The index of the required collection
- * @return The number of fields stored in for the current collection.
- * NULL if there are no collection object at the secified index
- */
- IMPORT_C const CCollection* CollectionByIndex(TInt aIndex) const;
-
- /**
- * Returns a pointer to the field object at the given index within the field
- * list
- *
- * @since S60 v5.0
- * @param aIndex The offset within the current field list
- * @return A pointer to the specified field object
- * NULL if there is no field object at the specified index
- */
- IMPORT_C const CField* FieldByIndex(TInt aIndex) const;
-
- /**
- * Check if collection type is physical
- *
- * @since S60 v5.0
- * @return true if physical
- */
- IMPORT_C TBool IsPhysical() const;
-
- /**
- * Check if collection type is application
- *
- * @since S60 v5.0
- * @return true if application
- */
- IMPORT_C TBool IsApplication() const;
-
- /**
- * Check if collection type is logical
- *
- * @since S60 v5.0
- * @return true if logical
- */
- IMPORT_C TBool IsLogical() const;
-
- /**
- * Check if collection type is report
- *
- * @since S60 v5.0
- * @return true if report
- */
- IMPORT_C TBool IsReport() const;
-
- /**
- * Check if collection type is name array
- *
- * @since S60 v5.0
- * @return true if named array
- */
- IMPORT_C TBool IsNamedArray() const;
-
- /**
- * Check if collection type is usage switch
- *
- * @since S60 v5.0
- * @return true if is usage switch
- */
- IMPORT_C TBool IsUsageSwitch() const;
-
- /**
- * Check if collection type is usage modifier
- *
- * @since S60 v5.0
- * @return true if usage modifier
- */
- IMPORT_C TBool IsUsageModifier() const;
-
-public:
-
- /**
- * Set Collection type
- *
- * @since S60 v5.0
- * @return None
- */
- void SetType(TUint32 aType);
-
- /**
- * Set usage page
- *
- * @since S60 v5.0
- * @return None
- */
- void SetUsagePage(TInt aUsagePage);
-
- /**
- * Set usage
- *
- * @since S60 v5.0
- * @return None
- */
- void SetUsage(TInt aUsage);
-
- /**
- * Called when a new collection object has been encountered in
- * the report descriptor. This creates a new CCollection object
- * and adds it to the current list
- *
- * @since S60 v5.0
- * @return None
- */
- CCollection* AddCollectionL();
-
- /**
- * Called when a new field object has been encountered in the
- * report descriptor. This creates a new field object and adds it
- * the the current list
- *
- * @since S60 v5.0
- * @return A pointer to the new field object
- */
- CField* AddFieldL();
-
-protected:
-
- CCollection();
- void ConstructL();
-
-private:
-
- /**
- * Collection type
- */
- TUint32 iType;
-
- /**
- * Usage page
- */
- TInt iUsagePage;
-
- /**
- * Usage
- */
- TInt iUsage;
-
- /**
- * List of collections for the report descriptor
- */
- RPointerArray<CCollection> iCollections;
-
- /**
- * List of fields in the current collection
- */
- RPointerArray<CField> iFields;
-
- };
-
-#endif // C_COLLECTION_H
-
--- a/remoteconn_plat/generic_hid_api/inc/hidfield.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,732 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID field descriptor definition
-*
-*/
-
-#ifndef C_FIELD_H
-#define C_FIELD_H
-
-
-#include <e32base.h>
-
-
-const TInt KFieldAttributeConstant = 1<<0; //!< Data (0) or Constant (1)
-const TInt KFieldAttributeVariable = 1<<1; //!< Array (0) or Variable (1)
-const TInt KFieldAttributeRelative = 1<<2; //!< Absolute (0) or Relative (1)
-const TInt KFieldAttributeWrap = 1<<3; //!< No wrap (0) or Wrap (1)
-const TInt KFieldAttributeNonLinear = 1<<4; //!< Linear (0) or Non-linear (1)
-const TInt KFieldAttributeNoPreferred = 1<<5; //!< Preferred state (0) or not (1)
-const TInt KFieldAttributeNullState = 1<<6; //!< No null position (0) or null state (1)
-const TInt KFieldAttributeVolatile = 1<<7; //!< Non-volatile (0) or volatile (1)
-const TInt KFieldAttributeBufferedBytes = 1<<8; //!< Bit field (0) or buffered bytes (1)
-
-const TInt KSizeOfByte = 8;
-/**
- * HID report field presentation
- * Represents an individual field in a HID report, ie. the attributes
- * of an input, output or feature Main item defined in the HID report
- * descriptor.
- *
- * The CField contains information such as the usage IDs sent in the
- * the report, the type of the report (input, output or feature) and
- * the logical range.
- *
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CField : public CBase
- {
-public:
- enum TType
- {
- EInput, //!< Input report
- EOutput, //!< Output report
- EFeature //!< Feature report
- };
-
-
-
-public:
- static CField* NewL();
- static CField* NewLC();
-
- /**
- * Destructor.
- */
- virtual ~CField();
-
-public:
- // Accessors:
-
- /**
- * Set Report root
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C TInt UsagePage() const;
-
- /**
- * Return report id
- *
- * @since S60 v5.0
- * @return report id
- */
- IMPORT_C TInt ReportId() const;
-
- /**
- * Return offset
- *
- * @since S60 v5.0
- * @return offset
- */
- IMPORT_C TInt Offset() const;
-
- /**
- * Return size
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C TInt Size() const;
-
- /**
- * Return count
- *
- * @since S60 v5.0
- * @return count
- */
- IMPORT_C TInt Count() const;
-
- /**
- * Return logical minimium
- *
- * @since S60 v5.0
- * @return Logical minimium
- */
- IMPORT_C TInt LogicalMin() const;
-
- /**
- * Return logical maximum
- *
- * @since S60 v5.0
- * @return logical maximum
- */
- IMPORT_C TInt LogicalMax() const;
-
- /**
- * Return usage min
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C TInt UsageMin() const;
-
- /**
- * Return usage max
- *
- * @since S60 v5.0
- * @return usage max
- */
- IMPORT_C TInt UsageMax() const;
-
- /**
- * Return Physical minimum
- *
- * @since S60 v5.0
- * @return physical minimum
- */
- IMPORT_C TInt PhysicalMin() const;
-
- /**
- * Return Physical max
- *
- * @since S60 v5.0
- * @return return physical max
- */
- IMPORT_C TInt PhysicalMax() const;
-
- /**
- * Return unit
- *
- * @since S60 v5.0
- * @return Unit
- */
- IMPORT_C TInt Unit() const;
-
- /**
- * Return unit exponent
- *
- * @since S60 v5.0
- * @return unit exponent
- */
- IMPORT_C TInt UnitExponent() const;
-
- /**
- * Return Designator index
- *
- * @since S60 v5.0
- * @return Designator Index
- */
- IMPORT_C TInt DesignatorIndex() const;
-
- /**
- * Return designator minimium
- *
- * @since S60 v5.0
- * @return return designator index minimium
- */
- IMPORT_C TInt DesignatorMin() const;
-
- /**
- * Return designator maximium
- *
- * @since S60 v5.0
- * @return designator maximium
- */
- IMPORT_C TInt DesignatorMax() const;
-
- /**
- * Return string minimum
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C TInt StringMin() const;
-
- /**
- * Return string maximum
- *
- * @since S60 v5.0
- * @return string maximum
- */
- IMPORT_C TInt StringMax() const;
-
- /**
- * Return string index
- *
- * @since S60 v5.0
- * @return string index
- */
- IMPORT_C TInt StringIndex() const;
-
- /**
- * Return attributes
- *
- * @since S60 v5.0
- * @return attributes
- */
- IMPORT_C TUint32 Attributes() const;
-
- /**
- * Return type
- *
- * @since S60 v5.0
- * @return type
- */
- IMPORT_C TType Type() const;
-
- /**
- * Return variable status
- *
- * @since S60 v5.0
- * @return variable status
- */
- IMPORT_C TBool IsVariable() const;
-
- /**
- * Return array status
- *
- * @since S60 v5.0
- * @return arrau status
- */
- IMPORT_C TBool IsArray() const;
-
- /**
- * Return data status
- *
- * @since S60 v5.0
- * @return data status
- */
- IMPORT_C TBool IsData() const;
-
- /**
- * Return constant status
- *
- * @since S60 v5.0
- * @return constant status
- */
- IMPORT_C TBool IsConstant() const;
-
- /**
- * Return input status
- *
- * @since S60 v5.0
- * @return input status
- */
- IMPORT_C TBool IsInput() const;
-
- /**
- * Return output status
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C TBool IsOutput() const;
-
- /**
- * Return feature status
- *
- * @since S60 v5.0
- * @return feature status
- */
- IMPORT_C TBool IsFeature() const;
-
- /**
- * Check if reportid is in report
- *
- * @since S60 v5.0
- * @param aReportId report id
- * @return true if reportid is in report
- */
- IMPORT_C TBool IsInReport(TInt aReportId) const;
-
- /**
- * Check if usage exsist
- *
- * @since S60 v5.0
- * @param aUsage Usage id
- * @return None
- */
- IMPORT_C TBool HasUsage(TInt aUsage) const;
-
- /**
- * Return usage array
- *
- * @since S60 v5.0
- * @return usage array
- */
- IMPORT_C TArray<TInt> UsageArray() const;
-
- /**
- * Return usage
- *
- * @since S60 v5.0
- * @param aIndex usage array index
- * @return usage
- */
- IMPORT_C TInt Usage(TInt aIndex) const;
-
- /**
- * Return usage count
- *
- * @since S60 v5.0
- * @return usage count
- */
- IMPORT_C TInt UsageCount() const;
-
- /**
- * Return last usage
- *
- * @since S60 v5.0
- * @return last usage
- */
- IMPORT_C TInt LastUsage() const;
-
- /**
- * Set type
- *
- * @since S60 v5.0
- * @param aType type of field
- * @return None
- */
- IMPORT_C void SetType(const TType& aType);
-
- /**
- * Add usage
- *
- * @since S60 v5.0
- * @param aUsage usage to be added
- * @return None
- */
- IMPORT_C void AddUsageL(TInt aUsage);
-
- /**
- * Clear usage list
- *
- * @since S60 v5.0
- * @return None
- */
- IMPORT_C void ClearUsageList();
-
- /**
- * Set usage page
- *
- * @since S60 v5.0
- * @param aUsagePage usagepage to be set
- * @return None
- */
- IMPORT_C void SetUsagePage(TInt aUsagePage);
-
- /**
- * Set offset
- *
- * @since S60 v5.0
- * @param aOffset offset to be set
- * @return None
- */
- IMPORT_C void SetOffset(TInt aOffset);
-
- /**
- * Set size
- *
- * @since S60 v5.0
- * @param aSize size to be set
- * @return None
- */
- IMPORT_C void SetSize(TInt aSize);
-
- /**
- * Set count
- *
- * @since S60 v5.0
- * @param aCount Count to be set
- * @return None
- */
- IMPORT_C void SetCount(TInt aCount);
-
- /**
- * Set logical minimium
- *
- * @since S60 v5.0
- * @param aMin Logical minimium to be set
- * @return None
- */
- IMPORT_C void SetLogicalMin(TInt aMin);
-
- /**
- * Set logical maximum
- *
- * @since S60 v5.0
- * @param aMax logical maximum to be used
- * @return None
- */
- IMPORT_C void SetLogicalMax(TInt aMax);
-
- /**
- * Set usage min
- *
- * @since S60 v5.0
- * @param aMin usage minimium to be set.
- * @return None
- */
- IMPORT_C void SetUsageMin(TInt aMin);
-
- /**
- * Set usage maximum
- *
- * @since S60 v5.0
- * @param aMax usage max to be set
- * @return None
- */
- IMPORT_C void SetUsageMax(TInt aMax);
-
- /**
- * Set Report ID
- *
- * @since S60 v5.0
- * @param aReportId report id to be set
- * @return None
- */
- IMPORT_C void SetReportId(TInt aReportId);
-
- /**
- * Set attributes
- *
- * @since S60 v5.0
- * @param aAttributes attributes to be set
- * @return None
- */
- IMPORT_C void SetAttributes(TUint32 aAttributes);
-
- /**
- * Set physical minimium
- *
- * @since S60 v5.0
- * @param aValue physical minimium value
- * @return None
- */
- IMPORT_C void SetPhysicalMin(TInt aValue);
-
- /**
- * Set Physical maximum
- *
- * @since S60 v5.0
- * @param aValue physical maximum value
- * @return None
- */
- IMPORT_C void SetPhysicalMax(TInt aValue);
-
- /**
- * Set unit value
- *
- * @since S60 v5.0
- * @param aValue unit value
- * @return None
- */
- IMPORT_C void SetUnit(TInt aValue);
-
- /**
- * Set unit exponent
- *
- * @since S60 v5.0
- * @param aValue unit exponent valut to be set
- * @return None
- */
- IMPORT_C void SetUnitExponent(TInt aValue);
-
- /**
- * Set Designator index
- *
- * @since S60 v5.0
- * @param aValue Designator index value
- * @return None
- */
- IMPORT_C void SetDesignatorIndex(TInt aValue);
-
- /**
- * Set designator minimium
- *
- * @since S60 v5.0
- * @param aValue designator minimum value
- * @return None
- */
- IMPORT_C void SetDesignatorMin(TInt aValue);
-
- /**
- * Set designator maximium value
- *
- * @since S60 v5.0
- * @param aValue designator maximium value
- * @return None
- */
- IMPORT_C void SetDesignatorMax(TInt aValue);
-
- /**
- * Set string minimium value
- *
- * @since S60 v5.0
- * @param aValue string minimium value
- * @return None
- */
- IMPORT_C void SetStringMin(TInt aValue);
-
- /**
- * Set string maximum value
- *
- * @since S60 v5.0
- * @param aValue string maximum value to be set
- * @return None
- */
- IMPORT_C void SetStringMax(TInt aValue);
-
- /**
- * Set string index
- *
- * @since S60 v5.0
- * @param aValue string index
- * @return None
- */
- IMPORT_C void SetStringIndex(TInt aValue);
-
- /**
- * Set Logical range
- *
- * @since S60 v5.0
- * @param aMin logical range minimium value
- * @param aMax logical range maximum value
- * @return None
- */
- IMPORT_C void SetLogicalRange(TInt aMin, TInt aMax);
-
- /**
- * Set Usage range
- *
- * @since S60 v5.0
- * @param aMin usage range minimium value
- * @param aMax usage range maximum value
- * @return None
- */
- IMPORT_C void SetUsageRange(TInt aMin, TInt aMax);
-
- /**
- * Set Physical range
- *
- * @since S60 v5.0
- * @param aMin physical range minimium value
- * @param aMax physical range maximum value
- * @return None
- */
- IMPORT_C void SetPhysicalRange(TInt aMin, TInt aMax);
-
- /**
- * Set string range
- *
- * @since S60 v5.0
- * @param aMin string range minimium value
- * @param aMax string range maximum value
- * @return None
- */
- IMPORT_C void SetStringRange(TInt aMin, TInt aMax);
-
- /**
- * Set designator range
- *
- * @since S60 v5.0
- * @param aMin designator range minimium value
- * @param aMax designator range maximum value
- * @return None
- */
- IMPORT_C void SetDesignatorRange(TInt aMin, TInt aMax);
-
-private:
- CField();
-
-
-
-private:
-
- /**
- * Input, output or feature report
- */
- TType iType;
-
- // For a detailed description of the use of the following members,
- // see "USB Device Class Definition for Human Interface Devices
- // (HID)", Firmware Specification, Version 1.11, USB Implementers'
- // Forum, June 2001.
-
- /**
- * The usage page this field is associated with (G)
- */
- TInt iUsagePage;
-
- /**
- * ID for the HID report containing this field (G)
- */
- TInt iReportId;
-
- /**
- * Field offset (in bits) from start of report
- */
- TInt iPos;
-
- /**
- * Bit size of each item in the current field (G)
- */
- TInt iSize;
-
- /**
- * Number of items in the report field (G)
- */
- TInt iCount;
-
- /**
- * Minimum extent value in logical units (G)
- */
- TInt iLogicalMin;
-
- /**
- * Maximum extent value in logical units (G)
- */
- TInt iLogicalMax;
-
- /**
- * Starting usage associated with array / bitmap (L)
- */
- TInt iUsageMin;
-
- /**
- * Ending usage associated with array / bitmap (L)L)
- */
- TInt iUsageMax;
-
- /**
- * Unit value (G)
- */
- TInt iUnit;
-
- /**
- * Value of the unit exponent in base 10 (G)
- */
- TInt iUnitExponent;
-
- /**
- * Body part used for a control (L)
- */
- TInt iDesignatorIndex;
-
- /**
- * String associated with a control (L)
- */
- TInt iStringIndex;
-
- /**
- * Minimum physical extent for a variable item (G)
- */
- TInt iPhysicalMin;
-
- /**
- * Maximum physical extent for a variable item (G)
- */
- TInt iPhysicalMax;
-
- /**
- * First string index for a group of strings (L)
- */
- TInt iStringMin;
-
- /**
- * Last string index for a group of strings (L)
- */
- TInt iStringMax;
-
- /**
- * Starting designator index (L)
- */
- TInt iDesignatorMin;
-
- /**
- * Ending designator index (L)
- */
- TInt iDesignatorMax;
-
- /**
- * Flags associated with a main item (e.g. "array")
- */
- TUint32 iAttributes;
-
- /**
- * The usage indexes associated with this field (G)
- */
- RArray<TInt> iUsageList;
-
- // (G) = Global item
- // (L) = Local item
- };
-
-#endif
-
--- a/remoteconn_plat/generic_hid_api/inc/hidgeneric.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares main application class.
-*
-*/
-
-
-#ifndef C_GENERICHID_H
-#define C_GENERICHID_H
-
-#include <hidinterfaces.h>
-
-class CDriverListItem;
-class TElement;
-class CParser;
-class CReportRoot;
-class CConnectionInfo;
-
-/**
- *
- * Generic HID main class
- * Generic HID layer, allowing the HID Transport layers and device drivers to
- * pass data to the Generic HID
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CGenericHid : public CHidTransport, public MDriverAccess
- {
-public:
- virtual ~CGenericHid();
-
- /**
- * Constructs a generic HID layer with a reference to the owner so commands can
- * be sent to connected devices
- *
- * @since S60 v5.0
- * @param aTransportLayer The owning transport layer
- * @return a Pointer to an instantiated Generic HID layer
- */
- IMPORT_C static CGenericHid* NewL(MTransportLayer* aTransportLayer);
-
- /**
- * Constructs a generic HID layer with a reference to the owner so commands can
- * be sent to connected devices
- *
- * @since S60 v5.0
- * @param aTransportLayer The owning transport layer
- * @return a Pointer to an instantiated Generic HID layer
- */
- IMPORT_C static CGenericHid* NewLC(MTransportLayer* aTransportLayer);
-
- /**
- * Fromm class MDriverAccess
- * Retrieves the country code for the HID device
- *
- * @since S60 v5.0
- * @param aConnectionID The device identifier
- * @return a country code
- */
- TUint CountryCodeL(TInt aConnectionID);
-
- /**
- * Fromm class MDriverAccess
- * Retrieves the country code for the HID device
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @return a vendor ir
- */
- TUint VendorIdL(TInt aConnectionId);
-
- /**
- * Fromm class MDriverAccess
- * Retrieves the product identifier for the HID device
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @return a prodcut id
- */
- TUint ProductIdL(TInt aConnectionId);
-
-
- /**
- * Fromm class MDriverAccess
- * Sets the protocol to be used for reports.
- * Leaves KErrInUse The request was not successful because the
- * transport layer is busy with a previous request,
- * KErrNotReady The request failed because the device
- * is currently unavailable and KErrNotFound The request
- * was unsuccessful
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @param aInterface The device interface being used by the driver
- * @param aProtocol The requested report protocol (boot or report)
- * @parem aDriver Calling driver
- * @return None.
- */
- void SetProtocolL(TInt aConnectionId, TUint16 aInterface,
- MDriverAccess::TProtocols aProtocol, CHidDriver* aDriver);
-
-
- /**
- * Fromm class MDriverAccess
- * Requests the current protocol from the HID device. This is an asynchronous
- * request. The protocol value will come through at a later time
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @param aInterface The hid interface
- * @return None.
- */
- void GetProtocolL(TInt aConnectionId, TUint16 aInterface);
-
- /**
- * Fromm class MDriverAccess
- * A request for a report from the device. This is an asynchronous request.
- * The report will come through at a later time
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @param aReportId report id to be get
- * @param aInterface The device interface being used by the driver
- * @param aLength report lenght
- * @return None.
- */
- void GetReportL(TInt aConnectionId, TUint8 aReportId,
- TUint16 aInterface, TUint16 aLength);
-
- /**
- * Fromm class MDriverAccess
- * A request to send a report payload to the HID device
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aReportId The report id
- * @param aReportType Type of report (input/output/feature)
- * @param aPayload The report containing the device setup packet
- * @param aInterface The device interface being used by the driver
- * @parem aDriver Calling driver
- * @return None.
- */
- void SetReportL(TInt aConnectionId,
- TUint8 aReportId, MDriverAccess::TReportType aReportType,
- const TDesC8& aPayload, TUint16 aInterface, CHidDriver* aDriver);
-
- /**
- * Fromm class MDriverAccess
- * A request to send a report payload to the HID device in Interrupt Channel
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aReportId report id which payload to be send
- * @param aPayload The report containing the device setup packet
- * @param aInterface The device interface being used by the driver
- * @return None.
- */
- void DataOutL(TInt aConnectionId, TUint8 aReportId,
- const TDesC8& aPayload, TUint16 aInterface);
-
- /**
- * Fromm class MDriverAccess
- * Request for the current idle setting for the device
- * This is an asynchronous request. The idle value will come through at a
- * later time. Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device identifier
- * @param aReportId The report ID for which we want the idle rate
- * @param aInterface The device interface being used by the driver
- * @return None.
- */
- void GetIdleL(TInt aConnectionId, TUint8 aReportId, TUint16 aInterface);
-
- /**
- * Fromm class MDriverAccess
- * Request to the HID device to set the specified idle rate
- * A request to send a report payload to the HID device
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aDuration The number of 0.04ms intervals to wait between reports
- * @param aReportId The report for which the idle rate is being set
- * @param aInterface The device interface being used by the driver
- * @parem aDriver Calling driver
- * @return None.
- */
- void SetIdleL(TInt aConnectionId, TUint8 aDuration,
- TUint8 aReportId, TUint16 aInterface, CHidDriver* aDriver);
-
- /**
- * From class CHidTransport
- * Called by the transport layers to inform the generic HID of the success of
- * the last Set... command.
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aCmdAck Status of the last Set... command
- * @return None.
- */
- void CommandResult(TInt aConnectionId, TInt aCmdAck);
-
- /**
- * From class MDriverAccess
- * Gives the device driver access to the results of the report
- * descriptor parsing
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @return A pointer to the parsed descriptor object.
- */
- CReportRoot* ReportDescriptor(TInt aConnectionId);
-
- /**
- * From class CHidTransport
- * Called by a transport layer when a device has connected and the report
- * descriptors have been obtained
- *
- * @since S60 v5.0
- * @param aConnectionId The tansport-layer enumeration for the connection
- * @param aDescriptor The report descriptor for the connected HID device
- * @return KErrNone if a driver was found, otherwise an error code
- */
- TInt ConnectedL(TInt aConnectionId, const TDesC8& aDescriptor);
-
- /**
- * From class CHidTransport
- * Called by a transport layer when a device has been disconnected
- *
- * @since S60 v5.0
- * @param aConnectionId The tansport-layer enumeration for the connection
- * @return KErrNone if a driver was found, otherwise an error code
- */
- TInt Disconnected(TInt aConnectionId);
-
- /**
- * From class CHidTransport
- * Called by the transport layer when a device has sent a report on the
- * interrupt or control channel
- *
- * @since S60 v5.0
- * @param aConnectionId The tansport-layer enumeration for the connection
- * @param aChannel Channel ID (Interrupt or Control)
- * @param aPayload The complete report payload
- * @return KErrNone if the data was handled by the driver, otherwise an error code
- */
- virtual TInt DataIn(TInt aConnectionId,
- CHidTransport::THidChannelType aChannel, const TDesC8& aPayload);
-
- /**
- * From class CHidTransport
- * Called by the transport layer to suspend or resume a driver
- *
- * @since S60 v5.0
- * @param aConnectionId The tansport-layer enumeration for the connection
- * @param aActive EActive to start the driver(s), ESuspend to suspend
- * @return KErrNone if the driver was successfully activated, otherwise an error code
- */
- TInt DriverActive(TInt aConnectionId,
- CHidTransport::TDriverState aActive);
-
-protected:
- CGenericHid(MTransportLayer* aTransportLayer);
- void ConstructL();
-
-private:
-
- /**
- * Remove drivers
- *
- * @since S60 v5.0
- * @return None
- */
- void RemoveDrivers();
-
- /**
- * Attempts to find a driver that is handling reports from the HID device
- *
- * @since S60 v5.0
- * @return Connection information
- */
- CConnectionInfo* SeekConnectionInfo(TInt aConnectionId);
-
-private:
-
- /**
- * Instantiated driver list
- */
- TSglQue<CDriverListItem> iDriverList;
-
- /**
- * Parser
- * Own.
- */
- CParser* iParser;
-
- /**
- * Parser
- * Not own.
- */
- MTransportLayer* iTransportLayer;
-
- /**
- * Connection information
- */
- RPointerArray<CConnectionInfo> iConnectionInfo;
-
- /**
- * Input data handling registry
- * Own.
- */
- CHidInputDataHandlingReg* iInputHandlingReg;
-
- };
-
-#endif
--- a/remoteconn_plat/generic_hid_api/inc/hidinterfaces.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,704 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares main application class.
-*
-*/
-
-
-
-#ifndef C_HIDDRIVER_H
-#define C_HIDDRIVER_H
-
-#include <ecom/ecom.h>
-
-
-class CReportRoot;
-class MDriverAccess;
-class MTransportLayer;
-class CHidDriver;
-// ----------------------------------------------------------------------
-
-// Return codes from the Generic HID to Transport layers
-//
-const TInt KErrHidBase = -8000;
-
-const TInt KErrHidNoDriver = KErrHidBase; /*!< No driver could be found to handle the request */
-const TInt KErrHidSuspended = KErrHidBase - 1; /*!< Command not handled - driver is suspended */
-const TInt KErrHidUnrecognised = KErrHidBase - 2; /*!< Driver could not understand the data */
-const TInt KErrHidUnexpected = KErrHidBase - 3; /*!< Unsolicited data from the device */
-const TInt KErrHidBadChannel = KErrHidBase - 4; /*!< Channel was not Int or Ctrl type */
-const TInt KErrHidPartialSupported = KErrHidBase - 5; /*!< Partil supported hid device */
-
-// Errors returned by the report translator / generator:
-//
-const TInt KErrUsageNotFound = KErrHidBase - 10; //!< Usage page/ID wasn't found in the field
-const TInt KErrValueOutOfRange = KErrHidBase - 11; //!< Value specified is outside the logical range
-const TInt KErrNoSpaceInArray = KErrHidBase - 12; //!< Array field already contains the maximum number of values
-const TInt KErrBadControlIndex = KErrHidBase - 13; //!< Control index exceeds the number of controls in the field
-
-// ACK codes returned by Set/Get requests to the devices
-//
-const TInt KErrCommandAckBase = -8100;
-
-const TInt KErrAckInvalidReportID = KErrCommandAckBase; /*!< Invalid report ID */
-const TInt KErrAckInvalidParameter = KErrCommandAckBase - 1; /*!< Invalid or out of range param */
-const TInt KErrAckUnknown = KErrCommandAckBase - 2; /*!< Command failed, but the device can't determine why */
-const TInt KErrAckFatal = KErrCommandAckBase - 3; /*!< The device is in an unrecoverable state and must be restarted */
-
-// Constant for plugin interface:
-const TUid KHidDriverPluginInterfaceUid = { 0x10201d26 };
-
-
-class THidEvent
- {
- public:
- /**
- * Usage page
- */
- TInt iUsagePage;
-
- /**
- * Keycode
- */
- TInt iKeyCode;
- };
-
-class CHidInputDataHandlingReg: public CBase
- {
-
-public:
- /**
- * Two-phased constructor.
- */
- static CHidInputDataHandlingReg* NewL();
-
- /**
- * Destructor
- */
- virtual ~CHidInputDataHandlingReg();
-
-public:
-
- /**
- * Check if key event is not allready processed
- *
- * @since S60 v5.0
- * @param aUsagePage a usage page to be checked
- * @param aUsage a usage code to be checked
- * @return true if event is not allready handled
- */
- IMPORT_C TBool AllowedToHandleEvent(TInt aUsagePage, TInt aUsage);
-
-
- /**
- * Add handled event
- *
- * @since S60 v5.0
- * @param aUsagePage usage page to be handled
- * @param aUsage Usage to be handled
- * @return None.
- */
- IMPORT_C void AddHandledEvent( TInt aUsagePage, TInt aUsage);
-
- /**
- * Reset Array
- */
- void Reset();
-
-private:
-
- CHidInputDataHandlingReg();
- void ConstructL();
-
-private:
-
- /**
- * Event array
- * Own.
- */
- CArrayFixFlat<THidEvent>* iEventArray;
-
- };
-
-/**
- *
- * Transport layer interface class
- * Interface allowing the generic HID layer to pass data to a Transport layer
- * All commands are asynchronous. The results are returned via the
- *
- * @since S60 v5.0
- */
-class MTransportLayer
- {
-public:
-
- /**
- * Request for the country code of the given device.
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return country code.
- */
- virtual TUint CountryCodeL(TInt aConnID) = 0;
-
- /**
- * Request for the vendor identifier for the given device.
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return vendor id.
- */
- virtual TUint VendorIdL(TInt aConnID) = 0;
-
- /**
- * Request for the product identifier for the given device.
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return product id.
- */
- virtual TUint ProductIdL(TInt aConnID) = 0;
-
- /**
- * Request for the current device report protocol. The protocol will be
- * received as a control report via the CHidTransport::DataIn function
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aInterface The interface we want to get the protocol from
- * @return None.
- */
- virtual void GetProtocolL(TInt aConnID, TUint16 aInterface) = 0;
-
- /**
- * Request to put the device in the specified protocol
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aValue The requested protocol for the device (boot or report)
- * @param aInterface The interface we want to set the protocol for
- * @return None.
- */
- virtual void SetProtocolL(TInt aConnID, TUint16 aValue,
- TUint16 aInterface) = 0;
-
- /**
- * Request for a device report. The data will be received as a control report
- * via the CHidTransport::DataIn function
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aReportType The type of report (input/output/feature) requested
- * @param aReportID The specific report required
- * @param aInterface The interface we want the report from
- * @param aLength The expected length of the report buffer
- * @return None.
- */
- virtual void GetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID,
- TUint16 aInterface, TUint16 aLength) = 0;
-
- /**
- * Request to send a report to a device. The response will be reported via the
- * CHidTransport::CommandResult function
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aReportType The type of report (input/output/feature) requested
- * @param aReportID The specific report required to set
- * @param aInterface The interface we want to send the report to
- * @param aReport The report payload to be sent to the device
- * @return None.
- */
- virtual void SetReportL(TInt aConnID, TUint8 aReportType,TUint8 aReportID,
- TUint16 aInterface, const TDesC8& aReport) = 0;
-
- /**
- * Request to send data to a device. There are no responses to this report from device.
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aReportID The specific report required
- * @param aInterface The interface we want to send the report to
- * @param aReport The report payload to be sent to the device
- * @return None.
- */
- virtual void DataOutL(TInt aConnID, TUint8 aReportID,
- TUint16 aInterface, const TDesC8& aReport) = 0;
-
- /**
- * Request for the current idle rate of a report from the device. The response
- * will be recevied via the CHidTransport::DataIn function
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aReportID The specific report to be queried
- * @param aInterface The interface we want to query for idle rate
- * @return None.
- */
- virtual void GetIdleL(TInt aConnID, TUint8 aReportID,
- TUint16 aInterface) = 0;
-
- /**
- * Request to set the current idle rate for a report on the device.
- * The response will be received via the CHidTransport::CommandResult function
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @param aReportID The specific report to be queried
- * @param aDuration The time period between idle reports (4ms per bit. An
- * interval of 0 disables idle reports so that Interrupt reports are only ever
- * received when the reported data has changed
- * @param aReportID The specific report to be queried
- * @param aInterface The interface we want to query for idle rate
- * @return None.
- */
- virtual void SetIdleL(TInt aConnID, TUint8 aDuration, TUint8 aReportID,
- TUint16 aInterface) = 0;
- };
-
-/**
- *
- * Driver access interface
- * Interface allowing drivers to request data from and send data to devices via
- * the Generic HID layer.
- *
- * @since S60 v5.0
- */
-class MDriverAccess
- {
-public:
-
- /**
- * The type of report requested from the device
- * Note: The enumeration values map directly to the HID equivalent values
- * (Passed as TUint16 values to the transport layer)
- */
- enum TReportType
- {
- EInput=1, /*!< Input report */
- EOutput, /*!< Output report */
- EFeature /*!< Feature report */
- };
-
- /** Return codes from the Generic HID to the device drivers
- * Note: The enumeration values map directly to the HID equivalent values
- *(Passed as TUint8 values to the transport layer)
- */
-
- enum TProtocols
- {
- EBoot=0, /*!< Boot Protocol */
- EReport=1 /*!< Report Protocol */
- };
-
-public:
-
- /**
- * Retrieves the country code for the HID device
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return contry code
- */
- virtual TUint CountryCodeL(TInt aConnID) = 0;
-
- /**
- * Retrieves the for the HID device
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return vendor id
- */
- virtual TUint VendorIdL(TInt aConnID) = 0;
-
- /**
- * Retrieves the product identifier for the HID device
- *
- * @since S60 v5.0
- * @param aConnID The device identifier
- * @return produrct id
- */
- virtual TUint ProductIdL(TInt aConnID) = 0;
-
- /**
- * Requests the current protocol for the device (boot or report)
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavaila
- *
- * @since S60 v5.0
- * @param aConnectionID The connection id
- * @param aInterface The current interface being used by the driver
- * @return None.
- */
- virtual void GetProtocolL(TInt aConnectionID,
- TUint16 aInterface) = 0;
-
- /**
- * Requests a report from the device
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The connection id
- * @param aReportId The report required from the device
- * @param aInterface The current interface being used by the driver
- * @param aLength ** NOT USED **
- * @return None
- */
- virtual void GetReportL(TInt aConnectionId, TUint8 aReportId,
- TUint16 aInterface, TUint16 aLength) = 0;
-
- /**
- * Requests the current Idle setting for the device
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aReportId The report required from the device
- * @param aInterface The current interface being used by the driver
- * @return None.
- */
- virtual void GetIdleL(TInt aConnectionId, TUint8 aReportId,
- TUint16 aInterface ) = 0;
-
- /**
- * Sets the protocol to be used for reports
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aInterface The current interface being used by the driver
- * @param aProtocol The required protocol (boot or report)
- * @parem aDriver Calling driver
- * @return None.
- */
- virtual void SetProtocolL(TInt aConnectionId,
- TUint16 aInterface, TProtocols aProtocol, CHidDriver* aDriver) = 0;
-
- /**
- * Sets the idle interval for interrupt data.
- * Leaves whit KErrInUse The request was not successful because the transport
- * layer is busy with previous request and KErrNotReady The request failed
- * because the device is currently unavailable
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aDuration The idle interval, in steps of 0.04ms intervals (where
- * 1 = 0.04ms, 2=0.08ms). 0 will disable idle so reports
- * are only sent when the state of the device changes
- * @param aInterface The current interface being used by the driver
- * @param aReportId The report whose idle rate is being set
- * @param aInterface The current interface being used by the driver
- * @parem aDriver Calling driver
- * @return None.
- */
- virtual void SetIdleL(TInt aConnectionId, TUint8 aDuration,
- TUint8 aReportId, TUint16 aInterface, CHidDriver* aDriver) = 0;
-
-
- /**
- * Sends a report to the device
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aReportId The report to receive the setup report
- * @param aReportType The type of report being sent to the device (input, output
- * or Feature)
- * @param aPayload The report being sent to the device
- * @parem aDriver Calling driver
- * @param aInterface The current interface being used by the driver
- * @return KErrNone The request was successful and the result of the command is
- * expected at a later time (as a CmdAck message), KErrInUse The request
- * was not successful because the transport layer is busy with a previous
- * request, KErrNotReady The request failed because the device is currently
- * unavailable and KErrNoMemory The request failed because not enough memory
- * available
- */
- virtual void SetReportL(TInt aConnectionId, TUint8 aReportId,
- TReportType aReportType, const TDesC8& aPayload,
- TUint16 aInterface, CHidDriver* aDriver) = 0;
-
- /**
- * Sends a report to the device (from host) using Interrupt Channel as DATA
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @param aReportId The report to receive the setup report
- * @param aPayload The report being sent to the device
- * @param aInterface The current interface being used by the driver
- * @return KErrNone The request was successful and the result of the
- * command is expected at a later time (as a CmdAck message),
- * KErrInUse The request was not successful because the transport layer is
- * busy with a previous request, KErrNotReady The request failed because the
- * device is currently unavailable and KErrNoMemory The request failed because
- * not enough memory available
- */
- virtual void DataOutL(TInt aConnectionId, TUint8 aReportId,
- /*TReportType aReportType,*/ const TDesC8& aPayload,
- TUint16 aInterface) = 0;
-
- /**
- * A request for the parsed descriptor container object so the driver can
- * retrieve the report format(s)
- *
- * @since S60 v5.0
- * @param aConnectionId The device ID
- * @return A pointer to the parsed report descriptor container and
- * NULL if no parsed report descriptor container exists
- */
- virtual CReportRoot* ReportDescriptor(TInt aConnectionId) = 0;
- };
-
-
-/**
- *
- * Hid transport interface
- * Interface allowing the transport layer to pass data to the Generic HID
- *
- * @since S60 v5.0
- */
-class CHidTransport : public CBase
- {
-public:
- /**
- * Defines the channel type for the DataIn function
- */
- enum THidChannelType
- {
- EHidChannelInt, /*!< Interrupt channel */
- EHidChannelCtrl /*!< Control channel */
- };
-
- /**
- *Driver state (active or suspended)
- */
- enum TDriverState
- {
- EActive, /*!< Driver will handle interrupt data */
- ESuspend /*!< the driver will not handle interrupt data */
- };
-
-public:
-
- /**
- * Called when a device has connected
- *
- * @since S60 v5.0
- * @param aConnectionId The transport-layer enumeration for the connection
- * @param aDescriptor The report descriptor for the device
- * @return KErrNone The connection will be handled by one or more drivers,
- * KErrHidNoDriver No driver was found to handle the connected device
- */
- virtual TInt ConnectedL(TInt aConnectionId, const TDesC8& aDescriptor) = 0;
-
- /**
- * Called when a device has been disconnected
- *
- * @since S60 v5.0
- * @param aConnectionId The transport-layer enumeration for the connection
- * @param aDescriptor The report descriptor for the device
- * @return KErrNone The device was recognised and its drivers were unloaded and
- * KErrHidNoDriver No driver was found to handle the connected device
- */
- virtual TInt Disconnected(TInt aConnectionId) = 0;
-
- /**
- * Called when a device has been disconnected
- *
- * @since S60 v5.0
- * @param aConnectionId Transport layer connection enumeration
- * @param aChannel Channel ID (Interrupt or Control)
- * @param aPayload The complete report payload
- * @return KErrNone The payload was handled by one or more drivers,
- * KErrHidNoDriver No driver is handling reports from the device
- * and KErrHidSuspended The report was not handled because all the drivers
- * handling the device are suspended
- */
- virtual TInt DataIn(TInt aConnectionId,
- THidChannelType aChannel, const TDesC8& aPayload) = 0;
-
- /**
- * Suspends or Resumes the driver(s) handling the connection
- *
- * @since S60 v5.0
- * @param aConnectionId Transport layer connection enumeration
- * @param aActive The requested state of the driver (active or suspended)
- * @return KErrNone The driver was successfully put into the requested state,
- * and KErrHidAlreadyInState All the drivers were already in the
- * requested state
- */
- virtual TInt DriverActive(TInt aConnectionId,
- CHidTransport::TDriverState aActive) = 0;
-
- /**
- * Called by the transport layers to inform the generic HID of the
- * success of the last Set... command.
- *
- * @since S60 v5.0
- * @param aConnectionId Transport layer connection enumeration
- * @param aCmdAck Status of the last Set... command
- * @return None.
- */
- virtual void CommandResult(TInt aConnectionId, TInt aCmdAck) = 0;
- };
-
-/**
- *
- * Driver plugin interface
- * Interface allowing drivers to request data from and send data to devices via
- * the Generic HID layer.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CHidDriver : public CBase
- {
-public:
-
-
- /**
- * Two-phased constructor.
- * @param aImplementationUid Implementation UID of the plugin to be
- * created.
- * @param aHid Driver acces interface
- */
- IMPORT_C static CHidDriver* NewL(
- const TUid aImplementationUid,
- MDriverAccess* aHid );
-
- /**
- * Destructor
- */
- IMPORT_C virtual ~CHidDriver();
-
- /**
- * Called by the Generic HID to see if the factory can use reports described by
- * the parsed report descriptor
- * NOTE: The current implementation supports just one driver and that driver
- * that will either handle all the reports from the device or none at all.
- * Report ID is not currently being taken into account.
- *
- * @since S60 v5.0
- * @param aReportDescriptor Parsed HID report descriptor
- * @return KErrNone The driver will handle reports from the report descriptor and
- * KErrHidUnrecognised The driver cannot handle reports from the device
- */
- virtual TInt CanHandleReportL(CReportRoot* aReportDescriptor) = 0;
-
- /**
- * Called by the Generic HID layer when a device has sent a report on the
- * interrupt or control channel
- *
- * @since S60 v5.0
- * @param aChannel Channel ID (Interrupt or Control)
- * @param aPayload The complete report payload
- * @return Error if data can't be handled.
- */
- virtual TInt DataIn(CHidTransport::THidChannelType aChannel,
- const TDesC8& aPayload) = 0;
-
- /**
- * Called by the Generic HID layer when the handled device has been disconnected
- * interrupt or control channel
- *
- * @since S60 v5.0
- * @param aReason Disconnection code
- * @return None.
- */
- virtual void Disconnected(TInt aReason) = 0;
-
- /**
- * Called after a driver is sucessfully created by the Generic HID,
- * when a device is connected.
- *
- * @since S60 v5.0
- * @param aConnectionId An number used to identify the device in
- * subsequent calls from the driver to the generic HID, for example
- * when sending data to the device.
- * @return None.
- */
- virtual void InitialiseL(TInt aConnectionId) = 0;
-
- /**
- * Enables the driver so that it will configure the device and
- * start handling interrupt reports from the device
- *
- * @since S60 v5.0
- * @param aConnectionId A number used to identify the device in
- * subsequent calls from the driver to the Generic HID, for example
- * when sending data to the device.
- * @return None.
- */
- virtual void StartL(TInt aConnectionId) = 0;
-
- /**
- * Disables the driver so that it will stop handling device
- * interrupt reports
- *
- * @since S60 v5.0
- * @return None.
- */
- virtual void Stop() = 0;
-
- /**
- * Called by the transport layers to inform the generic HID of
- * the success of the last Set... command.
- *
- * @since S60 v5.0
- * @param aCmdAck Status of the last Set... command
- * @return None.
- */
- virtual void CommandResult(TInt aCmdAck) = 0;
-
- /**
- * Return count of supported fields
- *
- * @since S60 v5.0
- * @return Number of supported fields.
- */
- virtual TInt SupportedFieldCount()= 0;
-
-
- /**
- * Set input handling registy
- *
- * @since S60 v5.0
- * @param aHandlingReg a Input handling registry
- * @return Number of supported fields.
- */
- virtual void SetInputHandlingReg(CHidInputDataHandlingReg* aHandlingReg) = 0;
-
- protected:
- /**
- * C++ constructor.
- */
- IMPORT_C CHidDriver();
-
- private: // Data
-
- /**
- * ECOM plugin instance UID.
- */
- TUid iDtor_ID_Key;
- };
-
-#endif
-
-
--- a/remoteconn_plat/generic_hid_api/inc/hidreportroot.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,274 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Declares hid report class
-*
-*/
-
-
-#ifndef C_HIDREPORTROOT_H
-#define C_HIDREPORTROOT_H
-
-#include <e32base.h>
-
-#include "hidfield.h"
-#include "hidcollection.h"
-
-#include "hidvalues.h"
-
-class CReportRoot;
-
-
-
-/**
- * Hid field finder class
- * The MHidFieldFinder class defines the call-back interface used by
- * THidFieldSearch. A device driver uses THidFieldSearch::SearchL()
- * along with a custom MHidFieldFinder object to determine whether it
- * is compatible with a given report descriptor.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class MHidFieldFinder
- {
-public:
-
- /**
- * Called by THidFieldSearch::SearchL() during traversal of the
- * report descriptor tree when a CCollection is encountered. It
- * will be called once, and only once, for every CCollection in the
- * descriptor. It is not called for the root collection
- * (the CReportRoot).
- *
- * @since S60 v5.0
- * @param aCollection A pointer to the collection object.
- * @return ETrue if the contents of this collection (any child CField
- * or CCollection objects) should be examined. A driver would return
- * EFalse if a collection was not of a compatible type, for
- * example if the usage page was inappropriate.
- */
- virtual TBool BeginCollection(const CCollection *aCollection) = 0;
-
- /**
- * Called by THidFieldSearch::SearchL() during traversal of the
- * report descriptor tree when all CFields and child CCollections
- * of a CCollection have been examined. It will be called once,
- * and only once, for every CCollection in the descriptor. It is
- * not called for the root collection (the CReportRoot).
- *
- * @since S60 v5.0
- * @param aCollection A pointer to the collection object.
- * @return ETrue if the search (tree traversal) should
- * continue. A driver returns EFalse if it has finished examining
- * the whole descriptor, in general this will be if it has
- * established that it is compatible with the report descriptor.
- */
- virtual TBool EndCollection(const CCollection *aCollection) = 0;
-
- /**
- * Called once for each CField in a CCollection by
- * THidFieldSearch::SearchL() during the traversal of a report
- * descriptor tree.
- *
- * @since S60 v5.0
- * @param aField The pointer to field
- * @return None.
- */
- virtual void Field(const CField* aField) = 0;
- };
-
-
-/**
- * Report Size
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class TReportSize
- {
-public:
-
- /**
- * Constructor.
- *
- * @since S60 v5.0
- * @param aReportId The report id
- * @param aType Field type
- * @return Pointer to report size object
- */
- TReportSize(TInt aReportId, CField::TType aType);
-
-
- /**
- * TReportSize comparision
- *
- * @since S60 v5.0
- * @param aFirst first report size to be compared.
- * @param aSecond second report size to be compared
- * @return None
- */
- static TBool Match(const TReportSize& aFirst,
- const TReportSize& aSecond);
-
- /**
- * Report id
- */
- TInt iReportId;
-
- /**
- * Fiel type
- */
- CField::TType iType;
-
- /**
- * Report size
- */
- TInt iSize;
- };
-
-
-/**
- * Hid field search
- * THidFieldSearch provides a mechanism for traversing a parsed report
- * descriptor tree (a CReportRoot object). It is intended for a device
- * driver to use when it is looking to see if it is compatible with a
- * newly connected device, i.e. provides the appropriate types of
- * report. The driver must provide an object of a class that implements
- * the MHidFieldFinder interface.
- *
- * @since S60 v5.0
- */
-class THidFieldSearch
- {
-public:
-
- /**
- * Traverse a parsed report descriptor (a tree of CCollections
- * and CFields) calling the MHidFieldFinder member functions as
- * appropriate.
- *
- * @since S60 v5.0
- * @param aReportRoot THe pointer to field
- * @param aFinder An object that will establish if the report
- * descriptor is suitable.
- * @return None.
- */
- IMPORT_C void SearchL(const CReportRoot* aReportRoot,
- MHidFieldFinder* aFinder);
-
-private:
-
- /**
- * Traverse a parsed report descriptor (a tree of CCollections
- * and CFields) calling the MHidFieldFinder member functions as
- * appropriate.
- *
- * @since S60 v5.0
- * @param aReportRoot THe pointer to field
- * @return ETrue when search is done.
- */
- TBool DoSearchL(const CCollection* aCollection);
-
-private:
- MHidFieldFinder* iFinder;
- };
-
-/**
- * Root report
- * The top level of the tree of fields and collections in a HID
- * report descriptor.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class CReportRoot : public CCollection
- {
-public:
- static CReportRoot* NewLC();
- static CReportRoot* NewL();
-
- /**
- * Destructor
- */
- virtual ~CReportRoot();
-
- /**
- * Increase the size of a given report by a given number of bits
- *
- * @since S60 v5.0
- * @param aReportId The report id, which size shoud be increased
- * @param aType a Type of field
- * @param aIncrement size of increase
- * @return None
- */
- void IncrementReportSizeL(TInt aReportId,
- CField::TType aType, TInt aIncrement);
-
- /**
- * Get the size of a given report in bits
- *
- * @since S60 v5.0
- * @param aReportId The report id, which size shoud be increased
- * @param aType a Type of field
- * @return Size of report in bits
- */
- TInt ReportSize(TInt aReportId, CField::TType aType) const;
-
- /**
- * Get the size of a given report in bytes
- *
- * @since S60 v5.0
- * @param aReportId The report id, which size shoud be increased
- * @param aType a Type of field
- * @return Size of report in bytys
- */
- IMPORT_C TInt ReportSizeBytes(TInt aReportId, CField::TType aType) const;
-
- /**
- * Get the number of reports
- *
- * @since S60 v5.0
- * @return number of reports
- */
- TInt NumberOfReports() const;
-
- /**
- * Get the size of a given report by array index, rather than type & ID
- *
- * @since S60 v5.0
- * @param aIndex report index
- * @return report size
- */
- TInt ReportSize(TInt aIndex) const;
-
-private:
- CReportRoot();
-
- /**
- * Find report index
- *
- * @since S60 v5.0
- * @param aReportId The report id to be found
- * @param aType a Type of field
- * @return report size
- */
- TInt FindReportSizeIndex(TInt aReportId, CField::TType aType) const;
-
- /**
- * Array to store the size of each report
- */
- RArray<TReportSize> iSizes;
- };
-
-#endif
--- a/remoteconn_plat/generic_hid_api/inc/hidtranslate.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
-* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Report translator
-*
-*/
-
-#ifndef T_TRANSLATE_H
-#define T_TRANSLATE_H
-
-#include <e32std.h>
-
-class CField;
-
-/**
- * HID report base object
- *
- * Base class for report translator and report generator.
- * Contains only static functions.
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class TReportUtils
- {
-public:
- /**
- * Find the index within the usages for a field of a given usage ID.
- *
- * @since S60 v5.0
- * @param aField Pointer to the field.
- * @param aUsageId Usage ID to find.
- * @param aUsageIndex Reference to variable to receive the index.
- * @return True if the usage ID is found.
- */
- static TBool GetIndexOfUsage(const CField* aField,
- TInt aUsageId, TInt& aUsageIndex);
- /**
- * Find the usage ID at a given index within the usages for a field.
- *
- * @since S60 v5.0
- * @param aField Pointer to the field.
- * @param aUsageIndex The index.
- * @return The usage ID at the given index.
- */
- static TInt UsageAtIndex(const CField* aField, TInt aUsageIndex);
-
- /**
- * Write a value to a field at a given index.
- *
- * @since S60 v5.0
- * @param aData Buffer containing the HID report.
- * @param aField The field in which to write.
- * @param aIndex Position in the field to write.
- * @param aValue Value to write to the field.
- * @return Error code indicating success or reason for failure.
- */
- static TInt WriteData(HBufC8& aData, const CField* aField,
- TInt aIndex, TInt aValue);
-
- /**
- * Read a value from a field at a given index.
- *
- * @since S60 v5.0
- * @param aData Buffer containing the HID report.
- * @param aField The field from which to read.
- * @param aIndex Position in the field to read.
- * @param aValue Reference to variable to receive the value read
- * from the field.
- * @return Error code indicating success or reason for failure.
- */
- static TInt ReadData(const TDesC8& aData, const CField* aField,
- TInt aIndex, TInt& aValue);
- };
-
-/**
- * HID report translator
- *
- * Allows a device driver to extract data items from a device report, based on
- * the results of the report descriptor parser stage (at device connection)
- *
- * @lib generichid.lib
- * @since S60 v5.0
- */
-class TReportTranslator
- {
-public:
-
- /**
- * Constructor.
- *
- * @since S60 v5.0
- * @param aData Data to be extracted
- * @param aField HID field
- * @return return TReportTranslator
- */
- IMPORT_C TReportTranslator(const TDesC8& aData, const CField* aField);
-
- /**
- * For variable fields, reads the logical value of the control with the
- * given usage ID. For arrays, searches for the usage ID and gives the
- * value as ETrue if found and EFalse if not.
- *
- * @since S60 v5.0
- * @param aValue Reference to variable to receive the value read
- * from the field.
- * @param aUsageId Usage ID of the control to read.
- * @param aControlOffset Which control to read when more than one
- * have the same usage ID.
- * @return Error code indicating success or reason for failure.
- */
- IMPORT_C TInt GetValue(TInt& aValue, TInt aUsageId,
- TInt aControlOffset = 0) const;
-
- /**
- * Alternate version of the above method for convenience. Returns the
- * value read directly and leaves if an error occurs.
- *
- * @since S60 v5.0
- * @param aUsageId Usage ID of the control to read.
- * @param aControlOffset Which control to read when more than one
- * have the same usage ID.
- * @return The logical value of a variable, or true/false for an array.
- */
- IMPORT_C TInt ValueL(TInt aUsageId, TInt aControlOffset = 0) const;
-
- /**
- * Gets the usage ID at a given index in an array field. For variable
- * fields, if the logical value of the control at the given index is non-
- * zero, returns the usage ID of the control, otherwise returns zero.
- *
- * @since S60 v5.0
- * @param aUsageId Reference to variable to receive the usage ID.
- * @param aIndex Index in the array to read.
- * @return Error code indicating success or reason for failure.
- */
- IMPORT_C TInt GetUsageId(TInt& aUsageId, TInt aIndex) const;
-
- /**
- * Alternate version of the above method for convenience. Returns the
- * usage ID directly and leaves if an error occurs.
- *
- * @since S60 v5.0
- * @param aIndex Index in the array to read.
- * @return The usage ID.
- */
- IMPORT_C TInt UsageIdL(TInt aIndex) const;
-
- /**
- * Gets the logical value at a given index in a field. Leaves if an
- * error occurs.
- *
- * @since S60 v5.0
- * @param aIndex Index in the field to read.
- * @return The logical value.
- */
- IMPORT_C TInt RawValueL(TInt aIndex) const;
-
- /**
- * Gets the number of controls in the field.
- *
- * @since S60 v5.0
- * @return The number of controls.
- */
- IMPORT_C TInt Count() const;
-
-private:
-
- /**
- * Data to be extracted
- */
- const TDesC8& iData;
-
- /**
- * HID field
- * Not own.
- */
- const CField* iField;
- };
-
-#endif
--- a/remoteconn_plat/generic_hid_api/inc/hidvalues.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
-* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: HID related enums
-*
-*/
-
-
-#ifndef HIDVALUES_H
-#define HIDVALUES_H
-
-#include <e32std.h>
-
-/**
- * Constants as defined in "USB HID Usage Tables", Version 1.11, USB
- * Implementers' Forum, June 2001. Used throughout for parsing report
- * descriptors and interpreting reports.
- */
-
-/**
- * HID usage page ID values, as given in the document "USB HID Usage
- * Tables", Version 1.11, USB Implementers' Forum, June 2001
- */
-enum THidUsagePages
- {
- EUsagePageUndefined = 0x00,
- EUsagePageGenericDesktop = 0x01,
- EUsagePageSimulationControls = 0x02,
- EUsagePageVRControls = 0x03,
- EUsagePageSportControls = 0x04,
- EUsagePageGameControls = 0x05,
- EUsagePageGenericDeviceControls = 0x06,
- EUsagePageKeyboard = 0x07,
- EUsagePageLEDs = 0x08,
- EUsagePageButton = 0x09,
- EUsagePageOrdinal = 0x0A,
- EUsagePageTelephony = 0x0B,
- EUsagePageConsumer = 0x0C,
- EUsagePageDigitizer = 0x0D,
- EUsagePagePIDPage = 0x0F,
- EUsagePageUnicode = 0x10,
- EUsagePageAlphanumericDisplay = 0x14,
- EUsagePageMedicalInstruments = 0x40,
- EUsagePageMonitorMin = 0x80,
- EUsagePageMonitorMax = 0x83,
- EUsagePagePowerMin = 0x84,
- EUsagePagePowerMax = 0x87,
- EUsagePageBarCodeScanner = 0x8C,
- EUsagePageScale = 0x8D,
- EUsagePageMagStripe = 0x8E,
- EUsagePagePOS = 0x8F,
- EUsagePageCameraControl = 0x90,
- EUsagePageArcade = 0x91,
- EUsagePageVendorSpecific = 0xFF01
- };
-
-/**
- * HID usage ID values for the Generic Desktop usage page, as given in
- * the document "USB HID Usage Tables", Version 1.11, USB Implementers'
- * Forum, June 2001
- */
-enum THidGenericDesktopUsages
- {
- EGenericDesktopUsagePointer = 0x01,
- EGenericDesktopUsageMouse = 0x02,
- EGenericDesktopUsageJoystick = 0x04,
- EGenericDesktopUsagePad = 0x05,
- EGenericDesktopUsageKeyboard = 0x06,
- EGenericDesktopUsageKeypad = 0x07,
- EGenericDesktopUsageMultiAxisCtrl = 0x08,
- EGenericDesktopUsageX = 0x30,
- EGenericDesktopUsageY = 0x31,
- EGenericDesktopUsageZ = 0x32,
- EGenericDesktopUsageRx = 0x33,
- EGenericDesktopUsageRy = 0x34,
- EGenericDesktopUsageRz = 0x35,
- EGenericDesktopUsageSlider = 0x36,
- EGenericDesktopUsageDial = 0x37,
- EGenericDesktopUsageWheel = 0x38,
- EGenericDesktopUsageHatSwitch = 0x39,
- EGenericDesktopUsageCountedBuffer = 0x3A,
- EGenericDesktopUsageByteCount = 0x3B,
- EGenericDesktopUsageMotionWakeup = 0x3C,
- EGenericDesktopUsageStart = 0x3D,
- EGenericDesktopUsageSelect = 0x3E
- };
-
-enum THidTelephonyUsages
- {
- ETelephonyUsageHookSwitch = 0x20,
- ETelephonyUsagePhoneMute = 0x2F,
- ETelephonyUsagePoC = 0x33
- };
-
-enum THidConsumerUsages
- {
- EConsumerUsagePlay = 0xB0,
- EConsumerUsageFastForward = 0xB3,
- EConsumerUsageRewind = 0xB4,
- EConsumerUsageScanNext = 0xB5,
- EConsumerUsageScanPrev = 0xB6,
- EConsumerUsageStop = 0xB7,
- EConsumerUsageRandomPlay = 0xB9,
- EConsumerUsagePlayPause = 0xCD,
- EConsumerUsageVolumeInc = 0xE9,
- EConsumerUsageVolumeDec = 0xEA,
- EConsumerUsageMute = 0xE2
- };
-
-enum THidVendorSpecificUsages
- {
- EVendorSpecificUsagePoC = 0x01,
- EVendorSpecificUsageHeadplugDetection = 0x02
- };
-// ----------------------------------------------------------------------
-
-#endif
--- a/remoteconn_plat/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ b/remoteconn_plat/group/bld.inf Wed Sep 01 12:20:56 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -17,10 +17,3 @@
*/
-
-#include "../dialup_connection_status_api/group/bld.inf"
-#include "../dun_secondary_display_notification_api/group/bld.inf"
-#include "../generic_hid_api/group/bld.inf"
-#include "../locod_bearer_plugin_api/group/bld.inf"
-#include "../locod_service_plugin_api/group/bld.inf"
-
--- a/remoteconn_plat/locod_bearer_plugin_api/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File that exports the files belonging to
-: Locod bearer API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/locodplugin.hrh MW_LAYER_PLATFORM_EXPORT_PATH(locodplugin.hrh)
-../inc/locodbearer.h MW_LAYER_PLATFORM_EXPORT_PATH(locodbearer.h)
-../inc/locodbearerplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(locodbearerplugin.h)
-../inc/locodbearerplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(locodbearerplugin.inl)
-../inc/locodbearerpluginobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(locodbearerpluginobserver.h)
-../inc/locodbearerpluginparams.h MW_LAYER_PLATFORM_EXPORT_PATH(locodbearerpluginparams.h)
-../inc/locodbearerpluginparams.inl MW_LAYER_PLATFORM_EXPORT_PATH(locodbearerpluginparams.inl)
--- a/remoteconn_plat/locod_bearer_plugin_api/group/locod_bearer_plugin_api.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component locod_bearer_plugin_api
-
-source \sf\mw\remoteconn\localconnectivityservice\locod_bearer_plugin_api
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearer.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Defines the LCD Bearer Plugin identifier.
-*
-*/
-
-
-#ifndef T_LOCODBEARER_H
-#define T_LOCODBEARER_H
-
-#include <e32base.h>
-
-/** bearer value in LC */
-enum TLocodBearer
- {
- ELocodBearerBT = 0x0001,
- ELocodBearerIR = 0x0010,
- ELocodBearerUSB = 0x0100,
- };
-
-#endif // T_LOCODBEARER_H
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerplugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin base class declaration.
-*
-*/
-
-
-#ifndef C_LOCODBEARERPLUGIN_H
-#define C_LOCODBEARERPLUGIN_H
-
-#include <e32base.h>
-#include "locodbearerpluginparams.h"
-
-/**
- * Bearer Plugin base class
- *
- * This is the base class from which bearer plugins inherit.
- *
- * See locodplugin.hrh for the resource registration definitions.
- *
- * @lib euser.lib
- * @since S60 v3.2
- */
-class CLocodBearerPlugin : public CBase
- {
-public:
-
- static CLocodBearerPlugin* NewL(TLocodBearerPluginParams& aParams);
-
- virtual ~CLocodBearerPlugin();
-
- /**
- * Gets the implementation uid of this plugin
- *
- * @since S60 v3.2
- * @return The implementation uid
- */
- TUid ImplementationUid() const;
-
-protected:
-
- CLocodBearerPlugin(TLocodBearerPluginParams& aParams);
-
- /**
- * Gets the observer interface object associated with this plugin
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodBearerPluginObserver& Observer() const;
-
-private: // data
-
- /**
- * UID set by ECOM when the instance is created. Used when the instance
- * is destroyed.
- */
- TUid iInstanceUid;
-
- /**
- * Implementation UID of the concrete instance.
- */
- TUid iImplementationUid;
-
- /**
- * Holds the observer object which will be notified when the operations
- * complete
- * Not own.
- */
- MLocodBearerPluginObserver& iObserver;
-
- };
-
-#include "locodbearerplugin.inl"
-
-#endif // C_LOCODBEARERPLUGIN_H
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerplugin.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-#include <ecom.h>
-
-// -----------------------------------------------------------------------------
-// Creates the bearer plug ins and return it to caller
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin* CLocodBearerPlugin::NewL(TLocodBearerPluginParams& aParams)
- {
- CLocodBearerPlugin* self = reinterpret_cast<CLocodBearerPlugin*>(
- REComSession::CreateImplementationL(
- aParams.ImplementationUid(),
- _FOFF(CLocodBearerPlugin, iInstanceUid),
- (TAny*)&aParams)
- );
-
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin::~CLocodBearerPlugin()
- {
- REComSession::DestroyedImplementation(iInstanceUid);
- }
-
-// -----------------------------------------------------------------------------
-// Return the implemtation uid
-// -----------------------------------------------------------------------------
-//
-inline TUid CLocodBearerPlugin::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline CLocodBearerPlugin::CLocodBearerPlugin(TLocodBearerPluginParams& aParams)
- : iImplementationUid(aParams.ImplementationUid()),
- iObserver(aParams.Observer())
- {
- }
-
-// -----------------------------------------------------------------------------
-// Return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodBearerPluginObserver& CLocodBearerPlugin::Observer() const
- {
- return iObserver;
- }
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginobserver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin observer interface definition.
-*
-*/
-
-
-#ifndef M_LOCODBEARERPLUGINOBSERVER_H
-#define M_LOCODBEARERPLUGINOBSERVER_H
-
-#include "locodbearer.h"
-
-/**
- * LCD Bearer Plugin Observer interface class
- *
- * This is the bearer plugin observer interface definition used by LCD
- * Bearer Plugins to inform the daemon about the plugin's event.
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class MLocodBearerPluginObserver
- {
-public:
-
- /**
- * This is a callback function used by the plugins to inform when the
- * bearer's availability changes.
- *
- * @since S60 v3.2
- * @param aBearer the bearer which calls this nothification
- * @param aStatus the status of this bearer, ETrue if it is available;
- * EFalse otherwise.
- */
- virtual void NotifyBearerStatus(TLocodBearer aBearer, TBool aStatus) = 0;
- };
-
-#endif // M_LOCODBEARERPLUGINOBSERVER_H
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginparams.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-#ifndef T_LOCODBEARERPLUGINPARAMS_H
-#define T_LOCODBEARERPLUGINPARAMS_H
-
-class MLocodBearerPluginObserver;
-
-/**
- * LCD Bearer Plugin Callback construction parameters
- *
- * This interface class is used to pass construction parameters to the
- * plugins. These parameters include the callback interface and the ECOM
- * plugin implementation UID
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class TLocodBearerPluginParams
- {
-public:
-
- /**
- * Constructor.
- *
- * @since S60 v3.2
- * @param aUid Implementation UID of the plugin being constructed
- * @param aObserver Callback interface object
- */
- TLocodBearerPluginParams(const TUid aUid, MLocodBearerPluginObserver& aObserver);
-
- /**
- * Gets the implementation UID of the plugin
- *
- * @since S60 v3.2
- * @return Implementaion UID
- */
- TUid ImplementationUid() const;
-
- /**
- * Gets the observer interface object
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodBearerPluginObserver& Observer() const;
-
-private: // data
-
- /**
- * The implementation UID
- */
- const TUid iImplementationUid;
-
- /**
- * Reference to the observer object
- */
- MLocodBearerPluginObserver& iObserver;
-
- };
-
-#include "locodbearerpluginparams.inl"
-
-#endif // T_LOCODBEARERPLUGINPARAMS_H
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginparams.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Bearer Plugin construction parameters
-* declaration
-*
-*/
-
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline TLocodBearerPluginParams::TLocodBearerPluginParams(const TUid aUid, MLocodBearerPluginObserver& aObserver)
- : iImplementationUid(aUid),
- iObserver(aObserver)
- {
- }
-
-// -----------------------------------------------------------------------------
-// returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid TLocodBearerPluginParams::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// returns the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodBearerPluginObserver& TLocodBearerPluginParams::Observer() const
- {
- return iObserver;
- }
--- a/remoteconn_plat/locod_bearer_plugin_api/inc/locodplugin.hrh Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Definitions for plugin resource registration.
-*
-*/
-
-
-#ifndef LOCODPLUGIN_HRH
-#define LOCODPLUGIN_HRH
-
-/**
- * This file contains the defintions for plugin resource registration.
- *
- * All plugins should use version 2 registration resource file and set the
- * rom_only field to 1 to prevent it from being overridden by RAM-based plugins.
- *
- * All bearer plugins should use KLOCODBEARERINTERFACEUID as the interface UID.
- *
- * A bearer plugin should use its corresponding feature ID (from features.hrh) as the
- * implementation UID, that is,
- * Implementation UID of IR bearer is KFeatureIdIrda,
- * Implementation UID of BT bearer is KFeatureIdBt,
- * Implementation UID of USB bearer is KFeatureIdUsb.
- *
- * All service plugins should use KLOCODSERVICEINTERFACEUID as the interface UID.
- *
- * A service plugin should use its corresponding feature ID (from features.hrh) as the
- * implementation UID, that is,
- * Implementation UID of Dun is KFeatureIdDun, (not exist yet, CR created)
- * Implementation UID of Obex is KFeatureIdSrcs,
- *
- */
-
-// Interface UID of bearer plugins
-#define KLOCODBEARERINTERFACEUID 0x20002771
-
-// Interface UID of service plugins
-#define KLOCODSERVICEINTERFACEUID 0x20002772
-
-#endif // LOCODPLUGIN_HRH
--- a/remoteconn_plat/locod_service_plugin_api/group/bld.inf Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: File that exports the files belonging to
-: Locod bearer API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/locodserviceplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(locodserviceplugin.h)
-../inc/locodserviceplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(locodserviceplugin.inl)
-../inc/locodservicepluginobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(locodservicepluginobserver.h)
-../inc/locodservicepluginparams.h MW_LAYER_PLATFORM_EXPORT_PATH(locodservicepluginparams.h)
-../inc/locodservicepluginparams.inl MW_LAYER_PLATFORM_EXPORT_PATH(locodservicepluginparams.inl)
--- a/remoteconn_plat/locod_service_plugin_api/group/locod_service_plugin_api.mrp Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-component locod_service_plugin_api
-
-source \sf\mw\remoteconn\localconnectivityservice\locod_service_plugin_api
-
-notes_source \component_defs\release.src
-
-ipr E
-
-
--- a/remoteconn_plat/locod_service_plugin_api/inc/locodserviceplugin.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin base class declaration.
-*
-*/
-
-
-#ifndef C_LOCODSERVICEPLUGIN_H
-#define C_LOCODSERVICEPLUGIN_H
-
-#include <e32base.h>
-
-#include "locodservicepluginparams.h"
-#include "locodbearer.h"
-
-/**
- * Service Plugin base class
- *
- * This is the base class from which service plugins inherit.
- *
- * When a service plugin is constructed, it should not start any service by default.
- * A service is started on demand when the bearer is available.
- *
- * @euser.lib
- * @since S60 v3.2
- */
-class CLocodServicePlugin : public CBase
- {
-public:
-
- static CLocodServicePlugin* NewL(TLocodServicePluginParams& aParams);
-
- virtual ~CLocodServicePlugin();
-
- /**
- * Tell service plugin which service should be enabled or disabled according to
- * specified bearer and its status.
- *
- * On completion, the plugin should call
- * MLocodServicePluginObserver::ManageServiceCompleted() to inform the result.
- *
- * @since S60 v3.2
- * @param aBearer the bearer identification
- * @param aStatus the status of this bearer, ETrue if it is available;
- * EFalse otherwise.
- */
- virtual void ManageService(TLocodBearer aBearer, TBool aStatus) = 0;
-
- TUid ImplementationUid() const;
-
-protected:
-
- CLocodServicePlugin(TLocodServicePluginParams& aParams);
-
- /**
- * Gets the observer interface object associated with this plugin
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodServicePluginObserver& Observer() const;
-
-private: // data
-
- /**
- * UID set by ECOM when the instance is created. Used when the instance
- * is destroyed.
- */
- TUid iInstanceUid;
-
- /**
- * Implementation UID of the concrete instance.
- */
- const TUid iImplementationUid;
-
- /**
- * Holds the observer object which will be notified when the operations
- * complete
- * Not own.
- */
- MLocodServicePluginObserver& iObserver;
-
- };
-
-#include <locodserviceplugin.inl>
-
-#endif // C_LOCODSERVICEPLUGIN_H
--- a/remoteconn_plat/locod_service_plugin_api/inc/locodserviceplugin.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-#include <ecom.h>
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin* CLocodServicePlugin::NewL(TLocodServicePluginParams& aParams)
- {
- CLocodServicePlugin* self = reinterpret_cast<CLocodServicePlugin*>(
- REComSession::CreateImplementationL(
- aParams.ImplementationUid(),
- _FOFF(CLocodServicePlugin, iInstanceUid),
- (TAny*)&aParams)
- );
-
- return self;
- }
-
-
-// -----------------------------------------------------------------------------
-// Service plug ins destructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin::~CLocodServicePlugin()
- {
- REComSession::DestroyedImplementation(iInstanceUid);
- }
-
-// -----------------------------------------------------------------------------
-// returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid CLocodServicePlugin::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// CLocodServicePlugin C++ constructor
-// -----------------------------------------------------------------------------
-//
-inline CLocodServicePlugin::CLocodServicePlugin(TLocodServicePluginParams& aParams)
- : iImplementationUid(aParams.ImplementationUid()),
- iObserver(aParams.Observer())
- {
- }
-
-// -----------------------------------------------------------------------------
-// return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodServicePluginObserver& CLocodServicePlugin::Observer() const
- {
- return iObserver;
- }
-
--- a/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginobserver.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin observer interface definition.
-*
-*/
-
-
-#ifndef M_LOCODSERVICEPLUGINOBSERVER_H
-#define M_LOCODSERVICEPLUGINOBSERVER_H
-
-#include "locodbearer.h"
-
-/**
- * LCD Service Plugin Observer interface class
- *
- * This is the service plugin observer interface definition used by LCD
- * Service Plugins to inform the daemon when an action is complete.
- *
- * @lib
- * @since S60 v3.2
- */
-class MLocodServicePluginObserver
- {
-public:
-
- /**
- * This is a callback function used by the plugins to inform when
- * managing the service have completed. The parameters passed should be
- * identical to the ones used when the plugin's ManageService() was called,
- * plus this service plugin's implemnetation UID and the completion status.
- *
- * @since S60 v3.2
- * @param aBearer the bearer identification passed in ManageService()
- * @param aStatus the status of this bearer passed in ManageService()
- * @param aServiceImplUid, the implementation UID of this service plugin.
- * @param err KErrNone if the operation succeeded; otherwise a Symbian
- * error code.
- */
- virtual void ManageServiceCompleted(
- TLocodBearer aBearer,
- TBool aStatus,
- TUid aServiceImplUid,
- TInt err) = 0;
- };
-
-#endif // M_LOCODSERVICEPLUGINOBSERVER_H
--- a/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginparams.h Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-#ifndef T_LOCODSERVICEPLUGINPARAMS_H
-#define T_LOCODSERVICEPLUGINPARAMS_H
-
-class MLocodServicePluginObserver;
-
-/**
- * LCD Service Plugin Callback construction parameters
- *
- * This interface class is used to pass construction parameters to the
- * plugins. These parameters include the callback interface (usually
- * implemented by the LCD) and the ECOM plugin implementation UID
- *
- * @lib ?library
- * @since S60 v3.2
- */
-class TLocodServicePluginParams
- {
-public:
- /**
- * Constructor.
- *
- * @since S60 v3.2
- * @param aUid Implementation UID of the plugin being constructed
- * @param aObserver Callback interface object
- */
- TLocodServicePluginParams(TUid aUid, MLocodServicePluginObserver& aObserver);
-
- /**
- * Gets the implementation UID of the plugin
- *
- * @since S60 v3.2
- * @return Implementaion UID
- */
- TUid ImplementationUid() const;
-
- /**
- * Gets the observer interface object
- *
- * @since S60 v3.2
- * @return The observer object
- */
- MLocodServicePluginObserver& Observer() const;
-
-private: // data
-
- /**
- * The implementation UID
- */
- const TUid iImplementationUid;
-
- /**
- * Reference to the observer object
- */
- MLocodServicePluginObserver& iObserver;
-
- };
-
-#include "locodservicepluginparams.inl"
-
-#endif // T_LOCODSERVICEPLUGINPARAMS_H
--- a/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginparams.inl Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This is the LCD Service Plugin construction parameters
-* declaration
-*
-*/
-
-
-// -----------------------------------------------------------------------------
-// Constructor method, just saves the arguments into member variables
-// -----------------------------------------------------------------------------
-//
-inline TLocodServicePluginParams::TLocodServicePluginParams(TUid aUid, MLocodServicePluginObserver& aObserver)
- : iImplementationUid(aUid),
- iObserver(aObserver)
- {
- }
-
-// -----------------------------------------------------------------------------
-// Returns the implementation UID
-// -----------------------------------------------------------------------------
-//
-inline TUid TLocodServicePluginParams::ImplementationUid() const
- {
- return iImplementationUid;
- }
-
-// -----------------------------------------------------------------------------
-// return the observer class
-// -----------------------------------------------------------------------------
-//
-inline MLocodServicePluginObserver& TLocodServicePluginParams::Observer() const
- {
- return iObserver;
- }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd Wed Sep 01 12:20:56 2010 +0100
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+ name CDATA #REQUIRED
+ schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+ name CDATA #REQUIRED
+ levels CDATA #IMPLIED
+ span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+ name CDATA #REQUIRED
+ level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+ unitID ID #REQUIRED
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ bldFile CDATA #REQUIRED
+ priority CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+ name CDATA #REQUIRED
+ mrp CDATA #REQUIRED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+ name CDATA #REQUIRED
+ version CDATA #REQUIRED
+ late (Y|N) #IMPLIED
+ filter CDATA #IMPLIED
+ contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+ name ID #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+ name ID #REQUIRED
+ abldTarget CDATA #REQUIRED
+ description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+ name ID #REQUIRED
+ abldOption CDATA #REQUIRED
+ description CDATA #REQUIRED
+ enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+ name ID #REQUIRED
+ description CDATA #REQUIRED
+ filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+ command CDATA #REQUIRED
+ targetList IDREFS #IMPLIED
+ unitParallel (Y | N | y | n) #REQUIRED
+ targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+ name CDATA #REQUIRED
+ cwd CDATA #REQUIRED
+ command CDATA #REQUIRED>
--- a/sysdef_1_5_1.dtd Tue Aug 31 16:03:15 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
- <!ELEMENT SystemDefinition (systemModel?, build?)>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (logicalset* | module*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- levels CDATA #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalset name CDATA #REQUIRED>
- <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
- <!ATTLIST logicalsubset name CDATA #REQUIRED>
- <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
- <!ATTLIST module
- name CDATA #REQUIRED
- level CDATA #IMPLIED>
- <!ELEMENT component (unit* | package* | prebuilt*)*>
- <!ATTLIST component name CDATA #REQUIRED>
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- unitID ID #REQUIRED
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- bldFile CDATA #REQUIRED
- priority CDATA #IMPLIED
- contract CDATA #IMPLIED
- proFile CDATA #IMPLIED
- qmakeArgs CDATA #IMPLIED>
- <!ELEMENT package EMPTY>
- <!ATTLIST package
- name CDATA #REQUIRED
- mrp CDATA #REQUIRED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT prebuilt EMPTY>
- <!ATTLIST prebuilt
- name CDATA #REQUIRED
- version CDATA #REQUIRED
- late (Y|N) #IMPLIED
- filter CDATA #IMPLIED
- contract CDATA #IMPLIED>
- <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
- <!ELEMENT unitList (unitRef+)>
- <!ATTLIST unitList
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT unitRef EMPTY>
- <!ATTLIST unitRef unit IDREF #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
- <!ELEMENT unitListRef EMPTY>
- <!ATTLIST unitListRef unitList IDREF #REQUIRED>
- <!ELEMENT layerRef EMPTY>
- <!ATTLIST layerRef layerName CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- command CDATA #REQUIRED>