-
While Web BLE is simply genius when it comes to ease of using pre-built development tools, I want to build a 'server' side app/tool to suck up all data from my Bangle watch. Web BLE's valid https cert requirement is really getting in the way at the moment for me.
I just want a Node console application that connects to my Bangle JS and pulls existing files (created by my BangleJS App on the watch).
I saw the example of using Puck.js over Web BLE, can I do something like that without Web BLE? Say I pair my watch with my laptop, can I use simple NodeJS to pull files over Bluetooth? Any guidance is appreciated. It need not be Bangle JS specific, any Espruino sample will do.
Cheers
-
-
-
-
@user71255 were you wearing the watch on your wrist or did you hold up to the open sky for a bit? Not trolling, wondering if the gps receiver works under a jacket sleeve or does it need line clear line of sight. I held it against the train-window for a couple of minutes just now and it did find a fix. Will try the 'jacket sleeve' experiment tonight when cycling back home.
Having tried to build a Pi+Adafruit GPS module in the past and given up realising it needs line of sight to work (or external antenna), I am very stoked at what Bangle can do :-)
-
@Gordon that is a nice trick. It seems Typescript now has the ability to generate TypeDefinition stubs from JsDocs... I'll give it a go and update here.
My progress has been slowed down due to other hobby distractions, please bear with me :-)
-
@Dutch_Peter whatever works. This thread is for bringing forward experiences/issues using Typescript to develop BangleJS apps in particular which can be expanded to Espruino in general.
I am halfway through Type definition of Bangle API. Still wondering if I should takeup the challenge of updating the entire Espruino type definition. It is a bit of Yak shaving I rather not get stuck in. I want to have a Bangle JS App ready rather quickly.
The TS quickstart project I referred to (above) has a lot of Espruino specific steps that actually sets you up well for Espruino devices. I'll try and adapt it to Bangle as far as possible.
I am not rewriting anything in Typescript, rather I am just creating Type definitions for existing APIs to help use TS to write Espruino code.
I am pretty sure the TS compiler/transpiler generates better JS code than I can hope to write. For those who can write better JS code directly, rock on folks!
-
@parasquid I am an Espruino noob, so I can't speak for the type definition referred to in this post -> https://www.espruino.com/Typescript+and+Visual+Studio+Code+IDE
I have a fork of the quickstart here but I still haven't managed to get all bits running without errors. Atleast it has all dependencies upgraded and latest version of Gulp.
I am not going to mess up the Espruino type definition in DefinitelyTyped unless someone files a bug for it. But you probably need to dig into the
node_modules\@types\espruino\index.d.ts
and comment out line number 3692 that saysdeclare var global: any;
The variable 'global' conflicts with another one in node.d.ts I believe.
I think I'll start a self contained repository for the BangleJS typedef and slowly get familiar with Espruino myself. I'll post updates here.Cheers.
-
How vibrant is the Typescript + Espruino community? I see a "getting started" and a type definition for Espruino but it is fairly outdated. Attempting to update the repo gets stuck in use of the
var global
property in Espruino's type definition. I believe it conflicts with Node's own Type definitions.I am planning to hack together something to get TypeScript and BangleJS working. If more people are interested I will try to be clean enough to be able to push it to DefinitelyTyped repository.
Cheers.
-
@Robin and @allObjects thank you for all the tips, but guess what 'fixed' it? Merging the latest upstream from espruino/BangleApps repo into my fork and redeploying (almost) the same code. I will dig into the changeset and see if I can spot what changed.
Couple of points though:
E.on('init'...) : I am not sure Bangle Apps fall in this category, because I am guessing Bangle HW on init, start the firmware first and not the App (not my App anyway).
IIFE - I deserve no credit for getting that to work, I was simply copying a pattern from the most basic clock App in the Repo.
H/w - @allObjects I was just too impatient to wait 3 months, I want to dump my Fitbit as soon as possible, I backed the Beta Unit, so I am developing on device.
Thanks again.
-
@allObjects thanks for the tip. Any sample code I can look at?
My code is here
https://github.com/piofthings/BangleApps/blob/master/apps/fitclck/fit-clock.js
It is just a copy of the
morph-clock.js
app with some minor mods. -
When I upload my code from the WebIDE it has access to BTN1, 2 and 3 and the code responds correctly. However when I check in my code to Github and deploy it via my Bangle.js loader, it only responds to BTN3. BTN2 brings up Settings App and BTN1 doesn't respond at all.
Is there a way to override the Settings app when my clock app is on ?
-
Okay, though I marked it resolved, it is still a bit flaky but I've found two tricks
Keep the WebIDE connected on one browser tab, and use the other browser tab to upload from Github then even if you do a hard refresh, the Connect button will still show the Bangle watch because the WebIDE is paired in the other window
If Web BLE (Chrome fails to find your watch and connect) Go to "Make connectable" setting on Bangle's Setting app, select "no" and press middle button (BTN2). Then select "Make connectable" again and set it back to "yes" and press middle button. This avoids a reboot.
-
@Gordon Thanks for the pointers, I was able to write heart rates to a file and read them back. Onwards and upwards, now to send it back to the computer :-)
-
Ever since I wrote this post, connection has been stable and Chromium has been able to find the watch on request. :D :D :D
@Gordon to answer you question
Earlier, it wouldn't find the watch in Chromium's BLE connection dialog (until reboot).Currently I have the
Programmable
:On
,Bluetooth
:On
andHID
:off
.(in other news I have now called storage.eraseAll() once and have (since) managed to revive my Bangle :D...)
-
This is likely a very local issue with my environment, just chucking it out to see if anyone else has had it.
I am running Chromium on OSX and my Web BLE connects reliably if I have just restarted BangleJS. After that, I deploy an App, run the app, then want to make tweaks, so I commit change to Github, hit refresh on the github.io page for my Apps, and the connection is lost. So far so good. Now when I say pair again, it hardly ever connects to BangleJS the second time (the device isn't listed as available in the pairing window). This is irrespective of whether I have crashed my app or not.I have to go into the Setup app, turn Bangle off, turn it back on, and it detects and connects again.
Again, very likely, a local environment issue, but has anyone else encountered this out in the wild?
I'll test on Raspberry Pi later and see if I have the same issue. Could just be my Chromium build.
-
-
Hah! Found the manual page :-) http://www.espruino.com/Reference#Storage
I'll go away now and read up :-)
-
Hi Team, just got my BangleJS Beta unit today and starting poking around Espruino for the first time.
Any way a Bangle app can save values to a temporary storage on the watch. I realise this might be fairly limited. But I am looking for a mode where the watch stores stuff on device and sends them off to another connected device.
Basically I want continuous heart-rate monitoring (as efficiently as possible)... but there isn't much point in continuous monitoring if I can't save all the data.
Hope this makes sense. Please feel to do a "RTFM" but just give me a page number to look at :D
-
Just after posting, I find this... https://github.com/noble/noble
I am going to see if I can connect to my Bangle using this and build a nice bridge.