blob: 272cb1052e4cd2a323c5f1fc6df7388db4c8cad7 [file] [log] [blame]
Shraddha Basantwanifdeb39f2022-05-17 14:45:34 +05301/*
2 * Copyright (C) 2022 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
17package android.hardware.cas;
18
19import android.hardware.cas.ScramblingMode;
20import android.hardware.cas.SessionIntent;
21
22/**
23 * ICas is the API to control the CAS. It is used to manage sessions, provision/refresh the cas
24 * system, and process the EMM/ECM messages. It also allows bi-directional, scheme-specific
25 * communications between the client and the cas system.
Venkatarama Avadhanib4eb99b2022-12-05 15:44:34 +053026 * @hide
Shraddha Basantwanifdeb39f2022-05-17 14:45:34 +053027 */
28@VintfStability
29interface ICas {
30 /**
31 * Close a session.
32 *
33 * @param sessionId The id of the session to be closed.
34 */
35 void closeSession(in byte[] sessionId);
36
37 /**
Venkatarama Avadhani9bd34272023-01-30 11:20:06 +053038 * Open a session to descramble one or more streams without specifying intention
39 * and scrambling mode.
40 *
41 * @return sessionId The id of the newly opened session.
42 */
43 byte[] openSessionDefault();
44
45 /**
Shraddha Basantwanifdeb39f2022-05-17 14:45:34 +053046 * Open a session to descramble one or more streams by specifying intention
47 * and scrambling mode.
48 *
49 * @param intent the intention of the session to be opened.
50 * @param mode the scrambling mode the session will use.
51 *
52 * @return sessionId The id of the newly opened session.
53 */
54 byte[] openSession(in SessionIntent intent, in ScramblingMode mode);
55
56 /**
57 * Process an ECM from the ECM stream for this session’s elementary stream.
58 *
59 * @param sessionId the id of the session which the ecm data applies to.
60 * @param ecm a byte array containing the ecm data.
61 */
62 void processEcm(in byte[] sessionId, in byte[] ecm);
63
64 /**
65 * Process an in-band EMM from the EMM stream.
66 *
67 * @param emm a byte array containing the emm data.
68 */
69 void processEmm(in byte[] emm);
70
71 /**
72 * Initiate a provisioning operation for a CA system.
73 *
74 * @param provisionString string containing information needed for the
75 * provisioning operation, the format of which is scheme and implementation
76 * specific.
77 */
78 void provision(in String provisionString);
79
80 /**
81 * Notify the CA system to refresh entitlement keys.
82 *
83 * @param refreshType the type of the refreshment.
84 * @param refreshData private data associated with the refreshment.
85 */
86 void refreshEntitlements(in int refreshType, in byte[] refreshData);
87
88 /**
89 * Release the descrambler instance.
90 */
91 void release();
92
93 /**
94 * Send an scheme-specific event to the CasPlugin.
95 *
96 * @param event an integer denoting a scheme-specific event to be sent.
97 * @param arg a scheme-specific integer argument for the event.
98 * @param data a byte array containing scheme-specific data for the event.
99 */
100 void sendEvent(in int event, in int arg, in byte[] eventData);
101
102 /**
103 * Send an scheme-specific session event to the CasPlugin.
104 *
105 * @param sessionId the id of an opened session.
106 * @param event an integer denoting a scheme-specific event to be sent.
107 * @param arg a scheme-specific integer argument for the event.
108 * @param data a byte array containing scheme-specific data for the event.
109 */
110 void sendSessionEvent(in byte[] sessionId, in int event, in int arg, in byte[] eventData);
111
112 /**
113 * Provide the CA private data from a CA_descriptor in the conditional
114 * access table to a CasPlugin.
115 *
116 * @param pvtData a byte array containing the private data, the format of
117 * which is scheme-specific and opaque to the framework.
118 */
119 void setPrivateData(in byte[] pvtData);
120
121 /**
122 * Provide the CA private data from a CA_descriptor in the program map
123 * table to a session.
124 *
125 * @param sessionId the id of the session which the private data applies to.
126 * @param pvtData a byte array containing the private data, the format of
127 * which is scheme-specific and opaque to the framework.
128 */
129 void setSessionPrivateData(in byte[] sessionId, in byte[] pvtData);
130}