rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | #include "CdmaSmsCbProgramData.h" |
| 18 | |
| 19 | CdmaSmsCbProgramData::CdmaSmsCbProgramData(int operation, int category, |
| 20 | int language, int maxMessages, int alertOption, std::string categoryName) { |
| 21 | mOperation = operation; |
| 22 | mCategory = category; |
| 23 | mLanguage = language; |
| 24 | mMaxMessages = maxMessages; |
| 25 | mAlertOption = alertOption; |
| 26 | mCategoryName = categoryName; |
| 27 | } |
| 28 | |
| 29 | CdmaSmsCbProgramData::~CdmaSmsCbProgramData() { |
| 30 | // TODO Auto-generated destructor stub |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Returns the service category operation, e.g. {@link #OPERATION_ADD_CATEGORY}. |
| 35 | * @return one of the {@code OPERATION_*} values |
| 36 | */ |
| 37 | int CdmaSmsCbProgramData::getOperation() { |
| 38 | return mOperation; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns the CDMA service category to modify. |
| 43 | * @return a 16-bit CDMA service category value |
| 44 | */ |
| 45 | int CdmaSmsCbProgramData::getCategory() { |
| 46 | return mCategory; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Returns the CDMA language code for this service category. |
| 51 | * @return one of the language values defined in BearerData.LANGUAGE_* |
| 52 | */ |
| 53 | int CdmaSmsCbProgramData::getLanguage() { |
| 54 | return mLanguage; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Returns the maximum number of messages to store for this service category. |
| 59 | * @return the maximum number of messages to store for this service category |
| 60 | */ |
| 61 | int CdmaSmsCbProgramData::getMaxMessages() { |
| 62 | return mMaxMessages; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Returns the service category alert option, e.g. {@link #ALERT_OPTION_DEFAULT_ALERT}. |
| 67 | * @return one of the {@code ALERT_OPTION_*} values |
| 68 | */ |
| 69 | int CdmaSmsCbProgramData::getAlertOption() { |
| 70 | return mAlertOption; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Returns the service category name, in the language specified by {@link #getLanguage()}. |
| 75 | * @return an optional service category name |
| 76 | */ |
| 77 | std::string CdmaSmsCbProgramData::getCategoryName() { |
| 78 | return mCategoryName; |
| 79 | } |
| 80 | |
| 81 | std::string CdmaSmsCbProgramData::toString() { |
| 82 | return "CdmaSmsCbProgramData{operation=" + std::to_string(mOperation) |
| 83 | + ", category=" + std::to_string(mCategory) + ", language=" |
| 84 | + std::to_string(mLanguage) + ", max messages=" |
| 85 | + std::to_string(mMaxMessages) + ", alert option=" |
| 86 | + std::to_string(mAlertOption) + ", category name=" + mCategoryName + "}"; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Describe the kinds of special objects contained in the marshalled representation. |
| 91 | * @return a bitmask indicating this Parcelable contains no special objects |
| 92 | */ |
| 93 | int CdmaSmsCbProgramData::describeContents() { |
| 94 | return 0; |
| 95 | } |