简体   繁体   English

如何通过2个连接的蓝牙设备发送数据

[英]How to send data over 2 connected Bluetooth devices

I am creating an application that uses the system Bluetooth manager to connect 2 devices. 我正在创建一个使用系统蓝牙管理器连接2个设备的应用程序。 Is it possible to send data programmatically through an app? 是否可以通过应用程序以编程方式发送数据? (I understand that you need to use a BluetoothSocket to get the input and output streams. How to I get the socket for the connected devices? ) (我知道您需要使用BluetoothSocket来获取输入和输出流。如何获取所连接设备的套接字?)

This sample project explains how to send data between 2 devices. 此示例项目说明了如何在2个设备之间发送数据。 If you examine BluetoothChatService class you will get all the details you need. 如果检查BluetoothChatService类,您将获得所需的所有详细信息。 It's not that hard. 没那么难。 Opening sockets and moving data from worker thread to UI is explained clearly. 清楚说明了打开套接字并将数据从工作线程移动到UI的过程。 ConnectedThread is sending data to UI thread ConnectedThread正在将数据发送到UI线程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM