Pairing bluetooth thermal printer in windows CE and fX2.0

Topics: Bluetooth - Other
Mar 11, 2016 at 10:19 AM
Edited Mar 11, 2016 at 4:42 PM
Hi all,
I'm newbie with Bluetooth and I'm going to discover info all over the web.
I've found 32feet (version 3.4) and in the tutorial (youtube) it seems to be what I need.
I've written the code like the video... but when I try to pair it always fails.

this is all my code for testing:


BluetoothDeviceInfo deviceInfo;
    List<string> deviceNames;
    InTheHand.Net.Sockets.BluetoothDeviceInfo[] devices; 

    private void btnSearch_Click(object sender, EventArgs e)
    {
        lblStatus.Text = "Scanning devices...";
        lblStatus.Refresh();
        deviceNames = new List<string>();
        //*** start Scandevices
        InTheHand.Net.Sockets.BluetoothClient btClient = new InTheHand.Net.Sockets.BluetoothClient();
        devices = btClient.DiscoverDevicesInRange();
        //*** scan complete
        lblStatus.Text = "Scan complete";
        lblStatus.Refresh();

        foreach (InTheHand.Net.Sockets.BluetoothDeviceInfo d in devices)
        {
            if (d.ClassOfDevice.ToString() == "680")
            {
                deviceInfo = d;
                deviceNames.Add(d.DeviceName.ToString());
            }
        }

        lstBox.DataSource = deviceNames;
        lstBox.Refresh();

        lblStatus.Text = "";
        lblStatus.Refresh();

        if (lstBox.Items.Count == 1)
        { 
          // forzo il pair 
            if (pairDevice())
            {
                lblStatus.Text = "Pair complete";
            }
            else
            {
                lblStatus.Text = "Pair error";
            }
            lblStatus.Refresh();
        }

    }


    private bool pairDevice()
    {
        if (!deviceInfo.Authenticated)
        {
            if (!BluetoothSecurity.PairRequest(deviceInfo.DeviceAddress, ""))
            {
                return false;
            }
        }
        return true;
    }
with my laptop I connect to the printer without PIN ... (empty)

in which way can I solve this trouble?

TIA Dario