moved more api functions to Api class
This commit is contained in:
@@ -930,7 +930,7 @@ Java_com_tutpro_baresip_MainActivity_reload_1config(JNIEnv *env, jobject thiz) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jint JNICALL
|
JNIEXPORT jint JNICALL
|
||||||
Java_com_tutpro_baresip_Utils_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaCmd) {
|
Java_com_tutpro_baresip_Api_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaCmd) {
|
||||||
const char *native_cmd = (*env)->GetStringUTFChars(env, javaCmd, 0);
|
const char *native_cmd = (*env)->GetStringUTFChars(env, javaCmd, 0);
|
||||||
LOGD("processing command '%s'\n", native_cmd);
|
LOGD("processing command '%s'\n", native_cmd);
|
||||||
if (strcmp(native_cmd, "audio_debug") == 0) {
|
if (strcmp(native_cmd, "audio_debug") == 0) {
|
||||||
@@ -942,7 +942,7 @@ Java_com_tutpro_baresip_Utils_cmd_1exec(JNIEnv *env, jobject thiz, jstring javaC
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_com_tutpro_baresip_Utils_audio_1codecs(JNIEnv *env, jobject thiz)
|
Java_com_tutpro_baresip_Api_audio_1codecs(JNIEnv *env, jobject thiz)
|
||||||
{
|
{
|
||||||
struct list *aucodecl = baresip_aucodecl();
|
struct list *aucodecl = baresip_aucodecl();
|
||||||
struct le *le;
|
struct le *le;
|
||||||
@@ -969,7 +969,7 @@ Java_com_tutpro_baresip_Utils_audio_1codecs(JNIEnv *env, jobject thiz)
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_com_tutpro_baresip_Utils_uri_1decode(JNIEnv *env, jobject thiz, jstring javaUri) {
|
Java_com_tutpro_baresip_Api_uri_1decode(JNIEnv *env, jobject thiz, jstring javaUri) {
|
||||||
const char *uri = (*env)->GetStringUTFChars(env, javaUri, 0);
|
const char *uri = (*env)->GetStringUTFChars(env, javaUri, 0);
|
||||||
struct pl pl;
|
struct pl pl;
|
||||||
struct uri uri2;
|
struct uri uri2;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
regint = findViewById(R.id.RegInt) as EditText
|
regint = findViewById(R.id.RegInt) as EditText
|
||||||
regint.setText(acc.regint.toString())
|
regint.setText(acc.regint.toString())
|
||||||
|
|
||||||
val audioCodecs = ArrayList(Utils.audio_codecs().split(","))
|
val audioCodecs = ArrayList(Api.audio_codecs().split(","))
|
||||||
newCodecs.addAll(audioCodecs)
|
newCodecs.addAll(audioCodecs)
|
||||||
while (newCodecs.size < audioCodecs.size) newCodecs.add("")
|
while (newCodecs.size < audioCodecs.size) newCodecs.add("")
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ class AccountActivity : AppCompatActivity() {
|
|||||||
if (ob != acc.outbound) {
|
if (ob != acc.outbound) {
|
||||||
val outbound = ArrayList<String>()
|
val outbound = ArrayList<String>()
|
||||||
for (i in ob.indices) {
|
for (i in ob.indices) {
|
||||||
if ((ob[i] == "") || Utils.uri_decode(ob[i])) {
|
if ((ob[i] == "") || Api.uri_decode(ob[i])) {
|
||||||
if (account_set_outbound(acc.accp, ob[i], i) == 0) {
|
if (account_set_outbound(acc.accp, ob[i], i) == 0) {
|
||||||
if (ob[i] != "")
|
if (ob[i] != "")
|
||||||
outbound.add(account_outbound(acc.accp, i))
|
outbound.add(account_outbound(acc.accp, i))
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.tutpro.baresip
|
|||||||
|
|
||||||
object Api {
|
object Api {
|
||||||
|
|
||||||
|
external fun audio_codecs(): String
|
||||||
external fun call_peeruri(callp: String): String
|
external fun call_peeruri(callp: String): String
|
||||||
|
external fun cmd_exec(cmd: String): Int
|
||||||
|
external fun uri_decode(uri: String): Boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
||||||
val outCalls = Call.uaCalls(calls, uas[aorSpinner.selectedItemPosition], "out")
|
val outCalls = Call.uaCalls(calls, uas[aorSpinner.selectedItemPosition], "out")
|
||||||
if (outCalls.size > 0) {
|
if (outCalls.size > 0) {
|
||||||
if (Utils.cmd_exec("zrtp_unverify " + outCalls[0].zid) != 0) {
|
if (Api.cmd_exec("zrtp_unverify " + outCalls[0].zid) != 0) {
|
||||||
Log.w("Baresip",
|
Log.w("Baresip",
|
||||||
"Command 'zrtp_unverify ${outCalls[0].zid}' failed")
|
"Command 'zrtp_unverify ${outCalls[0].zid}' failed")
|
||||||
} else {
|
} else {
|
||||||
@@ -405,7 +405,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
verifyDialog.setMessage("Do you want to verify SAS <${ev[1]}> <${ev[2]}>?")
|
verifyDialog.setMessage("Do you want to verify SAS <${ev[1]}> <${ev[2]}>?")
|
||||||
verifyDialog.setPositiveButton("Yes") { dialog, _ ->
|
verifyDialog.setPositiveButton("Yes") { dialog, _ ->
|
||||||
val security: Int
|
val security: Int
|
||||||
if (Utils.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
if (Api.cmd_exec("zrtp_verify ${ev[3]}") != 0) {
|
||||||
Log.w("Baresip", "Command 'zrtp_verify ${ev[3]}' failed")
|
Log.w("Baresip", "Command 'zrtp_verify ${ev[3]}' failed")
|
||||||
security = R.drawable.box_yellow
|
security = R.drawable.box_yellow
|
||||||
} else {
|
} else {
|
||||||
@@ -605,7 +605,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
R.id.about -> {
|
R.id.about -> {
|
||||||
Utils.cmd_exec("audio_debug")
|
Api.cmd_exec("audio_debug")
|
||||||
i = Intent(this, AboutActivity::class.java)
|
i = Intent(this, AboutActivity::class.java)
|
||||||
startActivityForResult(i, ABOUT_CODE)
|
startActivityForResult(i, ABOUT_CODE)
|
||||||
return true
|
return true
|
||||||
@@ -761,7 +761,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
unverifyDialog.setMessage("This call is SECURE and peer is VERIFIED! " +
|
unverifyDialog.setMessage("This call is SECURE and peer is VERIFIED! " +
|
||||||
"Do you want to unverify the peer?")
|
"Do you want to unverify the peer?")
|
||||||
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
unverifyDialog.setPositiveButton("Unverify") { dialog, _ ->
|
||||||
if (Utils.cmd_exec("zrtp_unverify " + call.zid) != 0) {
|
if (Api.cmd_exec("zrtp_unverify " + call.zid) != 0) {
|
||||||
Log.w("Baresip", "Command 'zrtp_unverify ${call.zid}' failed")
|
Log.w("Baresip", "Command 'zrtp_unverify ${call.zid}' failed")
|
||||||
} else {
|
} else {
|
||||||
security_button.setImageResource(R.drawable.box_yellow)
|
security_button.setImageResource(R.drawable.box_yellow)
|
||||||
|
|||||||
@@ -182,8 +182,4 @@ object Utils {
|
|||||||
return isLocked
|
return isLocked
|
||||||
}
|
}
|
||||||
|
|
||||||
external fun cmd_exec(cmd: String): Int
|
|
||||||
external fun uri_decode(uri: String): Boolean
|
|
||||||
external fun audio_codecs(): String
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user