blob: 8026e15ecfd8bdac2723c73441bc58557a48ecac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include "datalogmanager.h"
#include "unpacker.h"
DataLogManager::DataLogManager(WatchConnector *watch, QObject *parent) :
QObject(parent), watch(watch)
{
watch->setEndpointHandler(WatchConnector::watchDATA_LOGGING, [this](const QByteArray& data) {
if (data.size() < 2) {
logger()->warn() << "small data_logging packet";
return false;
}
const char command = data[0];
const int session = data[1];
switch (command) {
case WatchConnector::datalogOPEN:
logger()->debug() << "open datalog session" << session;
return true;
case WatchConnector::datalogCLOSE:
logger()->debug() << "close datalog session" << session;
return true;
case WatchConnector::datalogTIMEOUT:
logger()->debug() << "timeout datalog session" << session;
return true;
case WatchConnector::datalogDATA:
handleDataCommand(session, data.mid(2));
return true;
default:
return false;
}
});
}
void DataLogManager::handleDataCommand(int session, const QByteArray &data)
{
Unpacker u(data);
// TODO Seemingly related to analytics, so not important.
logger()->debug() << "got datalog data" << session << data.size();
}
|