在 Android 手机上从外部设备获取二进制数据

发布于 2024-09-08 21:53:25 字数 453 浏览 1 评论 0原文

我正在寻找一些关于如何解决我遇到的问题的意见。我们有一个设备,它需要通过以太网发送二进制数据(它们主要只是符号,但采用自定义二进制格式)。我需要在手机上拦截这些数据并在谷歌地图上显示符号。我只是想知道解决这个问题的最佳方法,我有一些想法,但不确定它们是否可能或可行:

  1. 如果设备正在运行某种服务器,手机是否可以直接连接到设备然后轮询新数据?如果是这样,需要什么协议才能像这样直接连接?
  2. 也许修改设备软件以将数据以 SMS 数据消息格式发送到手机?我不确定软件是否可以在手机本身不是手机的情况下“欺骗”短信?
  3. 设备软件是否将其所有二进制数据上传到位于某处的 ftp/http 服务器,是否让手机连接到该服务器并定期轮询新数据?

我是 Android 开发的新手,基本上我想做的就是从手机上的设备获取这个二进制数据,并通过谷歌地图解析/显示它。这些想法听起来怎么样,或者是否有我忽略的更简单的方法?谢谢!

I'm looking for some input on how to go about a problem I have. We have a device that has binary data that it needs to send out (they are mainly just symbols, but in a custom binary format) over ethernet. I need to intercept this data on the phone and display the symbols over google maps. I'm just wondering the best way to go about this, I have a few ideas but am not sure if they are possible or feasable:

  1. Is it possible for the phone to connect directly to the device if the device had some sort of server running on it, then poll for new data? If so, what is the protocol needed to be able to direct connect like that?
  2. Perhaps modify the device software to send data to the phone(s) in SMS data message format? Im not sure if it is possible for software to "spoof" an SMS to a phone when it is not a phone itself?
  3. Have the device software upload all its binary data to a ftp/http server that is sitting out there somewhere, have the phone(s) connect to that server and poll for new data periodically?

I'm brand new to android development, basically all I want to do is grab this binary data from the device on my phone and parse/display it over google maps. How do any of those ideas sound, or is there a much easier way I am overlooking? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何时共饮酒 2024-09-15 21:53:25

手机可以吗
直接连接到设备,如果
设备正在运行某种服务器
,然后轮询新数据?

可能,如果它们都在同一个 WiFi LAN 上。

如果是这样,需要什么协议
可以这样直接连接吗?

您必须询问您的设备的制造商。我们无从得知。

也许修改设备软件以
通过短信数据将数据发送到手机
消息格式?

如果是 GSM 手机或 CDMA 手机,也许这可行。

让设备软件上传所有
将其二进制数据传输到 ftp/http 服务器
就坐在某个地方,
将手机连接到该设备
服务器并轮询新数据
定期?

这具有通过 3G 与设备配合使用的优点,因为电话和设备不必位于同一网络上——它们只需能够访问该服务器即可。对于 Android 2.2,您还可以使用 C2DM 来让手机知道有数据被捡起。

Is it possible for the phone to
connect directly to the device if the
device had some sort of server running
on it, then poll for new data?

Possibly, if they are both on the same WiFi LAN.

If so, what is the protocol needed to
be able to direct connect like that?

You would have to ask the manufacturer of your device. We have no way to know.

Perhaps modify the device software to
send data to the phone(s) in SMS data
message format?

If it is a GSM phone or a CDMA phone, perhaps this would work.

Have the device software upload all
its binary data to a ftp/http server
that is sitting out there somewhere,
have the phone(s) connect to that
server and poll for new data
periodically?

This has the advantage of working with the device over 3G, as the phone and device do not have to be on the same network -- they both just have to be able to reach that server. With Android 2.2, you could also use C2DM to tickle the phone to let it know there is data to be picked up.

半岛未凉 2024-09-15 21:53:25

对于连接类型,您可以选择蓝牙、WiFi 或 GPRS/3G。最适合您的情况取决于设备与手机的距离以及它具有的连接功能。

您还必须决定如何启动连接 - 通过电话还是通过设备。 Android 手机上的服务器唯一可靠的选择是蓝牙。 Wifi 限制打开服务器套接字,而 GPRS/3G 则取决于运营商。如果设备运行服务器,如果它位于 LAN 或 Internet 上,您可以通过 WiFi 访问它;对于 GPRS/3G,它必须位于 Internet 上。

一旦你选择了这些东西,你就可以选择协议,但在那个阶段要找到答案还有很长的路要走。

For connection type, you can choose between Bluetooth, WiFi or GPRS/3G. What's best for your case depends on how close is the device to the phone and what connection capabilities it have.

You must also decide how connection will be initiated - by phone or by device. The only reliable option for a server on the Android phone is Bluetooth. Wifi is restricted for opening server sockets, and GPRS/3G is carrier dependent. If the device runs a server, you can access it via WiFi if it's on the LAN or Internet, for GPRS/3G it has to be on Internet.

Once you choose these things, you're left with the choice for protocol, but it's a long way to it for an answer at that stage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文