1

I am trying to develop a React Native based application that collects sensor data from Movesense Sensor.

One of the guides I am referencing to is https://github.com/tugberka/react-native-mds this repo. (as suggested in the development document)

I was just wondering if this repo is compatible with the latest SDK version and will there be example code coming?

Saewon Kye
  • 13
  • 3
  • Current symptoms that I am having is... I was able to build the project with Movesense library and import MDS object. When I call "scan" function with console.log of address and name on "componentDidMount" function, it's not showing any device. The Movesense device was right next to my phone and it does blink a red light. – Saewon Kye Aug 11 '21 at 08:12
  • It should be compatible. In android devices the scan functionality requires that the app is given Location permission, or the scan will not return any devices. – PetriL Aug 11 '21 at 11:28
  • I am testing on ios and have given bluetooth and location (just in case) permission. The way I am looking for scanned devices is logging the name and address as a call back to scan function. Is this not the correct way to view the scanned devices? – Saewon Kye Aug 11 '21 at 12:31
  • I'm not familiar with iOS & react-native, but typically that is the way. If you are able to see some other BLE devices in the scan responses, then the issue may be that some other software / phone has connected to the same sensor so it is no longer advertising nor available. – PetriL Aug 13 '21 at 10:40
  • I was not able to see other BLE devices during the scan process. When I used other ble library for scanning, I was able to see other ble devices, but not when I used Movesense mobile lib. Maybe I have implemented the code incorrectly. – Saewon Kye Aug 13 '21 at 13:20
  • If you have acomlished something I would love to see it! I'm getting very tired with this, I get all the services but all of them with no names or whatever. I'm using react-native-ble-plx as well. – Carlos Saiz Orteu Sep 12 '21 at 02:44
  • @CarlosSaizOrteu I have something working using "react-native-ble-manager" package. I have updated my movesense device with (https://bitbucket.org/suunto/movesense-device-lib/src/master/samples/gatt_sensordata_app/) this DFU package. I will try to clean up some code and share the code with you this weekend. – Saewon Kye Sep 14 '21 at 00:06
  • FYI, when using react-native-ble-manager package you should use react-native project not ejected expo project. – Saewon Kye Sep 14 '21 at 00:06
  • That would be great mate! Thanks very much!@SaewonKye – Carlos Saiz Orteu Sep 17 '21 at 11:20
  • @CarlosSaizOrteu I am sorry it took too long to share the code. I will be working on the documentation of the project in later date, but I wanted to share the code with you sooner. "https://github.com/kyesw/movesense-react-native" Check out this link and let me know if you have questions. FYI, you have to update your movesense device with "Movesense-gatt_sensordata_app_w_bootloader.zip" package that I have included in the repo. – Saewon Kye Sep 25 '21 at 16:08
  • @SaewonKye Hey that is great! Thanks very much! Can I ask you were did you get the uid's to know what is the service that they are linked to? Again, thank very much! – Carlos Saiz Orteu Sep 28 '21 at 08:37
  • @CarlosSaizOrteu You can find out uid's by discovering services of the device. However, if you update your device's DFU with the "Movesense-gatt_sensordata_app_w_bootloader.zip", you can use the same uid in my repo – Saewon Kye Sep 29 '21 at 03:59
  • @SaewonKye I mean where did you get the information to know those concrets uidd are related to let's say "heart rate" service for example. The question is how to know a uuid is related to x service. Example: 12243e7676 --> heart beat – Carlos Saiz Orteu Sep 29 '21 at 08:52
  • This is the code associated with the DFU I have used. `https://bitbucket.org/suunto/movesense-device-lib/src/master/samples/gatt_sensordata_app/web_client/index.html` Because I only needed accelerometer, the project was enough for me. If want you want to use "heart beat" service, I believe you should search for other project. Hope this helps. – Saewon Kye Sep 30 '21 at 00:22

1 Answers1

1

Have you checked out the gatt sensordata app example from Movesense bitbucket (https://bitbucket.org/suunto/movesense-device-lib/src/master/samples/gatt_sensordata_app/)? By using this example firmware you could create a React Native app without the need to use MDS libraries.

In web_client/index.html you can see javascript example how to parse data if you want to use this firmware.

analog
  • 38
  • 4
  • As you have suggested, I have used react-native-ble-plx library to connect to the sensor. However, I can only discover four services (device info, battery info, unknown, heart rate related). Am I getting the services correctly? – Saewon Kye Aug 11 '21 at 15:08
  • Did you manage to update the firmware to the sensor? If you have the aforementioned firmware on the sensor, then the services should be correct. – analog Aug 11 '21 at 16:56
  • When I checked the version of the sensor core through Movesense app available in AppStore, the version is displayed as 2.0. Do I still need to update the firmware? – Saewon Kye Aug 12 '21 at 00:14
  • Just to clarify, I have to convert dataResource API string ("/Meas/Acc/58") to Unit8Array and write those values to a device. Then, the device will return a characteristic which I have to monitor for notification. Did I understand the process correctly? – Saewon Kye Aug 12 '21 at 05:54
  • If you want to use the gatt sensordata app example from bitbucket, first you must build it following these instructions (https://www.movesense.com/docs/test_env/esw2preview/tools/). After you have successfully built it, update the firmware on the sensor (http://www.movesense.com/docs/esw/dfu_update/) – analog Aug 12 '21 at 07:16
  • You can also get all the samples as DFU package from movesense-device-lib bitbucket under samples/bin, no need to build them unless you want to modify something. – PetriL Aug 13 '21 at 10:38
  • Thank you both for such a kind instructions. I will try updating the core with sample DFU packages. – Saewon Kye Aug 13 '21 at 11:38
  • Thanks to your guides, I was able to update DFU package. I am currently subscribing to notifiable characteristic. I still did not manage to write "hello" to the device. However, there is a message coming in when I disconnect the sensor. Does this mean that I am currently in right notification characteristic but not writing to the device correctly? – Saewon Kye Aug 13 '21 at 13:18
  • @SaewonKye I don't think that it is a notification you are getting when you are disconnecting from the sensor, maybe it's a callback from the bluetooth module you are using? Did you look at this example https://bitbucket.org/suunto/movesense-device-lib/src/master/samples/gatt_sensordata_app/web_client/index.html ? It could provide some help here. – analog Aug 17 '21 at 05:28
  • Hello command which is sent to the sensor in the example -> let helloCmd = new Uint8Array([0, 123]); – analog Aug 17 '21 at 05:31
  • I know it's been quite a while but I was able to figure out thanks to you guys. As it turns out the package that I was using did not support uint8array communication. Rather than customizing the DFU package, I changed my ble package for react native. Once again thanks so much. – Saewon Kye Sep 14 '21 at 00:09