1/*
2 * Copyright (C) 2009 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 com.android.internal.telephony.gsm;
18
19/**
20 * SmsBroadcastConfigInfo defines one configuration of Cell Broadcast
21 * Message (CBM) to be received by the ME
22 *
23 * fromServiceId - toServiceId defines a range of CBM message identifiers
24 * whose value is 0x0000 - 0xFFFF as defined in TS 23.041 9.4.1.2.2 for GMS
25 * and 9.4.4.2.2 for UMTS. All other values can be treated as empty
26 * CBM message ID.
27 *
28 * fromCodeScheme - toCodeScheme defines a range of CBM data coding schemes
29 * whose value is 0x00 - 0xFF as defined in TS 23.041 9.4.1.2.3 for GMS
30 * and 9.4.4.2.3 for UMTS.
31 * All other values can be treated as empty CBM data coding scheme.
32 *
33 * selected false means message types specified in {@code <fromServiceId, toServiceId>}
34 * and {@code <fromCodeScheme, toCodeScheme>} are not accepted, while true means accepted.
35 *
36 */
37public final class SmsBroadcastConfigInfo {
38    private int fromServiceId;
39    private int toServiceId;
40    private int fromCodeScheme;
41    private int toCodeScheme;
42    private boolean selected;
43
44    /**
45     * Initialize the object from rssi and cid.
46     */
47    public SmsBroadcastConfigInfo(int fromId, int toId, int fromScheme,
48            int toScheme, boolean selected) {
49        fromServiceId = fromId;
50        toServiceId = toId;
51        fromCodeScheme = fromScheme;
52        toCodeScheme = toScheme;
53        this.selected = selected;
54    }
55
56    /**
57     * @param fromServiceId the fromServiceId to set
58     */
59    public void setFromServiceId(int fromServiceId) {
60        this.fromServiceId = fromServiceId;
61    }
62
63    /**
64     * @return the fromServiceId
65     */
66    public int getFromServiceId() {
67        return fromServiceId;
68    }
69
70    /**
71     * @param toServiceId the toServiceId to set
72     */
73    public void setToServiceId(int toServiceId) {
74        this.toServiceId = toServiceId;
75    }
76
77    /**
78     * @return the toServiceId
79     */
80    public int getToServiceId() {
81        return toServiceId;
82    }
83
84    /**
85     * @param fromCodeScheme the fromCodeScheme to set
86     */
87    public void setFromCodeScheme(int fromCodeScheme) {
88        this.fromCodeScheme = fromCodeScheme;
89    }
90
91    /**
92     * @return the fromCodeScheme
93     */
94    public int getFromCodeScheme() {
95        return fromCodeScheme;
96    }
97
98    /**
99     * @param toCodeScheme the toCodeScheme to set
100     */
101    public void setToCodeScheme(int toCodeScheme) {
102        this.toCodeScheme = toCodeScheme;
103    }
104
105    /**
106     * @return the toCodeScheme
107     */
108    public int getToCodeScheme() {
109        return toCodeScheme;
110    }
111
112    /**
113     * @param selected the selected to set
114     */
115    public void setSelected(boolean selected) {
116        this.selected = selected;
117    }
118
119    /**
120     * @return the selected
121     */
122    public boolean isSelected() {
123        return selected;
124    }
125
126    @Override
127    public String toString() {
128        return "SmsBroadcastConfigInfo: Id [" +
129                fromServiceId + ',' + toServiceId + "] Code [" +
130                fromCodeScheme + ',' + toCodeScheme + "] " +
131            (selected ? "ENABLED" : "DISABLED");
132    }
133}
134