1+ package com .googlecode .android_scripting .facade ;
2+
3+ import android .app .Service ;
4+ import android .content .Context ;
5+ import android .content .Intent ;
6+ import android .net .wifi .ScanResult ;
7+ import android .net .wifi .WifiInfo ;
8+ import android .net .wifi .WifiManager ;
9+ import android .net .wifi .WifiManager .WifiLock ;
10+ import android .os .Bundle ;
11+
12+ import com .googlecode .android_scripting .jsonrpc .RpcReceiver ;
13+ import com .googlecode .android_scripting .jsonrpc .RpcReceiverManager ;
14+ import com .googlecode .android_scripting .rpc .Rpc ;
15+ import com .googlecode .android_scripting .rpc .RpcOptional ;
16+ import com .googlecode .android_scripting .rpc .RpcParameter ;
17+ import com .zuowuxuxi .util .NAction ;
18+ import com .zuowuxuxi .util .NUtil ;
19+
20+ import java .util .List ;
21+
22+ /**
23+ * Wifi functions.
24+ *
25+ */
26+ public class QPyInterfaceFacade extends RpcReceiver {
27+ private final Service mService ;
28+
29+ public QPyInterfaceFacade (FacadeManager manager ) {
30+ super (manager );
31+ mService = manager .getService ();
32+
33+ }
34+
35+ @ Override
36+ public void shutdown () {
37+ // TODO Auto-generated method stub
38+ }
39+
40+ @ Rpc (description = "Execute QPython script throught SL4A" , returns = "True if the operation succeeded." )
41+ public Boolean executeQPy (@ RpcParameter (name = "QPython script path" ) @ RpcOptional String path ) {
42+
43+ String extPlgPlusName = com .zuowuxuxi .config .CONF .EXT_PLG_PLUS ;
44+
45+ //if (NUtil.checkAppInstalledByName(mService.getApplicationContext(), extPlgPlusName)) {
46+ Intent intent = new Intent ();
47+ intent .setClassName (extPlgPlusName , extPlgPlusName +".MPyApi" );
48+ intent .setFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
49+ intent .setAction (extPlgPlusName +".action.MPyApi" );
50+
51+ Bundle mBundle = new Bundle ();
52+ mBundle .putString ("app" , NAction .getCode (mService .getApplicationContext ()));
53+ mBundle .putString ("act" , "onPyApi" );
54+ mBundle .putString ("flag" , "SL4A" );
55+ mBundle .putString ("param" , "fileapi" );
56+ mBundle .putString ("pyfile" , path );
57+
58+ intent .putExtras (mBundle );
59+
60+ mService .getApplicationContext ().startActivity (intent );
61+
62+ //}
63+
64+ return true ;
65+ }
66+
67+ }
0 commit comments