Как обмениваться изображениями с помощью response-native-ble-plx - PullRequest
0 голосов
/ 04 сентября 2018

Я хочу отправить изображение из приложения iOS на подключенный ноутбук в каком-либо каталоге с помощью «act-native-ble-plx ». Но я не очень понимаю и не понимаю, как это сделать. Я уже могу соединить приложение и ноутбук вместе через Bluetooth. Но я понятия не имею, как это работает, какую часть и функции следует использовать для отправки данных.

Это мой код.

scanAndConnect() {
this.manager.startDeviceScan(null, null, (error, device) => {
    if (error) {
        // Handle error (scanning will be stopped automatically)
        console.log("TTT");
    }
    console.log(device.name);
    // Check if it is a device you are looking for based on advertisement data
    // or other criteria.
    if (device.name !== null) {
        console.log('Success');
        // Stop scanning as it's not necessary if you are scanning for one device.
        this.manager.stopDeviceScan();
        console.log('Found ${device.name}');
        device.connect()
        .then((device) => {
        console.log(device+"test1");
        return device.discoverAllServicesAndCharacteristics()
        })
        .then((device) => {
       // Do work on device with services and characteristics
        console.log(device+"test2");
            this.manager.writeCharacteristicWithResponseForDevice("1234")
          .catch((error)=>{
             console.log('error in writing data');
          })
        })
        .catch((error) => {
        // Handle errors
          console.log(error);
        });

        // Proceed with connection.
    }
   else {
     console.log("Notmatch"+device.name);

     this.manager.stopDeviceScan();
   }
});
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...