How to handle the react native ble plx [BleError: Operation was rejected]?

Viewed 296

I have problem with react native ble plx. I try to print the image screenshot from component using react native viewshot and then i convert those file to string base64 after that i try to print to my bluetooth third party devices. but it doesnt work. i follow documentation and try to find solution by googling and experiment but still. im stuck.

async print(text: string) {
    if (!connectedDevice) return;
    const file = await RNFS.readFile(text, 'base64').then((res) => {
      return res;
    });

bleManager
  .writeCharacteristicWithResponseForDevice(
    connectedDevice?.id,
    SerialServiceUUID,
    SerialCharacteristicUUID,
    file,
  )
  .then((resp) => {
    console.log('WRITE resp = ', resp);
  })
  .catch((err) => {
    console.log('WRITE err = ', err);
  });}

enter image description here

0 Answers
Related