[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/toholed.git</param>
<param name="branch">master</param>
- <param name="revision">405045a7fe85885b034e3bdf55cc5a02cc6456fd</param>
+ <param name="revision">f4df6a12829620fc9daed76af6b24a45cb6c76ad</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/.gitignore
^
|
@@ -0,0 +1,2 @@
+daemon/src/mceiface.cpp
+daemon/src/mceiface.h
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/.gitmodules
^
|
@@ -7,3 +7,6 @@
[submodule "daemon/3rdparty/libdsme"]
path = daemon/3rdparty/libdsme
url = https://github.com/nemomobile/libdsme.git
+[submodule "daemon\\3rdparty\\nemo-keepalive"]
+ path = daemon\\3rdparty\\nemo-keepalive
+ url = https://github.com/nemomobile/nemo-keepalive.git
|
[-]
[+]
|
Added |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/daemon/3rdparty/nemo-keepalive
^
|
+(directory)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/daemon/daemon.pro
^
|
@@ -7,6 +7,8 @@
LIBS += -lrt
+system(qdbusxml2cpp -p src/mceiface.h:src/mceiface.cpp 3rdparty/nemo-keepalive/lib/mceiface.xml)
+
target.path = /usr/bin/
systemd.path = /etc/systemd/system/
@@ -34,9 +36,11 @@
INSTALLS += target systemd udevrule dbusconf ambience images
INCLUDEPATH += \
+ ./src/ \
./3rdparty/libdsme/include/ \
./3rdparty/mce-dev/include/ \
- ./3rdparty/libiphb/src/
+ ./3rdparty/libiphb/src/ \
+ ./3rdparty/nemo-keepalive/lib/
SOURCES += \
@@ -53,7 +57,11 @@
src/derp.c \
3rdparty/libiphb/src/libiphb.c \
src/notificationmanager.cpp \
- src/updateTime.c
+ src/updateTime.c \
+ src/mceiface.cpp \
+ 3rdparty/nemo-keepalive/lib/backgroundactivity.cpp \
+ 3rdparty/nemo-keepalive/lib/backgroundactivity_p.cpp \
+ 3rdparty/nemo-keepalive/lib/heartbeat.cpp
HEADERS += \
3rdparty/libiphb/src/libiphb.h \
@@ -72,7 +80,11 @@
src/derp.h \
src/charger.h \
src/notificationmanager.h \
- src/updateTime.h
+ src/updateTime.h \
+ src/mceiface.h \
+ 3rdparty/nemo-keepalive/lib/backgroundactivity.h \
+ 3rdparty/nemo-keepalive/lib/backgroundactivity_p.h \
+ 3rdparty/nemo-keepalive/lib/heartbeat.h
OTHER_FILES += \
rpm/toholed.spec \
@@ -80,5 +92,6 @@
config/$${TARGET}.service \
config/95-$${TARGET}.rules \
ambience/harbour-ambience-toholed.ambience \
- ambience/images/harbour-ambience-toholed.jpg
+ ambience/images/harbour-ambience-toholed.jpg \
+ 3rdparty/nemo-keepalive/lib/mceiface.xml
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/daemon/src/toholed-dbus.cpp
^
|
@@ -37,11 +37,6 @@
#include <QColor>
#include <contextproperty.h>
-extern "C"
-{
- #include "iphbd/libiphb.h"
-}
-
static char screenBuffer[SCREENBUFFERSIZE] = { 0 };
@@ -86,29 +81,9 @@
blinkTimerCount = 0;
blinkNow = false;
- iphbRunning = false;
- iphbModeKeepAlive = false;
- iphbdHandler = iphb_open(0);
-
- if (!iphbdHandler)
- printf("Error opening iphb\n");
-
- iphb_fd = iphb_get_fd(iphbdHandler);
-
- iphbNotifier = new QSocketNotifier(iphb_fd, QSocketNotifier::Read);
-
- if (!QObject::connect(iphbNotifier, SIGNAL(activated(int)), this, SLOT(heartbeatReceived(int))))
- {
- delete iphbNotifier, iphbNotifier = 0;
- printf("failed to connect iphbNotifier\n");
- }
- else
- {
- iphbNotifier->setEnabled(false);
- }
-
- if (iphbNotifier)
- printf("iphb initialized succesfully\n");
+ activity = new BackgroundActivity(this);
+ connect(activity, SIGNAL(running()), this, SLOT(heartbeatReceived()));
+ activity->wait(BackgroundActivity::ThirtySeconds);
prevTime = QTime::currentTime();
@@ -134,9 +109,6 @@
enableOled();
setInterruptEnable(true);
- /* Update screen and start iphb */
- heartbeatReceived(0);
-
printf("initialisation complete\n");
getCurrentNetworkConnectionStates();
@@ -271,7 +243,7 @@
.arg(wifiPowered ? (wifiConnected ? 'W' : 'w') : ' ')
.arg(bluetoothPowered ? (bluetoothConnected ? 'B' : 'b') : ' ')
.arg((alarmsPresent && showAlarmsPresent) ? "A" : "")
- .arg(lastTemperature);
+ .arg(showCurrentTemperature ? lastTemperature : "");
drawSmallText(40, 50, tmp.toLocal8Bit().data(), screenBuffer);
}
}
@@ -286,7 +258,7 @@
printf("Time now: %s Battery: %s (%d)\n", baNow.data(), babatNow.data(), timerCount );
/* If we did not get temperature at start, don't retry ever */
- if (!lastTemperature.isEmpty())
+ if (!lastTemperature.isEmpty() && showCurrentTemperature)
lastTemperature = getCurrentTemperature();
}
@@ -305,71 +277,15 @@
}
-/* iphb wakeup stuff */
+/* nemo-keepalive wakeup stuff */
-void Toholed::heartbeatReceived(int sock)
+void Toholed::heartbeatReceived()
{
- Q_UNUSED(sock);
-
- iphbStop();
timerCount++;
updateDisplay();
- iphbStart();
-}
-
-void Toholed::iphbStart()
-{
- if (iphbRunning)
- return;
-
- if (!(iphbdHandler && iphbNotifier))
- {
- printf("iphbStart iphbHandler not ok\n");
- return;
- }
-
- time_t unixTime;
- if (iphbModeKeepAlive)
- unixTime = iphb_wait(iphbdHandler, 0, 1 , 0); /* This should keep the device ~alive */
- else
- unixTime = iphb_wait(iphbdHandler, 25, 35 , 0); /* ~30 SEC window for normal operation */
-
- if (unixTime == (time_t)-1)
- {
- printf("iphbStart timer failed\n");
- return;
- }
-
- iphbNotifier->setEnabled(true);
- iphbRunning = true;
-
-}
-
-void Toholed::iphbStop()
-{
- if (!iphbRunning)
- return;
-
- if (!(iphbdHandler && iphbNotifier))
- {
- printf("iphbStop iphbHandler not ok\n");
- return;
- }
-
- iphbNotifier->setEnabled(false);
-
- (void)iphb_discard_wakeups(iphbdHandler);
-
- iphbRunning = false;
-
-}
-
-void Toholed::iphbChangeMode(bool keepAlive)
-{
- iphbStop();
- iphbModeKeepAlive = keepAlive;
- iphbStart();
+ /* Wait for next 30 sec */
+ activity->wait();
}
/* DBus Exposed call methods */
@@ -390,6 +306,7 @@
displayOffWhenMainActive = settings.value("displayOffWhenMainActive", false).toBool();
analogClockFace = settings.value("analogClockFace", false).toBool();
showAlarmsPresent = settings.value("showAlarmsPresent", true).toBool();
+ showCurrentTemperature = settings.value("showCurrentTemperature", true).toBool();
settings.endGroup();
}
@@ -428,6 +345,7 @@
displayOffWhenMainActive = map.value("displayOffWhenMainActive", displayOffWhenMainActive).toBool();
analogClockFace = map.value("analogClockFace", analogClockFace ).toBool();
showAlarmsPresent = map.value("showAlarmsPresent", showAlarmsPresent ).toBool();
+ showCurrentTemperature = map.value("showCurrentTemperature", showCurrentTemperature).toBool();
ScreenCaptureOnProximity = map.value("ssp", ScreenCaptureOnProximity).toBool();
ScreenCaptureOnProximityStorePath = map.value("sspPath", ScreenCaptureOnProximityStorePath).toString();
@@ -441,6 +359,7 @@
settings.setValue("displayOffWhenMainActive", displayOffWhenMainActive);
settings.setValue("analogClockFace", analogClockFace);
settings.setValue("showAlarmsPresent", showAlarmsPresent);
+ settings.setValue("showCurrentTemperature", showCurrentTemperature);
settings.endGroup();
if (proximityEnabled || alsEnabled)
@@ -1273,10 +1192,12 @@
void Toholed::blinkTimerTimeout( )
{
+ activity->setState(BackgroundActivity::Running);
+
if (!oledInitDone || !blinkOnNotification)
{
blinkTimer->stop();
- iphbChangeMode(false);
+ activity->wait();
return;
}
@@ -1297,12 +1218,9 @@
if (blinkTimerCount <= 0 && !blinkNow)
{
blinkTimer->stop();
- iphbChangeMode(false);
+ activity->wait();
return;
}
-
- if (!iphbModeKeepAlive)
- iphbChangeMode(true);
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/daemon/src/toholed-dbus.h
^
|
@@ -16,11 +16,7 @@
#define SERVICE_NAME "com.kimmoli.toholed"
#define DRAWINGMODELOCKTIMEOUT (30000)
-extern "C"
-{
- #include "iphbd/libiphb.h"
-}
-
+#include "backgroundactivity.h"
/* main class */
@@ -35,12 +31,7 @@
~Toholed()
{
/* Disable everything */
-
- if(iphbdHandler)
- (void)iphb_close(iphbdHandler);
-
- if(iphbNotifier)
- delete iphbNotifier;
+ delete(activity);
setInterruptEnable(false);
deinitOled();
@@ -102,10 +93,7 @@
void blinkTimerTimeout( );
void notificationSend(QString summary, QString body);
- void heartbeatReceived(int sock);
- void iphbStop();
- void iphbStart();
- void iphbChangeMode(bool keepAlive = false);
+ void heartbeatReceived();
private:
QThread *thread;
@@ -135,12 +123,6 @@
QMutex mutex;
- iphb_t iphbdHandler;
- int iphb_fd;
- QSocketNotifier *iphbNotifier;
- bool iphbRunning;
- bool iphbModeKeepAlive;
-
int gpio_fd;
int proximity_fd;
@@ -161,6 +143,7 @@
bool displayOffWhenMainActive;
bool analogClockFace;
bool showAlarmsPresent;
+ bool showCurrentTemperature;
QString getCurrentProfile();
void getCurrentNetworkConnectionStates();
@@ -188,6 +171,8 @@
QString getCurrentTemperature();
QString lastTemperature;
+
+ BackgroundActivity *activity;
};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/settings-ui/qml/pages/SettingsPage.qml
^
|
@@ -165,6 +165,18 @@
}
}
+ TextSwitch
+ {
+ text: "Show current temperature"
+ description: "Show temperature of current location"
+ checked: tohosettings.showCurrentTemperature
+ automaticCheck: false
+ onClicked:
+ {
+ tohosettings.showCurrentTemperature = !tohosettings.showCurrentTemperature
+ tohosettings.writeSettings("showCurrentTemperature", tohosettings.showCurrentTemperature)
+ }
+ }
SectionHeader
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/settings-ui/src/tohosettings.cpp
^
|
@@ -73,6 +73,7 @@
m_displayOffWhenMainActive = settings.value("displayOffWhenMainActive", false).toBool();
m_analogClockFace = settings.value("analogClockFace", false).toBool();
m_showAlarmsPresent = settings.value("showAlarmsPresent", true).toBool();
+ m_showCurrentTemperature = settings.value("showCurrentTemperature", true).toBool();
settings.endGroup();
emit blinkChanged();
@@ -82,6 +83,7 @@
emit displayOffWhenMainActiveChanged();
emit analogClockFaceChanged();
emit showAlarmsPresentChanged();
+ emit showCurrentTemperatureChanged();
}
TohoSettings::~TohoSettings()
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-toholed-0.4.8.tar.bz2/settings-ui/src/tohosettings.h
^
|
@@ -25,7 +25,7 @@
Q_PROPERTY(bool displayOffWhenMainActive READ readDisplayOffWhenMainActive WRITE writeDisplayOffWhenMainActive NOTIFY displayOffWhenMainActiveChanged())
Q_PROPERTY(bool analogClockFace READ readAnalogClockFace WRITE writeAnalogClockFace NOTIFY analogClockFaceChanged())
Q_PROPERTY(bool showAlarmsPresent READ readShowAlarmsPresent WRITE writeShowAlarmsPresent NOTIFY showAlarmsPresentChanged())
-
+ Q_PROPERTY(bool showCurrentTemperature READ readShowCurrentTemperature WRITE writeShowCurrentTemperature NOTIFY showCurrentTemperatureChanged())
public:
explicit TohoSettings(QObject *parent = 0);
@@ -40,6 +40,7 @@
void writeDisplayOffWhenMainActive(bool x) { m_displayOffWhenMainActive = x; emit displayOffWhenMainActiveChanged(); }
void writeAnalogClockFace(bool x) { m_analogClockFace = x; emit analogClockFaceChanged(); }
void writeShowAlarmsPresent(bool x) { m_showAlarmsPresent = x; emit showAlarmsPresentChanged(); }
+ void writeShowCurrentTemperature(bool x) { m_showCurrentTemperature = x; emit showCurrentTemperatureChanged(); }
bool readBlink() { return m_blink; }
bool readAls() { return m_als; }
@@ -48,6 +49,7 @@
bool readDisplayOffWhenMainActive() { return m_displayOffWhenMainActive; }
bool readAnalogClockFace() { return m_analogClockFace; }
bool readShowAlarmsPresent() { return m_showAlarmsPresent; }
+ bool readShowCurrentTemperature() { return m_showCurrentTemperature; }
Q_INVOKABLE void readSettings();
Q_INVOKABLE void writeSettings(QString key, bool value);
@@ -68,6 +70,7 @@
void displayOffWhenMainActiveChanged();
void analogClockFaceChanged();
void showAlarmsPresentChanged();
+ void showCurrentTemperatureChanged();
void screenShotChanged();
private:
@@ -78,6 +81,7 @@
bool m_displayOffWhenMainActive;
bool m_analogClockFace;
bool m_showAlarmsPresent;
+ bool m_showCurrentTemperature;
};
|