Added new advanced configuration options to redirect sound and microphone.

Added JNI settings for sound and microphone redirection.
This commit is contained in:
Armin Novak 2013-09-19 13:45:16 +02:00
parent 14ea8f8b89
commit 0d9ab7ce6a
17 changed files with 140 additions and 10 deletions

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -654,6 +654,42 @@ JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls
(*env)->ReleaseStringUTFChars(env, jpath, path);
}
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env,
jclass cls, jint instance, jboolean enable)
{
char** p;
int count = 1;
freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings;
DEBUG_ANDROID("sound redirect: %s", enable ? "TRUE" : "FALSE");
p = malloc(sizeof(char*));
p[0] = "rdpsnd";
freerdp_client_add_static_channel(settings, count, p);
free(p);
}
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env,
jclass cls, jint instance, jboolean enable)
{
char** p;
int count = 1;
freerdp* inst = (freerdp*)instance;
rdpSettings * settings = inst->settings;
DEBUG_ANDROID("microphone redirect: %s", enable ? "TRUE" : "FALSE");
p = malloc(sizeof(char*));
p[0] = "audin";
freerdp_client_add_static_channel(settings, count, p);
free(p);
}
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable)
{
freerdp* inst = (freerdp*)instance;

View File

@ -45,6 +45,8 @@ JNIEXPORT void JNICALL jni_freerdp_set_performance_flags(JNIEnv *env, jclass cls
jboolean disableMenuAnimations, jboolean disableTheming, jboolean enableFontSmoothing, jboolean enableDesktopComposition);
JNIEXPORT void JNICALL jni_freerdp_set_advanced_settings(JNIEnv *env, jclass cls, jint instance, jstring jRemoteProgram, jstring jWorkDir);
JNIEXPORT void JNICALL jni_freerdp_set_drive_redirection(JNIEnv *env, jclass cls, jint instance, jstring jpath);
JNIEXPORT void JNICALL jni_freerdp_set_sound_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_microphone_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_clipboard_redirection(JNIEnv *env, jclass cls, jint instance, jboolean enable);
JNIEXPORT void JNICALL jni_freerdp_set_gateway_info(JNIEnv *env, jclass cls, jint instance, jstring jgatewayhostname, jint port, jstring jgatewayusername, jstring jgatewaypassword, jstring jgatewaydomain);
JNIEXPORT void JNICALL jni_freerdp_set_data_directory(JNIEnv *env, jclass cls, jint instance, jstring jdirectory);

View File

@ -76,6 +76,18 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
jni_freerdp_set_clipboard_redirection(env, cls, inst, enable);
}
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *env, jclass cls, jint inst, jboolean redirect)
{
jni_freerdp_set_sound_redirection(env, cls, inst, redirect);
}
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1microphone_1redirection
(JNIEnv *env, jclass cls, jint inst, jboolean redirect)
{
jni_freerdp_set_microphone_redirection(env, cls, inst, redirect);
}
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1drive_1redirection
(JNIEnv *env, jclass cls, jint inst, jstring path)
{

View File

@ -87,6 +87,22 @@ JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1clipboard_1redirection
(JNIEnv *, jclass, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_sound_redirection
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1sound_1redirection
(JNIEnv *, jclass, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_microphone_redirection
* Signature: (IZ)V
*/
JNIEXPORT void JNICALL Java_com_freerdp_freerdpcore_services_LibFreeRDP_freerdp_1set_1microphone_1redirection
(JNIEnv *, jclass, jint, jboolean);
/*
* Class: com_freerdp_freerdpcore_services_LibFreeRDP
* Method: freerdp_set_drive_redirection

View File

@ -115,6 +115,8 @@
<string name="settings_enable_gateway_settings">Enable Gateway</string>
<string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">Redirect SDCard</string>
<string name="settings_redirect_sound">Redirect Sound</string>
<string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Seguridad</string>
<string-array name="security_array">
<item>Automatico</item>

View File

@ -114,6 +114,8 @@
<string name="settings_enable_gateway_settings">Enable Gateway</string>
<string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">"Redirect SDCard"</string>
<string name="settings_redirect_sound">Redirect Sound</string>
<string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">"Securité"</string>
<string-array name="security_array">
<item>"Automatique"</item>

View File

@ -115,6 +115,8 @@
<string name="settings_enable_gateway_settings">Gateway inschakelen</string>
<string name="settings_gateway_settings">Gateway instellingen</string>
<string name="settings_redirect_sdcard">SDCard aankoppelen</string>
<string name="settings_redirect_sound">Redirect Sound</string>
<string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Beveiliging</string>
<string-array name="security_array">
<item>Automatisch</item>

View File

@ -112,6 +112,8 @@
<string name="settings_enable_gateway_settings">Enable Gateway</string>
<string name="settings_gateway_settings">Gateway Settings</string>
<string name="settings_redirect_sdcard">Redirect SDCard</string>
<string name="settings_redirect_sound">Redirect Sound</string>
<string name="settings_redirect_microphone">Redirect Microphone</string>
<string name="settings_security">Security</string>
<string-array name="security_array">
<item>Automatic</item>

View File

@ -36,6 +36,8 @@
</PreferenceScreen>
<CheckBoxPreference android:key="bookmark.redirect_sdcard" android:title="@string/settings_redirect_sdcard"/>
<CheckBoxPreference android:key="bookmark.redirect_sound" android:title="@string/settings_redirect_sound"/>
<CheckBoxPreference android:key="bookmark.redirect_microphone" android:title="@string/settings_redirect_microphone"/>
<com.freerdp.freerdpcore.utils.IntListPreference android:key="bookmark.security" android:title="@string/settings_security" android:entries="@array/security_array" android:entryValues="@array/security_values_array" />
<EditTextPreference android:key="bookmark.remote_program" android:title="@string/settings_remote_program" android:summary="notepad.exe"/>
<EditTextPreference android:key="bookmark.work_dir" android:title="@string/settings_work_dir"/>

View File

@ -82,6 +82,7 @@ public class GlobalApp extends Application implements LibFreeRDP.EventListener
super.onCreate();
bookmarkDB = new BookmarkDB(this);
manualBookmarkGateway = new ManualBookmarkGateway(bookmarkDB);
historyDB = new HistoryDB(this);

View File

@ -295,6 +295,8 @@ public class BookmarkBase implements Parcelable, Cloneable
private ScreenSettings screen3G;
private PerformanceFlags performance3G;
private boolean redirectSDCard;
private boolean redirectSound;
private boolean redirectMicrophone;
private int security;
private boolean consoleMode;
private String remoteProgram;
@ -309,6 +311,8 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = parcel.readParcelable(ScreenSettings.class.getClassLoader());
performance3G = parcel.readParcelable(PerformanceFlags.class.getClassLoader());
redirectSDCard = (parcel.readInt() == 1) ? true : false;
redirectSound = (parcel.readInt() == 1) ? true : false;
redirectMicrophone = (parcel.readInt() == 1) ? true : false;
security = parcel.readInt();
consoleMode = (parcel.readInt() == 1) ? true : false;
remoteProgram = parcel.readString();
@ -320,6 +324,8 @@ public class BookmarkBase implements Parcelable, Cloneable
screen3G = new ScreenSettings();
performance3G = new PerformanceFlags();
redirectSDCard = false;
redirectSound = false;
redirectMicrophone = false;
security = 0;
consoleMode = false;
remoteProgram = "";
@ -358,6 +364,22 @@ public class BookmarkBase implements Parcelable, Cloneable
return redirectSDCard;
}
public void setRedirectSound(boolean redirect) {
this.redirectSound = redirect;
}
public boolean getRedirectSound() {
return redirectSound;
}
public void setRedirectMicrophone(boolean redirect) {
this.redirectMicrophone = redirect;
}
public boolean getRedirectMicrophone() {
return redirectMicrophone;
}
public void setSecurity(int security) {
this.security = security;
}
@ -418,6 +440,8 @@ public class BookmarkBase implements Parcelable, Cloneable
out.writeParcelable(screen3G, flags);
out.writeParcelable(performance3G, flags);
out.writeInt(redirectSDCard ? 1 : 0);
out.writeInt(redirectSound ? 1 : 0);
out.writeInt(redirectMicrophone ? 1 : 0);
out.writeInt(security);
out.writeInt(consoleMode ? 1 : 0);
out.writeString(remoteProgram);
@ -620,6 +644,8 @@ public class BookmarkBase implements Parcelable, Cloneable
editor.putBoolean("bookmark.perf_themes_3g", advancedSettings.getPerformance3G().getTheming());
editor.putBoolean("bookmark.redirect_sdcard", advancedSettings.getRedirectSDCard());
editor.putBoolean("bookmark.redirect_sound", advancedSettings.getRedirectSound());
editor.putBoolean("bookmark.redirect_microphone", advancedSettings.getRedirectMicrophone());
editor.putInt("bookmark.security", advancedSettings.getSecurity());
editor.putString("bookmark.remote_program", advancedSettings.getRemoteProgram());
editor.putString("bookmark.work_dir", advancedSettings.getWorkDir());
@ -662,6 +688,8 @@ public class BookmarkBase implements Parcelable, Cloneable
advancedSettings.getPerformance3G().setTheming(sharedPrefs.getBoolean("bookmark.perf_themes_3g", false));
advancedSettings.setRedirectSDCard(sharedPrefs.getBoolean("bookmark.redirect_sdcard", false));
advancedSettings.setRedirectSound(sharedPrefs.getBoolean("bookmark.redirect_sound", false));
advancedSettings.setRedirectMicrophone(sharedPrefs.getBoolean("bookmark.redirect_microphone", false));
advancedSettings.setSecurity(sharedPrefs.getInt("bookmark.security", 0));
advancedSettings.setRemoteProgram(sharedPrefs.getString("bookmark.remote_program", ""));
advancedSettings.setWorkDir(sharedPrefs.getString("bookmark.work_dir", ""));

View File

@ -64,6 +64,8 @@ public abstract class BookmarkBaseGateway
rowid = insertPerformanceFlags(db, bookmark.getAdvancedSettings().getPerformance3G());
values.put("performance_3g", rowid);
values.put("redirect_sdcard", bookmark.getAdvancedSettings().getRedirectSDCard());
values.put("redirect_sound", bookmark.getAdvancedSettings().getRedirectSound());
values.put("redirect_microphone", bookmark.getAdvancedSettings().getRedirectMicrophone());
values.put("security", bookmark.getAdvancedSettings().getSecurity());
values.put("console_mode", bookmark.getAdvancedSettings().getConsoleMode());
values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram());
@ -100,6 +102,8 @@ public abstract class BookmarkBaseGateway
updateScreenSettings3G(db, bookmark);
updatePerformanceFlags3G(db, bookmark);
values.put("redirect_sdcard", bookmark.getAdvancedSettings().getRedirectSDCard());
values.put("redirect_sound", bookmark.getAdvancedSettings().getRedirectSound());
values.put("redirect_microphone", bookmark.getAdvancedSettings().getRedirectMicrophone());
values.put("security", bookmark.getAdvancedSettings().getSecurity());
values.put("console_mode", bookmark.getAdvancedSettings().getConsoleMode());
values.put("remote_program", bookmark.getAdvancedSettings().getRemoteProgram());
@ -219,6 +223,8 @@ public abstract class BookmarkBaseGateway
// advanced settings
columns.add("enable_3g_settings");
columns.add("redirect_sdcard");
columns.add("redirect_sound");
columns.add("redirect_microphone");
columns.add("security");
columns.add("console_mode");
columns.add("remote_program");
@ -277,6 +283,8 @@ public abstract class BookmarkBaseGateway
readScreenSettings3G(bookmark, cursor);
readPerformanceFlags3G(bookmark, cursor);
bookmark.getAdvancedSettings().setRedirectSDCard(cursor.getInt(cursor.getColumnIndex("redirect_sdcard")) == 0 ? false : true);
bookmark.getAdvancedSettings().setRedirectSound(cursor.getInt(cursor.getColumnIndex("redirect_sound")) == 0 ? false : true);
bookmark.getAdvancedSettings().setRedirectMicrophone(cursor.getInt(cursor.getColumnIndex("redirect_microphone")) == 0 ? false : true);
bookmark.getAdvancedSettings().setSecurity(cursor.getInt(cursor.getColumnIndex("security")));
bookmark.getAdvancedSettings().setConsoleMode(cursor.getInt(cursor.getColumnIndex("console_mode")) == 0 ? false : true);
bookmark.getAdvancedSettings().setRemoteProgram(cursor.getString(cursor.getColumnIndex("remote_program")));

View File

@ -22,14 +22,14 @@ import android.database.sqlite.SQLiteOpenHelper;
public class BookmarkDB extends SQLiteOpenHelper
{
private static final int DB_VERSION = 3;
private static final int DB_VERSION = 4;
private static final String DB_NAME = "bookmarks.db";
public static final String ID = BaseColumns._ID;
public BookmarkDB(Context context)
{
super(context, DB_NAME, null, DB_VERSION);
super(context, DB_NAME, null, DB_VERSION);
}
@Override
@ -101,6 +101,8 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "screen_3g, "
+ "performance_3g, "
+ "redirect_sdcard, "
+ "redirect_sound, "
+ "redirect_microphone, "
+ "security, "
+ "remote_program, "
+ "work_dir, "
@ -112,7 +114,7 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "'', "
+ "'', "
+ "3389, "
+ "1, 1, 2, 2, 0, 0, '', '', 0);";
+ "1, 1, 2, 2, 0, 0, 0, 0, '', '', 0);";
db.execSQL(sqlInsertDefaultSessionEntry);
}
@ -140,7 +142,9 @@ public class BookmarkDB extends SQLiteOpenHelper
+ "enable_3g_settings INTEGER DEFAULT 0, "
+ "screen_3g INTEGER NOT NULL, "
+ "performance_3g INTEGER NOT NULL, "
+ "redirect_sdcard INTEGER, "
+ "redirect_sdcard INTEGER DEFAULT 0, "
+ "redirect_sound INTEGER DEFAULT 0, "
+ "redirect_microphone INTEGER DEFAULT 0, "
+ "security INTEGER, "
+ "remote_program TEXT, "
+ "work_dir TEXT, "

View File

@ -40,6 +40,8 @@ public class LibFreeRDP
private static native void freerdp_set_data_directory(int inst, String directory);
private static native void freerdp_set_clipboard_redirection(int inst, boolean enable);
private static native void freerdp_set_sound_redirection(int inst, boolean enable);
private static native void freerdp_set_microphone_redirection(int inst, boolean enable);
private static native void freerdp_set_drive_redirection(int inst, String path);
private static native void freerdp_set_gateway_info(int inst, String gatewayhostname, int port,
@ -165,7 +167,15 @@ public class LibFreeRDP
freerdp_set_gateway_info(inst, gatewaySettings.getHostname(), gatewaySettings.getPort(),
gatewaySettings.getUsername(), gatewaySettings.getPassword(), gatewaySettings.getDomain());
}
// Sound redirection
if (advancedSettings.getRedirectSound())
freerdp_set_sound_redirection(inst, true);
// Microphone redirection
if (advancedSettings.getRedirectMicrophone())
freerdp_set_microphone_redirection(inst, true);
return true;
}

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -3,6 +3,7 @@
<name>aFreeRDP</name>
<comment></comment>
<projects>
<project>FreeRDPCore</project>
</projects>
<buildSpec>
<buildCommand>