d2819a0d90655d34fa9f29ea8810d7f73c030777
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.IoTConnectivity / Interop / Interop.IoTConnectivity.Server.cs
1 /// Copyright 2016 by Samsung Electronics, Inc.,
2 ///
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
8
9 using System;
10 using System.Runtime.InteropServices;
11
12 internal static partial class Interop
13 {
14     internal static partial class IoTConnectivity
15     {
16         internal static partial class Server
17         {
18             internal enum RequestType
19             {
20                 Unknown = 0,
21                 Get = 1,
22                 Put = 2,
23                 Post = 3,
24                 Delete = 4,
25             }
26
27             internal static partial class IoTCon
28             {
29                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_start_presence")]
30                 internal static extern int StartPresence(uint time);
31
32                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_stop_presence")]
33                 internal static extern int StopPresence();
34
35                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_set_device_name")]
36                 internal static extern int SetDeviceName(string deviceName);
37             }
38
39             internal static partial class Resource
40             {
41                 internal delegate void RequestHandlerCallback(IntPtr resource, IntPtr request, IntPtr userData);
42
43                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_create")]
44                 internal static extern int Create(string uriPath, IntPtr resTypes, IntPtr ifaces, int properties, RequestHandlerCallback cb, IntPtr userData, out IntPtr resourceHandle);
45
46                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_destroy")]
47                 internal static extern int Destroy(IntPtr resourceHandle);
48
49                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_interface")]
50                 internal static extern int BindInterface(IntPtr resource, string iface);
51
52                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_type")]
53                 internal static extern int BindType(IntPtr resourceHandle, string resourceType);
54
55                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_set_request_handler")]
56                 internal static extern int SetRequestHandler(IntPtr resource, RequestHandlerCallback cb, IntPtr userData);
57
58                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_child_resource")]
59                 internal static extern int BindChildResource(IntPtr parent, IntPtr child);
60
61                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_unbind_child_resource")]
62                 internal static extern int UnbindChildResource(IntPtr parent, IntPtr child);
63
64                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_notify")]
65                 internal static extern int Notify(IntPtr resource, IntPtr repr, IntPtr observers, int qos);
66
67                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_number_of_children")]
68                 internal static extern int GetNumberOfChildren(IntPtr resource, out int number);
69
70                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_nth_child")]
71                 internal static extern int GetNthChild(IntPtr parent, int index, out IntPtr child);
72
73                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_uri_path")]
74                 internal static extern int GetUriPath(IntPtr resource, out IntPtr uriPath);
75
76                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_types")]
77                 internal static extern int GetTypes(IntPtr resource, out IntPtr types);
78
79                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_interfaces")]
80                 internal static extern int GetInterfaces(IntPtr resource, out IntPtr ifaces);
81
82                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_properties")]
83                 internal static extern int GetProperties(IntPtr resource, out int properties);
84             }
85
86             internal static partial class Request
87             {
88                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_host_address")]
89                 internal static extern int GetHostAddress(IntPtr request, out IntPtr hostAddress);
90
91                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_connectivity_type")]
92                 internal static extern int GetConnectivityType(IntPtr request, out int connectivityType);
93
94                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_representation")]
95                 internal static extern int GetRepresentation(IntPtr request, out IntPtr repr);
96
97                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_request_type")]
98                 internal static extern int GetRequestType(IntPtr request, out int type);
99
100                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_options")]
101                 internal static extern int GetOptions(IntPtr request, out IntPtr options);
102
103                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_query")]
104                 internal static extern int GetQuery(IntPtr request, out IntPtr query);
105
106                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_type")]
107                 internal static extern int GetObserveType(IntPtr request, out int observeType);
108
109                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_id")]
110                 internal static extern int GetObserveId(IntPtr request, out int observeId);
111             }
112
113             internal static partial class Response
114             {
115                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_create")]
116                 internal static extern int Create(IntPtr request, out IntPtr response);
117
118                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_destroy")]
119                 internal static extern void Destroy(IntPtr resp);
120
121                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_options")]
122                 internal static extern int GetOptions(IntPtr resp, out IntPtr options);
123
124                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_representation")]
125                 internal static extern int GetRepresentation(IntPtr resp, out IntPtr repr);
126
127                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_result")]
128                 internal static extern int GetResult(IntPtr resp, out int result);
129
130                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_result")]
131                 internal static extern int SetResult(IntPtr resp, int result);
132
133                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_representation")]
134                 internal static extern int SetRepresentation(IntPtr resp, IntPtr repr);
135
136                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_options")]
137                 internal static extern int SetOptions(IntPtr resp, IntPtr options);
138
139                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_send")]
140                 internal static extern int Send(IntPtr resp);
141             }
142
143             internal static partial class Observers
144             {
145                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_create")]
146                 internal static extern int Create(out IntPtr observers);
147
148                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_destroy")]
149                 internal static extern void Destroy(IntPtr observers);
150
151                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_add")]
152                 internal static extern int Add(IntPtr observers, int observeId);
153
154                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_remove")]
155                 internal static extern int Remove(IntPtr observers, int observeId);
156             }
157         }
158     }
159 }