org.symbian.tools.wrttools.previewer/preview/script/lib/sapi/Sensor.js
author Eugene Ostroukhov <eugeneo@symbian.org>
Wed, 19 May 2010 17:17:31 -0700
changeset 337 afe6a53c0ed4
parent 334 915daddff233
child 402 f943a50b6689
permissions -rw-r--r--
Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     1
/**
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     2
 * Copyright (c) 2009-2010 Symbian Foundation and/or its subsidiary(-ies).
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     3
 * All rights reserved.
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     4
 * This component and the accompanying materials are made available
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     6
 * which accompanies this distribution, and is available
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     8
 *
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
     9
 * Initial Contributors:
273
b1f63c2c240c Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 210
diff changeset
    10
 * Nokia Corporation - initial contribution.
b1f63c2c240c Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 210
diff changeset
    11
 * 
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
    12
 * Contributors:
273
b1f63c2c240c Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 210
diff changeset
    13
 * 
b1f63c2c240c Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 210
diff changeset
    14
 * Description:
b1f63c2c240c Bug 2072 - Update .js files with EPL
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 210
diff changeset
    15
 * 
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
    16
 */
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
    17
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    18
/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    19
 * Sensor.js
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    20
 * 
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
    21
 * Web Runtime Service API emulation 
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    22
 * WRT v1.1
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    23
 * 
210
0f7abfd6ae62 Fixed bug 2072: update .js files with EPL
tasneems@symbian.org
parents: 37
diff changeset
    24
 */
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    25
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    26
(function(){
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    27
	var CHANNEL_ACCEL = 7;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    28
	var CHANNEL_ACCELDT = 8;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    29
	var CHANNEL_ORIENTATION = 10;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    30
	var CHANNEL_ROTATION = 11;
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    31
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    32
	var transactionToCallback = new Object();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    33
	var nextTransactionId = 2123148; // Random seed number! (Actual number doesn't matter)
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    34
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    35
	var AccelerometerAxis			= new Array();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    36
	var AccelerometerDoubleTapping	= new Array();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    37
	var Orientation					= new Array();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    38
	var Rotation					= new Array();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    39
	var xyOrientation = 0;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    40
	var zOrientation = 0;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    41
	
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    42
	var provider = 'Service.Sensor',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    43
		Interface = 'ISensor';
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    44
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    45
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    46
	 * Sensor service
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    47
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    48
	var SensorService = function(){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    49
		this.FindSensorChannel 			= __FindSensorChannel;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    50
		this.RegisterForNotification	= __RegisterForNotification;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    51
		this.Cancel						= __Cancel;
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    52
		this.GetChannelProperty			= __GetChannelProperty;
334
915daddff233 JS cleanup to make it more compatible with JSDT
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 333
diff changeset
    53
	};
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    54
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    55
	device.implementation.extend(provider, Interface, new SensorService() );
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    56
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    57
	/******************************************************/	
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    58
	/******************************************************/	
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    59
	/******************************************************/	
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    60
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    61
	var	context = device.implementation.context,
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    62
		_t = context._t,
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    63
		method = '',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    64
		result = false,
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    65
		DBase = null;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    66
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    67
	device.implementation.setOrientation = function(xy, z) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    68
		xyOrientation = xy;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    69
		zOrientation = z;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    70
		
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    71
		for (var i = 0; i < Orientation.length; i++) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    72
			notifyOrientationChangeListener(Orientation[i]);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    73
		}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    74
	};
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
    75
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    76
	function notifyOrientationChangeListener(callback) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    77
		var orientation;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    78
		if (xyOrientation > -45 && xyOrientation <= 45) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    79
			orientation = "DisplayUp";
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    80
		} else if (xyOrientation > 45 && xyOrientation <= 135) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    81
			orientation = "DisplayLeftUp";
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    82
		} else if (xyOrientation > 135 || xyOrientation <= -135) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    83
			orientation = "DisplayDown";
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    84
		} else if (xyOrientation > -135 && xyOrientation <= -45) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    85
			orientation = "DisplayRightUp";
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    86
		}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    87
		callback(getTransactionId(callback), 9, context.Result( {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    88
			DeviceOrientation : orientation
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    89
		}));
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    90
	}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    91
	
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    92
	function getTransactionId(callback) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    93
		for ( var tId in transactionToCallback) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    94
			if (transactionToCallback[tId] == callback) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    95
				return tId;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    96
			}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    97
		}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    98
	}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
    99
	
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   100
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   101
	 * Sensor: FindSensorChannel
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   102
	 * @param {Object} criteria
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   103
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   104
	function __FindSensorChannel(criteria){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   105
		method = 'FindSensorChannel';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   106
		if(!criteria)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   107
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgCriteriaMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   108
			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   109
		if(typeof criteria != 'object')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   110
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgCriteriaMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   111
						
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   112
		if(typeof criteria.SearchCriterion == 'undefined')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   113
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgDataMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   114
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   115
		if(typeof criteria.SearchCriterion != 'string')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   116
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgidInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   117
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   118
		if(!(criteria.SearchCriterion== "All" || criteria.SearchCriterion== "AccelerometerAxis" || criteria.SearchCriterion=="AccelerometerDoubleTapping" || criteria.SearchCriterion=="Orientation" || criteria.SearchCriterion=="Rotation"))
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   119
		 	return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgSearchParamInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   120
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   121
		if(arguments.length > 1)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   122
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgCriteriaMissing);			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   123
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   124
		DBase = context.getData(provider);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   125
		var returnValue;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   126
		returnValue = DBase[criteria.SearchCriterion] || [] ;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   127
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   128
		return context.Result(returnValue,0);			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   129
	}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   130
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   131
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   132
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   133
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   134
	 * Sensor: RegisterForNotification
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   135
	 * @param {Object} criteria, callback
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   136
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   137
	function __RegisterForNotification(criteria, callback, flag){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   138
		flag = flag || false;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   139
		method = 'RegisterForNotification';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   140
		context.notify(_t('%s:: RegisterForNotification not implemented in preview').arg(provider));
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   141
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   142
		if(arguments.length >2 && (typeof flag != "undefined" && typeof flag != "boolean"))
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   143
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgCriteriaMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   144
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   145
		if(typeof callback != 'function')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   146
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgInsufficentArgument);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   147
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   148
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   149
		if(!criteria)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   150
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   151
			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   152
		if(typeof criteria != 'object')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   153
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   154
						
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   155
		if(typeof criteria.ListeningType == 'undefined' || typeof criteria.ChannelInfoMap == 'undefined')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   156
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   157
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   158
		if(typeof criteria.ListeningType != 'string')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   159
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgListenTypeInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   160
			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   161
		if(typeof criteria.ChannelInfoMap != 'object')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   162
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgChannelInfoMapInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   163
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   164
		if(!(criteria.ListeningType== "ChannelData" ))
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   165
		 	return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgOutofRange);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   166
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   167
		if (typeof callback == 'function') {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   168
			var channels = criteria.ChannelInfoMap;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   169
			// for ( var channel in channels) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   170
			var notify = null;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   171
			switch (channels.ChannelId) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   172
			case CHANNEL_ACCEL:
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   173
				AccelerometerAxis.push(callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   174
				break;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   175
			case CHANNEL_ACCELDT:
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   176
				AccelerometerDoubleTapping.push(callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   177
				break;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   178
			case CHANNEL_ORIENTATION:
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   179
				Orientation.push(callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   180
				notify = notifyOrientationChangeListener;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   181
				break;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   182
			case CHANNEL_ROTATION:
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   183
				Rotation.push(callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   184
				break;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   185
			}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   186
			// }
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   187
			var tID = nextTransactionId++;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   188
			transactionToCallback[tID] = callback;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   189
			setTimeout(notify, 20, callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   190
//			var result = context.callAsync(this, arguments.callee, criteria, callback);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   191
			return context.AsyncResult(tID);
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   192
		}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   193
				
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   194
		return context.ErrorResult();
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   195
	}
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   196
	
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   197
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   198
	 * Sensor: Cancel
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   199
	 * @param {Object} criteria
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   200
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   201
	function __Cancel(criteria){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   202
		method = 'Cancel';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   203
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   204
		if(arguments.length > 1 && typeof criteria != "object" && typeof criteria.TransactionID != "number" && arguments[1])
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   205
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgCriteriaMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   206
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   207
		if (!criteria || typeof criteria.TransactionID == 'undefined') 
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   208
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgTransIDMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   209
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   210
		if (criteria.TransactionID == Infinity || criteria.TransactionID == -Infinity) 
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   211
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgTransIDMissing);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   212
		
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   213
		if (typeof criteria.TransactionID != 'number')
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   214
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgIncorrectTransID);
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   215
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   216
		var callback = transactionToCallback[criteria.TransactionID];
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   217
		if (typeof callback == 'function') {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   218
			removeCallback(callback, AccelerometerAxis);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   219
			removeCallback(callback, AccelerometerDoubleTapping);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   220
			removeCallback(callback, Orientation);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   221
			removeCallback(callback, Rotation);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   222
			return context.ErrorResult();
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   223
		}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   224
		return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT,
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   225
				msg.msgInvalidTransID);
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   226
	}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   227
337
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   228
	
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   229
	function removeCallback(callback, array) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   230
		var i = 0;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   231
		for (i = 0; i < array.length; i++) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   232
			var el = array[i];
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   233
			if (el == callback) {
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   234
				array.splice(i, 1);
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   235
				return;
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   236
			}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   237
		}
afe6a53c0ed4 Work-in-progress commit for orientation preview. API is emulated and basic work on previewer is implemented. Some display issues are remaining
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 334
diff changeset
   238
	}
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   239
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   240
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   241
	 * Sensor: GetChannelProperty
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   242
	 * @param {Object} criteria
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   243
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   244
	function __GetChannelProperty(criteria){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   245
		method = 'GetChannelProperty';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   246
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   247
		if(!criteria)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   248
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   249
			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   250
		if(typeof criteria != 'object')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   251
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   252
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   253
		if(typeof criteria.ChannelInfoMap == 'undefined' || typeof criteria.PropertyId == 'undefined')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   254
			return error(device.implementation.ERR_MISSING_ARGUMENT, msg.msgIncompleteInput);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   255
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   256
		if(typeof criteria.ChannelInfoMap != 'object')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   257
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgChannelInfoMapInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   258
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   259
		if(typeof criteria.PropertyId != 'string')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   260
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgInvalidPropertyID);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   261
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   262
		if(criteria.PropertyId != 'Availability' && criteria.PropertyId != "ChannelAccuracy" && criteria.PropertyId != "ChannelDataFormat" && criteria.PropertyId != "ChannelScale" && criteria.PropertyId != "ChannelUnit" && criteria.PropertyId != "ConnectionType" && criteria.PropertyId != "DataRate" && criteria.PropertyId != "Description" && criteria.PropertyId != "MeasureRange" && criteria.PropertyId != "ScaledRange" && criteria.PropertyId != "SensorModel")
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   263
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgInvalidPropertyID);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   264
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   265
		if(arguments.length > 1)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   266
			return error(device.implementation.ERR_INVALID_SERVICE_ARGUMENT, msg.msgCriteriaMissing);			
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   267
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   268
		DBase = context.getData(provider);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   269
		var property = DBase['SensorProperty'];
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   270
		if(typeof criteria.ChannelInfoMap['ChannelId'] == 'undefined' || typeof criteria.ChannelInfoMap['ChannelId'] != 'number')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   271
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgChannelInfoMapInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   272
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   273
		var channel = null;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   274
		if(criteria.ChannelInfoMap['ChannelId'] == 7)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   275
		{
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   276
			channel = 'AccelerometerAxis';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   277
		}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   278
		else if(criteria.ChannelInfoMap['ChannelId'] == 8)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   279
		{
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   280
			channel = 'AccelerometerDoubleTapping';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   281
		}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   282
		else if(criteria.ChannelInfoMap['ChannelId'] == 10)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   283
		{
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   284
			channel = 'Orientation';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   285
		}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   286
		else if(criteria.ChannelInfoMap['ChannelId'] == 11)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   287
		{
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   288
			channel = 'Rotation';
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   289
		}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   290
	
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   291
		if(channel == null)
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   292
			return error(device.implementation.ERR_BAD_ARGUMENT_TYPE, msg.msgChannelInfoMapInvalid);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   293
		
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   294
		var returnValue = property[channel][criteria.PropertyId];
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   295
		if(typeof returnValue == 'undefined')
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   296
			return context.ErrorResult(device.implementation.ERR_NOT_FOUND);
334
915daddff233 JS cleanup to make it more compatible with JSDT
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 333
diff changeset
   297
		return context.Result(returnValue,0);
37
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   298
	}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   299
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   300
	/**
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   301
	 * Sensor: error
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   302
	 * @param {number,string} ErrorCode and ErrorString
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   303
	 * Replaces Error String with method name
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   304
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   305
	function error(code, msg /*, args...*/){
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   306
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   307
		var args = ['Sensors',method].concat([].slice.call(arguments,2));
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   308
		msg = msg ? _t().arg.apply(msg,args) : undefined;
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   309
		return context.ErrorResult(code, msg);
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   310
	}
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   311
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   312
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   313
	/** 
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   314
	 * error messages
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   315
	 * order of %s args: Service name, method name, parameter name 
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   316
	 */
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   317
	var msg = {	
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   318
		msgInterfaceNotSupported 	: '%s:Requested interface not supported by the provider',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   319
		msgInterfaceMissing 		: '%s:Interface name missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   320
		msgInsufficentArgument 		: '%s:%s:Insufficent argument for asynchronous request',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   321
		msgListenTypeMissing 		: '%s:%s:Listening type missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   322
		msgListenTypeInvalid		: '%s:%s:Listening type is invalid',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   323
		msgChannelInfoMissing		: '%s:%s:ChannelInfoMap missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   324
		msgIncompleteInput			: '%s:%s:Incomplete input param list',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   325
		msgOutofRange				: '%s:%s:Listening type is out of allowed range',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   326
		msgCallbackMissing			: '%s:%s:Callback missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   327
		msgAlreadyRegistered		: '%s:%s:Notification is already registered on this channel',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   328
		msgCriteriaMissing			: '%s:%s:Search criterion is missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   329
		msgInvalidSearchCriteria	: '%s:%s:Invalid Search Criterion',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   330
		msgChannelSearchInvalid		: '%s:%s:Channel search param type invalid',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   331
		msgSearchParamInvalid		: '%s:%s:Invalid channel search param',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   332
		msgTransIDMissing			: '%s:%s:Transaction id is missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   333
		msgIncorrectTransID			: '%s:%s:Incorrect TransactionID',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   334
		msgInvalidTransID			: '%s:%s:Invalid TransactionID',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   335
		msgPropertyIDMissing		: '%s:%s:Property id missing',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   336
		msgInvalidPropertyID		: '%s:%s:Property id is invalid',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   337
		msgChannelNotSupported		: '%s:%s:Channel property not supported',
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   338
		msgChannelInfoMapInvalid	: '%s:%s:ChannelInfoMap Type Invalid'
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   339
	};
641b65b14318 Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff changeset
   340
333
895153411a80 Bug 2647 - phonegap example : storage preview support
Eugene Ostroukhov <eugeneo@symbian.org>
parents: 273
diff changeset
   341
}) ();