MaxstARSDK  3.5.0
NativeSharedAPI.cs
1 /*==============================================================================
2 Copyright 2017 Maxst, Inc. All Rights Reserved.
3 ==============================================================================*/
4 
5 using System;
6 using System.Linq;
7 using System.Runtime.InteropServices;
8 
9 namespace maxstAR
10 {
11  internal class NativeSharedAPI
12  {
13  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
14  //public static extern void setUnityEditorMode(bool enable);
15 
16  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
17  //public static extern void createAppId(IntPtr byteArray, int arrayLength, byte[] createdAppId, int[] appIdLength);
18 
19  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
20  //public static extern void setAppKey(string appKey);
21 
22  #region -- Signature authenticatoin
23  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
24  public static extern int Signature_getSignatureType();
25 
26  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
27  public static extern IntPtr Signature_getInvalidImagePtr();
28 
29  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
30  public static extern IntPtr Signature_getFreeImagePtr();
31  #endregion
32 
33  #region -- MaxstAR Setting
34  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
35  //public static extern void onSurfaceCreated();
36 
37  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
38  public static extern void setScreenOrientation(int orientation);
39 
40  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
41  public static extern void onSurfaceChanged(int viewWidth, int viewHeight);
42 
43  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
44  //public static extern void onSurfaceDestroyed();
45  #endregion
46 
47  #region -- Camera Device settings
48  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
49  public static extern int CameraDevice_start(int cameraId, int preferredWidth, int preferredHeight);
50 
51  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
52  public static extern void CameraDevice_stop();
53 
54  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
55  public static extern bool CameraDevice_setFocusMode(int focusMode);
56 
57  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
58  public static extern bool CameraDevice_setFlashLightMode(bool toggle);
59 
60  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
61  public static extern bool CameraDevice_setAutoWhiteBalanceLock(bool toggle);
62 
63  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
64  public static extern bool CameraDevice_flipVideo(int direction, bool toggle);
65 
66  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
67  public static extern int CameraDevice_getParamList();
68 
69  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
70  public static extern int CameraDevice_Param_getKeyLength(int index);
71 
72  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
73  public static extern void CameraDevice_Param_getKey(int index, byte[] key);
74 
75  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
76  public static extern bool CameraDevice_setBoolTypeParameter(string key, bool boolValue);
77 
78  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
79  public static extern bool CameraDevice_setIntTypeParameter(string key, int intValue);
80 
81  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
82  public static extern bool CameraDevice_setRangeTypeParameter(string key, int min, int max);
83 
84  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
85  public static extern bool CameraDevice_setStringTypeParameter(string key, string intValue);
86 
87  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
88  public static extern int CameraDevice_getWidth();
89 
90  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
91  public static extern int CameraDevice_getHeight();
92 
93  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
94  public static extern IntPtr CameraDevice_getCameraImagePtr(ulong trackedFrame_cPtr, byte[] imageBuffer);
95 
96  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
97  public static extern void CameraDevice_getProjectionMatrix(float[] matrix);
98  #endregion
99 
100  //#region -- Background renderer setting
101  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
102  //public static extern void setDeviceRendererType(int deviceRendererType);
103 
104  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
105  //public static extern void BackgroundRenderer_setRenderingOption(int option);
106 
107  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
108  //public static extern void BackgroundRenderer_setVideoTargetTexture(int textureId, int width, int height);
109 
110  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
111  //public static extern void BackgroundRenderer_setClippingPlane(float nearClipPlane, float farClipPlane);
112 
113  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
114  //public static extern IntPtr getNativeRenderEventFunc();
115  //#endregion
116 
117  #region -- Tracker Manager
118  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
119  public static extern void TrackerManager_startTracker(int trackerMask);
120 
121  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
122  public static extern void TrackerManager_stopTracker();
123 
124  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
125  public static extern void TrackerManager_destroyTracker();
126 
127  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
128  public static extern void TrackerManager_addTrackerData(string trackingFileName, bool isAndroidAssetFile = false);
129 
130  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
131  public static extern void TrackerManager_removeTrackerData(string trackingFileName = "");
132 
133  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
134  public static extern void TrackerManager_loadTrackerData();
135 
136  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
137  public static extern void TrackerManager_setTrackingOption(int option);
138 
139  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
140  public static extern bool TrackerManager_isTrackerDataLoadCompleted();
141 
142  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
143  public static extern ulong TrackerManager_updateTrackingState();
144 
145  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
146  public static extern void TrackerManager_findSurface();
147 
148  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
149  public static extern void TrackerManager_quitFindingSurface();
150 
151  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
152  //public static extern ulong TrackerManager_getSurfaceMesh();
153 
154  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
155  public static extern ulong TrackerManager_getGuideInfo();
156 
157  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
158  public static extern ulong TrackerManager_saveSurfaceData(string outputFileName);
159 
160  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
161  //public static extern int TrackerManager_getCodeScanResultLength();
162 
163  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
164  //public static extern void TrackerManager_getCodeScanResult(byte[] result, int length);
165 
166  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
167  //public static extern void TrackerManager_getSurfaceMesh(float[] vertices, int[] indices, float[] pose);
168 
169  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
170  //public static extern void getSurfaceMeshInfo(out int vertexCount, out int indexCount);
171 
172  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
173  public static extern void TrackerManager_getWorldPositionFromScreenCoordinate(float[] screen, float[] world);
174 
175  #region -- Guide Info
176  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
177  public static extern float GuideInfo_getInitializingProgress(ulong GuideInfo_cPtr);
178 
179  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
180  public static extern int GuideInfo_getKeyframeCount(ulong GuideInfo_cPtr);
181 
182  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
183  public static extern int GuideInfo_getFeatureCount(ulong GuideInfo_cPtr);
184 
185  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
186  public static extern void GuideInfo_getFeatureBuffer(ulong GuideInfo_cPtr, float [] data, int length);
187  #endregion
188 
189  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
190  //public static extern int TrackerManager_getKeyframeCount();
191 
192  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
193  //public static extern int TrackerManager_getFeatureCount();
194 
195  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
196  //public static extern int TrackerManager_getFeatureVertex(float[] vertex);
197 
198  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
199  //public static extern int TrackerManager_getFeatureTrackingPose(float[] pose);
200  #endregion
201 
202  #region -- TrackingResult
203  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
204  public static extern int TrackingResult_getCount(ulong TrackingResult_cPtr);
205 
206  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
207  public static extern ulong TrackingResult_getTrackable(ulong TrackingResult_cPtr, int index);
208  #endregion
209 
210  #region -- Trackable
211  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
212  public static extern void Trackable_getId(ulong Trackable_cPtr, byte[] id);
213 
214  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
215  public static extern void Trackable_getName(ulong Trackable_cPtr, byte[] name);
216 
217  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
218  //public static extern float Trackable_getDistance(ulong Trackable_cPtr, int index);
219 
220  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
221  public static extern void Trackable_getPose(ulong Trackable_cPtr, float[] pose);
222 
223  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
224  //public static extern float Trackable_getWidth(ulong Trackable_cPtr);
225 
226  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
227  //public static extern float Trackable_getHeight(ulong Trackable_cPtr);
228  #endregion
229 
230  #region -- TrackingState
231  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
232  public static extern ulong TrackingState_getTrackingResult(ulong TrackingState_cPtr);
233 
234  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
235  public static extern ulong TrackingState_getImage(ulong TrackingState_cPtr);
236 
237  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
238  public static extern int TrackingState_getCodeScanResultLength(ulong TrackingState_cPtr);
239 
240  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
241  public static extern void TrackingState_getCodeScanResult(ulong TrackingState_cPtr, byte[] result, int length);
242 
243  #endregion
244 
245  #region -- SurfaceMesh
246  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
247  //public static extern float SurfaceMesh_getInitializingProgress(ulong SurfaceMesh_cPtr);
248 
249  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
250  //public static extern int SurfaceMesh_getVertexCount(ulong SurfaceMesh_cPtr);
251 
252  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
253  //public static extern int SurfaceMesh_getIndexCount(ulong SurfaceMesh_cPtr);
254 
255  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
256  //public static extern float SurfaceMesh_getVertexBuffer(ulong SurfaceMesh_cPtr, float[] vertexBuffer, int vertexCount);
257 
258  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
259  //public static extern float SurfaceMesh_getIndexBuffer(ulong SurfaceMesh_cPtr, short[] indexBuffer, int indexCount);
260  #endregion
261 
262  #region -- SurfaceThumbnail
263  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
264  public static extern int SurfaceThumbnail_getWidth(ulong SurfaceThumbnail_cPtr);
265 
266  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
267  public static extern int SurfaceThumbnail_getHeight(ulong SurfaceThumbnail_cPtr);
268 
269  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
270  public static extern int SurfaceThumbnail_getLength(ulong SurfaceThumbnail_cPtr);
271 
272  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
273  public static extern int SurfaceThumbnail_getBpp(ulong SurfaceThumbnail_cPtr);
274 
275  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
276  public static extern int SurfaceThumbnail_getData(ulong SurfaceThumbnail_cPtr, byte[] data, int length);
277  #endregion
278 
279  #region -- Sensor Device
280  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
281  public static extern void startSensor();
282 
283  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
284  public static extern void stopSensor();
285  #endregion
286 
287  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
288  //public static extern float getTrackingFps();
289 
290  //[DllImport(MaxstARUtils.MaxstARSharedLibName)]
291  //public static extern float getTrackingTime();
292 
293  #region -- MapViewer
294  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
295  public static extern bool MapViewer_initialize(string fileName);
296 
297  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
298  public static extern void MapViewer_deInitialize();
299 
300  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
301  public static extern IntPtr MapViewer_getJson();
302 
303  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
304  public static extern int MapViewer_create(int idx);
305 
306  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
307  public static extern void MapViewer_getIndices(out int indices);
308 
309  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
310  public static extern void MapViewer_getTexCoords(out float texCoords);
311 
312  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
313  public static extern int MapViewer_getImageSize(int idx);
314 
315  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
316  public static extern void MapViewer_getImage(int idx, out byte image);
317  #endregion
318 
319  #region -- Wearable Calibration
320  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
321  public static extern bool WearableCalibration_isActivated();
322 
323  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
324  public static extern bool WearableCalibration_init(string modelName);
325 
326  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
327  public static extern void WearableCalibration_deinit();
328 
329  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
330  public static extern void WearableCalibration_setSurfaceSize(int width, int height);
331 
332  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
333  public static extern void WearableCalibration_getProjectionMatrix(float[] projection, int eyeType);
334  #endregion
335 
336  #region -- Image Extractor
337  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
338  public static extern int TrackedImage_getWidth(ulong Image_cPtr);
339 
340  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
341  public static extern int TrackedImage_getHeight(ulong Image_cPtr);
342 
343  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
344  public static extern int TrackedImage_getLength(ulong Image_cPtr);
345 
346  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
347  public static extern int TrackedImage_getFormat(ulong Image_cPtr);
348 
349  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
350  public static extern void TrackedImage_getData(ulong Image_cPtr, byte[] buffer, int size);
351 
352  [DllImport(MaxstARUtils.MaxstARSharedLibName)]
353  public static extern ulong TrackedImage_getDataPtr(ulong Image_cPtr, int size);
354  #endregion
355  }
356 }
Define constant values
Definition: MaxstARUtils.cs:18