使用BluetoothListener时设置引脚

时间:2014-01-10 08:52:11

标签: c# android bluetooth windows-ce

我正在制作一个Android应用程序来连接WIN CE PC上的程序,其中WIN CE PC作为服务器。

使用以下代码

 bluetoothListener = new BluetoothListener(mUUID);
 bluetoothListener.Start();
 con = bluetoothListener.AcceptBluetoothClient();            
 updateUI("Client has connected");
 mStream = con.GetStream(); 

这将在我连接到它的第一个WIN CE PC上提示引脚请求。 但由于WIN CE PC上的程序必须在前台运行,我不能使用WIN CE提示输入引脚。

是否可以在WIN CE侧设置引脚,这样就不会提示引脚输入窗口,我总是可以使用我设置的相同引脚连接它。

我希望能够使用代码更改WIN CE PC的蓝牙名称,而不是在设备菜单中更改它。

编辑1:

如果我使用

con = bluetoothListener.AcceptBluetoothClient(); 
con.SetPin("4567");

它设置引脚但仅在下次连接时才设置。 如果我使用

con.SetPin("4567");
con = bluetoothListener.AcceptBluetoothClient(); 

我得到一个NullReferenceException,因为尚未声明con。

0 个答案:

没有答案