# define event-action, iot-headless only
# DeviceNotifier=
# - define which event(device-notifiy) is filtered
-# Action=
+# ChangeState=
# - define action for the event
+# ActionBroadcast=yes
+# - broadcast upon occuring the event
+
[EventAction]
Name=CHARGER_CONNECTED
Enum=2001
DeviceNotifier=DEVICE_NOTIFIER_BATTERY_CHARGER_CONNECTED
-Action=sleep,sleep
-Action=normal,normal
+ActionBroadcast=yes
[EventAction]
Name=CHARGER_DISCONNECTED
Enum=2002
DeviceNotifier=DEVICE_NOTIFIER_BATTERY_CHARGER_DISCONNECTED
-Action=sleep,sleep
-Action=normal,normal
+ActionBroadcast=yes
#INITIAL_STATE_BY_POWERKEY_BOOTING
Enum=3000
BootReason=powerkey
-Action=start,normal
+ActionChangeState=start,normal
[EventAction]
#INITIAL_STATE_BY_CHARGER_BOOTING
Enum=3001
BootReason=charger
-Action=start,sleep
+ActionChangeState=start,sleep
# integer in broadcasting dbus signal.
# Keycode=integer
# - define keycode to filter key event
-# Duration=integer,integer
+# DetectionRangeMsec=integer,integer
# - define time window in milisecond for filtering key event. -1 means no limit.
# TriggerType=level/edge
# - define event type
-# Action=broadcast
-# - define broadcast action for the event.
-# Action=current,next
+# ActionBroadcast=yes
+# - Broadcast upon occuring an event, default no.
+# ActionChangeState=current,next
# - define state transition action for the event.
[EventAction]
Name=BLINKKEY_EDGE
Enum=1000
Keycode=bluetooth
-Duration=0,2000
+DetectionRangeMsec=0,2000
TriggerType=edge
-Action=sleep,sleep
+ActionBroadcast=yes
[EventAction]
Name=SHORTKEY_LEVEL
Enum=1001
Keycode=power
-Duration=2000,-1
+DetectionRangeMsec=2000,-1
TriggerType=level
-Action=broadcast
+ActionBroadcast=yes
[EventAction]
Name=SHORTKEY_EDGE
Enum=1002
Keycode=power
-Duration=2000,7000
+DetectionRangeMsec=2000,7000
TriggerType=edge
-Action=normal,sleep
-Action=sleep,normal
+ActionChangeState=normal,sleep
+ActionChangeState=sleep,normal
[EventAction]
Name=LONGKEY_LEVEL
Enum=1003
Keycode=power
-Duration=7000,-1
+DetectionRangeMsec=7000,-1
TriggerType=level
-Action=broadcast
+ActionBroadcast=yes
[EventAction]
Name=LONGKEY_EDGE
Enum=1004
Keycode=power
-Duration=7000,-1
+DetectionRangeMsec=7000,-1
TriggerType=edge
ConditionVconf=memory/sysman/charger_status,int,0
-Action=normal,poweroff
+ActionChangeState=normal,poweroff
char *name;
int id;
+ /* broadcast upon occuring this event */
+ int broadcast;
+
/* which action to do on receiving an event */
enum device_notifier_type action;
void *user_data;
sscanf(prop->value, "%d", &handler->id);
} else if (MATCH(prop->key, "DeviceNotifier")) {
parse_device_notifier(handler, prop->value);
- } else if (MATCH(prop->key, "Action")) {
+ } else if (MATCH(prop->key, "ActionChangeState")) {
parse_action(handler, prop->value);
+ } else if (MATCH(prop->key, "ActionBroadcast")) {
+ handler->broadcast = MATCH(prop->value, "yes");
}
}
SYS_G_LIST_APPEND(*action_list, ti);
}
-static void parse_action(struct input_event_unit *ieu, const char *action)
+static void parse_change_state(struct input_event_unit *ieu, const char *action)
{
char curr[16] = { 0, };
char next[16] = { 0, };
- if (MATCH(action, "broadcast")) {
- ieu->notifier = DEVICE_NOTIFIER_INPUT_BROADCAST_SIGNAL;
- ieu->user_data = (void *) ieu;
- } else if (sscanf(action, "%15[^,],%15s", curr, next) == 2) {
+ if (sscanf(action, "%15[^,],%15s", curr, next) == 2) {
ieu->notifier = DEVICE_NOTIFIER_REQUEST_TRANSITION_STATE;
/* append transition info to ieu->user_data */
add_action_transition_info(ieu, curr, next);
sscanf(prop->value, "%d", &ieu->id);
} else if (MATCH(prop->key, "Keycode")) {
parse_keycode(ieu, prop->value);
- } else if (MATCH(prop->key, "Duration")) {
+ } else if (MATCH(prop->key, "DetectionRangeMsec")) {
parse_duration(ieu, prop->value);
} else if (MATCH(prop->key, "TriggerType")) {
parse_trigger_type(ieu, prop->value);
} else if (MATCH(prop->key, "ConditionVconf")) {
parse_condition_vconf(ieu, prop->value);
- } else if (MATCH(prop->key, "Action")) {
- parse_action(ieu, prop->value);
+ } else if (MATCH(prop->key, "ActionChangeState")) {
+ parse_change_state(ieu, prop->value);
+ } else if (MATCH(prop->key, "ActionBroadcast")) {
+ ieu->broadcast = MATCH(prop->value, "yes");
}
}
/* condition for triggering action */
struct condition_vconf cv;
+ /* broadcast upon occuring this event */
+ int broadcast;
+
/* which action to do on receiving an event */
enum device_notifier_type notifier;
void *user_data;
ieu->timer = 0;
- if (check_input_event_condition(ieu)) {
- _D("Trigger(level) event=%s(%d), action=%d", ieu->name, ieu->id, ieu->notifier);
- device_notify(ieu->notifier, ieu->user_data);
- } else {
+ if (check_input_event_condition(ieu) == 0) {
_D("Skip(level) event=%s(%d), condition=%s isn't meet", ieu->name, ieu->id, ieu->cv.keyname);
+ return G_SOURCE_REMOVE;
}
+ _D("Trigger(level) event=%s(%d), action=%d", ieu->name, ieu->id, ieu->notifier);
+ device_notify(ieu->notifier, ieu->user_data);
+
return G_SOURCE_REMOVE;
}
static void edge_triggered(struct input_event_unit *ieu)
{
- if (check_input_event_condition(ieu)) {
- _D("Trigger(edge) event=%s(%d), action=%d", ieu->name, ieu->id, ieu->notifier);
- device_notify(ieu->notifier, ieu->user_data);
- } else {
+ if (check_input_event_condition(ieu) == 0) {
_D("Skip(edge) event=%s(%d), condition=%s isn't meet", ieu->name, ieu->id, ieu->cv.keyname);
+ return;
}
+
+ _D("Trigger(edge) event=%s(%d), action=%d", ieu->name, ieu->id, ieu->notifier);
+ device_notify(ieu->notifier, ieu->user_data);
}
static void start_event_timer(struct input_config *ic)
return 0;
}
-static int broadcast_input_signal_cb(void *data)
-{
- struct input_event_unit *ieu = (struct input_event_unit *) data;
-
- if (!ieu)
- return 0;
-
- _D("Broadcast siganl, event=%s(%d)", ieu->name, ieu->id);
- gdbus_signal_emit(NULL, DEVICED_PATH_INPUT, DEVICED_INTERFACE_INPUT,
- "Key", g_variant_new("(i)", ieu->id));
-
- return 0;
-}
-
static void input_handler_init(void *data)
{
- register_notifier(DEVICE_NOTIFIER_INPUT_BROADCAST_SIGNAL, broadcast_input_signal_cb);
-
init_input_config();
}
SYS_G_LIST_FOREACH(result->props, elem, prop) {
if (MATCH(prop->key, "Enum"))
init_ti.reason = atoi(prop->value);
- else if (MATCH(prop->key, "Action"))
+ else if (MATCH(prop->key, "ActionChangeState"))
parse_transition_info(prop->value);
}
}
NOTIFY_STR(DEVICE_NOTIFIER_KEY_PRESS),
NOTIFY_STR(DEVICE_NOTIFIER_KEY_RELEASE),
- /* action triggered by input event */
- NOTIFY_STR(DEVICE_NOTIFIER_INPUT_TRIGGER_POWEROFF),
- NOTIFY_STR(DEVICE_NOTIFIER_INPUT_BROADCAST_SIGNAL),
-
/* Purpose of calling methods of different modules
* Use prefix DEVICE_NOTIFIER_REQUEST */
NOTIFY_STR(DEVICE_NOTIFIER_REQUEST_TRANSITION_STATE),
DEVICE_NOTIFIER_KEY_PRESS,
DEVICE_NOTIFIER_KEY_RELEASE,
- /* action triggered by input event */
- DEVICE_NOTIFIER_INPUT_TRIGGER_POWEROFF,
- DEVICE_NOTIFIER_INPUT_BROADCAST_SIGNAL,
-
/* Purpose of calling methods of different modules
* Use prefix DEVICE_NOTIFIER_REQUEST */
DEVICE_NOTIFIER_REQUEST_TRANSITION_STATE,