Bluetooth pairing .....Scan and pair


Audience

Hi , Is there anybody have a simple application for pairing any bluetooth device bu scanning/entering only MAC address and without searching ? one of our partner has already developed one for MC65 by using our scanandpair tool in EMDK but it doesn't so good if device asks for pin code? thanks

Submitted by Anonymous (not verified) on May 04, 2019 Permalink

Hi, Thanks for all the answers. It was not for RS507 but yes the tools that you've mentioned in EMDK should work. I would appreciated if you may comment for following code which still can't pair with pin code. Thanks in advance.   {                 ScanAndPairTool scanAndPairTool = new ScanAndPairTool();                 scanAndPairTool.NotificationInfo.NotifyType = NOTIFYTYPES.BEEPER;                 scanAndPairTool.BluetoothInfo.LocalComPort = 4;                 scanAndPairTool.ScanInfo.ScanTimeout = 30000;                 ScanAndPairResults result = txtDevicePin.Text!= string.Empty ? scanAndPairTool.ScanAndPair() : scanAndPairTool.ScanAndPair( "0000");                   #region Exception Handle                switch (result)                 {                     case ScanAndPairResults.ERROR_BT_FINDDEVICEFAIL:                         SetInfo( "Error in discovering Bluetooth Device");                         break;                     case ScanAndPairResults.ERROR_BT_FINDSERVICEFAIL:                         SetInfo( "Error in performing Bluetooth service search");                         break;                     case ScanAndPairResults.ERROR_BT_INIT:                         SetInfo( "Failure in Bluetooth initialization");                         break;                      case ScanAndPairResults.ERROR_BT_INSUFFICIENTDATA:                         SetInfo( "Not enough information available to perform the bluetooth operation");                         break;                     case ScanAndPairResults.ERROR_BT_INVALIDDATA:                         SetInfo( "Invalid Bluetooth address or name provided");                         break;                     case ScanAndPairResults.ERROR_BT_NOTPAIRED:                         SetInfo( "Error in unpairing a bluetooth device that is not yet paired");                         break;                     case ScanAndPairResults.ERROR_BT_OBJECTNOTCREATED:                         SetInfo( "Error in internal bluetooth object creation");                         break;                     case ScanAndPairResults.ERROR_BT_PAIR:                         SetInfo( "Failure in bluetooth pairing");                         break;                     case ScanAndPairResults.ERROR_BT_RADIOMODE:                         SetInfo( "Error in updating bluetooth radio mode");                         break;                     case ScanAndPairResults.ERROR_BT_REGISTRY:                         SetInfo( "Failure on accessing bluetooth related registry information");                         break

Submitted by CFW863 on May 04, 2019 Permalink

You are forcing sac&pair to use the localcomport to 4.  Are you sure this com port on the Motorola device is available for use?  If you don't set the localcomport, scan&pair will automatically select a comport that is available and use it for connection. When the pairing fails, what is the error Scan&Pair is returning?  What remote device are you trying to pair with? Printer? I am responsible for the EMDK products including Scan&Pair.  Please do contact me by email or phone for a faster resolution.  We can update thius thread with the resolution later.

Submitted by USER02383 on May 04, 2019 Permalink

Attached is a document one of my customers created for this type of pairing. As far as I know only SPP mode can make the RS507 a master which is the condition required to pair with a barcode

Submitted by TCFX34 on May 04, 2019 Permalink

You can Call MS BT API BthSetPin to programmatically respond to the PIN query thus suppressing the PIN dialog PS: Above API works only for MS BT stack. Taheer

Submitted by CFW863 on May 04, 2019 Permalink

ScanAndPair should work. Pass the pin to the following call:
public ScanAndPairResults ScanAndPair(
   string BluetoothAuthenticationPIN
) Refer to the documentation.  Is there a reason why you can't use this call?

Submitted by USER06054 on May 04, 2019 Permalink

are you looking for something like Bt_Information applet that we have for MPA2.0? I tiwll display device BT address as barcode. We are using it for RS507 support.

Submitted by Anonymous (not verified) on May 04, 2019 Permalink

Its been a while since I last worked on bluetooth, but if you're using the MS stack, I believe there are MS registry entries for storing PIN codes that the MS Stack will supply automatically if the device requests a PIN.  With thos values set, the ScanandPair functionality in the EMDK may  work for you.