• Hi :)

    Im working on integrating the Puck.js into my react native application using react-native-ble-plx
    Everything is working fine, but when i try to write some data, i just get this message

    [BleError: Characteristic 6e400002-b5a3-f393-e0a9-e50e24dcca9e notify change failed for device 1E986C85-8037-E56E-A18D-0F38826AAB12 and service 6e400001-b5a3-f393-e0a9-e50e24dcca9e]

    Thats my code :)

    return new Promise<string>((resolve, reject) => {
                return Ble.startDeviceScan(null, null, async (error, device) => {
                    if (error) {
                        console.log(error.message);
                        if (typeof error.message === 'string') {
                            //show error
                        }
                        reject(false);
                        return;
                    }
    
                    console.log(device?.name);
    
                    if (device?.name?.trim().startsWith('Puck.js')) {
                        try {
                            if (device) {
                                Ble.stopDeviceScan();
                                const connected = await device.isConnected();
    
                                if (!connected) {
                                    await device.connect();
                                    await device.discoverAllServicesAndCharacteristics();
                                    const result2 = await device.services();
                                    result2.forEach(async (service) => {
                                        const charLit = await service.characteristics();
                                        charLit.forEach(async (chari) => {
                                            console.log('carhi', chari);
                                            if (chari.uuid === '6e400002-b5a3-f393-e0a9-e50e24dcca9e') {
                                                chari.monitor((error, char) => {
                                                    console.log('monitor,', error, char !== undefined);
                                                });
    
                                                const data = Buffer.from(['LED1.set();/n']).toString('base64');
                                                chari
                                                    .writeWithResponse(data)
                                                    .then((val) => console.log('val', val))
                                                    .catch((reason) => console.log('reson', reason));
                                            }
                                        });
                                    });
                                }
    
                                resolve(device.id);
                            }
                        } catch (err: any) {
                            console.log('errMessage', err);
                            if (typeof err.message === 'string') {
                                // show error
                            }
    
                            reject(err.message);
                        }
                    }
                });
            });
    

    I would be greatful for any help :)

About

Avatar for user154849 @user154849 started