I am trying to connect desktop windows version of windows XP, Vista 32bit, 64bit, Win7 32bit, 64 bit. to bluetooth adapter (parani ESD110V2 2.0.0). The bluetooth radio used is also parani UD100. The code down below is used to install bluetooth and the outgoing virtual com port is used and passed to a serial handle where the communication is handled.
The bluetooth adapter is used in two modes .
mode 0: connectable and discoverable
mode1: connectable but NON-discoverable.
As the code executes the SetServiceState(BluetoothService.SerialPort,true,true) does not install the incoming virtual com port.It neither works in mode 0 nor mode 1.The normal pairing that is usually done by selecting the Bluetooth Devices from the control panel works and the bluetooth communication is absolutely fine.
Is there a problem with the library?? Can you suggest a possible solution of how this could be handled??
Can you please suggest a better way to install bluetooth apart from SetServiceState.Our application has to use the virtual com port.
using InTheHand.Net.Bluetooth;
using InTheHand.Net.Bluetooth.Factory;
using InTheHand.Net.Ports;
using InTheHand.Net.Sockets;
using InTheHand.Windows.Forms;
using InTheHand.Net;
BluetoothAddress addr;
BluetoothDeviceInfo Ldevice;
ManagementEventWatcher m_inWatcher;
private BluetoothListener bl;
if (!BluetoothRadio.IsSupported)
{
label4.Text = " ";
CMessages.ShowErrorMessage("Bluetooth Radio is not available.");
_Connect.Enabled = true;
return;
}
if (BluetoothRadio.PrimaryRadio.Mode == RadioMode.PowerOff)
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
addr = BluetoothAddress.Parse(BTh_MacAddress.ToStringAddress().ToLower());
CDataSet.DataSet.MacAddr = BTh_MacAddress.ToStringAddress().ToLower();
Ldevice = new BluetoothDeviceInfo(addr);
if (!BluetoothSecurity.PairRequest(addr, edit_Code1.Text))
{
CMessages.ShowErrorMessage("Bluetooth Pairing Request Failed.");
return;
}
else
{
BT_Found = true;
bool state = true;
VirtPortName = CSystemDeviceInfo.GetVirtualCommPorts(addr.ToString());
if (VirtPortName == "")
{
Ldevice.SetServiceState(BluetoothService.SerialPort, state, true);
}
Ldevice.Update(); Ldevice.Refresh();
//break;
}
Thanks,
Ravi M.