1 /* 2 * Copyright (C) 2006 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.stk; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * Enumeration for representing the tone values for use with PLAY TONE 24 * proactive commands. 25 * 26 * {@hide} 27 */ 28 public enum Tone implements Parcelable { 29 // Standard supervisory tones 30 31 /** 32 * Dial tone. 33 */ 34 DIAL(0x01), 35 36 /** 37 * Called subscriber busy. 38 */ 39 BUSY(0x02), 40 41 /** 42 * Congestion. 43 */ 44 CONGESTION(0x03), 45 46 /** 47 * Radio path acknowledge. 48 */ 49 RADIO_PATH_ACK(0x04), 50 51 /** 52 * Radio path not available / Call dropped. 53 */ 54 RADIO_PATH_NOT_AVAILABLE(0x05), 55 56 /** 57 * Error/Special information. 58 */ 59 ERROR_SPECIAL_INFO(0x06), 60 61 /** 62 * Call waiting tone. 63 */ 64 CALL_WAITING(0x07), 65 66 /** 67 * Ringing tone. 68 */ 69 RINGING(0x08), 70 71 // Terminal proprietary tones 72 73 /** 74 * General beep. 75 */ 76 GENERAL_BEEP(0x10), 77 78 /** 79 * Positive acknowledgement tone. 80 */ 81 POSITIVE_ACK(0x11), 82 83 /** 84 * Negative acknowledgement tone. 85 */ 86 NEGATIVE_ACK(0x12), 87 88 /** 89 * Ringing tone as selected by the user for incoming speech call. 90 */ 91 INCOMING_SPEECH_CALL(0x13), 92 93 /** 94 * Alert tone as selected by the user for incoming SMS. 95 */ 96 INCOMING_SMS(0x14), 97 98 /** 99 * Critical alert. 100 * This tone is to be used in critical situations. The terminal shall make 101 * every effort to alert the user when this tone is indicated independent 102 * from the volume setting in the terminal. 103 */ 104 CRITICAL_ALERT(0x15), 105 106 /** 107 * Vibrate only, if available. 108 */ 109 VIBRATE_ONLY(0x20), 110 111 // Themed tones 112 113 /** 114 * Happy tone. 115 */ 116 HAPPY(0x30), 117 118 /** 119 * Sad tone. 120 */ 121 SAD(0x31), 122 123 /** 124 * Urgent action tone. 125 */ 126 URGENT(0x32), 127 128 /** 129 * Question tone. 130 */ 131 QUESTION(0x33), 132 133 /** 134 * Message received tone. 135 */ 136 MESSAGE_RECEIVED(0x34), 137 138 // Melody tones 139 MELODY_1(0x40), 140 MELODY_2(0x41), 141 MELODY_3(0x42), 142 MELODY_4(0x43), 143 MELODY_5(0x44), 144 MELODY_6(0x45), 145 MELODY_7(0x46), 146 MELODY_8(0x47); 147 148 private int mValue; 149 150 Tone(int value) { 151 mValue = value; 152 } 153 154 /** 155 * Create a Tone object. 156 * @param value Integer value to be converted to a Tone object. 157 * @return Tone object whose value is {@code value}. If no Tone object has 158 * that value, null is returned. 159 */ 160 public static Tone fromInt(int value) { 161 for (Tone e : Tone.values()) { 162 if (e.mValue == value) { 163 return e; 164 } 165 } 166 return null; 167 } 168 169 Tone(Parcel in) { 170 mValue = in.readInt(); 171 } 172 173 public void writeToParcel(Parcel dest, int flags) { 174 dest.writeInt(ordinal()); 175 } 176 177 public int describeContents() { 178 return 0; 179 } 180 181 public static final Parcelable.Creator<Tone> CREATOR = new Parcelable.Creator<Tone>() { 182 public Tone createFromParcel(Parcel in) { 183 return Tone.values()[in.readInt()]; 184 } 185 186 public Tone[] newArray(int size) { 187 return new Tone[size]; 188 } 189 }; 190 } 191