2014-02-27 85 views
0

我想從elm327設備接收數據。第7行中的 我收到AT+BRSF=24\r字符串,而不是速度字符串。從elm327設備接收數據

1.private async Task<string> GetSpeed() 
2. { 
3.  string retVal; 
4.  _dataWriter.WriteString("010D\r"); // send pid for speed information 
5.  await _dataWriter.FlushAsync(); 
6.  await _dataReader.LoadAsync(30); // get answer 
7.  String Message = _dataReader.ReadString(11); 
8.  retVal = Message; 
9.  if (retVal.Contains('<')) 
10.  { 
11.  retVal.Substring(0, retVal.IndexOf("<")); 

12.  } 
13.  return retVal.Replace("\n", ""); 
14. } 

我使用SDP藍牙協議:

PeerFinder.AlternateIdentities["Bluetooth:SDP"] = "{00001101-0000-1000-8000-00805F9B34FB}"; 

回答

1

問題是與連接通道, 予先用下一行的嘗試:

_stream = await socket.ConnectAsync(selectedDevice.HostName,"1"); 

但工作通道是16而不是1,工作線是:

_stream = await socket.ConnectAsync(selectedDevice.HostName,"16"):