Brew provides a Perl interface library. developers can write scripts through the Perl interface to automate the execution of batch processing commands. The API list includes:
• Connect and control the target mobile phone
U connecttodevice (char * portname, char * dllname)
U putdeviceoffline (INT)
U resetdevice ()
• Copy files and directories
U copyfiletodevice (char * SRC, char * DEST, bool overwrite)
U copyfilefromdevice (char * SRC, char * DEST)
U copydirdevice (const char * ppcdirname, const char * pdevicedirname)
• Record mobile phone log information
U setlogmask (char * logmask)
U setlogduration (unsigned long X)
U startlogger ()
• Simulate mobile phone button events
U startgrinder (char * targetname)
U seteventinterval (long leventsinterval)
U sendkeys (INT count, char ** eventcodes)
The following is a script example used by grinder and btil.
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 );
Use Enum QW (normal = 0 no_voice_call after_voice_call config_screen = 4 hidden_config = 8 force_unique = 32 scr_saver = 64 background = 160 );
#
# 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 brew applet with flag to start it in background.
#5) releases the Perl module.
#
# Initialize the Perl module. This shoshould be the first function to be called.
Grinderpl: initperlmodule ();
# Load the default settings.
Grinderpl: loadsettings (0 );
If (grinderpl: initdeviceex ("COM1", "btiloem. dll ")){
$ I = 0x12345678; # ID of Applet to be started
Grinderpl: btilstartapplet ($ I, background );
}
Grinderpl: releaseperlmodule ();