androidadb实现解析Word格式.docx

上传人:b****2 文档编号:15352192 上传时间:2022-10-29 格式:DOCX 页数:8 大小:21.27KB
下载 相关 举报
androidadb实现解析Word格式.docx_第1页
第1页 / 共8页
androidadb实现解析Word格式.docx_第2页
第2页 / 共8页
androidadb实现解析Word格式.docx_第3页
第3页 / 共8页
androidadb实现解析Word格式.docx_第4页
第4页 / 共8页
androidadb实现解析Word格式.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

androidadb实现解析Word格式.docx

《androidadb实现解析Word格式.docx》由会员分享,可在线阅读,更多相关《androidadb实现解析Word格式.docx(8页珍藏版)》请在冰豆网上搜索。

androidadb实现解析Word格式.docx

adb.c的main函数是adbclient、adbservice、adbdaemon的共同入口,

[cpp]viewplaincopyintmain(intargc,char**argv){#ifADB_HOSTadb_sysdeps_init();

adb_trace_init();

D("

Handlingcommandline()\n"

);

returnadb_commandline(argc-1,argv+1);

#else/*Ifadbdrunsinsidetheemulatorthiswillenableadbtracingvia*adb-debugqemudserviceintheemulator.*/adb_qemu_trace_init();

if((argc&

gt;

1)&

amp;

&

(!

strcmp(argv[1],"

recovery"

))){adb_device_banner="

;

recovery_mode=1;

}start_device_log();

Handlingmain()\n"

returnadb_main(0,DEFAULT_ADB_PORT);

#endif}

根据Android.mk中传入的ADB_HOST确定编译的是adbclient\adbservice,或者是adbdaemon,ADB_HOST为1时编译adbclient\adbservice的代码,ADB_HOST为0时编译adbdaemon的代码。

以上代码中,adbclient\adbservice端代码如下,

[cpp]viewplaincopyadb_sysdeps_init();

1、adb_sysdeps_init():

adbclient\adbservice适用于linux和windows版本,所以代码中有平台相关的部分。

2、adb_trace_init():

初始化log输出配置,初始化后在HOST上设置ADB_TRACE这个环境变量,可以控制client\service端的log输出等级,

配置为1或者all的话,将输出所有的log。

3、adb_commandline():

关键函数,代码如下。

[cpp]viewplaincopyintadb_commandline(intargc,char**argv){charbuf[4096];

intno_daemon=0;

intis_daemon=0;

intis_server=0;

intpersist=0;

intr;

intquote;

transport_typettype=kTransportAny;

char*serial=NULL;

char*server_port_str=NULL;

/*Ifdefined,thisshouldbeanabsolutepathto*thedirectorycontainingallofthevarioussystemimages*foraparticularproduct.Ifnotdefined,andtheadb*commandrequiresthisinformation,thentheusermust*specifythepathusing"

-p"

.*/gProductOutPath=getenv("

ANDROID_PRODUCT_OUT"

if(gProductOutPath==NULL||gProductOutPath[0]=='

\0'

){gProductOutPath=NULL;

}//TODO:

alsotryTARGET_PRODUCT/TARGET_DEVICEasahintserial=getenv("

ANDROID_SERIAL"

/*Validateandassigntheserverport*/server_port_str=getenv("

ANDROID_ADB_SERVER_PORT"

intserver_port=DEFAULT_ADB_PORT;

if(server_port_str&

strlen(server_port_str)&

0){server_port=(int)strtol(server_port_str,NULL,0);

if(server_port&

lt;

=0||server_port&

65535){fprintf(stderr,"

adb:

EnvvarANDROID_ADB_SERVER_PORTmustbeapositivenumberlessthan65535.Got\"

%s\"

\n"

server_port_str);

returnusage();

}}/*modifiersandflags*/while(argc&

0){if(!

strcmp(argv[0],"

server"

)){is_server=1;

}elseif(!

nodaemon"

)){no_daemon=1;

}elseif(!

strcmp(argv[0],"

fork-server"

)){/*thisisaspecialflagusedonlywhentheADBclientlaunchestheADBServer*/is_daemon=1;

persist"

)){persist=1;

strncmp(argv[0],"

2)){constchar*product=NULL;

if(argv[0][2]=='

){if(argc&

2)returnusage();

product=argv[1];

argc--;

argv++;

}else{product=argv[0]+2;

}gProductOutPath=find_product_out_path(product);

if(gProductOutPath==NULL){fprintf(stderr,"

couldnotresolve\"

-p%s\"

product);

}}elseif(argv[0][0]=='

-'

&

argv[0][1]=='

s'

){if(isdigit(argv[0][2])){serial=argv[0]+2;

}else{if(argc&

2||argv[0][2]!

='

)returnusage();

serial=argv[1];

}}elseif(!

-d"

)){ttype=kTransportUsb;

-e"

)){ttype=kTransportLocal;

-a"

)){gListenAll=1;

-H"

2)){constchar*hostname=NULL;

hostname=argv[1];

}else{hostname=argv[0]+2;

}adb_set_tcp_name(hostname);

-P"

2)){if(argv[0][2]=='

server_port_str=argv[1];

}else{server_port_str=argv[0]+2;

}if(strlen(server_port_str)&

portnumbermustbeapositivenumberlessthan65536.Got\"

}}else{fprintf(stderr,"

portnumbermustbeapositivenumberlessthan65536.Gotemptystring.\n"

}}else{/*outofrecognizedmodifiersandflags*/break;

}argc--;

}adb_set_transport(ttype,serial);

adb_set_tcp_specifics(server_port);

if(is_server){if(no_daemon||is_daemon){r=adb_main(is_daemon,server_port);

}else{r=launch_server(server_port);

}if(r){fprintf(st

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 兵器核科学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1