Originally Posted by pEEf:
I think this is a better way to do it:
[CODE] this.serviceRequest = new Mojo.Service.Request("palm://com.palm.vibrate", {
method: 'vibrate', parameters: { 'period': 0,'duration': 250 }
});
[/CODE]
This produces one quarter-second vibrate. (250ms)
You can use this to also make pulsed vibrates, setting period to 250 and duration to 2000 will make 4 short vibrates over a 2 second span. The Period param is a "no vibrate" period, so setting it to zero makes it continuous. Duration is the length of the cycle.
The crotest is some kind of a test mode I think, and not intended for normal use (so it may break in the future).
I agree, I got looking at some more code examples and have constructed a function to craft a custom vibrate, you can define the period aswell as the duration as function arguments, just call the function with the necessary values and you're good to go!
[CODE]
vibratorTurnOn: function(aPeriod, aDuration){
var request = new Mojo.Service.Request("palm://com.palm.vibrate", {
method: 'vibrate',
parameters: {
'period': aPeriod,
'duration': aDuration
},
onSuccess: function() {
QDLogger.log("Successfully initialized vibrator");
},
onFailure: function() {
QDLogger.log("Error initializing vibrator");
}
});
return request;
}
[/CODE]
pEEf, thanks for the suggestion, I had a suspicion that crotest is/will be unreliable for applications but for testing purposes I figured it would do fine.