Pebble: Pass datalog creation timestamp to PebbleKit, properly announce PebbleKit datalogging support
This commit is contained in:
parent
946ed5f000
commit
ad9cfae6f9
|
@ -58,17 +58,17 @@ public class PebbleContentProvider extends ContentProvider {
|
|||
if (uri.equals(CONTENT_URI)) {
|
||||
MatrixCursor mc = new MatrixCursor(columnNames);
|
||||
int connected = 0;
|
||||
int appMessage = 0;
|
||||
int pebbleKit = 0;
|
||||
Prefs prefs = GBApplication.getPrefs();
|
||||
if (prefs.getBoolean("pebble_enable_pebblekit", false)) {
|
||||
appMessage = 1;
|
||||
pebbleKit = 1;
|
||||
}
|
||||
String fwString = "unknown";
|
||||
if (mGBDevice != null && mGBDevice.getType() == DeviceType.PEBBLE && mGBDevice.isInitialized()) {
|
||||
connected = 1;
|
||||
fwString = mGBDevice.getFirmwareVersion();
|
||||
}
|
||||
mc.addRow(new Object[]{connected, appMessage, 0, 3, 8, 2, fwString});
|
||||
mc.addRow(new Object[]{connected, pebbleKit, pebbleKit, 3, 8, 2, fwString});
|
||||
|
||||
return mc;
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ public class GBDeviceEventDataLogging extends GBDeviceEvent {
|
|||
|
||||
public int command;
|
||||
public UUID appUUID;
|
||||
public long timestamp;
|
||||
public long tag;
|
||||
public byte pebbleDataType;
|
||||
public Object data;
|
||||
|
|
|
@ -17,12 +17,14 @@ class DatalogSession {
|
|||
final UUID uuid;
|
||||
final byte itemType;
|
||||
final short itemSize;
|
||||
final int timestamp;
|
||||
String taginfo = "(unknown)";
|
||||
|
||||
DatalogSession(byte id, UUID uuid, int tag, byte itemType, short itemSize) {
|
||||
DatalogSession(byte id, UUID uuid, int timestamp, int tag, byte itemType, short itemSize) {
|
||||
this.id = id;
|
||||
this.tag = tag;
|
||||
this.uuid = uuid;
|
||||
this.timestamp = timestamp;
|
||||
this.itemType = itemType;
|
||||
this.itemSize = itemSize;
|
||||
}
|
||||
|
@ -62,6 +64,7 @@ class DatalogSession {
|
|||
|
||||
dataLogging.command = GBDeviceEventDataLogging.COMMAND_RECEIVE_DATA;
|
||||
dataLogging.appUUID = uuid;
|
||||
dataLogging.timestamp = timestamp & 0xffffffffL;
|
||||
dataLogging.tag = tag;
|
||||
dataLogging.pebbleDataType = itemType;
|
||||
gbDeviceEvents[i] = dataLogging;
|
||||
|
|
|
@ -13,8 +13,8 @@ class DatalogSessionHealthHR extends DatalogSessionPebbleHealth {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatalogSessionHealthHR.class);
|
||||
|
||||
DatalogSessionHealthHR(byte id, UUID uuid, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, tag, item_type, item_size, device);
|
||||
DatalogSessionHealthHR(byte id, UUID uuid, int timestamp, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, item_type, item_size, device);
|
||||
taginfo = "(Health - HR " + tag + " )";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class DatalogSessionHealthOverlayData extends DatalogSessionPebbleHealth {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatalogSessionHealthOverlayData.class);
|
||||
|
||||
public DatalogSessionHealthOverlayData(byte id, UUID uuid, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, tag, item_type, item_size, device);
|
||||
DatalogSessionHealthOverlayData(byte id, UUID uuid, int timestamp, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, item_type, item_size, device);
|
||||
taginfo = "(Health - overlay data " + tag + " )";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ class DatalogSessionHealthSleep extends DatalogSessionPebbleHealth {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatalogSessionHealthSleep.class);
|
||||
|
||||
public DatalogSessionHealthSleep(byte id, UUID uuid, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, tag, item_type, item_size, device);
|
||||
DatalogSessionHealthSleep(byte id, UUID uuid, int timestamp, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, item_type, item_size, device);
|
||||
taginfo = "(Health - sleep " + tag + " )";
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ class DatalogSessionHealthSteps extends DatalogSessionPebbleHealth {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DatalogSessionHealthSteps.class);
|
||||
|
||||
public DatalogSessionHealthSteps(byte id, UUID uuid, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, tag, item_type, item_size, device);
|
||||
DatalogSessionHealthSteps(byte id, UUID uuid, int timestamp, int tag, byte item_type, short item_size, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, item_type, item_size, device);
|
||||
taginfo = "(Health - steps)";
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ abstract class DatalogSessionPebbleHealth extends DatalogSession {
|
|||
|
||||
private final GBDevice mDevice;
|
||||
|
||||
DatalogSessionPebbleHealth(byte id, UUID uuid, int tag, byte itemType, short itemSize, GBDevice device) {
|
||||
super(id, uuid, tag, itemType, itemSize);
|
||||
DatalogSessionPebbleHealth(byte id, UUID uuid, int timestamp, int tag, byte itemType, short itemSize, GBDevice device) {
|
||||
super(id, uuid, timestamp, tag, itemType, itemSize);
|
||||
mDevice = device;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class PebbleKitSupport {
|
|||
|
||||
void sendDataLoggingIntent(GBDeviceEventDataLogging dataLogging) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("data_log_timestamp", System.currentTimeMillis() / 1000); // is this data really not present in data from watch?!
|
||||
intent.putExtra("data_log_timestamp", dataLogging.timestamp);
|
||||
intent.putExtra("uuid", dataLogging.appUUID);
|
||||
intent.putExtra("data_log_uuid", dataLogging.appUUID); // Is that really the same?
|
||||
intent.putExtra("data_log_tag", dataLogging.tag);
|
||||
|
|
|
@ -2248,15 +2248,15 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
|||
LOG.info("DATALOG OPENSESSION. id=" + (id & 0xff) + ", App UUID=" + uuid.toString() + ", log_tag=" + log_tag + ", item_type=" + item_type + ", itemSize=" + item_size);
|
||||
if (!mDatalogSessions.containsKey(id)) {
|
||||
if (uuid.equals(UUID_ZERO) && log_tag == 81) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSteps(id, uuid, log_tag, item_type, item_size, getDevice()));
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSteps(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else if (uuid.equals(UUID_ZERO) && log_tag == 83) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSleep(id, uuid, log_tag, item_type, item_size, getDevice()));
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthSleep(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else if (uuid.equals(UUID_ZERO) && log_tag == 84) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthOverlayData(id, uuid, log_tag, item_type, item_size, getDevice()));
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthOverlayData(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else if (uuid.equals(UUID_ZERO) && log_tag == 85) {
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthHR(id, uuid, log_tag, item_type, item_size, getDevice()));
|
||||
mDatalogSessions.put(id, new DatalogSessionHealthHR(id, uuid, timestamp, log_tag, item_type, item_size, getDevice()));
|
||||
} else {
|
||||
mDatalogSessions.put(id, new DatalogSession(id, uuid, log_tag, item_type, item_size));
|
||||
mDatalogSessions.put(id, new DatalogSession(id, uuid, timestamp, log_tag, item_type, item_size));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue