mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
initial commit
This commit is contained in:
commit
cb42456140
8 changed files with 367 additions and 0 deletions
23
LinphoneAuthInfo.java
Normal file
23
LinphoneAuthInfo.java
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
LinphoneAuthInfo.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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;
|
||||
|
||||
public interface LinphoneAuthInfo {
|
||||
|
||||
}
|
||||
68
LinphoneCore.java
Normal file
68
LinphoneCore.java
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
LinphoneCore.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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.io.File;
|
||||
import java.net.URI;
|
||||
|
||||
public interface LinphoneCore {
|
||||
/*
|
||||
* linphone core states
|
||||
*/
|
||||
interface GeneralState {
|
||||
/* states for GSTATE_GROUP_POWER */
|
||||
static int GSTATE_POWER_OFF =0; /* initial state */
|
||||
static int GSTATE_POWER_STARTUP=1;
|
||||
static int GSTATE_POWER_ON=2;
|
||||
static int GSTATE_POWER_SHUTDOWN=3;
|
||||
/* states for GSTATE_GROUP_REG */
|
||||
static int GSTATE_REG_NONE=10; /* initial state */
|
||||
static int GSTATE_REG_OK=11;
|
||||
static int GSTATE_REG_FAILED=12;
|
||||
/* states for GSTATE_GROUP_CALL */
|
||||
static int GSTATE_CALL_IDLE=20; /* initial state */
|
||||
static int GSTATE_CALL_OUT_INVITE=21;
|
||||
static int GSTATE_CALL_OUT_CONNECTED=22;
|
||||
static int GSTATE_CALL_IN_INVITE=23;
|
||||
static int GSTATE_CALL_IN_CONNECTED=24;
|
||||
static int GSTATE_CALL_END=25;
|
||||
static int GSTATE_CALL_ERROR=26;
|
||||
static int GSTATE_INVALID=27;
|
||||
/**
|
||||
* get new state {@link: }
|
||||
*/
|
||||
public int getNewState();
|
||||
}
|
||||
|
||||
|
||||
public LinphoneProxyConfig createProxyConfig(URI identity,URI proxy,URI route);
|
||||
|
||||
public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg);
|
||||
|
||||
/**
|
||||
* @return null if no default proxyconfig
|
||||
*/
|
||||
public LinphoneProxyConfig getDefaultProxyConfig();
|
||||
|
||||
void addAuthInfo(LinphoneAuthInfo info);
|
||||
|
||||
public void invite(String url);
|
||||
|
||||
public void iterate();
|
||||
}
|
||||
42
LinphoneCoreException.java
Normal file
42
LinphoneCoreException.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
LinphoneCoreException.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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;
|
||||
|
||||
public class LinphoneCoreException extends Exception {
|
||||
|
||||
public LinphoneCoreException() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public LinphoneCoreException(String detailMessage) {
|
||||
super(detailMessage);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public LinphoneCoreException(Throwable throwable) {
|
||||
super(throwable);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public LinphoneCoreException(String detailMessage, Throwable throwable) {
|
||||
super(detailMessage, throwable);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
43
LinphoneCoreFactory.java
Normal file
43
LinphoneCoreFactory.java
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
LinphoneCoreFactory.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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.io.File;
|
||||
|
||||
public class LinphoneCoreFactory {
|
||||
static {
|
||||
System.loadLibrary("liblinphone");
|
||||
}
|
||||
static LinphoneCoreFactory theLinphoneCoreFactory = new LinphoneCoreFactory();
|
||||
|
||||
public static LinphoneCoreFactory instance() {
|
||||
|
||||
return theLinphoneCoreFactory;
|
||||
}
|
||||
public LinphoneAuthInfo createAuthInfo(String username,String password) {
|
||||
throw new RuntimeException("Not Implemented yet");
|
||||
}
|
||||
|
||||
public LinphoneCore createLinphoneCore(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) {
|
||||
throw new RuntimeException("Not Implemented yet");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
63
LinphoneCoreImpl.java
Normal file
63
LinphoneCoreImpl.java
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
LinphoneCoreImpl.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
public class LinphoneCoreImpl implements LinphoneCore {
|
||||
|
||||
private final LinphoneCoreListener mListener;
|
||||
private final long nativePtr;
|
||||
private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata);
|
||||
private native void iterate(long nativePtr);
|
||||
LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig,File factoryConfig,Object userdata) throws IOException {
|
||||
mListener=listener;
|
||||
nativePtr = newLinphoneCore(listener,userConfig.getCanonicalPath(),factoryConfig.getCanonicalPath(),userdata);
|
||||
}
|
||||
|
||||
public void addAuthInfo(LinphoneAuthInfo info) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public LinphoneProxyConfig createProxyConfig(URI identity, URI proxy,URI route) {
|
||||
return new LinphoneProxyConfigImpl(identity, proxy, route);
|
||||
}
|
||||
|
||||
public LinphoneProxyConfig getDefaultProxyConfig() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void invite(String url) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void iterate() {
|
||||
iterate(nativePtr);
|
||||
}
|
||||
|
||||
public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
49
LinphoneCoreListener.java
Normal file
49
LinphoneCoreListener.java
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
LinphoneCoreListener.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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;
|
||||
|
||||
|
||||
|
||||
public interface LinphoneCoreListener {
|
||||
|
||||
/**< Notifies the application that it should show up
|
||||
* @return */
|
||||
public void show(LinphoneCore lc);
|
||||
/**< Notifies incoming calls
|
||||
* @return */
|
||||
public void inviteReceived(LinphoneCore lc,String from);
|
||||
/**< Notify calls terminated by far end
|
||||
* @return */
|
||||
public void byeReceived(LinphoneCore lc,String from);
|
||||
/**< Ask the application some authentication information
|
||||
* @return */
|
||||
public void authInfoRequested(LinphoneCore lc,String realm,String username);
|
||||
/**< Callback that notifies various events with human readable text.
|
||||
* @return */
|
||||
public void displayStatus(LinphoneCore lc,String message);;
|
||||
/**< Callback to display a message to the user
|
||||
* @return */
|
||||
public void displayMessage(LinphoneCore lc,String message);
|
||||
/** Callback to display a warning to the user
|
||||
* @return */
|
||||
public void displayWarning(LinphoneCore lc,String message);
|
||||
/**< State notification callback
|
||||
* @return */
|
||||
public void generalState(LinphoneCore lc,LinphoneCore.GeneralState state);
|
||||
}
|
||||
25
LinphoneProxyConfig.java
Normal file
25
LinphoneProxyConfig.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
LinphoneProxyConfig.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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;
|
||||
|
||||
public interface LinphoneProxyConfig {
|
||||
|
||||
void enableRegister(boolean value);
|
||||
|
||||
}
|
||||
54
LinphoneProxyConfigImpl.java
Normal file
54
LinphoneProxyConfigImpl.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
LinphoneProxyConfigImpl.java
|
||||
Copyright (C) 2010 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
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.net.URI;
|
||||
|
||||
|
||||
public class LinphoneProxyConfigImpl implements LinphoneProxyConfig {
|
||||
|
||||
final long nativePtr;
|
||||
protected LinphoneProxyConfigImpl(URI identity,URI proxy,URI route) {
|
||||
nativePtr = createAndAdd();
|
||||
edit(nativePtr);
|
||||
setIdentity(nativePtr,identity.getScheme()+":"+identity.getHost());
|
||||
done(nativePtr);
|
||||
}
|
||||
|
||||
protected void finalize() throws Throwable {
|
||||
deleteNative(nativePtr);
|
||||
}
|
||||
private native long createAndAdd();
|
||||
private native long deleteNative(long ptr);
|
||||
|
||||
private native void edit(long ptr);
|
||||
private native void done(long ptr);
|
||||
|
||||
private native void setIdentity(long ptr,String identity);
|
||||
/*private native void setProxy(long ptr,String identity);*/
|
||||
|
||||
private native void enableRegister(long ptr,boolean value);
|
||||
|
||||
public void enableRegister(boolean value) {
|
||||
edit(nativePtr);
|
||||
enableRegister(nativePtr,value);
|
||||
done(nativePtr);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue