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