I want to pair a bluetooth barcode scanner(like the one's used in retail stores) with an esp32. The scanner easily pairs with my smartphone or laptop.I am using the 'BluetoothSerial' library. When i use SerialBT.discover(), the scanner gets listed in the list of available devices. But when I use SerialBT.connect(), it doesnt pair. I have tried hardcoding the address too as follows,
uint8_t address[6] = {0xAA, 0xFE, 0x45, 0x2E, 0x0E, 0x39};
if (SerialBT.connect(address)) {
Serial.println("Connected to the barcode scanner!");
} else {
Serial.println("Failed to connect to the barcode scanner.");
}
I have tried using the name of the scanner in SerialBT.connect(), but that too doesn't work. What could be the problem? The scanner is set in HID mode, is BluetoothSerial library the best suited for this task?