From 6b6886fa47c112ddcd89fc32bfa7fe6949962cc3 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 27 Aug 2023 15:44:20 +0200 Subject: add support for syncing pens with no name --- smartpensyncer.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'smartpensyncer.cc') 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) -- cgit v1.2.3