/* Copyright 2009 Palm, Inc.  All rights reserved. */

var SystemService = Class.create({ 
	initialize: function() { 
	}
});


SystemService.identifier = 'palm://com.palm.systemservice';

SystemService.setRingtone = function(value,callback) {
	
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"ringtone":value}, 			
		});
	return request;
}

SystemService.getRingtone = function(callback) {
	
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["ringtone"],"subscribe":true}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.getSystemUISounds = function(callback) {
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["systemSounds"]}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.setSystemUISounds = function(value){
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"systemSounds":value}, 			
		});
	return request;
}

/*SystemService.getSystemUIAlerts = function(callback) {
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["uiNotifications"]}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.setSystemUIAlerts = function(value){
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"uiNotifications":value}, 			
		});
	return request;
}*/


/*SystemService.getUISounds = function(callback) {
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["uiSoundsWhenCharging"]}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.setUISounds = function(value){
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"uiSoundsWhenCharging":value}, 			
		});
	return request;
}*/

SystemService.getVibrateCharging = function(callback) {
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["vibrateWhenCharging"]}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.setVibrateCharging = function(value){
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"vibrateWhenCharging":value}, 			
		});
	return request;
}

SystemService.getSoundWhenOnCradle = function(callback) {
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["playSoundWhenCharging"]}, 
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.setSoundWhenOnCradle = function(value){
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"playSoundWhenCharging":value}, 			
		});
	return request;
}


SystemService.setSystemlockMode = function(mode,callback) {
	
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'setPreferences',
			parameters: {"lockmode":mode},  
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}

SystemService.getSystemlockMode = function(callback) {
	
	var request = new Mojo.Service.Request(SystemService.identifier, {
			method: 'getPreferences',
			parameters: {"keys":["lockmode"]},  
			onSuccess: callback,
			onFailure: callback
		});
	return request;
}