aboutsummaryrefslogtreecommitdiff
path: root/smartpensyncer.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2023-08-27 15:44:20 +0200
committerJavier <dev.git@javispedro.com>2023-08-27 15:44:20 +0200
commit6b6886fa47c112ddcd89fc32bfa7fe6949962cc3 (patch)
tree61d034ef21f56e66a877fb1a909da4196751b1e8 /smartpensyncer.cc
parentd6f25f86527b74022b9d425d1a126b4f9154e1a0 (diff)
downloadscribiu-6b6886fa47c112ddcd89fc32bfa7fe6949962cc3.tar.gz
scribiu-6b6886fa47c112ddcd89fc32bfa7fe6949962cc3.zip
add support for syncing pens with no name
Diffstat (limited to 'smartpensyncer.cc')
-rw-r--r--smartpensyncer.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/smartpensyncer.cc b/smartpensyncer.cc
index 794b7c5..3556f77 100644
--- a/smartpensyncer.cc
+++ b/smartpensyncer.cc
@@ -181,6 +181,12 @@ void SmartpenSyncer::run()
_penName = _pen->getPenName();
qDebug() << "got pen name:" << _penName;
+
+ if (_penName.isEmpty()) {
+ _penName = _pen->getPenSerial();
+ qDebug() << "pen with no name, using pen serial instead:" << _penName;
+ }
+
emit gotPenName(_penName);
QVariantMap penInfo = _pen->getPenInfo();
@@ -222,11 +228,11 @@ bool SmartpenSyncer::syncPen()
// Get the current user time offset from the pen
// and store it so that we have it even when the pen is offline
TimestampFile userTimeFile(_penDataDir.filePath(PEN_USER_TIME_FILE));
- Smartpen::PenTime userTime = _pen->getPenTime(Smartpen::PenUserTime);
+ Smartpen::PenTime userTime = _pen->getPenTime(Smartpen::Parameter::UserTime);
userTimeFile.set(userTime);
qDebug() << "pen time base:" << userTime << Smartpen::fromPenTime(userTime, 0);
- Smartpen::PenTime penTime = _pen->getPenTime(Smartpen::PenRtcTime);
+ Smartpen::PenTime penTime = _pen->getPenTime(Smartpen::Parameter::RtcTime);
qDebug() << "pen current time:" << penTime << Smartpen::fromPenTime(userTime, penTime);
// Read when is the last time we synchronized with this pen (in PenTime, not user time)