2

I'm using windows 7 and connected my phone using bluetooth. This connection uses a virtual COM port for communication, which I've configured to specified baud rate, flow control, word length, etc. before I call my php function


function sendmsg($str = 'AT\r\n', $device = 'COM5'){
  $handle = fopen($device, "w+b");
  stream_set_blocking($handle, 0);
  fwrite($handle, $str);
  fclose($handle);
  return true;
}

Now the problem is fopen() throws me an error saying that it is an invalid argument and it has failed to opened stream and all else fails. But my phone says it is connected to my computer and then flashes an alert that bluetooth connection has failed. When I tried the same configuration parameters over PuTTY I was able to do what I wanted to do. I've also tried it on C# but that too ended up with the same result :(

4

2 回答 2

1

http://code.google.com/p/php-serial/

于 2011-01-18T14:31:09.873 回答
0

我做了类似的事情,但在 Python 中并且它有效 - Windows Vista 与诺基亚 N70 手机交谈。手机通过蓝牙配对,通信是使用与配对一起创建的 COM 端口完成的。它基于一个名为pySerial的开源项目

于 2011-01-18T19:48:26.353 回答