Home | History | Annotate | Download | only in imps
      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 import com.android.im.imps.ImpsConnectionConfig.CirMethod;
     21 import com.android.im.imps.ImpsConnectionConfig.TransportType;
     22 
     23 /**
     24  * The configuration of the capabilities of the client.
     25  */
     26 final class ImpsClientCapability {
     27 
     28     private ImpsClientCapability() {
     29     }
     30 
     31     /**
     32      * Gets the type of the client.
     33      *
     34      * @return the type of the client.
     35      */
     36     public static String getClientType() {
     37         return "MOBILE_PHONE";
     38     }
     39 
     40     /**
     41      * Get the maximum number of bytes of XML (WBXML, SMS - depending on the
     42      * actual encoding) primitive that the client-side parser can handle.
     43      *
     44      * @return the maximum number of bytes that the parser can handle.
     45      */
     46     public static int getParserSize() {
     47         // TODO: we do not really have a limit for this for now. Just return
     48         // a number big enough.
     49         return 256 * 1024;
     50     }
     51 
     52     /**
     53      * Get the maximum number of bytes of the message content that the client
     54      * can handle.
     55      *
     56      * @return the maximum number of bytes of the message content that the
     57      * client can handle.
     58      */
     59     public static int getAcceptedContentLength() {
     60         return 256 * 1024;
     61     }
     62 
     63     /**
     64      * Gets the maximum number of open transactions from both client and
     65      * server side at any given time.
     66      *
     67      * @return the maximum number of open transactions.
     68      */
     69     public static int getMultiTrans() {
     70         return 1;
     71     }
     72 
     73     /**
     74      * Gets the maximum number of primitives that the client can handle within
     75      * the same transport message at any given time.
     76      *
     77      * @return the maximum number of primitives within the same transport
     78      *         message.
     79      */
     80     public static int getMultiTransPerMessage() {
     81         return 1;
     82     }
     83 
     84     /**
     85      * Gets the initial IM delivery method that the recipient client prefers in
     86      * the set of "PUSH" and "Notify/Get".
     87      *
     88      * @return "P" if prefers "PUSH", or "N" if prefers "Notify/Get".
     89      */
     90     public static String getInitialDeliveryMethod() {
     91         return "P";
     92     }
     93 
     94     /**
     95      * Get supported CIR methods in preferred order.
     96      *
     97      * @return a array of supported CIR methods.
     98      */
     99     public static CirMethod[] getSupportedCirMethods() {
    100         return new CirMethod[] {
    101                 CirMethod.STCP,
    102                 CirMethod.SSMS,
    103                 CirMethod.SHTTP,
    104         };
    105     }
    106 
    107     /**
    108      * Get supported bearers (HTTP(S), WSP, SMS).
    109      *
    110      * @return the array of supported bearers.
    111      */
    112     public static TransportType[] getSupportedBearers() {
    113         return new TransportType[] {
    114                 TransportType.HTTP
    115         };
    116     }
    117 
    118     /**
    119      * Get supported Presence attributes
    120      *
    121      * @return the array of supported Presence attributes
    122      */
    123     public static String[] getSupportedPresenceAttribs() {
    124         return new String[] {
    125                 ImpsTags.OnlineStatus,
    126                 ImpsTags.ClientInfo,
    127                 ImpsTags.UserAvailability,
    128                 ImpsTags.StatusText,
    129                 ImpsTags.StatusContent,
    130         };
    131     };
    132 
    133     /**
    134      * Gets the basic presence attributes.
    135      *
    136      * @return an array of the basic Presence attributes.
    137      */
    138     public static String[] getBasicPresenceAttributes() {
    139         return new String[] {
    140                 ImpsTags.OnlineStatus,
    141                 ImpsTags.ClientInfo,
    142                 ImpsTags.UserAvailability,
    143         };
    144     }
    145 
    146 }
    147