2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Runtime.InteropServices;
20 internal static partial class Interop
22 internal enum ContactsChanged
29 internal static partial class Database
31 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_insert_record")]
32 internal static extern int Insert(IntPtr recordHandle, out int recordId);
34 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_record")]
35 internal static extern int Get(string uri, int recordId, out IntPtr recordHandle);
37 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_update_record")]
38 internal static extern int Update(IntPtr recordHandle);
40 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_delete_record")]
41 internal static extern int Delete(string uri, int recordId);
43 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_replace_record")]
44 internal static extern int Replace(IntPtr recordHandle, int recordId);
46 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_all_records")]
47 internal static extern int GetRecords(string uri, int offset, int limit, out IntPtr listHandle);
49 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_records_with_query")]
50 internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr listHandle);
52 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_insert_records")]
53 internal static extern int InsertRecords(IntPtr listHandle, out IntPtr ids, out int count);
55 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_update_records")]
56 internal static extern int UpdateRecords(IntPtr listHandle);
58 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_delete_records")]
59 internal static extern int DeleteRecords(string uri, int[] recordIdArray, int count);
61 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_replace_records")]
62 internal static extern int ReplaceRecords(IntPtr listHandle, int[] recordIdArray, int count);
64 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_current_version")]
65 internal static extern int GetVersion(out int contactsDBVersion);
67 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_add_changed_cb")]
68 internal static extern int AddChangedCb(string uri, ContactsDBChangedCallback callback, IntPtr userData);
70 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_remove_changed_cb")]
71 internal static extern int RemoveChangedCb(string uri, ContactsDBChangedCallback callback, IntPtr userData);
73 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_changes_by_version")]
74 internal static extern int GetChangesByVersion(string uri, int addressBookId, int contactsDBVersion, out IntPtr changeRecordList, out int currentContactsDBVersion);
76 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records")]
77 internal static extern int Search(string uri, string keyword, int offset, int limit, out IntPtr listHandle);
79 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_query")]
80 internal static extern int Search(IntPtr queryHandle, string keyword, int offset, int limit, out IntPtr listHandle);
82 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_range")]
83 internal static extern int Search(string uri, string keyword, int offset, int limit, int range, out IntPtr listHandle);
85 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_for_snippet")]
86 internal static extern int Search(string uri, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle);
88 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_query_for_snippet")]
89 internal static extern int Search(IntPtr queryHandle, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle);
91 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_range_for_snippet")]
92 internal static extern int Search(string uri, string keyword, int offset, int limit, int range, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle);
94 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_count")]
95 internal static extern int GetCount(string uri, out int count);
97 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_count_with_query")]
98 internal static extern int GetCount(IntPtr queryHandle, out int count);
100 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_last_change_version")]
101 internal static extern int GetLastChangeVersion(out int version);
103 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_status")]
104 internal static extern int GetStatus(out Tizen.Pims.Contacts.ContactsDatabase.DBStatus status);
106 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_add_changed_cb")]
107 internal static extern int AddStatusChangedCb(ContactsDBStatusChangedCallback callback, IntPtr userData);
109 [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_remove_changed_cb")]
110 internal static extern int RemoveStatusChangedCb(ContactsDBStatusChangedCallback callback, IntPtr userData);
112 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
113 internal delegate void ContactsDBChangedCallback(string uri, IntPtr userData);
115 [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)]
116 internal delegate void ContactsDBStatusChangedCallback(Tizen.Pims.Contacts.ContactsDatabase.DBStatus status, IntPtr userData);