1use core::ffi::c_double;
4
5use crate::{map_jump_table, V5_DeviceT};
6
7use core::ffi::c_float;
8
9#[repr(C, packed)]
10#[derive(Default, Debug, Copy, Clone, PartialEq)]
11pub struct V5_DeviceAiVisionColor {
12 pub id: u8,
13 pub red: u8,
14 pub grn: u8,
15 pub blu: u8,
16 pub hangle: c_float,
17 pub hdsat: c_float,
18 pub reserved: u32,
19}
20
21#[repr(C, packed)]
22#[derive(Copy, Clone)]
23pub struct V5_DeviceAiVisionObject {
24 pub id: u8,
25 pub r#type: u8,
26 pub object: V5_DeviceAiVisionObjectData,
27}
28
29#[repr(C)]
30#[derive(Copy, Clone)]
31pub union V5_DeviceAiVisionObjectData {
32 pub color: V5_DeviceAiVisionColorData,
33 pub tag: V5_DeviceAiVisionTagData,
34 pub model: V5_DeviceAiVisionModelData,
35}
36
37#[repr(C)]
39#[derive(Default, Debug, Copy, Clone, PartialEq)]
40pub struct V5_DeviceAiVisionColorData {
41 pub xoffset: u16,
43 pub yoffset: u16,
45 pub width: u16,
47 pub height: u16,
49 pub angle: u16,
51}
52
53#[repr(C)]
55#[derive(Default, Debug, Copy, Clone, PartialEq)]
56pub struct V5_DeviceAiVisionTagData {
57 pub x0: i16,
58 pub y0: i16,
59 pub x1: i16,
60 pub y1: i16,
61 pub x2: i16,
62 pub y2: i16,
63 pub x3: i16,
64 pub y3: i16,
65}
66
67#[repr(C)]
69#[derive(Default, Debug, Copy, Clone, PartialEq)]
70pub struct V5_DeviceAiVisionModelData {
71 pub xoffset: u16,
73 pub yoffset: u16,
75 pub width: u16,
77 pub height: u16,
79 pub score: u16,
81}
82
83#[repr(C, packed)]
84#[derive(Default, Debug, Copy, Clone, PartialEq)]
85pub struct V5_DeviceAiVisionCode {
86 pub id: u8,
87 pub len: u8,
88 pub c1: i16,
89 pub c2: i16,
90 pub c3: i16,
91 pub c4: i16,
92 pub c5: i16,
93 pub c6: i16,
94 pub c7: i16,
95}
96
97map_jump_table! {
98 0xcd4 => pub fn vexDeviceAiVisionClassNameGet(device: V5_DeviceT, id: i32, pName: *mut u8) -> i32,
99 0xcc4 => pub fn vexDeviceAiVisionCodeGet(device: V5_DeviceT, id: u32, pCode: *mut V5_DeviceAiVisionCode) -> bool,
100 0xcc0 => pub fn vexDeviceAiVisionCodeSet(device: V5_DeviceT, pCode: *mut V5_DeviceAiVisionCode),
101 0xcbc => pub fn vexDeviceAiVisionColorGet(device: V5_DeviceT, id: u32, pColor: *mut V5_DeviceAiVisionColor) -> bool,
102 0xcb8 => pub fn vexDeviceAiVisionColorSet(device: V5_DeviceT, pColor: *mut V5_DeviceAiVisionColor),
103 0xcac => pub fn vexDeviceAiVisionModeGet(device: V5_DeviceT) -> u32,
104 0xca8 => pub fn vexDeviceAiVisionModeSet(device: V5_DeviceT, mode: u32),
105 0xcb0 => pub fn vexDeviceAiVisionObjectCountGet(device: V5_DeviceT) -> i32,
106 0xcb4 => pub fn vexDeviceAiVisionObjectGet(device: V5_DeviceT, indexObj: u32, pObject: *mut V5_DeviceAiVisionObject) -> i32,
107 0xcd8 => pub fn vexDeviceAiVisionSensorSet(device: V5_DeviceT, brightness: c_double, contrast: c_double),
108 0xcc8 => pub fn vexDeviceAiVisionStatusGet(device: V5_DeviceT) -> u32,
109 0xccc => pub fn vexDeviceAiVisionTemperatureGet(device: V5_DeviceT) -> c_double,
110}