bluetoothsocket串口问题 手上有个蓝牙设备,想用手机接收设备上发送出来的数据,数据是十六进制的。网上看到可以用bluetoothSocket虚拟串口实现,但没有类似的例子,哪位仁兄能帮下忙指点一下啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class BluetoothOppRfcommTransport implements ObexTransport { private final BluetoothSocket mSocket; public BluetoothOppRfcommTransport(BluetoothSocket socket) { super(); this.mSocket = socket; } public void close() throws IOException { mSocket.close(); } public DataInputStream openDataInputStream() throws IOException { return new DataInputStream(openInputStream()); } public DataOutputStream openDataOutputStream() throws IOException { return new DataOutputStream(openOutputStream()); } public InputStream openInputStream() throws IOException { return mSocket.getInputStream(); } public OutputStream openOutputStream() throws IOException { return mSocket.getOutputStream(); } public void connect() throws IOException { } public void create() throws IOException { } public void disconnect() throws IOException { } public void listen() throws IOException { } public boolean isConnected() throws IOException { //return mSocket.isConnected(); // TODO: add implementation return true; } public String getRemoteAddress() { if (mSocket == null) return null; return mSocket.getRemoteDevice().getAddress(); }} android和javaweb的选择 在avd中运行的程序,可以调用本机的硬件吗 RadioGroup问题!!(求助) 用什么方法能够结束一个应用程序? 真机调试问题,急。。。 Android Eclipse 调试步进不进入JAR包和Android包的问题。 本菜鸟在使用pagerview遇到问题求解 怎么实现关键字标签 Android Studio 模拟器起不来是为什么啊? 新手求帮助 android 怎么拍摄出来最好的照片 如何在一个Activity中通过不同的VIEW来刷新界面?
public class BluetoothOppRfcommTransport implements ObexTransport { private final BluetoothSocket mSocket; public BluetoothOppRfcommTransport(BluetoothSocket socket) {
super();
this.mSocket = socket;
} public void close() throws IOException {
mSocket.close();
} public DataInputStream openDataInputStream() throws IOException {
return new DataInputStream(openInputStream());
} public DataOutputStream openDataOutputStream() throws IOException {
return new DataOutputStream(openOutputStream());
} public InputStream openInputStream() throws IOException {
return mSocket.getInputStream();
} public OutputStream openOutputStream() throws IOException {
return mSocket.getOutputStream();
} public void connect() throws IOException {
} public void create() throws IOException {
} public void disconnect() throws IOException {
} public void listen() throws IOException {
} public boolean isConnected() throws IOException {
//return mSocket.isConnected();
// TODO: add implementation
return true;
} public String getRemoteAddress() {
if (mSocket == null)
return null;
return mSocket.getRemoteDevice().getAddress();
}}