从PC到Android手机发送指令 - 通过物理连接(USB,串口等)串口、指令、物理、手机

由网友(坐在情敌坟头唱忐忑)分享简介:我工作的一个项目自动执行某些任务(如播放一首歌曲,播放视频,蓝牙接收数据等)从PC上的Andr​​oid手机。I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth da...

我工作的一个项目自动执行某些任务(如播放一首歌曲,播放视频,蓝牙接收数据等)从PC上的Andr​​oid手机。

I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.

基本上PC将发送一个通知到手机,并在手机上的应用程序或东西然后将处理通知,做'东西'。这真的是相反的: HTTP://$c$c.google.com/p/android-notifier/

Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really: http://code.google.com/p/android-notifier/

我已经看到了一些例子来说明如何将命令发送到通过网络连接一个Android应用程序监听器或服务,但在这种情况下,我宁愿传输是通过物理连接。

I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.

USB 理想情况下,我想的连接是通过USB端口。但我已经看到了一些网上的帖子这表明,SDK本身并不支持这一点。 (Android应用,通信与插入USB端口的设备)。

USB Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).

有一些其他的SDK / API在那里,使这更容易? 在我所见过的亚行一些职位,但真的不明白...将这项工作? (http://developer.android.com/guide/developing/tools/adb.html) Is there some other SDK/API out there that makes this easier? I've seen some posts on the ADB, but don't really get it... Would that work? (http://developer.android.com/guide/developing/tools/adb.html)

的Serial over USB 我也看到了一些网站,展示如何使用breakoutbox进行双向串行通信,而只与G1。这可能与较新的手机?

Serial over USB I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?

电话 我愿意接受任何真正的新望的手机。我目前在看的Galaxy S,是因为它具有视频输出,通过耳机插孔。我打开如果需要的话生根。

The Phone I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.

推荐答案

实现一个HTTP在你的应用服务器,然后把你的手机在USB系绳模式。这将创建你的手机与PC之间的本地网络。然后,您应该能够发送HTTP请求,或创建一个使用手机的IP的WebSockets。

Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.

编辑:我测试了它,和它的作品,请参见这里

EDIT : I tested it, and it works, see here

阅读全文

相关推荐

最新文章