Revision: 201003
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 20:06:52 +0200
changeset 1 ffb8e2ddd8dc
parent 0 0ce1b5ce9557
child 3 d0ad4c067c0c
child 9 f935d51494d1
child 11 7aed01f358af
Revision: 201003 Kit: 201003
systemswstubs/featuremanagerstub/data/10205058.rss
systemswstubs/featuremanagerstub/group/bld.inf
systemswstubs/featuremanagerstub/group/featmgrstubplugin.mmp
systemswstubs/featuremanagerstub/inc/featmgrplugin.h
systemswstubs/featuremanagerstub/inc/plugintimer.h
systemswstubs/featuremanagerstub/inc/trace.h
systemswstubs/featuremanagerstub/rom/featmgrstubplugin.iby
systemswstubs/featuremanagerstub/src/featmgrplugin.cpp
systemswstubs/featuremanagerstub/src/plugintimer.cpp
systemswstubs/featuremanagerstub/src/proxy.cpp
systemswstubs/sensorchannelsreference/group/bld.inf
systemswstubs/sensorchannelsreference/inc/sensrvproprietarychannels.h
systemswstubs/sensorchannelsreference/inc/sensrvproprietarydatatypes.h
systemswstubs/sensorchannelsreference/inc/sensrvproprietaryproperties.h
systemswstubs/ssyreference/data/10205089.rss
systemswstubs/ssyreference/group/1020507E.txt
systemswstubs/ssyreference/group/SsyReferenceConfig.xml
systemswstubs/ssyreference/group/SsyReferenceConfigR.xml
systemswstubs/ssyreference/group/SsyReference_Config_template.xml
systemswstubs/ssyreference/group/bld.inf
systemswstubs/ssyreference/group/ssyreferenceplugin.mmp
systemswstubs/ssyreference/inc/ssyreferencechannel.h
systemswstubs/ssyreference/inc/ssyreferencechanneldataprovider.h
systemswstubs/ssyreference/inc/ssyreferencecmdhandler.h
systemswstubs/ssyreference/inc/ssyreferenceconfig.h
systemswstubs/ssyreference/inc/ssyreferencecontrol.h
systemswstubs/ssyreference/inc/ssyreferencepropertyprovider.h
systemswstubs/ssyreference/inc/ssyreferencetrace.h
systemswstubs/ssyreference/rom/ssyreference.iby
systemswstubs/ssyreference/src/ECOMEntryPoint.cpp
systemswstubs/ssyreference/src/ssyreferencechannel.cpp
systemswstubs/ssyreference/src/ssyreferencechanneldataprovider.cpp
systemswstubs/ssyreference/src/ssyreferencecmdhandler.cpp
systemswstubs/ssyreference/src/ssyreferenceconfig.cpp
systemswstubs/ssyreference/src/ssyreferencecontrol.cpp
systemswstubs/ssyreference/src/ssyreferencepropertyprovider.cpp
systemswstubs/tiltcompensationstub/bwins/tiltcompensationu.def
systemswstubs/tiltcompensationstub/eabi/tiltcompensationu.def
systemswstubs/tiltcompensationstub/group/bld.inf
systemswstubs/tiltcompensationstub/group/tiltcompensationstub.mmp
systemswstubs/tiltcompensationstub/inc/common.h
systemswstubs/tiltcompensationstub/inc/common/common.h
systemswstubs/tiltcompensationstub/inc/common/trace.h
systemswstubs/tiltcompensationstub/inc/common/traceconfiguration.hrh
systemswstubs/tiltcompensationstub/inc/trace.h
systemswstubs/tiltcompensationstub/inc/traceconfiguration.hrh
systemswstubs/tiltcompensationstub/rom/tiltcompensation.iby
systemswstubs/tiltcompensationstub/src/tiltcompensation.cpp
systemswstubs/tiltcompensationstub/src/tiltcompensation/tiltcompensation.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/data/10205058.rss	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin ECom resource file
+*
+*/
+
+
+#include "ecom/registryinfov2.rh"
+
+// Declares info for one implementations
+
+RESOURCE REGISTRY_INFO featmgrstubplugin_registry_info
+    {
+    // UID for the DLL. See FeatMgrStubPlugin.mmp
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = 0x10205058;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x10205057;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10205059;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";      
+                    opaque_data = "";
+                    rom_only = 1;
+                    }
+                };
+            }
+        };
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/group/bld.inf	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* 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:  Feature Manager stub plugin bld file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/featmgrstubplugin.iby                              CORE_IBY_EXPORT_PATH(stubs,featmgrstubplugin.iby)
+
+PRJ_MMPFILES
+../group/featmgrstubplugin.mmp
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/group/featmgrstubplugin.mmp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin Project definition file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          FeatMgrStubPlugin.dll
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D 0x10205058 
+
+VENDORID	VID_DEFAULT
+
+CAPABILITY CAP_ECOM_PLUGIN
+
+SOURCEPATH	../src
+SOURCE          proxy.cpp
+SOURCE		featmgrplugin.cpp
+SOURCE 		plugintimer.cpp
+
+START RESOURCE ../data/10205058.rss 
+ #ifdef SYMBIAN_SECURE_ECOM 
+  TARGET FeatMgrStubPlugin.rsc
+ #endif 
+END
+
+USERINCLUDE     ../inc
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib 
+LIBRARY         ecom.lib
+
+LANG            SC
+
+// Trace macros
+//MACRO           API_TRACE_FLAG           // Uncomment during testing to get API traces.
+//MACRO           COMPONENT_TRACE_FLAG     // Uncomment during testing to get COMPONENT traces.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/inc/featmgrplugin.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manger stub plugin header
+*
+*/
+
+
+#ifndef __FEATMGRPLUGIN_H_
+#define __FEATMGRPLUGIN_H_
+
+#include <featureinfoplugin.h>
+#include "plugintimer.h"
+
+
+class CFeatMgrPlugin : public CFeatureInfoPlugin,
+                       public MPluginTimerCallback
+    {
+    public:
+
+        static CFeatMgrPlugin* NewL();
+        virtual ~CFeatMgrPlugin();
+
+        /**
+        * Method to invoke a particular command in the plugin
+        * @param aCommandId Command ID
+        * @param aTransId   Transaction ID
+        * @param aData      Data associated with command
+        */
+        virtual void ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                      const TUint8 aTransId,
+                                      TDesC8& aData );
+        
+        // From MPluginTimerCallback
+        void GenericTimerFiredL( MFeatureInfoPluginCallback& aService,
+                                const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                const TUint8 aTransId,
+                                TInt aRetVal );
+    private: // Construction
+
+        CFeatMgrPlugin();
+        void ConstructL();
+        
+       // RPointerArray<CPluginTimer> iTimers;
+       CPluginTimer* iTimer;
+ 
+    };
+
+#endif // __FEATMGRPLUGIN_H_
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/inc/plugintimer.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin timer definition
+*
+*/
+
+
+
+#ifndef __PLUGINTIMER_H_
+#define __PLUGINTIMER_H_
+
+#include <featureinfoplugin.h>
+
+/**
+*  An interface for handling timer expiration events.
+*/
+class MPluginTimerCallback
+    {
+    public:
+        /** 
+        * Called when the timer fires
+        */
+        virtual void GenericTimerFiredL( MFeatureInfoPluginCallback& aService,
+                                       FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                       TUint8 aTransId,
+                                       TInt aRetVal ) = 0;
+    };
+
+
+class CPluginTimer : public CTimer
+    {
+    public:
+        CPluginTimer( TInt aPriority, 
+                      MFeatureInfoPluginCallback& aService,
+                      FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                      TUint8 aTransId,
+                      TInt aRetVal,
+                      MPluginTimerCallback* aCallback );
+        
+        ~CPluginTimer();
+
+        CPluginTimer(TInt aPriority);
+
+        static CPluginTimer* NewL( const TTimeIntervalMicroSeconds32& anInterval, 
+                                   MFeatureInfoPluginCallback& aService,
+                                   FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                   TUint8 aTransId,
+                                   TInt aRetVal,
+                                   MPluginTimerCallback* aCallback );
+                         
+        void ConstructL();
+        
+        void RunL();
+        
+        inline TUint8 TransId() const
+            {
+            return  iTransId;
+            };
+    
+    private:
+    
+       MFeatureInfoPluginCallback& iService;  // Not owned
+        
+       FeatureInfoCommand::TFeatureInfoCmd iCommandId;
+       TUint8 iTransId;
+       TInt iRetVal;
+       
+       MPluginTimerCallback* iCallback;  // Not owned
+    
+    };
+
+
+#endif // __PLUGINTIMER_H_
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/inc/trace.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is debug macro definition file for Feature Manager
+*
+*/
+
+
+#ifndef TRACE_H
+#define TRACE_H
+
+// INCLUDES
+#include <e32svr.h>
+
+// PC-LINT OPTIONS
+// Removes null statement not in line by itself warnings from 
+// COMPONENT_TRACE macros
+//lint -esym(960,54)
+
+// Removes "area too small" pointer cast warnings.
+//lint -e826
+
+
+
+// CONSTANTS
+// MACROS
+#ifdef _DEBUG
+
+    #ifdef COMPONENT_TRACE_FLAG
+
+        #define COMPONENT_TRACE( a ) RDebug::Print a 
+
+    #else // #ifdef COMPONENT_TRACE_FLAG
+
+        #define COMPONENT_TRACE( a )
+
+    #endif //#ifdef COMPONENT_TRACE_FLAG
+
+    #ifdef API_TRACE_FLAG
+
+        #define API_TRACE( a ) RDebug::Print a
+
+    #else //#ifdef API_TRACE_FLAG
+
+        #define API_TRACE( a )
+
+    #endif //#ifdef API_TRACE_FLAG
+
+#else // #ifdef _DEBUG
+
+    #define COMPONENT_TRACE( a )
+    #define API_TRACE( a )
+
+#endif //#ifdef _DEBUG
+
+
+// DATA TYPES
+// FUNCTION PROTOTYPES
+// FORWARD DECLARATIONS
+
+#endif //#ifndef TRACE_H
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/rom/featmgrstubplugin.iby	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* 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:  FeatMgrStubPlugin provide dummy implementation for emulator
+*                environment to be used instead of proper FeatMgr plugin.
+*
+*/
+
+
+#ifndef __FEATMGRSTUBPLUGIN_IBY__
+#define __FEATMGRSTUBPLUGIN_IBY__
+
+ECOM_PLUGIN( FeatMgrStubPlugin.dll , FeatMgrStubPlugin.rsc )
+
+#endif // __FEATMGRSTUBPLUGIN_IBY__
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/src/featmgrplugin.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,196 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin 
+*                implementation.
+*
+*/
+
+
+#include "featmgrplugin.h"
+#include <featureinfoplugin.h>
+#include "trace.h"     
+
+CFeatMgrPlugin* CFeatMgrPlugin::NewL()
+    {
+    CFeatMgrPlugin* self = new(ELeave) CFeatMgrPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+CFeatMgrPlugin::~CFeatMgrPlugin()
+    {
+    if ( iTimer )
+        {
+        delete iTimer;
+        iTimer = NULL;
+        }
+    }
+
+CFeatMgrPlugin::CFeatMgrPlugin()
+    {
+    }
+
+void CFeatMgrPlugin::ConstructL()
+    {
+    }
+
+    
+void CFeatMgrPlugin::ProcessCommandL( const FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                      const TUint8 aTransId,
+                                      TDesC8& /*aData*/ )
+    {
+    COMPONENT_TRACE((_L("FeatMgrPlugin: Processing command: 0x%x, TransId: 0x%x"), 
+                         aCommandId, aTransId));
+           
+    switch ( aCommandId )
+        {
+        case FeatureInfoCommand::ELoadFeatureInfoCmdId:
+            {
+            COMPONENT_TRACE(_L("FeatMgrPlugin: Processed ELoadFeatureInfoCmdId"));
+            // Load feature info
+            }
+            break;
+        default :
+            {
+            COMPONENT_TRACE((_L("FeatMgrPlugin: Unknown Command: 0x%x"), aCommandId));
+            }
+            break;
+        }
+        
+    TInt retval(KErrNone);
+    TInt timeout( 1000 ); // microseconds
+
+    // create new timer
+
+
+    iTimer = CPluginTimer::NewL(timeout, *iResponseCallback, aCommandId, aTransId, retval,this);
+    }
+
+void CFeatMgrPlugin::GenericTimerFiredL(
+    MFeatureInfoPluginCallback& aService,
+    FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+    TUint8 aTransId,
+    TInt /*aRetVal*/)
+    {
+    COMPONENT_TRACE((_L("FeatMgr Plugin: GenericTimerFiredL (0x%x, 0x%x)"), 
+                         aCommandId, aTransId));
+
+    //__ASSERT_ALWAYS(!(&aService), User::Invariant() );
+    
+    RArray<FeatureInfoCommand::TFeature>* list = 
+    new(ELeave) RArray<FeatureInfoCommand::TFeature>(1);
+    
+    FeatureInfoCommand::TFeatureInfo featureList;
+    TInt err( KErrNone );
+    
+    //
+    // TEST CASES
+    //
+    
+    /***/
+    // For testing, case 1.
+    // Returns empty list and KErrNone.
+
+    featureList.iErrorCode = KErrNone;
+    featureList.iList = *list;
+    
+    FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
+    
+    TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));    
+    /***/
+    
+    /***
+    // For testing, case 2.
+    // Returns one feature and KErrNone.
+    
+    FeatureInfoCommand::TFeature feature1; 
+    feature1.iFeatureID = KFeatureIdBt;
+    feature1.iValue = ETrue;
+    
+    list->Append(feature1);
+    
+    featureList.iErrorCode = KErrNone;
+    featureList.iList = *list;
+        
+    FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
+    
+    TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));   
+    ***/
+        
+    /***
+    // For testing, case 3.
+    // Returns three features and KErrNone
+    
+    FeatureInfoCommand::TFeature feature1; 
+    FeatureInfoCommand::TFeature feature2; 
+    FeatureInfoCommand::TFeature feature3; 
+    
+    feature1.iFeatureID = KFeatureIdBt;
+    feature1.iValue = EFalse;
+    
+    feature1.iFeatureID = KFeatureIdIrda;
+    feature1.iValue = ETrue;
+    
+    feature1.iFeatureID = KFeatureIdProtocolWlan;
+    feature1.iValue = EFalse;
+    
+    list->Append(feature1);
+    list->Append(feature2);
+    list->Append(feature3);
+    
+    featureList.iErrorCode = KErrNone;
+    featureList.iList = *list;
+    
+    FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
+    
+    TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));    
+    ***/
+    
+    /***
+    // For testing, case 4.
+    // Returns empty list and KErrArgument. 
+        
+    featureList.iErrorCode = KErrArgument;
+    featureList.iList = *list;
+    
+    FeatureInfoCommand::TFeatureInfoRespPckg resPackage(featureList);
+    
+    TRAP(err, aService.ProcessResponseL(aCommandId, aTransId, resPackage));    
+    ***/
+            
+    /***
+    // For testing, case 5.
+    // ProcessResponseL never called.
+    ***/
+    
+    list->Reset();
+    delete list;
+    
+    // TEST CASES END
+ 
+    if ( err != KErrNone )
+        {
+        COMPONENT_TRACE((_L("FeatMgr Plugin: Error in ProcessResponseL: %d"), err));
+        }
+    
+    if ( iTimer && !iTimer->IsActive() )
+        {
+        delete iTimer;
+        iTimer = NULL;            
+        COMPONENT_TRACE((_L("FeatMgr Plugin: GenericTimerFiredL - Removed obsolete timer")));
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/src/plugintimer.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin timer implementation
+*
+*/
+
+
+#include "plugintimer.h"
+#include <featureinfoplugin.h>
+#include "trace.h"
+
+CPluginTimer* CPluginTimer::NewL( const TTimeIntervalMicroSeconds32& anInterval, 
+                                  MFeatureInfoPluginCallback& aService,
+                                  FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                                  TUint8 aTransId, 
+                                  TInt aRetVal,
+                                  MPluginTimerCallback* aCallback )
+    {
+    CPluginTimer* self = new( ELeave ) CPluginTimer(0, aService, aCommandId, 
+                                                    aTransId, aRetVal, aCallback);
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    CActiveScheduler::Add(self);
+
+    COMPONENT_TRACE((_L("FeatMgr Plugin - CPluginTimer::NewL - Setting timer: %d"), anInterval));
+
+    self->After(anInterval);
+
+    return self;
+    }
+
+CPluginTimer::~CPluginTimer()    
+    {
+    // PCLint demands
+    iCallback = NULL; 
+    }
+
+CPluginTimer::CPluginTimer( TInt aPriority, 
+                            MFeatureInfoPluginCallback& aService,
+                            FeatureInfoCommand::TFeatureInfoCmd aCommandId,
+                            TUint8 aTransId,
+                            TInt aRetVal,
+                            MPluginTimerCallback* aCallback )
+    : CTimer(aPriority),
+    iService(aService),
+    iCommandId(aCommandId),
+    iTransId(aTransId),
+    iRetVal(aRetVal),
+    iCallback(aCallback)
+    {
+    }
+
+void CPluginTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+    
+void CPluginTimer::RunL(  )
+    {
+    iCallback->GenericTimerFiredL(iService, iCommandId, iTransId, iRetVal );
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/featuremanagerstub/src/proxy.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Feature Manager stub plugin proxy definition file
+*
+*/
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "featmgrplugin.h"
+
+// Map the interface implementation UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(0x10205059,	CFeatMgrPlugin::NewL),
+    };
+
+// Exported proxy for instantiation method resolution.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/sensorchannelsreference/group/bld.inf	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,27 @@
+/*
+* 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 sensorchannelsreference
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/sensrvproprietaryproperties.h  OS_LAYER_PLATFORM_EXPORT_PATH(sensrvproprietaryproperties.h)
+../inc/sensrvproprietarydatatypes.h   OS_LAYER_PLATFORM_EXPORT_PATH(sensrvproprietarydatatypes.h)
+../inc/sensrvproprietarychannels.h    OS_LAYER_PLATFORM_EXPORT_PATH(sensrvproprietarychannels.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/sensorchannelsreference/inc/sensrvproprietarychannels.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* 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:  Proprietary channels definitions
+*
+*/
+
+
+#ifndef SENSRVPROPRIETARYCHANNELS_H
+#define SENSRVPROPRIETARYCHANNELS_H
+
+#include <sensrvtypes.h>
+
+/**
+* - Name:          Proprietary example channel type.
+*                  Value of the channel ID must be unique among the all channels.
+*                  To guarantee uniqueness, UID value can be used for channel ID.
+*                  UID values are assigned to developers centrally by Symbian.
+*                  In this example temporary UID range is used (0xExxxxxxx).
+* - Type:          N/A
+* - Datatype:      see sensrvproprietarydatatypes.h
+* - Description:   Example channel definition.
+*/
+//const TSensrvChannelTypeId KSensrvProprietaryChanneld = 0xE0000001;
+
+#endif // SENSRVPROPRIETARYCHANNELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/sensorchannelsreference/inc/sensrvproprietarydatatypes.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* 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 header provides the proprietary data type definitions.
+*
+*/
+
+
+#ifndef SENSRVPROPRIETARYDATATYPES_H
+#define SENSRVPROPRIETARYDATATYPES_H
+
+// See platform provided data type definitions for a channel
+// from sensrvchanneldatatypes.h as an example.
+
+#endif // SENSRVPROPRIETARYDATATYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/sensorchannelsreference/inc/sensrvproprietaryproperties.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,41 @@
+/*
+* 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 header provides the proprietary property definitions.
+*
+*/
+
+
+#ifndef SENSRVPROPRIETARYPROPERTIES_H
+#define SENSRVPROPRIETARYPROPERTIES_H
+
+#include <sensrvproperty.h>
+
+/**
+* - Name:        Name of the property. 
+*                Property values from 0x0 to 0xffff are reserved for platform use.
+* - Type:        Defines type of the property (TInt/TReal/TBuf)
+* - Scope:       Defines a property scope. Property can be defined for a 
+*                channel, for a specific item in a channel or for a server 
+*                related to channel or 
+* - Group:       Defines which category a property belongs
+* - Mandatory:   Defines is property mandatory or in which groups property is 
+*                mandatory 
+* - Capability:  Capabilities needed to set this property
+* - Description: Description of the property
+* 
+*/
+//const TSensrvPropertyId KSensrvProprietaryProperty = 0x00010000;
+
+
+#endif // SENSRVPROPRIETARYPROPERTIES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/data/10205089.rss	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,106 @@
+/*
+* 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:  Used as an reference implementation
+*                Declaration of SSYReferencePlugin ECom resource
+*
+*/
+
+
+#include <sensrvresource.hrh>
+#include "ecom/registryinfov2.rh"
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+// 
+// 10205089.rss
+// Declares info for SSYReference ECom plugin
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE REGISTRY_INFO SSYReferencePlugin
+    {
+    // UID for the DLL. See SSYReferencePlugin.mmp
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = 0x10205089;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KSsyControlInterfaceUid;
+            implementations = 
+                {
+                BINARY_IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10205088;
+                    version_no         = 1;
+                    display_name       = "SSYReferencePlugin";
+                    default_data       = {
+                                         // Double tap channel
+                                         0x1, // ChannelInfoVersion
+                                         0x2F, //  ChannelInfoLength
+                                         0x2E, // Flags
+                                         0x81, 0x50, 0x20, 0x10, // ChannelType
+                                         0x02, 0x00, 0x00, 0x00, // ContextType ESensrvContextTypeDevice
+                                         0x0B, 0x00, 0x00, 0x00, // Quantity ESensrvQuantityTapping
+                                         0x0C, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, 0x44, 0x62, 0x6C, 0x54, 0x61, 0x70, // Location: SsyRefDblTap
+                                         0x06, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, // VendorId: SsyRef
+                                         0x7F, 0x50, 0x20, 0x10, // ChannelDataTypeId
+                                         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // ChannelSecurityPolicy
+                                         
+                                         // Accelerometer channel
+                                         0x1, // ChannelInfoVersion
+                                         0x2F, //  ChannelInfoLength
+                                         0x1E, // Flags
+                                         0x7E, 0x50, 0x20, 0x10, // ChannelType
+                                         0x02, 0x00, 0x00, 0x00, // ContextType ESensrvContextTypeDevice
+                                         0x0A, 0x00, 0x00, 0x00, // Quantity ESensrvQuantityAcceleration
+                                         0x0C, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, 0x58, 0x59, 0x5A, 0x43, 0x68, 0x6E, // Location SsyRefXYZChn
+                                         0x06, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, // VendorId: SsyRef
+                                         0x7E, 0x50, 0x20, 0x10, // ChannelDataTypeId
+                                         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // ChannelSecurityPolicy
+                                         
+                                         // Magnetometer channel
+                                         0x1, // ChannelInfoVersion
+                                         0x2F, //  ChannelInfoLength
+                                         0x1E, // Flags
+                                         0xE0, 0xBE, 0x00, 0x20, // ChannelType
+                                         0x01, 0x00, 0x00, 0x00, // ContextType ESensrvContextAmbient
+                                         0x0E, 0x00, 0x00, 0x00, // Quantity ESensrvQuantityMagnetic
+                                         0x0C, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, 0x58, 0x59, 0x5A, 0x43, 0x68, 0x6E, // Location: SsyRefXYZChn
+                                         0x06, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, // VendorId: SsyRef
+                                         0xE0, 0xBE, 0x00, 0x20, // ChannelDataTypeId
+                                         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // ChannelSecurityPolicy
+
+                                         // Proximity channel
+                                         0x1, // ChannelInfoVersion
+                                         0x2F, //  ChannelInfoLength
+                                         0x3E, // Flags
+                                         0x85, 0xE5, 0x00, 0x20, // ChannelType (0x2000E585)
+                                         0x02, 0x00, 0x00, 0x00, // ContextType ESensrvContextTypeDevice
+                                         0x10, 0x00, 0x00, 0x00, // Quantity ESensrvQuantityProximity
+                                         0x0C, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, 0x50, 0x72, 0x78, 0x43, 0x68, 0x6E, // Location: SsyRefPrxChn
+                                         0x06, 0x53, 0x73, 0x79, 0x52, 0x65, 0x66, // VendorId: SsyRef
+                                         0x85, 0xE5, 0x00, 0x20, // ChannelDataTypeId
+                                         0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF // ChannelSecurityPolicy                                                                             
+                                         };
+                    opaque_data        = {};
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
Binary file systemswstubs/ssyreference/group/1020507E.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/group/SsyReferenceConfig.xml	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,298 @@
+<!-- SSY reference configuration -->
+<SsyReferenceConfig>
+    <SsyGeneralInformation>
+    </SsyGeneralInformation>
+    <ChannelInformationGroup ChannelCount="4">
+        <ChannelItem
+            ChannelId="1"
+            ContextType="2" 
+            Quantity="11" 
+            ChannelType="0x10205081" 
+            Location="SsyRefDblTap"
+            Vendor="SsyRef"
+            DataTypeId="0x1020507F">
+                <Properties>
+                <PropertyItem PropertyId="0x00000002"
+                  ItemIndex="0"
+                  PropertyValue="100"
+                  MaxValue="150"
+                  MinValue="0"
+                  ReadOnly="0"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000004"
+                  ItemIndex="0"
+                  PropertyValue="1"
+    		      MaxValue="1"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+				  <!-- Channel property, availability of the channel, mandatory for all channels, see KSensrvPropIdAvailability  -->
+                </PropertyItem>
+          </Properties>
+          <ChannelData StartIntervalMs="3000">
+            <ChannelDataItem  DataTypeId="0x1020507F" count="1" IntervalMs="3000">
+              <SsyRefChannelDataTapping Direction="0x01"></SsyRefChannelDataTapping>
+            </ChannelDataItem>
+                      <ChannelDataItem DataTypeId="0x1020507F" count="1" IntervalMs="5000">
+              <SsyRefChannelDataTapping Direction="0x02"></SsyRefChannelDataTapping>
+            </ChannelDataItem>            
+          </ChannelData>
+        </ChannelItem>
+        <ChannelItem
+            ChannelId="2"
+            ContextType="2" 
+            Quantity="10" 
+            ChannelType="0x1020507E" 
+            Location="SsyRefXYZChn" 
+            Vendor="SsyRef"
+            DataTypeId="0x1020507E">
+            <Properties>
+                <!-- First four properties has same property Id, they are grouped to array property -->
+                <!-- First is array info -2, which tells currently selected property, value = 1 -->
+                <!-- Max and Min values tells max and min property array indexes, not the actual values -->
+                <!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="-2"
+                  ItemIndex="0"
+                  PropertyValue="1"
+                  MaxValue="2"
+                  MinValue="0"
+                  ReadOnly="0"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="0"
+                  ItemIndex="0"
+                  PropertyValue="10"
+    		      MaxValue="10"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="1"
+                  ItemIndex="0"
+                  PropertyValue="30"
+    		      MaxValue="30"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="2"
+                  ItemIndex="0"
+                  PropertyValue="50"
+    		      MaxValue="50"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>         
+                <PropertyItem PropertyId="0x00000004"
+                  ItemIndex="0"
+                  PropertyValue="1"
+    		      MaxValue="1"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, availability of the channel, mandatory for all channels, see KSensrvPropIdAvailability  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="1"
+                  PropertyValue="14.56"
+                  MaxValue="128"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for X-axis (item index = 1), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="2"
+                  PropertyValue="20.65"
+                  MaxValue="256"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for Y-axis (item index = 2), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="3"
+                  PropertyValue="10.56"
+                  MaxValue="128"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for Z-axis (item index = 3), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+				<PropertyItem PropertyId="0x000000008"
+                  ItemIndex="-1"
+                  PropertyValue="10"
+				  MaxValue="1"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="2">
+				  </PropertyItem>
+                    <!-- Channel item property, accuracy property common (item index = -1), see KSensrvPropIdChannelAccuracy  -->
+				<PropertyItem PropertyId="0x0000000010"
+                  ItemIndex="-1"
+                  PropertyValue="10"
+				  MaxValue="0"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel item property, unit property for common (item index = -1), see KSensrvPropIdChannelUnit  -->
+                </PropertyItem>
+                </Properties>
+          <ChannelData StartIntervalMs="1000">
+            <ChannelDataItem DataTypeId="0x1020507E" count="3" IntervalMs="5000">
+              <SsyRefChannelDataAxis XAxis="1" YAxis="1" ZAxis="50" ></SsyRefChannelDataAxis>
+            </ChannelDataItem>
+        </ChannelData>
+        </ChannelItem>          
+        <ChannelItem
+            ChannelId="3"
+            ContextType="1" 
+            Quantity="14" 
+            ChannelType="0x2000BEE0" 
+            Location="SsyRefXYZChn"
+            Vendor="SsyRef"
+            DataTypeId="0x2000BEE0">
+            <Properties>
+                <!-- First four properties has same property Id, they are grouped to array property -->
+                <!-- First is array info -2, which tells currently selected property, value = 1 -->
+                <!-- Max and Min values tells max and min property array indexes, not the actual values -->
+                <!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+                <PropertyItem PropertyId="0x00000002"
+    		      ItemIndex="0"
+    		      PropertyValue="10"
+    		      MaxValue="10"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="1"
+                  PropertyValue="14.56"
+                  MaxValue="128"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for X-axis (item index = 1), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="2"
+                  PropertyValue="20.65"
+                  MaxValue="256"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for Y-axis (item index = 2), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000005"
+                  ItemIndex="3"
+                  PropertyValue="10.56"
+                  MaxValue="128"
+                  MinValue="1"
+                  ReadOnly="0"
+                  PropertyType="2">
+                    <!-- Channel item property, measure range for Z-axis (item index = 3), see KSensrvPropIdMeasureRange  -->
+                </PropertyItem>
+			</Properties>
+          <ChannelData StartIntervalMs="1000">
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="5" YAxisCalib="35" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="20" YAxisCalib="25" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="25" YAxisCalib="20" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="35" YAxisCalib="5" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="35" YAxisCalib="-5" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="25" YAxisCalib="-20" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="20" YAxisCalib="-25" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BEE0" count="1" IntervalMs="100">
+              <SsyRefChannelDataMagneticAxis XAxis="1" YAxis="1" ZAxis="1" XAxisCalib="5" YAxisCalib="-35" ZAxisCalib="-140" ></SsyRefChannelDataMagneticAxis>
+            </ChannelDataItem>
+          </ChannelData>
+        </ChannelItem>
+        <ChannelItem
+            ChannelId="4"
+            ContextType="2" 
+            Quantity="16" 
+            ChannelType="0x2000E585" 
+            Location="SsyRefPrxChn" 
+            Vendor="SsyRef"
+            DataTypeId="0x2000E585">
+            <Properties>
+                <!-- First four properties has same property Id, they are grouped to array property -->
+                <!-- First is array info -2, which tells currently selected property, value = 1 -->
+                <!-- Max and Min values tells max and min property array indexes, not the actual values -->
+                <!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="-2"
+                  ItemIndex="0"
+                  PropertyValue="1"
+                  MaxValue="2"
+                  MinValue="0"
+                  ReadOnly="0"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="0"
+                  ItemIndex="0"
+                  PropertyValue="10"
+                  MaxValue="0"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="1"
+                  ItemIndex="0"
+                  PropertyValue="30"
+                  MaxValue="0"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+                <PropertyItem PropertyId="0x00000002"
+                    ArrayIndex="2"
+                  ItemIndex="0"
+                  PropertyValue="50"
+                  MaxValue="0"
+                  MinValue="0"
+                  ReadOnly="1"
+                  PropertyType="1">
+                    <!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+                </PropertyItem>
+            </Properties>
+          <ChannelData StartIntervalMs="5000">
+            <ChannelDataItem DataTypeId="0x2000E585" count="3" IntervalMs="4000">
+              <SsyRefChannelDataProximity ProximityState="0"></SsyRefChannelDataProximity>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000E585" count="2" IntervalMs="4000">
+              <SsyRefChannelDataProximity ProximityState="1"></SsyRefChannelDataProximity>
+            </ChannelDataItem>
+          </ChannelData>
+        </ChannelItem>
+    </ChannelInformationGroup>
+</SsyReferenceConfig>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/group/SsyReferenceConfigR.xml	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,269 @@
+<!-- SSY reference configuration -->
+<SsyReferenceConfig>
+    <SsyGeneralInformation>
+    </SsyGeneralInformation>
+    <ChannelInformationGroup ChannelCount="4">
+    	<ChannelItem
+    		ChannelId="5"
+    		ContextType="2" 
+    		Quantity="11" 
+    		ChannelType="0x10205081" 
+    		Location="SsyRefDblTap"
+    		Vendor="SsyRefVendor"
+    		DataTypeId="0x1020507F">
+    			<Properties>
+        		<PropertyItem PropertyId="0x00000002"
+    		      ItemIndex="0"
+    		      PropertyValue="100"
+    		      MaxValue="150"
+    		      MinValue="0"
+    		      ReadOnly="0"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000004"
+    		      ItemIndex="0"
+    		      PropertyValue="1"
+    		      MaxValue="1"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, availability of the channel, mandatory for all channels, see KSensrvPropIdAvailability  -->
+        		</PropertyItem>
+          </Properties>
+          <ChannelData StartIntervalMs="3000">
+            <ChannelDataItem  DataTypeId="0x1020507F" count="1" IntervalMs="3000">
+              <SsyRefChannelDataTapping Direction="0x01"></SsyRefChannelDataTapping>
+            </ChannelDataItem>
+					  <ChannelDataItem DataTypeId="0x1020507F" count="1" IntervalMs="5000">
+              <SsyRefChannelDataTapping Direction="0x02"></SsyRefChannelDataTapping>
+            </ChannelDataItem>            
+          </ChannelData>
+    	</ChannelItem>
+<ChannelItem
+    		ChannelId="2"
+    		ContextType="2" 
+    		Quantity="10" 
+    		ChannelType="0x1020507E" 
+    		Location="SsyRefAxisChan" 
+    		Vendor="SsyRefVendor"
+    		DataTypeId="0x1020507E">
+        	<Properties>
+        		<!-- First four properties has same property Id, they are grouped to array property -->
+        		<!-- First is array info -2, which tells currently selected property, value = 1 -->
+        		<!-- Max and Min values tells max and min property array indexes, not the actual values -->
+        		<!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="-2"
+    		      ItemIndex="0"
+    		      PropertyValue="1"
+    		      MaxValue="2"
+    		      MinValue="0"
+    		      ReadOnly="0"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="0"
+    		      ItemIndex="0"
+    		      PropertyValue="10"
+    		      MaxValue="10"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="1"
+    		      ItemIndex="0"
+    		      PropertyValue="30"
+    		      MaxValue="30"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="2"
+    		      ItemIndex="0"
+    		      PropertyValue="50"
+    		      MaxValue="50"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000004"
+    		      ItemIndex="0"
+    		      PropertyValue="1"
+    		      MaxValue="1"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, availability of the channel, mandatory for all channels, see KSensrvPropIdAvailability  -->
+        		</PropertyItem>
+    		    <PropertyItem PropertyId="0x00000005"
+    		      ItemIndex="1"
+    		      PropertyValue="14.56"
+    		      MaxValue="128"
+    		      MinValue="1"
+    		      ReadOnly="0"
+    		      PropertyType="2">
+    		     	<!-- Channel item property, measure range for X-axis (item index = 1), see KSensrvPropIdMeasureRange  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000005"
+    		      ItemIndex="2"
+    		      PropertyValue="20.65"
+    		      MaxValue="256"
+    		      MinValue="1"
+    		      ReadOnly="0"
+    		      PropertyType="2">
+    		     	<!-- Channel item property, measure range for Y-axis (item index = 2), see KSensrvPropIdMeasureRange  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000005"
+    		      ItemIndex="3"
+    		      PropertyValue="10.56"
+    		      MaxValue="128"
+    		      MinValue="1"
+    		      ReadOnly="0"
+    		      PropertyType="2">
+    		     	<!-- Channel item property, measure range for Z-axis (item index = 3), see KSensrvPropIdMeasureRange  -->
+        		</PropertyItem>
+        	</Properties>
+          <ChannelData StartIntervalMs="5000">
+            <ChannelDataItem DataTypeId="0x1020507E" count="3" IntervalMs="500">
+              <SsyRefChannelDataAxis XAxis="50" YAxis="32" ZAxis="44" ></SsyRefChannelDataAxis>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x1020507E" count="4" IntervalMs="2000">
+              <SsyRefChannelDataAxis XAxis="22" YAxis="49" ZAxis="55" ></SsyRefChannelDataAxis>
+            </ChannelDataItem>
+        </ChannelData>
+    	</ChannelItem>    	    
+    	<ChannelItem
+    		ChannelId="3"
+    		ContextType="2" 
+    		Quantity="10" 
+    		ChannelType="0x2000E585" 
+    		Location="SsyRefAxisChan" 
+    		Vendor="SsyRefVendor"
+    		DataTypeId="0x2000E585">
+        	<Properties>
+        		<!-- First four properties has same property Id, they are grouped to array property -->
+        		<!-- First is array info -2, which tells currently selected property, value = 1 -->
+        		<!-- Max and Min values tells max and min property array indexes, not the actual values -->
+        		<!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="-2"
+    		      ItemIndex="0"
+    		      PropertyValue="1"
+    		      MaxValue="2"
+    		      MinValue="0"
+    		      ReadOnly="0"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="0"
+    		      ItemIndex="0"
+    		      PropertyValue="10"
+    		      MaxValue="10"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="1"
+    		      ItemIndex="0"
+    		      PropertyValue="30"
+    		      MaxValue="30"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="2"
+    		      ItemIndex="0"
+    		      PropertyValue="50"
+    		      MaxValue="50"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        	</Properties>
+          <ChannelData StartIntervalMs="5000">
+            <ChannelDataItem DataTypeId="0x2000E585" count="3" IntervalMs="1000">
+              <SsyRefChannelDataProximity ProximityState="1"></SsyRefChannelDataProximity>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000E585" count="2" IntervalMs="1000">
+              <SsyRefChannelDataProximity ProximityState="2"></SsyRefChannelDataProximity>
+            </ChannelDataItem>
+        </ChannelData>
+    	</ChannelItem>
+   	  <ChannelItem
+    		ChannelId="7"
+    		ContextType="2" 
+    		Quantity="10" 
+    		ChannelType="0x2000BF16" 
+    		Location="SsyRefAxisChan" 
+    		Vendor="SsyRefVendor"
+    		DataTypeId="0x2000BF16">
+        	<Properties>
+        		<!-- First four properties has same property Id, they are grouped to array property -->
+        		<!-- First is array info -2, which tells currently selected property, value = 1 -->
+        		<!-- Max and Min values tells max and min property array indexes, not the actual values -->
+        		<!-- Array index is mandatory only for array type of properties, by default it is -1 -->
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="-2"
+    		      ItemIndex="0"
+    		      PropertyValue="1"
+    		      MaxValue="2"
+    		      MinValue="0"
+    		      ReadOnly="0"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="0"
+    		      ItemIndex="0"
+    		      PropertyValue="10"
+    		      MaxValue="10"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="1"
+    		      ItemIndex="0"
+    		      PropertyValue="30"
+    		      MaxValue="30"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        		<PropertyItem PropertyId="0x00000002"
+        			ArrayIndex="2"
+    		      ItemIndex="0"
+    		      PropertyValue="50"
+    		      MaxValue="50"
+    		      MinValue="0"
+    		      ReadOnly="1"
+    		      PropertyType="1">
+    		     	<!-- Channel property, data rate, mandatory for all channels, see KSensrvPropIdDataRate  -->
+        		</PropertyItem>
+        	</Properties>
+          <ChannelData StartIntervalMs="5500">
+            <ChannelDataItem DataTypeId="0x2000BF16" count="3" IntervalMs="2000">
+              <SsyRefChannelDataAmbientLight AmbientLightState="22"></SsyRefChannelDataAmbientLight>
+            </ChannelDataItem>
+            <ChannelDataItem DataTypeId="0x2000BF16" count="2" IntervalMs="2000">
+              <SsyRefChannelDataAmbientLight AmbientLightState="77"></SsyRefChannelDataAmbientLight>
+            </ChannelDataItem>            
+        </ChannelData>
+    	</ChannelItem>
+    	</ChannelInformationGroup>
+</SsyReferenceConfig>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/group/SsyReference_Config_template.xml	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,148 @@
+<!-- SsyReference configuration file template -->
+<!-- ********************************************************** -->
+<!-- * NOTE. DO NOT LEFT ANY COMMENTS INTO ACTUAL CONFIG FILE * -->
+<!-- ********************************************************** -->
+<SsyReferenceConfig>
+    <SsyGeneralInformation>
+        <!-- General information for SSY itself -->
+        <Properties>
+        <!-- General properties of the sensor -->
+    	  <!-- TSensrvProperty. Each property has its own item defined in here -->
+        	
+        	<!-- Property example 1 -->
+        	<PropertyItem PropertyId="TSensrvPropertyId"
+        	    ItemIndex="Item index in channel data structure"
+        		PropertyValue="Value of the property"
+        		MaxValue="Maximum value of data"
+        		MinValue="Minimum value of data"
+        		ReadOnly="Read only or modifiable"
+        		PropertyType="TSensrvPropertyType">
+            </PropertyItem>
+            <!-- Property example 2 -->
+        	<PropertyItem PropertyId="TSensrvPropertyId"
+        		ItemIndex="Item index in channel data structure"
+        		PropertyValue="Value of the property"
+        		MaxValue="Maximum value of data"
+        		MinValue="Minimum value of data"
+        		ReadOnly="Read only or modifiable"
+        		PropertyType="TSensrvPropertyType">
+            </PropertyItem>
+        </Properties>
+    </SsyGeneralInformation>
+    <ChannelInformationGroup ChannelCount="2">
+    	<!-- Channel definitions. Each channel item contains all information of one channel -->
+    	<!-- Channel example 1 -->
+    	<ChannelItem 
+    		ChannelId="This value is updated runtime when Sensrv has defined channel IDs" 
+    		ContextType="TSensrvContextType" 
+    		Quantity="TSensrvQuantity" 
+    		ChannelType="TSensrvChannelTypeId" 
+    		Location="Location of the sensor" 
+    		Vendor="Vendor ID"
+    		DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h">
+    		  <!-- One channel definition. Each channel has its own item block -->
+        	<!-- TSensrvChannelInfo. Contains information of this channel; Context type, Quantity etc. --> 
+        	
+        	<!-- Contains properties of this channel. -->
+        	<Properties>
+        	  <!-- TSensrvProperty. Each property has its own item defined in here -->
+        		<!-- Property example 3 -->
+    		    <PropertyItem PropertyId="TSensrvPropertyId"
+    		      ItemIndex="Item index in channel data structure"
+    		      PropertyValue="Value of the property"
+    		      MaxValue="Maximum value of data"
+    		      MinValue="Minimum value of data"
+    		      ReadOnly="Read only or modifiable"
+    		      PropertyType="TSensrvPropertyType">
+        		</PropertyItem>
+    		    <!-- Property example 4 -->
+    		    <PropertyItem PropertyId="TSensrvPropertyId"
+    		      ItemIndex="Item index in channel data structure"
+    		      PropertyValue="Value of the property"
+    		      MaxValue="Maximum value of data"
+    		      MinValue="Minimum value of data"
+    		      ReadOnly="Read only or modifiable"
+    		      PropertyType="TSensrvPropertyType">
+        		</PropertyItem>
+        	</Properties>
+
+            <!-- Channel data. Information of generated data by this channel.  -->
+            <!-- There may be several different (yet same type) data items. Next data item is added to  -->
+            <!-- buffer after the previous data items (all according to count) are added and last Interval is passed -->
+             
+            <ChannelData StartIntervalMs="Time in milliseconds to start filling buffer after StartChannelData()">
+                <ChannelDataItem DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h" count="Number of this data items to be added into buffer (with the same values)" 
+    			     									 IntervalMs="Time in milliseconds after next data item is added into buffer">
+                    <!-- Content of this channel item is dependent on the type of this channel. It must be one and only one of the following -->
+                    <SsyRefChannelDataAxis XAxis="Integer value of X Axis" YAxis="Integer value of Y Axis" ZAxis="Integer value of Z Axis" ><!-- This type has DataTypeID 0x00010001 --></SsyRefChannelDataAxis>
+                    <SsyRefChannelDataTapping Direction="direction of tapping"><!-- This type has DataTypeID 0x00010002 --></SsyRefChannelDataTapping>
+                </ChannelDataItem>
+
+                <!-- Next channel data item -->
+                <ChannelDataItem DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h" count="Number of this data items to be added into buffer (with the same values)" 
+    			     									 IntervalMs="Time in milliseconds after next data item is added into buffer">
+                    <!-- Content of this channel item is dependent on the type of this channel. It must be one and only one of the following -->
+                    <SsyRefChannelDataAxis XAxis="Integer value of X Axis" YAxis="Integer value of Y Axis" ZAxis="Integer value of Z Axis" ><!-- This type has DataTypeID 0x00010001 --></SsyRefChannelDataAxis>
+                    <SsyRefChannelDataTapping Direction="direction of tapping"><!-- This type has DataTypeID 0x00010002 --></SsyRefChannelDataTapping>
+                </ChannelDataItem>
+            </ChannelData>
+    	</ChannelItem>
+    	<!-- Channel example 2 -->
+    	<ChannelItem 
+    		ChannelId="This value is updated runtime when Sensrv has defined channel IDs" 
+    		ContextType="TSensrvContextType" 
+    		Quantity="TSensrvQuantity" 
+    		ChannelType="TSensrvChannelTypeId" 
+    		Location="Location of the sensor" 
+    		Vendor="Vendor ID"
+    		DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h">
+    		<!-- One channel definition. Each channel has its own item block -->
+        	<!-- TSensrvChannelInfo. Contains information of this channel; Context type, Quantity etc. -->
+        	
+            <!-- Contains properties of this channel. -->
+        	<Properties>
+        	  	 <!-- TSensrvProperty. Each property has its own item defined in here -->
+        		 <!-- Property example 5 -->
+    		    <PropertyItem PropertyId="TSensrvPropertyId"
+    		      ItemIndex="Item index in channel data structure"
+    		      PropertyValue="Value of the property"
+    		      MaxValue="Maximum value of data"
+    		      MinValue="Minimum value of data"
+    		      ReadOnly="Read only or modifiable"
+    		      PropertyType="TSensrvPropertyType">
+        		</PropertyItem>
+
+        		<!-- Property example 6 -->
+    		    <PropertyItem PropertyId="TSensrvPropertyId"
+    		      ItemIndex="Item index in channel data structure"
+    		      PropertyValue="Value of the property"
+    		      MaxValue="Maximum value of data"
+    		      MinValue="Minimum value of data"
+    		      ReadOnly="Read only or modifiable"
+    		      PropertyType="TSensrvPropertyType">
+        	    </PropertyItem>
+        	</Properties>
+
+            <!-- Channel data. Information of generated data by this channel.  -->
+            <!-- There may be several different (yet same type) data items. Next data item is added to  -->
+            <!-- buffer after the previous data items (all according to count) are added and last Interval is passed -->
+             
+            <ChannelData StartIntervalMs="Time in milliseconds to start filling buffer after StartChannelData()">
+                <ChannelDataItem DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h" count="Number of this data items to be added into buffer (with the same values)" 
+    			     									 IntervalMs="Time in milliseconds after next data item is added into buffer">
+                    <!-- Content of this channel item is dependent on the type of this channel. It must be one and only one of the following -->
+                    <SsyRefChannelDataAxis XAxis="Integer value of X Axis" YAxis="Integer value of Y Axis" ZAxis="Integer value of Z Axis" ><!-- This type has DataTypeID 0x00010001 --></SsyRefChannelDataAxis>
+                    <SsyRefChannelDataTapping Direction="direction of tapping"><!-- This type has DataTypeID 0x00010002 --></SsyRefChannelDataTapping>
+                    </ChannelDataItem>
+
+                <!-- Next channel data item -->
+                <ChannelDataItem DataTypeId="data type ID identifies data type defined here. See sensrvchanneldatatypes.h" count="Number of this data items to be added into buffer (with the same values)" 
+    			     									 IntervalMs="Time in milliseconds after next data item is added into buffer">
+                    <!-- Content of this channel item is dependent on the type of this channel. It must be one and only one of the following -->
+                    <SsyRefChannelDataAxis XAxis="Integer value of X Axis" YAxis="Integer value of Y Axis" ZAxis="Integer value of Z Axis" ><!-- This type has DataTypeID 0x00010001 --></SsyRefChannelDataAxis>
+                    <SsyRefChannelDataTapping Direction="direction of tapping"><!-- This type has DataTypeID 0x00010002 --></SsyRefChannelDataTapping>
+                </ChannelDataItem>
+            </ChannelData>
+    	</ChannelItem>
+    </ChannelInformationGroup>
+</SsyReferenceConfig>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/group/bld.inf	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,44 @@
+/*
+* 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:  Used as an reference implementation
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/ssyreference.iby CORE_OS_LAYER_IBY_EXPORT_PATH(ssyreference.iby)
+
+// Export config to SensorServers private folder
+
+// For emulator use
+SsyReferenceConfig.xml  /epoc32/release/winscw/udeb/z/private/1020507E/reference/SsyReferenceConfig.xml
+SsyReferenceConfig.xml  /epoc32/release/winscw/urel/z/private/1020507E/reference/SsyReferenceConfig.xml
+1020507E.txt /epoc32/release/winscw/udeb/z/private/10202be9/1020507E.txt
+1020507E.txt /epoc32/release/winscw/urel/z/private/10202be9/1020507E.txt
+
+// For HW use
+SsyReferenceConfig.xml  /epoc32/data/z/private/1020507E/reference/SsyReferenceConfig.xml
+1020507E.txt /epoc32/data/z/private/10202be9/1020507E.txt
+
+PRJ_MMPFILES
+#ifdef RD_SENSOR_FW
+ssyreferenceplugin.mmp
+#endif // RD_SENSOR_FW
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/group/ssyreferenceplugin.mmp	Mon Jan 18 20:06:52 2010 +0200
@@ -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:  Project file for ssyreferenceplugin.dll
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ssyreferenceplugin.dll
+TARGETTYPE      PLUGIN
+VENDORID        VID_DEFAULT
+
+// ECom Dll recognition UID followed by the unique UID for this dll
+UID             0x10009D8D 0x10205089
+
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../src
+
+SOURCE          ssyreferencechanneldataprovider.cpp
+SOURCE          ssyreferencecontrol.cpp
+SOURCE          ssyreferencepropertyprovider.cpp
+SOURCE          ssyreferencechannel.cpp
+SOURCE          ssyreferenceconfig.cpp
+SOURCE          ssyreferencecmdhandler.cpp
+SOURCE          ECOMEntryPoint.cpp
+
+USERINCLUDE     ../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+// The resource name should have to be same as the third UID above
+
+START RESOURCE ../data/10205089.rss
+#ifdef SYMBIAN_SECURE_ECOM
+TARGET          ssyreferenceplugin.rsc
+#endif // SYMBIAN_SECURE_ECOM
+END
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY sensrvutil.lib
+LIBRARY xmlparser.lib // for XML parser
+LIBRARY efsrv.lib
+LIBRARY xmldom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencechannel.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,238 @@
+/*
+* 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:  Reference implementation of SSY Channel
+*
+*/
+
+
+#ifndef SSYREFERENCECHANNEL_H
+#define SSYREFERENCECHANNEL_H
+
+#include <e32base.h>
+#include <sensrvtypes.h>
+#include "ssyreferenceconfig.h"
+
+class CSsyReferenceControl;
+class CSsyReferenceChannelDataProvider;
+class CSsyReferencePropertyProvider;
+class CSsyReferenceCmdHandler;
+
+/**
+ *  Main control class for SSY. Controls sensor basic functionality and provides mandatory 
+ *  ECOM interface specific things.
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferenceChannel : public CBase
+    {
+
+public:
+
+    /**
+     * Enumeration of the state of this channel
+     */
+    enum TSsyReferenceChannelState
+        {
+        ESsyReferenceChannelIdle,      // Channel created, not opened
+        ESsyReferenceChannelOpening,   // Processing channel opening
+        ESsyReferenceChannelOpen,      // Channel is open
+        ESsyReferenceChannelReceiving, // Channel is receiving data
+        ESsyReferenceChannelClosing    // Processing channel closing. After this state is idle
+        };
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @param[in] aSsyControl Reference to SSY control instance.
+     * @param[in] aChannelInfo Information of this channel
+     * @return CSsyReferenceControl* Pointer to created CSsyReferenceControl object
+     */
+    static CSsyReferenceChannel* NewL( CSsyReferenceControl& aSsyControl, TSensrvChannelInfo aChannelInfo );
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferenceChannel();
+
+    /**
+     * Request for SSY to open a sensor channel asynchronously. 
+     * Response to the request is delivered through MSsyCallback::ChannelOpened().
+     * Initilizes SSY (and the sensor) to be ready for other control commands via
+     * data and property providers. Multiple OpenChannel()-requests can be
+     * active for different channels at the same time.
+     *
+     * @since S60 5.0
+     * @return void Symbian OS error code
+     */
+    TInt OpenChannel();
+
+    /**
+     * Request to close a sensor channel asynchronously. 
+     * Response to the request is delivered through MSsyCallback::ChannelClosed().
+     * Multiple CloseChannel()-requests can be active for different channels 
+     * at the same time.
+     *
+     * @since S60 5.0
+     * @return void Symbian OS error code
+     */  
+    TInt CloseChannel();
+
+    /**
+     * Returns ID of this channel
+     */
+    TInt ChannelId();
+
+    /**
+     * Handles response directed to this channel
+     *
+     * @since S60 5.0
+     * @param[in] aMessage Contains information of the response
+     */
+    void ProcessResponse( TSsyReferenceMsg* aMessage );
+
+    /**
+     * Updates the state of this channel
+     * 
+     * @since S60 5.0
+     * @param[in] aNewState State to update this channel
+     */
+    void UpdateState( const TSsyReferenceChannelState aNewState );
+
+    /**
+     * Reference to SsyControl
+     */
+    CSsyReferenceControl& SsyControl() const;
+
+    /**
+     * Reference to command handler
+     */
+    CSsyReferenceCmdHandler& CommandHandler() const;
+
+    /**
+     * Search property of given property id from the channel properties and 
+     * returns reference to that. Leaves with KErrNotFound if property is not found
+     *
+     * @since S60 5.0
+     * @param[in] aPropertyId Property ID to locate
+     * @param[in] aItemIndex Item index if this search conserns specific property
+     * @param[in] aArrayIndex Indicates array index of property
+     */
+    TSensrvProperty& FindPropertyL( const TSensrvPropertyId aPropertyId,
+                                    TInt aItemIndex = KErrNotFound,
+                                    TInt aArrayIndex = ESensrvSingleProperty );
+
+    /**
+     * Search property of given property id from the channel properties and 
+     * update property values, if not read only
+     *
+     * @since S60 5.0
+     * @param[in] aProperty Property to find and update
+     */
+    void FindAndUpdatePropertyL( const TSensrvProperty& aProperty );
+    
+
+    /**
+     * Copies properties to param PropertyList
+     *
+     * @since S60 5.0
+     * @param[in, out] aPropertyList List where to copy properties
+     */
+    void GetProperties( RSensrvPropertyList& aPropertyList );
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     * @since S60 5.0
+     * @param[in] aSsyControl Reference to SSY Control instance.
+     * @param[in] aChannelInfo Information of this channel
+     */
+    CSsyReferenceChannel( CSsyReferenceControl& aSsyControl, TSensrvChannelInfo aChannelInfo );
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Handles response for OpenChannel and completes transaction by calling 
+     * MSsyCallback::ChannelOpened
+     *
+     * @since S60 5.0
+     * @param[in] aError Error code indicating the channel opening status
+     */
+    void HandleOpenChannelRespL( const TInt aError );
+
+    /**
+     * Handles response for CloseChannel and completes transaction by calling 
+     * MSsyCallback::ChannelClosed
+     *
+     * @since S60 5.0
+     */
+    void HandleCloseChannelResp();
+
+    /**
+     * Handles response for StartChannelData. Loops all channel data items and sends 
+     * each item to ChannelDataProvider
+     *
+     * @since S60 5.0
+     */
+    void HandleDataReceivedResp();
+
+private: // data
+
+    /**
+     * Reference to SSY Control to send responses to Sensor Server
+     */
+    CSsyReferenceControl& iSsyControl;
+
+    /**
+     * Pointer to CSsyReferenceChannelDataProvider owned by this channel
+     */
+    CSsyReferenceChannelDataProvider* iChannelDataProvider;
+
+    /**
+     * Pointer to CSsyReferencePropertyProvider owned by this channel
+     */
+    CSsyReferencePropertyProvider* iChannelPropertyProvider;
+
+    /**
+     * Pointer to command handler
+     */
+    CSsyReferenceCmdHandler* iCmdHandler;
+
+    /**
+     * Information of this channel
+     */
+    TSensrvChannelInfo iChannelInfo;
+
+    /**
+     * State of this channel. See CSsyReferenceChannel::TSsyReferenceChannelState
+     */
+    TInt iState;
+
+    /**
+     * Property list of this channel
+     */
+    RSensrvPropertyList iProperties;
+    };
+
+#endif // SSYREFERENCECHANNEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencechanneldataprovider.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* 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:  Reference implementation of SSY Channel Data Provider interface
+*
+*/
+
+
+#ifndef SSYREFERENCECHANNELDATAPROVIDER_H
+#define SSYREFERENCECHANNELDATAPROVIDER_H
+
+#include <ssychanneldataprovider.h>
+
+class CSsyReferenceChannel;
+class TSsyReferenceMsg;
+
+/**
+ *  Channel data provider implementation.
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferenceChannelDataProvider : public CBase, public MSsyChannelDataProvider
+    {
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @param[in] aChannel Reference to channel this provider belongs to
+     * @return CSsyReferenceChannelDataProvider* Pointer to created CSsyReferenceControl object
+     */
+    static CSsyReferenceChannelDataProvider* NewL( CSsyReferenceChannel& aChannel );
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferenceChannelDataProvider();
+
+// from base class MSsyChannelDataProvider
+
+    /**
+     * From MSsyChannelDataProvider
+     * Starts asynchronous data listening. Multiple OpenChannel()-requests
+     * can be active for different channels at the same time.
+     *
+     * @since S60 5.0
+     * @param[in] aBuffer Pointer to a data buffer 
+     * @param[in] aCount Indicates data buffer size as a count of the data objects.
+     */
+    void StartChannelDataL( const TSensrvChannelId aChannelId, TUint8* aBuffer, TInt aCount );
+
+    /**
+     * From MSsyChannelDataProvider
+     * Stops asynchronous data listening. The data buffer is not valid after call of 
+     * this function.
+     *
+     * @since S60 5.0
+     */
+    void StopChannelDataL( const TSensrvChannelId aChannelId );
+
+    /**
+     * From MSsyChannelDataProvider
+     * Forces SSY to call BufferFilled() regardless of how many data items have been
+     * written to buffer. Even if no data items have yet been written, BufferFilled()
+     * must be called.
+     *
+     * @since S60 5.0
+     */
+    void ForceBufferFilledL( const TSensrvChannelId aChannelId );
+
+    /** 
+    * Returns a pointer to a specified interface - to allow future extension
+    * of this class without breaking binary compatibility
+    *
+    * @since S60 5.0
+    * @param aInterfaceUid Identifier of the interface to be retrieved
+    * @param aInterface A reference to a pointer that retrieves the specified interface.
+    */
+    void GetChannelDataProviderInterfaceL( TUid aInterfaceUid, TAny*& aInterface );
+
+    /**
+     * Channel data item received
+     *
+     * @param[in] aMessage Contains channel item
+     */
+    void ChannelDataReceivedL( TSsyReferenceMsg* aMessage );
+
+private:
+
+    /**
+     * C++ constructor.
+     * @param[in] aChannel Reference to channel this provider belongs to
+     */
+    CSsyReferenceChannelDataProvider( CSsyReferenceChannel& aChannel );
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Adds data into buffer. 
+     *
+     *@param[in] aData Data to add to buffer
+     *@param[in] aSize Size of data
+     */
+    void AddDataToBuffer( TUint8* aData, const TInt aSize );
+
+    /**
+     * Sends BufferFilled notification to MSsyCallback
+     */
+    void SendBufferFilled();
+
+private: // data
+
+    /**
+     * Reference to channel for which this provider belongs to
+     */
+    CSsyReferenceChannel& iChannel;
+
+    /**
+     * Pointer to data buffer in Sensor Server side
+     */
+    TUint8* iDataBuffer;
+
+    /**
+     * Maximum requested data items
+     */
+    TInt iMaxCount;
+
+    /**
+     * Number of items in buffer
+     */
+    TInt iDataCount;
+
+    };
+
+#endif // SSYREFERENCECHANNELDATAPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencecmdhandler.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,148 @@
+/*
+* 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:  Command handler for SSY <--> Sensor messages
+*
+*/
+
+
+#ifndef SSYREFERENCECMDHANDLER_H
+#define SSYREFERENCECMDHANDLER_H
+
+#include <e32base.h>
+#include "ssyreferenceconfig.h"
+
+// FORWARD DECLARATIONS
+class CSsyReferenceChannel;
+
+/**
+ *  Command handler class for handling commands of one channel. Each opened 
+ *  channel has its own instance of this class
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferenceCmdHandler : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @param[in] aSsyChannel Reference to SSY Channel instance.
+     * @return CSsyReferenceCmdHandler* Pointer to created CSsyReferenceCmdHandler object
+     */
+    static CSsyReferenceCmdHandler* NewL( CSsyReferenceChannel& aSsyChannel );
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferenceCmdHandler();
+
+// from base class CSsyControl
+
+    /**
+     * Processes command specified in param aMessage. 
+     *
+     * @since S60 5.0
+     * @param[in] aMessage Contains command information to process
+     * @return void Symbian OS error code
+     */
+    TInt ProcessCommand( TSsyReferenceMsg aMessage );
+
+    /**
+     * From CActive
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     */
+    TInt RunError( TInt aError );
+
+    /**
+     * Callback function for DataItem generation
+     */
+    static TInt DataItemCallback( TAny* aThis );
+    
+    /**
+     * Handles data item generation. Called from DataItemCallback
+     */
+    TInt GenerateChannelDataItem();
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     * @since S60 5.0
+     * @param[in] aSsyChannel Reference to SSY Channel instance.
+     */
+    CSsyReferenceCmdHandler( CSsyReferenceChannel& aSsyChannel );
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Makes synchronous calls asynchronous
+     */
+    void IssueRequest( TInt aError = KErrNone );
+
+    /**
+     * Sends response to channel
+     */
+    void SendResponse( TInt aError = KErrNone );
+
+private: // data
+
+    /**
+     * Reference to SSY Conrtol to send responses for commands
+     */
+    CSsyReferenceChannel& iSsyChannel;
+
+    /**
+     * Pointer to currently processing message
+     */
+    TSsyReferenceMsg* iMessage;
+
+    /**
+     * Data item array
+     */
+    TSsyRefDataItemArray iDataItemArray;
+
+    /**
+     * Pointer to next item to generate in iDataItemArray
+     */
+    TInt iDataItemPtr;
+
+    /**
+     * Periodic timer for generating channel data
+     */
+    CPeriodic* iTimer;
+
+    };
+
+#endif // SSYREFERENCECMDHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferenceconfig.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,598 @@
+/*
+* 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:  Contains SSY Reference's channel configuration data
+*
+*/
+
+
+
+
+#ifndef SSYREFERENCECONFIG_H
+#define SSYREFERENCECONFIG_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <sensrvtypes.h>
+#include <sensrvchannelinfo.h>
+#include <gmxmlparser.h>
+#include <sensrvchanneldatatypes.h>
+#include <sensrvproximitysensor.h>
+#include <sensrvilluminationsensor.h>
+
+// CONSTANTS
+// Data item sizes
+const TInt KSsyRefAxisDataItemSize = sizeof( TSensrvAccelerometerAxisData );
+const TInt KSsyRefTappingDataItemSize = sizeof( TSensrvTappingData );
+const TInt KSsyRefProximityDataItemSize = sizeof( TSensrvProximityData );
+const TInt KSsyRefAmbientLightDataItemSize = sizeof( TSensrvAmbientLightData );
+const TInt KSsyRefMagneticAxisDataItemSize = sizeof( TSensrvMagnetometerAxisData );
+
+// ENUMS
+enum TSsyReferenceFunctions
+    {
+    ESsyReferenceOpenChannel,
+    ESsyReferenceOpenChannelResp,
+    ESsyReferenceDataItemReceived,
+    ESsyReferenceCloseChannel,
+    ESsyReferenceCloseChannelResp,
+    ESsyReferenceStartChannelData,
+    ESsyReferenceStopChannelData
+    };
+
+/**
+ * Base class for Channel data types. Contains iChannelDataType which is set
+ * by derived classes on construction.
+ */
+class TSsyRefChannelDataBase
+    {
+    public:
+    /**
+     * Enumeration for possible channel data types
+     */
+    enum TSsyRefChannelDataType
+        {
+        ESsyRefChannelTypeTapping = 5000,
+        ESsyRefChannelTypeAxis,
+        ESsyRefChannelTypeProximity,
+        ESsyRefChannelTypeAmbientLight,
+        ESsyRefChannelTypeMagneticAxis
+        };
+   
+    TInt  ChannelDataType() const { return iChannelDataType; }
+    TInt  Interval() const { return iInterval; }
+    
+    void SetTimestamp( const TTime aTimestamp ) { iTimestamp = aTimestamp; }
+    TTime Timestamp() const { return iTimestamp; }
+
+    TInt  Size() const { return iSize; }
+
+    protected:
+
+    /**
+     * Protected constructor as this class is not supposed to be instantiate
+     * directly.
+     */
+    TSsyRefChannelDataBase() {}
+
+    protected: // data
+
+    /**
+     * Identifies the type of data type class derived from this base class
+     */
+    TInt iChannelDataType;
+    
+    /**
+     * Interval. Indicates time in ms from previous item until next item is produced
+     */
+    TInt iInterval;
+
+    /**
+     * Timestamp. Time when this data item is generated.
+     */
+    TTime iTimestamp;
+
+    /**
+     * Size of one data item. This is filled by derived class
+     */
+    TInt iSize;
+
+    /**
+     * Axis data item values. 
+     * Accessible from TSsyRefChannelDataAxis/TSsyRefChannelDataMagneticAxis classes
+     */
+    TInt iXAxis;
+    TInt iYAxis;
+    TInt iZAxis;
+    /**
+     * Axis data calibrated values. 
+     * Accessible from TSsyRefChannelDataMagneticAxis classes
+     */
+    TInt iXAxisCalib;
+    TInt iYAxisCalib;
+    TInt iZAxisCalib;
+
+    
+    /**
+     * Proximity data item values.
+     * Accessible only from TSsyRefChannelProximity class
+     */    
+    TInt iProximityState;
+
+    /**
+     * AmbientLight data item values.
+     * Accessible only from TSsyRefChannelAmbientLight class
+     */    
+    TInt iAmbientLightState;
+
+    /**
+     * Tapping data item values. Difrection of the tapping.
+     * Accessible only from TSsyRefChannelDataTapping class
+     */
+    TInt iDirection;
+    };
+
+// Type definition array for Data item base class
+typedef RArray<TSsyRefChannelDataBase> TSsyRefDataItemArray;
+
+/**
+ * Message item for SSY <--> Sensor communications
+ * Contains Channel ID for which the message belongs to,
+ * Function ID that identifies the command and
+ * error for error cases. 
+ */
+class TSsyReferenceMsg
+    {
+    public:
+
+    /**
+    * Constructor of the TSsyReferenceMsg
+    *
+    * @since S60 5.0
+    * @param[in] aChannelId Channel identifier
+    * @param[in] aFunction See TSsyReferenceFunctions
+    */  
+    TSsyReferenceMsg( TInt aChannelId, TInt aFunction ) : 
+        iChannelId( aChannelId ), 
+        iFunction( aFunction ),
+        iError( KErrNone )
+        {}
+
+    /**
+     * Copy constructor of the TSsyReferenceMsg
+     *
+     * @since S60 5.0
+     * @param[in] aMsg Object to be copied to constructed object
+     */    
+    TSsyReferenceMsg( const TSsyReferenceMsg& aMsg ) :
+        iChannelId( aMsg.iChannelId ),
+        iFunction( aMsg.iFunction ),
+        iError( aMsg.iError )
+        {}
+
+    TInt ChannelId() { return iChannelId; }
+
+    void SetFunction( TInt aFunction ) { iFunction = aFunction; }
+    TInt Function()  { return iFunction; }
+
+    void SetError( TInt aError ) { iError = aError; }
+    TInt Error()     { return iError; }
+
+    void SetDataItem( TSsyRefChannelDataBase* aDataItem ) { iDataItem = aDataItem; }
+    TSsyRefChannelDataBase* DataItem() const { return iDataItem; }
+
+    private: // data
+    
+    TInt iChannelId; // Identifies the channel
+    TInt iFunction;  // Identifies the command
+    TInt iError;     // Error is passed to response handler
+    
+    // Data item for received data. This is casted to correct data item 
+    // class implementation according to ChannelDataType
+    TSsyRefChannelDataBase* iDataItem;
+    };
+
+/**
+ * Tapping data type class implementation.
+ */
+class TSsyRefChannelDataTapping : public TSsyRefChannelDataBase
+    {
+    public:
+
+    TSsyRefChannelDataTapping( TInt aDirection, TInt aInterval  )
+        { 
+        iChannelDataType = ESsyRefChannelTypeTapping;
+        iSize = KSsyRefTappingDataItemSize;
+        iInterval = aInterval;
+        iDirection = aDirection;
+        }
+    
+    TInt Direction() const { return iDirection; }
+    };
+
+/**
+ * XYZ Axis data type class implementation.
+ */
+class TSsyRefChannelDataAxis : public TSsyRefChannelDataBase
+    {
+    public:
+
+    TSsyRefChannelDataAxis( TInt aXAxis, TInt aYAxis, TInt aZAxis, 
+                            TInt aInterval )
+        { 
+        iChannelDataType = ESsyRefChannelTypeAxis;
+        iSize = KSsyRefAxisDataItemSize;
+        iInterval = aInterval; 
+        iXAxis = aXAxis;
+        iYAxis = aYAxis;
+        iZAxis = aZAxis;
+        }
+    
+    TInt XAxis() const { return iXAxis; }
+    TInt YAxis() const { return iYAxis; }
+    TInt ZAxis() const { return iZAxis; }
+    };
+
+
+/**
+ * Proximity data type class implementation.
+ */
+class TSsyRefChannelDataProximity : public TSsyRefChannelDataBase
+    {
+    public:
+
+    TSsyRefChannelDataProximity( TInt aProximityState, TInt aInterval )
+        { 
+        iChannelDataType = ESsyRefChannelTypeProximity;
+        iSize = KSsyRefProximityDataItemSize;
+        iInterval = aInterval; 
+        iProximityState = aProximityState;
+        }
+    
+    TInt ProximityState() const { return iProximityState; }
+    };
+
+/**
+ * AmbientLight data type class implementation.
+ */
+class TSsyRefChannelDataAmbientLight : public TSsyRefChannelDataBase
+    {
+    public:
+
+    TSsyRefChannelDataAmbientLight( TInt aAmbientLightState, TInt aInterval )
+        { 
+        iChannelDataType = ESsyRefChannelTypeAmbientLight;
+        iSize = KSsyRefAmbientLightDataItemSize;
+        iInterval = aInterval; 
+        iAmbientLightState = aAmbientLightState;
+        }
+    
+    TInt AmbientLightState() const { return iAmbientLightState; }
+    };
+
+/**
+ * XYZ Axis data type class implementation.
+ */
+class TSsyRefChannelDataMagneticAxis : public TSsyRefChannelDataBase
+    {
+    public:
+
+    TSsyRefChannelDataMagneticAxis( TInt aXAxis, TInt aYAxis, TInt aZAxis, 
+        TInt aXAxisCalib, TInt aYAxisCalib, TInt aZAxisCalib, TInt aInterval )
+        { 
+        iChannelDataType = ESsyRefChannelTypeMagneticAxis;
+        iSize = KSsyRefMagneticAxisDataItemSize;
+        iInterval = aInterval; 
+        iXAxis = aXAxis;
+        iYAxis = aYAxis;
+        iZAxis = aZAxis;
+        iXAxisCalib = aXAxisCalib;
+        iYAxisCalib = aYAxisCalib;
+        iZAxisCalib = aZAxisCalib;
+        }
+    
+    TInt XAxis() const { return iXAxis; }
+    TInt YAxis() const { return iYAxis; }
+    TInt ZAxis() const { return iZAxis; }
+    TInt XAxisCalib() const { return iXAxisCalib; }
+    TInt YAxisCalib() const { return iYAxisCalib; }
+    TInt ZAxisCalib() const { return iZAxisCalib; }
+    };
+
+/**
+ * Channel ID pair class for pairing config file channel id and
+ * Sensor Server generated channel ID.
+ *
+ */
+class TSsyRefChannelIdPair
+    {
+    public:
+    /**
+    * Constructor of the TSsyRefChannelIdPair
+    *
+    * @since S60 5.0
+    * @param[in] aConfigChannelId Channel identifier from config file
+    */  
+    TSsyRefChannelIdPair( TInt aConfigChannelId ) : 
+        iConfigChannelId( aConfigChannelId )
+        {}
+
+    TInt ConfigId() const { return iConfigChannelId; }
+    TInt ServerId() const { return iSrvChannelId; }
+
+    void SetServerId( const TInt aSrvId ) { iSrvChannelId = aSrvId; }
+
+    private: // data
+    
+    TInt iConfigChannelId; // Config file ID of the channel
+    TInt iSrvChannelId;    // Sensor server assigned ID of the channel
+    };
+
+typedef RArray<TSsyRefChannelIdPair> TSsyRefChannelIdArray;
+
+
+// CONSTANTS
+
+/**
+ *  Configuration class for SSY reference plugin. Generates configured SSY channel information.
+ *  This keeps reference SSY implementation independent from 'sensor' it uses. This class is fully
+ *  modifiable regarding to the needs of this SSY. It may be for example accelerometer sensor 
+ *  without any changes in the SSY reference implementation. Only this class is modified.
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferenceConfig : public CActive, public MMDXMLParserObserver
+    {
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @return CSsyReferenceConfig* Pointer to created CSsyReferenceControl object
+     */
+    static CSsyReferenceConfig* NewL();
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferenceConfig();
+
+    /**
+     * From CActive
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     */
+    void DoCancel();
+
+    /**
+     * From CActive
+     */
+    TInt RunError( TInt aError );
+
+    /**
+     * From MMDXMLParserObserver
+     *
+	 * Call back function used to inform a client of the Parser when a parsing operation completes.
+     * @since S60 5.0
+	 */
+	void ParseFileCompleteL();
+
+    /**
+	 * Starts parsing config file. This function blocks until file is parsed
+     * @since S60 5.0
+	 */
+	void InitConfigL();
+
+    /**
+     * Total number of channels this SSY provides
+     *
+     * @since S60 5.0
+     * @return TInt Count of channels this SSY is configured to provide
+     */
+    TInt ChannelCount();
+
+    /**
+     * Generates channels this SSY is configured to provide
+     *
+     * @since S60 5.0
+     * @param[in,out] aChannnelList Filled with generated channels by this configurator
+     */
+    void GenerateChannels( RSensrvChannelInfoList& aChannelList );
+
+    /**
+     * Updates Sensor server's generated channel Ids
+     *
+     * @since S60 5.0
+     * @param[in] aChannnelList Same list as GenerateChannels produces but 
+     *                this contains channel identifiers
+     */
+    void UpdateChannelIds( RSensrvChannelInfoList aChannelList );
+
+    /**
+     * Reads all channel data information from config file and fills
+     * parameters with information
+     *
+     * @since S60 5.0
+     * @param[in]     aSrvChannelId Sensor server generated channel id of the target channel
+     * @param[in,out] aDataItemList Contains data item objects defined in config file. Each
+     *                Data item is presented as Data Item class derived from TSsyRefChannelDataBase.
+     *                List can contain only one type of derived channel data items
+     * @param[in,out] aStartInterval Contains start interval to start producing data items
+     */
+    void GetChannelDataInformationL( const TInt aSrvChannelId, 
+                                     TSsyRefDataItemArray& aDataItemList, 
+                                     TInt& aStartInterval );
+
+    /**
+     * Reads sensor properties from config file and adds them to list
+     *
+     * @since S60 5.0
+     * @param[out] aPropertyList List where to append properties
+     */
+    void GetSensorPropertiesL( RSensrvPropertyList& aPropertyList );
+
+    /**
+     * Reads channel properties from config file and adds them to list
+     *
+     * @since S60 5.0
+     * @param[in] aSenSrvChannelId Sensor server generated channel id
+     * @param[out] aPropertyList List where to append properties
+     */
+    void GetChannelPropertiesL( const TInt aSrvChannelId, 
+                                RSensrvPropertyList& aPropertyList );
+
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CSsyReferenceConfig();
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Makes synchronous calls asynchronous
+     */
+    void IssueRequest( TInt aError = KErrNone );
+
+    /**
+     * Reads attribute value from element and casts it into TInt value
+     * 
+     * @since S60 5.0
+     * @param[in] aElement Element from where to read attribute
+     * @param[in] aAttrib Attribute name which to read
+     * @return TInt Integer value of read value
+     */
+    TInt GetAttributeIntValue( CMDXMLElement& aElement, const TDesC& aAttrib );
+
+    /**
+     * Reads attribute value from element and casts it into literal value
+     * 
+     * @since S60 5.0
+     * @param[in] aElement Element from where to read attribute
+     * @param[in] aAttrib Attribute name which to read
+     * @param[in/out] aTarget Target descriptor where to copy read literal
+     */
+    void GetAttributeStrValue( CMDXMLElement& aElement, const TDesC& aAttrib, TDes8& aTarget );
+
+    /**
+     * Reads attribute value from element and casts it into TReal value
+     * 
+     * @since S60 5.0
+     * @param[in] aElement Element from where to read attribute
+     * @param[in] aAttrib Attribute name which to read
+     * @return TReal value of the attribute
+     */
+    TReal GetAttributeRealValue( CMDXMLElement& aElement, const TDesC& aAttrib );
+
+    /**
+     * Reads Hexadesimal attribute value from element and casts it into Integer value
+     * 
+     * @since S60 5.0
+     * @param[in] aElement Element from where to read attribute
+     * @param[in] aAttrib Attribute name which to read
+     * @return TUint Unsigned integer value of read Hexadesimal value
+     */
+    TUint GetAttributeHexValue( CMDXMLElement& aElement, const TDesC& aAttrib );
+
+    /**
+     * Compares Sensor server generated channel IDs and return corresponding 
+     * ConfigFile channel id
+     * 
+     * @since S60 5.0
+     * @param[in] aSrvChannelId SenServer generated channel ID for which pair is needed
+     * @return TInt ConfigFile channel ID that is paired with aSrvChannelId
+     */
+    TInt ConfigChannelId( const TInt aSrvChannelId ) const;
+
+    /**
+     * Searches channel element for given SensorServer generated channel ID
+     * 
+     * @since S60 5.0
+     * @param[in] aSrvChannelId SenServer generated channel ID identifying wanted channel element
+     * @return CMDXMLElement Pointer to found channel element or NULL if not found
+     */
+    CMDXMLElement* ChannelElement( const TInt aSrvChannelId );
+
+    /**
+     * Reads properties from given element and adds them to list. 
+     * Element can be either 'SsyGenealInformation' or 'ChannelItem'
+     *
+     * @since S60 5.0
+     * @param[in]  aElement Element from where to read properties
+     * @param[out] aPropertyList List where to append properties
+     */
+    void GetElementPropertiesL( CMDXMLElement& aElement, RSensrvPropertyList& aPropertyList );
+
+
+private: // data
+    
+    /**
+     * Pointer of the config xml-file parser
+     */
+    CMDXMLParser* iConfigParser;
+
+    /**
+     * Contains Ssy general information element and all of its childs
+     */
+    CMDXMLElement* iGenralInfoElement;
+
+    /**
+     * Contains Ssy Channel information group element and all of its childs
+     * including each channel information and channel data for testing purpose
+     */
+    CMDXMLElement* iChannelGroupElement;
+
+    /**
+     * Number of channels defined in config file
+     */
+    TInt iChannelCount;
+
+    /**
+     * Active scheduler wait for blocking construction until config file is parsed
+     */
+    CActiveSchedulerWait iSchedulerWait;
+
+    /**
+     * Indicates is config file parsed
+     */
+    TBool iConfigFileParsed;
+
+    /**
+     * Channel ID pair array
+     */
+    TSsyRefChannelIdArray iChannelPairArray;
+
+    /**
+     * Elements of the config file. These needs to be stored
+     */
+    CMDXMLDocument* iConfigFile;
+    CMDXMLElement*  iSsyReferenceConfig; // Root of the config
+
+    };
+
+#endif //SSYREFERENCECONFIG_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencecontrol.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,159 @@
+/*
+* 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:  Reference implementation of SSY Control
+*
+*/
+
+
+#ifndef SSYREFERENCECONTROL_H
+#define SSYREFERENCECONTROL_H
+
+#include <ssycontrol.h>
+#include "ssyreferenceconfig.h"
+
+// FORWARD DECLARATIONS
+class CSsyReferenceChannel;
+
+/**
+ *  Main control class for SSY. Controls sensor basic functionality and provides mandatory 
+ *  ECOM interface specific things.
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferenceControl : public CSsyControl
+    {
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @param[in] aSsyCallback Reference to SSY callback instance.
+     * @return CSsyReferenceControl* Pointer to created CSsyReferenceControl object
+     */
+    static CSsyReferenceControl* NewL( MSsyCallback& aSsyCallback );
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferenceControl();
+
+// from base class CSsyControl
+
+    /**
+     * From CSsyControl
+     * Request for SSY to open a sensor channel asynchronously. 
+     * Response to the request is delivered through MSsyCallback::ChannelOpened().
+     * Initilizes SSY (and the sensor) to be ready for other control commands via
+     * data and property providers. Multiple OpenChannel()-requests can be
+     * active for different channels at the same time.
+     *
+     * @since S60 5.0
+     * @param[in] aChannelID Channel that is requested to be opened
+     * @return Symbian OS error code
+     */
+    void OpenChannelL( TSensrvChannelId aChannelID );
+
+    /**
+     * From CSsyControl
+     * Request to close a sensor channel asynchronously. 
+     * Response to the request is delivered through MSsyCallback::ChannelClosed().
+     * Multiple CloseChannel()-requests can be active for different channels 
+     * at the same time.
+     *
+     * @since S60 5.0
+     * @param[in] aChannelID Channel that is reqeusted to be closed
+     * @leave Symbian OS error code
+     */  
+    void CloseChannelL( TSensrvChannelId aChannelID );
+
+    /**
+     * Reference to SSY Callback instance
+     */
+    MSsyCallback& SsyCallback() const;
+
+    /**
+     * Reference to SSY Config file
+     */
+    CSsyReferenceConfig& SsyConfig() const;
+    /**
+     * Handles response to CSsyReferenceCmdHandler::ProcessCommand
+     *
+     * @since S60 5.0
+     * @param[in] aMessage Contains information of the response
+     */
+    void ProcessResponse( TSsyReferenceMsg* aMessage );
+
+    /**
+     * Search property of given property id from the channel properties and 
+     * returns reference to that. Leaves with KErrNotFound if property is not found
+     *
+     * @since S60 5.0
+     * @param[in]  aPropertyId Property ID to locate
+     * @param[in]  aArrayIndex Propertys array index
+     * @param[out] aProperty Contains found property
+     */
+    void FindPropertyL( const TSensrvPropertyId aPropertyId, 
+                        const TInt aArrayIndex,
+                        TSensrvProperty& aProperty );
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     * @since S60 5.0
+     * @param[in] aSsyCallback Reference to SSY callback instance.
+     */
+    CSsyReferenceControl( MSsyCallback& aSsyCallback );
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Finds and returns pointer to channel
+     */
+    CSsyReferenceChannel* FindChannelL( TSensrvChannelId aChannelID );
+
+private: // data
+
+    /**
+     * Reference to SSY CallBack to send responses to Sensor Server
+     */
+    MSsyCallback& iSsyCallback;
+
+    /**
+     * Pointer array of all channels provided by this SSY
+     */
+    CArrayPtrFlat<CSsyReferenceChannel>* iChannelArray;
+
+    /**
+     * Pointer to config file parser
+     */
+    CSsyReferenceConfig* iConfigFile;
+
+    /**
+     * Property list of general properties of this SSY
+     */
+    RSensrvPropertyList iProperties;
+
+    };
+
+#endif // SSYREFERENCECONTROL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencepropertyprovider.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,140 @@
+/*
+* 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:  Reference implementation of SSY Property Provider interface
+*
+*/
+
+
+#ifndef SSYREFERENCEPROPERTYPROVIDER_H
+#define SSYREFERENCEPROPERTYPROVIDER_H
+
+#include <ssypropertyprovider.h>
+
+class CSsyReferenceChannel;
+
+/**
+ *  Channel property provider implementation.
+ *
+ *  @lib ssyreferenceplugin.lib
+ *  @since S60 5.0
+ */
+class CSsyReferencePropertyProvider : public CBase, public MSsyPropertyProvider
+    {
+
+public:
+
+    /**
+     * Two-phase constructor
+     *
+     * @since S60 5.0
+     * @param[in] aChannel Reference to channel this provider belongs to
+     * @return CSsyReferenceChannelDataProvider* Pointer to created CSsyReferenceControl object
+     */
+    static CSsyReferencePropertyProvider* NewL( CSsyReferenceChannel& aChannel );
+
+    /**
+     * Virtual destructor
+     *
+     * @since S60 5.0
+     */
+    virtual ~CSsyReferencePropertyProvider();
+
+// from base class MSsyPropertyProvider
+
+    /**
+     * From MSsyPropertyProvider
+     * Check if property value affects other sensor channels already open.
+     * If the new property value is legal but affects somehow other channels' properties,
+     * SSY must return list of the affected channels so that the sensor server can
+     * check if the client allowed to set this property. If the SSY value 
+     * is not legal SSY must leave with KErrArgument-value.
+     *
+     * @since S60 5.0
+     * @param[in] aProperty Property to be checked. 
+     * @param[out] aAffectedChannels Return list of the channel which will be affected if the property 
+     *       value will be set.
+     * @leave KErrArgument If the property value is illegal.
+     */  
+    void CheckPropertyDependenciesL( const TSensrvChannelId aChannelId,
+                                     const TSensrvProperty& aProperty,
+                                     RSensrvChannelList& aAffectedChannels ); 
+
+    /**
+     * From MSsyPropertyProvider
+     * Set property for the channel. Before the sensor server sets the property value,
+     * it is checked with CheckPropertyDependenciesL()-function.
+     * This means a property value should always be valid for the SSY.
+     *
+     * @since S60 5.0
+     * @param[in] aProperty Rereference to a property object to be set
+     */  
+    void SetPropertyL( const TSensrvChannelId aChannelId, 
+                       const TSensrvProperty& aProperty );
+
+    /**
+     * From MSsyPropertyProvider
+     * Get channel property value. The property parameter contains channel id and
+     * item index. SSY fills values and attributes to the property object.
+     *
+     * @since S60 5.0
+     * @param[in, out] aProperty Reference to a property object to be filled
+     *     with property values and attributes.
+     */  
+    void GetPropertyL( const TSensrvChannelId aChannelId, 
+                       TSensrvProperty& aProperty );
+
+    /**
+     * From MSsyPropertyProvider
+     * Get all channel properties. Returns all properties which are related to this channel.
+     *
+     * @since S60 5.0
+     * @param[out] aChannelPropertyList List of the all properties of the channel.
+     */  
+    void GetAllPropertiesL( const TSensrvChannelId aChannelId,
+                            RSensrvPropertyList& aChannelPropertyList );
+
+    /** 
+    * Returns a pointer to a specified interface - to allow future extension
+    * of this class without breaking binary compatibility
+    *
+    * @since S60 5.0
+    * @param aInterfaceUid Identifier of the interface to be retrieved
+    * @param aInterface A reference to a pointer that retrieves the specified interface.
+    */
+    void GetPropertyProviderInterfaceL( TUid aInterfaceUid, 
+                                        TAny*& aInterface );
+
+private:
+
+    /**
+     * C++ constructor.
+     * @param[in] aChannel Reference to channel this provider belongs to
+     */
+    CSsyReferencePropertyProvider( CSsyReferenceChannel& aChannel );
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Reference to channel for which this provider belongs to
+     */
+    CSsyReferenceChannel& iChannel;
+
+    };
+
+#endif // SSYREFERENCEPROPERTYPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/inc/ssyreferencetrace.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,110 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef SSYREFERENCETRACE_H
+#define SSYREFERENCETRACE_H
+
+// INCLUDES
+#include <e32svr.h>
+
+// PC-LINT OPTIONS
+// Removes null statement not in line by itself warnings from 
+// COMPONENT_TRACE macros
+//lint -esym(960,54)
+
+// Removes "area too small" pointer cast warnings.
+//lint -e826
+
+
+
+// CONSTANTS
+// MACROS
+#ifdef _DEBUG
+
+    #ifdef THREAD_TRACE_FLAG
+    
+        #define THREAD_TRACE RDebug::Print(RThread().Name());
+        
+    #else
+        
+        #define THREAD_TRACE
+        
+    #endif // #ifdef THREAD_TRACE_FLAG
+    
+    #ifdef BUFFER_TRACE_FLAG
+    
+        #define BUFFER_TRACE_DEBUG
+        #define DEBUG_PRINT_BUFFER DebugPrintBuffer();
+        #define BUFFER_TRACE( a ) RDebug::Print a 
+        
+    #else
+        
+        #define DEBUG_PRINT_BUFFER
+        #define BUFFER_TRACE( a )
+        
+    #endif // #ifdef THREAD_TRACE_FLAG
+
+    #ifdef COMPONENT_TRACE_FLAG
+
+        #define COMPONENT_TRACE( a ) THREAD_TRACE;RDebug::Print a 
+        #define COMPONENT_TRACE_DEBUG   
+        
+    #else // #ifdef COMPONENT_TRACE_FLAG
+
+        #define COMPONENT_TRACE( a )
+
+    #endif //#ifdef COMPONENT_TRACE_FLAG
+
+    #ifdef API_TRACE_FLAG
+
+        #define API_TRACE( a ) THREAD_TRACE;RDebug::Print a
+        #define API_TRACE_DEBUG
+
+    #else //#ifdef API_TRACE_FLAG
+
+        #define API_TRACE( a )
+
+    #endif //#ifdef API_TRACE_FLAG
+
+    #ifdef ERROR_TRACE_FLAG
+
+        #define ERROR_TRACE( a ) THREAD_TRACE;RDebug::Print a
+        #define ERROR_TRACE_DEBUG
+
+    #else //#ifdef ERROR_TRACE_FLAG
+
+        #define ERROR_TRACE( a )
+
+    #endif //#ifdef ERROR_TRACE_FLAG
+
+#else // #ifdef _DEBUG
+
+    #define COMPONENT_TRACE( a )
+    #define API_TRACE( a )
+    #define ERROR_TRACE( a )
+    #define BUFFER_TRACE( a )
+    #define THREAD_TRACE
+    #define DEBUG_PRINT_BUFFER
+
+#endif //#ifdef _DEBUG
+
+#endif // SSYREFERENCETRACE_H
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/rom/ssyreference.iby	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,30 @@
+/*
+* 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:  Reference / stub implementation for Sensor framework SSY plugin
+*
+*/
+
+
+#ifndef SSYREFERENCE_IBY
+#define SSYREFERENCE_IBY
+
+#ifdef RD_SENSOR_FW
+ECOM_PLUGIN(ssyreferenceplugin.dll, ssyreferenceplugin.rsc)
+data=ZPRIVATE\1020507E\reference\SsyReferenceConfig.xml         \private\1020507E\reference\SsyReferenceConfig.xml
+#endif // RD_SENSOR_FW
+
+#endif // SSYREFERENCE_IBY
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ECOMEntryPoint.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -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:  ECom entry point for creating ECom plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "ssyreferencecontrol.h"
+
+// Define the interface UIDs
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x10205088,
+                                CSsyReferenceControl::NewL )
+    };
+
+// The one and only exported function that is the ECom entry point
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy
+        (TInt& aTableCount)
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+/**
+ * Standard Symbian OS DLL entry point.
+ */
+#ifndef EKA2
+TBool E32Dll(TDllReason)
+    {
+    return ETrue;
+    }
+#endif // EKA2
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferencechannel.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,443 @@
+/*
+* 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:  Reference implementation of SSY Channel
+*
+*/
+
+
+#include <ssycallback.h>                     // MSsyCallback
+#include "ssyreferencechannel.h"
+#include "ssyreferencecontrol.h"             // SSY Control
+#include "ssyreferencepropertyprovider.h"    // iChannelPropertyProvider
+#include "ssyreferencechanneldataprovider.h" // iChannelDataProvider
+#include "ssyreferencetrace.h"
+#include "ssyreferencecmdhandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannel::CSsyReferenceChannel( CSsyReferenceControl& aSsyControl, TSensrvChannelInfo aChannelInfo ) :
+    iSsyControl( aSsyControl ),
+    iChannelInfo( aChannelInfo ),
+    iState( ESsyReferenceChannelIdle )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::CSsyReferenceChannel()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::CSsyReferenceChannel() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ConstructL()" ) ) );
+
+    // Create command handler
+    iCmdHandler = CSsyReferenceCmdHandler::NewL( *this );
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ConstructL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannel* CSsyReferenceChannel::NewL( CSsyReferenceControl& aSsyControl, TSensrvChannelInfo aChannelInfo )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::NewL()" ) ) );
+    CSsyReferenceChannel* self = new ( ELeave ) CSsyReferenceChannel( aSsyControl, aChannelInfo );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannel::~CSsyReferenceChannel()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::~CSsyReferenceChannel()" ) ) );
+
+    // In case channel is not closed before destruction, providers are not deleted
+    if ( iChannelDataProvider )
+        {
+        delete iChannelDataProvider;
+        iChannelDataProvider = NULL;
+        }
+    
+    if ( iChannelPropertyProvider )
+        {
+        delete iChannelPropertyProvider;
+        iChannelPropertyProvider = NULL;
+        }
+
+    if ( iCmdHandler )
+        {
+        delete iCmdHandler;
+        iCmdHandler = NULL;
+        }
+
+    iProperties.Reset();
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::~CSsyReferenceChannel() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::ChannelId
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceChannel::ChannelId()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ChannelId() - %i" ), iChannelInfo.iChannelId ) );
+    return iChannelInfo.iChannelId;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::SsyControl
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceControl& CSsyReferenceChannel::SsyControl() const
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::SsyControl()" ) ) );
+    return iSsyControl;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::SsyCmdHandler
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceCmdHandler& CSsyReferenceChannel::CommandHandler() const
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::SsyCmdHandler()" ) ) );
+    return *iCmdHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::FindPropertyL
+// ---------------------------------------------------------------------------
+//
+TSensrvProperty& CSsyReferenceChannel::FindPropertyL( 
+    const TSensrvPropertyId aPropertyId, 
+    TInt aItemIndex,
+    TInt aArrayIndex )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::FindPropertyL()" ) ) );
+    TSensrvProperty* property = NULL;
+    TBool propertyFound( EFalse );
+
+    // Search property
+    for ( TInt i = 0; i < iProperties.Count() && !propertyFound; i++ )
+        {
+        property = static_cast<TSensrvProperty*>( &iProperties[i] );
+
+        // Compare property IDs and array index
+        if ( property->GetPropertyId() == aPropertyId )
+            {
+            // Compare item index if it is given
+            if ( ( KErrNotFound == aItemIndex ) || ( property->PropertyItemIndex() == aItemIndex ) )
+                {
+                // Correct property ID is found, now check is it array type of property.
+                // Either array indexes must match or propertys array index has to be array info
+                if ( ( property->GetArrayIndex() == aArrayIndex ) || 
+                     ( ( property->GetArrayIndex() == ESensrvArrayPropertyInfo ) && 
+                       ( ESensrvSingleProperty == aArrayIndex ) ) )
+                    {
+                    // Correct array index found
+                    propertyFound = ETrue;    
+                    }
+                }
+            }
+        }
+
+    // Leave if not found
+    if ( !propertyFound )
+        {
+        iSsyControl.FindPropertyL( aPropertyId, aArrayIndex, *property );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::FindPropertyL() - return" ) ) );
+    return *property;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::FindAndUpdatePropertyL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::FindAndUpdatePropertyL( const TSensrvProperty& aProperty )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::FindAndUpdatePropertyL()" ) ) );
+    TBool propertyFound( EFalse );
+
+    // Search property
+    for ( TInt i = 0; i < iProperties.Count() && !propertyFound; i++ )
+        {
+        // Compare property IDs
+        if ( iProperties[i].GetPropertyId() == aProperty.GetPropertyId() )
+            {
+            // Compare item index if it is given
+            if ( ( KErrNotFound != aProperty.PropertyItemIndex() ) && 
+                 ( iProperties[i].PropertyItemIndex() == aProperty.PropertyItemIndex() ) )
+                {
+                // Property found -> update if possible
+                if ( iProperties[i].ReadOnly() )
+                    {
+                    User::Leave( KErrAccessDenied );
+                    }
+                // If modifiable, get type and update value
+                switch ( iProperties[i].PropertyType() )
+                    {
+                    case ESensrvIntProperty:
+                        {
+                        TInt value( 0 );
+                        aProperty.GetValue( value );
+                        iProperties[i].SetValue( value );
+                        break;
+                        }
+                    case ESensrvRealProperty:
+                        {
+                        TReal value( 0 );
+                        aProperty.GetValue( value );
+                        iProperties[i].SetValue( (TReal) value );
+                        break;
+                        }
+                    case ESensrvBufferProperty:
+                        {
+                        TBuf8<20> propValue;
+                        aProperty.GetValue( propValue );
+                        iProperties[i].SetValue( propValue );
+                        break;
+                        }
+                    default:
+                        {
+                        break;
+                        }
+                    }
+                propertyFound = ETrue;
+                }
+            }
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::FindPropertyL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::GetProperties
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::GetProperties( RSensrvPropertyList& aPropertyList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::GetProperties()" ) ) );
+    // Copy properties one by one to param aPropertyList
+    TInt propCount( iProperties.Count() );
+    RSensrvPropertyList propList( propCount );
+
+    for ( TInt i = 0; i < propCount; i++ )
+        {
+        propList.Append( iProperties[i] );
+        }
+
+    aPropertyList = propList;
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::GetProperties() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::UpdateState
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::UpdateState( const TSsyReferenceChannelState aNewState )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::UpdateState() - %i" ), aNewState ) );
+    iState = aNewState;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::ProcessResponse
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::ProcessResponse( TSsyReferenceMsg* aMessage )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ProcessResponse()" ) ) );
+    
+    if ( aMessage ) 
+        {
+        switch ( aMessage->Function() )
+            {
+            case ESsyReferenceOpenChannelResp:
+                {
+                // Open channel specific handling here
+                TRAPD( err, HandleOpenChannelRespL( aMessage->Error() ) );
+                if ( KErrNone != err )
+                    {
+                    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ProcessResponse() - Error opening channel: %i" ), err ) );
+                    }
+                break;
+                }
+            case ESsyReferenceDataItemReceived:
+                {
+                // Send data item to data provider
+                TRAPD( err, iChannelDataProvider->ChannelDataReceivedL( aMessage ) );
+                if ( KErrNone != err )
+                    {
+                    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ProcessResponse() - Error receiving data: %i" ), err ) );
+                    }
+                break;  
+                }
+            case ESsyReferenceCloseChannelResp:
+                {
+                // Close channel specific handling here
+                HandleCloseChannelResp();
+                break;  
+                }
+            default:
+                {
+                // This command was not intended to process here, try Control class
+                iSsyControl.ProcessResponse( aMessage );    
+                COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ProcessResponse() - Unknown function" ) ) );
+                }
+            }
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::ProcessResponse() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::OpenChannel
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceChannel::OpenChannel()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::OpenChannel()" ) ) );
+
+    TInt err( KErrAlreadyExists );
+
+    // Check that this channel is not already open
+    if ( ESsyReferenceChannelIdle == iState )
+        {
+        // Update state and issue request. Will continue in HandleOpenChannelResp
+        UpdateState( ESsyReferenceChannelOpening );
+
+        // Create message with function spesific information
+        // and pass it to command handler
+        err = iCmdHandler->ProcessCommand( TSsyReferenceMsg( ChannelId(), ESsyReferenceOpenChannel ) );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::OpenChannel() - return" ) ) );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::HandleOpenChannelResp
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::HandleOpenChannelRespL( const TInt aError )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::HandleOpenChannelResp()" ) ) );
+
+    // Open channel asynhronously and complete request with MSsyCallback::ChannelOpened() when
+    // channel is opened.
+
+    // Create instance of the data provider of this channel
+    iChannelDataProvider = CSsyReferenceChannelDataProvider::NewL( *this );
+    // Create instance of the property provider of this channel
+    iChannelPropertyProvider = CSsyReferencePropertyProvider::NewL( *this );
+
+    TInt error( aError );
+
+    // If channel opening succeeds, update state to Open
+    if ( KErrNone == aError )
+        {
+        // Update state to Open
+        UpdateState( ESsyReferenceChannelOpen );
+        // Get channel properties
+        TRAP( error, iSsyControl.SsyConfig().GetChannelPropertiesL( ChannelId(), iProperties ) );
+        }
+    else
+        {
+        // Channel opening failed, back to idle
+        UpdateState( ESsyReferenceChannelIdle ); 
+        }
+
+    // Complete transaction
+    iSsyControl.SsyCallback().ChannelOpened( ChannelId(),
+                                error,
+                                iChannelDataProvider,
+                                iChannelPropertyProvider );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::HandleOpenChannelResp() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::CloseChannel
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceChannel::CloseChannel()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::CloseChannel()" ) ) );
+
+    TInt err( KErrNotFound );
+
+    // Check that this channel is open
+    if ( ESsyReferenceChannelOpen == iState )
+        {
+        // Update state and issue request. Will continue in HandleCloseChannelResp
+        UpdateState( ESsyReferenceChannelClosing );
+        // Create message with function spesific information
+        // and pass it to command handler
+        err = iCmdHandler->ProcessCommand( TSsyReferenceMsg( ChannelId(), ESsyReferenceCloseChannel ) );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::CloseChannel() - return" ) ) );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannel::HandleCloseChannelResp
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannel::HandleCloseChannelResp()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::HandleCloseChannelResp()" ) ) );
+
+    // Close channel and complete request with MSsyCallback::ChannelClosed() when
+    // channel is closed.
+
+    // Delete providers
+    delete iChannelDataProvider;
+    iChannelDataProvider = NULL;
+
+    delete iChannelPropertyProvider;
+    iChannelPropertyProvider = NULL;
+
+    // Update state to idle
+    UpdateState( ESsyReferenceChannelIdle );
+
+    // Reset properties
+    iProperties.Reset();
+
+    // Complete transaction
+    iSsyControl.SsyCallback().ChannelClosed( ChannelId() );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannel::HandleCloseChannelResp() - return" ) ) );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferencechanneldataprovider.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,303 @@
+/*
+* 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:  Reference implementation of SSY Channel Data Provider interface
+*
+*/
+
+
+#include "ssyreferencechanneldataprovider.h"
+#include "ssyreferencetrace.h"
+#include "ssyreferencechannel.h"
+#include "ssyreferencecontrol.h"
+#include "ssyreferencecmdhandler.h"
+#include "ssycallback.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannelDataProvider::CSsyReferenceChannelDataProvider( CSsyReferenceChannel& aChannel ) :
+    iChannel( aChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::CSsyReferenceChannelDataProvider()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::CSsyReferenceChannelDataProvider() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ConstructL()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ConstructL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannelDataProvider* CSsyReferenceChannelDataProvider::NewL( CSsyReferenceChannel& aChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::NewL()" ) ) );
+    CSsyReferenceChannelDataProvider* self = new ( ELeave ) CSsyReferenceChannelDataProvider( aChannel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannelDataProvider::~CSsyReferenceChannelDataProvider()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::~CSsyReferenceChannelDataProvider()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::~CSsyReferenceChannelDataProvider() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::StartChannelDataL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::StartChannelDataL( 
+    const TSensrvChannelId aChannelId, 
+    TUint8* aBuffer, 
+    TInt aCount )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::StartChannelDataL()" ) ) );
+
+    if ( iChannel.ChannelId() != aChannelId )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Store buffer pointer
+    iDataBuffer = aBuffer;
+    iMaxCount = aCount;
+    iDataCount = 0;
+
+    // Udpate channel state
+    iChannel.UpdateState( CSsyReferenceChannel::ESsyReferenceChannelReceiving );
+
+    // Start receiving
+    iChannel.CommandHandler().ProcessCommand( TSsyReferenceMsg( aChannelId, ESsyReferenceStartChannelData ) );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::StartChannelDataL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::StopChannelDataL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::StopChannelDataL( const TSensrvChannelId aChannelId )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::StopChannelDataL()" ) ) );
+
+    // Leave if wrong channel
+    if ( iChannel.ChannelId() != aChannelId )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Udpate channel state
+    iChannel.UpdateState( CSsyReferenceChannel::ESsyReferenceChannelOpen );
+
+    // Stop receiving
+    iChannel.CommandHandler().ProcessCommand( TSsyReferenceMsg( aChannelId, ESsyReferenceStopChannelData ) );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::StopChannelDataL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::ForceBufferFilledL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::ForceBufferFilledL( const TSensrvChannelId aChannelId )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ForceBufferFilledL()" ) ) );
+
+    // Leave if wrong channel
+    if ( iChannel.ChannelId() != aChannelId )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Send current buffer. Channel keeps receiveing
+    SendBufferFilled();
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ForceBufferFilledL() - return" ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CSensrvTestCases::GetChannelDataProviderInterfaceL
+// -----------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::GetChannelDataProviderInterfaceL( TUid aInterfaceUid, 
+	                                        TAny*& aInterface )
+    {
+    aInterface = NULL;
+    
+	if ( aInterfaceUid.iUid == KSsyChannelDataProviderInterface1.iUid )
+		{
+		aInterface = reinterpret_cast<TAny*>(
+			static_cast<MSsyChannelDataProvider*>( this ) );
+		}
+    }
+    
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::ChannelDataReceived
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::ChannelDataReceivedL( TSsyReferenceMsg* aMessage )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ChannelDataReceived()" ) ) );
+    
+    // Get base class from message
+    TSsyRefChannelDataBase* dataItemBase = aMessage->DataItem();
+
+    if ( !dataItemBase )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // get size of the object
+    TInt size( dataItemBase->Size() );
+
+    // First, resolve data item type
+    switch ( dataItemBase->ChannelDataType() )
+        {
+        case TSsyRefChannelDataBase::ESsyRefChannelTypeTapping:
+            {
+            // Cast data item base to tapping data item
+            TSsyRefChannelDataTapping* tappingData = static_cast<TSsyRefChannelDataTapping*>( dataItemBase );
+            TSensrvTappingData senSrvTapping;
+            senSrvTapping.iTimeStamp = tappingData->Timestamp();
+            senSrvTapping.iDirection = tappingData->Direction();
+
+            // Add mapped data item into buffer
+            AddDataToBuffer( reinterpret_cast<TUint8*>( &senSrvTapping ), size );
+            break;
+            }
+        case TSsyRefChannelDataBase::ESsyRefChannelTypeAxis:
+            {
+            // Cast data item base to Axis data item
+            TSsyRefChannelDataAxis* axisData = static_cast<TSsyRefChannelDataAxis*>( dataItemBase );
+            TSensrvAccelerometerAxisData senSrvAxis;
+            senSrvAxis.iTimeStamp = axisData->Timestamp();
+            senSrvAxis.iAxisX = axisData->XAxis();
+            senSrvAxis.iAxisY = axisData->YAxis();
+            senSrvAxis.iAxisZ = axisData->ZAxis();
+            
+            // Add data to buffer
+            AddDataToBuffer( reinterpret_cast<TUint8*>( &senSrvAxis ), size );
+            break;
+            }
+        case TSsyRefChannelDataBase::ESsyRefChannelTypeProximity:
+            {
+            // Cast data item base to tapping data item
+            TSsyRefChannelDataProximity* proximityData = static_cast<TSsyRefChannelDataProximity*>( dataItemBase );
+            TSensrvProximityData senSrvProximity;
+            senSrvProximity.iProximityState = ( TSensrvProximityData::TProximityState ) proximityData->ProximityState();
+
+            // Add mapped data item into buffer
+            AddDataToBuffer( reinterpret_cast<TUint8*>( &senSrvProximity ), size );
+            break;
+            }
+        case TSsyRefChannelDataBase::ESsyRefChannelTypeAmbientLight:
+            {
+            // Cast data item base to tapping data item
+            TSsyRefChannelDataAmbientLight* ambientLightData = static_cast<TSsyRefChannelDataAmbientLight*>( dataItemBase );
+            TSensrvAmbientLightData senSrvAmbientLight;
+            senSrvAmbientLight.iAmbientLight = ambientLightData->AmbientLightState();
+
+            // Add mapped data item into buffer
+            AddDataToBuffer( reinterpret_cast<TUint8*>( &senSrvAmbientLight ), size );
+            break;
+            }
+        case TSsyRefChannelDataBase::ESsyRefChannelTypeMagneticAxis:
+            {
+            // Cast data item base to Axis data item
+            TSsyRefChannelDataMagneticAxis* axisData = static_cast<TSsyRefChannelDataMagneticAxis*>( dataItemBase );
+            TSensrvMagnetometerAxisData senSrvAxis;
+            senSrvAxis.iTimeStamp = axisData->Timestamp();
+            senSrvAxis.iAxisXRaw = axisData->XAxis();
+            senSrvAxis.iAxisYRaw = axisData->YAxis();
+            senSrvAxis.iAxisZRaw = axisData->ZAxis();
+            senSrvAxis.iAxisXCalibrated = axisData->XAxisCalib();
+            senSrvAxis.iAxisYCalibrated = axisData->YAxisCalib();
+            senSrvAxis.iAxisZCalibrated = axisData->ZAxisCalib();
+            
+            // Add data to buffer
+            AddDataToBuffer( reinterpret_cast<TUint8*>( &senSrvAxis ), size );
+            break;
+            }
+        default:
+            {
+            // Unknown data item -> Leave
+            User::Leave( KErrUnknown );
+            }
+        }
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::ChannelDataReceived() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::AddDataToBuffer
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::AddDataToBuffer( TUint8* aData, const TInt aSize )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::AddDataToBuffer()" ) ) );
+    // Write data to buffer. If buffer is full, send notification to SensorServer
+
+    // Write data bytes one by one to buffer pointer. The actual buffer is in Sensor Server    
+    for ( TInt i = 0; i < aSize; i++ )
+        {
+        *iDataBuffer++ = *aData++;
+        }
+    
+    // Increase number of items count
+    iDataCount++;
+
+    // Check is maximum data count received
+    if ( iDataCount == iMaxCount )
+        {
+        // Send BufferFilled notification to Sensor server
+        SendBufferFilled();
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::AddDataToBuffer() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceChannelDataProvider::SendBufferFilled
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceChannelDataProvider::SendBufferFilled()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::SendBufferFilled()" ) ) );
+    // Send BufferFilled notification to Sensor server
+    iChannel.SsyControl().SsyCallback().BufferFilled( iChannel.ChannelId(), iDataCount, iDataBuffer, iMaxCount );
+    iDataCount = 0;
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceChannelDataProvider::SendBufferFilled() - return" ) ) );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferencecmdhandler.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,362 @@
+/*
+* 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:  Command handler for SSY <--> Sensor messages
+*
+*/
+
+
+#include <e32property.h>
+#include "ssyreferencecmdhandler.h"
+#include "ssyreferencecontrol.h"
+#include "ssyreferencechannel.h"
+#include "ssyreferencetrace.h"
+
+// ======== CONSTANTS ========
+const TInt KSsyRefShortDelay = 100; 
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceCmdHandler::CSsyReferenceCmdHandler( CSsyReferenceChannel& aSsyChannel ) :
+    CActive( EPriorityNormal ),
+    iSsyChannel( aSsyChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::CSsyReferenceCmdHandler()" ) ) );
+    CActiveScheduler::Add( this );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::CSsyReferenceCmdHandler() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceCmdHandler::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ConstructL()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ConstructL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceCmdHandler* CSsyReferenceCmdHandler::NewL( CSsyReferenceChannel& aSsyChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::NewL()" ) ) );
+    CSsyReferenceCmdHandler* self = new ( ELeave ) CSsyReferenceCmdHandler( aSsyChannel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceCmdHandler::~CSsyReferenceCmdHandler()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::~CSsyReferenceCmdHandler()" ) ) );
+
+    if ( iMessage )
+        {
+        // Send ProcessResponse
+        iMessage->SetError( KErrCancel );
+        iSsyChannel.ProcessResponse( iMessage );
+        delete iMessage;
+        iMessage = NULL;
+        }
+
+    if ( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::~CSsyReferenceCmdHandler() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::ProcessCommand
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceCmdHandler::ProcessCommand( TSsyReferenceMsg aMessage )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ProcessCommand()" ) ) );
+    TInt err( KErrAlreadyExists );
+    
+    // Special case, when channel is reciving, iMessage is not deleted after ProcessCommand
+    if ( aMessage.Function() == ESsyReferenceStopChannelData )
+        {
+        // Stop 'receiving'. No need to handle this asynchronously
+        if ( iTimer )
+            {
+            iTimer->Cancel();
+            delete iTimer;
+            iTimer = NULL;
+            }
+        
+        iDataItemArray.Reset();
+        iDataItemPtr = 0;
+        err = KErrNone;
+        // No need to send ProcessResponse either
+        delete iMessage;
+        iMessage = NULL;
+        }
+    else if ( !iMessage )
+        {
+        TRAP(err, iMessage = new ( ELeave ) TSsyReferenceMsg( aMessage ));
+        COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ProcessCommand() - error %d creatig TSsyReferenceMsg" ), err ) );
+
+        switch( aMessage.Function() )
+            {
+            case ESsyReferenceStartChannelData:
+                {
+                // Get channel data items and start 'receiving'
+                IssueRequest();
+                err = KErrNone;
+                break;
+                }
+            case ESsyReferenceOpenChannel:
+                {
+                // Open channel specific handling here
+                IssueRequest();
+                err = KErrNone;
+                break;
+                }
+            case ESsyReferenceCloseChannel:
+                {
+                // Close channel specific handling here
+                IssueRequest();
+                err = KErrNone;
+                break;  
+                }
+            default:
+                {
+                COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ProcessCommand() - Unknown function" ) ) );
+                err = KErrNotFound;
+                }
+            }
+        }
+    else
+        {
+        err = KErrUnknown;
+        }
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ProcessCommand() - return" ) ) );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::IssueRequest
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceCmdHandler::IssueRequest( TInt aError )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::IssueRequest()" ) ) );
+    // Provides synchronous function calls to be handled as asynchronous
+    if ( !IsActive() )
+        {
+        TRequestStatus *s = &iStatus;
+	    User::RequestComplete( s, aError );
+	    SetActive();
+        }
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::IssueRequest() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::SendResponse
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceCmdHandler::SendResponse( TInt aError )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::SendResponse()" ) ) );
+    // Send response to channel
+    if ( iMessage )
+        {
+        iMessage->SetError( aError );
+        iSsyChannel.ProcessResponse( iMessage );
+        delete iMessage;
+        iMessage = NULL;
+        }
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::SendResponse() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::RunL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceCmdHandler::RunL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::RunL() - %i" ), iStatus.Int() ) );
+    
+    TInt err( iStatus.Int() );
+
+    if ( iMessage )
+        {
+        switch( iMessage->Function() )
+            {
+            case ESsyReferenceStartChannelData:
+                {
+                TInt startInterval( 0 );
+                
+                // Get all Channel data information from config file
+                iSsyChannel.SsyControl().SsyConfig().
+                    GetChannelDataInformationL( iMessage->ChannelId(), iDataItemArray, startInterval );
+
+                // Check that channel data items were found
+                if ( iDataItemArray.Count() )
+                    {
+                    // If interval is zero, set small interval
+                    if ( startInterval == 0 )
+                        {
+                        startInterval = KSsyRefShortDelay;
+                        }
+
+                    // wait that interval
+                    if ( iTimer )
+                        {
+                        iTimer->Cancel();
+                        delete iTimer;
+                        iTimer = NULL;
+                        }
+
+                    // Reset pointer
+                    iDataItemPtr = 0;
+
+                    // Start timer and continue processing in callback function
+                    iTimer = CPeriodic::NewL( EPriorityNormal );
+                    iTimer->Start( startInterval * 1000, 0, TCallBack( DataItemCallback, this ) );
+                    }
+                break;
+                }
+            case ESsyReferenceOpenChannel:
+                {
+                // Open channel response specific handling here
+                iMessage->SetFunction( ESsyReferenceOpenChannelResp );
+                SendResponse();
+                break;
+                }
+            case ESsyReferenceCloseChannel:
+                {
+                // Close channel response specific handling here
+                iMessage->SetFunction( ESsyReferenceCloseChannelResp );
+                SendResponse();
+                break;  
+                }
+            default:
+                {
+                COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::ProcessCommand() - Unknown function" ) ) );
+                err = KErrNotFound;
+                }
+            }
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::RunL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceCmdHandler::DoCancel()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::DoCancel()" ) ) );
+
+    // Handle cancel for this channel. Cancel any ongoing requests
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::DoCancel() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceCmdHandler::RunError( TInt /*aError*/ )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::RunError()" ) ) );
+
+    // Handle possible errors here and return KErrNone to prevent SSY from panic
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::RunError() - return" ) ) );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::DataItemCallback
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceCmdHandler::DataItemCallback( TAny* aThis )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::DataItemCallback()" ) ) );
+    return static_cast<CSsyReferenceCmdHandler*>( aThis )->GenerateChannelDataItem();
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceCmdHandler::GenerateChannelDataItem
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceCmdHandler::GenerateChannelDataItem()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::GenerateChannelDataItem()" ) ) );
+
+    // Get next item from list and set pointer to next item
+    TSsyRefChannelDataBase dataItem = iDataItemArray[iDataItemPtr++];
+
+    // Get next item interval from data item
+    TInt nextInterval( dataItem.Interval() );
+
+    // Set timestamp to data item
+    TTime time;
+    time.HomeTime();
+    dataItem.SetTimestamp( time );
+
+    // If interval is zero, set small interval
+    if ( nextInterval == 0 )
+        {
+        nextInterval = KSsyRefShortDelay;
+        }
+
+    // Add data item to message
+    iMessage->SetDataItem( &dataItem );
+
+    // If in last data item, set pointer back to first item
+    if ( iDataItemArray.Count() == iDataItemPtr )
+        {
+        iDataItemPtr = 0;
+        }
+
+    // Send response and start new timer
+    iMessage->SetFunction( ESsyReferenceDataItemReceived );
+    iSsyChannel.ProcessResponse( iMessage );
+
+    if ( iTimer )
+        {
+        delete iTimer;
+        iTimer = NULL;
+        }
+
+    TRAP_IGNORE( iTimer = CPeriodic::NewL( EPriorityNormal );
+                 iTimer->Start( nextInterval * 1000, 0, TCallBack( DataItemCallback, this ) ); )
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceCmdHandler::GenerateChannelDataItem() - return" ) ) );
+    return KErrNone;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferenceconfig.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,948 @@
+/*
+* 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:  Configuration implementation of this SSY
+*
+*/
+
+
+#include <sensrvsensorchannels.h>
+#include <sensrvchanneldatatypes.h>
+#include <sensrvtypes.h>
+#include <f32file.h>
+#include <gmxmldocument.h>
+#include <gmxmlelement.h>
+
+#include "ssyreferencecontrol.h"
+#include "ssyreferenceconfig.h"
+#include "ssyreferencetrace.h"
+
+
+// ======== CONSTANTS =======
+_LIT( KSsyReferenceCfgFileOrig, "Z:\\private\\1020507E\\reference\\SsyReferenceConfig.xml" );
+_LIT( KSsyReferenceCfgFileExt, "C:\\ssyreference\\SsyReferenceConfig.xml" );
+
+// Config file definitions
+
+// Maximum attribute lenghth
+const TInt KSsyRefMaxAttribLength = 20;
+
+// TAG DEFINITIONS
+_LIT( KSsyRefRootTag, "SsyReferenceConfig" );                   // Ssy general information tag
+_LIT( KSsyRefGeneralInfoTag, "SsyGeneralInformation" );         // Ssy general information tag
+_LIT( KSsyRefChannelInfoGroupTag, "ChannelInformationGroup" );  // Channel information group tag
+_LIT( KSsyRefChannelItemTag, "ChannelItem" );                   // Channel item tag
+_LIT( KSsyRefChannelDataTag, "ChannelData" );                   // Channel data tag
+_LIT( KSsyRefChannelDataItemTag, "ChannelDataItem" );           // Channel data item tag
+
+_LIT( KSsyRefProperties, "Properties" );                        // Properties tag
+_LIT( KSsyRefPropertyItem, "PropertyItem" );                    // PropertyItem tag
+
+// Data item definitions
+_LIT( KSsyRefAxisDataItemTag, "SsyRefChannelDataAxis" );        // SsyRefChannelDataAxis data item tag
+_LIT( KSsyRefXAxis, "XAxis" );                                  // XAxis from SsyRefChannelDataAxis
+_LIT( KSsyRefYAxis, "YAxis" );                                  // YAxis from SsyRefChannelDataAxis
+_LIT( KSsyRefZAxis, "ZAxis" );                                  // ZAxis from SsyRefChannelDataAxis
+
+_LIT( KSsyRefTappingDataItemTag, "SsyRefChannelDataTapping" );  // SsyRefChannelDataTapping data item tag
+_LIT( KSsyRefDirection, "Direction" );                          // Direction from SsyRefChannelDataTapping
+
+_LIT( KSsyRefProximityDataItemTag, "SsyRefChannelDataProximity" );  // SsyRefChannelDataProximity data item tag
+_LIT( KSsyRefProximityState, "ProximityState" );                                   // ProximityStatus from SsyRefChannelDataProximity
+
+_LIT( KSsyRefAmbientLightDataItemTag, "SsyRefChannelDataAmbientLight" );  // SsyRefChannelDataAmbientLight data item tag
+_LIT( KSsyRefAmbientLightState, "AmbientLightState" );                                   // AmbientLightStatus from SsyRefChannelDataAmbientLight
+
+_LIT( KSsyRefMagneticAxisDataItemTag, "SsyRefChannelDataMagneticAxis" );        // SsyRefChannelDataMagneticAxis data item tag
+_LIT( KSsyRefXAxisCalib, "XAxisCalib" );                        // XAxis from SsyRefChannelDataMagneticAxis
+_LIT( KSsyRefYAxisCalib, "YAxisCalib" );                        // YAxis from SsyRefChannelDataMagneticAxis
+_LIT( KSsyRefZAxisCalib, "ZAxisCalib" );                        // ZAxis from SsyRefChannelDataMagneticAxis
+
+// ATTRIBUTE DEFINITIONS
+_LIT( KSsyRefChannelCount, "ChannelCount" );    // Channel count from ChannelInformationGroup
+_LIT( KSsyRefChannelId, "ChannelId" );          // Channel ID from ChannelItem
+_LIT( KSsyRefContextType, "ContextType" );      // Context type from ChannelItem
+_LIT( KSsyRefQuantity, "Quantity" );            // Quantity from ChannelItem
+_LIT( KSsyRefChannelType, "ChannelType" );      // ChannelType from ChannelItem
+_LIT( KSsyRefLocation, "Location" );            // Location from ChannelItem
+_LIT( KSsyRefVendorId, "Vendor" );              // Vendor from ChannelItem
+
+
+// Channel data item specific attribute definitions
+_LIT( KSsyRefStartInterval, "StartIntervalMs" );              // StartInterval from ChannelData
+_LIT( KSsyRefDataItemCount, "count" );                        // count from ChannelDataItem
+_LIT( KSsyRefDataTypeID, "DataTypeId" );                      // DataTypeId from ChannelDataItem
+_LIT( KSsyRefInterval, "IntervalMs" );                        // IntervalMs from ChannelDataItem
+
+// Property spesific attributes
+_LIT( KSsyRefPropertyId, "PropertyId" );              // PropertyId from PropertyItem
+_LIT( KSsyRefArrayIndex, "ArrayIndex" );              // ArrayIndex from PropertyItem
+_LIT( KSsyRefItemIndex, "ItemIndex" );                // ItemIndex from PropertyItem
+_LIT( KSsyRefPropertyValue, "PropertyValue" );        // PropertyValue from PorpertyItem
+_LIT( KSsyRefPropertyType, "PropertyType" );          // PropertyType from PropertyItem
+_LIT( KSsyRefMaxValue, "MaxValue" );                  // MaxValue from PropertyItem
+_LIT( KSsyRefMinValue, "MinValue" );                  // MinValue from PorpertyItem
+_LIT( KSsyRefReadOnly, "ReadOnly" );                  // ReadOnly from PropertyItem
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceConfig::CSsyReferenceConfig() :
+    CActive( EPriorityMuchLess )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::CSsyReferenceConfig()" ) ) );
+    CActiveScheduler::Add( this );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::CSsyReferenceConfig() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ConstructL()" ) ) );
+    // Create config file parser
+    iConfigParser = CMDXMLParser::NewL( this );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ConstructL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceConfig* CSsyReferenceConfig::NewL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::NewL()" ) ) );
+    CSsyReferenceConfig* self = new ( ELeave ) CSsyReferenceConfig();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceConfig::~CSsyReferenceConfig()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::~CSsyReferenceConfig()" ) ) );
+    
+    if ( iConfigParser )
+        {
+        delete iConfigParser;
+        iConfigParser = NULL;
+        }
+
+    if ( iGenralInfoElement )
+        {
+        delete iGenralInfoElement;
+        iGenralInfoElement = NULL;
+        }
+
+    if ( iChannelGroupElement )
+        {
+        delete iChannelGroupElement;
+        iChannelGroupElement = NULL;
+        }
+
+    if ( iSsyReferenceConfig )
+        {
+        delete iSsyReferenceConfig;
+        iSsyReferenceConfig = NULL;
+        }
+
+    if ( iConfigFile )
+        {
+        delete iConfigFile;
+        iConfigFile = NULL;
+        }
+
+    iChannelPairArray.Reset();
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::~CSsyReferenceConfig() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::InitConfig
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::InitConfigL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::InitConfig()" ) ) );
+    
+    // Open config file
+    RFs fileSession;
+    User::LeaveIfError( fileSession.Connect() );
+
+    // Locate extrenal file... 
+    RFile file;
+    TInt err( file.Open( fileSession, KSsyReferenceCfgFileExt, EFileRead ) );
+    file.Close();
+
+    // Check is external file found
+    if ( KErrNone == err )
+        {
+        // Use SSY with external configuration
+        iConfigParser->ParseFile( fileSession, KSsyReferenceCfgFileExt );
+        }
+    else
+        {
+        // Use SSY with original configuration
+
+        // Start parsing file and wait notification to ParseFileCompleteL
+        // XML Parser takes ownership of the RFs and closes it when file is parsed
+        iConfigParser->ParseFile( fileSession, KSsyReferenceCfgFileOrig );
+        }
+
+    iConfigFileParsed = EFalse;
+
+    // This active object has very low priority since XML parser uses Active objects also, 
+    // so it is mandatory to let XML parser to complete sooner than this active object
+    IssueRequest();
+    iSchedulerWait.Start(); // Blocks until file is parsed
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::InitConfig() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::IssueRequest
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::IssueRequest( TInt aError )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::IssueRequest()" ) ) );
+    // Provides synchronous function calls to be handled as asynchronous
+    if ( !IsActive() )
+        {
+        SetActive();
+        TRequestStatus *s = &iStatus;
+	    User::RequestComplete( s, aError );
+        }
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::IssueRequest() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::RunL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::RunL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::RunL() - %i" ), iStatus.Int() ) );
+
+    if ( iConfigFileParsed )
+        {
+        // Stop blocking
+        iSchedulerWait.AsyncStop();
+        }
+    else
+        {
+        // Continue RunL loop
+        IssueRequest();
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::RunL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::DoCancel()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::DoCancel()" ) ) );
+
+    // Stop blocking
+    iSchedulerWait.AsyncStop();
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::DoCancel() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceConfig::RunError( TInt /*aError*/ )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::RunError()" ) ) );
+
+    // Handle possible errors here and return KErrNone to prevent SSY from panic
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::RunError() - return" ) ) );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::ParseFileCompleteL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::ParseFileCompleteL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ParseFileCompleteL()" ) ) );
+    
+    ERROR_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ParseFileCompleteL(): parse error=%d", iConfigParser->Error() ) ) );
+    
+    // if the parser fails with KErrNoMemory, increase the default heap size for SSY's (key 3) in the repository 1020507E.txt exported by this component
+    __ASSERT_DEBUG( iConfigParser->ErrorSeverity() != EXMLFatal, User::Invariant() ); //  OK to continue if not a fatal error
+    
+    // First get document
+    iConfigFile = iConfigParser->DetachXMLDoc();
+    // Then get document element
+    CMDXMLElement*  documentElement = iConfigFile->DocumentElement();
+    // Get root element, 'SsyReferenceConfig'
+    iSsyReferenceConfig = documentElement->FirstChildOfType( KSsyRefRootTag );
+    // Get gereral information element 
+    iGenralInfoElement = iSsyReferenceConfig->FirstChildOfType( KSsyRefGeneralInfoTag );
+    // Get channel information group element
+    iChannelGroupElement = iSsyReferenceConfig->FirstChildOfType( KSsyRefChannelInfoGroupTag );
+    // Get channel count
+    iChannelCount = GetAttributeIntValue( *iChannelGroupElement, KSsyRefChannelCount );
+
+    // No need to delete documentElement, it is owned by iConfigFile.
+    documentElement = NULL;
+    iConfigFileParsed = ETrue;
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ParseFileCompleteL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetAttributeIntValue
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceConfig::GetAttributeIntValue( CMDXMLElement& aElement, const TDesC& aAttrib )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeIntValue()" ) ) );
+    COMPONENT_TRACE( ( _L( "  Element: %s", aElement.NodeName() ) ) );
+    COMPONENT_TRACE( ( _L( "  Attribute: %s", aAttrib ) ) );
+
+    TInt intValue( 0 );
+
+    // Check availability
+    if ( aElement.IsAttributeSpecified( aAttrib ) )
+        {
+        // Buffer to where to read value
+        TBufC<KSsyRefMaxAttribLength> buffer( KNullDesC );
+        TPtrC ptr( buffer );
+
+        // Read attribute value
+        aElement.GetAttribute( aAttrib, ptr );
+
+        // Cast literal value into TInt
+        TLex lexValue( ptr );
+        lexValue.Val( intValue );
+        }
+
+    COMPONENT_TRACE( ( _L( "  IntValue: %i", intValue ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeIntValue() - return" ) ) );
+    return intValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetAttributeStrValue
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GetAttributeStrValue( CMDXMLElement& aElement, const TDesC& aAttrib, TDes8& aTarget )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeStrValue()" ) ) );
+    COMPONENT_TRACE( ( _L( "  Element: %s", aElement.NodeName() ) ) );
+    COMPONENT_TRACE( ( _L( "  Attribute: %s", aAttrib ) ) );
+
+    // Check availability
+    if ( aElement.IsAttributeSpecified( aAttrib ) )
+        {
+        // Buffer to where to read value
+        TBufC<KSsyRefMaxAttribLength> buffer( KNullDesC );
+        TPtrC ptr( buffer );
+
+        // Read attribute value
+        aElement.GetAttribute( aAttrib, ptr );
+
+        // Copy string from 16-bit descriptor to 8-bit descriptor
+        aTarget.Copy( ptr );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeStrValue() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetAttributeHexValue
+// ---------------------------------------------------------------------------
+//
+TUint CSsyReferenceConfig::GetAttributeHexValue( CMDXMLElement& aElement, const TDesC& aAttrib )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeHexValue()" ) ) );
+    COMPONENT_TRACE( ( _L( "  Element: %s", aElement.NodeName() ) ) );
+    COMPONENT_TRACE( ( _L( "  Attribute: %s", aAttrib ) ) );
+
+    TUint32 hexValue( 0 );
+
+    // Check availability
+    if ( aElement.IsAttributeSpecified( aAttrib ) )
+        {
+        // Buffer to where to read value
+        TBufC<KSsyRefMaxAttribLength> buffer( KNullDesC );
+        TPtrC ptr( buffer );
+
+        // Read attribute value
+        aElement.GetAttribute( aAttrib, ptr );
+
+        // Get bounded value and cast it into TUint32 (hex)
+        TRadix radix( EHex );
+        TUint limit( 0xFFFFFFFF );
+
+        // Append string into Lex and skip first two characters, 0x
+        TLex lexValue( ptr );
+        lexValue.Inc( 2 );
+
+        // Read value
+        lexValue.BoundedVal( hexValue, radix, limit );
+        }
+
+    COMPONENT_TRACE( ( _L( "  HexValue: %x", hexValue ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeHexValue() - return" ) ) );
+    return hexValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetAttributeRealValue
+// ---------------------------------------------------------------------------
+//
+TReal CSsyReferenceConfig::GetAttributeRealValue( CMDXMLElement& aElement, const TDesC& aAttrib )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeRealValue()" ) ) );
+    COMPONENT_TRACE( ( _L( "  Element: %s", aElement.NodeName() ) ) );
+    COMPONENT_TRACE( ( _L( "  Attribute: %s", aAttrib ) ) );
+
+    TReal realValue( 0 );
+
+    // Check availability
+    if ( aElement.IsAttributeSpecified( aAttrib ) )
+        {
+
+        // Buffer to where to read value
+        TBufC<KSsyRefMaxAttribLength> buffer( KNullDesC );
+        TPtrC ptr( buffer );
+
+        // Read attribute value
+        aElement.GetAttribute( aAttrib, ptr );
+
+        // Cast literal value into TReal
+        TLex lexValue( ptr );
+        lexValue.Val( realValue );
+        }
+
+    COMPONENT_TRACE( ( _L( "  IntValue: %i", realValue ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetAttributeRealValue() - return" ) ) );
+    return realValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::ChannelCount
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceConfig::ChannelCount()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ChannelCount() - %i" ), iChannelCount ) );
+    return iChannelCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GenerateChannels
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GenerateChannels( RSensrvChannelInfoList& aChannelList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GenerateChannels()" ) ) );
+
+    // Initialize channel pair array
+    TSsyRefChannelIdArray tempArray( iChannelCount );
+    iChannelPairArray = tempArray;
+
+    // Go through Channel group element and get all information
+    TSensrvChannelInfo channelInfo;
+    CMDXMLElement* channelElement = iChannelGroupElement->FirstChildOfType( KSsyRefChannelItemTag );
+
+    while( channelElement )
+        {
+        // check is element correct type of node
+        if ( channelElement->NodeType() == CMDXMLNode::EElementNode )
+            {
+            // read channel identifier
+            iChannelPairArray.Append( TSsyRefChannelIdPair( GetAttributeIntValue( *channelElement, KSsyRefChannelId ) ) );
+
+            // Read attributes
+            channelInfo.iContextType = ( TSensrvContextType ) GetAttributeIntValue( *channelElement, KSsyRefContextType );
+            channelInfo.iQuantity = ( TSensrvQuantity ) GetAttributeIntValue( *channelElement, KSsyRefQuantity );
+            channelInfo.iChannelType = ( TSensrvChannelTypeId ) GetAttributeHexValue( *channelElement, KSsyRefChannelType );
+            GetAttributeStrValue( *channelElement, KSsyRefLocation, channelInfo.iLocation );
+            GetAttributeStrValue( *channelElement, KSsyRefVendorId, channelInfo.iVendorId );
+            channelInfo.iChannelDataTypeId = ( TSensrvChannelDataTypeId ) GetAttributeHexValue( *channelElement, KSsyRefDataTypeID );
+            
+            // Calculate data item size based on channel type
+            switch ( channelInfo.iChannelType )
+                {
+                case KSensrvChannelTypeIdAccelerometerXYZAxisData:
+                    {
+                    channelInfo.iDataItemSize = KSsyRefAxisDataItemSize;
+                    break;
+                    }
+                case KSensrvChannelTypeIdProximityMonitor:
+                    {
+                    channelInfo.iDataItemSize = KSsyRefProximityDataItemSize;
+                    break;
+                    }
+                case KSensrvChannelTypeIdAmbientLightData:
+                    {
+                    channelInfo.iDataItemSize = KSsyRefAmbientLightDataItemSize;
+                    break;
+                    }
+                case KSensrvChannelTypeIdAccelerometerWakeupData:
+                case KSensrvChannelTypeIdAccelerometerDoubleTappingData:
+                    {
+                    channelInfo.iDataItemSize = KSsyRefTappingDataItemSize;
+                    break;
+                    }
+                case KSensrvChannelTypeIdMagnetometerXYZAxisData:
+                    {
+                    channelInfo.iDataItemSize = KSsyRefMagneticAxisDataItemSize;
+                    break;
+                    }
+                default:
+                    {
+                    channelInfo.iDataItemSize = 0;
+                    break;
+                    }
+                }
+
+            // Append channel info to list
+            aChannelList.Append( channelInfo );
+            }
+        channelElement = static_cast<CMDXMLElement*>( channelElement->NextSibling() );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GenerateChannels() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetChannelDataInformation
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GetChannelDataInformationL( 
+    const TInt aSrvChannelId,
+    TSsyRefDataItemArray& aDataItemList, 
+    TInt& aStartInterval )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetChannelDataInformation()" ) ) );
+
+    // First, get correct config channel element corresponding to aSrvChannelId
+    CMDXMLElement* channelElement = ChannelElement( aSrvChannelId );
+
+    if ( channelElement )
+        {
+        // Channel element found, get channel data group element
+        CMDXMLElement* groupElement = channelElement->FirstChildOfType( KSsyRefChannelDataTag );
+        
+        if ( groupElement )
+            {
+            // Get start interval
+            aStartInterval = GetAttributeIntValue( *groupElement, KSsyRefStartInterval );
+
+            // First, loop channel data items to get total count
+            CMDXMLElement* dataItemElement = groupElement->FirstChildOfType( KSsyRefChannelDataItemTag );
+
+            // Take channel data item type at this point. One channel can produce only one type of
+            // channel data item
+            TUint channelType( GetAttributeHexValue( *dataItemElement, KSsyRefDataTypeID ) );
+
+            TInt channelItemCount( 0 ); // Total number of data items
+            TInt definitionCount( 0 );  // Total number of different definitions
+
+            // Go through elements and get counters
+            while ( dataItemElement )
+                {
+                definitionCount++;
+                channelItemCount = channelItemCount + GetAttributeIntValue( *dataItemElement, KSsyRefDataItemCount );
+                // This will return NULL if no next sibling found
+                dataItemElement = static_cast<CMDXMLElement*>( dataItemElement->NextSibling() );
+                }
+
+            // Now, start all over to get item information
+            dataItemElement = groupElement->FirstChildOfType( KSsyRefChannelDataItemTag );
+
+            // Create temp array now that we know the data item count
+            TSsyRefDataItemArray tempArray( channelItemCount );
+
+            for ( TInt i = 0; i < definitionCount; i++ )
+                {
+                // Check element type
+                if ( dataItemElement->NodeType() == CMDXMLNode::EElementNode )
+                    {
+                    // First we get interval and count from channel item
+                    TInt interval( GetAttributeIntValue( *dataItemElement, KSsyRefInterval ) );
+                    TInt countOfType( GetAttributeIntValue( *dataItemElement, KSsyRefDataItemCount ) );
+
+                    // Read next child values to corresponding data type class
+                    switch ( channelType )
+                        {
+                        case TSensrvAccelerometerAxisData::KDataTypeId:
+                            {
+                            CMDXMLElement* axisDataElement = dataItemElement->FirstChildOfType( KSsyRefAxisDataItemTag );
+                            TInt axisX( GetAttributeIntValue( *axisDataElement, KSsyRefXAxis ) );
+                            TInt axisY( GetAttributeIntValue( *axisDataElement, KSsyRefYAxis ) );
+                            TInt axisZ( GetAttributeIntValue( *axisDataElement, KSsyRefZAxis ) );
+
+                            // Create channel data type item
+                            TSsyRefChannelDataAxis channelData( axisX, axisY, axisZ, interval );
+                            // add items into array
+                            for ( TInt k = 0; k < countOfType; k++ )
+                                {
+                                tempArray.Append( channelData );
+                                }
+                            break;
+                            }
+                        case TSensrvTappingData::KDataTypeId:
+                            {
+                            CMDXMLElement* tappingDataElement = dataItemElement->FirstChildOfType( KSsyRefTappingDataItemTag );
+                            TInt direction( GetAttributeHexValue( *tappingDataElement, KSsyRefDirection ) );
+                            
+                            // Create channel data type item
+                            TSsyRefChannelDataTapping channelData( direction, interval );
+                            // add items into array
+                            for ( TInt k = 0; k < countOfType; k++ )
+                                {
+                                tempArray.Append( channelData );
+                                }
+                            break;
+                            }
+                        case TSensrvProximityData::KDataTypeId:
+                            {
+                            CMDXMLElement* proximityDataElement = dataItemElement->FirstChildOfType( KSsyRefProximityDataItemTag );
+                            TInt state( GetAttributeIntValue( *proximityDataElement, KSsyRefProximityState ) );
+                            
+                            // Create channel data type item
+                            TSsyRefChannelDataProximity channelData( state, interval );
+                            // add items into array
+                            for ( TInt k = 0; k < countOfType; k++ )
+                                {
+                                tempArray.Append( channelData );
+                                }
+                            break;
+                            }
+                        case TSensrvAmbientLightData::KDataTypeId:
+                            {
+                            CMDXMLElement* ambientLightDataElement = dataItemElement->FirstChildOfType( KSsyRefAmbientLightDataItemTag );
+                            TInt state( GetAttributeIntValue( *ambientLightDataElement, KSsyRefAmbientLightState ) );
+                            
+                            // Create channel data type item
+                            TSsyRefChannelDataAmbientLight channelData( state, interval );
+                            // add items into array
+                            for ( TInt k = 0; k < countOfType; k++ )
+                                {
+                                tempArray.Append( channelData );
+                                }
+                            break;
+                            }
+                        case TSensrvMagnetometerAxisData::KDataTypeId:
+                            {
+                            CMDXMLElement* axisDataElement = dataItemElement->FirstChildOfType( KSsyRefMagneticAxisDataItemTag );
+                            TInt axisX( GetAttributeIntValue( *axisDataElement, KSsyRefXAxis ) );
+                            TInt axisY( GetAttributeIntValue( *axisDataElement, KSsyRefYAxis ) );
+                            TInt axisZ( GetAttributeIntValue( *axisDataElement, KSsyRefZAxis ) );
+                            TInt axisXCalib( GetAttributeIntValue( *axisDataElement, KSsyRefXAxisCalib ) );
+                            TInt axisYCalib( GetAttributeIntValue( *axisDataElement, KSsyRefYAxisCalib ) );
+                            TInt axisZCalib( GetAttributeIntValue( *axisDataElement, KSsyRefZAxisCalib ) );
+
+                            // Create channel data type item
+                            TSsyRefChannelDataMagneticAxis channelData( axisX, axisY, axisZ, 
+                                axisXCalib, axisYCalib, axisZCalib, interval );
+                            // add items into array
+                            for ( TInt k = 0; k < countOfType; k++ )
+                                {
+                                tempArray.Append( channelData );
+                                }
+                            break;
+                            }
+                        default:
+                            {
+                            // Other data items are not supported
+                            User::Leave( KErrGeneral );
+                            }
+                        }
+                    }
+
+                // Get next channel data item element
+                dataItemElement = static_cast<CMDXMLElement*>( dataItemElement->NextSibling() );
+                }
+
+            // Compress temp array in case there were comments
+            tempArray.Compress();
+
+            // copy information to param array
+            aDataItemList = tempArray;
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetChannelDataInformation() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetElementPropertiesL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GetElementPropertiesL( 
+    CMDXMLElement& aElement, 
+    RSensrvPropertyList& aPropertyList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetElementPropertiesL()" ) ) );
+
+    // First we need 'Properties' element
+    CMDXMLElement* properties = aElement.FirstChildOfType( KSsyRefProperties );
+
+    if ( !properties )
+        {
+        // Wrong element... or properties are not defined
+        User::Leave( KErrNotFound );
+        }
+
+    // Get first property get started
+    CMDXMLElement* propertyItem = properties->FirstChildOfType( KSsyRefPropertyItem );
+    TInt propertyCount( 0 );
+
+    // Loop properties to get count of properties
+    while ( propertyItem )
+        {
+        propertyCount++;
+        propertyItem = static_cast<CMDXMLElement*>( propertyItem->NextSibling() ); // returns NULL if next not found
+        }
+    
+    if ( !propertyCount )
+        {
+        // Check that there are properties
+        User::Leave( KErrNotFound );
+        }
+
+    // Temporary property list now that we know the property count
+    RSensrvPropertyList tempList( propertyCount );
+
+    // Start loop again from the start and read each property
+    propertyItem = properties->FirstChildOfType( KSsyRefPropertyItem );
+    for ( TInt i = 0; i < propertyCount; i++ )
+        {
+        // Check element type
+        if ( propertyItem->NodeType() == CMDXMLNode::EElementNode )
+            {
+            // Read property values
+            const TSensrvPropertyId propertyId( ( TSensrvPropertyId )GetAttributeHexValue( *propertyItem, KSsyRefPropertyId ) );
+            const TInt itemIndex( GetAttributeIntValue( *propertyItem, KSsyRefItemIndex ) );
+            const TBool readOnly( ( TBool )GetAttributeIntValue( *propertyItem, KSsyRefReadOnly ) );
+            const TSensrvPropertyType propertyType( ( TSensrvPropertyType ) GetAttributeIntValue( *propertyItem, KSsyRefPropertyType ) );
+
+            // Array index must be handled in different way as it is not mandatory. Little modification is needed as it may not exist in XML file
+            TInt arrayIndex( ESensrvSingleProperty );
+
+            // Extra check is needed, otherwise this value is always '0' when it should be 'ESensrvSingleProperty' by default
+            if ( propertyItem->IsAttributeSpecified( KSsyRefArrayIndex ) )
+                {
+                // Attribute exists, now we can read the value
+                arrayIndex = GetAttributeIntValue( *propertyItem, KSsyRefArrayIndex );
+                }
+
+            // Resolve type, get correct type value and append property into list
+            switch ( propertyType )
+                {
+                case ESensrvIntProperty:
+                    {
+                    const TInt intValue( GetAttributeIntValue( *propertyItem, KSsyRefPropertyValue ) );
+                    const TInt maxValue( GetAttributeIntValue( *propertyItem, KSsyRefMaxValue ) );
+                    const TInt minValue( GetAttributeIntValue( *propertyItem, KSsyRefMinValue ) );
+                    TSensrvProperty property( propertyId, itemIndex, intValue, maxValue, minValue, readOnly, propertyType );
+                    property.SetArrayIndex( arrayIndex );
+                    tempList.Append( property );
+                    break;
+                    }
+                 case ESensrvRealProperty:
+                    {
+                    const TReal intValue( GetAttributeRealValue( *propertyItem, KSsyRefPropertyValue ) );
+                    const TReal maxValue( GetAttributeRealValue( *propertyItem, KSsyRefMaxValue ) );
+                    const TReal minValue( GetAttributeRealValue( *propertyItem, KSsyRefMinValue ) );
+                    TSensrvProperty property( propertyId, itemIndex, intValue, maxValue, minValue, readOnly, propertyType );
+                    property.SetArrayIndex( arrayIndex );
+                    tempList.Append( property );
+                    break;
+                    }
+                 case ESensrvBufferProperty:
+                    {
+                    TBuf8<KSensrvPropertyTextBufferSize> desValue;
+                    GetAttributeStrValue( *propertyItem, KSsyRefPropertyValue, desValue );
+                    TSensrvProperty property( propertyId, itemIndex, desValue, readOnly, propertyType );
+                    property.SetArrayIndex( arrayIndex );
+                    tempList.Append( property );
+                    break;
+                    }
+                default:
+                    {
+                    // Unknown property type -> leave
+                    User::Leave( KErrArgument );    
+                    }
+                }
+            }
+
+        // Next property
+        propertyItem = static_cast<CMDXMLElement*>( propertyItem->NextSibling() ); // returns NULL if next not found
+        }
+
+    // Compress temp list in case there were comment nodes
+    tempList.Compress();
+
+    // copy temp list to parameter list
+    aPropertyList = tempList;
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetElementPropertiesL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::ChannelElement
+// ---------------------------------------------------------------------------
+//
+CMDXMLElement* CSsyReferenceConfig::ChannelElement( const TInt aSrvChannelId )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ChannelElement()" ) ) );
+
+    const TInt configId( ConfigChannelId( aSrvChannelId ) );
+    TBool channelFound( EFalse );
+    
+    // Loop channel group and match configId for the channel ID in element
+    CMDXMLElement* channelItemElement = iChannelGroupElement->FirstChildOfType( KSsyRefChannelItemTag );
+    
+    for ( TInt i = 0; i < iChannelCount || !channelFound; i++ )
+        {
+        TInt channelId( GetAttributeIntValue( *channelItemElement, KSsyRefChannelId ) );
+        if ( configId == channelId  )
+            {
+            // Channel found, no  need to loop
+            channelFound = ETrue;
+            }
+        else
+            {
+            // Take next channel
+            channelItemElement = static_cast<CMDXMLElement*>( channelItemElement->NextSibling() );
+            }
+        }
+
+    // If not found, return NULL
+    if ( !channelFound )
+        {
+        channelItemElement = NULL;
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ChannelElement() - return" ) ) );
+    return channelItemElement;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::UpdateChannelIds
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::UpdateChannelIds( RSensrvChannelInfoList aChannelList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::UpdateChannelIds()" ) ) );
+    
+
+    if ( ChannelCount() == aChannelList.Count() )
+        {
+        for ( TInt i = 0; i < aChannelList.Count(); i++ )
+            {
+            iChannelPairArray[i].SetServerId( aChannelList[i].iChannelId );
+            }
+        }
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::UpdateChannelIds() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::ConfigChannelId
+// ---------------------------------------------------------------------------
+//
+TInt CSsyReferenceConfig::ConfigChannelId( const TInt aSrvChannelId ) const
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ConfigChannelId()" ) ) );    
+    TInt returnValue( 0 );
+    
+    for ( TInt i = 0; i < iChannelPairArray.Count(); i++ )
+        {
+        if ( iChannelPairArray[i].ServerId() == aSrvChannelId )
+            {
+            returnValue = iChannelPairArray[i].ConfigId();
+            }
+        }
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::ConfigChannelId() - return" ) ) );
+    return returnValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetSensorPropertiesL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GetSensorPropertiesL( RSensrvPropertyList& aPropertyList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetSensorPropertiesL()" ) ) );
+
+    // We already have SsyGeneralInformation element, read properties from that
+    GetElementPropertiesL( *iGenralInfoElement, aPropertyList );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetSensorPropertiesL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceConfig::GetChannelPropertiesL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceConfig::GetChannelPropertiesL( 
+    const TInt aSrvChannelId, 
+    RSensrvPropertyList& aPropertyList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetChannelPropertiesL()" ) ) );
+
+    // Get channel element first
+    CMDXMLElement* channelElement = ChannelElement( aSrvChannelId );
+
+    if ( !channelElement )
+        {
+        // Leave, channel element is not found
+        User::Leave( KErrNotFound );
+        }
+
+    // Get properties of this channel element
+    GetElementPropertiesL( *channelElement, aPropertyList );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceConfig::GetChannelPropertiesL() - return" ) ) );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferencecontrol.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,280 @@
+/*
+* 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:  Reference implementation of SSY Control
+*
+*/
+
+
+#include <ssycallback.h>                     // MSsyCallback
+#include "ssyreferencecontrol.h"
+#include "ssyreferencetrace.h"
+#include "ssyreferencechannel.h"
+#include "ssyreferencecmdhandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceControl::CSsyReferenceControl( MSsyCallback& aSsyCallback ) :
+    iSsyCallback( aSsyCallback )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::CSsyReferenceControl()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::CSsyReferenceControl() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceControl::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::ConstructL()" ) ) );
+
+    // Create configurator and start config file parsing
+    iConfigFile = CSsyReferenceConfig::NewL();
+    TRAPD( err, iConfigFile->InitConfigL() ); // This will block until config is ready
+
+    if ( KErrNone != err )
+        {
+        COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::ConstructL() - Init config failed: %i" ), err ) );
+        }
+
+    // ---------------------------------------------------------------
+
+    // Store channel count for later use
+    const TInt channelCount( iConfigFile->ChannelCount() );
+
+    // Instantiate channel info list
+    RSensrvChannelInfoList channelInfoList( channelCount );
+    CleanupClosePushL( channelInfoList );
+
+    // Fills channel info list with generated channel info objects
+    iConfigFile->GenerateChannels( channelInfoList );
+
+    // Register channels. Sensor Server generates unique ID for each channel
+    iSsyCallback.RegisterChannelsL( channelInfoList );
+
+    // Update channel IDs to ConfigFile
+    iConfigFile->UpdateChannelIds( channelInfoList );
+
+    // Create channels
+    iChannelArray = new ( ELeave ) CArrayPtrFlat<CSsyReferenceChannel>( channelCount );
+    for ( TInt i = 0; i < channelCount; i++ )
+        {
+        CSsyReferenceChannel* channel = CSsyReferenceChannel::NewL( *this, channelInfoList[i] );
+        iChannelArray->AppendL( channel );
+        }
+
+    // Clean up
+    CleanupStack::PopAndDestroy( &channelInfoList );
+
+    // Get properties of this SSY. Leaves with KErrNotFound if not found. These properties are 
+    // not mandatory, so we can ignore that leave
+    TRAP_IGNORE( iConfigFile->GetSensorPropertiesL( iProperties ) );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::ConstructL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceControl* CSsyReferenceControl::NewL( MSsyCallback& aSsyCallback )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::NewL()" ) ) );
+    CSsyReferenceControl* self = new ( ELeave ) CSsyReferenceControl( aSsyCallback );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceControl::~CSsyReferenceControl()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::~CSsyReferenceControl()" ) ) );
+
+    if ( iChannelArray )
+        {
+        if ( iChannelArray->Count() )
+            {
+            iChannelArray->ResetAndDestroy();
+            }
+        
+        delete iChannelArray;
+        }
+
+    if ( iConfigFile ) 
+        {
+        delete iConfigFile;
+        iConfigFile = NULL;
+        }
+
+    iProperties.Reset();
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::~CSsyReferenceControl() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::SsyCallback
+// ---------------------------------------------------------------------------
+//
+MSsyCallback& CSsyReferenceControl::SsyCallback() const
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::SsyCallback()" ) ) );
+    return iSsyCallback;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::SsyConfig
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceConfig& CSsyReferenceControl::SsyConfig() const
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::SsyConfig()" ) ) );
+    return *iConfigFile;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::FindPropertyL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceControl::FindPropertyL( 
+    const TSensrvPropertyId aPropertyId, 
+    const TInt aArrayIndex,
+    TSensrvProperty& aProperty )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::FindPropertyL()" ) ) );
+    TSensrvProperty* property = NULL;
+    TBool propertyFound( EFalse );
+
+    // Search property
+    for ( TInt i = 0; i < iProperties.Count() && !propertyFound; i++ )
+        {
+        property = static_cast<TSensrvProperty*>( &iProperties[i] );
+
+        // Compare property IDs
+        if ( property->GetPropertyId() == aPropertyId )
+            {
+            // Correct property ID is found, now check is it array type of property.
+            // Either array indexes must match or propertys array index has to be array info
+            if ( ( property->GetArrayIndex() == aArrayIndex ) || 
+                 ( ( property->GetArrayIndex() == ESensrvArrayPropertyInfo ) && 
+                   ( ESensrvSingleProperty == aArrayIndex ) ) )
+                {
+                // Correct array index found
+                propertyFound = ETrue;    
+                }
+            }
+        }
+
+    // Leave if not found
+    if ( !propertyFound )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    aProperty = *property;
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::FindPropertyL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::FindChannel
+// ---------------------------------------------------------------------------
+//
+CSsyReferenceChannel* CSsyReferenceControl::FindChannelL( TSensrvChannelId aChannelID )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::FindChannel()" ) ) );
+    
+    if ( !iChannelArray )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    const TInt channelCount( iChannelArray->Count() );
+    CSsyReferenceChannel* channel = NULL;
+
+    // Check that there are channels
+    if ( channelCount ) 
+        {
+        // Loop channels until correct channel is found
+        for ( TInt i = 0; i < channelCount; i++ ) 
+            {
+            channel = iChannelArray->At( i );
+            
+            // Compare channel id
+            if ( channel->ChannelId() == aChannelID )
+                {
+                // Channel found, no need to loop rest
+                i = channelCount;
+                }
+            }
+        }
+
+    // Leave if channel is not found
+    if ( !channel )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::FindChannel() - return" ) ) );
+    return channel;
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::OpenChannelL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceControl::OpenChannelL( TSensrvChannelId aChannelID )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::OpenChannelL()" ) ) );
+    // Find and open channel
+    User::LeaveIfError( FindChannelL( aChannelID )->OpenChannel() );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::OpenChannelL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::CloseChannelL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceControl::CloseChannelL( TSensrvChannelId aChannelID )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::CloseChannelL()" ) ) );
+    // Find and close channel
+    User::LeaveIfError( FindChannelL( aChannelID )->CloseChannel() );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::CloseChannelL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferenceControl::ProcessResponse
+// ---------------------------------------------------------------------------
+//
+void CSsyReferenceControl::ProcessResponse( TSsyReferenceMsg* /*aMessage*/ )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::ProcessResponse()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferenceControl::ProcessResponse() - return" ) ) );
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/ssyreference/src/ssyreferencepropertyprovider.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,170 @@
+/*
+* 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:  Reference implementation of SSY Property Provider interface
+*
+*/
+
+
+#include "ssyreferencepropertyprovider.h"
+#include "ssyreferencetrace.h"
+#include "ssyreferencechannel.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider C++ constructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferencePropertyProvider::CSsyReferencePropertyProvider( CSsyReferenceChannel& aChannel ) :
+    iChannel( aChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::ConstructL()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL() - return" ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::NewL
+// ---------------------------------------------------------------------------
+//
+CSsyReferencePropertyProvider* CSsyReferencePropertyProvider::NewL( CSsyReferenceChannel& aChannel )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL()" ) ) );
+    CSsyReferencePropertyProvider* self = new ( ELeave ) CSsyReferencePropertyProvider( aChannel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL() - return" ) ) );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::CheckPropertyDependenciesL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::CheckPropertyDependenciesL( 
+    const TSensrvChannelId /*aChannelId*/,
+    const TSensrvProperty& /*aProperty*/,
+    RSensrvChannelList& /*aAffectedChannels*/ )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL()" ) ) );
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::SetPropertyL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::SetPropertyL( 
+    const TSensrvChannelId aChannelId,
+    const TSensrvProperty& aProperty )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL()" ) ) );
+
+    if ( iChannel.ChannelId() != aChannelId )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Search property. Leaves with KErrNotFound if property is not found. 
+    // Leaves with KErrAccessDenied if found property is Read only
+    iChannel.FindAndUpdatePropertyL( aProperty );
+    
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::GetPropertyL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::GetPropertyL( 
+    const TSensrvChannelId aChannelId,
+    TSensrvProperty& aProperty )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL()" ) ) );
+    
+    if ( iChannel.ChannelId() != aChannelId && aChannelId != 0 )
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        // Search property. Leaves with KErrNotFound if property is not found
+        aProperty = iChannel.FindPropertyL( 
+                        aProperty.GetPropertyId(), 
+                        aProperty.PropertyItemIndex(),
+                        aProperty.GetArrayIndex() );
+        }
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::GetAllPropertiesL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::GetAllPropertiesL( 
+    const TSensrvChannelId aChannelId,
+    RSensrvPropertyList& aChannelPropertyList )
+    {
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL()" ) ) );
+    
+    if ( iChannel.ChannelId() != aChannelId )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    iChannel.GetProperties( aChannelPropertyList );
+
+    COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL() - return" ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL
+// ---------------------------------------------------------------------------
+//
+void CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL( TUid aInterfaceUid, 
+	                                        TAny*& aInterface )
+    {
+    aInterface = NULL;
+    
+	if ( aInterfaceUid.iUid == KSsyPropertyProviderInterface1.iUid )
+		{
+		aInterface = reinterpret_cast<TAny*>(
+			static_cast<MSsyPropertyProvider*>( this ) );
+		}
+    }
+  
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/bwins/tiltcompensationu.def	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?Compensate@@YAHABVTTiltCompensationInput@@AAVTTiltCompensationOutput@@F@Z @ 1 NONAME ; int Compensate(class TTiltCompensationInput const &, class TTiltCompensationOutput &, short)
+	?Compensate@@YAHABVTTiltCompensationInput@@AAVTTiltCompensationOutput@@FABV?$RArray@N@@@Z @ 2 NONAME ; int Compensate(class TTiltCompensationInput const &, class TTiltCompensationOutput &, short, class RArray<double> const &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/eabi/tiltcompensationu.def	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z10CompensateRK22TTiltCompensationInputR23TTiltCompensationOutputs @ 1 NONAME
+	_Z10CompensateRK22TTiltCompensationInputR23TTiltCompensationOutputsRK6RArrayIdE @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/group/bld.inf	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,29 @@
+/*
+* 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:  Build information file for project Tilt Compensation SSY.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+tiltcompensationstub.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/group/tiltcompensationstub.mmp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,39 @@
+/*
+* 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:  Project definition file for project Tilt Compensation
+*                algorithm.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          		tiltcompensation.dll
+TARGETTYPE      		dll
+UID             		0x1000008d 0x2000B5F7
+
+CAPABILITY      		CAP_GENERAL_DLL
+VENDORID        		VID_DEFAULT
+
+SOURCEPATH      		../src
+SOURCE                  tiltcompensation.cpp
+
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     		.
+USERINCLUDE     		../inc
+
+LIBRARY         		euser.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/common.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  Common definitions.
+*
+*/
+
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <e32std.h>
+
+// CONSTANTS
+
+/** Panic codes */
+enum TPanicReason
+    {
+    EInvalidState,
+    EAlreadyServingTransaction,
+    ENotActive,
+    ENullPointer,
+    EInvalidTransactionId,
+    EInvalidEventId,
+    EIncorrectStateCount,
+    EAccelerometerChannelNotCreated,
+    EMagnetometerChannelNotCreated
+    };
+
+#endif // COMMON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/common/common.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  Common definitions.
+*
+*/
+
+
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <e32std.h>
+
+// CONSTANTS
+
+/** Panic codes */
+enum TPanicReason
+    {
+    EInvalidState,
+    EAlreadyServingTransaction,
+    ENotActive,
+    ENullPointer,
+    EInvalidTransactionId,
+    EInvalidEventId,
+    EIncorrectStateCount,
+    EAccelerometerChannelNotCreated,
+    EMagnetometerChannelNotCreated
+    };
+
+#endif // COMMON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/common/trace.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,407 @@
+/*
+* 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 TRACE_H
+#define TRACE_H
+
+#include <e32base.h>
+
+#include "traceconfiguration.hrh"
+
+#ifdef TRACE_INTO_FILE
+#include <flogger.h> // RFileLogger
+#else
+#include <e32debug.h> // RDebug
+#endif
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+//
+
+/**
+* Panic category.
+*/
+_LIT( KPanicCat, "TILTSSY" );
+
+/**
+* Prefix trace macro to complete tracing with component name.
+* Returns TDesC which can be used directly with RDebug or RFileLogger.
+*/
+#define _PREFIX_TRACE( aMsg ) TPtrC( (const TText*)L"[TILT SSY]: " L##aMsg )
+
+/**
+* Prefix error trace
+*/
+#define _PREFIX_ERROR( aMsg ) _PREFIX_TRACE( "[ERROR: %d]: " L##aMsg )
+
+/**
+* Prefix info trace.
+*/
+#define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg )
+
+/**
+* Prefix macro for strings
+*/
+#define _PREFIX_CHAR( aMsg ) (const char*)"[TILT SSY]: " ##aMsg
+
+/**
+* Define needed directories if TRACE_INTO_FILE macro in use
+*/
+#ifdef TRACE_INTO_FILE
+
+    _LIT( KDir, "TILT_SSY" );
+    _LIT( KFile, "TILT_SSY.log" );
+    _LIT( KFullPath, "c:\\logs\\TILT_SSY\\" );
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Assert trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+
+    #define ASSERT_DEBUG_TRACE( aCond, aReason )\
+        {\
+        if( !( aCond ) )\
+            {\
+            RDebug::Printf( "[TILT SSY]: ASSERT in file: %s, function: %s, line: %u, reason: %d",\
+                __FILE__, __FUNCTION__, __LINE__, aReason );\
+            }\
+        __ASSERT_DEBUG( aCond, User::Panic( KPanicCat, aReason ) );\
+        }
+        
+#else
+
+    #define ASSERT_DEBUG_TRACE( aCond, aReason )
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Error trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef ERROR_TRACE
+
+    /**
+    * Error trace definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+            
+    #else//TRACE_INTO_FILE not defined
+    
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+    
+    #endif//TRACE_INTO_FILE
+
+    #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 ) ERROR_2( KErrGeneral, aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) ERROR_3( KErrGeneral, aMsg, aP1, aP2, aP3 )
+
+#else//ERROR_TRACE not defined
+
+    #define ERROR( aErr, aMsg )
+    #define ERROR_1( aErr, aMsg, aP1 )
+    #define ERROR_2( aErr, aMsg, aP1, aP2 )
+    #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )
+    #define ERROR_GEN( aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 )
+
+#endif//ERROR_TRACE
+
+//-----------------------------------------------------------------------------
+// Info trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef INFO_TRACE
+
+    /**
+    * Info log message definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define INFO( aMsg )\
+            {\
+            RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+
+        #define INFO( aMsg )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+
+    #endif//TRACE_INTO_FILE
+        
+#else//INFO_TRACE not defined
+
+    #define INFO( aMsg )
+    #define INFO_1( aMsg, aP1 )
+    #define INFO_2( aMsg, aP1, aP2 )
+    #define INFO_3( aMsg, aP1, aP2, aP3 )
+
+#endif//INFO_TRACE
+
+//-----------------------------------------------------------------------------
+// Trace current client thread name and process id
+//-----------------------------------------------------------------------------
+//
+#ifdef CLIENT_TRACE
+
+    #define CLIENT( aMessage )\
+        {\
+        RThread thread;\
+        TInt err = aMessage.Client( thread );\
+        if( err == KErrNone )\
+            {\
+            RProcess process;\
+            err = thread.Process( process );\
+            if( err == KErrNone )\
+                {\
+                TPtrC thredName( thread.Name() );\
+                TUid processUid( process.SecureId() );\
+                INFO_2( "Current client process UID: [%x], thread name: [%S]",\
+                    processUid,\
+                    &thredName );\
+                }\
+            process.Close();\
+            }\
+        thread.Close();\
+        }
+
+#else
+
+    #define CLIENT( aMessage )
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Function trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef FUNC_TRACE
+
+    /**
+    * Function logging definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            TPtrC8 trace( _S8( aMsg ) );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, trace, aP1 );\
+            }\
+    
+    #else//TRACE_INTO_FILE not defined
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            RDebug::Printf( aMsg, aP1 );\
+            }\
+    
+    #endif//TRACE_INTO_FILE
+        
+    /**
+    * Function trace helper class.
+    * 
+    * NOTE:
+    * LC -methods cannot be trapped. Therefore if LC -method leaves
+    * END trace is used instead of LEAVE trace.
+    * If you have an idea how to round this problem please tell.
+    */
+    _LIT8( KFuncNameTerminator, "(" );
+    _LIT8( KFuncLeavePatternL, "L" );
+    class TFuncLog
+        {
+        public:
+            static void Cleanup( TAny* aPtr )
+                {
+                TFuncLog* self = static_cast< TFuncLog* >( aPtr );
+                self->iLeft = ETrue;
+                FUNC( _PREFIX_CHAR("%S-LEAVE"), &self->iFunc ); // Leave detected
+                }
+            inline TFuncLog( const char* aFunc ) :
+                    iFunc( aFunc ? _S8( aFunc ) : _S8("") ),
+                    iLeft( EFalse ),
+                    iCleanupItem( Cleanup, this ),
+                    iCanLeave( EFalse )
+                {
+                TInt pos( iFunc.Find( KFuncNameTerminator ) );
+                if( pos != KErrNotFound )
+                    {
+                    iFunc.Set( iFunc.Left( pos ) );
+                    iCanLeave = !iFunc.Right( KFuncLeavePatternL().Length() ).Compare( KFuncLeavePatternL );
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::PushL( iCleanupItem ); // Ignore warnings
+                        }
+                    }
+                FUNC( _PREFIX_CHAR("%S-START"), &iFunc );
+                }
+
+            inline ~TFuncLog()
+                {
+                if ( !iLeft )
+                    {
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::Pop( this ); // Pop the cleanup item
+                        }
+                    FUNC( _PREFIX_CHAR("%S-END"), &iFunc ); // Normally finished
+                    }
+                }
+
+        private: // Data
+            TPtrC8 iFunc;
+            TBool iLeft;
+            TCleanupItem iCleanupItem;
+            TBool iCanLeave;
+        };
+    #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ );
+    
+#else//FUNC_TRACE not defined
+
+    #define FUNC_LOG
+
+#endif//FUNC_TRACE
+
+//-----------------------------------------------------------------------------
+// Timestamp trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef TIMESTAMP_TRACE
+
+    #ifdef TRACE_INTO_FILE
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend,\
+                _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                    &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RDebug::Print( _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #endif//TRACE_INTO_FILE
+
+#else//TIMESTAMP_TRACE not defined
+
+    #define TIMESTAMP( aCaption )
+
+#endif//TIMESTAMP_TRACE
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/common/traceconfiguration.hrh	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* 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 TRACECONFIGURATION_HRH
+#define TRACECONFIGURATION_HRH
+
+//-----------------------------------------------------------------------------
+// Trace definitions
+//-----------------------------------------------------------------------------
+//
+
+/**
+* Error trace enabled
+*/
+#ifdef _DEBUG
+    #define ERROR_TRACE
+#else
+    #undef ERROR_TRACE
+#endif
+
+/**
+* Info trace enabled
+*/
+#ifdef _DEBUG
+    #define INFO_TRACE
+#else
+    #undef INFO_TRACE
+#endif
+
+/**
+* Function trace enabled
+*/
+#undef FUNC_TRACE
+
+/**
+* Timestamp tracing on
+*/
+#ifdef _DEBUG
+    #define TIMESTAMP_TRACE
+#else
+    #undef TIMESTAMP_TRACE
+#endif
+
+/**
+* Tracing current client process and thread
+*/
+#ifdef _DEBUG
+    #define CLIENT_TRACE
+#else
+    #undef CLIENT_TRACE
+#endif
+
+/**
+* Tracing into file enabled, default RDebug
+*/
+#undef TRACE_INTO_FILE
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/trace.h	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,407 @@
+/*
+* 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 TRACE_H
+#define TRACE_H
+
+#include <e32base.h>
+
+#include "traceconfiguration.hrh"
+
+#ifdef TRACE_INTO_FILE
+#include <flogger.h> // RFileLogger
+#else
+#include <e32debug.h> // RDebug
+#endif
+
+//-----------------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------------
+//
+
+/**
+* Panic category.
+*/
+_LIT( KPanicCat, "TILTSSY" );
+
+/**
+* Prefix trace macro to complete tracing with component name.
+* Returns TDesC which can be used directly with RDebug or RFileLogger.
+*/
+#define _PREFIX_TRACE( aMsg ) TPtrC( (const TText*)L"[TILT SSY]: " L##aMsg )
+
+/**
+* Prefix error trace
+*/
+#define _PREFIX_ERROR( aMsg ) _PREFIX_TRACE( "[ERROR: %d]: " L##aMsg )
+
+/**
+* Prefix info trace.
+*/
+#define _PREFIX_INFO( aMsg ) _PREFIX_TRACE( "[INFO]: " L##aMsg )
+
+/**
+* Prefix macro for strings
+*/
+#define _PREFIX_CHAR( aMsg ) (const char*)"[TILT SSY]: " ##aMsg
+
+/**
+* Define needed directories if TRACE_INTO_FILE macro in use
+*/
+#ifdef TRACE_INTO_FILE
+
+    _LIT( KDir, "TILT_SSY" );
+    _LIT( KFile, "TILT_SSY.log" );
+    _LIT( KFullPath, "c:\\logs\\TILT_SSY\\" );
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Assert trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+
+    #define ASSERT_DEBUG_TRACE( aCond, aReason )\
+        {\
+        if( !( aCond ) )\
+            {\
+            RDebug::Printf( "[TILT SSY]: ASSERT in file: %s, function: %s, line: %u, reason: %d",\
+                __FILE__, __FUNCTION__, __LINE__, aReason );\
+            }\
+        __ASSERT_DEBUG( aCond, User::Panic( KPanicCat, aReason ) );\
+        }
+        
+#else
+
+    #define ASSERT_DEBUG_TRACE( aCond, aReason )
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Error trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef ERROR_TRACE
+
+    /**
+    * Error trace definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+            
+    #else//TRACE_INTO_FILE not defined
+    
+        #define ERROR( aErr, aMsg )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr );\
+                }\
+            }
+        #define ERROR_1( aErr, aMsg, aP1 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1 );\
+                }\
+            }
+        #define ERROR_2( aErr, aMsg, aP1, aP2 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2 );\
+                }\
+            }
+        #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )\
+            {\
+            if( aErr < KErrNone )\
+                {\
+                RDebug::Print( _PREFIX_ERROR( aMsg ), aErr, aP1, aP2, aP3 );\
+                }\
+            }
+    
+    #endif//TRACE_INTO_FILE
+
+    #define ERROR_GEN( aMsg ) ERROR( KErrGeneral, aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 ) ERROR_1( KErrGeneral, aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 ) ERROR_2( KErrGeneral, aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 ) ERROR_3( KErrGeneral, aMsg, aP1, aP2, aP3 )
+
+#else//ERROR_TRACE not defined
+
+    #define ERROR( aErr, aMsg )
+    #define ERROR_1( aErr, aMsg, aP1 )
+    #define ERROR_2( aErr, aMsg, aP1, aP2 )
+    #define ERROR_3( aErr, aMsg, aP1, aP2, aP3 )
+    #define ERROR_GEN( aMsg )
+    #define ERROR_GEN_1( aMsg, aP1 )
+    #define ERROR_GEN_2( aMsg, aP1, aP2 )
+    #define ERROR_GEN_3( aMsg, aP1, aP2, aP3 )
+
+#endif//ERROR_TRACE
+
+//-----------------------------------------------------------------------------
+// Info trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef INFO_TRACE
+
+    /**
+    * Info log message definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define INFO( aMsg )\
+            {\
+            RFileLogger::Write( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+
+        #define INFO( aMsg )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ) );\
+            }
+        #define INFO_1( aMsg, aP1 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1 );\
+            }
+        #define INFO_2( aMsg, aP1, aP2 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2 );\
+            }
+        #define INFO_3( aMsg, aP1, aP2, aP3 )\
+            {\
+            RDebug::Print( _PREFIX_INFO( aMsg ), aP1, aP2, aP3 );\
+            }
+
+    #endif//TRACE_INTO_FILE
+        
+#else//INFO_TRACE not defined
+
+    #define INFO( aMsg )
+    #define INFO_1( aMsg, aP1 )
+    #define INFO_2( aMsg, aP1, aP2 )
+    #define INFO_3( aMsg, aP1, aP2, aP3 )
+
+#endif//INFO_TRACE
+
+//-----------------------------------------------------------------------------
+// Trace current client thread name and process id
+//-----------------------------------------------------------------------------
+//
+#ifdef CLIENT_TRACE
+
+    #define CLIENT( aMessage )\
+        {\
+        RThread thread;\
+        TInt err = aMessage.Client( thread );\
+        if( err == KErrNone )\
+            {\
+            RProcess process;\
+            err = thread.Process( process );\
+            if( err == KErrNone )\
+                {\
+                TPtrC thredName( thread.Name() );\
+                TUid processUid( process.SecureId() );\
+                INFO_2( "Current client process UID: [%x], thread name: [%S]",\
+                    processUid,\
+                    &thredName );\
+                }\
+            process.Close();\
+            }\
+        thread.Close();\
+        }
+
+#else
+
+    #define CLIENT( aMessage )
+
+#endif
+
+//-----------------------------------------------------------------------------
+// Function trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef FUNC_TRACE
+
+    /**
+    * Function logging definitions.
+    */
+    #ifdef TRACE_INTO_FILE
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            TPtrC8 trace( _S8( aMsg ) );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend, trace, aP1 );\
+            }\
+    
+    #else//TRACE_INTO_FILE not defined
+    
+        #define FUNC( aMsg, aP1 )\
+            {\
+            RDebug::Printf( aMsg, aP1 );\
+            }\
+    
+    #endif//TRACE_INTO_FILE
+        
+    /**
+    * Function trace helper class.
+    * 
+    * NOTE:
+    * LC -methods cannot be trapped. Therefore if LC -method leaves
+    * END trace is used instead of LEAVE trace.
+    * If you have an idea how to round this problem please tell.
+    */
+    _LIT8( KFuncNameTerminator, "(" );
+    _LIT8( KFuncLeavePatternL, "L" );
+    class TFuncLog
+        {
+        public:
+            static void Cleanup( TAny* aPtr )
+                {
+                TFuncLog* self = static_cast< TFuncLog* >( aPtr );
+                self->iLeft = ETrue;
+                FUNC( _PREFIX_CHAR("%S-LEAVE"), &self->iFunc ); // Leave detected
+                }
+            inline TFuncLog( const char* aFunc ) :
+                    iFunc( aFunc ? _S8( aFunc ) : _S8("") ),
+                    iLeft( EFalse ),
+                    iCleanupItem( Cleanup, this ),
+                    iCanLeave( EFalse )
+                {
+                TInt pos( iFunc.Find( KFuncNameTerminator ) );
+                if( pos != KErrNotFound )
+                    {
+                    iFunc.Set( iFunc.Left( pos ) );
+                    iCanLeave = !iFunc.Right( KFuncLeavePatternL().Length() ).Compare( KFuncLeavePatternL );
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::PushL( iCleanupItem ); // Ignore warnings
+                        }
+                    }
+                FUNC( _PREFIX_CHAR("%S-START"), &iFunc );
+                }
+
+            inline ~TFuncLog()
+                {
+                if ( !iLeft )
+                    {
+                    if ( iCanLeave )
+                        {
+                        CleanupStack::Pop( this ); // Pop the cleanup item
+                        }
+                    FUNC( _PREFIX_CHAR("%S-END"), &iFunc ); // Normally finished
+                    }
+                }
+
+        private: // Data
+            TPtrC8 iFunc;
+            TBool iLeft;
+            TCleanupItem iCleanupItem;
+            TBool iCanLeave;
+        };
+    #define FUNC_LOG TFuncLog _fl( __PRETTY_FUNCTION__ );
+    
+#else//FUNC_TRACE not defined
+
+    #define FUNC_LOG
+
+#endif//FUNC_TRACE
+
+//-----------------------------------------------------------------------------
+// Timestamp trace macros
+//-----------------------------------------------------------------------------
+//
+#ifdef TIMESTAMP_TRACE
+
+    #ifdef TRACE_INTO_FILE
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RFileLogger::WriteFormat( KDir, KFile, EFileLoggingModeAppend,\
+                _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                    &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #else//TRACE_INTO_FILE not defined
+    
+        #define TIMESTAMP( aCaption )\
+            {\
+            TTime t;\
+            t.HomeTime();\
+            TDateTime dt = t.DateTime();\
+            _LIT( KCaption, aCaption );\
+            RDebug::Print( _PREFIX_TRACE("[TIMESTAMP] %S %d:%02d:%02d.%d us"),\
+                &KCaption, dt.Hour(), dt.Minute(), dt.Second(), dt.MicroSecond() );\
+            }
+
+    #endif//TRACE_INTO_FILE
+
+#else//TIMESTAMP_TRACE not defined
+
+    #define TIMESTAMP( aCaption )
+
+#endif//TIMESTAMP_TRACE
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/inc/traceconfiguration.hrh	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,73 @@
+/*
+* 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 TRACECONFIGURATION_HRH
+#define TRACECONFIGURATION_HRH
+
+//-----------------------------------------------------------------------------
+// Trace definitions
+//-----------------------------------------------------------------------------
+//
+
+/**
+* Error trace enabled
+*/
+#ifdef _DEBUG
+    #define ERROR_TRACE
+#else
+    #undef ERROR_TRACE
+#endif
+
+/**
+* Info trace enabled
+*/
+#ifdef _DEBUG
+    #define INFO_TRACE
+#else
+    #undef INFO_TRACE
+#endif
+
+/**
+* Function trace enabled
+*/
+#undef FUNC_TRACE
+
+/**
+* Timestamp tracing on
+*/
+#ifdef _DEBUG
+    #define TIMESTAMP_TRACE
+#else
+    #undef TIMESTAMP_TRACE
+#endif
+
+/**
+* Tracing current client process and thread
+*/
+#ifdef _DEBUG
+    #define CLIENT_TRACE
+#else
+    #undef CLIENT_TRACE
+#endif
+
+/**
+* Tracing into file enabled, default RDebug
+*/
+#undef TRACE_INTO_FILE
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/rom/tiltcompensation.iby	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* 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:  Stub
+*
+*/
+
+#ifndef __TILTCOMPENSATION_IBY__
+#define __TILTCOMPENSATION_IBY__
+
+file=ABI_DIR\BUILD_DIR\tiltcompensation.dll			SHARED_LIB_DIR\tiltcompensation.dll
+
+#endif __TILTCOMPENSATION_IBY__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/src/tiltcompensation.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,211 @@
+/*
+* 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:  Compensate function definition.
+*
+*/
+
+
+#include <e32math.h>
+#include <tiltcompensation.h>
+#include <e32debug.h>
+
+//-----------------------------------------------------------------------------
+// Direction6D
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt Compensate(
+    const TTiltCompensationInput& aInput,
+    TTiltCompensationOutput& aOutput,
+    const TInt16 aPreviousTheta
+     )
+    {
+    TReal target;
+    TReal source( 0 );
+    TReal inputY( aInput.iMagneticVector.iY );
+    TReal inputZ( aInput.iMagneticVector.iZ );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    
+    Math::ATan( target, source );
+    TInt16 declination( ( target * 180 ) / 3.14 );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        declination = declination + 90;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        declination = declination + 180;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        declination = declination + 270;
+        }
+    
+    if( inputY == 0 && inputZ > 0 )
+        {
+        declination = 0;
+        }
+    if( inputY > 0 && inputZ == 0 )
+        {
+        declination = 90;
+        }
+    if( inputY == 0 && inputZ < 0 )
+        {
+        declination = 180;
+        }
+    if( inputY < 0 && inputZ == 0 )
+        {
+        declination = 270;
+        }
+    
+    if( ( aPreviousTheta < ( aOutput.iTheta + 5 ) ) && ( aPreviousTheta > ( aOutput.iTheta - 5 ) ) )
+        {
+        aOutput.iTheta = aPreviousTheta;
+        }
+    
+    aOutput.iTheta = declination;
+    return KErrNone;
+    }
+    
+//-----------------------------------------------------------------------------
+// Direction6D
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt Compensate(
+    const TTiltCompensationInput& aInput,
+    TTiltCompensationOutput& aOutput,
+    const TInt16 aPreviousTheta,
+    const RParamsArray& aParamsArray )
+    {
+    TReal target;
+    TReal source( 0 );
+    TReal inputY( aInput.iMagneticVector.iY );
+    TReal inputX( aInput.iMagneticVector.iX );
+    
+    // Get parameters
+    for( TInt i = 0; i != aParamsArray.Count(); i++ )
+        {
+        TInt parameter = aParamsArray[ i ];
+        }
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iX > 0 )
+    // 0 - 90 degrees
+        {
+        source = inputX / inputY;
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iX < 0 )
+    // 90 - 180 degrees
+        {
+        source = inputX / inputY * -1;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iX < 0 )
+    // 180 - 270 degrees
+        {
+        source = inputY / inputX;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iX > 0 )
+    // 270 - 360 degrees
+        {
+        source = inputX / inputY * -1;
+        }
+    
+    Math::ATan( target, source );
+    TInt16 declination( ( target * 180 ) / 3.14 );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iX > 0 )
+    // 0 - 90 degrees
+        {
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iX < 0 )
+    // 90 - 180 degrees
+        {
+        declination = declination + 90;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iX < 0 )
+    // 180 - 270 degrees
+        {
+        declination = declination + 180;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iX > 0 )
+    // 270 - 360 degrees
+        {
+        declination = declination + 270;
+        }
+    
+    if( inputY == 0 && inputX > 0 )
+        {
+        declination = 0;
+        }
+    if( inputY > 0 && inputX == 0 )
+        {
+        declination = 90;
+        }
+    if( inputY == 0 && inputX < 0 )
+        {
+        declination = 180;
+        }
+    if( inputY < 0 && inputX == 0 )
+        {
+        declination = 270;
+        }
+    
+    if( ( aPreviousTheta < ( aOutput.iTheta + 5 ) ) && ( aPreviousTheta > ( aOutput.iTheta - 5 ) ) )
+        {
+        aOutput.iTheta = aPreviousTheta;
+        }
+    
+    // Filter data...
+    
+    // For testing purposes change angle with fixed values from input parameters
+    aOutput.iTheta = declination;
+    const TInt KAngleChange = 30;
+    aOutput.iTheta += ( aParamsArray[ 0 ] * KAngleChange );
+    aOutput.iTheta += ( aParamsArray[ 1 ] * KAngleChange );
+    aOutput.iTheta += ( aParamsArray[ 2 ] * KAngleChange );
+    aOutput.iTheta += ( aParamsArray[ 3 ] * KAngleChange );
+    aOutput.iTheta %= 360; // take modulo to avoid angle larger than 360
+    // ... end for testing purposes
+    
+
+    return KErrNone;
+    }    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/systemswstubs/tiltcompensationstub/src/tiltcompensation/tiltcompensation.cpp	Mon Jan 18 20:06:52 2010 +0200
@@ -0,0 +1,186 @@
+/*
+* 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:  Compensate function definition.
+*
+*/
+
+
+#include <e32math.h>
+#include "tiltcompensation.h"
+
+//-----------------------------------------------------------------------------
+// Direction6D
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt Compensate(
+    const TTiltCompensationInput& aInput,
+    TTiltCompensationOutput& aOutput,
+     )
+    {
+    TReal target;
+    TReal source( 0 );
+    TReal inputY( aInput.iMagneticVector.iY );
+    TReal inputZ( aInput.iMagneticVector.iZ );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    
+    Math::ATan( target, source );
+    TInt16 declination( ( target * 180 ) / 3.14 );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        declination = declination + 90;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        declination = declination + 180;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        declination = declination + 270;
+        }
+    
+    if( inputY == 0 && inputZ > 0 )
+        {
+        declination = 0;
+        }
+    if( inputY > 0 && inputZ == 0 )
+        {
+        declination = 90;
+        }
+    if( inputY == 0 && inputZ < 0 )
+        {
+        declination = 180;
+        }
+    if( inputY < 0 && inputZ == 0 )
+        {
+        declination = 270;
+        }
+    
+    aOutput.iTheta = declination;
+    return KErrNone;
+    }
+    
+//-----------------------------------------------------------------------------
+// Direction6D
+//-----------------------------------------------------------------------------
+//
+EXPORT_C TInt Compensate(
+    const TTiltCompensationInput& aInput,
+    TTiltCompensationOutput& aOutput,
+    const RParamsArray& aParamsArray )
+    {
+    TReal target;
+    TReal source( 0 );
+    TReal inputY( aInput.iMagneticVector.iY );
+    TReal inputZ( aInput.iMagneticVector.iZ );
+    
+    // Get parameters
+    for( TInt i = 0; i != aParamsArray.Count(); i++ )
+        {
+        TInt parameter = aParamsArray[ i ];
+        }
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        source = inputY / inputZ;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        source = inputZ / inputY * -1;
+        }
+    
+    Math::ATan( target, source );
+    TInt16 declination( ( target * 180 ) / 3.14 );
+    
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ > 0 )
+    // 0 - 90 degrees
+        {
+        }
+    if( aInput.iMagneticVector.iY > 0 && aInput.iMagneticVector.iZ < 0 )
+    // 90 - 180 degrees
+        {
+        declination = declination + 90;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ < 0 )
+    // 180 - 270 degrees
+        {
+        declination = declination + 180;
+        }
+    if( aInput.iMagneticVector.iY < 0 && aInput.iMagneticVector.iZ > 0 )
+    // 270 - 360 degrees
+        {
+        declination = declination + 270;
+        }
+    
+    if( inputY == 0 && inputZ > 0 )
+        {
+        declination = 0;
+        }
+    if( inputY > 0 && inputZ == 0 )
+        {
+        declination = 90;
+        }
+    if( inputY == 0 && inputZ < 0 )
+        {
+        declination = 180;
+        }
+    if( inputY < 0 && inputZ == 0 )
+        {
+        declination = 270;
+        }
+    
+    aOutput.iTheta = declination;
+    return KErrNone;
+    }    
+
+// End of File