]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCallLog.java
javadoc enhancements
[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  * Call data records object 
22  *
23  */
24 import java.util.Vector;
25
26
27 /**
28  * Object representing a call log.
29  *
30  *
31 **/
32 public interface LinphoneCallLog {
33         /**
34          * Represents call status
35          *
36          */
37         static class CallStatus {
38                 
39                 static private Vector<CallStatus> values = new Vector<CallStatus>();
40                 private final int mValue;
41                 private final String mStringValue;
42                 /**
43                  * Call success.
44                  */
45                 public final static CallStatus Success = new CallStatus(0,"Sucess");
46                 /**
47                  * Call aborted.
48                  */
49                 public final static CallStatus Aborted = new CallStatus(1,"Aborted");
50                 /**
51                  * missed incoming call.
52                  */
53                 public final static CallStatus Missed = new CallStatus(2,"Missed");
54                 /**
55                  * remote call declined.
56                  */
57                 public final static CallStatus Declined = new CallStatus(3,"Declined");
58                 
59                 
60                 private CallStatus(int value,String stringValue) {
61                         mValue = value;
62                         values.addElement(this);
63                         mStringValue=stringValue;
64                 }
65                 public static CallStatus fromInt(int value) {
66
67                         for (int i=0; i<values.size();i++) {
68                                 CallStatus state = (CallStatus) values.elementAt(i);
69                                 if (state.mValue == value) return state;
70                         }
71                         throw new RuntimeException("CallStatus not found ["+value+"]");
72                 }
73                 public String toString() {
74                         return mStringValue;
75                 }
76                 public int toInt() {
77                         return mValue;
78                 }
79         }
80         
81         /**
82          * Originator of the call as a LinphoneAddress object.
83          * @return LinphoneAddress
84          */
85         public LinphoneAddress getFrom();
86         /**
87          * Destination of the call as a LinphoneAddress object.
88          * @return
89          */
90         public LinphoneAddress getTo ();
91         /**
92          * The direction of the call
93          * @return CallDirection
94          */
95         public CallDirection getDirection();
96         /**
97          * get status of this call
98          * @return CallStatus
99          */
100         public CallStatus getStatus();
101         
102         /**
103          * A human readable String with the start date/time of the call
104          * @return String
105          */
106         public String getStartDate();
107         
108         /**
109          * A  timestamp of the start date/time of the call in milliseconds since January 1st 1970
110          * @return  long
111          */
112         public long getTimestamp();
113         
114         /**
115          * The call duration, in seconds
116          * @return int
117          */
118         public int getCallDuration();
119         /**
120          *  Call id from signaling
121          * @return int
122          */
123         public int getCallId();
124 }