1 /*
2  * Copyright 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.media.tv.tuner.frontend;
18 
19 import android.annotation.IntDef;
20 import android.annotation.IntRange;
21 import android.annotation.NonNull;
22 import android.annotation.SystemApi;
23 import android.media.tv.tuner.frontend.FrontendStatus.FrontendStatusType;
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 
27 /**
28  * A class contains the Frontend Status Readiness of a given type.
29  *
30  * @hide
31  */
32 @SystemApi
33 public final class FrontendStatusReadiness {
34     /** @hide */
35     @IntDef({FRONTEND_STATUS_READINESS_UNDEFINED, FRONTEND_STATUS_READINESS_UNAVAILABLE,
36             FRONTEND_STATUS_READINESS_UNSTABLE, FRONTEND_STATUS_READINESS_STABLE,
37             FRONTEND_STATUS_READINESS_UNSUPPORTED})
38     @Retention(RetentionPolicy.SOURCE)
39     public @interface Readiness {}
40 
41     /**
42      * The FrontendStatus readiness status for the given FrontendStatusType is undefined.
43      */
44     public static final int FRONTEND_STATUS_READINESS_UNDEFINED =
45             android.hardware.tv.tuner.FrontendStatusReadiness.UNDEFINED;
46 
47     /**
48      * The FrontendStatus for the given FrontendStatusType is currently unavailable.
49      */
50     public static final int FRONTEND_STATUS_READINESS_UNAVAILABLE =
51             android.hardware.tv.tuner.FrontendStatusReadiness.UNAVAILABLE;
52 
53     /**
54      * The FrontendStatus for the given FrontendStatusType is ready to read, but it’s unstable.
55      */
56     public static final int FRONTEND_STATUS_READINESS_UNSTABLE =
57             android.hardware.tv.tuner.FrontendStatusReadiness.UNSTABLE;
58 
59     /**
60      * The FrontendStatus for the given FrontendStatusType is ready to read, and it’s stable.
61      */
62     public static final int FRONTEND_STATUS_READINESS_STABLE =
63             android.hardware.tv.tuner.FrontendStatusReadiness.STABLE;
64 
65     /**
66      * The FrontendStatus for the given FrontendStatusType is not supported.
67      */
68     public static final int FRONTEND_STATUS_READINESS_UNSUPPORTED =
69             android.hardware.tv.tuner.FrontendStatusReadiness.UNSUPPORTED;
70 
71     @FrontendStatusType private int mFrontendStatusType;
72     @Readiness private int mStatusReadiness;
73 
FrontendStatusReadiness(int type, int readiness)74     private FrontendStatusReadiness(int type, int readiness) {
75         mFrontendStatusType = type;
76         mStatusReadiness = readiness;
77     }
78 
79     /**
80      * Gets the frontend status type.
81      */
82     @FrontendStatusType
getStatusType()83     public int getStatusType() {
84         return mFrontendStatusType;
85     }
86     /**
87      * Gets the frontend status readiness.
88      */
89     @Readiness
getStatusReadiness()90     public int getStatusReadiness() {
91         return mStatusReadiness;
92     }
93 }
94