timer.reset(NO_DELAY, [this, doneCb = std::move(doneCb)]() {
ASSERT(uiElements.size() == requiredArguments);
auto coord = uiElements.front()->getScanningCoordinates();
- utils::EventGenerator::generateTapGesture(coord.x, coord.y, DerivedType::hold_time);
- doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ auto res = utils::EventGenerator::generateTapGesture(coord.x, coord.y, DerivedType::hold_time);
+ if (res) {
+ doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ } else {
+ ERROR("%s", res.getError().message.c_str());
+ }
markAsCompleted();
return ecore::TimerRepetitionPolicy::cancel;
});
auto from = getStartPoint();
auto to = getEndPoint();
- utils::EventGenerator::generateDragGesture(from.x, from.y, to.x, to.y, DEFAULT_STEPS_NUMBER, NO_DELAY);
- doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ auto res = utils::EventGenerator::generateDragGesture(from.x, from.y, to.x, to.y, DEFAULT_STEPS_NUMBER, NO_DELAY);
+ if (res) {
+ doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ } else {
+ ERROR("%s", res.getError().message.c_str());
+ }
+
markAsCompleted();
return ecore::TimerRepetitionPolicy::cancel;
});
auto from = uiElements.front()->getScanningCoordinates();
auto to = uiElements.back()->getScanningCoordinates();
- utils::EventGenerator::generateDragGesture(from.x, from.y, to.x, to.y, DerivedType::steps, DerivedType::hold_time);
- doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ auto res = utils::EventGenerator::generateDragGesture(from.x, from.y, to.x, to.y, DerivedType::steps, DerivedType::hold_time);
+ if (res) {
+ doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ } else {
+ ERROR("%s", res.getError().message.c_str());
+ }
+
markAsCompleted();
return ecore::TimerRepetitionPolicy::cancel;
});
ASSERT(GestureDispatcher<DerivedType>::uiElements.size() == requiredArguments);
auto coord = GestureDispatcher<DerivedType>::uiElements.front()->getScanningCoordinates();
- utils::EventGenerator::generatePinchGesture(coord.x, coord.y, DerivedType::radius_change, DEFAULT_STEPS_NUMBER);
- doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ auto res = utils::EventGenerator::generatePinchGesture(coord.x, coord.y, DerivedType::radius_change, DEFAULT_STEPS_NUMBER);
+ if (res) {
+ doneCb.callAfterTimeElapsed(sideEffectDelays::eModGesture);
+ } else {
+ ERROR("%s", res.getError().message.c_str());
+ }
+
markAsCompleted();
return ecore::TimerRepetitionPolicy::cancel;
});
#include "UniversalSwitchLog.hpp"
#include "DoneCallback.hpp"
-#include "DBus.hpp"
#include "dbusLocators.hpp"
#include <efl_util.h>
});
}
- void EventGenerator::generateTapGesture(int x, int y, double press_time)
+ DBus::ValueOrError<void> EventGenerator::generateTapGesture(int x, int y, double press_time)
{
DEBUG("Tap with drag gesture, x: %d, y: %d, press time: %d", x, y, press_time);
DBus::ConnectionType::SYSTEM};
static auto tap_steps = 1;
- dbus.method<void(int, int, int, int, int, double)>("DispatchDragEvent").
- call(x, y, x, y, tap_steps, press_time); //TODO: const for steps number
+ return dbus.method<void(int, int, int, int, int, double)>("DispatchDragEvent").call(x, y, x, y, tap_steps, press_time);
}
- void EventGenerator::generateDragGesture(int from_x, int from_y, int to_x, int to_y, int steps, double hold_time)
+ DBus::ValueOrError<void> EventGenerator::generateDragGesture(int from_x, int from_y, int to_x, int to_y, int steps, double hold_time)
{
DEBUG("Drag gesture, from (x, y): (%d, %d), to (x, y): (%d, %d), steps: %d, hold on first time: %lf", from_x, from_y, to_x, to_y, steps, hold_time);
dbusLocators::accessibilityEMod::OBJ_PATH,
dbusLocators::accessibilityEMod::INTERFACE,
DBus::ConnectionType::SYSTEM};
- dbus.method<void(int, int, int, int, int, double)>("DispatchDragEvent").
- call(from_x, from_y, to_x, to_y, steps, hold_time);
+ return dbus.method<void(int, int, int, int, int, double)>("DispatchDragEvent").call(from_x, from_y, to_x, to_y, steps, hold_time);
}
- void EventGenerator::generatePinchGesture(int x, int y, int radius_change, int steps)
+ DBus::ValueOrError<void> EventGenerator::generatePinchGesture(int x, int y, int radius_change, int steps)
{
DEBUG("Pinch gesture, x: %d, y: %d, radius change: %d, steps: %d", x, y, radius_change, steps);
dbusLocators::accessibilityEMod::OBJ_PATH,
dbusLocators::accessibilityEMod::INTERFACE,
DBus::ConnectionType::SYSTEM};
- dbus.method<void(int, int, int, int)>("DispatchPinchEvent").
- call(x, y, radius_change, steps);
+ return dbus.method<void(int, int, int, int)>("DispatchPinchEvent").call(x, y, radius_change, steps);
}
ecore::TimerRepetitionPolicy EventGenerator::createKeyDownEvent(GeneratorData genData, DoneCallback doneCb)
#include "ecore.hpp"
#include "Optional.hpp"
+#include "DBus.hpp"
#include <string>
#include <array>
static void generateKeyPress(const std::string &keyId, DoneCallback doneCb, unsigned multiplicity = SINGLE_PRESS,
PressType type = PressType::SHORT);
- static void generateTapGesture(int x, int y, double press_time);
- static void generateDragGesture(int from_x, int from_y, int to_x, int to_y, int steps, double hold_time);
- static void generatePinchGesture(int x, int y, int radius_change, int steps);
+ static DBus::ValueOrError<void> generateTapGesture(int x, int y, double press_time);
+ static DBus::ValueOrError<void> generateDragGesture(int from_x, int from_y, int to_x, int to_y, int steps, double hold_time);
+ static DBus::ValueOrError<void> generatePinchGesture(int x, int y, int radius_change, int steps);
private:
static ecore::TimerRepetitionPolicy createKeyDownEvent(GeneratorData genData, DoneCallback doneCb);