From 24205b8dbc6487ee066fec07c9c0840a3be30bb7 Mon Sep 17 00:00:00 2001
From: Markus Doits
- * After you have set up everything with {@link #set_arg(String, String)} + * After you have set up everything with {@link #setArg(String, String)} * (and variants), you can call a function from the AIDL-interface. This * will *
* Note your thread will be blocked during execution - if you want to call - * the function asynchronously, see {@link #call_async(String)}. + * the function asynchronously, see {@link #callAsync(String)}. *
* * @param function * a remote function to call * @return true, if call successful (= no errors), else false * - * @see #call_async(String) - * @see #set_arg(String, String) - * @see #set_onCallFinishListener(OnCallFinishListener) + * @see #callAsync(String) + * @see #setArg(String, String) + * @see #setOnCallFinishListener(OnCallFinishListener) */ public boolean call(String function) { - boolean success = this.call(function, args, result); - if (onCallFinishListener != null) { + boolean success = this.call(function, mArgs, mResult); + if (mOnCallFinishListener != null) { try { if( LOCAL_LOGD ) Log.d(TAG, "About to execute callback"); - onCallFinishListener.onCallFinish(result); + mOnCallFinishListener.onCallFinish(mResult); if( LOCAL_LOGD ) Log.d(TAG, "Callback executed"); } catch (Exception e) { Log.w(TAG, "Exception on callback: (" + e.getClass() + ") " + e.getMessage(), e); - warning_list.add("(LOCAL) Could not execute callback (" + e.getClass() + "): " + e.getMessage()); + mWarningList.add("(LOCAL) Could not execute callback (" + e.getClass() + "): " + e.getMessage()); } } return success; @@ -321,8 +328,8 @@ public class ApgCon { ** To see whether the task is finished, you have to possibilities: *
* Note, that the parameters are not deleted after a call, so you have to - * reset ({@link #clear_args()}) them manually if you want to. + * reset ({@link #clearArgs()}) them manually if you want to. *
* * @@ -399,10 +406,10 @@ public class ApgCon { * @param val * the value * - * @see #clear_args() + * @see #clearArgs() */ - public void set_arg(String key, String val) { - args.putString(key, val); + public void setArg(String key, String val) { + mArgs.putString(key, val); } /** @@ -415,7 +422,7 @@ public class ApgCon { * *
*
- * set_arg("a key", new String[]{ "entry 1", "entry 2" });
+ * setArg("a key", new String[]{ "entry 1", "entry 2" });
*
*
*
@@ -424,14 +431,14 @@ public class ApgCon {
* @param vals
* the value
*
- * @see #set_arg(String, String)
+ * @see #setArg(String, String)
*/
- public void set_arg(String key, String vals[]) {
+ public void setArg(String key, String vals[]) {
ArrayList* Anything the has been set up with the various - * {@link #set_arg(String, String)} functions, is cleared. + * {@link #setArg(String, String)} functions, is cleared. *
*- * Note, that any warning, error, callback, result, etc. is not cleared with + * Note, that any warning, error, callback, mResult, etc. is not cleared with * this. *
* * @see #reset() */ - public void clear_args() { - args.clear(); + public void clearArgs() { + mArgs.clear(); } /** @@ -509,8 +516,8 @@ public class ApgCon { * the object's key you want to return * @return an object at position key, or null if not set */ - public Object get_arg(String key) { - return args.get(key); + public Object getArg(String key) { + return mArgs.get(key); } /** @@ -525,12 +532,12 @@ public class ApgCon { * @return a human readable description of a error that happened, or null if * no more errors * - * @see #has_next_error() - * @see #clear_errors() + * @see #hasNextError() + * @see #clearErrors() */ - public String get_next_error() { - if (error_list.size() != 0) - return error_list.remove(0); + public String getNextError() { + if (mErrorList.size() != 0) + return mErrorList.remove(0); else return null; } @@ -540,10 +547,10 @@ public class ApgCon { * * @return true, if there are unreturned errors, false otherwise * - * @see #get_next_error() + * @see #getNextError() */ - public boolean has_next_error() { - return error_list.size() != 0; + public boolean hasNextError() { + return mErrorList.size() != 0; } /** @@ -552,15 +559,15 @@ public class ApgCon { ** Values <100 mean the error happened locally, values >=100 mean the error * happened at the remote side (APG). See the IApgService.aidl (or get the - * human readable description with {@link #get_next_error()}) for what + * human readable description with {@link #getNextError()}) for what * errors >=100 mean. *
* * @return the id of the error that happened */ - public int get_error() { - if (result.containsKey(ret.ERROR.name())) - return result.getInt(ret.ERROR.name()); + public int getError() { + if (mResult.containsKey(ret.ERROR.name())) + return mResult.getInt(ret.ERROR.name()); else return -1; } @@ -577,12 +584,12 @@ public class ApgCon { * @return a human readable description of a warning that happened, or null * if no more warnings * - * @see #has_next_warning() - * @see #clear_warnings() + * @see #hasNextWarning() + * @see #clearWarnings() */ - public String get_next_warning() { - if (warning_list.size() != 0) - return warning_list.remove(0); + public String getNextWarning() { + if (mWarningList.size() != 0) + return mWarningList.remove(0); else return null; } @@ -592,94 +599,94 @@ public class ApgCon { * * @return true, if there are unreturned warnings, false otherwise * - * @see #get_next_warning() + * @see #getNextWarning() */ - public boolean has_next_warning() { - return warning_list.size() != 0; + public boolean hasNextWarning() { + return mWarningList.size() != 0; } /** * Get the result * *- * This gets your result. After doing an encryption or decryption with APG, + * This gets your mResult. After doing an encryption or decryption with APG, * you get the output with this function. *
*- * Note, that when your last remote call is unsuccessful, the result will + * Note, that when your last remote call is unsuccessful, the mResult will * still have the same value like the last successful call (or null, if no - * call was successful). To ensure you do not work with old call's results, - * either be sure to {@link #reset()} (or at least {@link #clear_result()}) + * call was successful). To ensure you do not work with old call's mResults, + * either be sure to {@link #reset()} (or at least {@link #clearResult()}) * your instance before each new call or always check that - * {@link #has_next_error()} is false. + * {@link #hasNextError()} is false. *
* - * @return the result of the last {@link #call(String)} or + * @return the mResult of the last {@link #call(String)} or * {@link #call_asinc(String)}. * * @see #reset() - * @see #clear_result() - * @see #get_result_bundle() + * @see #clearResult() + * @see #getResultBundle() */ - public String get_result() { - return result.getString(ret.RESULT.name()); + public String getResult() { + return mResult.getString(ret.RESULT.name()); } /** - * Get the result bundle + * Get the mResult bundle * *- * Unlike {@link #get_result()}, which only returns any en-/decrypted + * Unlike {@link #getResult()}, which only returns any en-/decrypted * message, this function returns the complete information that was returned * by Apg. This also includes the "RESULT", but additionally the warnings, * errors and any other information. *
** For warnings and errors it is suggested to use the functions that are - * provided here, namely {@link #get_error()}, {@link #get_next_error()}, + * provided here, namely {@link #getError()}, {@link #getNextError()}, * {@link #get_next_Warning()} etc.), but if any call returns something non - * standard, you have access to the complete result bundle to extract the + * standard, you have access to the complete mResult bundle to extract the * information. *
* - * @return the complete result-bundle of the last call to apg + * @return the complete mResult-bundle of the last call to apg */ - public Bundle get_result_bundle() { - return result; + public Bundle getResultBundle() { + return mResult; } - public error get_connection_status() { - return connection_status; + public error getConnectionStatus() { + return mConnectionStatus; } /** * Clears all unfetched errors * - * @see #get_next_error() - * @see #has_next_error() + * @see #getNextError() + * @see #hasNextError() */ - public void clear_errors() { - error_list.clear(); - result.remove(ret.ERROR.name()); + public void clearErrors() { + mErrorList.clear(); + mResult.remove(ret.ERROR.name()); } /** * Clears all unfetched warnings * - * @see #get_next_warning() - * @see #has_next_warning() + * @see #getNextWarning() + * @see #hasNextWarning() */ - public void clear_warnings() { - warning_list.clear(); + public void clearWarnings() { + mWarningList.clear(); } /** - * Clears the last result + * Clears the last mResult * - * @see #get_result() + * @see #getResult() */ - public void clear_result() { - result.remove(ret.RESULT.name()); + public void clearResult() { + mResult.remove(ret.RESULT.name()); } /** @@ -689,34 +696,34 @@ public class ApgCon { * a object to call back after async execution * @see ApgConInterface */ - public void set_onCallFinishListener(OnCallFinishListener lis) { - onCallFinishListener = lis; + public void setOnCallFinishListener(OnCallFinishListener lis) { + mOnCallFinishListener = lis; } /** * Clears any callback object * - * @see #set_onCallFinishListener(OnCallFinishListener) + * @see #setOnCallFinishListener(OnCallFinishListener) */ - public void clear_onCallFinishListener() { - onCallFinishListener = null; + public void clearOnCallFinishListener() { + mOnCallFinishListener = null; } /** * Checks, whether an async execution is running * *- * If you started something with {@link #call_async(String)}, this will + * If you started something with {@link #callAsync(String)}, this will * return true if the task is still running *
* * @return true, if an async task is still running, false otherwise * - * @see #call_async(String) + * @see #callAsync(String) * */ - public boolean is_running() { - return async_running; + public boolean isRunning() { + return mAsyncRunning; } /** @@ -724,24 +731,24 @@ public class ApgCon { * ** This currently resets everything in this instance. Errors, warnings, - * results, callbacks, ... are removed. Any connection to the remote + * mResults, callbacks, ... are removed. Any connection to the remote * interface is upheld, though. *
* *- * Note, that when an async execution ({@link #call_async(String)}) is - * running, it's result, warnings etc. will still be evaluated (which might + * Note, that when an async execution ({@link #callAsync(String)}) is + * running, it's mResult, warnings etc. will still be evaluated (which might * be not what you want). Also mind, that any callback you set is also * reseted, so on finishing the execution any before defined callback will * NOT BE TRIGGERED. *
*/ public void reset() { - clear_errors(); - clear_warnings(); - clear_args(); - clear_onCallFinishListener(); - result.clear(); + clearErrors(); + clearWarnings(); + clearArgs(); + clearOnCallFinishListener(); + mResult.clear(); } } -- cgit v1.2.3