1d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian/*
2d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Copyright (C) 2011 The Android Open Source Project
3d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
4d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * you may not use this file except in compliance with the License.
6d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * You may obtain a copy of the License at
7d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
8d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian *
10d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * Unless required by applicable law or agreed to in writing, software
11d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * See the License for the specific language governing permissions and
14d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian * limitations under the License.
15d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian */
16d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
17d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#ifndef ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
18d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#define ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
19d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
20d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <stdint.h>
21d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <sys/types.h>
22d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
23d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <utils/Errors.h>
24d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <utils/RefBase.h>
25d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
26d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#include <binder/IInterface.h>
27d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
28d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopiannamespace android {
29d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian// ----------------------------------------------------------------------------
30d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
31d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianclass BitTube;
32d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
33d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianclass IDisplayEventConnection : public IInterface
34d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian{
35d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianpublic:
36478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian
37d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian    DECLARE_META_INTERFACE(DisplayEventConnection);
38d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
39478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
40478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * getDataChannel() returns a BitTube where to receive the events from
41478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
42d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian    virtual sp<BitTube> getDataChannel() const = 0;
43478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian
44478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
45478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * setVsyncRate() sets the vsync event delivery rate. A value of
46478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * 1 returns every vsync events. A value of 2 returns every other events,
47478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * etc... a value of 0 returns no event unless  requestNextVsync() has
48478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * been called.
49478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
50478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    virtual void setVsyncRate(uint32_t count) = 0;
51478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian
52478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    /*
53478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * requestNextVsync() schedules the next vsync event. It has no effect
54478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     * if the vsync rate is > 0.
55478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian     */
56478ae5eb5a0047e1b2988c896cff6363b455ee50Mathias Agopian    virtual void requestNextVsync() = 0;    // asynchronous
57d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian};
58d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
59d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian// ----------------------------------------------------------------------------
60d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
61d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianclass BnDisplayEventConnection : public BnInterface<IDisplayEventConnection>
62d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian{
63d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopianpublic:
64d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian    virtual status_t    onTransact( uint32_t code,
65d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian                                    const Parcel& data,
66d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian                                    Parcel* reply,
67d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian                                    uint32_t flags = 0);
68d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian};
69d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
70d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian// ----------------------------------------------------------------------------
71d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian}; // namespace android
72d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian
73d0566bc26fcf6ca396118701fa11900b627f2c09Mathias Agopian#endif // ANDROID_GUI_IDISPLAY_EVENT_CONNECTION_H
74