Discussion Groups

Bluetooth SDK for .NET CF 1.0, 2.0, 3.x

  • Hi there -

    Do we have a Bluetooth SDK for .NET CF?

    Would it allow me to write a scan to pair application?  i.e. scan a barcode with the BT mac address of a printer, and have it automatically bond, pair and start printing?

    Kind regards,

    James

  • You can do this within our MDSDK within the Bluetooth class.  You can download the SDK here

    PsionTeklogix::Peripherals::Bluetooth Class Reference

    Class provides access to some Bluetooth features. More...

    List of all members.

    Public Member Functions

      Bluetooth ()
      Constructor.
    void  PairSerialProfileDevice (string macAddress, string pin, string portName)
      Pairs a Serial Port Profile Bluetooth device with this terminal.
    void  PairSerialProfileScanner (string macAddress, string pin, string portName)
      Pairs a Serial Port Profile Bluetooth scanner with this terminal.
    void  UnpairSerialProfileDevice (string macAddress)
      Unpairs a Serial Port Profile Bluetooth device that was paired with either PairSerialProfileDevice or PairSerialProfileScanner.
  • James,

    For your information, our Mobile Devices SDK version 3.4 comes with a C# Bluetooth Serial Port Pairing demo application, which you could easily enhance to suit your needs:

    C:\Program Files\Psion Teklogix\Mobile Devices SDK V3.4\Samples\dotnet\c_sharp\BluetoothPairing

    Kind regards,
    Jacques

  • Excellent.

    Thanks indeed!

    Kind regards,

    James

  • In case it helps, let me share a VS2008 C# solution that illustrates how to pair and send data to a (serial) Bluetooth device.
      csBluetoothPrintDemo (compressed)

    Upon execution, you shall see:
      

    At this point,

    - key-in the Printer BT MAC address - a 12 x digit hexadecimal value - you wish to pair with
    - [optionally] key-in a PIN #
    - select the virtual COM port to be used
    - and hit [ Pair ]
     
    E.g.
      è Pair è
     
    Now click [OK] then
     
    - key-in data in the edit box located above the [ Print ] button
     
    - Or click the […] button to select the text file to be printed
     
      è 
     
    And finally hit [ Print ]
     
    --
     
    Installation instructions
    - Decompress the above csBluetoothPrintDemo (executable) file
    - Copy its content anywhere to your CE 5.0 unit Star
    - Once copied, launch the csBluetoothPrintDemo.exe program
    --
     


    I Special notes:

     

    Star As it stands, the application is targeting a CE5.0 device;

    --

    If your device is a Windows Mobile 6.x unit, prior to building and deploying this solution, make sure to

    • change the target platform to Windows Mobile 6 Professional SDK
    • replace the (CE 5.0) PtxSdkCommon.dll library added as source file in the Solution Explorer, with the library located in the C:\Program Files\Psion Teklogix\Mobile Devices SDK V3.4\WindowsMobile6 folder 

  • Hello,

    this application works fine. Is it possible to scan for available devices using your SDK?

    Kind regards

    Jens

  • Hello

    The PTX SDK supports the pairing and unpairing of the devices currently.

    You can use Microsoft's WM SDK for this purpose.

  • Hi!

    I'm trying to write to a printer mlp3030 (using bluetooth), without use of vcp (because I'm using the com driver to connect a another non-standar device).

    I did try this code, but, don't works.

    Can you help me?

               try

               {

                   BluetoothRadio br = BluetoothRadio.PrimaryRadio;

                   br.Mode = RadioMode.Discoverable;

                   BluetoothAddress addr = new BluetoothAddress(new byte[] { 0x10, 0x00, 0xe8, 0xac, 0x3f, 0xe9 });

                   BluetoothEndPoint ep = new BluetoothEndPoint(addr, BluetoothService.BasicPrinting);

                   BluetoothClient c = new BluetoothClient();

                   c.SetPin("");

                   c.Connect(ep);

                   StreamWriter sw = new StreamWriter(c.GetStream());

                   sw.WriteLine("hola\n");

                   sw.Close();

                   c.Close();

               }

               catch (Exception ex)

               {

                   MessageBox.Show(ex, "ERROR");

               }

    TIA

    jorge infante

    rosario - santa fe - argentina