已经检测到pc端
如何向pc端发送信息? public void Search(Form threadForm, ICallBack callBack) throws BluetoothStateException, Exception
{
try
{
LocalDevice localDevice = LocalDevice.getLocalDevice();
DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
searchListener = new SearchDrvListener(threadForm);
searchListener.callBack = callBack;
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, searchListener);
}
catch(Exception e)
{
throw new Exception("启动搜索时发生错误!错误信息:" + e.getMessage());
}
} public void Send(String driver_address, String text) throws Exception
{
try
{
String connStr = "btspp://<address>";
// update the Gauge message before connecting
session = (ClientSession)Connector.open(driver_address);
HeaderSet headers = session.createHeaderSet();
headers.setHeader(HeaderSet.NAME, text);
Operation operation = session.put(headers);
OutputStream outputStream = operation.openOutputStream();
if (outputStream == null) {
throw new IOException();
} }
catch(Exception e)
{
throw new Exception("发送信息时发生错误!错误信息:" + e.getMessage());
}
}如上,send函数中该怎么向pc发信息
如何向pc端发送信息? public void Search(Form threadForm, ICallBack callBack) throws BluetoothStateException, Exception
{
try
{
LocalDevice localDevice = LocalDevice.getLocalDevice();
DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent();
searchListener = new SearchDrvListener(threadForm);
searchListener.callBack = callBack;
discoveryAgent.startInquiry(DiscoveryAgent.GIAC, searchListener);
}
catch(Exception e)
{
throw new Exception("启动搜索时发生错误!错误信息:" + e.getMessage());
}
} public void Send(String driver_address, String text) throws Exception
{
try
{
String connStr = "btspp://<address>";
// update the Gauge message before connecting
session = (ClientSession)Connector.open(driver_address);
HeaderSet headers = session.createHeaderSet();
headers.setHeader(HeaderSet.NAME, text);
Operation operation = session.put(headers);
OutputStream outputStream = operation.openOutputStream();
if (outputStream == null) {
throw new IOException();
} }
catch(Exception e)
{
throw new Exception("发送信息时发生错误!错误信息:" + e.getMessage());
}
}如上,send函数中该怎么向pc发信息
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货