Commit 4fe13b9c authored by jehan's avatar jehan

add get_state native method

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@74 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 5648f98d
......@@ -118,16 +118,22 @@ int p2pproxy_resourcelocation_get_sip_proxyregistrar_uri(char* aStringArray, siz
jboolean lIsCopy;
getSipProxyRegistrarUriMethod = (*p2pproxy_application_jnienv)->GetStaticMethodID(p2pproxy_application_jnienv, p2pproxy_proxy_main_class, "getSipProxyRegistrarUriMethod", "()[java/lang/String;");
jstring lJStringResult = (*p2pproxy_application_jnienv)->CallStaticObjectMethod(p2pproxy_application_jnienv, p2pproxy_proxy_main_class, getSipProxyRegistrarUriMethod);
lJStringResult = (*p2pproxy_application_jnienv)->CallStaticObjectMethod(p2pproxy_application_jnienv, p2pproxy_proxy_main_class, getSipProxyRegistrarUriMethod);
if (lJStringResult == 0) {
return P2PPROXY_ERROR_RESOURCELOCATOR_SERVER_NOT_FOUND;
}
lString = GetStringUTFChars(p2pproxy_application_jnienv, lJStringResult, &lIsCopy);
strcpy(aStringArray,lString,aSize);
ReleaseStringUTFChars(p2pproxy_application_jnienv, lJStringResult, lString);
lString = (*p2pproxy_application_jnienv)->GetStringUTFChars(p2pproxy_application_jnienv, lJStringResult, &lIsCopy);
memcpy(aStringArray,lString,aSize);
(*p2pproxy_application_jnienv)->ReleaseStringUTFChars(p2pproxy_application_jnienv, lJStringResult, lString);
return P2PPROXY_NO_ERROR;
}
int p2pproxy_application_get_state() {
jmethodID stateMethod;
stateMethod = (*p2pproxy_application_jnienv)->GetStaticMethodID(p2pproxy_application_jnienv, p2pproxy_proxy_main_class, "getState", "()I");
return (*p2pproxy_application_jnienv)->CallStaticIntMethod(p2pproxy_application_jnienv, p2pproxy_proxy_main_class, stateMethod);
}
......@@ -30,7 +30,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define P2PPROXY_ACCOUNTMGT_USER_EXIST 1
#define P2PPROXY_ACCOUNTMGT_USER_NOT_EXIST 0
/* state code*/
#define P2PPROXY_CONNECTED 2
#define P2PPROXY_NOT_CONNECTED 1
/* status code*/
#define P2PPROXY_NO_ERROR 0
/*error codes*/
......@@ -52,6 +54,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
int p2pproxy_application_start(int argc, char **argv);
/**
* return status
* @return P2PPROXY_CONNECTED, P2PPROXY_NOT_ERROR
*
*/
int p2pproxy_application_get_state();
/**
* return the status string corresponding to the status code
*/
......
......@@ -422,4 +422,12 @@ public static String getSipProxyRegistrarUri() {
return null;
}
}
public static int getState() {
try {
isReady();
return P2pProxylauncherConstants.P2PPROXY_CONNECTED;
} catch (P2pProxyException e) {
return P2pProxylauncherConstants.P2PPROXY_NOT_CONNECTED;
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment