1 /*
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 
27 namespace android {
28 
29 class IGraphicBufferProducer;
30 
31 class IRemoteDisplayClient : public IInterface
32 {
33 public:
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.
43         kDisplayErrorUnknown = 1,
44         // Error: The connection was dropped unexpectedly.
45         kDisplayErrorConnectionDropped = 2,
46     };
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.
51     virtual void onDisplayConnected(const sp<IGraphicBufferProducer>& bufferProducer,
52             uint32_t width, uint32_t height, uint32_t flags, uint32_t session) = 0; // one-way
53 
54     // Indicates that the remote display has been disconnected normally.
55     // This method should only be called once the client has called 'dispose()'
56     // on the IRemoteDisplay.
57     // 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.
62     virtual void onDisplayError(int32_t error) = 0; // one-way
63 };
64 
65 
66 // ----------------------------------------------------------------------------
67 
68 class BnRemoteDisplayClient : public BnInterface<IRemoteDisplayClient>
69 {
70 public:
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
80