]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCallLog.java
add call status to java call logs
[linphone] / java / common / org / linphone / core / LinphoneCallLog.java
1 /*
2 LinPhoneCallLog.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21 import java.util.Vector;
22
23
24
25 public interface LinphoneCallLog {
26         /**
27          * Represents call status
28          *
29          */
30         static class CallStatus {
31                 static private Vector values = new Vector();
32                 private final int mValue;
33                 private final String mStringValue;
34                 /**
35                  * Call success.
36                  */
37                 public final static CallStatus Sucess = new CallStatus(0,"Sucess");
38                 /**
39                  * Call aborted.
40                  */
41                 public final static CallStatus Aborted = new CallStatus(1,"Aborted");
42                 /**
43                  * missed incoming call.
44                  */
45                 public final static CallStatus Missed = new CallStatus(2,"Missed");
46                 /**
47                  * remote call declined.
48                  */
49                 public final static CallStatus Declined = new CallStatus(3,"Declined");
50                 private CallStatus(int value,String stringValue) {
51                         mValue = value;
52                         values.addElement(this);
53                         mStringValue=stringValue;
54                 }
55                 public static CallStatus fromInt(int value) {
56
57                         for (int i=0; i<values.size();i++) {
58                                 CallStatus state = (CallStatus) values.elementAt(i);
59                                 if (state.mValue == value) return state;
60                         }
61                         throw new RuntimeException("CallStatus not found ["+value+"]");
62                 }
63                 public String toString() {
64                         return mStringValue;
65                 }
66                 public int toInt() {
67                         return mValue;
68                 }
69         }
70         
71         public LinphoneAddress getFrom();
72         
73         public LinphoneAddress getTo ();
74         
75         public CallDirection getDirection();
76         /**
77          * get status of this call
78          * @return
79          */
80         public CallStatus getStatus();
81 }