NEXT, PREV, BATT, CALLLOG, SMSLOG,
LS, RM, CONTACTS, DISABLE, ENABLE,
POLL, HANGUP, ANSWER, LAUNCH, DATA,
- GPS, GLOCATION, REBOOT, SHUTDOWN, NOTIFY
+ GPS, GLOCATION, REBOOT, NOTIFY, SCREENCAP,
+ TORCH
}
/**
/** Fine battery status notifications */
BATTERY_CHANGED,
/** Headset plug/unplug notifications */
- HEADSET
+ HEADSET,
+ /** Phone booted notifications */
+ BOOT,
}
/**
/** Location tracking is active. Registered by {@link Command#LOCATION}, unregistered by {@link Command#NOLOCATION} */
LOCATION(location_tracking_is_active),
/** The phone is ringing. Registered/unregistered by {@link Command#RING} */
- RING(ringing),
- /** The polling alarm is on. Registered/unregistered by {@link Command#POLL} */
- POLL(the_polling_service_is_running);
+ RING(ringing);
/** String resource: the event description */
public final int resource;
*/
public static URL getServerURL(final Context context, final String path) throws MalformedURLException{
final String hostname=PreferenceManager.getDefaultSharedPreferences(context).getString("hostname", "fonbot.ieval.ro");
- final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "7777"));
- final URL url=new URL("https", hostname, port, path);
+ final int port=Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(context).getString("port", "443"));
+ final URL url=new URL("http", hostname, port, path);
return url;
}
- /**
- * Poll the server for pending commands. This function must not be called from BroadcastReceivers
- *
- * @param context Context instance
- */
- public static void pollServer(final Context context){
- new HttpCallExecutableRunnable("/get", null, context, new PollResultCallback(context), false).execute();
- }
-
- /**
- * Poll the server for pending commands from {@link FonBotMainService}. This function should be used from BroadcastReceviers instead of {@link #pollServer}
- *
- * @param context Context instance
- */
- public static void safePollServer(final Context context){
- final Intent intent=new Intent(context, FonBotMainService.class);
- intent.setAction(FonBotMainService.ACTION_TRIGGER_POLL);
- context.startService(intent);
- }
/**
* Executes a given command
*
break;
case POLL:
- if(args.length>1){
- Heavy.help(context, replyTo, toNonNull(Command.POLL));
- break;
- }
-
- if(args.length==0){
- Heavy.poll(context, replyTo);
- break;
- }
-
- final long interval;
- try{
- interval=Long.parseLong(args[0]);
- } catch(NumberFormatException e){
- sendMessage(context, replyTo, cannot_parse_interval);
- break;
- }
-
- Heavy.poll(context, replyTo, interval);
+ Heavy.poll(context, replyTo);
break;
case HANGUP:
Heavy.reboot(context, replyTo, args.length==0?null:args[0]);
break;
- case SHUTDOWN:
- //TODO: implement command
- break;
-
case NOTIFY:
if(args.length!=1 && args.length!=3){
Heavy.help(context, replyTo, toNonNull(Command.NOTIFY));
else
Heavy.notify(context, replyTo, id, toNonNull(args[1]), toNonNull(args[2]));
break;
+
+ case SCREENCAP:
+ if(args.length != 1){
+ Heavy.help(context, replyTo, toNonNull(Command.SCREENCAP));
+ return;
+ }
+
+ Heavy.screencap(context, replyTo, args[0]);
+ break;
+
+ case TORCH:
+ Heavy.torch(context, replyTo);
+ break;
}
}