#========================================================================= 
#          Copyright © 2001-2004 QUALCOMM Incorporated.
#                     All Rights Reserved.
#========================================================================= 

# A very simple Perl5 script for Grinder
#! /usr/local/bin/perl -w 

#Please keep these two lines in all the sample scripts that you are writing for this version of Grinder
use GrinderPl;
use enum qw( AVK_ASTERISK=1000 AVK_NUMBER_SIGN AVK_SELECT AVK_UP AVK_DOWN AVK_LEFT AVK_RIGHT AVK_SEND AVK_CLR AVK_END);
################################################################################################

################################################################################################
#
# A Grinder perl application to configure Shaker on the phone.
#
#	1) It initializes the perl module.
#	2) Loads the default settings.
#	3) Initializes the phone.
#	4) Starts the Shaker.
#	5) Starts the BREW applet.
#	6) Sends the BREW events.
#	7) Releases the Shaker and closes it.
#	8) Releases the perl module.
#
################################################################################################

#Initialize the perl module. This should be the first function to be called.
GrinderPl::InitPerlModule();

#Load the default settings. 
GrinderPl::LoadSettings(0);

if(GrinderPl::InitDevice("COM1")) {

	$i = 0x1009012;	# Id of Applet to be started

	#Start configuring shaker
	if (GrinderPl::StartShaker())  {

		#Start BREW applet
		GrinderPl::StartApplet($i);

		# Send BREW event EVT_COMMAND (= 0x200)
		GrinderPl::SendBrewEvent(0x200, 102, 0);

		#End Shaker configuration
		GrinderPl::ReleaseShaker();	
	
		#Stop Shaker
		GrinderPl::CloseShaker();

	}
}
GrinderPl::ReleasePerlModule();