Shraddha Basantwani | fdeb39f | 2022-05-17 14:45:34 +0530 | [diff] [blame^] | 1 | /* |
| 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 | |
| 17 | package android.hardware.cas; |
| 18 | |
| 19 | import android.hardware.cas.ScramblingMode; |
| 20 | import 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. |
| 26 | */ |
| 27 | @VintfStability |
| 28 | interface ICas { |
| 29 | /** |
| 30 | * Close a session. |
| 31 | * |
| 32 | * @param sessionId The id of the session to be closed. |
| 33 | */ |
| 34 | void closeSession(in byte[] sessionId); |
| 35 | |
| 36 | /** |
| 37 | * Open a session to descramble one or more streams by specifying intention |
| 38 | * and scrambling mode. |
| 39 | * |
| 40 | * @param intent the intention of the session to be opened. |
| 41 | * @param mode the scrambling mode the session will use. |
| 42 | * |
| 43 | * @return sessionId The id of the newly opened session. |
| 44 | */ |
| 45 | byte[] openSession(in SessionIntent intent, in ScramblingMode mode); |
| 46 | |
| 47 | /** |
| 48 | * Process an ECM from the ECM stream for this session’s elementary stream. |
| 49 | * |
| 50 | * @param sessionId the id of the session which the ecm data applies to. |
| 51 | * @param ecm a byte array containing the ecm data. |
| 52 | */ |
| 53 | void processEcm(in byte[] sessionId, in byte[] ecm); |
| 54 | |
| 55 | /** |
| 56 | * Process an in-band EMM from the EMM stream. |
| 57 | * |
| 58 | * @param emm a byte array containing the emm data. |
| 59 | */ |
| 60 | void processEmm(in byte[] emm); |
| 61 | |
| 62 | /** |
| 63 | * Initiate a provisioning operation for a CA system. |
| 64 | * |
| 65 | * @param provisionString string containing information needed for the |
| 66 | * provisioning operation, the format of which is scheme and implementation |
| 67 | * specific. |
| 68 | */ |
| 69 | void provision(in String provisionString); |
| 70 | |
| 71 | /** |
| 72 | * Notify the CA system to refresh entitlement keys. |
| 73 | * |
| 74 | * @param refreshType the type of the refreshment. |
| 75 | * @param refreshData private data associated with the refreshment. |
| 76 | */ |
| 77 | void refreshEntitlements(in int refreshType, in byte[] refreshData); |
| 78 | |
| 79 | /** |
| 80 | * Release the descrambler instance. |
| 81 | */ |
| 82 | void release(); |
| 83 | |
| 84 | /** |
| 85 | * Send an scheme-specific event to the CasPlugin. |
| 86 | * |
| 87 | * @param event an integer denoting a scheme-specific event to be sent. |
| 88 | * @param arg a scheme-specific integer argument for the event. |
| 89 | * @param data a byte array containing scheme-specific data for the event. |
| 90 | */ |
| 91 | void sendEvent(in int event, in int arg, in byte[] eventData); |
| 92 | |
| 93 | /** |
| 94 | * Send an scheme-specific session event to the CasPlugin. |
| 95 | * |
| 96 | * @param sessionId the id of an opened session. |
| 97 | * @param event an integer denoting a scheme-specific event to be sent. |
| 98 | * @param arg a scheme-specific integer argument for the event. |
| 99 | * @param data a byte array containing scheme-specific data for the event. |
| 100 | */ |
| 101 | void sendSessionEvent(in byte[] sessionId, in int event, in int arg, in byte[] eventData); |
| 102 | |
| 103 | /** |
| 104 | * Provide the CA private data from a CA_descriptor in the conditional |
| 105 | * access table to a CasPlugin. |
| 106 | * |
| 107 | * @param pvtData a byte array containing the private data, the format of |
| 108 | * which is scheme-specific and opaque to the framework. |
| 109 | */ |
| 110 | void setPrivateData(in byte[] pvtData); |
| 111 | |
| 112 | /** |
| 113 | * Provide the CA private data from a CA_descriptor in the program map |
| 114 | * table to a session. |
| 115 | * |
| 116 | * @param sessionId the id of the session which the private data applies to. |
| 117 | * @param pvtData a byte array containing the private data, the format of |
| 118 | * which is scheme-specific and opaque to the framework. |
| 119 | */ |
| 120 | void setSessionPrivateData(in byte[] sessionId, in byte[] pvtData); |
| 121 | } |