Datalogic .NET SDK

BtDiscoverSerialDevices (Method)

 

Syntax

 

   public static BTDevice [] BtDiscoverSerialDevices ();

 

 

Class                           : Device

Namespace                : Datalogic.API

Assembly                   : Datalogic.API.DLL

 

 

Description

This function returns information about all discoverable devices in range that support the serial (SPP) profile.  This function can be used with BtCreateSerialPairing() to form a connection to a serial BT device, such a printer.

 

Parameters Table

 

Type

Parameter

Description

[returns]

BTDevice

 

On success, data on discovered serial devices.

[on error]

null

 

null is returned to indicate failure.

 

 

Example

 

       private void btnBTDiscover_Click(object sender, EventArgs e)

       {

            bool enabled;

 

            //Get the current BT status, only discover when BT enabled

            if (!Device.BtStatus(out enabled))

                enabled = false;

            if (enabled)

          {

                // Clear all items from the discovery list

                BtDiscoverList.Clear();

                BtDiscoverList.Columns.Add(columnHeader3);

                BtDiscoverList.Columns.Add(columnHeader4);

 

                // Perform the discovery

                Cursor.Current = Cursors.WaitCursor;

                devices = Device.BtDiscoverSerialDevices();

                Cursor.Current = Cursors.Default;

 

                if (devices == null)

                    MessageBox.Show("Error: Could not perform discovery");

                else

                {

                    // Update the discovery list.
                    string[] itemStr = new string[2];

                    for (int i = 0; i < devices.Length; i++)

                    {

                        itemStr[0] = devices[i].Name;

                        itemStr[1] = devices[i].AddrStr;

                        BtDiscoverList.Items.Add(new ListViewItem(itemStr));

                    }

                 }

            }

        }

 

 

 

 

 

See Also

Device.BTDevice (Sub-Class), Device.BtCreateSerialPairing (Method), Example #034.

 

Copyright © Datalogic ADC. All Right Reserved