Datalogic .NET SDK

BtCreateSerialPairing (Method)

 

Syntax

 

   public static Boolean BtCreateSerialPairing (char[] addrStr, Int32 portIndex);

 

 

Class                           : Device

Namespace                : Datalogic.API

Assembly                   : Datalogic.API.DLL

 

 

Description

Create a serial pairing based on a string BT UUID of a device. BtCreateSerialPairing() can be used to create a serial printer connection.

 

Parameters Table

 

Type

Parameter

Description

[in]

char[]

addrStr

Device’s address for which set the pairing.

[in]

Int32

portIndex

Virtual serial port index that will be used to create the pair.

 

 

 

 

[returns]

Boolean

 

On success, TRUE is returned.

[on error]

FALSE

 

FALSE is returned to indicate failure.

 

 

Example

 

       private void btnSetPair_Click(object sender, EventArgs e)

       {

            Boolean bSuccess  = false;

            int COMx = 0;

            string s;

 

            //check address’ string length

            if (txtAddress.Text.Length != 12)

            {

                listBox1.Items.Add("Error: Invalid address!");

            }

            else

            {

                // Get the index from a combobox: 0,1,...

                COMx = comboBox1.SelectedIndex;

                s = (txtAddress.Text + "\0");

                address =  s.ToCharArray();

 

                // Attempt to create serial pairing

                bSuccess = Device.BtCreateSerialPairing(address, COMx); // on the COMx

 

                if (bSuccess)

                {

                    listBox1.Items.Add("Pairing OK");

                }

                else

                {

                    listBox1.Items.Add("Pairing NOT VALID");
                }

            }

        }

 

 

 

Remarks

Check carefully the indexes of virtual port supported and available to make the pair.

 

See Also

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

 

Copyright © Datalogic ADC. All Right Reserved