@Override public void receiveData(Context context, int transactionId, PebbleDictionary data) { Follow followMe = ((DroidPlannerApp) applicationContext).followMe; PebbleKit.sendAckToPebble(applicationContext, transactionId); int request = (data.getInteger(KEY_PEBBLE_REQUEST).intValue()); switch (request) { case KEY_REQUEST_MODE_FOLLOW: followMe.toggleFollowMeState(); break; case KEY_REQUEST_CYCLE_FOLLOW_TYPE: followMe.cycleType(); break; case KEY_REQUEST_MODE_LOITER: ((DroidPlannerApp) applicationContext) .getDrone() .state .changeFlightMode(ApmModes.ROTOR_LOITER); break; case KEY_REQUEST_MODE_RTL: ((DroidPlannerApp) applicationContext) .getDrone() .state .changeFlightMode(ApmModes.ROTOR_RTL); break; } }
@Override public void onStop() { super.onStop(); dpApp.removeApiListener(this); }
protected Drone getDrone() { return dpApp.getDrone(); }
@Override public void onStart() { super.onStart(); dpApp.addApiListener(this); }
protected MissionProxy getMissionProxy() { return dpApp.getMissionProxy(); }