]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneChatMessage.java
callback notif text delivered JNI
[linphone] / java / common / org / linphone / core / LinphoneChatMessage.java
1 package org.linphone.core;
2
3 import java.util.Vector;
4
5
6 public interface LinphoneChatMessage {
7         interface StateListener{
8                 void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state);
9         }
10         static class State {
11                 @SuppressWarnings("rawtypes")
12                 static private Vector values = new Vector();
13                 private final int mValue;
14                 public final int value() {return mValue;}
15                 
16                 private final String mStringValue;
17                 /**
18                  * Idle
19                  */
20                 public final static State Idle = new State(0,"Idle");
21                 /**
22                  * Incoming call received.
23                  */
24                 public final static State InProgress = new State(1,"InProgress");
25                 /**
26                  * Outgoing call initialiazed.
27                  */
28                 public final static State Delivered = new State(2,"Delivered");
29                 /**
30                  * Outgoing call in progress. 
31                  */
32                 public final static State NotDelivered = new State(3,"NotDelivered");
33                 
34                 @SuppressWarnings("unchecked")
35                 private State(int value,String stringValue) {
36                         mValue = value;
37                         values.addElement(this);
38                         mStringValue=stringValue;
39                 }
40                 
41                 public static State fromInt(int value) {
42
43                         for (int i=0; i<values.size();i++) {
44                                 State state = (State) values.elementAt(i);
45                                 if (state.mValue == value) return state;
46                         }
47                         throw new RuntimeException("state not found ["+value+"]");
48                 }
49                 public String toString() {
50                         return mStringValue;
51                 }
52                 public int toInt() {
53                         return mValue;
54                 }
55         }
56         
57         long getNativePtr();
58         
59         Object getUserData();
60         
61         void setUserData();
62 }