Code Sync up from tizen_2.4
[platform/core/connectivity/mtp-responder.git] / include / mtp_event_handler.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _MTP_EVENT_HANDLER_H_
18 #define _MTP_EVENT_HANDLER_H_
19
20 #include <vconf.h>
21 #include "mtp_datatype.h"
22 #include "mtp_util.h"
23
24 typedef enum {
25         MTP_TURN_OFF,
26         MTP_ASK_TURN_ON,
27         MTP_ALWAYS_TURN_ON
28 } on_off_state_t;
29
30 typedef enum {
31         USB_INSERTED,
32         USB_REMOVED
33 } usb_state_t;
34
35 typedef struct {
36         mtp_uint32 action;
37         mtp_ulong param1;
38         mtp_ulong param2;
39         mtp_ulong param3;
40 } mtp_event_t;
41
42 typedef enum {
43         EVENT_CANCEL_INITIALIZATION,
44         EVENT_START_MAIN_OP,
45         EVENT_CLOSE,
46         EVENT_USB_REMOVED,
47         EVENT_OBJECT_ADDED,
48         EVENT_OBJECT_REMOVED,
49         EVENT_OBJECT_PROP_CHANGED,
50         EVENT_START_DATAIN,
51         EVENT_DONE_DATAIN,
52         EVENT_START_DATAOUT,
53         EVENT_DONE_DATAOUT,
54         EVENT_MAX
55 } event_code_t;
56
57 mtp_bool _eh_register_notification_callbacks(void);
58 mtp_bool _eh_handle_usb_events(mtp_uint32 type);
59 void _eh_deregister_notification_callbacks(void);
60 void _handle_mmc_notification(keynode_t *key, void *data);
61 void _eh_send_event_req_to_eh_thread(event_code_t action, mtp_ulong param1,
62                 mtp_ulong param2, void *param3);
63
64 #endif  /* _MTP_EVENT_HANDLER_H_ */