1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
4 *
5 * Not a Contribution, Apache license notifications and license are
6 * retained for attribution purposes only.
7
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef ANDROID_IQSERVICE_H
22#define ANDROID_IQSERVICE_H
23
24#include <stdint.h>
25#include <sys/types.h>
26#include <utils/Errors.h>
27#include <utils/RefBase.h>
28#include <binder/IInterface.h>
29#include <binder/IBinder.h>
30#include <IQClient.h>
31#include <IQHDMIClient.h>
32
33
34namespace qService {
35// ----------------------------------------------------------------------------
36
37class IQService : public android::IInterface
38{
39public:
40    DECLARE_META_INTERFACE(QService);
41    enum {
42        COMMAND_LIST_START = android::IBinder::FIRST_CALL_TRANSACTION,
43        SECURING,                // Hardware securing start/end notification
44        UNSECURING,              // Hardware unsecuring start/end notification
45        CONNECT_HWC_CLIENT,      // Connect HWC Client to qservice
46        SCREEN_REFRESH,          // Refresh screen through SF invalidate
47        EXTERNAL_ORIENTATION,    // Set external orientation
48        BUFFER_MIRRORMODE,       // Buffer mirrormode
49        CHECK_EXTERNAL_STATUS,   // Check status of external display
50        GET_DISPLAY_ATTRIBUTES,  // Get display attributes
51        SET_HSIC_DATA,           // Set HSIC on dspp
52        GET_DISPLAY_VISIBLE_REGION,  // Get the visibleRegion for dpy
53        PAUSE_WFD,               // Pause/Resume WFD
54        SET_WFD_STATUS,          // Set if wfd connection is on/off
55        CONNECT_HDMI_CLIENT,     // Connect HDMI Client
56        COMMAND_LIST_END = 400,
57    };
58
59    enum {
60        END = 0,
61        START,
62    };
63
64    // Register a HWC client that can be notified
65    // This client is generic and is intended to get
66    // dispatches of all events calling into QService
67    virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
68    // Register an HDMI client. This client gets notification of HDMI events
69    // such as plug/unplug and CEC messages
70    virtual void connect(const android::sp<qClient::IQHDMIClient>& client) = 0;
71    // Generic function to dispatch binder commands
72    // The type of command decides how the data is parceled
73    virtual android::status_t dispatch(uint32_t command,
74            const android::Parcel* inParcel,
75            android::Parcel* outParcel) = 0;
76};
77
78// ----------------------------------------------------------------------------
79
80class BnQService : public android::BnInterface<IQService>
81{
82public:
83    virtual android::status_t onTransact( uint32_t code,
84                                          const android::Parcel& data,
85                                          android::Parcel* reply,
86                                          uint32_t flags = 0);
87};
88
89// ----------------------------------------------------------------------------
90}; // namespace qService
91
92#endif // ANDROID_IQSERVICE_H
93