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.
19 using System.Runtime.InteropServices;
21 internal static partial class Interop
23 internal static partial class IoTConnectivity
25 internal static partial class Server
27 internal enum RequestType
36 internal static partial class IoTCon
38 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_start_presence")]
39 internal static extern int StartPresence(uint time);
41 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_stop_presence")]
42 internal static extern int StopPresence();
44 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_set_device_name")]
45 internal static extern int SetDeviceName(string deviceName);
48 internal static partial class Resource
50 internal delegate void RequestHandlerCallback(IntPtr resource, IntPtr request, IntPtr userData);
52 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_create")]
53 internal static extern int Create(string uriPath, IntPtr resTypes, IntPtr ifaces, int properties, RequestHandlerCallback cb, IntPtr userData, out IntPtr resourceHandle);
55 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_destroy")]
56 internal static extern int Destroy(IntPtr resourceHandle);
58 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_interface")]
59 internal static extern int BindInterface(IntPtr resource, string iface);
61 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_type")]
62 internal static extern int BindType(IntPtr resourceHandle, string resourceType);
64 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_set_request_handler")]
65 internal static extern int SetRequestHandler(IntPtr resource, RequestHandlerCallback cb, IntPtr userData);
67 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_child_resource")]
68 internal static extern int BindChildResource(IntPtr parent, IntPtr child);
70 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_unbind_child_resource")]
71 internal static extern int UnbindChildResource(IntPtr parent, IntPtr child);
73 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_notify")]
74 internal static extern int Notify(IntPtr resource, IntPtr repr, IntPtr observers, int qos);
76 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_number_of_children")]
77 internal static extern int GetNumberOfChildren(IntPtr resource, out int number);
79 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_nth_child")]
80 internal static extern int GetNthChild(IntPtr parent, int index, out IntPtr child);
82 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_uri_path")]
83 internal static extern int GetUriPath(IntPtr resource, out IntPtr uriPath);
85 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_types")]
86 internal static extern int GetTypes(IntPtr resource, out IntPtr types);
88 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_interfaces")]
89 internal static extern int GetInterfaces(IntPtr resource, out IntPtr ifaces);
91 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_properties")]
92 internal static extern int GetProperties(IntPtr resource, out int properties);
95 internal static partial class Request
97 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_host_address")]
98 internal static extern int GetHostAddress(IntPtr request, out IntPtr hostAddress);
100 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_connectivity_type")]
101 internal static extern int GetConnectivityType(IntPtr request, out int connectivityType);
103 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_representation")]
104 internal static extern int GetRepresentation(IntPtr request, out IntPtr repr);
106 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_request_type")]
107 internal static extern int GetRequestType(IntPtr request, out int type);
109 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_options")]
110 internal static extern int GetOptions(IntPtr request, out IntPtr options);
112 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_query")]
113 internal static extern int GetQuery(IntPtr request, out IntPtr query);
115 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_type")]
116 internal static extern int GetObserveType(IntPtr request, out int observeType);
118 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_id")]
119 internal static extern int GetObserveId(IntPtr request, out int observeId);
122 internal static partial class Response
124 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_create")]
125 internal static extern int Create(IntPtr request, out IntPtr response);
127 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_destroy")]
128 internal static extern void Destroy(IntPtr resp);
130 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_options")]
131 internal static extern int GetOptions(IntPtr resp, out IntPtr options);
133 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_representation")]
134 internal static extern int GetRepresentation(IntPtr resp, out IntPtr repr);
136 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_result")]
137 internal static extern int GetResult(IntPtr resp, out int result);
139 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_result")]
140 internal static extern int SetResult(IntPtr resp, int result);
142 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_representation")]
143 internal static extern int SetRepresentation(IntPtr resp, IntPtr repr);
145 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_options")]
146 internal static extern int SetOptions(IntPtr resp, IntPtr options);
148 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_send")]
149 internal static extern int Send(IntPtr resp);
152 internal static partial class Observers
154 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_create")]
155 internal static extern int Create(out IntPtr observers);
157 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_destroy")]
158 internal static extern void Destroy(IntPtr observers);
160 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_add")]
161 internal static extern int Add(IntPtr observers, int observeId);
163 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_remove")]
164 internal static extern int Remove(IntPtr observers, int observeId);