标题: 怎么让手机蓝牙APP接收单片机的数据 [打印本页]

作者: qq1105424012    时间: 2017-12-29 10:06
标题: 怎么让手机蓝牙APP接收单片机的数据
本帖最后由 qq1105424012 于 2017-12-29 10:09 编辑

//数据接收&发送程序
    public class DataThread extends Thread //数据接收和发送线程
    {
        private final BluetoothSocket mSocket;
        private final OutputStream mOutputStream;
        private InputStream mInputStream;

        public DataThread(BluetoothSocket socket) {
            mSocket = socket;
            OutputStream tempOutputStream = null;
            InputStream tempInputStream = null;

            try {
                tempOutputStream = mSocket.getOutputStream();
                tempInputStream = mSocket.getInputStream();
            } catch (IOException e) {
                Toast.makeText(MainActivity.this, "get input and output stream error", Toast.LENGTH_SHORT).show();
            }

            mOutputStream = tempOutputStream;
            mInputStream = tempInputStream;


        }

//    public void run() //接收数据
//    {
//
//
//
//
//       while (true)
//       {
//
//            }
//
//    }
}屏蔽的部分是不会写的,怎么让接收的数据一直在我TextView控件中一直显示啊。
有点反应不过来了,知道是用mInputStream读取,如何处理什么的想不通。


作者: qq1105424012    时间: 2017-12-29 11:19
求帮忙啊
作者: qq1105424012    时间: 2017-12-29 17:07
有没有人啊
作者: luoluoluo136    时间: 2017-12-29 17:25
这个你得到安卓开发论坛去问吧。。。我搞单片机的,不懂APP开发




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1