tizen 2.3.1 release
[framework/connectivity/bluez.git] / obexd / client / map-event.h
1 /*
2  *
3  *  OBEX
4  *
5  *  Copyright (C) 2013  BMW Car IT GmbH. All rights reserved.
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 struct obc_session;
25
26 enum map_event_type {
27         MAP_ET_NEW_MESSAGE,
28         MAP_ET_DELIVERY_SUCCESS,
29         MAP_ET_SENDING_SUCCESS,
30         MAP_ET_DELIVERY_FAILURE,
31         MAP_ET_SENDING_FAILURE,
32         MAP_ET_MEMORY_FULL,
33         MAP_ET_MEMORY_AVAILABLE,
34         MAP_ET_MESSAGE_DELETED,
35         MAP_ET_MESSAGE_SHIFT
36 };
37
38 struct map_event {
39         enum map_event_type type;
40         uint64_t handle;
41         char *folder;
42         char *old_folder;
43         char *msg_type;
44         char *datetime;
45         char *subject;
46         char *sender_name;
47         char *priority;
48 };
49
50 /* Handle notification in map client.
51  *
52  * event: Event report.
53  *
54  * Callback shall be called for every received event.
55  */
56 typedef void (*map_event_cb) (struct map_event *event, void *user_data);
57
58 /* Registers client notification handler callback for events that are
59  * addressed to the given mas instance id for the given device.
60  */
61 bool map_register_event_handler(struct obc_session *session, int mas_id,
62                                         map_event_cb cb, void *user_data);
63
64 /* Unregisters client notification handler callback.
65  */
66 void map_unregister_event_handler(struct obc_session *session, int mas_id);
67
68 /* Dispatch notification to a registered notification handler callback.
69  */
70 void map_dispatch_event(int mas_id, const char *device,
71                                                 struct map_event *event);