1/* 2 * Copyright (C) 2016 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.phone.vvm.omtp.protocol; 18 19import android.telephony.SmsManager; 20 21import com.android.phone.vvm.omtp.OmtpConstants; 22import com.android.phone.vvm.omtp.sms.OmtpCvvmMessageSender; 23import com.android.phone.vvm.omtp.sms.OmtpMessageSender; 24 25/** 26 * A flavor of OMTP protocol with a different mobile originated (MO) format 27 * 28 * Used by carriers such as T-Mobile 29 */ 30public class CvvmProtocol extends VisualVoicemailProtocol { 31 32 private static String IMAP_CHANGE_TUI_PWD_FORMAT = "CHANGE_TUI_PWD PWD=%1$s OLD_PWD=%2$s"; 33 private static String IMAP_CHANGE_VM_LANG_FORMAT = "CHANGE_VM_LANG Lang=%1$s"; 34 private static String IMAP_CLOSE_NUT = "CLOSE_NUT"; 35 36 @Override 37 public OmtpMessageSender createMessageSender(SmsManager smsManager, short applicationPort, 38 String destinationNumber) { 39 return new OmtpCvvmMessageSender(smsManager, applicationPort, destinationNumber); 40 } 41 42 @Override 43 public String getCommand(String command) { 44 if (command == OmtpConstants.IMAP_CHANGE_TUI_PWD_FORMAT) { 45 return IMAP_CHANGE_TUI_PWD_FORMAT; 46 } 47 if (command == OmtpConstants.IMAP_CLOSE_NUT) { 48 return IMAP_CLOSE_NUT; 49 } 50 if (command == OmtpConstants.IMAP_CHANGE_VM_LANG_FORMAT) { 51 return IMAP_CHANGE_VM_LANG_FORMAT; 52 } 53 return super.getCommand(command); 54 } 55} 56