您的位置:首页 > 其它

《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之92——BREW中的Perl 接口使用

2010-11-30 15:17 441 查看
BREW 中提供了Perl 接口库,开发者可以通过Perl接口编写脚本,来实现批处理命令的自动化执行。其中的API 列表包括:
•连接和控制目标手机
u ConnecttoDevice(char* portName, char* dllName)
u PutDeviceOffline(int)
u ResetDevice()
•复制文件和目录
u CopyFileToDevice(char* src, char* dest, bool overwrite)
u CopyFileFromDevice(char* src, char* dest)
u CopyDirDevice(const char* pPCDirName, const char* pDeviceDirName)
•记录手机的日志信息
u SetLogMask(char* logMask)
u SetLogDuration(unsigned long x)
u StartLogger()
•模拟手机的按键事件
u StartGrinder(char* targetName)
u SetEventInterval(long lEventsInterval)
u SendKeys(int count, char **eventCodes)
下面是Grinder与BTIL结合使用的脚本示例。
use GrinderPl;
use enum qw( ***K_ASTERISK=1000 ***K_NUMBER_SIGN ***K_SELECT ***K_UP ***K_DOWN ***K_LEFT ***K_RIGHT ***K_SEND ***K_CLR ***K_END);
use enum qw( NORMAL=0 NO_VOICE_CALL AFTER_VOICE_CALL CONFIG_SCREEN=4 HIDDEN_CONFIG=8 FORCE_UNIQUE=32 SCR_S***ER=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 should 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();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐