[問題] 藍牙使用L2CAP做傳輸的問題??
最近有在研究藍牙程式
因為想使用L2CAP來傳DATA
不過在寫伺服端時有發現到一個問題
以下是server端的一小段
import javax.bluetooth.*;
import javax.microedition.io.*;
public void start(){
UUID uuid = new UUID("102030405060708090A0B0C0D0E0F011", false);
try{
localdev=LocalDevice.getLocalDevice();
System.out.println("Server Start..");
url="btl2cap://localhost:" + uuid.toString()
+";ReceiveMTU=512;TransmitMTU=512";
System.out.println("Local find "+localdev.getFriendlyName());
/* 1 */ L2CAPConnectionNotifier
n=(L2CAPConnectionNotifier)Connector.open(url);
System.out.println("Waiting for connect...");
/* 2 */ L2CAPConnection conn=n.acceptAndOpen();
System.out.println("connect!!!")
}
catch(Exception e){ }
}
照理說程式應該是會執行到
/* 2 */ L2CAPConnection conn=n.acceptAndOpen();
等待Client連上才對, 可是我執行時卻只會執行到
/* 1 */ L2CAPConnectionNotifier
n=(L2CAPConnectionNotifier)Connector.open(url);
後就停住不動, 想請教一下是哪邊有問題嗎??
參考網站為
http://web.nchu.edu.tw/~jlu/cyut/bluetooth-p.shtml
P.S 我用的是bluecove2.0.3 jar
使用eclipseME1.7.9開發
先謝謝指教了
--
洪日慶:
在家做宅男有啥不好!!想吃就吃!!想睡就睡!!你也可以一樣阿!!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.122.160
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):