ngfd-plugin
haptic.h File Reference
#include <ngf/log.h>
#include <ngf/proplist.h>
#include <ngf/core.h>
#include <ngf/sinkinterface.h>
#include <ngf/inputinterface.h>

Go to the source code of this file.

Macros

#define N_HAPTIC_TYPE_KEY   "haptic.type"
 The haptic.type key tells what kind of haptic event this is.
 
#define N_HAPTIC_TYPE_TOUCH   "touch"
 
#define N_HAPTIC_TYPE_EVENT   "event"
 
#define N_HAPTIC_EFFECT_KEY   "haptic.effect"
 
#define N_HAPTIC_EFFECT_DEFAULT   "default"
 
#define N_HAPTIC_EFFECT_DRAG_START   "drag_start"
 
#define N_HAPTIC_EFFECT_RELEASE_WEAK   "release_weak"
 
#define N_HAPTIC_EFFECT_DRAG_FAIL   "drag_fail"
 
#define N_HAPTIC_EFFECT_DRAG_BOUNDARY   "drag_boundary"
 
#define N_HAPTIC_EFFECT_TOUCH_WEAK   "touch_weak"
 
#define N_HAPTIC_EFFECT_DRAG_END   "drag_end"
 
#define N_HAPTIC_EFFECT_RELEASE   "release"
 
#define N_HAPTIC_EFFECT_TOUCH   "touch"
 
#define N_HAPTIC_EFFECT_RELEASE_STRONG   "release_strong"
 
#define N_HAPTIC_EFFECT_TOUCH_STRONG   "touch_strong"
 
#define N_HAPTIC_EFFECT_SHORT   "short"
 
#define N_HAPTIC_EFFECT_STRONG   "strong"
 
#define N_HAPTIC_EFFECT_LONG   "long"
 
#define N_HAPTIC_EFFECT_NOTICE   "notice"
 
#define N_HAPTIC_EFFECT_MESSAGE   "message"
 
#define N_HAPTIC_EFFECT_ATTENTION   "attention"
 
#define N_HAPTIC_EFFECT_ALARM   "alarm"
 
#define N_HAPTIC_EFFECT_RINGTONE   "ringtone"
 
#define N_HAPTIC_CLASS_UNDEFINED   (0)
 
#define N_HAPTIC_CLASS_TOUCH   (1)
 
#define N_HAPTIC_CLASS_EVENT   (2)
 

Functions

int n_haptic_can_handle (NSinkInterface *iface, NRequest *request)
 Convenience function to filter haptic depending on settings and call state.
 
int n_haptic_class_for_type (const char *haptic_type)
 
const char * n_haptic_effect_for_request (NRequest *request)
 

Macro Definition Documentation

◆ N_HAPTIC_CLASS_EVENT

#define N_HAPTIC_CLASS_EVENT   (2)

◆ N_HAPTIC_CLASS_TOUCH

#define N_HAPTIC_CLASS_TOUCH   (1)

◆ N_HAPTIC_CLASS_UNDEFINED

#define N_HAPTIC_CLASS_UNDEFINED   (0)

◆ N_HAPTIC_EFFECT_ALARM

#define N_HAPTIC_EFFECT_ALARM   "alarm"

◆ N_HAPTIC_EFFECT_ATTENTION

#define N_HAPTIC_EFFECT_ATTENTION   "attention"

◆ N_HAPTIC_EFFECT_DEFAULT

#define N_HAPTIC_EFFECT_DEFAULT   "default"

◆ N_HAPTIC_EFFECT_DRAG_BOUNDARY

#define N_HAPTIC_EFFECT_DRAG_BOUNDARY   "drag_boundary"

◆ N_HAPTIC_EFFECT_DRAG_END

#define N_HAPTIC_EFFECT_DRAG_END   "drag_end"

◆ N_HAPTIC_EFFECT_DRAG_FAIL

#define N_HAPTIC_EFFECT_DRAG_FAIL   "drag_fail"

◆ N_HAPTIC_EFFECT_DRAG_START

#define N_HAPTIC_EFFECT_DRAG_START   "drag_start"

◆ N_HAPTIC_EFFECT_KEY

#define N_HAPTIC_EFFECT_KEY   "haptic.effect"

◆ N_HAPTIC_EFFECT_LONG

#define N_HAPTIC_EFFECT_LONG   "long"

◆ N_HAPTIC_EFFECT_MESSAGE

#define N_HAPTIC_EFFECT_MESSAGE   "message"

◆ N_HAPTIC_EFFECT_NOTICE

#define N_HAPTIC_EFFECT_NOTICE   "notice"

◆ N_HAPTIC_EFFECT_RELEASE

#define N_HAPTIC_EFFECT_RELEASE   "release"

◆ N_HAPTIC_EFFECT_RELEASE_STRONG

#define N_HAPTIC_EFFECT_RELEASE_STRONG   "release_strong"

◆ N_HAPTIC_EFFECT_RELEASE_WEAK

#define N_HAPTIC_EFFECT_RELEASE_WEAK   "release_weak"

◆ N_HAPTIC_EFFECT_RINGTONE

#define N_HAPTIC_EFFECT_RINGTONE   "ringtone"

◆ N_HAPTIC_EFFECT_SHORT

#define N_HAPTIC_EFFECT_SHORT   "short"

◆ N_HAPTIC_EFFECT_STRONG

#define N_HAPTIC_EFFECT_STRONG   "strong"

◆ N_HAPTIC_EFFECT_TOUCH

#define N_HAPTIC_EFFECT_TOUCH   "touch"

◆ N_HAPTIC_EFFECT_TOUCH_STRONG

#define N_HAPTIC_EFFECT_TOUCH_STRONG   "touch_strong"

◆ N_HAPTIC_EFFECT_TOUCH_WEAK

#define N_HAPTIC_EFFECT_TOUCH_WEAK   "touch_weak"

◆ N_HAPTIC_TYPE_EVENT

#define N_HAPTIC_TYPE_EVENT   "event"

◆ N_HAPTIC_TYPE_KEY

#define N_HAPTIC_TYPE_KEY   "haptic.type"

The haptic.type key tells what kind of haptic event this is.

Each bracketed event definition in events.d config files that needs haptic/vibra playback has to contain "haptic.type" line to define what kind of haptic event it is.

Supported type strings are currently: "event" - for most vibration effects "touch" - for events that only play when user touches touchscreen.

The haptic event type is used to filter out playback in case user has disabled the setting for certain type of haptic feedback.

◆ N_HAPTIC_TYPE_TOUCH

#define N_HAPTIC_TYPE_TOUCH   "touch"

Function Documentation

◆ n_haptic_can_handle()

int n_haptic_can_handle ( NSinkInterface * iface,
NRequest * request )

Convenience function to filter haptic depending on settings and call state.

This function should be used by all haptic feedback plugins in their _sink_can_handle() function to determine whether the event should be played or not. It will take care of returning FALSE in case vibration feedback is disabled or if phone calls are active. If it returns TRUE, the plugin can do additional checks (e.g. whether or not it has an effect for the request). The interface is kept in line with the definition in NSinkInterfaceDecl, so in case the plugin does not have to do any special casing, it can be used there directly.

Parameters
ifacePointer to a NSinkInterface
requestPointer to a NRequest
Returns
FALSE if the plugin should not handle this event, TRUE otherwise

◆ n_haptic_class_for_type()

int n_haptic_class_for_type ( const char * haptic_type)

◆ n_haptic_effect_for_request()

const char * n_haptic_effect_for_request ( NRequest * request)