diff -r bd7a2b98ea78 -r 5a72e60dea8b org.symbian.tools.wrttools/plugin.xml --- a/org.symbian.tools.wrttools/plugin.xml Thu Jun 17 17:19:01 2010 -0700 +++ b/org.symbian.tools.wrttools/plugin.xml Thu Jun 17 17:36:55 2010 -0700 @@ -969,40 +969,12 @@ - -// This function can be passed as callback to -// sensors.ISensor.RegisterForNotification method -function sensorCallback(transactionId, code, result) { - if (result.ErrorCode == 0) { - // TODO Process notification - var dataType = result.ReturnValue.DataType; // One of: "AxisData", "DoubleTappingData", "OrientationData" or "RotationData" - // var xAxis = result.ReturnValue.XAxisData; // Accelerometer - // var yAxis = result.ReturnValue.YAxisData; // Accelerometer - // var zAxis = result.ReturnValue.ZAxisData; // Accelerometer - // var direction = result.ReturnValue.DeviceDirection; // Accelerometer double tapping - // var orientation = result.ReturnValue.DeviceOrientation; // Orientation - // var xRotation = result.ReturnValue.XRotation; // Rotation - // var yRotation = result.ReturnValue.YRotation; // Rotation - // var zRotation = result.ReturnValue.ZRotation; // Rotation - } else { - var errorCode = result.ErrorCode; - var errorMessage = result.ErrorMessage; - // TODO Handle error - } -} - - - // Call this function to add a callback that will be notified of orientation changes -function watchSensorNotifications(sensorCallback) { +function watchSensorNotifications() { var sensors = device.getServiceObject("Service.Sensor", "ISensor"); var SensorParams = { SearchCriterion : "Orientation" // TODO Possible values (one of): @@ -1019,7 +991,7 @@ // TODO Handle error return null; } - // TODO Function named "orientationCallback" will be called when device orientation changes. This function should be created. + // TODO Function named "sensorCallback" will be called when device orientation changes. This function should be created. var result2 = sensors.ISensor.RegisterForNotification( { ChannelInfoMap : result.ReturnValue[0], ListeningType : "ChannelData" }, sensorCallback); @@ -1034,6 +1006,28 @@ return null; } } + +// This function can be passed as callback to +// sensors.ISensor.RegisterForNotification method +function sensorCallback(transactionId, code, result) { + if (result.ErrorCode == 0) { + // TODO Process notification + var dataType = result.ReturnValue.DataType; // One of: "AxisData", "DoubleTappingData", "OrientationData" or "RotationData" + var orientation = result.ReturnValue.DeviceOrientation; // Orientation + // var xAxis = result.ReturnValue.XAxisData; // Accelerometer + // var yAxis = result.ReturnValue.YAxisData; // Accelerometer + // var zAxis = result.ReturnValue.ZAxisData; // Accelerometer + // var direction = result.ReturnValue.DeviceDirection; // Accelerometer double tapping + // var xRotation = result.ReturnValue.XRotation; // Rotation + // var yRotation = result.ReturnValue.YRotation; // Rotation + // var zRotation = result.ReturnValue.ZRotation; // Rotation + } else { + var errorCode = result.ErrorCode; + var errorMessage = result.ErrorMessage; + // TODO Handle error + } +} +