Item 4 of 22 Previous | Next

1
Vote

SetServiceState(BluetoothService.SerialPort,state,true) for desktop windows.

description

I am using the latest version of the library which is 3.3.909.0
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.

No files are attached

comments

alanjmcf wrote Feb 14 at 12:06 PM

Does connecting using BluetoothClient work. e.g.
var cli = new BluetoothClient();
cli.Connect(addrOfTarget, BluetoothService.SerialPort);
...

So with the SetServiceState is there no COM port configured for device? And afterward no COM ports exist? Does the check mark appear in the Bluetooth Device UI?

mravi wrote Feb 11 at 8:16 PM

bluetooth stack on the pc is microsoft.i have to find the
value of Bluetooth.PrimaryRadio.SoftwareManufacturer is ??
if you saw the code above it uses the bluetoothsecurity.pairrequest function.

Anyways kindly let me know the possible or the better solution???
Thanks,
RAvi

alanjmcf wrote Feb 11 at 1:09 PM

What is the Bluetooth stack on the PC? What is the value of BluetoothRadio.PrimaryRadio.SoftwareManufacturer?

(Try BluetoothSecurity.PairRequest and see if that helps.)