blob: 0e6d55dc48da1ffe5aecea08225ba1e2b8d6f041 [file] [log] [blame]
Jeff Browne1045962012-09-04 21:38:42 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
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
17#ifndef ANDROID_IREMOTEDISPLAYCLIENT_H
18#define ANDROID_IREMOTEDISPLAYCLIENT_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/RefBase.h>
24#include <binder/IInterface.h>
25#include <binder/Parcel.h>
26
27namespace android {
28
Andy McFadden8ba01022012-12-18 09:46:54 -080029class IGraphicBufferProducer;
Jeff Browne1045962012-09-04 21:38:42 -070030
31class IRemoteDisplayClient : public IInterface
32{
33public:
34 DECLARE_META_INTERFACE(RemoteDisplayClient);
35
36 enum {
37 // Flag: The remote display is using a secure transport protocol such as HDCP.
38 kDisplayFlagSecure = 1 << 0,
39 };
40
41 enum {
42 // Error: An unknown / generic error occurred.
Jeff Brown455d02e2012-09-05 17:48:03 -070043 kDisplayErrorUnknown = 1,
Jeff Browne1045962012-09-04 21:38:42 -070044 // Error: The connection was dropped unexpectedly.
Jeff Brown455d02e2012-09-05 17:48:03 -070045 kDisplayErrorConnectionDropped = 2,
Jeff Browne1045962012-09-04 21:38:42 -070046 };
47
48 // Indicates that the remote display has been connected successfully.
49 // Provides a surface texture that the client should use to stream buffers to
50 // the remote display.
Andy McFadden8ba01022012-12-18 09:46:54 -080051 virtual void onDisplayConnected(const sp<IGraphicBufferProducer>& bufferProducer,
Chong Zhang87ecf192013-06-06 12:42:59 -070052 uint32_t width, uint32_t height, uint32_t flags, uint32_t session) = 0; // one-way
Jeff Browne1045962012-09-04 21:38:42 -070053
54 // Indicates that the remote display has been disconnected normally.
Jeff Brown455d02e2012-09-05 17:48:03 -070055 // This method should only be called once the client has called 'dispose()'
56 // on the IRemoteDisplay.
Jeff Browne1045962012-09-04 21:38:42 -070057 // It is currently an error for the display to disconnect for any other reason.
58 virtual void onDisplayDisconnected() = 0; // one-way
59
60 // Indicates that a connection could not be established to the remote display
61 // or an unrecoverable error occurred and the connection was severed.
Jeff Browne1045962012-09-04 21:38:42 -070062 virtual void onDisplayError(int32_t error) = 0; // one-way
63};
64
65
66// ----------------------------------------------------------------------------
67
68class BnRemoteDisplayClient : public BnInterface<IRemoteDisplayClient>
69{
70public:
71 virtual status_t onTransact( uint32_t code,
72 const Parcel& data,
73 Parcel* reply,
74 uint32_t flags = 0);
75};
76
77}; // namespace android
78
79#endif // ANDROID_IREMOTEDISPLAYCLIENT_H