mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 05:16:51 +01:00
Merge branch 'master' of https://codeberg.org/Freeyourgadget/Gadgetbridge
This commit is contained in:
commit
a700f98bb7
@ -32,9 +32,10 @@ import java.io.IOException;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.TimeZone;
|
import java.util.SimpleTimeZone;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
||||||
@ -55,6 +56,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSuppo
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(BangleJSDeviceSupport.class);
|
private static final Logger LOG = LoggerFactory.getLogger(BangleJSDeviceSupport.class);
|
||||||
@ -81,7 +83,10 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
builder.notify(rxCharacteristic, true);
|
builder.notify(rxCharacteristic, true);
|
||||||
|
|
||||||
uartTx(builder, " \u0003"); // clear active line
|
uartTx(builder, " \u0003"); // clear active line
|
||||||
setTime(builder);
|
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
if (prefs.getBoolean("datetime_synconconnect", true))
|
||||||
|
setTime(builder);
|
||||||
//sendSettings(builder);
|
//sendSettings(builder);
|
||||||
|
|
||||||
// get version
|
// get version
|
||||||
@ -234,7 +239,15 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
|
|
||||||
void setTime(TransactionBuilder builder) {
|
void setTime(TransactionBuilder builder) {
|
||||||
uartTx(builder, "\u0010setTime("+(System.currentTimeMillis()/1000)+");E.setTimeZone("+(TimeZone.getDefault().getRawOffset()/3600000)+");\n");
|
long ts = System.currentTimeMillis();
|
||||||
|
float tz = SimpleTimeZone.getDefault().getOffset(ts) / (1000 * 60 * 60.0f);
|
||||||
|
// set time
|
||||||
|
String cmd = "\u0010setTime("+(ts/1000)+");";
|
||||||
|
// set timezone
|
||||||
|
cmd += "E.setTimeZone("+tz+");";
|
||||||
|
// write timezone to settings
|
||||||
|
cmd += "(s=>{s&&(s.timezone="+tz+")&&require('Storage').write('setting.json',s);})(require('Storage').readJSON('setting.json',1))";
|
||||||
|
uartTx(builder, cmd+"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user