--- a/backupandrestore/backupengine/group/connectivity_securebackupengine.iby Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/group/connectivity_securebackupengine.iby Thu Jul 22 16:43:05 2010 +0100
@@ -21,7 +21,7 @@
file=ABI_DIR\BUILD_DIR\abclient.dll System\libs\abclient.dll
#ifndef SBEHEAPMAX
-#define SBEHEAPMAX 0x400000
+#define SBEHEAPMAX 0x2000000
#endif
file=ABI_DIR\BUILD_DIR\sbengine.exe System\programs\sbengine.exe heapmax=SBEHEAPMAX
--- a/backupandrestore/backupengine/group/sbeclient.mmp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/group/sbeclient.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -25,9 +25,7 @@
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
USERINCLUDE . ../inc
@@ -35,7 +33,8 @@
SOURCE sbheapwrapper.cpp
SOURCE sbeclient.cpp
SOURCE sbeclientsession.cpp
-SOURCE sbtypes.cpp
+SOURCE sbtypes.cpp
+SOURCE sbepanic.cpp
LIBRARY euser.lib estor.lib apgrfx.lib apmime.lib
--- a/backupandrestore/backupengine/group/sbencrypt.mmp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/group/sbencrypt.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -25,15 +25,14 @@
USERINCLUDE .
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
USERINCLUDE . ../inc
SOURCEPATH ../src
SOURCE sbencrypt.cpp
-SOURCE sbencryptimpl.cpp
+SOURCE sbencryptimpl.cpp
+SOURCE sbepanic.cpp
LIBRARY euser.lib
--- a/backupandrestore/backupengine/group/sbengine.mmp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/group/sbengine.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -29,9 +29,8 @@
UID 0 0x10202D56 // Assigned UID
VENDORID 0x70000001
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
+
SOURCEPATH ../src
SOURCE sbtypes.cpp
@@ -51,6 +50,7 @@
SOURCE sbecompressionandencryption.cpp
SOURCE sbeconfig.cpp
SOURCE sbeparserproxy.cpp
+SOURCE sbepanic.cpp
USERINCLUDE . ../inc
@@ -66,12 +66,12 @@
#ifdef __SBE_DISABLE_RELEASE_LOGGING
// Flogger will not be linked do this binary in UREL builds
- DEBUGLIBRARY flogger.lib
+DEBUGLIBRARY flogger.lib
#else
// Flogger always statically linked to this binary.
- LIBRARY flogger.lib
+LIBRARY flogger.lib
#endif
--- a/backupandrestore/backupengine/group/sbenginenojava.mmp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/group/sbenginenojava.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -30,9 +30,8 @@
MACRO SBENGINE_EXCLUDE_JAVA
-USERINCLUDE ../../../../../os/ossrv/genericservices/activebackupclient/inc
-SOURCEPATH ../../../../../os/ossrv/genericservices/activebackupclient/src
-SOURCE panic.cpp
+
+
SOURCEPATH ../src
SOURCE sbtypes.cpp
@@ -52,6 +51,7 @@
SOURCE sbecompressionandencryption.cpp
SOURCE sbeconfig.cpp
SOURCE sbeparserproxy.cpp
+SOURCE sbepanic.cpp
USERINCLUDE . ../inc
--- a/backupandrestore/backupengine/inc/sbedataowner.h Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/inc/sbedataowner.h Thu Jul 22 16:43:05 2010 +0100
@@ -50,6 +50,8 @@
_LIT(KCentRepProcessName, "centralrepositorysrv.exe");
_LIT8(KYes, "yes");
+ const TTimeIntervalMicroSeconds32 KABCallbackDefaultTimeout(200000000);
+
// Forwards
class CABServer;
class CDataOwnerManager;
@@ -196,7 +198,7 @@
*/
TActiveInformation() :
iSupported(EFalse), iRequiresDelayToPrepareData(EFalse),
- iSupportsSelective(EFalse), iSupportsIncremental(ETrue), iActiveDataOwner(EFalse), iActiveType(EActiveOnly)
+ iSupportsSelective(EFalse), iSupportsIncremental(ETrue), iActiveDataOwner(EFalse), iActiveType(EActiveOnly), iCallbackDelayTime(KABCallbackDefaultTimeout)
{
}
public:
@@ -207,6 +209,7 @@
TUint8 iSupportsIncremental; /*<! Supports Incremental */
TUint8 iActiveDataOwner; /*<! Although we say we're active, we're not really */
TActiveType iActiveType; /*<! Type of the Active DO */
+ TTimeIntervalMicroSeconds32 iCallbackDelayTime; /*<! Callback Delay Time */
};
/** Data Owner support classes and enums */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backupengine/inc/sbepanic.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,39 @@
+/**
+* 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:
+* Declaration of Panic(). Customises a panic raised in SBE
+*
+*
+*/
+
+
+
+/**
+ @file
+*/
+
+#ifndef __SBPANIC_H__
+#define __SBPANIC_H__
+
+namespace conn
+ {
+
+ /** @{ */
+
+ void Panic(TInt aPanicCode);
+
+ /** @} */
+ }
+
+#endif //__SBPANIC_H__
--- a/backupandrestore/backupengine/inc/sbeparserdefs.h Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/inc/sbeparserdefs.h Thu Jul 22 16:43:05 2010 +0100
@@ -67,6 +67,8 @@
_LIT8(KRequiresReboot, "requires_reboot");
_LIT8(KDeleteBeforeRestore, "delete_before_restore");
_LIT8(KBaseBackupOnly, "base_backup_only");
+
+ _LIT8(KCallbackDelayTime, "callback_delay_time");
}
#endif // __SBEPARSERDEFS_H__
--- a/backupandrestore/backupengine/src/abserver.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/abserver.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -26,7 +26,7 @@
#include "absession.h"
#include "absessionmap.h"
#include "sbedataownermanager.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sblog.h"
namespace conn
--- a/backupandrestore/backupengine/src/absession.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/absession.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -26,7 +26,7 @@
#include "sbedataownermanager.h"
#include "sbedataowner.h"
#include <connect/sbtypes.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sblog.h"
namespace conn
@@ -425,9 +425,10 @@
iCallbackWatchdog = NULL;
iCallbackWatchdog = CPeriodic::NewL(EPriorityHigh);
TTimeIntervalMicroSeconds32 KWatchdogIntervalNone = 0;
- iCallbackWatchdog->Start(KABCallbackWatchdogTimeout, KWatchdogIntervalNone, iWatchdogHandler);
+ iCallbackWatchdog->Start(DataOwnerL().ActiveInformation().iCallbackDelayTime, KWatchdogIntervalNone, iWatchdogHandler);
#endif
-
+
+
// Send the message back to the callback handler
iMessage.Complete(KErrNone);
--- a/backupandrestore/backupengine/src/absessionmap.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/absessionmap.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -22,7 +22,7 @@
#include "absession.h"
#include "absessionmap.h"
#include "sbedataowner.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbebufferhandler.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbebufferhandler.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -22,7 +22,7 @@
#include "sbebufferhandler.h"
#include "sblog.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
@@ -508,11 +508,29 @@
__LOG1("CBufferFileReader::WriteToFile() - making directory resulted in fatal error: %d", err);
User::Leave(err);
} // if
-
-
+
+ TEntry entry;
+ TBool isReadOnly = EFalse;
+ err = iFs.Entry(iFileName, entry);
+ if(KErrNone == err)
+ {
+ if(entry.iAtt & KEntryAttReadOnly)
+ {
+ isReadOnly = ETrue;
+ entry.iAtt &= ~KEntryAttReadOnly;
+ iFs.SetAtt(iFileName, entry.iAtt, ~entry.iAtt);
+ }
+ }
+
err = iFileHandle.Replace(iFs, iFileName, EFileWrite);
__LOG1("CBufferFileReader::WriteToFile() - replacing file returned err: %d", err);
User::LeaveIfError( err );
+
+ if(isReadOnly)
+ {
+ entry.iAtt |= KEntryAttReadOnly;
+ iFs.SetAtt(iFileName, entry.iAtt, ~entry.iAtt);
+ }
iFileOpen = ETrue;
__LOG("CBufferFileReader::RecreateFileL() - END");
--- a/backupandrestore/backupengine/src/sbeclient.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbeclient.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -22,7 +22,7 @@
#include "sbeclient.h"
#include "sbeclientsession.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbeclientsession.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbeclientsession.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -22,7 +22,7 @@
#include "sbeclientsession.h"
#include "sbeclientserver.h"
#include <connect/sbtypes.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbeconfig.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbeconfig.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -19,7 +19,7 @@
@file
*/
#include <e32std.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbeconfig.h"
#include "sblog.h"
#include <xml/parser.h>
--- a/backupandrestore/backupengine/src/sbedataowner.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbedataowner.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -25,7 +25,7 @@
#include "sbtypes.h"
#include "sblog.h"
#include "sbeparserdefs.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
@@ -3553,6 +3553,17 @@
iActiveInformation.iActiveType = EProxyImpOnly;
}
}
+ else if(!localName.CompareF(KCallbackDelayTime))
+ {
+ const TDesC8& value = aAttributes[x].Value().DesC();
+ TInt timeValue = 0;
+ TLex8 lex(value);
+ TInt err = lex.Val(timeValue);
+ if( err == KErrNone && timeValue > 0)
+ iActiveInformation.iCallbackDelayTime = TTimeIntervalMicroSeconds32(timeValue);
+ else
+ iActiveInformation.iCallbackDelayTime = KABCallbackDefaultTimeout;
+ }
} // for x
return KErrNone;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backupengine/src/sbepanic.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,40 @@
+// 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:
+// Server Panic methods
+//
+//
+
+/**
+ @file
+*/
+
+#include <e32std.h>
+#include "sbepanic.h"
+
+namespace conn
+ {
+ void Panic(TInt aPanicCode)
+ /**
+ @internalComponent
+
+ Calls User::Panic with reason "SB: <panic code>"
+
+ @param aPanicCode The panic code as defined in panic.h
+ @panic aPanicCode The panic code passed in
+ */
+ {
+ _LIT(KPanicString,"SBE:");
+ User::Panic(KPanicString,aPanicCode);
+ }
+ }
--- a/backupandrestore/backupengine/src/sbeserver.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbeserver.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -24,7 +24,7 @@
#include "sbeclientserver.h"
#include "sbeserver.h"
#include "sbesession.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbedataownermanager.h"
#include "sblog.h"
//#include <stdlib.h>
--- a/backupandrestore/backupengine/src/sbesession.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbesession.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -24,7 +24,7 @@
#include "sbeserver.h"
#include "sbesession.h"
#include "sbeclientserver.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbedataownermanager.h"
#include <connect/sbtypes.h>
#include "sblog.h"
--- a/backupandrestore/backupengine/src/sbheapwrapper.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbheapwrapper.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -21,7 +21,7 @@
*/
#include "sbheapwrapper.h"
-#include <connect/panic.h>
+#include "sbepanic.h"
namespace conn
{
--- a/backupandrestore/backupengine/src/sbtypes.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backupengine/src/sbtypes.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -19,7 +19,7 @@
@file
*/
#include <e32std.h>
-#include <connect/panic.h>
+#include "sbepanic.h"
#include "sbtypes.h"
#include <s32mem.h>
#include <apgcli.h>
--- a/backupandrestore/backuptest/ABTester/group/abtester.iby Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/ABTester/group/abtester.iby Thu Jul 22 16:43:05 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/ABTester/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/ABTester/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -33,10 +33,10 @@
./abtester.oby /epoc32/rom/include/abtester.oby
./abtester.iby /epoc32/rom/include/abtester.iby
- ../data/incremental_active_backup_registration.xml z:/private/0AB7E57C/backup_registration.xml
- ../data/proxy_active_backup_registration.xml z:/private/0AB7E57D/backup_registration.xml
- ../data/base_active_backup_registration.xml z:/private/0AB7E57E/backup_registration.xml
- ../data/base_active_backup_registration2.xml z:/private/0AB7E58A/backup_registration.xml
- ../data/base_active_backup_registration3.xml z:/private/0AB7E58B/backup_registration.xml
- ../data/passive_backup_registration.xml z:/private/0AB7E58C/backup_registration.xml
- ../data/backup_public_files_registration.xml z:/private/0FA00001/backup_registration.xml
+ ../data/incremental_active_backup_registration.xml z:/private/0ab7e57c/backup_registration.xml
+ ../data/proxy_active_backup_registration.xml z:/private/0ab7e57d/backup_registration.xml
+ ../data/base_active_backup_registration.xml z:/private/0ab7e57e/backup_registration.xml
+ ../data/base_active_backup_registration2.xml z:/private/0ab7e58a/backup_registration.xml
+ ../data/base_active_backup_registration3.xml z:/private/0ab7e58b/backup_registration.xml
+ ../data/passive_backup_registration.xml z:/private/0ab7e58c/backup_registration.xml
+ ../data/backup_public_files_registration.xml z:/private/0fa00001/backup_registration.xml
--- a/backupandrestore/backuptest/burtestserver/Group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/Group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -40,9 +40,8 @@
../testscripts/test_restorepackage.script z:/testdata/scripts/sbetestdata/test_restorepackage.script
../testscripts/test_increament.script z:/testdata/scripts/sbetestdata/test_increament.script
-../testscripts/sbeconfig.xml /epoc32/release/winscw/udeb/z/private/10202d56/sbeconfig.xml
-../testscripts/sbeconfig.xml /epoc32/release/winscw/urel/z/private/10202d56/sbeconfig.xml
-
+../../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
PRJ_TESTMMPFILES
burtestserver.mmp
--- a/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Thu Jul 22 16:43:05 2010 +0100
@@ -35,6 +35,10 @@
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 Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/inc/t_burteststepbase.h Thu Jul 22 16:43:05 2010 +0100
@@ -90,6 +90,9 @@
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 Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_burteststepbase.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -63,6 +63,9 @@
iDataOwners.Close();
iSidArray.Close();
+
+ iExcludeSidArray.Close();
+
iJidArray.Close();
iPublicFileNames.Close();
iPrivateFileNames.Close();
@@ -387,6 +390,48 @@
/** 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)
@@ -458,7 +503,6 @@
LogWithNum(LOG_LEVEL2,KTempText1, err);
iFailures++;
}
-
// Log
if (iDataOwners.Count() == 0)
{
@@ -470,6 +514,30 @@
_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()
@@ -510,6 +578,28 @@
_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)
@@ -557,8 +647,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);
@@ -576,19 +666,22 @@
else // possibly jid
{
HBufC* pSuiteHash = ExtractJavaIDL(*iDataOwners[index]);
- 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 (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)
{
@@ -1223,6 +1316,12 @@
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);
@@ -1367,8 +1466,25 @@
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 ================
@@ -1389,6 +1505,19 @@
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);
@@ -1482,7 +1611,6 @@
{
User::Leave(KErrInUse);
}
- iStatus = KRequestPending;
SetActive();
iActiveScheduler->Start();
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -17,7 +17,7 @@
@file
@released
*/
-
+#include "W32STD.H"
#include "t_teststepbackup.h"
namespace bur_ts
@@ -145,6 +145,8 @@
Log(LOG_LEVEL2, KLog3);
}
+ _LIT(KLog31, "Checking valid registration...");
+ Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -201,9 +203,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -238,9 +244,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
@@ -530,6 +540,10 @@
TRAPD(error,
for (TInt i=0; i < KRetries;)
{
+ //
+ LogWithNum(LOG_LEVEL3,_L("doActiveBackup-retryies :"), i);
+
+
CheckSIDStatusL(transferTypes, iTransferTypes);
if (iTransferTypes.Count()) // dataowners ready
{
@@ -551,7 +565,20 @@
iFailures++;
_LIT(KLogNoTrans, "***Error: Some Data Owners were Not Ready or Failed to Connect");
Log(LOG_LEVEL3, KLogNoTrans);
- } //if
+
+
+ //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
transferTypes.ResetAndDestroy();
User::LeaveIfError(error);
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -204,9 +204,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -241,9 +245,13 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ // do active backup when in partial backup mode
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackupasync.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -148,6 +148,8 @@
Log(LOG_LEVEL2, KLog3);
}
+ _LIT(KLog31, "Checking valid registration...");
+ Log(LOG_LEVEL2, KLog31);
CheckValidRegistrationL();
_LIT(KLog4, "Saving Data Owners...");
@@ -204,9 +206,12 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- //active
- BackupActiveBaseDataL();
- BackupActiveSnapshotDataL();
+ if (iIsPartial)
+ {
+ //active
+ BackupActiveBaseDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveBaseDataL();
@@ -251,9 +256,12 @@
BackupSystemBaseDataL();
BackupSystemSnapshotDataL();
- // active
- BackupActiveIncDataL();
- BackupActiveSnapshotDataL();
+ if (iIsPartial)
+ {
+ // active
+ BackupActiveIncDataL();
+ BackupActiveSnapshotDataL();
+ }
//passive
BackupPassiveIncDataL();
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestore.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -241,9 +241,13 @@
SupplyPassiveSnapshotDataL();
RestorePassiveBaseDataL();
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
+ // do active restore when in partial restore mode
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ }
}
void CBURTestStepRestore::IncrementalRestoreL()
@@ -259,11 +263,14 @@
RestorePassiveBaseDataL();
RestorePassiveIncDataL();
-
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
+ // do active restore when in partial restore mode
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
+ }
}
--- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststeprestoreasync.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -200,9 +200,12 @@
{
RestoreJavaMidletDataL();
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
+ if (iIsPartial)
+ {
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
+ }
//active
SupplyActiveSnapshotDataL();
@@ -216,17 +219,19 @@
*/
{
RestoreJavaMidletDataL();
-
- // passive
- SupplyPassiveSnapshotDataL();
- RestorePassiveBaseDataL();
- RestorePassiveIncDataL();
-
-
- //active
- SupplyActiveSnapshotDataL();
- RestoreActiveBaseDataL();
- RestoreActiveIncDataL();
+
+ // passive
+ SupplyPassiveSnapshotDataL();
+ RestorePassiveBaseDataL();
+ RestorePassiveIncDataL();
+
+ if (iIsPartial)
+ {
+ //active
+ SupplyActiveSnapshotDataL();
+ RestoreActiveBaseDataL();
+ RestoreActiveIncDataL();
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/backup_registration.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <passive_backup base_backup_only="yes">
+ <include_directory name = "preserve"/>
+ </passive_backup>
+</backup_registration>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/import_backup_registration.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,18 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <public_backup>
+ <include_directory name = "C:\public\81113002\"/>
+ <include_directory name = "!:\public\test\"/>
+ <exclude name = "c:\nkern.txt"/>
+ </public_backup>
+
+ <!-- Increase condition coverage -->
+ <exclude name = "c:\resource\81113002\nkern.txt"/>
+
+ <!--test proxy parse function. -->
+ <proxy_data_manager sid= "0x10202BE9" />
+
+ <system_backup/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/increamenttest.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <passive_backup base_backup_only="no">
+ <include_file name="needbackup.xml"/>
+ </passive_backup>
+ <public_backup>
+ <include_file name="c:\publicbackup.xml"/>
+ </public_backup>
+</backup_registration>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/invalidproxymgr.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+ <proxy_data_manager SID="0x00000000" />
+ <dbms_backup policy="AABBCCDD" />
+</backup_registration>
Binary file backupandrestore/backuptest/burtestserver/testscripts/private_file1.dat has changed
Binary file backupandrestore/backuptest/burtestserver/testscripts/public_file1.dat has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/public_file2.dat Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+test data
\ No newline at end of file
Binary file backupandrestore/backuptest/burtestserver/testscripts/sbeconfig.xml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test.ini Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,225 @@
+[BACKUP_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=10005399
+
+[BACKUP_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=10005399
+
+[BACKUP_RESTORE_0030]
+BackupDir=c:\BackupArchive\
+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\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=00000000
+
+[BACKUP_RESTORE_0060]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=o
+IDs=0AB7E57C
+ExpectStatus=-1
+
+[BACKUP_RESTORE_0070]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=12345678
+
+[BACKUP_RESTORE_0075]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0077]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0AB7E58F
+ExpectStatus=-21
+
+[BACKUP_RESTORE_0080]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0090]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58F
+
+[BACKUP_RESTORE_0100]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58C
+
+[BACKUP_RESTORE_0110]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=A,c,$,#,@,!,1,^,&,*
+IDs=0AB7E58C
+ExpectStatus=-1
+
+[BACKUP_RESTORE_0120]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=0
+DriveList=c
+IDs=0AB7E58C
+ExpectStatus=-21
+
+[INC_BACKUP_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[INC_BACKUP_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=0
+DriveList=c
+
+[PACKAGE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=8111300b
+
+[PACKAGE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=8111300b
+ExpectStatus=-11
+ExpectStatus2=-12
+
+[PACKAGE_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=81113002
+
+[PACKAGE_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=81113002
+ExpectStatus=-11
+ExpectStatus2=-12
+
+[PUBLIC_FILE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0FA00001
+ExpectPublicFiles=c:\public\0FA00001\public_file1.dat,c:\public\0FA00001\public_file2.dat
+
+[PUBLIC_FILE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+BaseOnly=1
+DriveList=c
+IDs=0FA00001
+ExpectPrivateFiles=C:\private\0FA00001\private_file1.dat
+ExpectPrivateFileSizes=68841
+
+[ACTIVE_BACKUP_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[ACTIVE_BACKUP_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57D
+BaseOnly=1
+DriveList=c
+ExpectStatus=-1
+
+[ACTIVE_BACKUP_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C
+BaseOnly=0
+DriveList=c
+
+[ACTIVE_BACKUP_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E58B
+BaseOnly=0
+DriveList=c
+ExpectStatus=5
+
+[ACTIVE_RESTORE_0010]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C,0AB7E57E,0AB7E58A
+BaseOnly=1
+DriveList=c
+
+[ACTIVE_RESTORE_0020]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57D
+BaseOnly=1
+DriveList=c
+ExpectStatus=-1
+ExpectStatus2=-18
+
+[ACTIVE_RESTORE_0030]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E57C
+BaseOnly=0
+DriveList=c
+
+[ACTIVE_RESTORE_0040]
+BackupDir=c:\BackupArchive\
+IsPartial=1
+IDs=0AB7E58B
+BaseOnly=0
+DriveList=c
+ExpectStatus=5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_activebackuprestore.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,230 @@
+// 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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_activebackup.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Active Backup
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0010
+//! @SYMTestCaseDesc Do BaseOnly active-backup for three data owners
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-backup for three data owners
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0010
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0010
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0020
+//! @SYMTestCaseDesc Do Proxy active-backup for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-backup for specified data owner
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0020
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0020
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0030
+//! @SYMTestCaseDesc Do Incremental active-backup for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-backup for specified data owner
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0030
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0030
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-0040
+//! @SYMTestCaseDesc Do active-backup for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-backup for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Backup fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0040
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Restore
+PRINT ----------------------------------------------
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0010
+//! @SYMTestCaseDesc Do BaseOnly active-restore for three data owners
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-restore for three data owners
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0010
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0020
+//! @SYMTestCaseDesc Do Proxy active-restore for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-restore for specified data owner
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0020
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0030
+//! @SYMTestCaseDesc Do Incremental active-restore for specified data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-restore for specified data owner
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0030
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0030
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-0040
+//! @SYMTestCaseDesc Do active-restore for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-restore for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Restore fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0040
+END_TESTCASE MTP-SBE-ACTIVERESTORE-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Backup Async
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+//! @SYMTestCaseDesc Do BaseOnly active-backup for three data owners asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-backup for three data owners asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0010
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0010
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+//! @SYMTestCaseDesc Do Proxy active-backup for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-backup for specified data owner asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0020
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0020
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+//! @SYMTestCaseDesc Do Incremental active-backup for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-backup for specified data owner asynchronously
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0030
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0030
+
+START_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+//! @SYMTestCaseDesc Do active-backup asynchronously for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-backup asynchronously for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Backup fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_BACKUP_0040
+END_TESTCASE MTP-SBE-ACTIVEBACKUP-ASYNC-0040
+
+PRINT ----------------------------------------------
+PRINT Test Active Restore Async
+PRINT ----------------------------------------------
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0010
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0010
+//! @SYMTestCaseDesc Do BaseOnly active-restore for three data owners asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do BaseOnly active-restore for three data owners asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0010
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0020
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0020
+//! @SYMTestCaseDesc Do Proxy active-restore for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Proxy active-restore for specified data owner asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0020
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0030
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0030
+//! @SYMTestCaseDesc Do Incremental active-restore for specified data owner asynchronously
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do Incremental active-restore for specified data owner asynchronously
+//! @SYMTestExpectedResults Restore succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0030
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0030
+
+START_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVERESTORE-ASYNC-0040
+//! @SYMTestCaseDesc Do active-restore asynchronously for a data owner whose executable file is missing
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority normal
+//! @SYMTestActions Do active-restore asynchronously for a data owner whose executable file is missing
+//! @SYMTestExpectedResults Restore fails with error code 5
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini ACTIVE_RESTORE_0040
+END_TESTCASE MTP-SBE-ACTIVERESTORE-ASYNC-0040
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backupinvalid.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,111 @@
+// 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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Invalid
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPINVALIDIDS-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDIDS-0000
+//! @SYMTestCaseDesc Invalid data owner ID test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invlid id and try backup it.
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0050
+END_TESTCASE MTP-SBE-BACKUPINVALIDIDS-0000
+
+START_TESTCASE MTP-SBE-BACKUPINVALIDDRIVE-0001
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDDRIVE-0001
+//! @SYMTestCaseDesc Invalid drive test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid drive for a data owner to backup
+//! @SYMTestExpectedResults SBE backup operation return -1
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0060
+END_TESTCASE MTP-SBE-BACKUPINVALIDDRIVE-0001
+
+RUN_UTILS MkDir c:\private\12345678\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\backup_registration.xml c:\private\12345678\backup_registration.xml
+START_TESTCASE MTP-SBE-BACKUPINVALIDDIR-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDDIR-0002
+//! @SYMTestCaseDesc Invalid directory test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid directory for a data owner to backup
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0070
+END_TESTCASE MTP-SBE-BACKUPINVALIDDIR-0002
+
+RUN_UTILS DeleteDirectory c:\private\12345678\
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\invalidproxymgr.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\backup_registration.xml
+START_TESTCASE MTP-SBE-BACKUPINVALIDPROXY-0003
+//! @SYMTestCaseID MTP-SBE-BACKUPINVALIDPROXY-0003
+//! @SYMTestCaseDesc Invalid proxy manager test
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify an invalid proxy manager in register file for a data owner to backup
+//! @SYMTestExpectedResults SBE can't found and do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0075
+END_TESTCASE MTP-SBE-BACKUPINVALIDPROXY-0003
+
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS CopyFile z:\sys\bin\esock.dll c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-BACKUPREADONLY-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPREADONLY-0004
+//! @SYMTestCaseDesc Test readonly file backup. This case only valid on hardware, on winscw, all file is readable.
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup a read only file
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0075
+END_TESTCASE MTP-SBE-BACKUPREADONLY-0004
+
+START_TESTCASE MTP-SBE-RESTOREREADONLY-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREREADONLY-0005
+//! @SYMTestCaseDesc Test readonly file restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore a readonly file, but the origin file exist
+//! @SYMTestExpectedResults -21
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0077
+END_TESTCASE MTP-SBE-RESTOREREADONLY-0005
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuppackage.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,109 @@
+// 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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_backuppackage.script
+// for testing backup datas of installed applications
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup and Restore package applications
+PRINT ----------------------------------------------
+RUN_PROGRAM 1000 swiconsole /i Z:\testdata\scripts\sbetestdata\bigexeforbackup.sis /optimal
+RUN_PROGRAM 1000 swiconsole /i Z:\testdata\scripts\sbetestdata\test_dll_nopublic.SIS /optimal
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+RUN_UTILS DeleteDirectory C:\system\temp\
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\private_file1.dat C:\private\81000014\private_file1.dat
+RUN_UTILS MakeReadWrite C:\private\81000014\private_file1.dat
+
+RUN_UTILS DeleteDirectory C:\public\
+RUN_UTILS MkDir C:\public\
+RUN_UTILS MkDir C:\public\81113002\
+RUN_UTILS MkDir C:\public\test\
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\public_file1.dat C:\public\81113002\public_file1.dat
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\public_file2.dat C:\public\81113002\public_file2.dat
+RUN_UTILS CopyFile Z:\testdata\scripts\sbetestdata\private_file1.dat C:\public\test\private_file1.dat
+RUN_UTILS MakeReadWrite C:\public\81113002\public_file1.dat
+RUN_UTILS MakeReadWrite C:\public\81113002\public_file2.dat
+RUN_UTILS MakeReadWrite C:\public\test\private_file1.dat
+
+START_TESTCASE MTP-SBE-BACKUPPACKAGE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPACKAGE-0000
+//! @SYMTestCaseDesc Backup big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup executable files and private data of install application
+//! @SYMTestExpectedResults 1. The success message displayed in the console.
+//! 2. No any error or warning message displayed in the console.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0010
+END_TESTCASE MTP-SBE-BACKUPPACKAGE-0000
+RUN_UTILS DeleteFile C:\private\81000014\private_file1.dat
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseDesc Restore big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install application from bakcup file.
+//! @SYMTestExpectedResults 1. The failure message of restore displayed in the console
+//! 2. The executable files are not be restored.
+//! 3. The private files are not be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0020
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+RUN_UTILS DeleteFile C:\private\81000014\private_file1.dat
+
+START_TESTCASE MTP-SBE-BACKUPPACKAGE-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPACKAGE-0002
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Backup executable files and private data of install DLL
+//! @SYMTestExpectedResults 1. The success message displayed in the console.
+//! 2. No any error or warning message displayed in the console.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0030
+END_TESTCASE MTP-SBE-BACKUPPACKAGE-0002
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0003
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install DLL from bakcup file.
+//! @SYMTestExpectedResults 1. The failure message of restore displayed in the console
+//! 2. The executable files are not be restored.
+//! 3. The private files are not be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0040
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0003
+
+RUN_UTILS DeleteFile C:\public\81113002\public_file1.dat
+RUN_UTILS DeleteFile C:\public\81113002\public_file2.dat
+RUN_UTILS DeleteFile C:\public\test\private_file1.dat
+RUN_UTILS DeleteDirectory C:\public\81113002\
+RUN_UTILS DeleteDirectory C:\public\test\
+RUN_UTILS DeleteDirectory C:\public\
+RUN_PROGRAM 900 swiconsole /u /uid 0x8111300b /pkg "big exe for backup" /vendor "Unique Vendor Name" /optimal
+RUN_PROGRAM 1000 swiconsole /u /uid 0x81113002 /pkg "tswinocapability" /vendor "Symbian" /optimal
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestore.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,163 @@
+// 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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Restore
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0000
+//! @SYMTestCaseDesc Backup with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0000
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALBASE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALBASE-0001
+//! @SYMTestCaseDesc restore with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-RESTOREPARTIALBASE-0001
+
+START_TESTCASE MTP-SBE-BACKUPPARTIAL-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIAL-0002
+//! @SYMTestCaseDesc Backup with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-BACKUPPARTIAL-0002
+
+START_TESTCASE MTP-SBE-RESTOREPARTIAL-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIAL-0003
+//! @SYMTestCaseDesc Restore with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-RESTOREPARTIAL-0003
+
+START_TESTCASE MTP-SBE-BACKUPFULLBASE-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLBASE-0004
+//! @SYMTestCaseDesc Backup with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-BACKUPFULLBASE-0004
+
+START_TESTCASE MTP-SBE-RESTOREFULLBASE-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLBASE-0005
+//! @SYMTestCaseDesc Restore with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-RESTOREFULLBASE-0005
+
+START_TESTCASE MTP-SBE-BACKUPFULL-0006
+//! @SYMTestCaseID MTP-SBE-BACKUPFULL-0006
+//! @SYMTestCaseDesc Backup with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-BACKUPFULL-0006
+
+START_TESTCASE MTP-SBE-RESTOREFULL-0007
+//! @SYMTestCaseID MTP-SBE-RESTOREFULL-0007
+//! @SYMTestCaseDesc Restore with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-RESTOREFULL-0007
+
+RUN_UTILS DeleteFile c:\sbetest1.txt
+RUN_UTILS DeleteFile c:\sbetest2.txt
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\sbetest1.txt
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\sbetest2.txt
+RUN_UTILS MakeReadWrite c:\sbetest1.txt
+RUN_UTILS MakeReadWrite c:\sbetest2.txt
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0008
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0008
+//! @SYMTestCaseDesc Do passive backup for a data owner which has a very complex backup registration file
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup for a data owner which has a very complex backup registration file
+//! @SYMTestExpectedResults Backup succeeds
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0100
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0008
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0010
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0010
+//! @SYMTestCaseDesc Do passive backup for a data owner with a invalid drive list
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup for a data owner with a invalid drive list
+//! @SYMTestExpectedResults Backup fails with error code -1
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0110
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0010
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0012
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASE-0012
+//! @SYMTestCaseDesc Do passive backup with abnormal operation sequence
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority high
+//! @SYMTestActions Do passive backup with abnormal operation sequence
+//! @SYMTestExpectedResults Backup fails with error code -21
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackup2 z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0120
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASE-0012
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_backuprestoreasync.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,122 @@
+// 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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Backup Restore Async
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\BackupArchive\
+START_TESTCASE MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+//! @SYMTestCaseDesc Backup with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-BACKUPPARTIALBASEASYNC-0000
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+//! @SYMTestCaseDesc restore with partial and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for base and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-RESTOREPARTIALBASEASYNC-0001
+
+START_TESTCASE MTP-SBE-BACKUPPARTIALASYNC-0002
+//! @SYMTestCaseID MTP-SBE-BACKUPPARTIALASYNC-0002
+//! @SYMTestCaseDesc Backup with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-BACKUPPARTIALASYNC-0002
+
+START_TESTCASE MTP-SBE-RESTOREPARTIALASYNC-0003
+//! @SYMTestCaseID MTP-SBE-RESTOREPARTIALASYNC-0003
+//! @SYMTestCaseDesc Restore with partial and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for increament and partial restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-RESTOREPARTIALASYNC-0003
+
+START_TESTCASE MTP-SBE-BACKUPFULLBASEASYNC-0004
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLBASEASYNC-0004
+//! @SYMTestCaseDesc Backup with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-BACKUPFULLBASEASYNC-0004
+
+START_TESTCASE MTP-SBE-RESTOREFULLBASEASYNC-0005
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLBASEASYNC-0005
+//! @SYMTestCaseDesc Restore with full and base
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and base restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0030
+END_TESTCASE MTP-SBE-RESTOREFULLBASEASYNC-0005
+
+START_TESTCASE MTP-SBE-BACKUPFULLASYNC-0006
+//! @SYMTestCaseID MTP-SBE-BACKUPFULLASYNC-0006
+//! @SYMTestCaseDesc Backup with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestBackupAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-BACKUPFULLASYNC-0006
+
+START_TESTCASE MTP-SBE-RESTOREFULLASYNC-0007
+//! @SYMTestCaseID MTP-SBE-RESTOREFULLASYNC-0007
+//! @SYMTestCaseDesc Restore with full and increament
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify ini file for full and increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestoreAsync z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0040
+END_TESTCASE MTP-SBE-RESTOREFULLASYNC-0007
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_increament.script Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,135 @@
+// 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:
+//
+
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test.script
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Increament
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory c:\BackupArchive\
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+RUN_UTILS DeleteFile c:\publicbackup.xml
+RUN_UTILS MkDir c:\private\0AB7E58F\
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\increamenttest.xml c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\backup_registration.xml
+RUN_UTILS CopyFile c:\private\0AB7E58F\backup_registration.xml c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-BACKUPBASE-0000
+//! @SYMTestCaseID MTP-SBE-BACKUPBASE-0000
+//! @SYMTestCaseDesc Backup 0AB7E58F
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0080
+END_TESTCASE MTP-SBE-BACKUPBASE-0000
+
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS CopyFile z:\testdata\scripts\sbetestdata\testbigfile.dat c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS MakeReadWrite c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS CopyFile c:\private\0AB7E58F\backup_registration.xml c:\publicbackup.xml
+START_TESTCASE MTP-SBE-BACKUPINCREAMENT-0010
+//! @SYMTestCaseID MTP-SBE-BACKUPINCREAMENT-0010
+//! @SYMTestCaseDesc Increament backup 0AB7E58F after some files changed
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-BACKUPINCREAMENT-0010
+
+RUN_UTILS DeleteFile c:\publicbackup.xml
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+START_TESTCASE MTP-SBE-RESTOREINCREAMENT-0020
+//! @SYMTestCaseID MTP-SBE-RESTOREINCREAMENT-0020
+//! @SYMTestCaseDesc Increament restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify 0AB7E58F need be increament restore
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-RESTOREINCREAMENT-0020
+
+RUN_UTILS DeleteFile c:\private\0AB7E58F\needbackup.xml
+RUN_UTILS DeleteFile c:\BackupArchive\AB7E58F\C\Passive\Base\data.bkp
+START_TESTCASE MTP-SBE-INVALIDDATARESTORE-0030
+//! @SYMTestCaseID MTP-SBE-INVALIDDATARESTORE-0030
+//! @SYMTestCaseDesc Increament restore with invalid data store
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Delete some data store data and try restore
+//! @SYMTestExpectedResults no error and SBE do nothing
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini BACKUP_RESTORE_0090
+END_TESTCASE MTP-SBE-INVALIDDATARESTORE-0030
+
+RUN_UTILS DeleteDirectory c:\private\0AB7E58F\
+START_TESTCASE MTP-SBE-ACTIVEBASEBACKUP-0040
+//! @SYMTestCaseID MTP-SBE-ACTIVEBASEBACKUP-0040
+//! @SYMTestCaseDesc Backup an active data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify active data owner need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVEBASEBACKUP-0040
+
+START_TESTCASE MTP-SBE-ACTIVEINCBACKUP-0050
+//! @SYMTestCaseID MTP-SBE-ACTIVEINCBACKUP-0050
+//! @SYMTestCaseDesc Increament backup an active data owner
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify active data owner need be backup
+//! @SYMTestExpectedResults no error
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestBackup z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVEINCBACKUP-0050
+
+START_TESTCASE MTP-SBE-ACTIVEBASERESTORE-0060
+//! @SYMTestCaseID MTP-SBE-ACTIVEBASERESTORE-0060
+//! @SYMTestCaseDesc Base restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify the active data owner need be base restore
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0010
+END_TESTCASE MTP-SBE-ACTIVEBASERESTORE-0060
+
+START_TESTCASE MTP-SBE-ACTIVEINCRESTORE-0070
+//! @SYMTestCaseID MTP-SBE-ACTIVEINCRESTORE-0070
+//! @SYMTestCaseDesc Increament restore
+//! @SYMPREQ 2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Specify the active data owner need be increament restore
+//! @SYMTestType CIT
+RUN_TEST_STEP 500 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini INC_BACKUP_RESTORE_0020
+END_TESTCASE MTP-SBE-ACTIVEINCRESTORE-0070
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_registration.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,15 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+ <public_backup>
+ <include_directory name = "\logs"/>
+ <include_directory name = "C:\public\81113002\"/>
+ <include_file name = "C:\public\81113002\public_file1.dat"/>
+ <include_directory name = "I:\"/>
+ <exclude name = "c:\nkern.txt"/>
+ <exclude name = "C:\public\81113002\public_file1.dat"/>
+ </public_backup>
+
+ <system_backup/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/backupandrestore/backuptest/burtestserver/testscripts/test_restorepackage.script Thu Jul 22 16:43:05 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:
+//
+
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// test_backuppackage.script
+// for testing backup datas of installed applications
+//
+////////////////////////////////////////////////////////////////////////////////////
+LOAD_SUITE BURTestServer
+
+PRINT ----------------------------------------------
+PRINT Test Restore
+PRINT ----------------------------------------------
+RUN_UTILS DeleteDirectory C:\system\temp\
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0000
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0000
+//! @SYMTestCaseDesc Restore big data which owner is install application
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install application from bakcup file.
+//! @SYMTestExpectedResults 1. The executable files are same like after installing application
+//! 2. The name and size of private files are same like after installing application.
+//! 3. The public files don't be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0020
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0000
+
+START_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseID MTP-SBE-RESTOREBACKUPPACKAGE-0001
+//! @SYMTestCaseDesc Backup DLLs data which are installed as part of package
+//! @SYMPREQ PREQ2492
+//! @SYMTestStatus Released
+//! @SYMTestPriority High
+//! @SYMTestActions Restore executable files and private datas of install DLL from bakcup file.
+//! @SYMTestExpectedResults 1. The dll files are same like after installing application
+//! 2. The name and size of DLLs are same like after installing application.
+//! 3. The public files don't be restored.
+//! @SYMTestType CIT
+RUN_TEST_STEP 100 BURTestServer TestRestore z:\testdata\scripts\sbetestdata\test.ini PACKAGE_0040
+END_TESTCASE MTP-SBE-RESTOREBACKUPPACKAGE-0001
+
+RUN_PROGRAM 900 swiconsole /u /uid 0x8111300b /pkg "big exe for backup" /vendor "Unique Vendor Name" /optimal
+RUN_PROGRAM 1000 swiconsole /u /uid 0x81113002 /pkg "tswinocapability" /vendor "Symbian" /optimal
Binary file backupandrestore/backuptest/burtestserver/testscripts/testbigfile.dat has changed
Binary file backupandrestore/backuptest/testdata/armv5/bigexeforbackup.sis has changed
Binary file backupandrestore/backuptest/testdata/armv5/test_dll_nopublic.sis has changed
Binary file backupandrestore/backuptest/testdata/winscw/bigexeforbackup.sis has changed
Binary file backupandrestore/backuptest/testdata/winscw/test_dll_nopublic.SIS has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:
+*
+*/
+
+
+// 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 "../mtpdataproviders/mtpwmpextndp/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 "../mtptransports/mtpbttransport/group/bld.inf"
+#include "../mtpdataproviders/mtpmetadatadp/group/bld.inf"
+#include "../mtpdataproviders/mtpstatusdp/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"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/group/dummy.txt Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+test1.
+
+test2.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
+ <!ENTITY layer_real_source_path "sf/mw/remoteconn" >
+]>
+
+<SystemDefinition name="Remoteconn" schema="1.5.1">
+ <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>
+
+
+ </layer>
+ </systemModel>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/bwins/dunatextu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,11 @@
+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)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/eabi/dunatextu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,11 @@
+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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/group/dunatext.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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
+
+USERINCLUDE ../inc ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY atextclient.lib
+LIBRARY atextcommon.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdEchoer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,990 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdPusher.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,372 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtEcomListen.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,185 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtModeListen.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,172 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtNvramListen.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,151 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtSpecialCmdHandler.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/inc/DunAtUrcHandler.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,182 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* 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") ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1989 @@
+/*
+* 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;
+ }
+ // As a last step adjust the possible multiple IsDelimiterCharacter()
+ // characters and set length of iLineBuffer. Leave iEndIndex untouched.
+ lineLength = iLineBuffer.Length();
+ for ( TInt i=lineLength-1; i>=0; i-- )
+ {
+ TChar character = iLineBuffer[i];
+ if ( !IsDelimiterCharacter(character) )
+ {
+ iLineBuffer.SetLength( i + 1 );
+ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() ));
+ FTRACE(FPrintRaw(iLineBuffer) );
+ break;
+ }
+ }
+ 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) 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,521 @@
+/*
+* 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") ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* 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") ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,182 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,190 @@
+/*
+* 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") ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtSpecialCmdHandler.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,228 @@
+/*
+* 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") ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/group/dunclient.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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
+
+USERINCLUDE ../inc ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/inc/dunactive.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,169 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/inc/dunclient.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/inc/dunplugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/inc/dunserverdef.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/src/0x20002775.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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 "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;
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/src/dunactive.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,150 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/src/dunclient.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/src/dunplugin.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* 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 ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/client/src/proxy.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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 <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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/group/bld.inf Thu Jul 22 16:43:05 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:
+*
+*/
+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"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/group/dun.mrp Thu Jul 22 16:43:05 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:
+#
+
+component dun
+
+source \sf\mw\remoteconn\localconnectivityservice\dun
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/bwins/dunbtu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/bwins/duniru.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/bwins/dunusbu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?NewLocalPluginL@@YAPAVMDunLocalMediaPlugin@@XZ @ 1 NONAME ; class MDunLocalMediaPlugin * NewLocalPluginL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/eabi/dunbtu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z15NewLocalPluginLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/eabi/duniru.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z15NewLocalPluginLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/eabi/dunusbu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z15NewLocalPluginLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/group/dunbt.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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
+
+USERINCLUDE ../inc/bt ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY euser.lib
+LIBRARY esock.lib
+LIBRARY btengdiscovery.lib
+LIBRARY bluetooth.lib
+LIBRARY dunutils.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/group/dunir.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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
+
+USERINCLUDE ../inc/ir ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY euser.lib
+LIBRARY c32.lib
+LIBRARY dunutils.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/group/dunusb.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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
+
+USERINCLUDE ../inc/usb ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY euser.lib
+LIBRARY c32.lib
+LIBRARY usbman.lib
+LIBRARY dunutils.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/bt/DunBtListen.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,261 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/bt/DunBtPlugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,310 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/ir/DunIrPlugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,177 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/usb/DunUsbConfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,207 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/usb/DunUsbListen.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/inc/usb/DunUsbPlugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,362 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,464 @@
+/*
+* 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" ) ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/bt/DunBtPlugin.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,582 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/ir/DunIrPlugin.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,340 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,292 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,259 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbPlugin.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,781 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunatext.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunbt.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunclient.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunir.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunserver.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunusb.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/rom/dunutils.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/group/dunserver.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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
+
+USERINCLUDE ../inc ../../utils/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc ../../../../inc
+
+LIBRARY euser.lib
+LIBRARY dunutils.lib
+LIBRARY btfeatures.lib
+DEBUGLIBRARY flogger.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/DunCloseWait.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,152 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/DunServer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,361 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/DunServerSecurityPolicy.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/DunServerUtils.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,389 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/DunSession.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/inc/dunserverdef.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/src/DunCloseWait.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,178 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/src/DunServer.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,674 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/src/DunServerUtils.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,497 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/server/src/DunSession.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,195 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/bwins/dunutilstestu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/conf/dunutilstest.cfg Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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]
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/eabi/dunutilstestu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/group/dunutilstest.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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
+
+//TARGETPATH ?target_path
+DEFFILE dunutilstest.def
+
+USERINCLUDE ../inc ../../utils/inc
+
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets
+
+#if defined(__S60_)
+ // OSEXT_LAYER_SYSTEMINCLUDE
+ MW_LAYER_SYSTEMINCLUDE
+#else
+ //SYSTEMINCLUDE /epoc32/include
+ //SYSTEMINCLUDE /epoc32/include/internal
+#endif
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/inc/dunutilstest.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/init/dunutilstest.ini Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,233 @@
+#
+# 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/tsrc/src/dunutilstest.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* 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 );
+
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/bwins/dunutilsu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+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)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/eabi/dunutilsu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/group/dunutils.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* 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
+
+USERINCLUDE ../inc ../../atext/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+// Note:
+// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones.
+// If there is a S60 header in the subdirectory then that should be
+// added into the include statements (like #include <phonebook/header.h>)
+//SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunChanMan.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,407 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunDataPusher.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,284 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunDataWaiter.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,156 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunDebug.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,107 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunDownstream.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,276 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunNetDataport.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,286 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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 <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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunPlugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,243 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunSignalCopy.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,226 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunSignalNotify.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunSignalWaiter.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunStream.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,229 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunTransUtils.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,531 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunTransporter.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,800 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunUpstream.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,347 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/inc/DunUtils.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunChanMan.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,577 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunDataPusher.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,450 @@
+/*
+* 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" )));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,253 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunDownstream.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,468 @@
+/*
+* 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" )));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunNetDataport.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,395 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunNoteHandler.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,184 @@
+/*
+* 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" ) ));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,475 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,385 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,257 @@
+/*
+* 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()
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunStream.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,320 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunTransUtils.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1077 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunTransporter.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,891 @@
+/*
+* 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" )));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunUpstream.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,576 @@
+/*
+* 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" )));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/dun/utils/src/DunUtils.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/bwins/generichidu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,101 @@
+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)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/eabi/generichidu.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,122 @@
+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>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/group/generichid.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE ../../../inc
+SYSTEMINCLUDE /epoc32/include/ecom
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/group/generichid.mrp Thu Jul 22 16:43:05 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:
+#
+
+component generichid
+
+source \sf\mw\remoteconn\localconnectivityservice\generichid
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/debug.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/debugconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hidconnectioninfo.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* 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_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hiddriveritem.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hiditem.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,198 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hidparser.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1041 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hidreportgenerator.h Thu Jul 22 16:43:05 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: 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__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/hiduids.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/inc/prjconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/rom/generichid.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidcollection.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,284 @@
+/*
+* 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
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidconnectioninfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hiddriveritem.cpp Thu Jul 22 16:43:05 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: 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidfield.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,638 @@
+/*
+* 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 );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidgeneric.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,533 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidinterfaces.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* 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();
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hiditem.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,263 @@
+/*
+* 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidparser.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1941 @@
+/*
+* 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();
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidreportbase.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidreportgenerator.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidreportroot.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidreporttranslator.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,170 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/src/hidsearch.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/Bmarm/GenericHidTestU.DEF Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/Bwins/GenericHidTestU.DEF Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/conf/GenericHidTest.cfg Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1749 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/E000B181.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/UsagePoC.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+ 0x33, 0x01
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x49, 0x00, //define designator minimum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x59, 0x00, //define designator maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkdesignatorminandmax3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x49, 0x10, //define designator minimum
+0x59, 0x00, //define designator maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkfieldbitneeded.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,28 @@
+//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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforcollectionerrors.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,16 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforfielderrors.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x15, 0x10, //define logical minimum
+0x25, 0x00, //define logical maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkforfielderrors2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x35, 0x10, //define physical minimum
+0x45, 0x00, //define physical maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,15 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x35, 0x00, //define physical minimum
+
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkformainerrors3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x45, 0x00, //define physical maximum
+
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checklogicalminandmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,9 @@
+//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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x91, 0x00 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xB1, 0x00 // main feature - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkmandatoryfieldexistence3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x81, 0x00 // main input tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xa9, 0x01 // begin delimiter
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xA1, 0x01 //main collection
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkparseerrors3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xA4 //global push - no data
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x89, 0x00, // define string minimum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x99, 0x00, // define string maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkstringminandmax3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x89, 0x10, // define string minimum
+0x99, 0x00, // define string maximum
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x19, 0x00, //define usage min to 0
+0x91, 0x01 // main output tag - create field
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x29, 0x00, //define usage max to 0
+0x91, 0x01 // main output tag - create field
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/checkusageminandmax3.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0x19, 0x10, //define usage min to 0
+0x29, 0x00, //define usage max to 0
+0x91, 0x01 // main output tag - create field
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/connectad83.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,36 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/delimiter.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,36 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/designator.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,154 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/designatorindex.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,155 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/dummyconnect.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/empty.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x0
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/feature.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,37 @@
+// 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
+//};
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/feature1.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,37 @@
+// 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
+//};
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globaitem_unknown.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xF5, 0x01 // global item - unknown
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalphysicalmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x45, 0xc8, //global physical maximum (200)
+0x45, 0xc8 //global physical maximum (200)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalphysicalmin.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x35, 0xc8, //global physical minimum (200)
+0x35, 0xc8 //global physical minimum (200)
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpop.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,4 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpop_withoutpush.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xB4 // global pop
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalpush.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0xA4, //global push - no data
+0xB4, // global pop
+0xA5, 0x01 // global push with data
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunit.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x65, 0x06, //global unit
+0x65, 0x06 //global unit
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunit_smallvalue.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x65, 0x02 //global unit
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunitexponent.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x55, 0x00, //global unit exponent
+0x55, 0x00 //global unit exponent
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/globalunitexponent2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x55, 0xff //global unit exponent
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/handleitem_withindelimiter.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+0xa9, 0x01, // begin delimiter - set iWithinDelimiter
+0xB1, 0xff, // main feature
+0xa9, 0x00 // end delimiter
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetcon2.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetconnect.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,24 @@
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetvolumeup.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+ 0x2f
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/headsetvolumeupm.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+ 0x01, 0x2f
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/hook.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+ 0x20, 0x01
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/hookconnect.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,24 @@
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/inputdata.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,5 @@
+0x01,0x48,
+0x00,0x00,
+0x00,0x00,
+0x01,0x02,
+0x02,0x03
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xa9, 0x01, // begin delimiter0xa9, 0x00, // end delimiter0xa9, 0x02, // unknown delimiter
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter_lonelydelimiter.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xa9, 0x00 // end delimiter - lonely delimiter
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdelimiter_nesteddelimiter.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xa1, 0x04, // COLLECTION (CCollection::ENamedArray) - warning 0xa9, 0x01, // begin delimiter0xa9, 0x01 // begin delimiter - nested
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatorindex.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x39, 0xc8,0x39, 0xc8,0xa9, 0x01, // begin delimiter0x39, 0xc8, // ELocalDesignatorIndex (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatormaximum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x59, 0xc8,0x59, 0xc8,0xa9, 0x01, // begin delimiter0x59, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localdesignatorminimum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x49, 0xc8,0x49, 0xc8,0xa9, 0x01, // begin delimiter0x49, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localitem_unknown.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xf9, 0x01 // unknow item
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringindex.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x79, 0xc8,0x79, 0xc8,0xa9, 0x01, // begin delimiter0x79, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringmaximum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x99, 0xc8,0x99, 0xc8,0xa9, 0x01, // begin delimiter0x99, 0xc8, // (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localstringminimum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x89, 0xc8,0x89, 0xc8,0xa9, 0x01, // begin delimiter0x89, 0xc8, // ELocalDesignatorIndex (200)0xc0 // END_COLLECTION
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusage.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusagemaximum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/localusageminimum.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/longitem.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x0C //long item
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainfeature.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,11 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainitem_unknown.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xF0 //main item - unknown
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mainoutputtag.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,11 @@
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multipagec.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,53 @@
+
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multipagein.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+0x01,0x48,
+0x00
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/multiple_usage_page_connect.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,18 @@
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/mute.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x24, 0x01
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/next.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0xE0, 0x04
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/output.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/output1.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/physicalmax.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+// 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
+//};
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/play.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2 @@
+ 0xB0, 0x01,
+ 0x81, 0x01
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/pop.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,152 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/prev.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+ 0x40, 0x02
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/push.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,152 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/stop.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+ 0xb7, 0x01
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/string.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,153 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/stringindex.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,154 @@
+// 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
+// };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/unit.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,44 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/unitexponent.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,43 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/voldown.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x22, 0x01
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/data/volup.hid Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1 @@
+0x21,0x01
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/eabi/GenericHidTestU.def Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/CHidDriverPlugin.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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
+
+SYSTEMINCLUDE /epoc32/include/ecom
+MW_LAYER_SYSTEMINCLUDE
+
+
+START RESOURCE ../data/E000B181.RSS
+TARGET chiddriverplugin.rsc
+END
+
+LIBRARY ECom.lib
+LIBRARY euser.lib
+LIBRARY generichid.lib
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,64 @@
+/*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
+
+SYSTEMINCLUDE /epoc32/include/internal
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_ats.pkg Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,171 @@
+;
+; 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_exe.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,42 @@
+/*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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest_phone.pkg Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,172 @@
+;
+; 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/build_sis_ats.bat Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,22 @@
+@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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/build_sis_phone.bat Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,27 @@
+@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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/CHidDriverPlugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/GenericHidTest.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,377 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/alarmcontrol.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/hidreports.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/tdialclient.h Thu Jul 22 16:43:05 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: 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_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/tgenerichidapi.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,340 @@
+/*
+* 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
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/inc/timer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/init/GenericHidTest_ats.ini Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/init/GenericHidTest_phone.ini Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,235 @@
+#
+# 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/CHidDriverPlugin.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,86 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/CHidDriverPluginProxy.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTest.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,210 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTestBlocks.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,2839 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/GenericHidTest_exe.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/alarmcontrol.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* 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);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/tdialclient.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* 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 );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/tgenerichidapi.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1540 @@
+/*
+* 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();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/src/timer.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/data/hidheadset.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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";
+ }
+ };
+ }
+ };
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/group/headset.mrp Thu Jul 22 16:43:05 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:
+#
+
+component headset
+
+source \sf\mw\remoteconn\localconnectivityservice\headset
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/group/hidheadset.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* 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
+
+USERINCLUDE ../inc ../hidremconbearer/inc
+
+#ifdef NO101APPDEPFIXES
+APP_LAYER_SYSTEMINCLUDE
+#else //NO101APPDEPFIXES
+MW_LAYER_SYSTEMINCLUDE
+#endif //NO101APPDEPFIXES
+SYSTEMINCLUDE ../../../inc
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY generichid.lib
+LIBRARY etel3rdparty.lib
+LIBRARY alarmclient.lib
+LIBRARY mpxplaybackutility.lib
+LIBRARY mpxcommon.lib
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/data/hidremconbearer.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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 = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/group/hidremconbearer.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/debug.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/debugconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerimplementation.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,287 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerinternalpskeys.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* 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__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerobserver.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/hidremconbearerscancodes.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/inc/prjconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/src/hidremconbearerimplementation.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,522 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/src/hidremconbearermain.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/hidremconbearer/src/hidremconbearerobserver.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,156 @@
+/*
+* 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();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/debug.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/debugconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/finder.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/headset.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,523 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/headsetuids.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/keypresstimer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/inc/prjconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/rom/hidheadset.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/src/finder.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,244 @@
+/*
+* 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 );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/src/headset.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1222 @@
+/*
+* 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
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/src/hidheadsetdriverproxy.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/headset/src/keypresstimer.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,94 @@
+/*
+* 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 );
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearerplugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearerplugin.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearerpluginobserver.h Thu Jul 22 16:43:05 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: 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearerpluginparams.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodbearerpluginparams.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodplugin.hrh Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodserviceplugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodserviceplugin.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodservicepluginobserver.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodservicepluginparams.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/commoninc/locodservicepluginparams.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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/localconnectivityservice/locod/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/group/locod.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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
+SYSTEMINCLUDE ../../inc ../../../inc
+SYSTEMINCLUDE /epoc32/include/ecom
+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
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/group/locod.mrp Thu Jul 22 16:43:05 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:
+#
+
+component locod
+
+source \sf\mw\remoteconn\localconnectivityservice\locod
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/debug.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,167 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/debugconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/locodaemon.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/locodservice.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/locodserviceman.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/prjconfig.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/inc/utils.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/rom/locod.iby Thu Jul 22 16:43:05 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:
+*
+*/
+
+#ifndef LOCALCONNECTIVITYDAEMON_IBY
+#define LOCALCONNECTIVITYDAEMON_IBY
+
+file=ABI_DIR\BUILD_DIR\locod.exe PROGRAMS_DIR\locod.exe
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/src/locodaemon.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,188 @@
+/*
+* 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
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/src/locodmain.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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 );
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/src/locodservice.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* 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)
+ {
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/src/locodserviceman.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* 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
+ }
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/localconnectivityservice/locod/src/utils.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,22 @@
+/*
+* 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/mtpimagedp/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -30,9 +30,7 @@
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
+2001fca2.txt /epoc32/data/z/private/10202be9/2001fca2.txt
../group/mtp_imagedp.iby /epoc32/rom/include/mtp_imagedp.iby
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h Thu Jul 22 16:43:05 2010 +0100
@@ -25,6 +25,7 @@
#include <e32base.h>
#include <f32file.h>
#include <e32std.h>
+#include <e32hashtab.h>
#include <mdesession.h>
#include <mtp/mtpprotocolconstants.h>
@@ -74,7 +75,8 @@
void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue, TBool alwaysCreate = ETrue);
//clear the cache
- void ClearCacheL();
+ void ClearAllCache();
+ void ClearCache(TUint aHandle);
void ConvertMTPTimeStr2TTimeL(const TDesC& aTimeString, TTime& aModifiedTime) const;
void StoreThunmnail(TUint aHandle, HBufC8* aData);
@@ -108,6 +110,9 @@
void OpenMdeObjectL();
void ClearThumnailCache();
+ TBool FindPropertiesCache(TUint aObjectHandle);
+ void DestroyPropertiesCahce(TUint aObjectHandle);
+
private:
//define property cache object
@@ -123,7 +128,6 @@
EImagePixHeight = 1,
EImageBitDepth = 2,
EDateCreated = 3,
-
/**
The number of elements.
*/
@@ -138,11 +142,9 @@
const TDesC& DesC(TUint aId) const;
TUint Uint(TUint aId) const;
- TUint ObjectHandle() const;
void SetDesCL(TUint aId, const TDesC& aValue);
- void SetUint(TUint aId, TUint aValue);
- void SetObjectHandle(TUint aObjectHandle);
+ void SetUint(TUint aId, TUint aValue);
private:
@@ -178,11 +180,6 @@
*/
RArray<TUint> iElementsUint;
- /**
- The object handle of owner
- */
- TUint iObjectHandle;
-
static const TElementMetaData KElements[];
};
@@ -211,7 +208,6 @@
MMTPObjectMgr& iObjectMgr;
CMTPObjectMetaData* iObjectInfo; //not owned
TBool iCacheHit;//flag to indicate cache is available
- TBool iNeedParse;//flag to indicate whether we need to parse image file by our self
/*
* Cache thumbnail, thumbnail size is inconsistent in winlogo test
@@ -222,7 +218,8 @@
* Cache the latest image properties which PC send to device,
* it can optimize synce/reverse-sync performance due to reduction of object properties generation
*/
- CMTPImagePropertiesCache* iPropertiesCache;
+ CMTPImagePropertiesCache* iCurrentPropertiesCache;
+ RHashMap<TUint, CMTPImagePropertiesCache*> iPropretiesCacheMap;
};
#endif // CMTPIMAGEDPOBJECTPROPERTYMGR_H
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -121,7 +121,7 @@
//Define RProperty of new pictures for status data provider
_LIT_SECURITY_POLICY_PASS(KAllowReadAll);
- TInt error = RProperty::Define(TUid::Uid(KMTPServerUID), KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll);
+ TInt error = RProperty::Define(KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll);
if (error != KErrNone && error != KErrAlreadyExists)
{
__FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error);
@@ -586,7 +586,7 @@
/**
* We clear property manager cache when receiving session close notification from framework every times
*/
- iPropertyMgr->ClearCacheL();
+ iPropertyMgr->ClearAllCache();
__FLOG(_L8("<< SessionClosedL"));
}
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -45,7 +45,7 @@
const TMTPRequestElementInfo KMTPCopyObjectPolicy[] =
{
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -238,7 +238,10 @@
//add Suid to deleteobjectlist
iDataProvider.AppendDeleteObjectsArrayL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid));
//coverity[unterminated_case]
- case KErrNone:
+ case KErrPathNotFound:
+ //if the file does not exist on device, remove it from objectstore
+ //coverity[fallthrough]
+ case KErrNone:
//add for test
__FLOG(_L8("KErrNone"));
//if the image object is new, we should update new picture count
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -141,7 +141,7 @@
TUint16 thumbFormat;
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleFormat, thumbFormat);
iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EThumbFormat, thumbFormat);
- TUint32 value;
+ TUint32 value(0);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, value);
iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EThumbCompressedSize, value);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleWidth, value);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -363,7 +363,7 @@
case EMTPObjectPropCodeRepresentativeSampleHeight:
case EMTPObjectPropCodeRepresentativeSampleWidth:
{
- TUint32 value;
+ TUint32 value(0);
iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), value, EFalse);
CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, propCode);
propElem.SetUint32L(CMTPTypeObjectPropListElement::EValue, value);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -314,7 +314,7 @@
void CMTPImageDpGetObjectPropValue::ServiceRepresentativeSampleSizeL()
{
- TUint32 representativeSampleSize;
+ TUint32 representativeSampleSize(0);
iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, representativeSampleSize, EFalse);
iMTPTypeUint32.Set(representativeSampleSize);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -45,7 +45,7 @@
const TMTPRequestElementInfo KMTPMoveObjectPolicy[] =
{
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -51,6 +51,9 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"MTPImageDpPropertyMgr");)
+// Indicate how many cache can be stored
+const TUint KCacheThreshold = 16;
+
/**
The properties cache table content.
*/
@@ -112,13 +115,10 @@
break;
}
}
-
- iObjectHandle = KMTPHandleNone;
}
void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::ResetL()
{
- iObjectHandle = KMTPHandleNone;
SetUint(EImagePixWidth, 0);
SetUint(EImagePixHeight, 0);
SetUint(EImageBitDepth, 0);
@@ -137,11 +137,6 @@
return iElementsUint[iElements[aId].iOffset];
}
-TUint CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::ObjectHandle() const
- {
- return iObjectHandle;
- }
-
void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::SetDesCL(TUint aId, const TDesC& aValue)
{
const TElementMetaData& KElement(iElements[aId]);
@@ -157,11 +152,6 @@
iElementsUint[iElements[aId].iOffset] = aValue;
}
-void CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::SetObjectHandle(TUint aObjectHandle)
- {
- iObjectHandle = aObjectHandle;
- }
-
CMTPImageDpObjectPropertyMgr* CMTPImageDpObjectPropertyMgr::NewL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider)
{
CMTPImageDpObjectPropertyMgr* self = new (ELeave) CMTPImageDpObjectPropertyMgr(aFramework, aDataProvider);
@@ -175,7 +165,7 @@
iFramework(aFramework),
iDataProvider(aDataProvider),
iFs(aFramework.Fs()),
- iObjectMgr(aFramework.ObjectMgr())
+ iObjectMgr(aFramework.ObjectMgr())
{
__FLOG_OPEN(KMTPSubsystem, KComponent);
}
@@ -183,7 +173,6 @@
void CMTPImageDpObjectPropertyMgr::ConstructL(MMTPDataProviderFramework& /*aFramework*/)
{
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Entry"));
- iPropertiesCache = CMTPImagePropertiesCache::NewL();
iMetaDataSession = CMdESession::NewL(*this);
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::ConstructL - Exit"));
}
@@ -191,10 +180,13 @@
CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr()
{
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Entry"));
- delete iPropertiesCache;
delete iObject;
delete iMetaDataSession;
delete iThumbnailCache.iThumbnailData;
+
+ //Clear propreties cache map
+ ClearAllCache();
+ iPropretiesCacheMap.Close();
__FLOG(_L8("CMTPImageDpObjectPropertyMgr::~CMTPImageDpObjectPropertyMgr - Exit"));
__FLOG_CLOSE;
}
@@ -212,26 +204,12 @@
/**
* determine whether the cache hit is occured
*/
- if (iPropertiesCache->ObjectHandle() == iObjectInfo->Uint(CMTPObjectMetaData::EHandle))
+ iCacheHit = FindPropertiesCache(iObjectInfo->Uint(CMTPObjectMetaData::EHandle));
+ if (!iCacheHit)
{
- iCacheHit = ETrue;
- }
- else
- {
- iCacheHit = EFalse;
-
- /**
- * if cache miss, we should clear the cache content
- */
- ClearCacheL();
-
- //need parse image file by our self if fail to get properties from MdS
- iNeedParse = ETrue;
-
- //clear previous Mde object
delete iObject;
- iObject = NULL;
- }
+ iObject = NULL;
+ }
}
else
{
@@ -241,13 +219,27 @@
* other operations will not use cache, such as setobjectvalue/setobjectproplist
*/
if (aSaveToCache)
- {
+ {
TUint objectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);
- if (iPropertiesCache->ObjectHandle() != objectHandle)
+ if (FindPropertiesCache(objectHandle))
+ {
+ __FLOG_VA((_L16("SetCurrentObjectL - find object in cache:%u"), objectHandle));
+ iCurrentPropertiesCache->ResetL();
+ }
+ else
{
- iPropertiesCache->ResetL();
+ if (iPropretiesCacheMap.Count() > KCacheThreshold)
+ {
+ // Find the first object handle from cache map and then destory it
+ RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap);
+ DestroyPropertiesCahce(*iter.NextKey());
+ __FLOG_VA((_L16("SetCurrentObjectL - destory object:%u"), objectHandle));
+ }
+
+ iCurrentPropertiesCache = CMTPImagePropertiesCache::NewL();
+ iPropretiesCacheMap.Insert(objectHandle, iCurrentPropertiesCache);
+ __FLOG_VA((_L16("SetCurrentObjectL - create new object:%u"), objectHandle));
}
- iPropertiesCache->SetObjectHandle(objectHandle);
}
}
@@ -304,13 +296,22 @@
iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, aValue);
break;
case EMTPObjectPropCodeWidth:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth, aValue);
+ }
break;
case EMTPObjectPropCodeHeight:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight, aValue);
+ }
break;
case EMTPObjectPropCodeImageBitDepth:
- iPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetUint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth, aValue);
+ }
break;
default:
//nothing to do
@@ -363,7 +364,10 @@
break;
case EMTPObjectPropCodeDateCreated://MdS property
- iPropertiesCache->SetDesCL(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated, aValue);
+ if (iCurrentPropertiesCache != NULL)
+ {
+ iCurrentPropertiesCache->SetDesCL(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated, aValue);
+ }
break;
default:
@@ -403,16 +407,18 @@
aValue = KThumbFormatCode;
break;
case EMTPObjectPropCodeProtectionStatus:
- iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry);
- if (entry.IsReadOnly())
+ {
+ TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), entry);
+ if ( err == KErrNone && entry.IsReadOnly())
{
aValue = EMTPProtectionReadOnly;
}
else
{
aValue = EMTPProtectionNoProtection;
- }
- break;
+ }
+ }
+ break;
default:
aValue = 0;//initialization
//ingore the failure if we can't get properties form MdS
@@ -638,19 +644,19 @@
switch (aProperty)
{
case EMTPObjectPropCodeDateCreated:
- (*(static_cast<CMTPTypeString*>(aValue))).SetL(iPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated));
+ (*(static_cast<CMTPTypeString*>(aValue))).SetL(iCurrentPropertiesCache->DesC(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EDateCreated));
break;
case EMTPObjectPropCodeWidth:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixWidth);
break;
case EMTPObjectPropCodeHeight:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImagePixHeight);
break;
case EMTPObjectPropCodeImageBitDepth:
- *static_cast<TUint32*>(aValue) = iPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth);
+ *static_cast<TUint32*>(aValue) = iCurrentPropertiesCache->Uint(CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::EImageBitDepth);
break;
default:
@@ -956,9 +962,18 @@
iMdeSessionError = aError;
}
-void CMTPImageDpObjectPropertyMgr::ClearCacheL()
+void CMTPImageDpObjectPropertyMgr::ClearAllCache()
{
- iPropertiesCache->ResetL();
+ while (iPropretiesCacheMap.Count())
+ {
+ RHashMap<TUint, CMTPImagePropertiesCache*>::TIter iter(iPropretiesCacheMap);
+ DestroyPropertiesCahce(*iter.NextKey());
+ };
+ }
+
+void CMTPImageDpObjectPropertyMgr::ClearCache(TUint aHandle)
+ {
+ DestroyPropertiesCahce(aHandle);
}
void CMTPImageDpObjectPropertyMgr::OpenMdeObjectL()
@@ -984,3 +999,32 @@
iThumbnailCache.iObjectHandle = KMTPHandleNone;
}
+
+TBool CMTPImageDpObjectPropertyMgr::FindPropertiesCache(TUint aObjectHandle)
+ {
+ TBool ret = EFalse;
+ CMTPImagePropertiesCache** ppCache = iPropretiesCacheMap.Find(aObjectHandle);
+ if (ppCache)
+ {
+ iCurrentPropertiesCache = *ppCache;
+ ret = (iCurrentPropertiesCache != NULL) ? ETrue : EFalse;
+ }
+ else
+ {
+ iCurrentPropertiesCache = NULL;
+ ret = EFalse;
+ }
+
+ return ret;
+ }
+
+void CMTPImageDpObjectPropertyMgr::DestroyPropertiesCahce(TUint aObjectHandle)
+ {
+ CMTPImagePropertiesCache** ppCache = iPropretiesCacheMap.Find(aObjectHandle);
+ if (ppCache)
+ {
+ CMTPImagePropertiesCache* pCache = *ppCache;
+ delete pCache;
+ iPropretiesCacheMap.Remove(aObjectHandle);
+ }
+ }
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -23,6 +23,7 @@
#include <e32const.h>
#include <mtp/mmtpdataproviderframework.h>
+
#include <mtp/cmtpobjectmetadata.h>
#include <mtp/cmtptypefile.h>
#include <mtp/cmtptypeobjectinfo.h>
@@ -752,6 +753,9 @@
{
__FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry"));
TBool result(ETrue);
+
+ delete iFileReceived;
+ iFileReceived = NULL;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
TInt64 objectsize = 0;
@@ -759,8 +763,10 @@
TInt objectsize = 0;
#endif
- iFileReceived->File().Size(objectsize);
-
+ TEntry entry;
+ User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry));
+ objectsize = entry.FileSize();
+
if (objectsize != iObjectSize)
{
__FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize));
@@ -789,34 +795,31 @@
if (iProtectionStatus == EMTPProtectionNoProtection ||
iProtectionStatus == EMTPProtectionReadOnly)
{
- TUint attValue = 0;
- User::LeaveIfError(iFileReceived->File().Att(attValue));
- attValue &= ~(KEntryAttNormal | KEntryAttReadOnly);
-
+ entry.iAtt &= ~(KEntryAttNormal | KEntryAttReadOnly);
if (iProtectionStatus == EMTPProtectionNoProtection)
{
- attValue |= KEntryAttNormal;
+ entry.iAtt |= KEntryAttNormal;
}
else
{
- attValue |= KEntryAttReadOnly;
+ entry.iAtt |= KEntryAttReadOnly;
}
- User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue));
+ User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
}
+
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));
}
-
- iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
+ User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
+
+ 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
@@ -827,10 +830,8 @@
CleanUndoList();
SendResponseL(EMTPRespCodeOK);
- }
+ }
- delete iFileReceived;
- iFileReceived = NULL;
iSuccessful = result;
__FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit"));
@@ -878,7 +879,7 @@
*/
TRAP_IGNORE(
iFramework.ObjectMgr().RemoveObjectL(iReceivedObject->Uint(CMTPObjectMetaData::EHandle));
- iObjectPropertyMgr.ClearCacheL();
+ iObjectPropertyMgr.ClearCache(iReceivedObject->Uint(CMTPObjectMetaData::EHandle));
);
}
--- a/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Thu Jul 22 16:43:05 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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/BWINS/pictbridgeU.DEF Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,27 @@
+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 &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/eabi/pictbridgeU.DEF Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,41 @@
+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>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/pictbridge.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/group/pictbridgeengine.mrp Thu Jul 22 16:43:05 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:
+#
+
+component pictbridgeengine
+
+source \sf\mw\remoteconn\localconnectivityservice\pictbridgeengine
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dps.rh Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* 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";
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsconnectnotifier.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsconst.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* 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
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsdefs.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,483 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsfile.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsoperation.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,312 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsoperation.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsparam.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,225 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsparam.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsptpnotifier.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsscriptreceiver.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsscriptsender.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstate.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,179 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstatemachine.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsstatemachine.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpstransaction.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,192 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpstransaction.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsusbnotifier.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlgenerator.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlparser.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,215 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlparser.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/dpsxmlstring.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/inc/pictbridge.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/rom/pictbridge.iby Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dps.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsconnectnotifier.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsfile.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* 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);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsoperation.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,957 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsparam.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsptpnotifier.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsscriptreceiver.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsscriptsender.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsstate.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,235 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsstatemachine.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* 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")));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpstransaction.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,455 @@
+/*
+* 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));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsusbnotifier.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,329 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlgenerator.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,333 @@
+/*
+* 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")));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlparser.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,445 @@
+/*
+* 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/dpsxmlstring.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,419 @@
+/*
+* 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();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtppictbridgedp/pictbridgeengine/src/pictbridge.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,384 @@
+/*
+* 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/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -42,7 +42,7 @@
const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,28 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.iby Thu Jul 22 16:43:05 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:
+//
+
+/**
+ @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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtp_playbackcontroldp.mrp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,29 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/group/mtpplaybackcontroldp.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,93 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropdesc.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,70 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcgetdevicepropvalue.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,64 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcresetdevicepropvalue.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,73 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcsetdevicepropvalue.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,71 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtppbcskip.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,63 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackcontroldp.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,116 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackmap.h Thu Jul 22 16:43:05 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:
+//
+
+/**
+ @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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/cmtpplaybackproperty.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,93 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpconst.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,56 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontroldpprocessor.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,47 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/inc/mtpplaybackcontrolpanic.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,42 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackcommand.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,114 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackevent.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,77 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/cmtpplaybackparam.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,104 @@
+// 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/inc/mmtpplaybackinterface.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,133 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackcommand.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,319 @@
+// 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackevent.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,140 @@
+// 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/cmtpplaybackparam.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,177 @@
+// 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);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackinterface/src/mmtpplaybackinterface.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,30 @@
+// 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 );
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcommandchecker.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,81 @@
+// 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_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackcontrolimpl.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,315 @@
+// 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackplaylisthelper.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,228 @@
+// 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_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/cmtpplaybackresumehelper.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,125 @@
+// 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_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/inc/mtpplaybackcontrolconst.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,65 @@
+// 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_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcommandchecker.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,209 @@
+// 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;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackcontrolimpl.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,1097 @@
+// 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;
+ }
+
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackplaylisthelper.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,756 @@
+// 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;
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/mtpplaybackmpximplementation/src/cmtpplaybackresumehelper.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,402 @@
+// 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropdesc.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,312 @@
+// 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"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcgetdevicepropvalue.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,242 @@
+// 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"));
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcresetdevicepropvalue.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,177 @@
+// 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"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcsetdevicepropvalue.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,220 @@
+// 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"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtppbcskip.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,164 @@
+// 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"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackcontroldp.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,392 @@
+// 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackmap.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,378 @@
+// 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"));
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/cmtpplaybackproperty.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,265 @@
+// 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,45 @@
+// 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 = "";
+ }
+ };
+ }
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldp_config.rss Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,33 @@
+// 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpimplproxy.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,40 @@
+// 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpdataproviders/mtpplaybackcontroldp/src/mtpplaybackcontroldpprocessor.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,95 @@
+// 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 Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/common/inc/mtpdatacapture.h Thu Jul 22 16:43:05 2010 +0100
@@ -23,13 +23,7 @@
// MTP data caputre defines
-#if defined(__WINS__)
_LIT(KRequestCaptureRootDir, "c:\\test\\data\\");
-#elif defined(__SERIES60_)
-_LIT(KRequestCaptureRootDir, "c:\\test\\data\\");
-#else
-_LIT(KRequestCaptureRootDir, "e:\\test\\data\\");
-#endif
_LIT(KRequestCaptureDirPrefix, "testcase");
_LIT(KIToRDataPhaseOutputFile, "i_to_r_dataphase.dat");
--- a/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h Thu Jul 22 16:43:05 2010 +0100
@@ -69,6 +69,25 @@
*/
const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007;
+#ifdef __MTP_NAVIENGINE_TEST
+//The free size of C-Drive of NaviEngine env is less than 21M,
+//it will block many ONB test cases
+const TInt KFreeSpaceThreshHoldDefaultValue(0);
+const TInt KFreeSpaceExtraReserved(0);
+
+#else
+//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor
+//popup 'Out of memory' note.When syncing music through ovi player,
+//sometimes device screen get freeze with this note
+//Be default, this value is read from Central Respository, if error while
+//reading, use this one
+const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes
+
+//Beside the OOD threshold value, we need to reserve extra disk space
+//for harvest server do the harvest, set this as 1M
+const TInt KFreeSpaceExtraReserved(1024*1024);//1M bytes
+
+#endif
#endif __UIKLAF_INTERNAL_CR_KEYS_H__
Binary file mtpfws/mtpfw/conf/mtpframework.confml has changed
--- a/mtpfws/mtpfw/daemon/client/src/rmtpclient.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/daemon/client/src/rmtpclient.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -117,15 +117,6 @@
// 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 Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/daemon/server/group/mtpserver.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -22,12 +22,9 @@
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
MW_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -73,6 +73,7 @@
{
__FLOG(_L8("~CMTPServer - Entry"));
delete iShutdown;
+ iShutdown = NULL;
iFrameworkSingletons.ConnectionMgr().StopTransports();
iFrameworkSingletons.DpController().UnloadDataProviders();
iFrameworkSingletons.Close();
@@ -139,12 +140,6 @@
if (--iSessionCount==0 && iFrameworkSingletons.ConnectionMgr().TransportCount() == 0)
{
// No active MTP client API sessions remain, start the shutdown timer.
- if (!iShutdown)
- {
- TRAPD(error, iShutdown = CMTPShutdown::NewL());
- __FLOG(_L8("CMTPShutdown Loaded- Entry"));
- UNUSED_VAR(error);
- }
if (iShutdown)
{
__FLOG(_L8("Shutdown Started - Entry"));
@@ -193,6 +188,12 @@
__FLOG(_L8("ConstructL - Entry"));
StartL(KMTPServerName);
iFrameworkSingletons.OpenL();
+ if (!iShutdown)
+ {
+ TRAPD(error, iShutdown = CMTPShutdown::NewL());
+ __FLOG(_L8("CMTPShutdown Loaded- Entry"));
+ UNUSED_VAR(error);
+ }
__FLOG(_L8("ConstructL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/devdp/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -30,7 +30,6 @@
#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 /epoc32/rom/include/mtp_devicedp.iby
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedatastore.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpdevicedatastore.h Thu Jul 22 16:43:05 2010 +0100
@@ -88,6 +88,9 @@
TBool IsConnectMac();
void SetConnectMac(TBool aConnectMac);
+
+ TBool Enumerated() const;
+ void RegisterPendingRequest();
private: // Form CActive
@@ -101,7 +104,6 @@
CMTPDeviceDataStore();
void ConstructL();
- TBool Enumerated() const;
void ExternalizeL(RWriteStream& aWriteStream) const;
void InternalizeL(RReadStream& aReadStream);
const TDesC& PropertyStoreName();
@@ -163,6 +165,7 @@
CMTPTypeArray* iSupportedDevProArray;
TUint8 iFormatOreder;
+
private: // Not owned.
MMTPEnumerationCallback* iCallback;
@@ -172,6 +175,7 @@
MExtnDevicePropDp* iExtnDevicePropDp;
TBool iIsConnectMac;
+ TBool iHasPendingRequest;
};
#endif // CMTPDEVICEDATASTORE_H
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetdeviceinfo.h Thu Jul 22 16:43:05 2010 +0100
@@ -57,7 +57,7 @@
void SetSupportedOperationsL(CMTPDataProviderController& aDpController);
void SetSupportedEventsL(CMTPDataProviderController& aDpController);
- void SetSupportedDevicePropertiesL();
+ void SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController);
void SetSupportedCaptureFormatsL(CMTPDataProviderController& aDpController);
void SetSupportedPlaybackFormatsL(CMTPDataProviderController& aDpController);
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetstorageinfo.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetstorageinfo.h Thu Jul 22 16:43:05 2010 +0100
@@ -30,6 +30,15 @@
//forward declaration
class CMTPTypeStorageInfo;
+//Default drive name used when failed to read drive name from
+//System
+_LIT(KPhoneMemory,"Phone memory");
+_LIT(KMassMemory,"Mass memory");
+_LIT(KMemoryCard,"Memory card");
+_LIT(KNoName,"No name");
+//The last resort for drive name:DriveChar + drive, eg 'A drive'
+_LIT(KDefaultName," drive");
+
/**
Defines device data provider GetStorageInfo request processor
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -35,11 +35,7 @@
// 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.
@@ -438,6 +434,7 @@
if (isCompleted)
{
Schedule(EEnumerated);
+
}
else
{
@@ -453,12 +450,20 @@
break;
case EEnumerated:
+ {
+ if (iHasPendingRequest)
+ {
+ iHasPendingRequest = EFalse;
+ iSingletons.DpController().ExecutePendingRequestL();
+ }
+
if (iCallback)
{
iCallback->NotifyEnumerationCompleteL(iStorageId, KErrNone);
iCallback = NULL;
iStorageId = KMTPNotSpecified32;
}
+ }
break;
case EEnumeratedBatteryLevel :
@@ -483,7 +488,8 @@
CActive(EPriorityStandard),
iBatteryInfoV1Pckg(iBatteryInfoV1),
iPhoneIdV1Pckg(iPhoneIdV1),
- iIsConnectMac(EFalse)
+ iIsConnectMac(EFalse),
+ iHasPendingRequest(EFalse)
{
CActiveScheduler::Add(this);
}
@@ -503,7 +509,7 @@
1. Device friendly name.
*/
iDeviceFriendlyNameDefault = iSingletons.FrameworkConfig().ValueL(CMTPFrameworkConfig::EDeviceFriendlyName);
- iDeviceFriendlyName = CMTPTypeString::NewL(*iDeviceFriendlyNameDefault);
+ iDeviceFriendlyName = CMTPTypeString::NewL();
// 2. Synchronization partner name.
iSyncPartnerNameDefault = iSingletons.FrameworkConfig().ValueL(CMTPFrameworkConfig::ESynchronizationPartnerName);
@@ -1235,3 +1241,10 @@
{
iIsConnectMac = aConnectMac;
}
+
+void CMTPDeviceDataStore::RegisterPendingRequest()
+ {
+ iHasPendingRequest = ETrue;
+ }
+
+
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -101,6 +101,15 @@
void CMTPGetDeviceInfo::ServiceL()
{
__FLOG(_L8("ServiceL - Entry"));
+
+ if (!iDpSingletons.DeviceDataStore().Enumerated())
+ {
+ __FLOG(_L8("MTPExtensionReady not ready, reschedule request"));
+ iDpSingletons.DeviceDataStore().RegisterPendingRequest();
+ RegisterPendingRequest();
+ return;
+ }
+
BuildDeviceInfoL();
SendDataL(*iDeviceInfo);
__FLOG(_L8("ServiceL - Exit"));
@@ -156,7 +165,7 @@
CMTPDataProviderController& dps(iSingletons.DpController());
SetSupportedOperationsL(dps);
SetSupportedEventsL(dps);
- SetSupportedDevicePropertiesL();
+ SetSupportedDevicePropertiesL(dps);
SetSupportedCaptureFormatsL(dps);
SetSupportedPlaybackFormatsL(dps);
@@ -234,11 +243,42 @@
/**
Populates the supported device properties field in the device info data set
*/
-void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL()
+void CMTPGetDeviceInfo::SetSupportedDevicePropertiesL(CMTPDataProviderController& aDpController)
{
- __FLOG(_L8("SetSupportedDevicePropertiesL - Entry"));
- iDeviceInfo->SetL(CMTPTypeDeviceInfo::EDevicePropertiesSupported,
- iDpSingletons.DeviceDataStore().GetSupportedDeviceProperties());
+ __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 - Exit"));
}
@@ -376,6 +416,13 @@
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/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -35,6 +35,8 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"GetDevicePropDesc");)
+_LIT(KSpace, " ");
+
/**
Two-phase constructor.
@param aPlugin The data provider plugin
@@ -273,7 +275,32 @@
CMTPDeviceDataStore& device(iDpSingletons.DeviceDataStore());
iPropDesc->SetStringL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, device.DeviceFriendlyNameDefault());
- iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
+
+ //if device friendly name is blank, which means it is the first time the device get connected,
+ //, so will use "manufacture + model id" firstly; if neither manufacture nor model
+ //id not able to be fetched by API, then use the default device friendly name
+ if ( device.DeviceFriendlyName().Length()<=0 )
+ {
+ if ( device.Manufacturer().Compare(KMTPDefaultManufacturer) && device.Model().Compare(KMTPDefaultModel) )
+ {
+ HBufC* friendlyName = HBufC::NewLC(device.Manufacturer().Length()+1+ device.Model().Length());
+ TPtr ptrName = friendlyName->Des();
+ ptrName.Copy(device.Manufacturer());
+ ptrName.Append(KSpace);
+ ptrName.Append(device.Model());
+ device.SetDeviceFriendlyNameL(ptrName);
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, ptrName);
+ CleanupStack::PopAndDestroy(friendlyName);
+ }
+ else
+ {
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyNameDefault());
+ }
+ }
+ else
+ {
+ iPropDesc->SetStringL(CMTPTypeDevicePropDesc::ECurrentValue, device.DeviceFriendlyName());
+ }
SendDataL(*iPropDesc);
__FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -27,6 +27,8 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"GetDevicePropValue");)
+_LIT(KSpace, " ");
+
/**
Two-phase constructor.
@param aPlugin The data provider plugin
@@ -96,7 +98,33 @@
void CMTPGetDevicePropValue::ServiceDeviceFriendlyNameL()
{
__FLOG(_L8("ServiceDeviceFriendlyNameL - Entry"));
- iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
+ //if device friendly name is blank, which means it is the first time the device get connected,
+ //, so will use "manufacture + model id" firstly; if neither manufacture nor model
+ //id not able to be fetched by API, then use the default device friendly name if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
+ if ( iDpSingletons.DeviceDataStore().DeviceFriendlyName().Length()<=0 )
+ {
+ if ( iDpSingletons.DeviceDataStore().Manufacturer().Compare(KMTPDefaultManufacturer) &&
+ iDpSingletons.DeviceDataStore().Model().Compare(KMTPDefaultModel) )
+ {
+ HBufC* friendlyName = HBufC::NewLC( iDpSingletons.DeviceDataStore().Manufacturer().Length()+1+ iDpSingletons.DeviceDataStore().Model().Length());
+ TPtr ptrName = friendlyName->Des();
+ ptrName.Copy( iDpSingletons.DeviceDataStore().Manufacturer());
+ ptrName.Append(KSpace);
+ ptrName.Append( iDpSingletons.DeviceDataStore().Model());
+ iDpSingletons.DeviceDataStore().SetDeviceFriendlyNameL(ptrName);
+ iString->SetL(ptrName);
+ CleanupStack::PopAndDestroy(friendlyName);
+ }
+ else
+ {
+ iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyNameDefault());
+ }
+ }
+ else
+ {
+ iString->SetL(iDpSingletons.DeviceDataStore().DeviceFriendlyName());
+ }
+
SendDataL(*iString);
__FLOG(_L8("ServiceDeviceFriendlyNameL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -197,10 +197,22 @@
case EMediaFloppy:
if (iDriveInfo.iDriveAtt & KDriveAttRemovable)
{
- storageType = EMTPStorageRemovableRAM;
+ //E: is set as logically removable after eMMC image updated
+ //So here we need to deal with this case to set it as FixedRam
+ if(iDriveInfo.iDriveAtt & KDriveAttInternal)
+ {
+ __FLOG(_L8("removable but internal drive, set as Fixed RAM"));
+ storageType = EMTPStorageFixedRAM;
+ }
+ else
+ {
+ __FLOG(_L8("non internal,set as removable RAM"));
+ storageType = EMTPStorageRemovableRAM;
+ }
}
else
{
+ __FLOG(_L8("Non removable, set as Fixed RAM"));
storageType = EMTPStorageFixedRAM;
}
break;
@@ -309,30 +321,68 @@
__FLOG(_L8("SetStorageDescriptionL - Entry"));
TUint32 storage(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
TInt driveNumber = iFramework.StorageMgr().DriveNumber(storage);
- RBuf volumeName;
- volumeName.CreateL(KMaxFileName);
- volumeName.CleanupClosePushL();
- RMTPDeviceDpSingletons devSingletons;
- devSingletons.OpenL(iFramework);
- CleanupClosePushL(devSingletons);
- TRAPD(resError, devSingletons.ConfigMgr().GetFriendlyVolumeNameL(driveNumber, volumeName));
- if ((KErrNone == resError) && (0 < volumeName.Length()))
- {
- __FLOG(_L8("Using volume name from resource file"));
- CMTPTypeString* mtpDescription = CMTPTypeString::NewLC(volumeName);
- iStorageInfo->SetL(CMTPTypeStorageInfo::EStorageDescription, *mtpDescription);
- CleanupStack::PopAndDestroy(mtpDescription);
- }
- else if (0 < iVolumeInfo.iName.Length())
- {
- __FLOG(_L8("Using standard volume name"));
- CMTPTypeString* mtpDescription = CMTPTypeString::NewLC(iVolumeInfo.iName);
- iStorageInfo->SetL(CMTPTypeStorageInfo::EStorageDescription, *mtpDescription);
- CleanupStack::PopAndDestroy(mtpDescription);
- }
-
- CleanupStack::PopAndDestroy(&devSingletons);
- CleanupStack::PopAndDestroy(&volumeName);
+ __FLOG_1(_L8("driveNumber:%d"),driveNumber);
+
+ CMTPTypeString* mtpDescription = CMTPTypeString::NewLC();
+
+ //Firstly, read name from VolumeInfo
+ if (0 < iVolumeInfo.iName.Length())
+ {
+ __FLOG_1(_L8("Using standard volume name:%S"),&iVolumeInfo.iName);
+ mtpDescription->SetL(iVolumeInfo.iName);
+ }
+ else //If name not set, set name according to type
+ {
+ TMTPTypeUint16 storageType(EMTPStorageUndefined);
+ iStorageInfo->GetL(CMTPTypeStorageInfo::EStorageType,storageType);
+ __FLOG_1(_L8("Set name according to storage type: %d"),storageType.Value());
+
+ switch (storageType.Value())
+ {
+ case EMTPStorageFixedROM:
+ if (driveNumber == EDriveC)//Phone Memory
+ {
+ __FLOG(_L8("drive c"));
+ mtpDescription->SetL(KPhoneMemory);
+ }
+ break;
+ case EMTPStorageRemovableROM:
+ break;
+ case EMTPStorageFixedRAM: // Mass Memory
+ mtpDescription->SetL(KMassMemory);
+ break;
+ case EMTPStorageRemovableRAM: // Memory Card
+ mtpDescription->SetL(KMemoryCard);
+ break;
+ case EMTPStorageUndefined:
+ default:
+ break;
+ }
+
+ //Finally, it the name still not set, use default value:
+ //eg, 'A drive'
+ if(mtpDescription->NumChars() == 0)
+ {
+ TChar driveChar;
+ TInt err = iFramework.Fs().DriveToChar(driveNumber,driveChar);
+ __FLOG_2(_L8("Use default name,driveNumber:%d err:%d"),driveNumber,err);
+ if (err == KErrNone)
+ {
+ TBuf<sizeof(KDefaultName) + 1> driveName;
+ driveName.Append(driveChar);
+ driveName.Append(KDefaultName);
+ mtpDescription->SetL(driveName);
+ }
+ else
+ {
+ mtpDescription->SetL(KNoName);
+ }
+ }
+ }
+
+ iStorageInfo->SetL(CMTPTypeStorageInfo::EStorageDescription,*mtpDescription);
+ CleanupStack::PopAndDestroy(mtpDescription);
+
__FLOG(_L8("SetStorageDescriptionL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -52,6 +52,8 @@
#include "cmtpgetserviceinfo.h"
#include "cmtpgetformatcapabilities.h"
#include "cmtpsetobjectprotection.h"
+#include "cmtpcommonrequestprocessor.h"
+
/**
device data provider mapping table from request ID to factory method of the request processor
*/
@@ -89,7 +91,9 @@
{EMTPOpCodeGetServiceIDs, CMTPGetServiceIds::NewL},
{EMTPOpCodeGetServiceInfo, CMTPGetServiceInfo::NewL},
{EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL},
- {EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL}
+ {EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL},
+ {EMTPOpCodeSetServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>},
+ {EMTPOpCodeDeleteServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -37,7 +37,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -455,7 +455,15 @@
for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i)
{
const TEntry& entry = iEntries[i];
+ TInt len = entry.iName.Length();
+ if(iCurrentPath.Length() + len > KMaxFileName)
+ {
+ __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored."));
+ continue;
+ }
+
iCurrentPath.Append(entry.iName);
+
__FLOG_VA((_L("Process path %S name %S"), &iCurrentPath, &entry.iName));
#ifdef __FLOG_ACTIVE
TBuf8<KMTPMaxFullFileName> tmp;
@@ -478,15 +486,6 @@
}
#endif // __FLOG_ACTIVE
- TInt len = entry.iName.Length();
- TInt totalLen = iCurrentPath.Length();
- if(totalLen > KMaxFileName)
- {
- // Remove filename part
- iCurrentPath.SetLength(totalLen - len);
- __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored."));
- continue;
- }
TUint32 handle = 0;
TMTPFormatCode format;
if(-- iObjectNeedToScan <=0 && iAllRootScaned)
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -38,7 +38,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -717,7 +717,7 @@
iFullPath.LowerCase();
__FLOG_VA((_L8("File Name %S"), &iFullPath));
TParsePtrC file( iFullPath );
- if ( file.ExtPresent() && iExceptionList.Find(file.Ext()) != KErrNotFound)
+ if ( file.ExtPresent() && file.Ext().Length()<=KExtensionLength && iExceptionList.Find(file.Ext()) != KErrNotFound)
{
TUint32 DpId = iFramework.DataProviderId();
HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iFullPath);
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -35,6 +35,7 @@
*/
const TMTPRequestElementInfo KMTPSetObjectProtectionPolicy[] =
{
+ //This policy does not taks effect, see CheckRequestL
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 0, 0, 0},
};
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpcopyobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -33,7 +33,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpmoveobject.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -36,7 +36,7 @@
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0},
{TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},
- {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 1, 0, 0}
+ {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
};
/**
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectinfo.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectinfo.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -35,7 +35,7 @@
const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir | EMTPElementAttrWrite, 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
/**
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectproplist.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsendobjectproplist.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -32,7 +32,7 @@
const TMTPRequestElementInfo KMTPSendObjectPropListPolicy[] =
{
{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeStorageId, EMTPElementAttrWrite, 1, 0, 0},
- {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, (EMTPElementAttrDir | EMTPElementAttrWrite), 2, KMTPHandleAll, KMTPHandleNone}
+ {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 2, KMTPHandleAll, KMTPHandleNone}
};
/**
--- a/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Thu Jul 22 16:43:05 2010 +0100
@@ -39,8 +39,7 @@
USERINCLUDE ../inc
//For UiklafInternalCRKeys.h,should be removed, after we switched to DFs
USERINCLUDE ../../common/inc
-//For mtpframeworkconst.h
-USERINCLUDE ../../inc
+
SOURCEPATH ../src
SOURCE cmtptypearray.cpp
--- a/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/datatypes/interface/cmtptypefile.h Thu Jul 22 16:43:05 2010 +0100
@@ -25,7 +25,7 @@
#include <e32base.h>
#include <f32file.h>
#include <mtp/mmtptype.h>
-
+
/**
Defines the MTP file object data type.
@publishedPartner
@@ -96,11 +96,12 @@
IMPORT_C TInt64 GetByteSent();
private:
- CMTPTypeFile();
- void ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode);
- void ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet);
+ CMTPTypeFile(RFs& aFs);
+ void ConstructL(const TDesC& aName, TFileMode aMode);
+ void ConstructL(const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet);
void ToggleRdWrBuffer();
-
+ void CreateDoubleBufferL(TInt64 aFileSize);
+
protected: // From CActive
void DoCancel();
@@ -108,8 +109,9 @@
TInt RunError(TInt aError);
void RunL();
+
private:
-
+
/**
The read and write data stream states.
*/
@@ -213,6 +215,7 @@
*/
CFileWriter *iFileWriter2;
+ RFs& iFs;
};
#endif // CMTPTYPEFILE_H
--- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -21,8 +21,6 @@
#include <mtp/cmtptypefile.h>
#include <mtp/mtpdatatypeconstants.h>
-#include "mtpframeworkconst.h"
-
//This file is exported from s60 sdk, now just copy it
//to make sure onb can run
#include "UiklafInternalCRKeys.h"
@@ -141,9 +139,9 @@
*/
EXPORT_C CMTPTypeFile* CMTPTypeFile::NewLC(RFs& aFs, const TDesC& aName, TFileMode aMode)
{
- CMTPTypeFile* self = new(ELeave) CMTPTypeFile;
+ CMTPTypeFile* self = new(ELeave) CMTPTypeFile(aFs);
CleanupStack::PushL(self);
- self->ConstructL(aFs, aName, aMode);
+ self->ConstructL(aName, aMode);
return self;
}
@@ -156,9 +154,9 @@
EXPORT_C CMTPTypeFile* CMTPTypeFile::NewLC(RFs& aFs, const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet)
{
- CMTPTypeFile* self = new(ELeave) CMTPTypeFile;
+ CMTPTypeFile* self = new(ELeave) CMTPTypeFile(aFs);
CleanupStack::PushL(self);
- self->ConstructL(aFs, aName, aMode, aRequiredSize, aOffSet);
+ self->ConstructL(aName, aMode, aRequiredSize, aOffSet);
return self;
}
@@ -188,12 +186,10 @@
//file syncing
TInt driveNo;
TDriveInfo driveInfo;
- iFile.Drive(driveNo,driveInfo);
- RFs fs;
+ User::LeaveIfError(iFile.Drive(driveNo,driveInfo));
+
TVolumeInfo volumeInfo;
- fs.Connect();
- fs.Volume(volumeInfo,driveNo);
- fs.Close();
+ User::LeaveIfError(iFs.Volume(volumeInfo,driveNo));
//Read the threshold value from Central Repository and check against it
CRepository* repository(NULL);
@@ -238,16 +234,8 @@
iRemainingDataSize = (TInt64)aSize;//Current implemenation does not support file size with 2 x64
- if(iRemainingDataSize> KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
+
if(iRemainingDataSize> KMTPFileSetSizeChunk)
{
//split the setSize to multiple calling of 512M
@@ -571,28 +559,29 @@
return iByteSent;
}
-CMTPTypeFile::CMTPTypeFile() :
+CMTPTypeFile::CMTPTypeFile(RFs& aFs) :
CActive(EPriorityUserInput), iBuffer1AvailForWrite(ETrue),
- iFileRdWrError(EFalse), iCurrentCommitChunk(NULL, 0)
+ iFileRdWrError(EFalse), iCurrentCommitChunk(NULL, 0),
+ iFs(aFs)
{
CActiveScheduler::Add(this);
}
-void CMTPTypeFile::ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode)
+void CMTPTypeFile::ConstructL(const TDesC& aName, TFileMode aMode)
{
if (aMode & EFileWrite)
{
iFileOpenForRead = EFalse;
- TInt err = iFile.Create(aFs, aName, aMode|EFileWriteDirectIO);
+ TInt err = iFile.Create(iFs, aName, aMode|EFileWriteDirectIO);
if (err != KErrNone)
{
- User::LeaveIfError(iFile.Replace(aFs, aName, aMode|EFileWriteDirectIO));
+ User::LeaveIfError(iFile.Replace(iFs, aName, aMode|EFileWriteDirectIO));
}
}
else
{
iFileOpenForRead = ETrue;
- User::LeaveIfError(iFile.Open(aFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly));
+ User::LeaveIfError(iFile.Open(iFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly));
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
TInt64 size = 0;
#else
@@ -602,35 +591,26 @@
iRemainingDataSize = size;
//For File reading, NO "SetSizeL()" will be called, therefore, create the buffer here.
- if (iRemainingDataSize > KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
}
}
-void CMTPTypeFile::ConstructL(RFs& aFs, const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet)
+void CMTPTypeFile::ConstructL(const TDesC& aName, TFileMode aMode, TInt64 aRequiredSize, TInt64 aOffSet)
{
if (aMode & EFileWrite)
{
iFileOpenForRead = EFalse;
- TInt err = iFile.Create(aFs, aName, aMode|EFileWriteDirectIO);
+ TInt err = iFile.Create(iFs, aName, aMode|EFileWriteDirectIO);
if (err != KErrNone)
{
- User::LeaveIfError(iFile.Replace(aFs, aName, aMode|EFileWriteDirectIO));
+ User::LeaveIfError(iFile.Replace(iFs, aName, aMode|EFileWriteDirectIO));
}
}
else
{
iFileOpenForRead = ETrue;
iOffSet = aOffSet;
- User::LeaveIfError(iFile.Open(aFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly));
+ User::LeaveIfError(iFile.Open(iFs, aName, aMode|EFileReadDirectIO|EFileShareReadersOnly));
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
TInt64 size = 0;
#else
@@ -650,16 +630,7 @@
iRemainingDataSize = iTargetFileSize;
//For File reading, NO "SetSizeL()" will be called, therefore, create the buffer here.
- if (iRemainingDataSize > KMTPFileChunkSizeForLargeFile) //512K
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForLargeFile);
- }
- else
- {
- iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
- }
+ CreateDoubleBufferL(iRemainingDataSize);
}
}
@@ -746,3 +717,46 @@
iBuffer1AvailForWrite = !iBuffer1AvailForWrite;//toggle the flag.
}
+
+/**
+ * Allocate double buffers to write to/read from file
+ * @param aFileSize: the size of the file to be written to or read from
+ * @return void
+ * leave code: KErrNoMemory if there is insufficient memory
+ */
+void CMTPTypeFile::CreateDoubleBufferL(TInt64 aFileSize)
+ {
+ if(aFileSize > KMTPFileChunkSizeForLargeFile) //512KB
+ {
+ TInt err = iBuffer1.CreateMax(KMTPFileChunkSizeForLargeFile);
+ TInt err2 = iBuffer2.CreateMax(KMTPFileChunkSizeForLargeFile);
+ TInt bufferSize = KMTPFileChunkSizeForLargeFile;
+
+ //if one of buffer allocation fails, decrease the buffer size by
+ //a half of it until :
+ //we finally succeed in the allocation Or
+ //the smallest acceptable buffer size KMTPFileChunkSizeForSmallFile(64KB) reaches.
+ while ((err != KErrNone || err2 != KErrNone) && bufferSize != KMTPFileChunkSizeForSmallFile)
+ {
+ iBuffer1.Close();
+ iBuffer2.Close();
+
+ bufferSize /= 2;
+ err = iBuffer1.CreateMax(bufferSize);
+ err2 = iBuffer2.CreateMax(bufferSize);
+ }
+
+ if ( err != KErrNone || err2 != KErrNone)
+ {
+ //We still can not allocate 2*64KB buffer, just leave under this case
+ iBuffer1.Close();
+ iBuffer2.Close();
+ User::Leave(KErrNoMemory);
+ }
+ }
+ else
+ {
+ iBuffer1.CreateMaxL(KMTPFileChunkSizeForSmallFile);
+ iBuffer2.CreateMaxL(KMTPFileChunkSizeForSmallFile);
+ }
+ }
--- a/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -609,9 +609,27 @@
{
User::Leave(KErrArgument);
}
- TUint16 retValue;
- GetValueL(&retValue, sizeof(TUint16));
- return retValue;
+
+ //Workaround for partial deletion issue observed on Windows XP/Windows7.
+ //When send an object from PC to device through Windows explorer, it will
+ //include the 'ProtectionStatus' property in the dataset of 'SendObjectPropList'
+ //command. While syncing through Ovi player or Windows Media Player, this property
+ //will not be included.
+ //When we delete a folder which contains read-only objects,we returns partial
+ //deletion code, because read-only object should not be deleted according to MTP spec.
+ //On receiving this,Windows popup a dialog saying 'device stops response', this really
+ //give user bad experience, to prevent this, we make this workaround here: when dataprovider
+ //query value of 'ProtectionStatus' property,always return EMTPProtectionNoProtection(0x0000).
+ if (EMTPObjectPropCodeProtectionStatus == iPropertyCode)
+ {
+ return EMTPProtectionNoProtection;
+ }
+ else
+ {
+ TUint16 retValue;
+ GetValueL(&retValue, sizeof(TUint16));
+ return retValue;
+ }
default:
User::Leave(KErrArgument);
}
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.txt has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.txt has changed
--- a/mtpfws/mtpfw/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -31,11 +31,7 @@
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)
--- a/mtpfws/mtpfw/inc/cmtpconnectionmgr.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/inc/cmtpconnectionmgr.h Thu Jul 22 16:43:05 2010 +0100
@@ -111,6 +111,10 @@
TMTPBTRemoteDevice iRemoteDevice;
/**
+ * Set ETrue when Resumetransport need to be called.
+ */
+ TBool iResumeCalled;
+ /**
FLOGGER debug trace member variable.
*/
__FLOG_DECLARATION_MEMBER_MUTABLE;
--- a/mtpfws/mtpfw/inc/cmtpobjectstore.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/inc/cmtpobjectstore.h Thu Jul 22 16:43:05 2010 +0100
@@ -27,7 +27,7 @@
#include "mtpframeworkconst.h"
#include "rmtpframework.h"
#include "mtpdebug.h"
-
+#include "cmtpreferencemgr.h"
class CFileStore;
class CMTPHandleAllocator;
class CMTPObjectMetaData;
@@ -155,6 +155,8 @@
}
void DoL(RDbTable& aTable)
{
+ //no need to call GetL already all it in TraverseL
+ iStore.ReferenceMgr().RemoveReferencesL(aTable.ColUint32(EObjectStoreHandleId));
aTable.DeleteL();
iStore.IncTranOpsNumL();
}
@@ -200,6 +202,7 @@
void MarkNonPersistentObjectsL(TUint aDataProviderId, TUint32 aStorageId);
void EstablishDBSnapshotL(TUint32 aStorageId);
void CleanDBSnapshotL(TBool aOnlyRoot = EFalse);
+ void RemoveUndefinedObjectsL();
void ObjectsEnumComplete();
void MarkDPLoadedL(TUint aDataProviderId, TBool aFlag);
@@ -364,6 +367,7 @@
TInt iSnapshotCleanPos;
CSnapshotWorker* iSnapshotWorker;
mutable TFileName iSuidBuf;
+ TBool iCleanUndefined;
/**
FLOGGER debug trace member variable.
*/
--- a/mtpfws/mtpfw/inc/mtpframeworkconst.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/inc/mtpframeworkconst.h Thu Jul 22 16:43:05 2010 +0100
@@ -81,14 +81,5 @@
*/
const TUint KMTPProxyDPID = 2;
-//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor
-//popup 'Out of memory' note.When syncing music through ovi player,
-//sometimes device screen get freeze with this note
-//Be default, this value is read from Central Respository, if error while
-//reading, use this one
-const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes
-//Beside the OOD threshold value, we need to reserve extra disk space
-//for harvest server do the harvest, set this as 1M
-const TInt KFreeSpaceExtraReserved(1024*1024);//1M bytes
#endif // MTPFRAMEWORKCONST_H
--- a/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -24,6 +24,9 @@
// Class constants.
__FLOG_STMT(_LIT8(KComponent,"ConnectionMgr");)
+const TUint KMTPUsbTransportUid = 0x102827B2;
+const TUint KMTPBTTransportUid = 0x10286FCB;
+
/**
CMTPConnectionMgr factory method.
@leave If a failure occurs, one of the system wide error codes.
@@ -40,8 +43,7 @@
CMTPConnectionMgr::~CMTPConnectionMgr()
{
StopTransport( iTransportUid, ETrue );
- iConnections.ResetAndDestroy();
- iSuspendedTransports.Reset();
+ iConnections.ResetAndDestroy();
iSuspendedTransports.Close();
delete iTransportTrigger;
__FLOG_CLOSE;
@@ -98,17 +100,25 @@
void CMTPConnectionMgr::ConnectionCloseComplete(const TUint& /*aConnUid*/)
{
__FLOG(_L8("ConnectionCloseComplete - Entry"));
- ResumeSuspendedTransport();
+ if (iTransportUid.iUid != KMTPUsbTransportUid )
+ {
+ ResumeSuspendedTransport();
+ }
+ else
+ {
+ iResumeCalled = ETrue;
+ }
+
__FLOG(_L8("ConnectionCloseComplete - exit"));
}
EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport)
{
-
- TInt32 bluetoothUid = 0x10286FCB;
-
+ __FLOG(_L8("StartTransportL - Entry"));
+
RUsb usb;
User::LeaveIfError(usb.Connect());
+ __FLOG(_L8("after connect, and before call get currentpersonalityid"));
TInt usbMode;
TUsbServiceState usbStat;
TInt err = usb.GetCurrentPersonalityId(usbMode);
@@ -134,7 +144,7 @@
//When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection.
- if(aTransport.iUid == bluetoothUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
+ if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid)
{
__FLOG(_L8("StartTransportL with parameter!"));
TMTPBTRemoteDeviceBuf tmpdata(iRemoteDevice);
@@ -147,7 +157,7 @@
__FLOG(_L8("StartTransportL without parameter!"));
StartTransportL( aTransport, NULL );
}
-
+ __FLOG(_L8("StartTransportL - Exit"));
}
/**
@@ -164,8 +174,6 @@
{
__FLOG(_L8("StartTransportL - Entry"));
- TInt32 bluetoothUid = 0x10286FCB;
-
if (iTransport)
{
__FLOG(_L8("The transport is not none."));
@@ -178,7 +186,7 @@
else
{
__FLOG_1(_L8("Relaunch the transport 0x%X"), iTransportUid.iUid);
- if(aTransport.iUid == bluetoothUid)
+ if(aTransport.iUid == KMTPBTTransportUid)
{
iTransport->Stop(*this);
delete iTransport;
@@ -218,7 +226,7 @@
iTransportCount++;
- if(iTransportUid.iUid != bluetoothUid)
+ if(iTransportUid.iUid != KMTPBTTransportUid)
{
UnsuspendTransport( iTransportUid );
}
@@ -273,7 +281,9 @@
__FLOG_1(_L8("aTransport is 0x%X"), aTransport.iUid);
- __FLOG_1(_L8("iTransportUid is 0x%X"), aTransport.iUid);
+ __FLOG_1(_L8("iTransportUid is 0x%X"), iTransportUid.iUid);
+
+ TInt transportId = iTransportUid.iUid;
if ( aByBearer )
{
@@ -291,6 +301,13 @@
iTransport = NULL;
iTransportUid = KNullUid;
iTransportCount--;
+ //To be sure Resume is done after StopTransport
+ if( transportId == KMTPUsbTransportUid && iResumeCalled)
+ {
+ ResumeSuspendedTransport();
+ iResumeCalled = EFalse;
+ }
+
}
__FLOG(_L8("StopTransport - Exit"));
@@ -391,6 +408,7 @@
__FLOG_OPEN(KMTPSubsystem, KComponent);
iRemoteDevice.iDeviceAddr = 0;
iRemoteDevice.iDeviceServicePort = 0;
+ iResumeCalled = EFalse;
}
/**
@@ -472,21 +490,28 @@
__FLOG_1(_L8("The count number is %d"), count);
__FLOG_1(_L8("The transportport id is 0x%X"), iTransportUid.iUid);
- TInt32 bluetoothUid = 0x10286FCB;
-
if ( ( count > 0 )
// If the transport was just switched and suspended, it shouldn't be resumed.
- && (( iTransportUid != iSuspendedTransports[count-1] ) || iTransportUid.iUid == bluetoothUid))
+ && (( iTransportUid != iSuspendedTransports[count-1] ) || iTransportUid.iUid == KMTPBTTransportUid))
{
__FLOG( _L8("Found suspended transport(s).") );
if ( !iTransportTrigger )
{
iTransportTrigger = new( ELeave ) CAsyncCallBack( CActive::EPriorityStandard );
}
- __ASSERT_DEBUG( ( !iTransportTrigger->IsActive() ), User::Invariant() );
- TCallBack callback( CMTPConnectionMgr::DoResumeSuspendedTransport, this );
- iTransportTrigger->Set( callback );
- iTransportTrigger->CallBack();
+
+ if ( !iTransportTrigger->IsActive())
+ {
+ __FLOG( _L8("Set call back function!") );
+ TCallBack callback( CMTPConnectionMgr::DoResumeSuspendedTransport, this );
+ iTransportTrigger->Set( callback );
+ iTransportTrigger->CallBack();
+ }
+ else
+ {
+ __FLOG( _L8("Call back has been set!") );
+ }
+
}
__FLOG( _L8("-ResumeSuspendedTransport") );
}
--- a/mtpfws/mtpfw/src/cmtpdataprovider.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpdataprovider.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -556,7 +556,10 @@
}
else
{
- iCurrentTransactionPhase = iCurrentConnection->TransactionPhaseL(iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID));
+ if (iCurrentRequest != NULL)
+ {
+ iCurrentTransactionPhase = iCurrentConnection->TransactionPhaseL(iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID));
+ }
}
__FLOG_VA((_L8("Current transaction phase = 0x%08X"), iCurrentTransactionPhase));
@@ -616,7 +619,8 @@
else if (iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone)
{
__FLOG(_L8("DP Enumeration is not complete"));
-
+ if (iCurrentRequest != NULL)
+ {
TUint16 opCode = iCurrentRequest->Uint16(TMTPTypeRequest::ERequestOperationCode);
switch(opCode)
@@ -669,6 +673,7 @@
default:
break;
}
+ }
}
}
else
@@ -678,16 +683,19 @@
//Make ActiveRequest processor and CancelRequest processing to occur synchronously
if( iCurrentTransactionPhase == ERequestPhase )
- {
- CMTPSession& session(static_cast<CMTPSession&>(iCurrentConnection->SessionWithMTPIdL(iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID))));
- MMTPConnectionProtocol& connection(static_cast<MMTPConnectionProtocol&>(*iCurrentConnection));
+ {
+ if( iCurrentRequest != NULL )
+ {
+ CMTPSession& session(static_cast<CMTPSession&>(iCurrentConnection->SessionWithMTPIdL(iCurrentRequest->Uint32(TMTPTypeRequest::ERequestSessionID))));
+ MMTPConnectionProtocol& connection(static_cast<MMTPConnectionProtocol&>(*iCurrentConnection));
- // Pass transaction to session to check against any pending events
- if ( session.CheckPendingEvent(*iCurrentRequest) )
- {
- //Current request matches a pending event, pass event to connection layer event processing
- connection.ReceivedEventL(session.PendingEvent());
- }
+ // Pass transaction to session to check against any pending events
+ if ( session.CheckPendingEvent(*iCurrentRequest) )
+ {
+ //Current request matches a pending event, pass event to connection layer event processing
+ connection.ReceivedEventL(session.PendingEvent());
+ }
+ }
}
}
--- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -372,7 +372,17 @@
*/
EXPORT_C TInt CMTPDataProviderController::DpId(TUint aUid)
{
- return iDataProviders.FindInOrder(TUid::Uid(aUid), CMTPDataProvider::LinearOrderUid);
+ TInt dpId = KErrNotFound;
+ for (TUint index=0; index < iDataProviders.Count(); index++)
+ {
+ if (iDataProviders[index]->ImplementationUid().iUid == aUid)
+ {
+ dpId = iDataProviders[index]->DataProviderId();
+ break;
+ }
+ }
+
+ return dpId;
}
/**
@@ -839,29 +849,36 @@
__FLOG(_L8("EnumerateDataProviderObjectsL - Entry"));
CMTPDataProvider& dp(DataProviderL(aId));
- if (IsObjectsEnumerationNeededL(dp))
- {
- TBool abnormaldown = ETrue;
- iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EAbnormalDown , abnormaldown);
- if ( (!abnormaldown) && (dp.DataProviderConfig().BoolValue(MMTPDataProviderConfig::EObjectEnumerationPersistent)))
- {
- // Initialize persistent objects store.
+ if (IsObjectsEnumerationNeededL(dp))
+ {
+ TBool abnormaldown = ETrue;
+ iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EAbnormalDown , abnormaldown);
+ if ( (!abnormaldown) && (dp.DataProviderConfig().BoolValue(MMTPDataProviderConfig::EObjectEnumerationPersistent)))
+ {
+ // Initialize persistent objects store.
iSingletons.ObjectMgr().RestorePersistentObjectsL(aId);
- }
+ }
else
- {
- // Mark all non-persistent objects.
- iSingletons.ObjectMgr().MarkNonPersistentObjectsL(aId,iEnumeratingStorages[0]);
- }
-
- // Initiate the data provider enumeration sequence.
- dp.EnumerateObjectsL(iEnumeratingStorages[0]);
- }
- else
- {
- //The DP does not need enumeration this time, so just change the state to go on.
- EnumerationStateChangedL(dp);
- }
+ {
+ // Mark all non-persistent objects.
+ iSingletons.ObjectMgr().MarkNonPersistentObjectsL(aId,iEnumeratingStorages[0]);
+ }
+ if ((KMTPStorageAll == iEnumeratingStorages[0]) || (iSingletons.StorageMgr().ValidStorageId(iEnumeratingStorages[0])))
+ {
+ //Only initiate the data provider enumeration sequence for valid storage or all storage
+ dp.EnumerateObjectsL(iEnumeratingStorages[0]);
+ }
+ else
+ {
+ EnumerationStateChangedL(dp);
+ }
+
+ }
+ else
+ {
+ //The DP does not need enumeration this time, so just change the state to go on.
+ EnumerationStateChangedL(dp);
+ }
__FLOG(_L8("EnumerateDataProviderObjectsL - Exit"));
}
--- a/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -180,7 +180,7 @@
}
//Save the AbnormalDown state to ETrue
- User::LeaveIfError(iRepository->Set(EAbnormalDown, KStartupInitValue ));
-
+ //if connect the phone to PC while backup, this will leave.
+ TRAP_IGNORE(iRepository->Set(EAbnormalDown, KStartupInitValue ));
}
--- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -25,7 +25,6 @@
#include <mtp/tmtptypeuint32.h>
#include "cmtphandleallocator.h"
#include "cmtpobjectstore.h"
-#include "cmtpreferencemgr.h"
#include "dbutility.h"
#include "cmtpdataprovidercontroller.h"
#include "cmtpdataprovider.h"
@@ -54,6 +53,8 @@
const TInt KMaxLimitCompactInEnumeration = 2048;
const TInt KMaxLimitCompactAfterEnumeration = 1024;
const TInt KSnapshotGranularity = 128;
+const TInt KMaxLimitSnapshotSize = 50000;
+
@@ -496,9 +497,15 @@
else
{
aObject.SetUint(CMTPObjectMetaData::EHandle, handle);
- needUpdateOwner = ETrue;
- //while enumerating, we ignore the repeatedly INSERT operations.
- //User::Leave(KErrAlreadyExists);
+ CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC());
+ if(ObjectL(aObject.DesC(CMTPObjectMetaData::ESuid), *object))
+ {
+ if(object->Uint(CMTPObjectMetaData::EDataProviderId) != aObject.Uint(CMTPObjectMetaData::EDataProviderId))
+ {
+ needUpdateOwner = ETrue;
+ }
+ }
+ CleanupStack::PopAndDestroy(object);
}
__FLOG_VA(_L8("Not Found in Snapshot"));
}
@@ -768,7 +775,7 @@
}
iCachedSuidHash = 0;
iCachedHandle = 0;
-
+ iReferenceMgr->RemoveReferencesL(aHandle.Value());
iBatched.DeleteL();
__FLOG(_L8("RemoveObjectL From iBacthed"));
IncTranOpsNumL();
@@ -787,6 +794,8 @@
}
iCachedSuidHash = 0;
iCachedHandle = 0;
+ //no need to call GetL already all it in LocateBySuidL
+ iReferenceMgr->RemoveReferencesL(iBatched_SuidHashID.ColUint32(EObjectStoreHandleId));
iBatched_SuidHashID.DeleteL();
IncTranOpsNumL();
}
@@ -837,6 +846,8 @@
void CMTPObjectStore::CleanL()
{
__FLOG(_L8("CleanL - Entry"));
+
+ RemoveUndefinedObjectsL();
Swi::RSisRegistrySession sisSession;
User::LeaveIfError(sisSession.Connect());
CleanupClosePushL(sisSession);
@@ -1375,6 +1386,39 @@
__FLOG(_L8("CleanDBSnapshotL Exit"));
}
+void CMTPObjectStore::RemoveUndefinedObjectsL()
+ {
+ __FLOG(_L8("CompactDBSnapshotL Entry"));
+
+ if (iCleanUndefined)
+ {
+ return;
+ }
+
+ TInt32 count = 0;
+ RDbTable temp;
+ CleanupClosePushL(temp);
+ User::LeaveIfError(temp.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable));
+ count = temp.CountL(RDbRowSet::EQuick);
+
+ __FLOG_VA((_L8("Count before deletion %d "), count));
+ CleanupStack::PopAndDestroy(&temp);
+
+ if (count > KMaxLimitSnapshotSize)
+ {
+ // Delete all object with undefined format
+ _LIT(KSQLDeleteObjectText, "DELETE FROM HandleStore WHERE FormatCode = %u");
+ iSqlStatement.Format(KSQLDeleteObjectText, EMTPFormatCodeUndefined);
+ User::LeaveIfError(iDatabase.Execute(iSqlStatement));
+ }
+
+ iCleanUndefined = ETrue;
+
+
+ __FLOG(_L8("CompactDBSnapshotL Exit"));
+ }
+
+
CMTPObjectStore::CEnumertingCacheItem::CEnumertingCacheItem(TUint32 aSuidHash, TUint32 aHandle, TUint32 aParent, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
{
iObjSuiIdHash = aSuidHash;
--- a/mtpfws/mtpfw/src/cmtpstoragemgr.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpstoragemgr.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -348,54 +348,8 @@
EXPORT_C TUint32 CMTPStorageMgr::DefaultStorageId() const
{
__FLOG(_L8("DefaultStorageId - Entry"));
-
- TUint32 ret = iDefaultStorageId;
- TBool check = EFalse;
- TInt driveNo = DriveNumber(ret);
- const TUint KMinFreeSpace(1024 * 512);
- if( (KErrNotFound == driveNo) || ( !IsReadWriteStorage(ret) ) )
- {
- check = ETrue;
- }
- else
- {
- TVolumeInfo volumeInfo;
- if(iSingletons.Fs().Volume(volumeInfo, driveNo) != KErrNone)
- {
- check = ETrue;
- }
- else if (volumeInfo.iFree < KMinFreeSpace)
- {
- check = ETrue;
- }
- }
-
- if(check)
- {
- const TUint KCount(iMapDriveToStorage.Count());
- for (TInt i = 0; i < KCount; i++)
- {
- if (iMapDriveToStorage[i] == KErrNotFound)
- {
- continue;
- }
- TVolumeInfo volume;
- if( !IsReadWriteStorage(iMapDriveToStorage[i])
- || (iSingletons.Fs().Volume(volume, i) != KErrNone) )
- {
- continue;
- }
-
- if (volume.iFree > KMinFreeSpace )
- {
- ret = iMapDriveToStorage[i];
- break;
- }
- }
- }
-
__FLOG(_L8("DefaultStorageId - Exit"));
- return ret;
+ return iDefaultStorageId;
}
EXPORT_C TInt CMTPStorageMgr::DriveNumber(TUint32 aStorageId) const
--- a/mtptransports/mtpcontroller/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpcontroller/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -22,7 +22,6 @@
PRJ_PLATFORMS
ARMV5
-WINSCW
PRJ_EXPORTS
mtp_controller.iby /epoc32/rom/include/mtp_controller.iby
--- a/mtptransports/mtpptpiptransport/ptpipdatatypes/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpptpiptransport/ptpipdatatypes/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -21,7 +21,6 @@
PRJ_PLATFORMS
ARMV5
-winscw
PRJ_EXPORTS
--- a/mtptransports/mtpptpiptransport/ptpipplugin/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpptpiptransport/ptpipplugin/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -21,7 +21,6 @@
PRJ_PLATFORMS
ARMV5
-winscw
PRJ_EXPORTS
--- a/mtptransports/mtpusbtransport/usbsic_cc/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpusbtransport/usbsic_cc/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -25,6 +25,5 @@
PRJ_EXPORTS
PRJ_MMPFILES
-#ifndef WINSCW
mtpusbsiccc.mmp
-#endif
+
--- a/mtptransports/mtpusbtransport/usbsic_imp/group/bld.inf Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpusbtransport/usbsic_imp/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -25,6 +25,5 @@
PRJ_EXPORTS
PRJ_MMPFILES
-#ifndef WINSCW
mtpusbsicimp.mmp
-#endif
+
--- a/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Thu Jul 22 16:43:05 2010 +0100
@@ -53,6 +53,9 @@
void CancelReceiveL(TInt aReason);
void CancelSendL(TInt aReason);
+ void FlushRxDataL();
+ void FlushBufferedRxDataL();
+
protected:
CMTPUsbEpBase(TUint aId, TPriority aPriority, CMTPUsbConnection& aConnection);
@@ -92,7 +95,6 @@
TBool ValidateUSBHeaderL();
void InitiateFirstChunkReceiveL();
void ProcessFirstReceivedChunkL();
- void FlushRxDataL();
protected: // Owned
@@ -204,7 +206,6 @@
*/
TUint64 iDataLength;
-
private: // Not owned
/**
--- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -138,14 +138,23 @@
// Update the transaction state.
SetBulkTransactionState(EDataIToRPhase);
- // Setup the bulk container and initiate the bulk data receive sequence.
- iUsbBulkContainer->SetPayloadL(&aData);
-
- //Expected containerType pre-setup here in case we don't receive IToR dataphase at all so
- //Cancel operation can trigger right call inside ReceiveBulkDataCompleteL().
- iUsbBulkContainer->SetUint16L(CMTPUsbContainer::EContainerType, EMTPUsbContainerTypeDataBlock);
-
- static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->ReceiveBulkDataL(*iUsbBulkContainer);
+ if (iIsCancelReceived) //cancel received
+ {
+ __FLOG(_L8("Transaction has been cancelled, just flush trash data and complete"));
+ static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->FlushRxDataL();
+ BoundProtocolLayer().ReceiveDataCompleteL(KErrCancel, aData, iMTPRequest);
+ }
+ else
+ {
+ // Setup the bulk container and initiate the bulk data receive sequence.
+ iUsbBulkContainer->SetPayloadL(&aData);
+
+ //Expected containerType pre-setup here in case we don't receive IToR dataphase at all so
+ //Cancel operation can trigger right call inside ReceiveBulkDataCompleteL().
+ iUsbBulkContainer->SetUint16L(CMTPUsbContainer::EContainerType, EMTPUsbContainerTypeDataBlock);
+
+ static_cast<CMTPUsbEpBulkOut*>(iEndpoints[EMTPUsbEpBulkOut])->ReceiveBulkDataL(*iUsbBulkContainer);
+ }
__FLOG(_L8("ReceiveDataL - Exit"));
}
@@ -472,11 +481,9 @@
#endif
isResponseTransactionCancelledNeeded = true;
- if( BoundProtocolLayer().TransactionPhaseL(iMTPSessionId) > EIdlePhase )
+ TMTPTransactionPhase transPhase = BoundProtocolLayer().TransactionPhaseL(iMTPSessionId);
+ if( transPhase > EIdlePhase && transPhase < ECompletingPhase )
{
-
-
-
iMTPEvent.Reset();
iMTPEvent.SetUint16(TMTPTypeEvent::EEventCode, iUsbControlRequestCancelData.Uint16(TMTPUsbControlRequestCancelData::ECancellationCode));
iMTPEvent.SetUint32(TMTPTypeEvent::EEventSessionID, iMTPSessionId);
@@ -496,45 +503,27 @@
BoundProtocolLayer().ReceivedEventL(iMTPEvent);
}
}
+ else if (transPhase == ECompletingPhase)
+ {
+ __FLOG(_L8("cancel event received at completing phase, flush rx data"));
+
+ //flush rx data.
+ iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL();
+ }
else
{
-
- #ifdef _DEBUG
- RDebug::Print(_L("cancel evnet received at idle state, stop data EPs, flush rx data, restart data eps,statusOK\n"));
- #endif
-
+ __FLOG(_L8("cancel event received at idle phase, stop data EPs, flush rx data, restart data eps"));
+
// stop data endpoint
DataEndpointsStop();
- //flush rx data
- TInt nbytes = 0;
- TInt err = iLdd.QueryReceiveBuffer(EndpointNumber(EMTPUsbEpBulkOut), nbytes);
- #ifdef _DEBUG
- RDebug::Print(_L("QueryReceiveBuffer()-----err is %d , nbytes is %d"), err, nbytes);
- #endif
-
- // has data, read it
- if( (err == KErrNone) && (nbytes > 0) )
- {
- // create the read buff
- RBuf8 readBuf;
- readBuf.CreateL(nbytes);
- // synchronously read the data
- TRequestStatus status;
- iLdd.ReadOneOrMore(status, EndpointNumber(EMTPUsbEpBulkOut), readBuf);
- User::WaitForRequest(status);
- if (KErrNone == status.Int())
- {
- #ifdef _DEBUG
- RDebug::Print(_L("%d bytes is flushed"), nbytes);
- #endif
- }
- readBuf.Close();
- }
+ //flush rx data.
+ iEndpoints[EMTPUsbEpBulkOut]->FlushRxDataL();
+
// initiate bulk request sequence.
- InitiateBulkRequestSequenceL();
-
- SetDeviceStatus(EMTPUsbDeviceStatusOK);
+ InitiateBulkRequestSequenceL();
+
+ SetDeviceStatus(EMTPUsbDeviceStatusOK);
}
}
@@ -1052,6 +1041,7 @@
CMTPUsbEpControl& ctrl(*static_cast<CMTPUsbEpControl*>(iEndpoints[EMTPUsbEpControl]));
if (!ctrl.Stalled())
{
+
ctrl.ReceiveControlRequestSetupL(iUsbControlRequestSetup);
}
__FLOG(_L8("InitiateControlRequestSequenceL - Exit"));
@@ -1264,7 +1254,7 @@
@param aRequest The USB SIC class specific request setup data.
@leave One of the system wide error codes, if a processing failure occurs.
*/
-void CMTPUsbConnection::ProcessControlRequestDeviceStatusL(const TMTPUsbControlRequestSetup& aRequest)
+void CMTPUsbConnection::ProcessControlRequestDeviceStatusL(const TMTPUsbControlRequestSetup& /*aRequest*/)
{
__FLOG(_L8("ProcessControlRequestDeviceStatusL - Entry"));
iUsbControlRequestDeviceStatus.Reset();
@@ -1400,6 +1390,7 @@
case KErrUsbDeviceClosing:
case KErrUsbCableDetached:
case KErrUsbDeviceBusReset:
+ case KErrUsbEpNotReady:
// Interface state is changing (@see RunL).
break;
@@ -1678,7 +1669,6 @@
SetBulkTransactionState(EUndefined);
SetConnectionState(EIdle);
SetSuspendState(ENotSuspended);
- SetDeviceStatus(EMTPUsbDeviceStatusBusy);
}
__FLOG(_L8("StopConnection - Exit"));
@@ -1697,6 +1687,9 @@
{
// Stop all data transfer activity.
DataEndpointsStop();
+
+ //flush buffered rx data.
+ iEndpoints[EMTPUsbEpBulkOut]->FlushBufferedRxDataL();
}
ControlEndpointStop();
@@ -1855,12 +1848,24 @@
ifc().iClass.iProtocolNum = KMTPUsbInterfaceProtocolSIC;
ifc().iTotalEndpointsUsed = KMTPUsbRequiredNumEndpoints;
- // Allocate 512KB buffer for OUT EndPoint, and 64KB for IN EndPoint
+ // Allocate 512KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint
TUint32 bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTMaximum;
// Write the active interface descriptor.
- User::LeaveIfError(iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority));
-
+ TInt err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority);
+
+ if (err == KErrNoMemory)
+ {
+ __FLOG(_L8("NoMem when setinterface, try with lower priority"));
+ // Allocate 64KB*2 buffer for OUT EndPoint, and 64KB for IN EndPoint
+ bandwidthPriority = EUsbcBandwidthINPlus2 | EUsbcBandwidthOUTPlus2;
+ err = iLdd.SetInterface(KMTPUsbAlternateInterface, ifc, bandwidthPriority);
+ __FLOG_1(_L8("setinterface return for lower priority:%d"),err);
+ }
+
+ __FLOG_1(_L8("setinterface error code:%d"),err);
+ User::LeaveIfError(err);
+
__FLOG(_L8("SetInterfaceDescriptorL - Exit"));
}
--- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Fri Jun 11 16:26:25 2010 +0100
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Thu Jul 22 16:43:05 2010 +0100
@@ -73,7 +73,7 @@
iReceiveData(NULL, 0),
iSendChunkData(NULL, 0),
iSendData(NULL, 0),
- iIsFirstChunk(EFalse),
+ iIsFirstChunk(EFalse),
iConnection(aConnection)
{
CActiveScheduler::Add(this);
@@ -254,7 +254,6 @@
Cancel();
}
-
__ASSERT_DEBUG(iState == EIdle, Panic(EMTPUsbBadState));
iReceiveDataSink = &aSink;
@@ -528,6 +527,12 @@
TUint16 containerType(Connection().BulkContainer().Uint16L(CMTPUsbContainer::EContainerType));
iDataLength = Connection().BulkContainer().Uint32L(CMTPUsbContainer::EContainerLength);
+#ifdef __FLOG_ACTIVE
+ TUint32 transactionId(Connection().BulkContainer().Uint32L(CMTPUsbContainer::ETransactionID));
+ TUint16 code(Connection().BulkContainer().Uint16L(CMTPUsbContainer::ECode));
+ __FLOG_VA((_L8("ContainerLength = %lu, containerType = 0x%x, code = 0x%x, transactionID = 0x%x"), iDataLength, containerType, code, transactionId));
+#endif
+
//Due to an issue of Windows OS, the value of CMTPUsbContainer::EContainerLength is incorrect if the
//object >= 4G-12. The value should be KMaxTUint32 in this kind of cases, but in current Windows
//implementation it will be a value between 0 and 11.
@@ -540,23 +545,14 @@
__FLOG_VA((_L8("containerType = %u , dataLength = %lu bytes"), containerType, iDataLength));
- if (iDataLength >= KUSBHeaderSize &&
- (containerType == EMTPUsbContainerTypeCommandBlock || containerType == EMTPUsbContainerTypeDataBlock))
- {
- result = ETrue;
- iDataCounter = 0;
-#ifdef _DEBUG
- RDebug::Print(_L("Find the valid usb header------------------------------------------------------\n"));
- TUint16 code(Connection().BulkContainer().Uint16L(CMTPUsbContainer::ECode));
- TUint32 transactionID(Connection().BulkContainer().Uint32L(CMTPUsbContainer::ETransactionID));
- RDebug::Print(_L("ContainerLength = 0x%x, containerType = 0x%x , code = 0x%x , transactionID = 0x%x "), iDataLength, containerType, code, transactionID);
- }
- else
- {
- RDebug::Print(_L("inValid usb Header read..........................................................."));
-#endif
- }
- __FLOG(_L8("CMTPUsbEpBase::ValidateUSBHeader - Exit"));
+ if (iDataLength >= KUSBHeaderSize &&
+ (containerType == EMTPUsbContainerTypeCommandBlock || containerType == EMTPUsbContainerTypeDataBlock))
+ {
+ result = ETrue;
+ iDataCounter = 0;
+ }
+
+ __FLOG_VA((_L8("CMTPUsbEpBase::ValidateUSBHeader - Exit with the result of %d"), result));
return result;
}
@@ -600,28 +596,19 @@
// USB Header validation
if (!ValidateUSBHeaderL())
{
- // If device has received trash data, flush the rest of the packet and try again.
- // This will occur when cancelling a transfer and the PC sends buffered data after
- // the cancellation.
- TRequestStatus status;
- do
- {
- // Keep looking for headers.
- // The case we are trying to catch is when we have 12 garbage bytes followed by 12 good bytes.
- // In this case the ReadOneOrMore is acting on the next packet rather than the current packet.
- // If the garbage data is a multiple of 12 bytes, we should still be able to catch the next good
- // header. Otherwise the ReadOneOrMore will return will <12 bytes and we will fall through
- // to the retry code below.
- iReceiveData.Zero();
- Connection().Ldd().ReadOneOrMore(status, EndpointNumber(), iReceiveData, KUSBHeaderSize);
- User::WaitForRequest(status);
- } while (iReceiveData.Length()==KUSBHeaderSize && !ValidateUSBHeaderL());
+ //trash data, continue to flush.
+ TRequestStatus status;
+ RBuf8 readBuf;
+ readBuf.CreateL(KMaxPacketTypeBulkHS);
+ Connection().Ldd().ReadPacket(status, EndpointNumber(), readBuf, KMaxPacketTypeBulkHS);
+ User::WaitForRequest(status);
+ RDebug::Print(_L("CMTPUsbEpBase::ProcessFirstReceivedChunkL(), trash data length = %d"), readBuf.Length());
+ readBuf.Close();
+
+ InitiateFirstChunkReceiveL();
+ return;
+
- if(!ValidateUSBHeaderL())
- {
- InitiateFirstChunkReceiveL();
- return;
- }
}
if ((iDataLength - KUSBHeaderSize) == 0)
@@ -1034,7 +1021,7 @@
void CMTPUsbEpBase::FlushRxDataL()
{
-
+ __FLOG(_L8("FlushRxDataL - Entry"));
// create the read buff
RBuf8 readBuf;
readBuf.CreateL(KFlushBufferMaxLen);
@@ -1046,27 +1033,42 @@
// get the data size in the receive buffer ready to read
TInt nbytes = 0;
TInt err = Connection().Ldd().QueryReceiveBuffer(EndpointNumber(), nbytes);
-#ifdef _DEBUG
- RDebug::Print(_L("FlushRxDataL()--1---err is %d , nbytes is %d"), err, nbytes);
-#endif
+
+ __FLOG_VA((_L8("FlushRxDataL()--1---err is %d , nbytes is %d"), err, nbytes));
// has data, read it
if( (err == KErrNone) && (nbytes > 0) )
- {
-
+ {
// synchronously read the data
TRequestStatus status;
Connection().Ldd().ReadOneOrMore(status, EndpointNumber(), readBuf);
User::WaitForRequest(status);
if(status.Int() != KErrNone) break;
-
- // whenever some data read, reset the rest wait time .
+
+#ifdef __FLOG_ACTIVE
+ TInt length = readBuf.Length();
+ __FLOG_VA((_L8("The length of trash data is %d"), length));
+
+ __FLOG(_L8("Begining of trash data"));
+ for (int i=0; i<4&&(i*4+4)<=length; i++)
+ {
+ __FLOG_VA((_L8("0x%x 0x%x 0x%x 0x%x"), readBuf[i*4], readBuf[i*4+1], readBuf[i*4+2], readBuf[i*4+3]));
+ }
+
+ __FLOG(_L8("Residual of trash data if any"));
+ TInt residualLength = length%512;
+ for (int i=0; i<4&&(i*4+4)<=residualLength; i++)
+ {
+ TInt beginIndex = length - residualLength;
+ __FLOG_VA((_L8("0x%x 0x%x 0x%x 0x%x"), readBuf[beginIndex + i*4], readBuf[beginIndex + i*4+1], readBuf[beginIndex + i*4+2], readBuf[beginIndex + i*4+3]));
+ }
+#endif
+
+ // whenever some data read, reset the rest wait time.
uRestTimeToWait = INTERVAL_FOR_FLUSH_TRASH_DATA;
-
-#ifdef _DEBUG
- RDebug::Print(_L("FlushRxDataL()---Reset the rest wait time"));
-#endif
+
+ __FLOG(_L8("FlushRxDataL()---Reset the rest wait time"));
}
else
{
@@ -1075,13 +1077,36 @@
// reduce the rest time to wait
uRestTimeToWait -= INTERVAL_FOR_READ_TRASH_DATA ;
}
-
-#ifdef _DEBUG
- RDebug::Print(_L("FlushRxDataL()---uRestTimeToWait is %d"), uRestTimeToWait);
-#endif
+
+ __FLOG_VA((_L8("FlushRxDataL()---uRestTimeToWait is %d"), uRestTimeToWait));
}while( uRestTimeToWait > 0);
readBuf.Close();
-
+ __FLOG(_L8("FlushRxDataL - Exit"));
}
+
+/*
+ * The difference with FlushRxDataL() is FlushBufferedRxDataL only flush current buffered trash data
+ * if currently no data is buffered in usb driver, just return rather than wait some time like what
+ * FlushRxDataL() does
+ */
+void CMTPUsbEpBase::FlushBufferedRxDataL()
+ {
+ //flush buffered rx data
+ TInt nbytes = 0;
+ TInt err = Connection().Ldd().QueryReceiveBuffer(EndpointNumber(), nbytes);
+
+ // has data, read it
+ if( (err == KErrNone) && (nbytes > 0) )
+ {
+ // create the read buff
+ RBuf8 readBuf;
+ readBuf.CreateL(nbytes);
+ // synchronously read the data
+ TRequestStatus status;
+ Connection().Ldd().ReadOneOrMore(status, EndpointNumber(), readBuf);
+ User::WaitForRequest(status);
+ readBuf.Close();
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dialup_connection_status_api/dialup_connection_status_api.metaxml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,17 @@
+<?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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dialup_connection_status_api/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dialup_connection_status_api/group/dialup_connection_status_api.mrp Thu Jul 22 16:43:05 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:
+#
+
+component dialup_connection_status_api
+
+source \sf\mw\remoteconn\localconnectivityservice\dialup_connection_status_api
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dialup_connection_status_api/inc/dundomainpskeys.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dun_secondary_display_notification_api/dun_secondary_display_notification_api.metaxml Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,17 @@
+<?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>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dun_secondary_display_notification_api/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dun_secondary_display_notification_api/group/dun_secondary_display_notification_api.mrp Thu Jul 22 16:43:05 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:
+#
+
+component dun_secondary_display_notification_api
+
+source \sf\mw\remoteconn\localconnectivityservice\dun_secondary_display_notification_api
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/dun_secondary_display_notification_api/inc/secondarydisplay/dunsecondarydisplayapi.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/group/generic_hid_api.mrp Thu Jul 22 16:43:05 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:
+#
+
+component generic_hid_api
+
+source \sf\mw\remoteconn\localconnectivityservice\generic_hid_api
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidcollection.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,272 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidfield.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,732 @@
+/*
+* 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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidgeneric.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,339 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidinterfaces.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,704 @@
+/*
+* 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
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidreportroot.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidtranslate.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/generic_hid_api/inc/hidvalues.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,127 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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: Includes all the Domain API specific bld.inf files, which
+* export files.
+*
+*/
+
+
+
+#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"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/group/locod_bearer_plugin_api.mrp Thu Jul 22 16:43:05 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:
+#
+
+component locod_bearer_plugin_api
+
+source \sf\mw\remoteconn\localconnectivityservice\locod_bearer_plugin_api
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearer.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerplugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerplugin.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginobserver.h Thu Jul 22 16:43:05 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: 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginparams.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,80 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodbearerpluginparams.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_bearer_plugin_api/inc/locodplugin.hrh Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/group/bld.inf Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/group/locod_service_plugin_api.mrp Thu Jul 22 16:43:05 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:
+#
+
+component locod_service_plugin_api
+
+source \sf\mw\remoteconn\localconnectivityservice\locod_service_plugin_api
+
+notes_source \component_defs\release.src
+
+ipr E
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/inc/locodserviceplugin.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/inc/locodserviceplugin.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginobserver.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginparams.h Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/remoteconn_plat/locod_service_plugin_api/inc/locodservicepluginparams.inl Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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_5_1.dtd Thu Jul 22 16:43:05 2010 +0100
@@ -0,0 +1,88 @@
+ <!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>