在 Android 上通过 RFCOMM 接收文件
有人知道如何通过 RFCOMM 在 android 上接收文件吗? 我是蓝牙问题的新手,所以请耐心等待。
我正在寻找一种通过 RFCOMM 作为流接收数据并将其存储在手机上的某个位置的方法。保存数据不是问题,它工作得很好。
主要问题是连接的实现和数据的可靠检索...
整个过程应该作为 android 服务来实现(以便在接收数据时不必启动任何活动)。您有何建议:本地服务还是远程服务?
问候, 波斯克伦
does someone know how to receive a file on android via RFCOMM?
I'm a newby to bluetooth issues, so please have patience with me.
I'm looking for an approach to receive data via RFCOMM as a stream and store it somewhere on my phone. Saving data is not the problem, it works quite fine.
The main issue is the implementation of the connection and the reliable retrieval of the data...
This whole procedure should be implemented as an android service (so that no activity has to be launched while receiving data). What would you suggest: Local or remote service?
greetz,
poeschlorn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说:
传输层是关键,也是棘手的部分。它可以像自己推出一样简单。例如:
发送者发送:
[直播开始] |文件名 |属性| [二进制数据] [流结束]
接收器查看文件名和属性,保存它们,然后打开输出文件并从属性之后开始写入到流的末尾。
传输完成后,关闭输入/输出流,然后关闭套接字。
In General:
The transport layer is the key, and the tricky part. It can be as simple as rolling your own. For example:
Sender sends:
[Start of stream] | FILENAME | ATTRIBUTES | [binary data] [End Of stream]
Receiver sees the file name and attributes, saves them, and opens up an output file and starts writing from after attributes, to the end of the stream.
After the transfer is complete, close the input/output streams, and then close the socket.