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 17 package 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 */ 37 public final class SmsBroadcastConfigInfo { 38 private int mFromServiceId; 39 private int mToServiceId; 40 private int mFromCodeScheme; 41 private int mToCodeScheme; 42 private boolean mSelected; 43 44 /** 45 * Initialize the object from rssi and cid. 46 */ SmsBroadcastConfigInfo(int fromId, int toId, int fromScheme, int toScheme, boolean selected)47 public SmsBroadcastConfigInfo(int fromId, int toId, int fromScheme, 48 int toScheme, boolean selected) { 49 mFromServiceId = fromId; 50 mToServiceId = toId; 51 mFromCodeScheme = fromScheme; 52 mToCodeScheme = toScheme; 53 mSelected = selected; 54 } 55 56 /** 57 * @param fromServiceId the fromServiceId to set 58 */ setFromServiceId(int fromServiceId)59 public void setFromServiceId(int fromServiceId) { 60 mFromServiceId = fromServiceId; 61 } 62 63 /** 64 * @return the fromServiceId 65 */ getFromServiceId()66 public int getFromServiceId() { 67 return mFromServiceId; 68 } 69 70 /** 71 * @param toServiceId the toServiceId to set 72 */ setToServiceId(int toServiceId)73 public void setToServiceId(int toServiceId) { 74 mToServiceId = toServiceId; 75 } 76 77 /** 78 * @return the toServiceId 79 */ getToServiceId()80 public int getToServiceId() { 81 return mToServiceId; 82 } 83 84 /** 85 * @param fromCodeScheme the fromCodeScheme to set 86 */ setFromCodeScheme(int fromCodeScheme)87 public void setFromCodeScheme(int fromCodeScheme) { 88 mFromCodeScheme = fromCodeScheme; 89 } 90 91 /** 92 * @return the fromCodeScheme 93 */ getFromCodeScheme()94 public int getFromCodeScheme() { 95 return mFromCodeScheme; 96 } 97 98 /** 99 * @param toCodeScheme the toCodeScheme to set 100 */ setToCodeScheme(int toCodeScheme)101 public void setToCodeScheme(int toCodeScheme) { 102 mToCodeScheme = toCodeScheme; 103 } 104 105 /** 106 * @return the toCodeScheme 107 */ getToCodeScheme()108 public int getToCodeScheme() { 109 return mToCodeScheme; 110 } 111 112 /** 113 * @param selected the selected to set 114 */ setSelected(boolean selected)115 public void setSelected(boolean selected) { 116 mSelected = selected; 117 } 118 119 /** 120 * @return the selected 121 */ isSelected()122 public boolean isSelected() { 123 return mSelected; 124 } 125 126 @Override toString()127 public String toString() { 128 return "SmsBroadcastConfigInfo: Id [" + 129 mFromServiceId + ',' + mToServiceId + "] Code [" + 130 mFromCodeScheme + ',' + mToCodeScheme + "] " + 131 (mSelected ? "ENABLED" : "DISABLED"); 132 } 133 } 134