You can control KSWEB by your application via Android Broadcast messages.
To apply control commands use this java class in your Android project: KSWEBControl.java
The typical usage is to extend this class by your main activity. Each command requires a tag for tracking of the result of its execution. KSWEB sends an answer with a tag via Broadcast after executing any command. It can be KSWEBControl.RESPOND_OK or KSWEBControl.RESPOND_ERROR.
Here you can see a list of available commands to control KSWEB.
This group of static commands allows you to start/stop components (servers) of KSWEB:
public static void ftpStart(Activity activity, String tag); public static void ftpStop(Activity activity, String tag); public static void lighttpdStart(Activity activity, String tag); public static void lighttpdStop(Activity activity, String tag); public static void nginxStart(Activity activity, String tag); public static void nginxStop(Activity activity, String tag); public static void mysqlStart(Activity activity, String tag); public static void mysqlStop(Activity activity, String tag);
These commands allow to start/close KSWEB. “Finish activity” allows to unload KSWEB from memory without shutting down servers:
public static void kswebStart(Activity activity, String tag); public static void kswebClose(Activity activity, String tag); public static void kswebFinishActivity(Activity activity, String tag);
To configure servers use these commands
Content of configuration file will be replaced by data from configTxt parameter:
public static void lighttpdSetConfig(Activity activity, String tag, String configTxt); public static void nginxSetConfig(Activity activity, String tag, String configTxt); public static void phpSetConfig(Activity activity, String tag, String configTxt); public static void mysqlSetConfig(Activity activity, String tag, String configTxt);
To control http servers host list you can use these commands:
public static void lighttpdAddHost(Activity activity, String tag, String hostname, String port, String rootDir); public static void lighttpdDeleteHost(Activity activity, String tag, String hostname, String port, String rootDir); public static void nginxAddHost(Activity activity, String tag, String hostname, String port, String rootDir); public static void nginxDeleteHost(Activity activity, String tag, String hostname, String port, String rootDir);