-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTobii.StreamEngine.Interop.cs
1007 lines (791 loc) · 45.4 KB
/
Tobii.StreamEngine.Interop.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
COPYRIGHT 2017 - PROPERTY OF TOBII AB
-------------------------------------
2017 TOBII AB - KARLSROVAGEN 2D, DANDERYD 182 53, SWEDEN - All Rights Reserved.
NOTICE: All information contained herein is, and remains, the property of Tobii AB and its suppliers, if any.
The intellectual and technical concepts contained herein are proprietary to Tobii AB and its suppliers and may be
covered by U.S.and Foreign Patents, patent applications, and are protected by trade secret or copyright law.
Dissemination of this information or reproduction of this material is strictly forbidden unless prior written
permission is obtained from Tobii AB.
*/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Tobii.StreamEngine
{
public static class Interop
{
public const string stream_engine_dll = "tobii_stream_engine";
public static string tobii_error_message(tobii_error_t result_code)
{
var pStr = tobii_error_message_internal(result_code);
return Marshal.PtrToStringAnsi(pStr);
}
[DllImport(stream_engine_dll, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_error_message")]
private static extern IntPtr tobii_error_message_internal(tobii_error_t result_code);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_get_api_version")]
public static extern tobii_error_t tobii_get_api_version(out tobii_version_t version);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_log_func_t(IntPtr log_context, tobii_log_level_t level, string text);
public static tobii_error_t tobii_api_create(out IntPtr api, tobii_custom_log_t custom_log)
{
return tobii_api_create(out api, IntPtr.Zero, custom_log);
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_api_create")]
private static extern tobii_error_t tobii_api_create(out IntPtr api, IntPtr customAlloc, tobii_custom_log_t custom_log); // Custom alloc doesn't make sense in .NET
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_api_destroy")]
public static extern tobii_error_t tobii_api_destroy(IntPtr api);
public static tobii_error_t tobii_enumerate_local_device_urls(IntPtr api, out List<string> device_urls)
{
var urls = new List<string>();
tobii_device_url_receiver_t handler = (url, data) => { urls.Add(url); };
var result = tobii_enumerate_local_device_urls_internal(api, handler, IntPtr.Zero);
device_urls = urls;
return result;
}
public enum tobii_device_generations_t
{
G5 = 0x00000002,
IS3 = 0x00000004,
IS4 = 0x00000008,
}
public static tobii_error_t tobii_enumerate_local_device_urls_ex(IntPtr api, out List<string> device_urls, uint device_generations)
{
var urls = new List<string>();
tobii_device_url_receiver_t handler = (url, data) => { urls.Add(url); };
var result = tobii_enumerate_local_device_urls_ex_internal(api, handler, IntPtr.Zero, device_generations);
device_urls = urls;
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_enumerate_local_device_urls")]
private static extern tobii_error_t tobii_enumerate_local_device_urls_internal(IntPtr api, tobii_device_url_receiver_t receiverFunction, IntPtr userData);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_enumerate_local_device_urls_ex")]
private static extern tobii_error_t tobii_enumerate_local_device_urls_ex_internal(IntPtr api, tobii_device_url_receiver_t receiverFunction, IntPtr userData, uint deviceGenerations);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_device_create")]
public static extern tobii_error_t tobii_device_create(IntPtr api, string url, out IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_device_create_ex")]
private static extern tobii_error_t tobii_device_create_ex_internal(IntPtr api, string url, tobii_license_key_t[] license_keys, int license_count, [MarshalAs(UnmanagedType.LPArray)] tobii_license_validation_result_t[] licenseResults, out IntPtr device);
public static tobii_error_t tobii_device_create_ex(IntPtr api, string url, string[] license_keys, List<tobii_license_validation_result_t> license_results, out IntPtr device)
{
var keys = new List<tobii_license_key_t>();
foreach (var key in license_keys)
{
keys.Add(new tobii_license_key_t { license_key = key, size_in_bytes = new IntPtr(key.Length * 2) });
}
var license_results_array = new tobii_license_validation_result_t[license_keys.Length];
var tobii_error = tobii_device_create_ex_internal(api, url, keys.ToArray(), keys.Count, license_results_array, out device);
if (license_results != null)
{
license_results.InsertRange(0, license_results_array);
}
return tobii_error;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_get_feature_group")]
public static extern tobii_error_t tobii_get_feature_group(IntPtr device, out tobii_feature_group_t feature_group);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_device_destroy")]
public static extern tobii_error_t tobii_device_destroy(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_wait_for_callbacks")]
private static extern tobii_error_t tobii_wait_for_callbacks_internal(IntPtr engine, int device_count, IntPtr[] devices);
public static tobii_error_t tobii_wait_for_callbacks(IntPtr engine, IntPtr[] devices)
{
var length = ( devices != null ) ? devices.Length : 0;
var tobii_error = tobii_wait_for_callbacks_internal(engine, length, devices);
return tobii_error;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_device_process_callbacks")]
public static extern tobii_error_t tobii_device_process_callbacks(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_device_clear_callback_buffers")]
public static extern tobii_error_t tobii_device_clear_callback_buffers(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_device_reconnect")]
public static extern tobii_error_t tobii_device_reconnect(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_system_clock")]
public static extern tobii_error_t tobii_system_clock(IntPtr api, out long timestamp_us);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_get_device_info")]
public static extern tobii_error_t tobii_get_device_info(IntPtr device, out tobii_device_info_t device_info);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_license_key_store")]
public static extern tobii_error_t tobii_license_key_store(IntPtr device, IntPtr data, IntPtr size);
public static tobii_error_t tobii_license_key_store(IntPtr device, byte[] license_key)
{
var ptr = Marshal.AllocHGlobal(license_key.Length);
tobii_error_t result;
try
{
Marshal.Copy(license_key, 0, ptr, license_key.Length);
result = tobii_license_key_store(device, ptr, new IntPtr(license_key.Length));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_license_key_retrieve")]
public static extern tobii_error_t tobii_license_key_retrieve(IntPtr device, tobii_data_receiver_t receiver);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_state_bool")]
public static extern tobii_error_t tobii_get_state_bool(IntPtr device, tobii_state_t state, out tobii_state_bool_t value);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_state_uint32")]
public static extern tobii_error_t tobii_get_state_uint32(IntPtr device, tobii_state_t state, out uint value);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_state_string")]
private static extern tobii_error_t tobii_get_state_string(IntPtr device, tobii_state_t state, StringBuilder value);
public static tobii_error_t tobii_get_state_string(IntPtr device, tobii_state_t state, out string value)
{
var val = new StringBuilder(512);
var result = tobii_get_state_string(device, state, val);
value = val.ToString();
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_notifications_subscribe")]
public static extern tobii_error_t tobii_notifications_subscribe(IntPtr device, tobii_notifications_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_notifications_unsubscribe")]
public static extern tobii_error_t tobii_notifications_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_capability_supported")]
public static extern tobii_error_t tobii_capability_supported(IntPtr device, tobii_capability_t capability, out bool supported);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_stream_supported")]
public static extern tobii_error_t tobii_stream_supported(IntPtr device, tobii_stream_t stream, out bool supported);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_engine_create")]
public static extern tobii_error_t tobii_engine_create(IntPtr api, out IntPtr engine);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_engine_destroy")]
public static extern tobii_error_t tobii_engine_destroy(IntPtr engine);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_engine_reconnect")]
public static extern tobii_error_t tobii_engine_reconnect(IntPtr engine);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_engine_process_callbacks")]
public static extern tobii_error_t tobii_engine_process_callbacks(IntPtr engine);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_engine_clear_callback_buffers")]
public static extern tobii_error_t tobii_engine_clear_callback_buffers(IntPtr engine);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "tobii_enumerate_devices")]
private static extern tobii_error_t tobii_enumerate_devices_internal(IntPtr engine, tobii_enumerated_device_receiver_t receiverFunction, IntPtr userData);
public static tobii_error_t tobii_enumerate_devices(IntPtr engine, out List<tobii_enumerated_device_t> enumerated_devices)
{
var devices = new List<tobii_enumerated_device_t>();
tobii_enumerated_device_receiver_t handler = (ref tobii_enumerated_device_t enumerated_device, IntPtr data) => { devices.Add(enumerated_device); };
var result = tobii_enumerate_devices_internal(engine, handler, IntPtr.Zero);
enumerated_devices = devices;
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_device_list_change_subscribe")]
public static extern tobii_error_t tobii_device_list_change_subscribe(IntPtr engine, tobii_device_list_change_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_device_list_change_unsubscribe")]
public static extern tobii_error_t tobii_device_list_change_unsubscribe(IntPtr device);
#region Streams
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_point_subscribe")]
public static extern tobii_error_t tobii_gaze_point_subscribe(IntPtr device, tobii_gaze_point_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_point_unsubscribe")]
public static extern tobii_error_t tobii_gaze_point_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_origin_subscribe")]
public static extern tobii_error_t tobii_gaze_origin_subscribe(IntPtr device, tobii_gaze_origin_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_origin_unsubscribe")]
public static extern tobii_error_t tobii_gaze_origin_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_eye_position_normalized_subscribe")]
public static extern tobii_error_t tobii_eye_position_normalized_subscribe(IntPtr device, tobii_eye_position_normalized_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_eye_position_normalized_unsubscribe")]
public static extern tobii_error_t tobii_eye_position_normalized_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_user_presence_subscribe")]
public static extern tobii_error_t tobii_user_presence_subscribe(IntPtr device, tobii_user_presence_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_user_presence_unsubscribe")]
public static extern tobii_error_t tobii_user_presence_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_head_pose_subscribe")]
public static extern tobii_error_t tobii_head_pose_subscribe(IntPtr device, tobii_head_pose_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_head_pose_unsubscribe")]
public static extern tobii_error_t tobii_head_pose_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_track_box")]
public static extern tobii_error_t tobii_get_track_box(IntPtr device, out tobii_track_box_t track_box);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_update_timesync")]
public static extern tobii_error_t tobii_update_timesync(IntPtr device);
#endregion
#region Wearable
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_wearable_data_subscribe")]
public static extern tobii_error_t tobii_wearable_data_subscribe(IntPtr device, tobii_wearable_data_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_wearable_data_unsubscribe")]
public static extern tobii_error_t tobii_wearable_data_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_lens_configuration")]
public static extern tobii_error_t tobii_get_lens_configuration(IntPtr device, out tobii_lens_configuration_t configuration);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_set_lens_configuration")]
public static extern tobii_error_t tobii_set_lens_configuration(IntPtr device, ref tobii_lens_configuration_t configuration);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_lens_configuration_writable")]
public static extern tobii_error_t tobii_lens_configuration_writable(IntPtr device, out tobii_lens_configuration_writable_t writable);
#endregion
#region Config
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_start")]
public static extern tobii_error_t tobii_calibration_start(IntPtr device, tobii_enabled_eye_t enabled_eye );
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_stop")]
public static extern tobii_error_t tobii_calibration_stop(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_clear")]
public static extern tobii_error_t tobii_calibration_clear(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_collect_data_2d")]
public static extern tobii_error_t tobii_calibration_collect_data_2d(IntPtr device, float x, float y);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_collect_data_3d")]
public static extern tobii_error_t tobii_calibration_collect_data_3d(IntPtr device, float x, float y, float z);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_collect_data_per_eye_2d")]
public static extern tobii_error_t tobii_calibration_collect_data_per_eye_2d(IntPtr device, float x, float y, tobii_enabled_eye_t requested_eyes, out tobii_enabled_eye_t collected_eyes);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_discard_data_2d")]
public static extern tobii_error_t tobii_calibration_discard_data_2d(IntPtr device, float x, float y);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_discard_data_3d")]
public static extern tobii_error_t tobii_calibration_discard_data_3d(IntPtr device, float x, float y, float z);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_discard_data_per_eye_2d")]
public static extern tobii_error_t tobii_calibration_discard_data_per_eye_2d(IntPtr device, float x, float y, tobii_enabled_eye_t calibrated_eyes);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_compute_and_apply")]
public static extern tobii_error_t tobii_calibration_compute_and_apply(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_compute_and_apply_per_eye")]
public static extern tobii_error_t tobii_calibration_compute_and_apply_per_eye(IntPtr device, out tobii_enabled_eye_t collected_eyes);
public static tobii_error_t tobii_calibration_retrieve(IntPtr device, out byte[] calibration)
{
byte[] buffer = null;
var result = tobii_calibration_retrieve(device, (data, size) =>
{
buffer = new byte[size.ToInt32()];
Marshal.Copy(data, buffer, 0, (int)size);
});
calibration = buffer;
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_retrieve")]
public static extern tobii_error_t tobii_calibration_retrieve(IntPtr device, tobii_data_receiver_t callback);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_calibration_point_data_receiver_t(ref tobii_calibration_point_data_t point_data, IntPtr user_data);
public static tobii_error_t tobii_calibration_parse(IntPtr api, byte[] calibration, out List<tobii_calibration_point_data_t> point_data_items)
{
var points = new List<tobii_calibration_point_data_t>();
var p = Marshal.AllocHGlobal(calibration.Length);
Marshal.Copy(calibration, 0, p, calibration.Length);
var result = tobii_calibration_parse(api, p, new IntPtr(calibration.Length), (ref tobii_calibration_point_data_t point_data, IntPtr user_data) =>
{
tobii_calibration_point_data_t point;
point.point_xy = point_data.point_xy;
point.left_status = point_data.left_status;
point.left_mapping_xy = point_data.left_mapping_xy;
point.right_status = point_data.left_status;
point.right_mapping_xy = point_data.left_mapping_xy;
points.Add(point);
}, IntPtr.Zero);
Marshal.FreeHGlobal(p);
point_data_items = points;
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_parse")]
public static extern tobii_error_t tobii_calibration_parse(IntPtr api, IntPtr calibration, IntPtr calibration_size, tobii_calibration_point_data_receiver_t callback, IntPtr user_data );
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calibration_apply")]
public static extern tobii_error_t tobii_calibration_apply(IntPtr device, IntPtr data, IntPtr size);
public static tobii_error_t tobii_calibration_apply(IntPtr device, byte[] calibration)
{
var ptr = Marshal.AllocHGlobal(calibration.Length);
tobii_error_t result;
try
{
Marshal.Copy(calibration, 0, ptr, calibration.Length);
result = tobii_calibration_apply(device, ptr, new IntPtr(calibration.Length));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_calculate_display_area_basic")]
public static extern tobii_error_t tobii_calculate_display_area_basic(IntPtr api, float width_mm, float height_mm, float offset_x_mm, ref tobii_geometry_mounting_t geometry_mounting, out tobii_display_area_t display_area );
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_display_area")]
public static extern tobii_error_t tobii_get_display_area(IntPtr device, out tobii_display_area_t display_area);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_set_display_area")]
public static extern tobii_error_t tobii_set_display_area(IntPtr device, ref tobii_display_area_t display_area);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_geometry_mounting")]
public static extern tobii_error_t tobii_get_geometry_mounting(IntPtr device, out tobii_geometry_mounting_t geometry);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "tobii_get_device_name")]
private static extern tobii_error_t tobii_get_device_name(IntPtr device, StringBuilder device_name);
public static tobii_error_t tobii_get_device_name(IntPtr device, out string device_name)
{
var dn = new StringBuilder(64);
var result = tobii_get_device_name(device, dn);
device_name = dn.ToString();
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi, EntryPoint = "tobii_set_device_name")]
public static extern tobii_error_t tobii_set_device_name(IntPtr device, string device_name);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_enumerate_output_frequencies")]
public static extern tobii_error_t tobii_enumerate_output_frequencies(IntPtr device, tobii_output_frequency_receiver_t receiver);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_set_output_frequency")]
public static extern tobii_error_t tobii_set_output_frequency(IntPtr device, float output_frequency);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_output_frequency")]
public static extern tobii_error_t tobii_get_output_frequency(IntPtr device, out float output_frequency);
#endregion
#region Advanced
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_data_subscribe")]
public static extern tobii_error_t tobii_gaze_data_subscribe(IntPtr device, tobii_gaze_data_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_gaze_data_unsubscribe")]
public static extern tobii_error_t tobii_gaze_data_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_enumerate_illumination_modes")]
public static extern tobii_error_t tobii_enumerate_illumination_modes(IntPtr device, tobii_illumination_mode_receiver_t receiver);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_illumination_mode")]
private static extern tobii_error_t tobii_get_illumination_mode(IntPtr device, StringBuilder illumination_mode);
public static tobii_error_t tobii_get_illumination_mode(IntPtr device, out string illumination_mode)
{
var im = new StringBuilder(64);
var result = tobii_get_illumination_mode(device, im);
illumination_mode = im.ToString();
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_set_illumination_mode")]
public static extern tobii_error_t tobii_set_illumination_mode(IntPtr device, string illumination_mode);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_timesync")]
public static extern tobii_error_t tobii_timesync(IntPtr device, out tobii_timesync_data_t timesync);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_digital_syncport_subscribe")]
public static extern tobii_error_t tobii_digital_syncport_subscribe(IntPtr device, tobii_digital_syncport_callback_t callback);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_digital_syncport_unsubscribe")]
public static extern tobii_error_t tobii_digital_syncport_unsubscribe(IntPtr device);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_enumerate_face_types")]
private static extern tobii_error_t tobii_enumerate_face_types_internal(IntPtr device, tobii_face_type_receiver_t receiver, IntPtr user_data);
public static tobii_error_t tobii_enumerate_face_types(IntPtr device, out List<string> face_types)
{
var types = new List<string>();
tobii_face_type_receiver_t handler = (face_type, data) => { types.Add(face_type); };
var result = tobii_enumerate_face_types_internal(device, handler, IntPtr.Zero);
face_types = types;
return result;
}
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_set_face_type")]
public static extern tobii_error_t tobii_set_face_type(IntPtr device, string face_type);
[DllImport(stream_engine_dll, CallingConvention = CallingConvention.Cdecl, EntryPoint = "tobii_get_face_type")]
private static extern tobii_error_t tobii_get_face_type(IntPtr device, StringBuilder face_type);
public static tobii_error_t tobii_get_face_type(IntPtr device, out string face_type)
{
var val = new StringBuilder(64);
var result = tobii_get_face_type(device, val);
face_type = val.ToString();
return result;
}
#endregion
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_version_t
{
public int major;
public int minor;
public int revision;
public int build;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct tobii_device_info_t
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string serial_number;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string model;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string generation;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string firmware_version;
}
[StructLayout(LayoutKind.Sequential)]
public class tobii_custom_log_t
{
public IntPtr log_context;
public Interop.tobii_log_func_t log_func;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_data_receiver_t(IntPtr data, IntPtr size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_device_url_receiver_t(string url, IntPtr user_data);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_face_type_receiver_t(string face_type, IntPtr user_data);
public enum tobii_feature_group_t
{
TOBII_FEATURE_GROUP_BLOCKED,
TOBII_FEATURE_GROUP_CONSUMER,
TOBII_FEATURE_GROUP_CONFIG,
TOBII_FEATURE_GROUP_PROFESSIONAL,
TOBII_FEATURE_GROUP_INTERNAL,
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_license_key_t
{
[MarshalAs(UnmanagedType.LPWStr)]
public string license_key;
public IntPtr size_in_bytes;
}
public enum tobii_license_validation_result_t
{
TOBII_LICENSE_VALIDATION_RESULT_OK,
TOBII_LICENSE_VALIDATION_RESULT_TAMPERED,
TOBII_LICENSE_VALIDATION_RESULT_INVALID_APPLICATION_SIGNATURE,
TOBII_LICENSE_VALIDATION_RESULT_NONSIGNED_APPLICATION,
TOBII_LICENSE_VALIDATION_RESULT_EXPIRED,
TOBII_LICENSE_VALIDATION_RESULT_PREMATURE,
TOBII_LICENSE_VALIDATION_RESULT_INVALID_PROCESS_NAME,
TOBII_LICENSE_VALIDATION_RESULT_INVALID_SERIAL_NUMBER,
TOBII_LICENSE_VALIDATION_RESULT_INVALID_MODEL,
}
[StructLayout(LayoutKind.Sequential)]
public struct TobiiVector2
{
public float x;
public float y;
}
[StructLayout(LayoutKind.Sequential)]
public struct TobiiVector3
{
public float x;
public float y;
public float z;
}
public enum tobii_validity_t
{
TOBII_VALIDITY_INVALID = 0,
TOBII_VALIDITY_VALID = 1
}
public enum tobii_field_presence_t
{
TOBII_FIELD_NOT_PRESENT = 0,
TOBII_FIELD_PRESENT = 1,
}
public enum tobii_error_t
{
TOBII_ERROR_NO_ERROR,
TOBII_ERROR_INTERNAL,
TOBII_ERROR_INSUFFICIENT_LICENSE,
TOBII_ERROR_NOT_SUPPORTED,
TOBII_ERROR_NOT_AVAILABLE,
TOBII_ERROR_CONNECTION_FAILED,
TOBII_ERROR_TIMED_OUT,
TOBII_ERROR_ALLOCATION_FAILED,
TOBII_ERROR_INVALID_PARAMETER,
TOBII_ERROR_CALIBRATION_ALREADY_STARTED,
TOBII_ERROR_CALIBRATION_NOT_STARTED,
TOBII_ERROR_ALREADY_SUBSCRIBED,
TOBII_ERROR_NOT_SUBSCRIBED,
TOBII_ERROR_OPERATION_FAILED,
TOBII_ERROR_CONFLICTING_API_INSTANCES,
TOBII_ERROR_CALIBRATION_BUSY,
TOBII_ERROR_CALLBACK_IN_PROGRESS,
TOBII_ERROR_TOO_MANY_SUBSCRIBERS
}
public enum tobii_log_level_t
{
TOBII_LOG_LEVEL_ERROR,
TOBII_LOG_LEVEL_WARN,
TOBII_LOG_LEVEL_INFO,
TOBII_LOG_LEVEL_DEBUG,
TOBII_LOG_LEVEL_TRACE,
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_notifications_callback_t(ref tobii_notification_t notification);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_gaze_point_callback_t(ref tobii_gaze_point_t gaze_point);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_gaze_origin_callback_t(ref tobii_gaze_origin_t gaze_origin);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_eye_position_normalized_callback_t(ref tobii_eye_position_normalized_t eye_position);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_user_presence_callback_t(tobii_user_presence_status_t status, long timestamp_us);
[StructLayout(LayoutKind.Sequential)]
public struct tobii_gaze_point_t
{
public long timestamp_us;
public tobii_validity_t validity;
public TobiiVector2 position;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_track_box_t
{
public TobiiVector3 front_upper_right_xyz;
public TobiiVector3 front_upper_left_xyz;
public TobiiVector3 front_lower_left_xyz;
public TobiiVector3 front_lower_right_xyz;
public TobiiVector3 back_upper_right_xyz;
public TobiiVector3 back_upper_left_xyz;
public TobiiVector3 back_lower_left_xyz;
public TobiiVector3 back_lower_right_xyz;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_gaze_origin_t
{
public long timestamp_us;
public tobii_validity_t left_validity;
public TobiiVector3 left;
public tobii_validity_t right_validity;
public TobiiVector3 right;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_eye_position_normalized_t
{
public long timestamp_us;
public tobii_validity_t left_validity;
public TobiiVector3 left;
public tobii_validity_t right_validity;
public TobiiVector3 right;
}
public enum tobii_user_presence_status_t
{
TOBII_USER_PRESENCE_STATUS_UNKNOWN,
TOBII_USER_PRESENCE_STATUS_AWAY,
TOBII_USER_PRESENCE_STATUS_PRESENT,
}
public enum tobii_notification_type_t
{
TOBII_NOTIFICATION_TYPE_CALIBRATION_STATE_CHANGED,
TOBII_NOTIFICATION_TYPE_EXCLUSIVE_MODE_STATE_CHANGED,
TOBII_NOTIFICATION_TYPE_TRACK_BOX_CHANGED,
TOBII_NOTIFICATION_TYPE_DISPLAY_AREA_CHANGED,
TOBII_NOTIFICATION_TYPE_FRAMERATE_CHANGED,
TOBII_NOTIFICATION_TYPE_POWER_SAVE_STATE_CHANGED,
TOBII_NOTIFICATION_TYPE_DEVICE_PAUSED_STATE_CHANGED,
TOBII_NOTIFICATION_TYPE_CALIBRATION_ENABLED_EYE_CHANGED,
TOBII_NOTIFICATION_TYPE_CALIBRATION_ID_CHANGED,
TOBII_NOTIFICATION_TYPE_COMBINED_GAZE_FACTOR_CHANGED,
TOBII_NOTIFICATION_TYPE_FAULTS_CHANGED,
TOBII_NOTIFICATION_TYPE_WARNINGS_CHANGED,
TOBII_NOTIFICATION_TYPE_FACE_TYPE_CHANGED,
}
public enum tobii_notification_value_type_t
{
TOBII_NOTIFICATION_VALUE_TYPE_NONE,
TOBII_NOTIFICATION_VALUE_TYPE_FLOAT,
TOBII_NOTIFICATION_VALUE_TYPE_STATE,
TOBII_NOTIFICATION_VALUE_TYPE_DISPLAY_AREA,
TOBII_NOTIFICATION_VALUE_TYPE_UINT,
TOBII_NOTIFICATION_VALUE_TYPE_ENABLED_EYE,
TOBII_NOTIFICATION_VALUE_TYPE_STRING,
}
[StructLayout(LayoutKind.Explicit)]
public struct tobii_notification_value_t
{
[FieldOffset(0)]
public float float_;
[FieldOffset(0)]
public tobii_state_bool_t state;
[FieldOffset(0)]
public tobii_display_area_t display_area;
[FieldOffset(0)]
public uint uint_;
[FieldOffset(0)]
public tobii_enabled_eye_t enabled_eye;
// TODO: Overlapping an object field with a non-object field i.e string and integer,
// will generate a runtime error. A re-design of this union is probably needed in order
// for it to work in the .NET bindings.
// WORK AROUND: When a notification containing a string is received, it needs to be
// queried through the tobii_get_state_string function.
//[FieldOffset(0), MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
//public string string_;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_notification_t
{
public tobii_notification_type_t type;
public tobii_notification_value_type_t value_type;
public tobii_notification_value_t value;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_wearable_data_callback_t(ref tobii_wearable_data_t data);
[StructLayout(LayoutKind.Sequential)]
public struct tobii_wearable_eye_t
{
public tobii_validity_t gaze_origin_validity;
public TobiiVector3 gaze_origin_mm_xyz;
public tobii_validity_t gaze_direction_validity;
public TobiiVector3 gaze_direction_normalized_xyz;
public tobii_validity_t pupil_diameter_validity;
public float pupil_diameter_mm;
public tobii_validity_t eye_openness_validity;
public float eye_openness;
public tobii_validity_t pupil_position_in_sensor_area_validity;
public TobiiVector2 pupil_position_in_sensor_area_xy;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_wearable_data_t
{
public long timestamp_tracker_us;
public long timestamp_system_us;
public uint frame_counter;
public uint led_mode;
public tobii_wearable_eye_t left;
public tobii_wearable_eye_t right;
public tobii_validity_t gaze_origin_combined_validity;
public TobiiVector3 gaze_origin_combined_mm_xyz;
public tobii_validity_t gaze_direction_combined_validity;
public TobiiVector3 gaze_direction_combined_normalized_xyz;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_lens_configuration_t
{
public TobiiVector3 left_xyz;
public TobiiVector3 right_xyz;
}
public enum tobii_lens_configuration_writable_t
{
TOBII_LENS_CONFIGURATION_NOT_WRITABLE,
TOBII_LENS_CONFIGURATION_WRITABLE,
}
public enum tobii_capability_t
{
TOBII_CAPABILITY_DISPLAY_AREA_WRITABLE,
TOBII_CAPABILITY_CALIBRATION_2D,
TOBII_CAPABILITY_CALIBRATION_3D,
TOBII_CAPABILITY_PERSISTENT_STORAGE,
TOBII_CAPABILITY_CALIBRATION_PER_EYE,
TOBII_CAPABILITY_COMBINED_GAZE_VR,
TOBII_CAPABILITY_FACE_TYPE,
}
public enum tobii_stream_t
{
TOBII_STREAM_GAZE_POINT,
TOBII_STREAM_GAZE_ORIGIN,
TOBII_STREAM_EYE_POSITION_NORMALIZED,
TOBII_STREAM_USER_PRESENCE,
TOBII_STREAM_HEAD_POSE,
TOBII_STREAM_WEARABLE,
TOBII_STREAM_GAZE_DATA,
TOBII_STREAM_DIGITAL_SYNCPORT,
TOBII_STREAM_DIAGNOSTICS_IMAGE,
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_output_frequency_receiver_t(float output_frequency);
[StructLayout(LayoutKind.Sequential)]
public struct tobii_display_area_t
{
public TobiiVector3 top_left_mm_xyz;
public TobiiVector3 top_right_mm_xyz;
public TobiiVector3 bottom_left_mm_xyz;
}
public enum tobii_enabled_eye_t
{
TOBII_ENABLED_EYE_LEFT,
TOBII_ENABLED_EYE_RIGHT,
TOBII_ENABLED_EYE_BOTH,
}
public enum tobii_calibration_point_status_t
{
TOBII_CALIBRATION_POINT_STATUS_FAILED_OR_INVALID,
TOBII_CALIBRATION_POINT_STATUS_VALID_BUT_NOT_USED_IN_CALIBRATION,
TOBII_CALIBRATION_POINT_STATUS_VALID_AND_USED_IN_CALIBRATION,
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_calibration_point_data_t
{
public TobiiVector2 point_xy;
public tobii_calibration_point_status_t left_status;
public TobiiVector2 left_mapping_xy;
public tobii_calibration_point_status_t right_status;
public TobiiVector2 right_mapping_xy;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_geometry_mounting_t
{
public int guides;
public float width_mm;
public float angle_deg;
public TobiiVector3 external_offset_mm_xyz;
public TobiiVector3 internal_offset_mm_xyz;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_gaze_data_eye_t
{
public tobii_validity_t gaze_origin_validity;
public TobiiVector3 gaze_origin_from_eye_tracker_mm_xyz;
public TobiiVector3 eye_position_in_track_box_normalized_xyz;
public tobii_validity_t gaze_point_validity;
public TobiiVector3 gaze_point_from_eye_tracker_mm_xyz;
public TobiiVector2 gaze_point_on_display_normalized_xy;
public tobii_validity_t eyeball_center_validity;
public TobiiVector3 eyeball_center_from_eye_tracker_mm_xyz;
public tobii_validity_t pupil_validity;
public float pupil_diameter_mm;
}
[StructLayout(LayoutKind.Sequential)]
public struct tobii_gaze_data_t
{
public long timestamp_tracker_us;
public long timestamp_system_us;
public tobii_gaze_data_eye_t left;
public tobii_gaze_data_eye_t right;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_gaze_data_callback_t(ref tobii_gaze_data_t gaze_data);
[StructLayout(LayoutKind.Sequential)]
public struct tobii_timesync_data_t
{
public long system_start_us;
public long system_end_us;
public long tracker_us;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_illumination_mode_receiver_t(string illumination_mode);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_digital_syncport_callback_t(uint signal, long timestamp_tracker_us, long timestamp_system_us);
public enum tobii_state_t
{
TOBII_STATE_POWER_SAVE_ACTIVE,
TOBII_STATE_REMOTE_WAKE_ACTIVE,
TOBII_STATE_DEVICE_PAUSED,
TOBII_STATE_EXCLUSIVE_MODE,
TOBII_STATE_FAULT,
TOBII_STATE_WARNING,
TOBII_STATE_CALIBRATION_ID,
TOBII_STATE_CALIBRATION_ACTIVE,
}
public enum tobii_state_bool_t
{
TOBII_STATE_BOOL_FALSE,
TOBII_STATE_BOOL_TRUE,
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_head_pose_callback_t(ref tobii_head_pose_t head_pose);
[StructLayout(LayoutKind.Sequential)]
public struct tobii_head_pose_t
{
public long timestamp_us;
public tobii_validity_t position_validity;
public TobiiVector3 position_xyz;
public tobii_validity_t rotation_x_validity;
public tobii_validity_t rotation_y_validity;
public tobii_validity_t rotation_z_validity;
public TobiiVector3 rotation_xyz;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_device_list_change_callback_t(string url, tobii_device_list_change_type_t type,
tobii_device_readiness_t readiness, long timestamp_us);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void tobii_enumerated_device_receiver_t(ref tobii_enumerated_device_t enumerated_device, IntPtr user_data);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct tobii_enumerated_device_t
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string url;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string serial_number;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string model;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string generation;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string firmware_version;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 120)] public string integration;
public tobii_device_readiness_t readiness;
}
public enum tobii_device_readiness_t
{
TOBII_DEVICE_READINESS_WAITING_FOR_FIRMWARE_UPGRADE,
TOBII_DEVICE_READINESS_UPGRADING_FIRMWARE,
TOBII_DEVICE_READINESS_WAITING_FOR_DISPLAY_AREA,
TOBII_DEVICE_READINESS_WAITING_FOR_CALIBRATION,
TOBII_DEVICE_READINESS_CALIBRATING,
TOBII_DEVICE_READINESS_READY,
TOBII_DEVICE_READINESS_PAUSED,
TOBII_DEVICE_READINESS_MALFUNCTIONING
}