1 /* 2 * Copyright (C) 2007 Esmertec AG. 3 * Copyright (C) 2007 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.im.imps; 19 20 public class ImpsConstants { 21 22 public static enum ImpsVersion { 23 IMPS_VERSION_11, 24 IMPS_VERSION_12, 25 IMPS_VERSION_13; 26 fromString(String value)27 public static ImpsVersion fromString(String value) { 28 if ("1.1".equals(value)) { 29 return IMPS_VERSION_11; 30 } else if ("1.2".equals(value)) { 31 return IMPS_VERSION_12; 32 } else if ("1.3".equals(value)) { 33 return IMPS_VERSION_13; 34 } else { 35 // Unknown version, use 1.2 as default 36 return IMPS_VERSION_12; 37 } 38 } 39 } 40 41 // TODO: move these to some place else? 42 public static final String CLIENT_PRODUCER = "MOKIA"; 43 public static final String CLIENT_VERSION = "0.1"; 44 45 public static final String VERSION_11_NS 46 = "http://www.wireless-village.org/CSP1.1"; 47 public static final String TRANSACTION_11_NS 48 = "http://www.wireless-village.org/TRC1.1"; 49 public static final String PRESENCE_11_NS 50 = "http://www.wireless-village.org/PA1.1"; 51 52 public static final String VERSION_12_NS 53 = "http://www.openmobilealliance.org/DTD/WV-CSP1.2"; 54 public static final String TRANSACTION_12_NS 55 = "http://www.openmobilealliance.org/DTD/WV-TRC1.2"; 56 public static final String PRESENCE_12_NS 57 = "http://www.openmobilealliance.org/DTD/WV-PA1.2"; 58 59 public static final String VERSION_13_NS 60 = "http://www.openmobilealliance.org/DTD/IMPS-CSP1.3"; 61 public static final String TRANSACTION_13_NS 62 = "http://www.openmobilealliance.org/DTD/IMPS-TRC1.3"; 63 public static final String PRESENCE_13_NS 64 = "http://www.openmobilealliance.org/DTD/IMPS-PA1.3"; 65 66 public static final String ADDRESS_PREFIX = "wv:"; 67 68 public static final String TRUE = "T"; 69 public static final String FALSE = "F"; 70 public static final String SUCCESS_CODE = "200"; 71 public static final String Open = "Open"; 72 public static final String DisplayName = "DisplayName"; 73 public static final String GROUP_INVITATION = "GR"; 74 public static final String Default = "Default"; 75 76 public static final int STATUS_UNAUTHORIZED = 401; 77 public static final int STATUS_NOT_IMPLEMENTED = 501; 78 public static final int STATUS_COULD_NOT_RECOVER_SESSION = 502; 79 // status 760 is IMPS 1.2 only 80 public static final int STATUS_AUTO_SUBSCRIPTION_NOT_SUPPORTED = 760; 81 82 /** presence UserAvailability values */ 83 public static final String PRESENCE_AVAILABLE = "AVAILABLE"; 84 public static final String PRESENCE_NOT_AVAILABLE = "NOT_AVAILABLE"; 85 public static final String PRESENCE_DISCREET = "DISCREET"; 86 87 /** presence ClientType values */ 88 public static final String PRESENCE_MOBILE_PHONE = "MOBILE_PHONE"; 89 public static final String PRESENCE_COMPUTER = "COMPUTER"; 90 public static final String PRESENCE_PDA = "PDA"; 91 public static final String PRESENCE_CLI = "CLI"; 92 public static final String PRESENCE_OTHER = "OTHER"; 93 94 public static final String COMMC_CAP_IM = "IM"; 95 } 96