ngfd-plugin: /build/ngfd/src/ngfd-1.4.1/src/include/ngf/haptic.h Source File

ngfd-plugin

haptic.h
Go to the documentation of this file.
1
2/*
3 * ngfd - Non-graphic feedback daemon
4 * Haptic feedback support functions
5 *
6 * Copyright (C) 2014 Jolla Ltd.
7 * Contact: Thomas Perl <thomas.perl@jolla.com>
8 *
9 * This work is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This work is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this work; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#ifndef N_NGF_HAPTIC_H
25#define N_NGF_HAPTIC_H
26
27#include <ngf/log.h>
28#include <ngf/proplist.h>
29#include <ngf/core.h>
30#include <ngf/sinkinterface.h>
31#include <ngf/inputinterface.h>
32
47#define N_HAPTIC_TYPE_KEY "haptic.type"
48
49#define N_HAPTIC_TYPE_TOUCH "touch"
50#define N_HAPTIC_TYPE_EVENT "event"
51
52#define N_HAPTIC_EFFECT_KEY "haptic.effect"
53
54#define N_HAPTIC_EFFECT_DEFAULT "default"
55
56/* System-defined haptic effects. Preferably all plugins implementing
57 * haptic functionality should be able to handle all the effects
58 * listed here. Strictly speaking only mandatory one is "default".
59 *
60 * Effects are roughly listed by their invasiveness, top one on the
61 * list is least invasive and last most invasive.
62 *
63 * alarm and ringtone effects should repeat indefinitely.
64 */
65#define N_HAPTIC_EFFECT_DRAG_START "drag_start"
66#define N_HAPTIC_EFFECT_RELEASE_WEAK "release_weak"
67#define N_HAPTIC_EFFECT_DRAG_FAIL "drag_fail"
68#define N_HAPTIC_EFFECT_DRAG_BOUNDARY "drag_boundary"
69#define N_HAPTIC_EFFECT_TOUCH_WEAK "touch_weak"
70#define N_HAPTIC_EFFECT_DRAG_END "drag_end"
71#define N_HAPTIC_EFFECT_RELEASE "release"
72#define N_HAPTIC_EFFECT_TOUCH "touch"
73#define N_HAPTIC_EFFECT_RELEASE_STRONG "release_strong"
74#define N_HAPTIC_EFFECT_TOUCH_STRONG "touch_strong"
75#define N_HAPTIC_EFFECT_SHORT "short"
76#define N_HAPTIC_EFFECT_STRONG "strong"
77#define N_HAPTIC_EFFECT_LONG "long"
78#define N_HAPTIC_EFFECT_NOTICE "notice"
79#define N_HAPTIC_EFFECT_MESSAGE "message"
80#define N_HAPTIC_EFFECT_ATTENTION "attention"
81#define N_HAPTIC_EFFECT_ALARM "alarm"
82#define N_HAPTIC_EFFECT_RINGTONE "ringtone"
83
84/* Supported haptic classes */
85#define N_HAPTIC_CLASS_UNDEFINED (0)
86#define N_HAPTIC_CLASS_TOUCH (1)
87#define N_HAPTIC_CLASS_EVENT (2)
88
105 int n_haptic_can_handle (NSinkInterface *iface, NRequest *request);
106
107/* Each haptic type belongs to a haptic class.
108 *
109 * Based on the haptic class the haptic event may be filtered away
110 * depending on the currently active settings.
111 *
112 * @param haptic_type Haptic type string
113 * @return Haptic class, or HAPTIC_CLASS_UNDEFINED if type doesn't have a class
114 */
115 int n_haptic_class_for_type (const char *haptic_type);
116
117/* Get value for haptic.effect from request.
118 *
119 * @param request NRequest struct
120 * @return Haptic effect string or NULL if haptic.effect is not defined
121 */
122 const char* n_haptic_effect_for_request (NRequest *request);
123
124#endif /* N_NGF_HAPTIC_H */
core.h
n_haptic_effect_for_request
const char * n_haptic_effect_for_request(NRequest *request)
n_haptic_class_for_type
int n_haptic_class_for_type(const char *haptic_type)
n_haptic_can_handle
int n_haptic_can_handle(NSinkInterface *iface, NRequest *request)
Convenience function to filter haptic depending on settings and call state.
inputinterface.h
log.h
proplist.h
NRequest
struct _NRequest NRequest
Internal request structure.
Definition request.h:26
sinkinterface.h
NSinkInterface
struct _NSinkInterface NSinkInterface
Internal sinkinterface structure.
Definition sinkinterface.h:26