summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-07-25 09:30:45 +0900
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>2018-07-25 01:49:54 +0000
commit22c2b46a500e962c82adcb1b0a24f5cbda779396 (patch)
treea1ae08b7b36c7514fb24353e428e00eaea072069
parentee731717ecd5453163aae3ec1efac664139f914e (diff)
Update agl-service-windowmanager-2017flounder_5.99.2flounder/5.99.25.99.2
This commit includes followings e4fcbf1 Fix the race condition of HomeScreen 2796f54 Remove useless functions 320122b Fix XDG application shrinks f25e251 Fix timer c6f9a9b Revert "Add PolicyManager as plugin" e4222ca Revert "Add policy table generated by ZIPC for EXAMPLE" 67f414f Add policy table generated by ZIPC for EXAMPLE 99b6f4d Add PolicyManager as plugin Change-Id: Ied0fe9841daa71897e86b3639822877b2b1fab9f Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r--meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017/agl-service-windowmanager-2017_git.bb2
1 files changed, 1 insertions, 1 deletions
diff --git a/meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017/agl-service-windowmanager-2017_git.bb b/meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017/agl-service-windowmanager-2017_git.bb
index 0db2dccc..da490198 100644
--- a/meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017/agl-service-windowmanager-2017_git.bb
+++ b/meta-hmi-framework/recipes-graphics/agl-service-windowmanager-2017/agl-service-windowmanager-2017_git.bb
@@ -15,7 +15,7 @@ DEPENDS = "af-binder json-c wayland wayland-ivi-extension wayland-native"
inherit cmake aglwgt
SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/agl-service-windowmanager-2017;protocol=https;branch=${AGL_BRANCH}"
-SRCREV = "f25e25114ab2ef7e3019bfe4ff9b65ff93c41b90"
+SRCREV = "e4fcbf1b100ec2d926f7fbba5b1246336d05d436"
PV = "1.0+git${SRCPV}"
S = "${WORKDIR}/git"
' href='#n173'>173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
/* Copyright (C) 2015, Jaguar Land Rover. All Rights Reserved.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include <QDBusConnection>
#include <QDBusObjectPath>
#include <QDBusReply>
#include <QDebug>

#include "climatecontrol.h"

ClimateControl::ClimateControl(QQuickItem *parent):
    QQuickItem(parent)
{
    qDebug() << "ClimateControl plugin loaded!";

    //
    // Verify that we can access the system bus, where AMB resides. This is largely informational, since the ambdbusaccess
    // application is responsible for actually accessing AMB.
    //
    if (!QDBusConnection::systemBus().isConnected())
    {
        qDebug() << "Unable to connect to system bus.";
    }
}

ClimateControl::~ClimateControl()
{
    qDebug() << "ClimateControl plugin unloaded.";
}

// Accessor methods.
qint32 ClimateControl::getZone()
{
    return this->zone;
}

void ClimateControl::setZone(qint32 newZone)
{
    if (this->zone != newZone)
    {
        this->zone = newZone;

        qDebug().nospace() << "Updated zone to " << this->zone << ".";

        emit zoneChanged();

        // Now that the zone has been updated, fetch the settings for this new zone.
        this->getSettings();
    }
}

quint16 ClimateControl::getFanSpeedLevel()
{
    return this->fanSpeedLevel;
}

void ClimateControl::setFanSpeedLevel(quint16 newFanSpeedLevel)
{
    if (this->fanSpeedLevel != newFanSpeedLevel)
    {
        this->dbusWrite("FanSpeedLevel", newFanSpeedLevel);
        this->fanSpeedLevel = newFanSpeedLevel;

        qDebug().nospace() << "Updated fan speed level to " << this->fanSpeedLevel << ".";

        emit fanSpeedLevelChanged();
    }
}

qint32 ClimateControl::getTargetTemperature()
{
    return this->targetTemperature;
}

void ClimateControl::setTargetTemperature(qint32 newTargetTemperature)
{
    if (this->targetTemperature != newTargetTemperature)
    {
        this->dbusWrite("TargetTemperature", newTargetTemperature);
        this->targetTemperature = newTargetTemperature;

        qDebug().nospace() << "Updated target temperature to " << this->targetTemperature << ".";

        emit targetTemperatureChanged();
    }
}

bool ClimateControl::getAirConditioning()
{
    return this->airConditioning;
}

void ClimateControl::setAirConditioning(bool newAirConditioning)
{
    if (this->airConditioning != newAirConditioning)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->airConditioning = newAirConditioning;

        qDebug().nospace() << "Updated air conditioning to " << this->airConditioning << ".";

        emit airConditioningChanged();
    }
}

bool ClimateControl::getHeater()
{
    return this->heater;
}

void ClimateControl::setHeater(bool newHeater)
{
    if (this->heater != newHeater)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->heater = newHeater;

        qDebug().nospace() << "Updated heater to " << this->heater << ".";

        emit heaterChanged();
    }
}

quint8 ClimateControl::getSeatHeater()
{
    return this->seatHeater;
}

void ClimateControl::setSeatHeater(quint8 newSeatHeater)
{
    if (this->seatHeater != newSeatHeater)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->seatHeater = newSeatHeater;

        qDebug().nospace() << "Updated seat heater to " << this->seatHeater << ".";

        emit seatHeaterChanged();
    }
}

quint8 ClimateControl::getSeatCooler()
{
    return this->seatCooler;
}

void ClimateControl::setSeatCooler(quint8 newSeatCooler)
{
    if (this->seatCooler != newSeatCooler)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->seatCooler = newSeatCooler;

        qDebug().nospace() << "Updated seat cooler to " << this->seatCooler << ".";

        emit seatCoolerChanged();
    }
}

bool ClimateControl::getAirCirculation()
{
    return this->airCirculation;
}

void ClimateControl::setAirCirculation(bool newAirCirculation)
{
    if (this->airCirculation != newAirCirculation)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->airCirculation = newAirCirculation;

        qDebug().nospace() << "Updated air circulation to " << this->airCirculation << ".";

        emit airCirculationChanged();
    }
}

quint8 ClimateControl::getSteeringWheelHeater()
{
    return this->steeringWheelHeater;
}

void ClimateControl::setSteeringWheelHeater(quint8 newSteeringWheelHeater)
{
    if (this->steeringWheelHeater != newSteeringWheelHeater)
    {
        // NOTE: This property is not enabled in the current version of AMB, so no D-Bus access is performed.
        this->steeringWheelHeater = newSteeringWheelHeater;

        qDebug().nospace() << "Updated steering wheel heater to " << this->steeringWheelHeater << ".";

        emit steeringWheelHeaterChanged();
    }
}

// D-Bus connection methods.
QVariant ClimateControl::dbusRead(const char *property)
{
    QString arguments = "R ClimateControl " + QString::fromUtf8(property);
    QString zoneString;

    // The zone has not been set yet, so do not bother reading from AMB with the exception of FanSpeedLevel at zone 0.
    if (!this->zone && strcmp(property, "FanSpeedLevel"))
    {
        // Return something resembling an uninitialized variable.
        return 0;
    }

    // The FanSpeedLevel property is the only property at zone 0 for now.
    zoneString = QString::number(!strcmp(property, "FanSpeedLevel") ? 0 : this->zone);

    // Add in the zone information.
    arguments += " " + zoneString;

    qDebug() << "Calling ambdbusaccess with the following arguments:" << arguments;

    // system() returns the result in the upper 8 bits, so shift the result to the right by 8.
    return system(QString("/usr/lib/qt5/qml/Automotive/ambdbusaccess " + arguments).toStdString().c_str()) >> 8;
}

void ClimateControl::dbusWrite(const char *property, QVariant value)
{
    QString arguments = "W ClimateControl " + QString::fromUtf8(property);
    QString zoneString;

    // The zone has not been set yet, so do not bother writing to AMB with the exception of FanSpeedLevel at zone 0.
    if (!this->zone && strcmp(property, "FanSpeedLevel"))
    {
        return;
    }

    // The FanSpeedLevel property is the only property at zone 0 for now.
    zoneString = QString::number(!strcmp(property, "FanSpeedLevel") ? 0 : this->zone);

    // Add in the zone information and value to write.
    arguments += " " + zoneString + " " + value.toString();

    qDebug() << "Calling ambdbusaccess with the following arguments:" << arguments;

    system(QString("/usr/lib/qt5/qml/Automotive/ambdbusaccess " + arguments).toStdString().c_str());
}

void ClimateControl::getSettings()
{
    quint8 ambFanSpeedLevel;
    qint32 ambTargetTemperature;

    //
    // Go fetch the settings for this zone.
    //
    // NOTE: Other properties are not enabled in the current version of AMB, so no D-Bus access is performed for them.
    //
    ambFanSpeedLevel = this->dbusRead("FanSpeedLevel").toInt();
    ambTargetTemperature = this->dbusRead("TargetTemperature").toInt();

    // Call the set methods to generate Qt signals, if any are necessary.
    this->setFanSpeedLevel(ambFanSpeedLevel);
    this->setTargetTemperature(ambTargetTemperature);
}