是否有关于adb的接口文档(adbwinapi.dll和adbwinusbapi.dll)? [英] Is there an interface document about adb(adbwinapi.dll and adbwinusbapi.dll)?
问题描述
我想在我的c ++项目中以编程方式使用adb。我已经从google网站上下载了源代码,但是没有关于如何在c或c ++的windows上构建和使用它的文档。我不想使用它使用shell或命令行。例如,我只想用我的c ++代码实现adb devices功能,那么我该怎么办呢?
我尝试了什么:
下载src代码,尝试将其称为动态,几乎没有关于如何将其与c ++一起使用的文档。
据我所知,您希望从您的应用程序中执行命令,如ADB命令行客户端。
然后,我将查看ADB客户端源,以了解它如何与服务器后台进程通信。连同 GitHub - cstyan / adbDocumentation:更好的ADB协议文档,特别是USB用途。 [ ^ ]你应该可以沟通。
换句话说:
只需在项目中使用ADB客户端源,而不使用main()
函数实现,并按以下方式调用函数main
。
adb devices示例:
clinet/main.cpp [ ^ ]
返回adb_commandline(argc - 1,const_cast< const char **>(argv + 1));
commandline.cpp [ ^ ]
if(!strcmp(argv [0],devices)){
const char * listopt;
if(argc< 2){
listopt =;
}否则if(argc == 2&&!strcmp(argv [1], - l)){
listopt = argv [1];
} else {
fprintf(stderr,用法:adb devices [-l] \ n);
返回1;
}
std :: string query = android :: base :: StringPrintf(host:%s%s,argv [0],listopt);
printf(附加设备列表\ n);
返回adb_query_command(查询);
}
如您所见,它构建了一个查询字符串并调用adb_query_command
。
I want use adb programmatically in my c++ project.I've downloaded the source code from google's website,but there is no document about how to built and use it on windows with c or c++.I don't want to use it with shell or commandline.For example,I just want implemnt the "adb devices" function with my c++ code,so what should I do about it?
What I have tried:
download src code,try to call it dynamic,There is almost no document about how to use it with c++.
As far as I understand you want to execute commands from within your app like the ADB command line client.
Then I would have a look at the ADB client sources to see how that communicates with the server background process. Together with the GitHub - cstyan/adbDocumentation: Better documentation of the ADB protocol, specifically for USB uses.[^] you should be able to communicate.
In other words:
Just use the ADB client sources in your project without themain()
function implementation and call the functions as done bymain
.
Example for "adb devices":
clinet/main.cpp[^]
return adb_commandline(argc - 1, const_cast<const char**>(argv + 1));if (!strcmp(argv[0], "devices")) { const char *listopt; if (argc < 2) { listopt = ""; } else if (argc == 2 && !strcmp(argv[1], "-l")) { listopt = argv[1]; } else { fprintf(stderr, "Usage: adb devices [-l]\n"); return 1; } std::string query = android::base::StringPrintf("host:%s%s", argv[0], listopt); printf("List of devices attached\n"); return adb_query_command(query); }
As you can see it builds a query string and callsadb_query_command
.
这篇关于是否有关于adb的接口文档(adbwinapi.dll和adbwinusbapi.dll)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!