1 /*
2  * Copyright 2020 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 package com.android.server.tv.tunerresourcemanager;
17 
18 /**
19  * A CiCam resource object used by the Tuner Resource Manager to record the CiCam
20  * information.
21  *
22  * @hide
23  */
24 public final class CiCamResource extends CasResource {
CiCamResource(Builder builder)25     private CiCamResource(Builder builder) {
26         super(builder);
27     }
28 
29     @Override
toString()30     public String toString() {
31         return "CiCamResource[systemId=" + this.getSystemId()
32                 + ", isFullyUsed=" + (this.isFullyUsed())
33                 + ", maxSessionNum=" + this.getMaxSessionNum()
34                 + ", ownerClients=" + ownersMapToString() + "]";
35     }
36 
getCiCamId()37     public int getCiCamId() {
38         return this.getSystemId();
39     }
40 
41     /**
42      * Builder class for {@link CiCamResource}.
43      */
44     public static class Builder extends CasResource.Builder {
Builder(int systemId)45         Builder(int systemId) {
46             super(systemId);
47         }
48 
49         /**
50          * Builder for {@link CasResource}.
51          *
52          * @param maxSessionNum the max session num the current Cas has.
53          */
maxSessionNum(int maxSessionNum)54         public Builder maxSessionNum(int maxSessionNum) {
55             super.mMaxSessionNum = maxSessionNum;
56             return this;
57         }
58 
59         /**
60          * Build a {@link CiCamResource}.
61          *
62          * @return {@link CiCamResource}.
63          */
64         @Override
build()65         public CiCamResource build() {
66             CiCamResource ciCam = new CiCamResource(this);
67             return ciCam;
68         }
69     }
70 }
71