Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Location.Geofence / Interop / Interop.Location.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Location.Geofence;
20
21 internal static partial class Interop
22 {
23     internal static partial class Geofence
24     {
25         [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_geopoint")]
26         internal static extern int CreateGPSFence(int placeId, double latitude, double longitude, int radius, string address, out IntPtr handle);
27
28         [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_bluetooth")]
29         internal static extern int CreateBTFence(int placeId, string bssid, string ssid, out IntPtr handle);
30
31         [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_wifi")]
32         internal static extern int CreateWiFiFence(int placeId, string bssid, string ssid, out IntPtr handle);
33
34         [DllImport(Libraries.Geofence, EntryPoint = "geofence_destroy")]
35         internal static extern int Destroy(IntPtr handle);
36
37         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_type")]
38         internal static extern int FenceType(IntPtr handle, out FenceType type);
39
40         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_place_id")]
41         internal static extern int FencePlaceID(IntPtr handle, out int placeId);
42
43         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_latitude")]
44         internal static extern int FenceLatitude(IntPtr handle, out double latitude);
45
46         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_longitude")]
47         internal static extern int FenceLongitude(IntPtr handle, out double longitude);
48
49         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_radius")]
50         internal static extern int FenceRadius(IntPtr handle, out int radius);
51
52         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_address")]
53         internal static extern int FenceAddress(IntPtr handle, out string address);
54
55         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_bssid")]
56         internal static extern int FenceBSSID(IntPtr handle, out string bssid);
57
58         [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_ssid")]
59         internal static extern int FenceSSID(IntPtr handle, out string ssid);
60     }
61
62     internal static partial class GeofenceStatus
63     {
64         [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_create")]
65         internal static extern int Create(int fenceId, out IntPtr statusHandle);
66
67         [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_destroy")]
68         internal static extern int Destroy(IntPtr statusHandle);
69
70         [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_get_state")]
71         internal static extern int State(IntPtr statusHandle, out GeofenceState state);
72
73         [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_get_duration")]
74         internal static extern int Duration(IntPtr statusHandle, out int seconds);
75     }
76
77     internal static partial class GeofenceManager
78     {
79         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
80         internal delegate bool StateChangedCallback(int fenceId, GeofenceState state, IntPtr userData);
81
82         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
83         internal delegate bool ProximityStateChangedCallback(int fenceId, ProximityState state, ProximityProvider provider, IntPtr userData);
84
85         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
86         internal delegate bool GeofenceEventCallback(int placeId, int fenceId, GeofenceError error, GeofenceEventType eventType, IntPtr userData);
87
88         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_is_supported")]
89         internal static extern int IsSupported(out bool supported);
90
91         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_create")]
92         internal static extern int Create(out IntPtr handle);
93
94         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_destroy")]
95         internal static extern int Destroy(IntPtr handle);
96
97         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_start")]
98         internal static extern int Start(IntPtr handle, int fenceId);
99
100         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_stop")]
101         internal static extern int Stop(IntPtr handle, int fenceId);
102
103         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_state_changed_cb")]
104         internal static extern int SetStateChangedCB(IntPtr handle, StateChangedCallback callback, IntPtr userData);
105
106         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_state_changed_cb")]
107         internal static extern int UnsetStateChangedCB(IntPtr handle);
108
109         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_proximity_state_changed_cb")]
110         internal static extern int SetProximityStateCB(IntPtr handle, ProximityStateChangedCallback callback, IntPtr userData);
111
112         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_proximity_state_changed_cb")]
113         internal static extern int UnsetProximityStateCB(IntPtr handle);
114
115         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_event_cb")]
116         internal static extern int SetGeofenceEventCB(IntPtr handle, GeofenceEventCallback callback, IntPtr userData);
117
118         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_event_cb")]
119         internal static extern int UnsetGeofenceEventCB(IntPtr handle);
120     }
121
122     internal static partial class VirtualPerimeter
123     {
124         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
125         internal delegate bool ForEachPlaceListCallback(int placeId, string placeName, int placeIndex, int placeCount, IntPtr userData);
126
127         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
128         internal delegate bool ForEachFenceListCallback(int fenceId, IntPtr fenceHandle, int placeIndex, int placeCount, IntPtr userData);
129
130         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_add_place")]
131         internal static extern int AddPlace(IntPtr handle, string placeName, out int placeId);
132
133         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_update_place")]
134         internal static extern int UpdatePlace(IntPtr handle, int placeId, string placeName);
135
136         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_remove_place")]
137         internal static extern int RemovePlace(IntPtr handle, int placeId);
138
139         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_add_fence")]
140         internal static extern int AddFence(IntPtr handle, IntPtr fenceHandle, out int fenceId);
141
142         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_remove_fence")]
143         internal static extern int RemoveFence(IntPtr handle, int fenceId);
144
145         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_geofence_list")]
146         internal static extern int GetForEachFenceList(IntPtr handle, ForEachFenceListCallback callback, IntPtr userData);
147
148         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_place_geofence_list")]
149         internal static extern int GetForEachPlaceFenceList(IntPtr handle, int placeId, ForEachFenceListCallback callback, IntPtr userData);
150
151         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_place_list")]
152         internal static extern int GetForEachPlaceList(IntPtr handle, ForEachPlaceListCallback callback, IntPtr userData);
153
154         [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_get_place_name")]
155         internal static extern int GetPlaceName(IntPtr handle, int placeId, out string placeName);
156     }
157 }