mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
JNI transport ports accessors. use List. hide warnings.
This commit is contained in:
parent
a779c59e8b
commit
ea362d160c
7 changed files with 124 additions and 98 deletions
|
|
@ -1175,4 +1175,29 @@ extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv
|
|||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneCallImpl_getDuration(JNIEnv* env,jobject thiz,jlong ptr) {
|
||||
linphone_call_get_duration((LinphoneCall *) ptr);
|
||||
}
|
||||
|
||||
extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getSignalingTransportPort(JNIEnv* env,jobject thiz,jlong ptr, jint code) {
|
||||
LCSipTransports tr;
|
||||
linphone_core_get_sip_transports((LinphoneCore *) ptr, &tr);
|
||||
switch (code) {
|
||||
case 0:
|
||||
return tr.udp_port;
|
||||
case 1:
|
||||
return tr.tcp_port;
|
||||
case 3:
|
||||
return tr.tls_port;
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSignalingTransportPorts(JNIEnv* env,jobject thiz,jlong ptr,jint udp, jint tcp, jint tls) {
|
||||
LinphoneCore *lc = (LinphoneCore *) ptr;
|
||||
LCSipTransports tr;
|
||||
tr.udp_port = udp;
|
||||
tr.tcp_port = tcp;
|
||||
tr.tls_port = tls;
|
||||
|
||||
linphone_core_set_sip_transports(lc, &tr); // tr will be copied
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ public interface LinphoneCall {
|
|||
*
|
||||
*/
|
||||
static class State {
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
|
@ -116,6 +117,7 @@ public interface LinphoneCall {
|
|||
*/
|
||||
public static final State CallReleased = new State(18,"CallReleased");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private State(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public interface LinphoneCallLog {
|
|||
*
|
||||
*/
|
||||
static class CallStatus {
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
|
@ -50,6 +51,8 @@ public interface LinphoneCallLog {
|
|||
* remote call declined.
|
||||
*/
|
||||
public final static CallStatus Declined = new CallStatus(3,"Declined");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private CallStatus(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
package org.linphone.core;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
|
|
@ -31,6 +32,7 @@ public interface LinphoneCore {
|
|||
* linphone core states
|
||||
*/
|
||||
static public class GlobalState {
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* Off
|
||||
|
|
@ -52,6 +54,7 @@ public interface LinphoneCore {
|
|||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private GlobalState(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
@ -74,6 +77,7 @@ public interface LinphoneCore {
|
|||
*
|
||||
*/
|
||||
static public class RegistrationState {
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Vector values = new Vector();
|
||||
/**
|
||||
* None
|
||||
|
|
@ -98,6 +102,7 @@ public interface LinphoneCore {
|
|||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private RegistrationState(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
@ -120,6 +125,7 @@ public interface LinphoneCore {
|
|||
*
|
||||
*/
|
||||
static public class FirewallPolicy {
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* No firewall is assumed.
|
||||
|
|
@ -137,6 +143,7 @@ public interface LinphoneCore {
|
|||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private FirewallPolicy(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
@ -157,35 +164,20 @@ public interface LinphoneCore {
|
|||
return mValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Signaling transports
|
||||
*
|
||||
* Signaling transports ports.
|
||||
*/
|
||||
static public class Transport {
|
||||
/**
|
||||
* UDP transport
|
||||
*/
|
||||
public final static Transport udp =new Transport("udp");
|
||||
/**
|
||||
* TCP transport
|
||||
*/
|
||||
public final static Transport tcp =new Transport("tcp");
|
||||
private final String mStringValue;
|
||||
|
||||
private Transport(String stringValue) {
|
||||
mStringValue=stringValue;
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
static public class Transports {
|
||||
public int udp;
|
||||
public int tcp;
|
||||
public int tls;
|
||||
}
|
||||
/**
|
||||
* EC Calibrator Status
|
||||
.
|
||||
*
|
||||
*/
|
||||
static public class EcCalibratorStatus {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* Calibration in progress
|
||||
|
|
@ -203,6 +195,7 @@ public interface LinphoneCore {
|
|||
private final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private EcCalibratorStatus(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
@ -333,7 +326,8 @@ public interface LinphoneCore {
|
|||
/**
|
||||
* @return a list of LinphoneCallLog
|
||||
*/
|
||||
public Vector getCallLogs();
|
||||
@SuppressWarnings("unchecked")
|
||||
public List getCallLogs();
|
||||
|
||||
/**
|
||||
* This method is called by the application to notify the Linphone core library when network is reachable.
|
||||
|
|
@ -430,17 +424,13 @@ public interface LinphoneCore {
|
|||
*/
|
||||
public boolean isEchoCancellationEnabled();
|
||||
/**
|
||||
* set transport used for signaling (TCP or UDP)
|
||||
*
|
||||
* @param aTransport
|
||||
* @param transports used for signaling (TCP, UDP and TLS)
|
||||
*/
|
||||
public void setSignalingTransport(Transport aTransport);
|
||||
public void setSignalingTransportPorts(Transports transports);
|
||||
/**
|
||||
* get transport used for signaling (TCP or UDP)
|
||||
*
|
||||
* @return Transport;
|
||||
* @return transports used for signaling (TCP, UDP, TLS)
|
||||
*/
|
||||
public Transport getSignalingTransport();
|
||||
public Transports getSignalingTransportPorts();
|
||||
/**
|
||||
* not implemented
|
||||
* @param value
|
||||
|
|
|
|||
|
|
@ -36,12 +36,13 @@ abstract public class LinphoneCoreFactory {
|
|||
factoryName = className;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final synchronized LinphoneCoreFactory instance() {
|
||||
try {
|
||||
if (theLinphoneCoreFactory == null) {
|
||||
Class lFactoryClass = Class.forName(factoryName);
|
||||
theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();
|
||||
}
|
||||
if (theLinphoneCoreFactory == null) {
|
||||
Class lFactoryClass = Class.forName(factoryName);
|
||||
theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Cannot instanciate factory ["+factoryName+"]");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public interface LinphoneFriend {
|
|||
*
|
||||
*/
|
||||
static class SubscribePolicy {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
|
|
@ -51,6 +53,8 @@ public interface LinphoneFriend {
|
|||
* Automatically accepts a subscription request.
|
||||
*/
|
||||
public final static SubscribePolicy SPAccept = new SubscribePolicy(2,"SPAccept");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private SubscribePolicy(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
*/
|
||||
package org.linphone.core;
|
||||
|
||||
import java.util.Vector;
|
||||
|
|
@ -27,71 +27,72 @@ import java.util.Vector;
|
|||
*/
|
||||
|
||||
public class OnlineStatus {
|
||||
@SuppressWarnings("unchecked")
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* Offline
|
||||
*/
|
||||
static public OnlineStatus Offline = new OnlineStatus(0,"Offline");
|
||||
/**
|
||||
* Online
|
||||
*/
|
||||
static public OnlineStatus Online = new OnlineStatus(1,"Online");
|
||||
/**
|
||||
* Busy
|
||||
*/
|
||||
static public OnlineStatus Busy = new OnlineStatus(2,"Busy");
|
||||
/**
|
||||
* Be Right Back
|
||||
*/
|
||||
static public OnlineStatus BeRightBack = new OnlineStatus(3,"BeRightBack");
|
||||
/**
|
||||
* Away
|
||||
*/
|
||||
static public OnlineStatus Away = new OnlineStatus(4,"Away");
|
||||
/**
|
||||
* On The Phone
|
||||
*/
|
||||
static public OnlineStatus OnThePhone = new OnlineStatus(5,"OnThePhone");
|
||||
/**
|
||||
* Out To Lunch
|
||||
*/
|
||||
static public OnlineStatus OutToLunch = new OnlineStatus(6,"OutToLunch ");
|
||||
/**
|
||||
* Do Not Disturb
|
||||
*/
|
||||
static public OnlineStatus DoNotDisturb = new OnlineStatus(7,"DoNotDisturb");
|
||||
/**
|
||||
* Moved in this sate, call can be redirected if an alternate contact address has been set using function {@link LinphoneCore#setPresenceInfo(int, String, OnlineStatus)}
|
||||
*/
|
||||
static public OnlineStatus StatusMoved = new OnlineStatus(8,"StatusMoved");
|
||||
/**
|
||||
* Using another messaging service
|
||||
*/
|
||||
static public OnlineStatus StatusAltService = new OnlineStatus(9,"StatusAltService");
|
||||
/**
|
||||
* Pending
|
||||
*/
|
||||
static public OnlineStatus Pending = new OnlineStatus(10,"Pending");
|
||||
|
||||
static private Vector values = new Vector();
|
||||
/**
|
||||
* Offline
|
||||
*/
|
||||
static public OnlineStatus Offline = new OnlineStatus(0,"Offline");
|
||||
/**
|
||||
* Online
|
||||
*/
|
||||
static public OnlineStatus Online = new OnlineStatus(1,"Online");
|
||||
/**
|
||||
* Busy
|
||||
*/
|
||||
static public OnlineStatus Busy = new OnlineStatus(2,"Busy");
|
||||
/**
|
||||
* Be Right Back
|
||||
*/
|
||||
static public OnlineStatus BeRightBack = new OnlineStatus(3,"BeRightBack");
|
||||
/**
|
||||
* Away
|
||||
*/
|
||||
static public OnlineStatus Away = new OnlineStatus(4,"Away");
|
||||
/**
|
||||
* On The Phone
|
||||
*/
|
||||
static public OnlineStatus OnThePhone = new OnlineStatus(5,"OnThePhone");
|
||||
/**
|
||||
* Out To Lunch
|
||||
*/
|
||||
static public OnlineStatus OutToLunch = new OnlineStatus(6,"OutToLunch ");
|
||||
/**
|
||||
* Do Not Disturb
|
||||
*/
|
||||
static public OnlineStatus DoNotDisturb = new OnlineStatus(7,"DoNotDisturb");
|
||||
/**
|
||||
* Moved in this sate, call can be redirected if an alternate contact address has been set using function {@link LinphoneCore#setPresenceInfo(int, String, OnlineStatus)}
|
||||
*/
|
||||
static public OnlineStatus StatusMoved = new OnlineStatus(8,"StatusMoved");
|
||||
/**
|
||||
* Using another messaging service
|
||||
*/
|
||||
static public OnlineStatus StatusAltService = new OnlineStatus(9,"StatusAltService");
|
||||
/**
|
||||
* Pending
|
||||
*/
|
||||
static public OnlineStatus Pending = new OnlineStatus(10,"Pending");
|
||||
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
protected final int mValue;
|
||||
private final String mStringValue;
|
||||
|
||||
private OnlineStatus(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue=stringValue;
|
||||
@SuppressWarnings("unchecked")
|
||||
private OnlineStatus(int value,String stringValue) {
|
||||
mValue = value;
|
||||
values.addElement(this);
|
||||
mStringValue=stringValue;
|
||||
}
|
||||
public static OnlineStatus fromInt(int value) {
|
||||
for (int i=0; i<values.size();i++) {
|
||||
OnlineStatus state = (OnlineStatus) values.elementAt(i);
|
||||
if (state.mValue == value) return state;
|
||||
}
|
||||
public static OnlineStatus fromInt(int value) {
|
||||
throw new RuntimeException("state not found ["+value+"]");
|
||||
}
|
||||
|
||||
for (int i=0; i<values.size();i++) {
|
||||
OnlineStatus state = (OnlineStatus) values.elementAt(i);
|
||||
if (state.mValue == value) return state;
|
||||
}
|
||||
throw new RuntimeException("state not found ["+value+"]");
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
public String toString() {
|
||||
return mStringValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue