by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 31 2019 14:20
    stonehippo edited #401
  • Jan 31 2019 14:17
    stonehippo opened #401
  • Jan 29 2019 18:49
    leo-tavares closed #400
  • Jan 29 2019 15:39
    leo-tavares edited #400
  • Jan 29 2019 15:37
    leo-tavares edited #400
  • Jan 29 2019 15:33
    leo-tavares edited #400
  • Jan 29 2019 15:31
    leo-tavares edited #400
  • Jan 29 2019 15:31
    leo-tavares opened #400
  • Jan 28 2019 19:17
    paulreimer closed #398
  • Jan 26 2019 19:05
    bhenav edited #399
  • Jan 26 2019 18:34
    bhenav edited #399
  • Jan 26 2019 18:33
    bhenav edited #399
  • Jan 26 2019 18:32
    bhenav edited #399
  • Jan 26 2019 18:25
    bhenav edited #399
  • Jan 26 2019 18:24
    bhenav edited #399
  • Jan 26 2019 18:21
    bhenav edited #399
  • Jan 26 2019 18:20
    bhenav opened #399
  • Jan 26 2019 00:03
    paulreimer opened #398
  • Jan 25 2019 23:46
    paulreimer opened #397
  • Jan 25 2019 23:20
    ChrisEdson opened #396
psi
@annazus
This library is great! Thank you. My question has to do with deviceId on iOS. Once I pair with a device, can I use the stored deviceId to reconnect with the device in the future?
Assuming the device is in advertising mode and connectable.
Dariusz Seweryn
@dariuszseweryn
@annazus Yes, it should be so
psi
@annazus
Thanks @dariuszseweryn
psi
@annazus
When I scan for a new BLE device, the first time usually neither localName and or name are available on the device. After I connect to it and then say scan again - the device name and localName are available. On occasion even the manufacturer data is missing . The strange part is I can see those fields using a BLE scanner app like nRF connect.
Any tips on how I can obtain localName, name and manufacturer data consistently like nRF connect does?
Dariusz Seweryn
@dariuszseweryn
I expect you have to aggregate data for a particular peripheral. iOS for instance is known for populating localName asynchronously
psi
@annazus
Yes, that makes sense. Thanks again.
Christian Bongardt
@chrbongardt
Hi guys, I'm experiencing some strange issue. When I start the device scan, if I update the react state of the current view, I never get any results on the callback.
Any tips?
Christian Bongardt
@chrbongardt
I fixed it by declaring the BLEManager outside of my stateless component
Andrew Sadowski
@andrewsadowski
I recently upgraded from RN 59.1 (with RN-ble-plx at V.1.0.3) to RN 62 (with RN-ble-plx at V.2.0.0) and i'm getting a BleError of Operation Cancelled when calling monitorCharacteristicForDevice. Basically it seems like its timing out and cancelling the interaction. Is there anything that has changed that could account for this, between V1 and V2? Checked again on my previous version and everything worked as expected. When monitoring the native logs, I see this error: ConnectionOperationQueue: Queue's awaitRelease() has been interrupted abruptly while it wasn't released by the release() method. Thanks!
Nishith
@nishith987_twitter
Hey @dariuszseweryn , I am working on connecting multiple sensors (esp32) to android and ios devices, does react-native-ble-plx allow me to connect and receive data between multiple sensors in a given time
João Vítor Pimentel da Silva
@joaovit1_gitlab
Hello, I'm having some problems when I try to retrieve some data from the device object to my stateless component useState hook, I tried a lot of things, but anything works
image.png
Here's what I have right now, setDevice doesn't work
Christian Bongardt
@chrbongardt
Hey João, can you share the rest of your controller? I had similar issues.
In my case it was due because of where I declared the ble manager.
Dariusz Seweryn
@dariuszseweryn
@nishith987_twitter It should be possible
@andrewsadowski Try targeting latest master and check if it is still the case
Andrew Sadowski
@andrewsadowski
Thanks @dariuszseweryn . Is there a newer version beyond 2.0.0? Looking at Master's package.json and it looks like that is the most current version.
Dariusz Seweryn
@dariuszseweryn
Andrew Sadowski
@andrewsadowski
Ah, thank you
Nishith
@nishith987_twitter
yeah Thank you @dariuszseweryn
Aly Abdelrahman
@abdelrahmanaly
Hello all, I am new to javascript so I am having some issues with promises. I'm trying to return my device.id to another component in my react-native file. I keep finding when I return from startDeviceConnection I always get null or undefined. But I am confused on a proper way of returning device.id
williamgoodhew
@williamgoodhew
Hi - I am able to connect to my Bluetooth external device from my phone. I am when I call .connectToDevice() it is connecting properly. In the documentation for the Bluetooth device it says after connecting the phone needs to ask for the token. The token is hexadecimal (0x06 0x01). How do I send this command from the Phone to the Bluetooth device. This is what the device documentation says "The connection between the CCU and the mobile phone is BLE 4.0 and compatible. The
mobile phone should actively establish a connection with the CCU through BLE MAC after
scanning code. After the connection is established, the mobile phone immediately sends the
command of get TOKEN (0x06 0x01) to get TOKEN."
_fantasticDev_
@SnakeGeneral
Hello everyone
const bleManager = new BleManager();
useEffect(() => {
    const subscription = bleManager.onStateChange(async (state) => {
        if (state === 'PoweredOn') {
            const permission = await requestLocationPermission();
            if(permission){
                scanAndConnect();
                subscription.remove();
            }
        }
    }, true);
});

const scanAndConnect = () => {
    console.log('scan start');
    bleManager.startDeviceScan(null, null, (error, device) => {
        console.log('scan started');
        if (error) {
            console.log('error:' + error);
        }

        if(device.name != null){
            console.log(device.name);
        }

        if (device.name === 'TI BLE Sensor Tag' ||
            device.name === 'SensorTag') {
            bleManager.stopDeviceScan();
        }
    });
}

return (
    <Background>
        <Logo/>
        <Header>Let’s start</Header>
        <Paragraph>
            Let's start by clicking start button, so app will start bluetooth.
        </Paragraph>
        <Button mode="outlined" onPress={() => console.log('start pressed')}>
            Start
        </Button>
        <Button mode="outlined" onPress={() => console.log('logout pressed')}>
            Logout
        </Button>
    </Background>
);
This code can't scan devices
Please help me
Dariusz Seweryn
@dariuszseweryn
@williamgoodhew Usually this means a characteristic write
@SnakeGeneral Is scan start logged?
Aly Abdelrahman
@abdelrahmanaly
How do you guys reference the class device in order to retrieve device.id?
My apologize let me explain in a better way, how do you save device.id so that you can read better without connecting. I’m trying to use bleManger and sending in device.id instead of connecting, catching a promise and going down till I reach characteristics.
_fantasticDev_
@SnakeGeneral
@dariuszseweryn Yes
Aly Abdelrahman
@abdelrahmanaly
@dariuszseweryn my apologize as well for not responding before when I asked a question. I completely missed the notification.
Dariusz Seweryn
@dariuszseweryn
@SnakeGeneral What OS?
@abdelrahmanaly Characteristics are only available after device has been connected and service discovery was performed
Aly Abdelrahman
@abdelrahmanaly
Screen Shot 2020-06-26 at 12.09.49 PM.png
I've already done that
I am unable to return the result. I can't catch it/ I can only use console.log to print it. but I would like to return it as a value for another function.
I am having issues returning anything in startdevicescan(), whether its a characteristics values or device.id for future use.
williamgoodhew
@williamgoodhew
Hi @dariuszseweryn thanks for the tip. I can now get a response from calling device.writeCharacteristicWithResponseForService() but the value field is empty. In the documentation, it says "The resulting Promise emits this characteristic when the response is received. Latest value may not be stored inside returned object." how would I get the latest value? The token returned is needed for all other requests.
function onConnect() {
    manager.connectToDevice('ECC17464-FEFC-DB10-D46A-2252F62AD9D4')
    .then((device) => {
      return device.discoverAllServicesAndCharacteristics()
    })
    .then((device) => {
        return device.writeCharacteristicWithResponseForService('90000034-0000-1000-8000-00805F9B34FB', '90000035-0000-1000-8000-00805F9B34FB', 'MHgwNjB4MDE=')
    })
    .then((characteristics) => {
      console.log('characteristics', characteristics)
    })
    .catch((error) => {
        console.log('device error: ', error)
    });
  }
Here is the console log with the empty value field.
Characteristic {id: 10764234176, uuid: "60000003-0000-1000-8000-00805f9b34fb", isNotifiable: false, isNotifying: false, isReadable: false, …}
deviceID: "ECC17464-FEFC-DB10-D46A-2252F62AD9D4"
id: 10764234176
isIndicatable: false
isNotifiable: false
isNotifying: false
isReadable: false
isWritableWithResponse: true
isWritableWithoutResponse: true
serviceID: 10776527104
serviceUUID: "90000034-0000-1000-8000-00805f9b34fb"
uuid: "90000035-0000-1000-8000-00805f9b34fb"
value: null
_manager: BleManager {_eventEmitter: NativeEventEmitter, _uniqueId: 5, _activePromises: {…}, _activeSubscriptions: {…}, _errorCodesToMessagesMapping: {…}}
__proto__: Object
Dariusz Seweryn
@dariuszseweryn
Because a write is writing onto your peripheral. It does not contain any response value. I suggest you to read about reads and notifications
The response you take for a value is just an ACK signal from your peripheral that it received the write
williamgoodhew
@williamgoodhew
Ok - i thought you said Characteristic write. I am trying readCharacteristicForDevice() and the value field is an empty string
Dariusz Seweryn
@dariuszseweryn
Try checking documentation of your peripheral
williamgoodhew
@williamgoodhew
Hi @dariuszseweryn - I have the ServiceUUID and the CharacteristicUUID, but I am trying to send a command to this characteristic so that it will return a value. The command is 0x060x01. I cannot work out where to place this command in the readCharacteristicForDevice() call. readCharacteristicForDevice() has 3/4 parameters, deviceIdentifier, ServiceUUID, CharacteristicUUID and transactionId (optional). Where do I place the command 0x060x01?
Dariusz Seweryn
@dariuszseweryn
☝️
williamgoodhew
@williamgoodhew
What does that mean?
Dariusz Seweryn
@dariuszseweryn
Try checking documentation of your peripheral