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

# Perl5 script for testing simple example
#! /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 illustrate the sending of keys on the phone
#
#	1) It initializes the perl module.
#	2) Loads the default settings.
#	3) Loads the device keymap file.
#	4) Initializes the phone through COM1.
#	5) Sends keys to the phone.
#	6) Later, it 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);

#Set keymapfile to the device keymap file
$keymapfile = "c:\\keymaps\\key1.ini";
GrinderPl::LoadDeviceConfigFile($keymapfile);

#Initialize the device
if(GrinderPl::InitDevice("COM1")) {

	#Send individual keys
	GrinderPl::SendKey('a');
	GrinderPl::SendKey('5');
	GrinderPl::SendKey(AVK_SELECT);

	#Send overlapped keys
	@str_arr1 = ("1", "2" ,"3");
	GrinderPl::SendKeys(3, @str_arr1);
}

#Release the perl module. This should be called after using GrinderPl.
GrinderPl::ReleasePerlModule();