+
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+ // ElDBus Accessibility Callbacks
+ /////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifdef DALI_ELDBUS_AVAILABLE
+ // Callback for Ecore ElDBus accessibility events.
+ static void OnEcoreElDBusAccessibilityNotification( void *context EINA_UNUSED, const Eldbus_Message *message )
+ {
+ EventHandler* handler = static_cast< EventHandler* >( context );
+ // Ignore any accessibility events when paused.
+ if( handler->mPaused )
+ {
+ return;
+ }
+
+ if( !handler->mAccessibilityAdaptor )
+ {
+ DALI_LOG_ERROR( "Invalid accessibility adaptor\n" );
+ return;
+ }
+
+ AccessibilityAdaptor* accessibilityAdaptor( &AccessibilityAdaptor::GetImplementation( handler->mAccessibilityAdaptor ) );
+ if( !accessibilityAdaptor )
+ {
+ DALI_LOG_ERROR( "Cannot access accessibility adaptor\n" );
+ return;
+ }
+
+ int gestureValue;
+ int xS, yS, xE, yE;
+ int state; // 0 - begin, 1 - ongoing, 2 - ended, 3 - aborted
+ int eventTime;
+
+ // The string defines the arg-list's respective types.
+ if( !eldbus_message_arguments_get( message, "iiiiiiu", &gestureValue, &xS, &yS, &xE, &yE, &state, &eventTime ) )
+ {
+ DALI_LOG_ERROR( "OnEcoreElDBusAccessibilityNotification: Error getting arguments\n" );
+ }
+
+ DALI_LOG_INFO( gImfLogging, Debug::General, "Got gesture: Name: %d Args: %d,%d,%d,%d State: %d\n", gestureValue, xS, yS, xE, yE );
+
+ // Create a touch point object.
+ TouchPoint::State touchPointState( TouchPoint::Down );
+ if( state == 0 )
+ {
+ touchPointState = TouchPoint::Down; // Mouse down.
+ }
+ else if( state == 1 )
+ {
+ touchPointState = TouchPoint::Motion; // Mouse move.
+ }
+ else if( state == 2 )
+ {
+ touchPointState = TouchPoint::Up; // Mouse up.
+ }
+ else
+ {
+ touchPointState = TouchPoint::Interrupted; // Error.
+ }
+
+ // Send touch event to accessibility adaptor.
+ TouchPoint point( 0, touchPointState, (float)xS, (float)yS );
+
+ // Perform actions based on received gestures.
+ // Note: This is seperated from the reading so we can have other input readers without changing the below code.
+ switch( gestureValue )
+ {
+ case 0: // OneFingerHover
+ {
+ // Focus, read out.
+ accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
+ break;
+ }
+ case 1: // TwoFingersHover
+ {
+ // In accessibility mode, scroll action should be handled when the currently focused actor is contained in scrollable control
+ accessibilityAdaptor->HandleActionScrollEvent( point, GetCurrentMilliSeconds() );
+ break;
+ }
+ case 2: // ThreeFingersHover
+ {
+ // Read from top item on screen continuously.
+ accessibilityAdaptor->HandleActionReadFromTopEvent();
+ break;
+ }
+ case 3: // OneFingerFlickLeft
+ {
+ // Move to previous item.
+ accessibilityAdaptor->HandleActionReadPreviousEvent();
+ break;
+ }
+ case 4: // OneFingerFlickRight
+ {
+ // Move to next item.
+ accessibilityAdaptor->HandleActionReadNextEvent();
+ break;
+ }
+ case 5: // OneFingerFlickUp
+ {
+ // Move to previous item.
+ accessibilityAdaptor->HandleActionPreviousEvent();
+ break;
+ }
+ case 6: // OneFingerFlickDown
+ {
+ // Move to next item.
+ accessibilityAdaptor->HandleActionNextEvent();
+ break;
+ }
+ case 7: // TwoFingersFlickUp
+ {
+ // Scroll up the list.
+ accessibilityAdaptor->HandleActionScrollUpEvent();
+ break;
+ }
+ case 8: // TwoFingersFlickDown
+ {
+ // Scroll down the list.
+ accessibilityAdaptor->HandleActionScrollDownEvent();
+ break;
+ }
+ case 9: // TwoFingersFlickLeft
+ {
+ // Scroll left to the previous page
+ accessibilityAdaptor->HandleActionPageLeftEvent();
+ break;
+ }
+ case 10: // TwoFingersFlickRight
+ {
+ // Scroll right to the next page
+ accessibilityAdaptor->HandleActionPageRightEvent();
+ break;
+ }
+ case 11: // ThreeFingersFlickLeft
+ {
+ // Not exist yet
+ break;
+ }
+ case 12: // ThreeFingersFlickRight
+ {
+ // Not exist yet
+ break;
+ }
+ case 13: // ThreeFingersFlickUp
+ {
+ // Not exist yet
+ break;
+ }
+ case 14: // ThreeFingersFlickDown
+ {
+ // Not exist yet
+ break;
+ }
+ case 15: // OneFingerSingleTap
+ {
+ // Focus, read out.
+ accessibilityAdaptor->HandleActionReadEvent( (unsigned int)xS, (unsigned int)yS, true /* allow read again */ );
+ break;
+ }
+ case 16: // OneFingerDoubleTap
+ {
+ // Activate selected item / active edit mode.
+ accessibilityAdaptor->HandleActionActivateEvent();
+ break;
+ }
+ case 17: // OneFingerTripleTap
+ {
+ // Zoom
+ accessibilityAdaptor->HandleActionZoomEvent();
+ break;
+ }
+ case 18: // TwoFingersSingleTap
+ {
+ // Pause/Resume current speech
+ accessibilityAdaptor->HandleActionReadPauseResumeEvent();
+ break;
+ }
+ case 19: // TwoFingersDoubleTap
+ {
+ // Start/Stop current action
+ accessibilityAdaptor->HandleActionStartStopEvent();
+ break;
+ }
+ case 20: // TwoFingersTripleTap
+ {
+ // Read information from indicator
+ accessibilityAdaptor->HandleActionReadIndicatorInformationEvent();
+ break;
+ }
+ case 21: // ThreeFingersSingleTap
+ {
+ // Read from top item on screen continuously.
+ accessibilityAdaptor->HandleActionReadFromTopEvent();
+ break;
+ }
+ case 22: // ThreeFingersDoubleTap
+ {
+ // Read from next item continuously.
+ accessibilityAdaptor->HandleActionReadFromNextEvent();
+ break;
+ }
+ case 23: // ThreeFingersTripleTap
+ {
+ // Not exist yet
+ break;
+ }
+ case 24: // OneFingerFlickLeftReturn
+ {
+ // Scroll up to the previous page
+ accessibilityAdaptor->HandleActionPageUpEvent();
+ break;
+ }
+ case 25: // OneFingerFlickRightReturn
+ {
+ // Scroll down to the next page
+ accessibilityAdaptor->HandleActionPageDownEvent();
+ break;
+ }
+ case 26: // OneFingerFlickUpReturn
+ {
+ // Move to the first item on screen
+ accessibilityAdaptor->HandleActionMoveToFirstEvent();
+ break;
+ }
+ case 27: // OneFingerFlickDownReturn
+ {
+ // Move to the last item on screen
+ accessibilityAdaptor->HandleActionMoveToLastEvent();
+ break;
+ }
+ case 28: // TwoFingersFlickLeftReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 29: // TwoFingersFlickRightReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 30: // TwoFingersFlickUpReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 31: // TwoFingersFlickDownReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 32: // ThreeFingersFlickLeftReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 33: // ThreeFingersFlickRightReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 34: // ThreeFingersFlickUpReturn
+ {
+ // Not exist yet
+ break;
+ }
+ case 35: // ThreeFingersFlickDownReturn
+ {
+ // Not exist yet
+ break;
+ }
+ }
+ }
+
+ void EcoreElDBusInitialisation( void *handle )
+ {
+ Eldbus_Object *object;
+ Eldbus_Proxy *manager;
+
+ if( !( mSystemConnection = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SYSTEM) ) )
+ {
+ DALI_LOG_ERROR( "Unable to get system bus\n" );
+ }
+
+ object = eldbus_object_get( mSystemConnection, BUS, PATH );
+ if( !object )
+ {
+ DALI_LOG_ERROR( "Getting object failed\n" );
+ return;
+ }
+
+ manager = eldbus_proxy_get( object, INTERFACE );
+ if( !manager )
+ {
+ DALI_LOG_ERROR( "Getting proxy failed\n" );
+ return;
+ }
+
+ if( !eldbus_proxy_signal_handler_add( manager, "GestureDetected", OnEcoreElDBusAccessibilityNotification, handle ) )
+ {
+ DALI_LOG_ERROR( "No signal handler returned\n" );
+ }
+ }
+#endif // DALI_ELDBUS_AVAILABLE
+