2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "qlibwindowmanager.h"
21 int QLibWindowmanager::init(int port, const QString &token) {
22 std::string ctoken = token.toStdString();
23 return this->wm->init(port, ctoken.c_str());
26 int QLibWindowmanager::requestSurface(json_object *label) {
27 applabel = json_object_get_string(label);
29 json_object *obj = json_object_new_object();
30 json_object_object_add(obj, wm->kKeyDrawingName, label);
31 return this->wm->requestSurface(obj);
34 int QLibWindowmanager::activateSurface(json_object *label) {
35 json_object *obj = json_object_new_object();
36 json_object_object_add(obj, wm->kKeyDrawingName, label);
37 json_object_object_add(obj, wm->kKeyDrawingArea, json_object_new_string("normal.full"));
39 return this->wm->activateSurface(obj);
42 int QLibWindowmanager::deactivateSurface(json_object *label) {
43 json_object *obj = json_object_new_object();
44 json_object_object_add(obj, wm->kKeyDrawingName, label);
45 return this->wm->deactivateSurface(obj);
48 int QLibWindowmanager::endDraw(json_object *label) {
49 json_object *obj = json_object_new_object();
50 json_object_object_add(obj, wm->kKeyDrawingName, label);
51 return this->wm->endDraw(obj);
54 void QLibWindowmanager::set_event_handler(enum QEventType et,
56 LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et;
57 return this->wm->set_event_handler(wet, std::move(f));
60 void QLibWindowmanager::slotActivateSurface(){
62 qDebug("Let's show HVAC");
64 this->activateSurface(json_object_new_string(applabel.c_str()));
68 QLibWindowmanager::QLibWindowmanager(QObject *parent)
69 :QObject(parent), isActive(false)
71 wm = new LibWindowmanager();
74 QLibWindowmanager::~QLibWindowmanager() { }