wince连接蓝牙打印机
我想做一个小工具,就是实现通过蓝牙将两个Windows Mobile系统的机子连接上,然后互相能建立端口(就是虚拟一个串口)用于发送内部GPS数据,现在我上网搜了一个库(InTheHand.Net.Personal.dll),利用它可以搜索到可见蓝牙,但是却连不上,总是出现"由于目标计算机主动拒绝,连接未能建立"的错误,而且连上之后怎么虚拟串口呢,也不会.下面是我的源码:
client = new BluetoothClient();
devices = client.DiscoverDevices();
Cursor.Current = Cursors.Default;
this.listBox1.Items.Clear();
if (devices != null && devices.Length > 0) {
for (int i = 0; i < devices.Length; i++) {
if (devices[i].DeviceName != null) {
this.listBox1.Items.Add(devices[i].DeviceName);
}
}
}
连接:
address = new BluetoothAddress(devices[index].DeviceID);
Guid service = BluetoothService.SerialPort;
client.Connect(new BluetoothEndPoint(address, service));
请路过的高手大神们帮忙看看,太纠结了,第一次接触这些东西,搞了好几天了,还是不知道错在哪里,谢谢大家了!!