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

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)

下面是GrinderBTIL结合使用的脚本示例。

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 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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值