TX characteristicilta puuttuu lukuoikeus

Minulla on kehityksessä mobiilisovellus, joka hyödyntää RuuviTagia. RuuviTagista olisi tarkoitus lukea sen id sekä sen mittaama tuorein data. Näitä ei tarvitse tallentaa minnekään, joten käyttö on hyvin yksinkertaista. Tämä on minulle ensimmäinen kerta, kun käytän bluetoothia devaamisessa.

Minulla on käytössä Cordova plugin cordova-plugin-ble-central (https://github.com/don/cordova-plugin-ble-central). RuuviTagien etsintä ja yhdistyminen toimivat aivan hyvin.

Kun yritän lukea TX characteristicin dataa, ohjelma kohtaa virheen: Error Domain=CBATTErrorDomain Code=2 "Reading is not permitted." UserInfo={NSLocalizedDescription=Reading is not permitted.}. Tämä johtuu siitä, että TX:ltä puuttuu lukuoikeus. Käyttämäni metodi: https://github.com/don/cordova-plugin-ble-central#read. Oletan, että ehkä jotenkin tällä tavalla saisin ulos mittaustietoja, jos se toimisi. Tässä data, jota ohjelma palauttaa:

<CBCharacteristic: 0x281b1dda0, UUID = 6E400003-B5A3-F393-E0A9-E50E24DCCA9E, properties = 0x10, value = (null), notifying = NO>

{"name":"Ruuvi 25B7","rssi":-26,"id":"1C3130FF-1AE0-CF45-0C4A-B4E93E8E26D9","advertising":{"kCBAdvDataLocalName":"Ruuvi 25B7","kCBAdvDataManufacturerData":{},"kCBAdvDataServiceUUIDs":["6E400001-B5A3-F393-E0A9-E50E24DCCA9E"],"kCBAdvDataIsConnectable":0},"services":["180A","6E400001-B5A3-F393-E0A9-E50E24DCCA9E"],"state":"connected","characteristics":[{"properties":["Read"],"isNotifying":false,"characteristic":"2A29","service":"180A"},{"properties":["Read"],"isNotifying":false,"characteristic":"2A24","service":"180A"},{"properties":["Read"],"isNotifying":false,"characteristic":"2A27","service":"180A"},{"properties":["Read"],"isNotifying":false,"characteristic":"2A26","service":"180A"},{"properties":["WriteWithoutResponse","Write"],"isNotifying":false,"characteristic":"6E400002-B5A3-F393-E0A9-E50E24DCCA9E","service":"6E400001-B5A3-F393-E0A9-E50E24DCCA9E"},{"properties":["Notify"],"isNotifying":false,"characteristic":"6E400003-B5A3-F393-E0A9-E50E24DCCA9E","service":"6E400001-B5A3-F393-E0A9-E50E24DCCA9E"}]}

Mistähän tämä voisi johtua? Otan myös mielelläni vastaan kaikenlaisia vinkkejä tällaisen ominaisuuden toteuttamiseen.

Hei,

Tagien lukeminen on tarkoitettu tehtäväksi niin, että lukija rekisteröityy TX-characteristicin notifikaatioihin ja tag lähettää notifikaation kun uutta dataa on tarjolla.

Dokumentaatiossamme näyttää olevan virhe, siellä sanotaan että characteristic olisi myös luettava. En ole aivan varma että korjaanko dokumentaation vai teenkö characteristicista luettavan seuraavaan firmware-versioon, mutta nopeana ratkaisuna toimii siis tuo notifikaatioiden vastaanottaminen. Uskoakseni GitHub - don/cordova-plugin-ble-central: Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap) on tähän oikea metodi.

1 Like

Google translate says:
I am developing a mobile application that utilizes RuuviTag. The ruuvi should be read from its ID as well as the latest data measured by it. These do not need to be stored anywhere, so use is very simple. This is the first time for me to use Bluetooth for deva.

I am using the Cordova plugin cordova-plugin-ble-central (GitHub - don/cordova-plugin-ble-central: Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)). Searching for and merging ruuvis work just fine.

When I try to read TX characteristic data, the program encounters an error: Error Domain = CBATTErrorDomain Code = 2 “Reading is not permitted.” UserInfo = {NSLocalizedDescription = Reading is not permitted.}. This is because TX lacks read access. The method I use: GitHub - don/cordova-plugin-ble-central: Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap) 1. I assume that somehow this way I would get out the measurement data if it worked. Here is the data returned by the program:

<CBCharacteristic: 0x281b1dda0, UUID = 6E400003-B5A3-F393-E0A9-E50E24DCCA9E, properties = 0x10, value = (null), notifying = NO>

{“name”: “Ruuvi 25B7”, “rssi”: - 26, “id”: “1C3130FF-1AE0-CF45-0C4A-B4E93E8E26D9”, “advertising”: {“kCBAdvDataLocalName”: “Ruuvi 25B7”, “kCBAdvDataManufacturerData” : {}, “kCBAdvDataServiceUUIDs”: [“6E400001-B5A3-F393-E0A9-E50E24DCCA9E”], “kCBAdvDataIsConnectable”: 0}, “services”: [“180A”, “6E400001-B5A3-F393-E39] , “state”: “connected”, “characteristics”: [{“properties”: [“Read”], “isNotifying”: false, “characteristic”: “2A29”, “service”: “180A”}, {” properties “: [” Read “],” isNotifying “: false,” characteristic “:” 2A24 “,” service “:” 180A “}, {” properties “: [” Read “],” isNotifying “: false,” characteristic “:” 2A27 “,” service “:” 180A “}, {” properties “: [” Read “],” isNotifying “: false,” characteristic “:” 2A26 “,” service “:” 180A "}, {“properties”: [“WriteWithoutResponse”, “Write”], “isNotifying”: false, “characteristic”: “6E400002-B5A3-F393-E0A9-E50E24DCCA9E”, “service”: "6E400001-B5A3-F393-E0A9- E50E24DCCA9E “}, {” properties “: [” Notify “],” isNotifying “: false,” characteristic “:” 6E400003-B5A3-F393-E0A9-E50E24DCCA9E “,” service “:” 6E400001-B5A3-F393-E0A9- E50E24DCCA9E "}]}

What could this be about? I also welcome any kind of tips for implementing such a feature.

Otso replied:
Hey,

The reading of the tags is intended to be done so that the reader registers with the TX-characteristic notifications and the tag sends the notification when new data is available.

There seems to be an error in our documentation, it says that characteristic should also be read. I’m not quite sure if I’ll fix the documentation or make the characteristic readable in the next firmware version, but the quick solution is to receive that notification. I believe GitHub - don / cordova-plugin-ble-central: The Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap) is the right method for this.