Hi,
I have modified the demo as follow:
private void btUnpair_Click(object sender, EventArgs e)
{
m_BTClient.Disconnect();
if (lvDevices.SelectedItems.Count == 0)
MessageBox.Show("Select device", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
else
{
ListViewItem Item = lvDevices.SelectedItems[0];
wclBluetoothRadio Radio = (wclBluetoothRadio)Item.Tag;
Int64 Address = Convert.ToInt64(Item.SubItems[1].Text, 16);
Int32 Res = Radio.RemoteUnpair(Address);
if (Res != wclErrors.WCL_E_SUCCESS)
ShowError(Res);
RefreshDevice(Item);
}
}
private void btPair_Click(object sender, EventArgs e)
{
if (lvDevices.SelectedItems.Count == 0)
MessageBox.Show("Select device", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
else
{
ListViewItem Item = lvDevices.SelectedItems[0];
wclBluetoothRadio Radio = (wclBluetoothRadio)Item.Tag;
Int64 Address = Convert.ToInt64(Item.SubItems[1].Text, 16);
Int32 Res = Radio.RemotePair(Address);
if (Res != wclErrors.WCL_E_SUCCESS)
ShowError(Res);
else
{
m_BTClient.Address = Address;
m_BTClient.Authentication = false;
m_BTClient.Encryption = false;
//m_BTClient.Timeout = 10;
m_BTClient.Channel = 11;
m_BTClient.Service = wclUUIDs.SerialPortServiceClass_UUID;
int iResult = m_BTClient.Connect(Radio);
if (iResult == wclErrors.WCL_E_SUCCESS)
{
}
}
}
}
private void BTClient_OnConnect(object Sender, int Error)
{
if (Error == wclErrors.WCL_E_SUCCESS)
{
MessageBox.Show("CONNECTED!", "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
else
{
MessageBox.Show("ERROR: " + Error.ToString(), "Warning", MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
}
Looking at the behaviors:
* RemotePair: two pairing are done, one for Classic and one for LE
* Connect: it looks that connection on Classic is done but if you query the status GetRemoteConnectedStatus it return false because LE is checked.
Is it possible to have one single behavior by excluding LE ?
I am not able to make it working in a reliable and repetitive way. I really need an help on your side.
Thanks. Regards.
Keven Corazza