06-29-2019 14:56
06-29-2019 14:56
Hello. At the beginning I will say that I am a fresh Fitbit Ionic user and a studio application.
I started to create "clock face" for myself and I have small problems because I could not understand some of the entries from the API documentation.
My personal clockwork has the background I have taken (uploaded photo) and shows the time.
I do not know what I'm doing wrong, but I can not program the following things:
- date (day, month, year)
- heart rate measurement
- and most importantly, or the battery indicator.
Below is my current code:
app/index.js
import document from "document";
import clock from "clock";
/* --------- CLOCK ---------- */
let myClock = document.getElementById("myClock");
clock.granularity = 'seconds'; // seconds, minutes, hours
clock.ontick = function(evt) {
myClock.text = ("0" + evt.date.getHours()).slice(-2) + ":" +
("0" + evt.date.getMinutes()).slice(-2) + ":" +
("0" + evt.date.getSeconds()).slice(-2);
};
import { battery } from "power";
console.log(Math.floor(battery.chargeLevel) + "%");
import { charger } from "power";
console.log("The charger " + (charger.connected ? "is" : "is not") + " connected");
resources/index.gui
<svg> <image href="monika.jpg" /> <text id="myClock" class="time"> </text> </svg>
resources/styles.css
.time{
x: 50%;
y: 50%+15;
fill: white;
font-size: 80;
font-family: Colfax-Black;
text-anchor: middle;
text-length: 10;
}resources/widget.gui
<svg>
<defs>
<link rel="stylesheet" href="styles.css" />
<link rel="import" href="/mnt/sysassets/widgets_common.gui" />
</defs>
</svg>What do I need to add to this code? I am waiting for advice, best regards.