Generate Licence file
[platform/core/telephony/tel-plugin-at_standard.git] / src / at_phonebook.c
1 /*
2  * tel-plugin-at_standard
3  *
4  * Copyright (c) 2012 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #include <glib.h>
20
21 #include <tcore.h>
22 #include <server.h>
23 #include <plugin.h>
24 #include <core_object.h>
25 #include <co_phonebook.h>
26
27 #include "at_phonebook.h"
28
29 static TReturn at_get_count(CoreObject *co, UserRequest *ur)
30 {
31         return TCORE_RETURN_ENOSYS;
32 }
33
34 static TReturn at_get_info(CoreObject *co, UserRequest *ur)
35 {
36         return TCORE_RETURN_ENOSYS;
37 }
38
39 static TReturn at_get_usim_info(CoreObject *co, UserRequest *ur)
40 {
41         return TCORE_RETURN_ENOSYS;
42 }
43
44 static TReturn at_read_record(CoreObject *co, UserRequest *ur)
45 {
46         return TCORE_RETURN_ENOSYS;
47 }
48
49 static TReturn at_update_record(CoreObject *co, UserRequest *ur)
50 {
51         return TCORE_RETURN_ENOSYS;
52 }
53
54 static TReturn at_delete_record(CoreObject *co, UserRequest *ur)
55 {
56         return TCORE_RETURN_ENOSYS;
57 }
58
59 static struct tcore_phonebook_operations phonebook_ops = {
60         .get_count = at_get_count,
61         .get_info = at_get_info,
62         .get_usim_info = at_get_usim_info,
63         .read_record = at_read_record,
64         .update_record = at_update_record,
65         .delete_record = at_delete_record,
66 };
67
68 gboolean at_phonebook_init(TcorePlugin *cp)
69 {
70         CoreObject *co;
71         Server *server;
72
73         co = tcore_phonebook_new(cp, &phonebook_ops, NULL);
74         if (co == NULL)
75                 return FALSE;
76
77         server = tcore_plugin_ref_server(cp);
78         tcore_server_add_template_object(server, co);
79
80         return TRUE;
81 }
82
83 void at_phonebook_exit(TcorePlugin *cp)
84 {
85         CoreObject *co;
86
87         if (cp == NULL)
88                 return;
89
90         co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_PHONEBOOK);
91         if (co == NULL)
92                 return;
93
94         tcore_object_free(co);
95 }
96