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