summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2011-02-22 15:51:34 +1000
committerLincoln Ramsay <lincoln.ramsay@nokia.com>2011-02-23 16:47:44 +1000
commit6c351f416d5cece4239fac6ffee0a43e91185927 (patch)
tree13819fea70da6b1b490d7679234579d822828fa5
parent31dbd2a68e4e011819a49b1ffb37a1d3c52fd965 (diff)
Don't delay readings when too much CPU is used.
Instead of letting un-processed readings build up in the buffer, read up to 100 readings at a time. Only the last is processed, the rest are simply dropped. Fixes: QTMOBILITY-759
-rw-r--r--plugins/sensors/symbian/accelerometersym.cpp17
-rw-r--r--plugins/sensors/symbian/accelerometersym.h4
-rw-r--r--plugins/sensors/symbian/ambientlightsensorsym.cpp17
-rw-r--r--plugins/sensors/symbian/ambientlightsensorsym.h4
-rw-r--r--plugins/sensors/symbian/compasssym.cpp17
-rw-r--r--plugins/sensors/symbian/compasssym.h4
-rw-r--r--plugins/sensors/symbian/lightsensorsym.cpp17
-rw-r--r--plugins/sensors/symbian/lightsensorsym.h4
-rw-r--r--plugins/sensors/symbian/magnetometersensorsym.cpp17
-rw-r--r--plugins/sensors/symbian/magnetometersensorsym.h4
-rw-r--r--plugins/sensors/symbian/orientationsym.cpp17
-rw-r--r--plugins/sensors/symbian/orientationsym.h4
-rw-r--r--plugins/sensors/symbian/proximitysensorsym.cpp17
-rw-r--r--plugins/sensors/symbian/proximitysensorsym.h4
-rw-r--r--plugins/sensors/symbian/rotationsensorsym.cpp18
-rw-r--r--plugins/sensors/symbian/rotationsensorsym.h4
-rw-r--r--plugins/sensors/symbian/sensorbackendsym.cpp15
-rw-r--r--plugins/sensors/symbian/sensorbackendsym.h9
-rw-r--r--plugins/sensors/symbian/tapsensorsym.cpp18
-rw-r--r--plugins/sensors/symbian/tapsensorsym.h4
20 files changed, 110 insertions, 105 deletions
diff --git a/plugins/sensors/symbian/accelerometersym.cpp b/plugins/sensors/symbian/accelerometersym.cpp
index 5b3845ee5b..c4dd39623e 100644
--- a/plugins/sensors/symbian/accelerometersym.cpp
+++ b/plugins/sensors/symbian/accelerometersym.cpp
@@ -144,19 +144,20 @@ void CAccelerometerSensorSym::start()
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle accelerometer sensor specific
* reading data and provides conversion and utility code
*/
-void CAccelerometerSensorSym::RecvData(CSensrvChannel &aChannel)
+void CAccelerometerSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvAccelerometerAxisData> accelerometerpkg( iData );
- TInt ret = aChannel.GetData( accelerometerpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvAccelerometerAxisData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
TReal x = iData.iAxisX;
TReal y = iData.iAxisY;
TReal z = iData.iAxisZ;
@@ -186,6 +187,8 @@ void CAccelerometerSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/accelerometersym.h b/plugins/sensors/symbian/accelerometersym.h
index 00f2f3ff1a..4981e14778 100644
--- a/plugins/sensors/symbian/accelerometersym.h
+++ b/plugins/sensors/symbian/accelerometersym.h
@@ -79,11 +79,11 @@ private:
CAccelerometerSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle accelerometer sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/ambientlightsensorsym.cpp b/plugins/sensors/symbian/ambientlightsensorsym.cpp
index 658a35d42c..e8444d3b5b 100644
--- a/plugins/sensors/symbian/ambientlightsensorsym.cpp
+++ b/plugins/sensors/symbian/ambientlightsensorsym.cpp
@@ -79,19 +79,20 @@ CAmbientLightSensorSym::CAmbientLightSensorSym(QSensor *sensor):CSensorBackendSy
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle ambient light sensor specific
* reading data and provides conversion and utility code
*/
-void CAmbientLightSensorSym::RecvData(CSensrvChannel &aChannel)
+void CAmbientLightSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvAmbientLightData> lightpkg( iData );
- TInt ret = aChannel.GetData( lightpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvAmbientLightData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
switch (iData.iAmbientLight)
@@ -136,6 +137,8 @@ void CAmbientLightSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/ambientlightsensorsym.h b/plugins/sensors/symbian/ambientlightsensorsym.h
index bab09dc7bb..fe3f2c3ef5 100644
--- a/plugins/sensors/symbian/ambientlightsensorsym.h
+++ b/plugins/sensors/symbian/ambientlightsensorsym.h
@@ -77,11 +77,11 @@ private:
CAmbientLightSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle ambient light sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/compasssym.cpp b/plugins/sensors/symbian/compasssym.cpp
index 2adf5317ba..52f86fcc7f 100644
--- a/plugins/sensors/symbian/compasssym.cpp
+++ b/plugins/sensors/symbian/compasssym.cpp
@@ -103,19 +103,20 @@ void CCompassSym::stop()
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle compass sensor specific
* reading data and provides conversion and utility code
*/
-void CCompassSym::RecvData(CSensrvChannel &aChannel)
+void CCompassSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvMagneticNorthData> proxpkg( iData );
- TInt ret = aChannel.GetData( proxpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvMagneticNorthData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
iReading.setAzimuth(iData.iAngleFromMagneticNorth);
@@ -125,6 +126,8 @@ void CCompassSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/compasssym.h b/plugins/sensors/symbian/compasssym.h
index 167f6ce867..70534da37e 100644
--- a/plugins/sensors/symbian/compasssym.h
+++ b/plugins/sensors/symbian/compasssym.h
@@ -92,11 +92,11 @@ private:
CCompassSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle compass sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/lightsensorsym.cpp b/plugins/sensors/symbian/lightsensorsym.cpp
index aaf0bf365d..2bf4a833c3 100644
--- a/plugins/sensors/symbian/lightsensorsym.cpp
+++ b/plugins/sensors/symbian/lightsensorsym.cpp
@@ -82,19 +82,20 @@ CLightSensorSym::CLightSensorSym(QSensor *sensor):CSensorBackendSym(sensor)
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle Light data sensor specific
* reading data and provides conversion and utility code
*/
-void CLightSensorSym::RecvData(CSensrvChannel &aChannel)
+void CLightSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost)
{
- TPckg<TSensrvAmbientLightLuxData> luxdatapkg( iData );
- TInt ret = aChannel.GetData( luxdatapkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvAmbientLightLuxData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
TReal lightValue = iData.iAmbientLight;
// Get a lock on the reading data
@@ -105,6 +106,8 @@ void CLightSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setLux(lightValue);
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/lightsensorsym.h b/plugins/sensors/symbian/lightsensorsym.h
index fa12dfa14b..3403afbb3a 100644
--- a/plugins/sensors/symbian/lightsensorsym.h
+++ b/plugins/sensors/symbian/lightsensorsym.h
@@ -78,11 +78,11 @@ private:
CLightSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle Light sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/magnetometersensorsym.cpp b/plugins/sensors/symbian/magnetometersensorsym.cpp
index fbc7223110..e864904cc2 100644
--- a/plugins/sensors/symbian/magnetometersensorsym.cpp
+++ b/plugins/sensors/symbian/magnetometersensorsym.cpp
@@ -41,7 +41,6 @@
// Internal Headers
#include "magnetometersensorsym.h"
-
#include <sensrvgeneralproperties.h>
/**
@@ -179,18 +178,18 @@ void CMagnetometerSensorSym::start()
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle magnetometer sensor specific
* reading data and provides conversion and utility code
*/
-void CMagnetometerSensorSym::RecvData(CSensrvChannel &aChannel)
+void CMagnetometerSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvMagnetometerAxisData> magnetometerpkg( iData );
- TInt ret = aChannel.GetData( magnetometerpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvMagnetometerAxisData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
TReal x, y, z;
@@ -231,6 +230,8 @@ void CMagnetometerSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setCalibrationLevel(iCalibrationLevel);
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/magnetometersensorsym.h b/plugins/sensors/symbian/magnetometersensorsym.h
index 454fcbded0..af3dbea662 100644
--- a/plugins/sensors/symbian/magnetometersensorsym.h
+++ b/plugins/sensors/symbian/magnetometersensorsym.h
@@ -90,11 +90,11 @@ private:
CMagnetometerSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle magnetometer sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* HandlePropertyChange is called from backend, to indicate a change in property
diff --git a/plugins/sensors/symbian/orientationsym.cpp b/plugins/sensors/symbian/orientationsym.cpp
index 4d1d1c3cab..778b0a8d93 100644
--- a/plugins/sensors/symbian/orientationsym.cpp
+++ b/plugins/sensors/symbian/orientationsym.cpp
@@ -80,19 +80,20 @@ COrientationSensorSym::COrientationSensorSym(QSensor *sensor):CSensorBackendSym(
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle orientation sensor specific
* reading data and provides conversion and utility code
*/
-void COrientationSensorSym::RecvData(CSensrvChannel &aChannel)
+void COrientationSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvOrientationData> orientationpkg( iData );
- TInt ret = aChannel.GetData( orientationpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvOrientationData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
//Mapping device orientation enum values to Qt Orientation enum values
@@ -150,6 +151,8 @@ void COrientationSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/orientationsym.h b/plugins/sensors/symbian/orientationsym.h
index 67b54b6d7b..10c7a809c8 100644
--- a/plugins/sensors/symbian/orientationsym.h
+++ b/plugins/sensors/symbian/orientationsym.h
@@ -77,11 +77,11 @@ private:
COrientationSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle orientation sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/proximitysensorsym.cpp b/plugins/sensors/symbian/proximitysensorsym.cpp
index 01299235e8..0b252318dc 100644
--- a/plugins/sensors/symbian/proximitysensorsym.cpp
+++ b/plugins/sensors/symbian/proximitysensorsym.cpp
@@ -80,19 +80,20 @@ CProximitySensorSym::CProximitySensorSym(QSensor *sensor):CSensorBackendSym(sens
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle proximity sensor specific
* reading data and provides conversion and utility code
*/
-void CProximitySensorSym::RecvData(CSensrvChannel &aChannel)
+void CProximitySensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvProximityData> proxpkg( iData );
- TInt ret = aChannel.GetData( proxpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvProximityData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
iReading.setClose(iData.iProximityState == TSensrvProximityData::EProximityDiscernible);
@@ -100,6 +101,8 @@ void CProximitySensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/proximitysensorsym.h b/plugins/sensors/symbian/proximitysensorsym.h
index 9deef2cf22..44fedae512 100644
--- a/plugins/sensors/symbian/proximitysensorsym.h
+++ b/plugins/sensors/symbian/proximitysensorsym.h
@@ -77,11 +77,11 @@ private:
CProximitySensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle proximity sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/rotationsensorsym.cpp b/plugins/sensors/symbian/rotationsensorsym.cpp
index 027d2a9b0e..81c0d07f77 100644
--- a/plugins/sensors/symbian/rotationsensorsym.cpp
+++ b/plugins/sensors/symbian/rotationsensorsym.cpp
@@ -41,7 +41,6 @@
// Internal Headers
#include "rotationsensorsym.h"
-
#include <sensrvgeneralproperties.h>
/**
@@ -85,19 +84,20 @@ CRotationSensorSym::CRotationSensorSym(QSensor *sensor):CSensorBackendSym(sensor
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle rotation sensor specific
* reading data and provides conversion and utility code
*/
-void CRotationSensorSym::RecvData(CSensrvChannel &aChannel)
+void CRotationSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvRotationData> rotationpkg( iData );
- TInt ret = aChannel.GetData( rotationpkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvRotationData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
// To Do verify with ds and ramsay
@@ -150,6 +150,8 @@ void CRotationSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/rotationsensorsym.h b/plugins/sensors/symbian/rotationsensorsym.h
index cacb3f8771..641b0fa909 100644
--- a/plugins/sensors/symbian/rotationsensorsym.h
+++ b/plugins/sensors/symbian/rotationsensorsym.h
@@ -77,11 +77,11 @@ private:
CRotationSensorSym(QSensor *sensor);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle rotation sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* Second phase constructor
diff --git a/plugins/sensors/symbian/sensorbackendsym.cpp b/plugins/sensors/symbian/sensorbackendsym.cpp
index 97959dbb67..311c8cde41 100644
--- a/plugins/sensors/symbian/sensorbackendsym.cpp
+++ b/plugins/sensors/symbian/sensorbackendsym.cpp
@@ -40,13 +40,12 @@
****************************************************************************/
// Internal Includes
#include "sensorbackendsym.h"
-
#include <sensrvgeneralproperties.h>
#include <e32math.h>
// Constants
const TInt KDesiredReadingCount = 1;
-const TInt KMaximumReadingCount = 1;
+const TInt KMaximumReadingCount = 100;
const TInt KDefaultBufferingPeriod = 0;
const TInt KAccuracyInvalid = -1;
@@ -631,18 +630,6 @@ void CSensorBackendSym::stop()
//Derived From MSensrvDataListener
-/*
- * DataReceived is called by the Sensor Server when ever data is available in the
- * sensor buffer
- */
-void CSensorBackendSym::DataReceived(CSensrvChannel &aChannel, TInt /*aCount*/, TInt /*aDataLost*/)
- {
- // Retrieve the data from sensor buffer
- RecvData(aChannel);
- // Notify that a reading is available
- newReadingAvailable();
- }
-
/**
* DataError is called to indicate an error, fatal errors are inrecoverable
*/
diff --git a/plugins/sensors/symbian/sensorbackendsym.h b/plugins/sensors/symbian/sensorbackendsym.h
index f74892b754..92c26bf6ae 100644
--- a/plugins/sensors/symbian/sensorbackendsym.h
+++ b/plugins/sensors/symbian/sensorbackendsym.h
@@ -89,7 +89,7 @@ class CSensorBackendSym : public CBase, public QSensorBackend, public MSensrvDat
* DataReceived is called by the Sensor Server when ever data is available in the
* sensor buffer
*/
- void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
+ //void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt aDataLost);
/**
* DataError is called to indicate an error, fatal errors are unrecoverable
@@ -142,13 +142,6 @@ class CSensorBackendSym : public CBase, public QSensorBackend, public MSensrvDat
virtual void HandlePropertyChange(CSensrvChannel &aChannel, const TSensrvProperty &aChangedProperty);
/*
- * RecvData is used to retrieve the sensor reading from sensor server
- * It is implemented the the sensor concrete class and handles sensor specific
- * reading data and provides conversion and utility code
- */
- virtual void RecvData(CSensrvChannel &aChannel) = 0;
-
- /*
* InitializeL is used to create and init the sensor server objects
*/
void InitializeL();
diff --git a/plugins/sensors/symbian/tapsensorsym.cpp b/plugins/sensors/symbian/tapsensorsym.cpp
index e7634aea36..ddac9f455a 100644
--- a/plugins/sensors/symbian/tapsensorsym.cpp
+++ b/plugins/sensors/symbian/tapsensorsym.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "tapsensorsym.h"
+
/**
* set the id of the Tap sensor
*/
@@ -76,19 +77,20 @@ CTapSensorSym::CTapSensorSym(QSensor *sensor):CSensorBackendSym(sensor)
iBackendData.iSensorType = KSensrvChannelTypeIdAccelerometerDoubleTappingData;
}
/*
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle tap sensor specific
* reading data and provides conversion and utility code
*/
-void CTapSensorSym::RecvData(CSensrvChannel &aChannel)
+void CTapSensorSym::DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/)
{
- TPckg<TSensrvTappingData> tappkg( iData );
- TInt ret = aChannel.GetData( tappkg );
- if(KErrNone != ret)
+ for (int i = 0; i < aCount; i++)
{
- // If there is no reading available, return without setting
- return;
+ TPckg<TSensrvTappingData> pkg( iData );
+ TInt ret = aChannel.GetData( pkg );
+ if (ret != KErrNone)
+ return;
}
+
// Get a lock on the reading data
iBackendData.iReadingLock.Wait();
//Mapping device tap sensor enum values to Qt tap sensor enum values
@@ -159,6 +161,8 @@ void CTapSensorSym::RecvData(CSensrvChannel &aChannel)
iReading.setTimestamp(iData.iTimeStamp.Int64());
// Release the lock
iBackendData.iReadingLock.Signal();
+ // Notify that a reading is available
+ newReadingAvailable();
}
/**
diff --git a/plugins/sensors/symbian/tapsensorsym.h b/plugins/sensors/symbian/tapsensorsym.h
index 50f39c720c..aaedd172a8 100644
--- a/plugins/sensors/symbian/tapsensorsym.h
+++ b/plugins/sensors/symbian/tapsensorsym.h
@@ -75,11 +75,11 @@ private:
*/
CTapSensorSym(QSensor *sensor);
/**
- * RecvData is used to retrieve the sensor reading from sensor server
+ * DataReceived is used to retrieve the sensor reading from sensor server
* It is implemented here to handle tap sensor specific
* reading data and provides conversion and utility code
*/
- void RecvData(CSensrvChannel &aChannel);
+ void DataReceived(CSensrvChannel &aChannel, TInt aCount, TInt /*aDataLost*/);
/**
* Second phase constructor
* Initialize the backend resources