• Hi,

    We are building a mobile application as part of our study project. We are using this app to connect to BangleJS and read the activity data and show data on graphically.

    What we have done so far:

    1. Storing activity data in a file on BangleJS
    2. Created a mobile app(used reactnative) to connect to bangleJS

    Now, I am looking for a way to push activity data file from bangleJS to mobile app. Is there any straightforward way?

    Thanks,
    Sachin

  • This is what the IDE Is using to connect to the bangle and download a file. Maybe the app will have to talk to bangle a bit, to respond with a connection request after the bangle initiates ??. Im not sure if it matters who initiates the connection, need further advice. Essentially its just reading a file and everything that it prints out, is the file contents, which gets sent over the serial/Uart.

    Espruino.Core.Utils.executeStatement(`(f­unction(filename) {
      var f = require("Storage").open(filename,"r");
      var d = f.read(INSERT_CHUNK_SIZE_HERE);
      while (d!==undefined) {
        console.log(btoa(d));
        d = f.read(INSERT_CHUNK_SIZE_HERE);
      }
    })(INSERT_FILE_NAME_HERE);`
    
  • Would react native have access to Web Bluetooth? If so you could just include the puck.js library from http://www.espruino.com/Web+Bluetooth and do pretty much as above. There's an example in the Bangle.js app loader doing exactly that: https://github.com/espruino/BangleApps/b­lob/master/js/comms.js#L247

    Otherwise you'd have to use whatever Bluetooth LE library React Native gives you I guess, and then implement what the puck.js library does (Connect to Nordic UART via bluetooth LE, and split any writes into 20 byte chunks) - but that's not too difficult really

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

File transfer over BLE to smart phone or other devices

Posted by Avatar for Sacs @Sacs

Actions