4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
32 #define NOTI_DIRECT "/tmp/noti/direct"
36 Ecore_Event_Handler *handler;
38 #define NOTI_CB(n) callback##n
40 Eina_Bool exit_func(void *data, int ev_type, void *ev)
42 Ecore_Event_Signal_Exit *e;
44 e = (Ecore_Event_Signal_Exit *) ev;
46 printf("Exit: interrupt\n");
48 printf("Exit: quit\n");
49 else if (e->terminate)
50 printf("Exit: terminate\n");
52 ecore_main_loop_quit();
54 return ECORE_CALLBACK_PASS_ON;
57 void in_access(void *data)
59 printf("%s\n", __func__);
62 void in_modify(void *data)
64 printf("%s\n", __func__);
67 void in_close_write(void *data)
69 printf("%s\n", __func__);
72 void in_close_nowrite(void *data)
74 printf("%s\n", __func__);
77 void in_open(void *data)
79 printf("%s\n", __func__);
89 static int step_cnt = 0;
92 printf("%s\n", __func__);
96 r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_access);
97 printf("noti del: in_access : %d\n", r);
100 r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_modify);
101 printf("noti del: in_modify : %d\n", r);
104 r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_close_write);
105 printf("noti del: in_close_write : %d\n", r);
108 r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_close_nowrite);
109 printf("noti del: in_close_nowrite : %d\n", r);
112 r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_open);
113 printf("noti del: in_open : %d\n", r);
120 int main(int argc, const char *argv[])
125 ecore_app_args_set(argc, argv);
128 printf("Noti init: %d\n", fd);
132 handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
134 ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_access, NULL, IN_ACCESS);
135 printf("noti add: in_access : %d\n", ret);
137 ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_modify, NULL, IN_MODIFY);
138 printf("noti add: in_modify : %d\n", ret);
140 ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_close_write, NULL, IN_CLOSE_WRITE);
141 printf("noti add: in_close_write : %d\n", ret);
143 ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_close_nowrite, NULL, IN_CLOSE_NOWRITE);
144 printf("noti add: in_close_nowrite : %d\n", ret);
146 ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_open, NULL, IN_OPEN);
147 printf("noti add: in_open : %d\n", ret);
149 ret = heynoti_attach_handler(fd);
150 printf("add main: %d\n", ret);
158 ecore_main_loop_begin();