Set timeout as 10sec
[apps/agl-service-windowmanager.git] / src / windowmanager-client.cpp
1 /*
2  * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 #include <iostream> // for debug
17 using std::cerr;//debug
18 using std::cout;//debug
19 using std::endl;//debug
20 #include "windowmanager-client.hpp"
21
22 namespace wm {
23
24 using std::string;
25
26 const std::vector<std::string> wm_events = {
27     // Private event for applications
28     "syncDraw", "flushDraw", "visible", "invisible", "active", "inactive"
29 };
30
31 WMClient::WMClient(const string &appid, unsigned layerID, unsigned surfaceID, const string &role)
32     :id(appid),
33      layer(layerID),
34      roles(0),
35      surfaces(0)
36 {
37     roles.push_back(role);
38     surfaces.push_back(surfaceID);
39     for(auto x: wm_events){
40 #if GTEST_ENABLED
41         string ev = x;
42 #else
43         afb_event ev = afb_daemon_make_event(x.c_str());
44 #endif
45         event_list[x] = ev;
46     }
47 }
48
49 WMClient::WMClient(const string &appid, const string &role)
50     : id(appid),
51       layer(0),
52       roles(0),
53       surfaces(0),
54       event_list(0)
55 {
56     roles.push_back(role);
57     for(auto x: wm_events){
58 #if GTEST_ENABLED
59         string ev = x;
60 #else
61         afb_event ev = afb_daemon_make_event(x.c_str());
62 #endif
63         event_list[x] = ev;
64     }
65 }
66
67 WMClient::~WMClient(){
68 }
69
70 string WMClient::appID(){
71     return this->id;
72 }
73
74 }