IvanStoilov / react-native-brother-printing

A package that allows you to printer with brother printers via Bluetooth and Wifi
MIT License
0 stars 0 forks source link

Function discoverPrinters not found. How do i discover bluetooth connected printers? #2

Open nemvik opened 7 months ago

nemvik commented 7 months ago

Hi,

we are using QL-820NWB and QL-820NWBc printers. We are using react-native with expo.

I connected my phone to both printers but neither is working correctly with printImageViaBluetooth(imageUri, modelName). When i paste QL-820NWB1234 (what i see in bluetooth connected devices) it says printer is not connected.

In docs you cay "To discover printers use the discoverPrinters function." but there is none in your package.

However, when i tried to scan devices with react-native-ble-plx or react-native-brother-printers i didnt find the printers. But when i connect the printers to wifi i am able to print with them using expo-print.

So my question is: How do i discover printers?

IvanStoilov commented 7 months ago

There is no discover functionality implemented. You have to know the IP address when connected via WiFi. For bluetooth - what is your full name of the brother printer? I have had some problems when there are spaces in the printer name (e.g. "Brother QL-820NWB").

nemvik commented 7 months ago

it says 'QL-820NWB0315' on my phone and is same on the printer. I even tried Address field 'AC:50:DE:0C:E3:5C' or just the model name 'QL-820NWBc' and 'QL-820NWB' but still i get {"error": 101, "message": "Printer not connected"}

IvanStoilov commented 7 months ago

Can you try with your phone's IP address and WiFi? In addition, do you have the Permissions correctly configured in your Info.plist (check the README.md)

nemvik commented 7 months ago

i added again everything into Info.plist and rebuilt the app. Tried with wifi but still no success

const modelName = 'QL-820NWB';
const ip = "192.168.2.213";
const imageUri = 'https://d30j33t1r58ioz.cloudfront.net/static/guides/sdk.png';

printImageViaBluetooth(imageUri, modelName).then((p) => console.log("print: ", p)).catch((err) => console.log("err: ", err));
printImageViaWifi(imageUri, ip, modelName).then((p) => console.log("print2: ", p)).catch((err) => console.log("err 2: ", err));

results are this:

LOG  err:  {"error": 101, "message": "Printer not connected"}
LOG  print2:  undefined