libnx  v4.7.0
irs.h
Go to the documentation of this file.
1 /**
2  * @file irs.h
3  * @brief HID IR sensor (irs) service IPC wrapper.
4  * @author yellows8
5  * @copyright libnx Authors
6  */
7 #pragma once
8 
9 #include "../types.h"
10 #include "../sf/service.h"
11 #include "../services/hid.h"
12 
13 #define IRS_MAX_CAMERAS 0x9
14 
15 /// IrCameraStatus
16 typedef enum {
17  IrsIrCameraStatus_Available = 0, ///< Available
18  IrsIrCameraStatus_Unsupported = 1, ///< Unsupported
19  IrsIrCameraStatus_Unconnected = 2, ///< Unconnected
21 
22 /// IrCameraInternalStatus
23 typedef enum {
25  IrsIrCameraInternalStatus_FirmwareUpdateNeeded = 1, ///< FirmwareUpdateNeeded
29  IrsIrCameraInternalStatus_FirmwareVersionRequested = 5, ///< FirmwareVersionRequested
30  IrsIrCameraInternalStatus_FirmwareVersionIsInvalid = 6, ///< FirmwareVersionIsInvalid
31  IrsIrCameraInternalStatus_Ready = 7, ///< [4.0.0+] Ready
32  IrsIrCameraInternalStatus_Setting = 8, ///< [4.0.0+] Setting
34 
35 /// IrSensorMode
36 typedef enum {
37  IrsIrSensorMode_None = 0, ///< None
38  IrsIrSensorMode_MomentProcessor = 1, ///< MomentProcessor
39  IrsIrSensorMode_ClusteringProcessor = 2, ///< ClusteringProcessor
40  IrsIrSensorMode_ImageTransferProcessor = 3, ///< ImageTransferProcessor
41  IrsIrSensorMode_PointingProcessor = 4, ///< PointingProcessor
42  IrsIrSensorMode_TeraPluginProcessor = 5, ///< TeraPluginProcessor
43  IrsIrSensorMode_IrLedProcessor = 6, ///< IrLedProcessor (doesn't apply to IrsDeviceFormat::ir_sensor_mode)
45 
46 /// ImageProcessorStatus
47 typedef enum {
51 
52 /// ImageTransferProcessorFormat. IR Sensor image resolution.
53 typedef enum {
57  IrsImageTransferProcessorFormat_40x30 = 3, ///< [4.0.0+] 40x30
58  IrsImageTransferProcessorFormat_20x15 = 4, ///< [4.0.0+] 20x15
60 
61 /// AdaptiveClusteringMode
62 typedef enum {
66 
67 /// AdaptiveClusteringTargetDistance
68 typedef enum {
73 
74 /// HandAnalysisMode
75 typedef enum {
76  IrsHandAnalysisMode_Silhouette = 1, ///< Silhouette
77  IrsHandAnalysisMode_Image = 2, ///< Image
78  IrsHandAnalysisMode_SilhouetteAndImage = 3, ///< SilhouetteAndImage
79  IrsHandAnalysisMode_SilhouetteOnly = 4, ///< [4.0.0+] SilhouetteOnly
81 
82 /// Internal validation callblack.
83 typedef bool (*IrsValidationCb)(void* userdata, void* arg);
84 
85 /// IrCameraHandle
86 typedef struct {
87  u8 player_number; ///< PlayerNumber
88  u8 device_type; ///< DeviceType
89  u8 reserved[0x2]; ///< Reserved
91 
92 /// PackedMcuVersion
93 typedef struct {
94  u16 major_version; ///< MajorVersion
95  u16 minor_version; ///< MinorVersion
97 
98 /// PackedFunctionLevel
99 typedef struct {
100  u8 ir_sensor_function_level; ///< IrSensorFunctionLevel
101  u8 reserved[0x3]; ///< Reserved
103 
104 /// Rect
105 typedef struct {
106  s16 x; ///< X
107  s16 y; ///< Y
108  s16 width; ///< Width
109  s16 height; ///< Height
110 } IrsRect;
111 
112 /// IrsMomentProcessorConfig
113 typedef struct {
114  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
115  u32 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
116  u32 gain; ///< IR sensor signal's digital gain.
117  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
118  u8 reserved[0x7]; ///< Reserved.
119  IrsRect window_of_interest; ///< WindowOfInterest
120  u32 preprocess; ///< Preprocess
121  u32 preprocess_intensity_threshold; ///< PreprocessIntensityThreshold
123 
124 /// PackedMomentProcessorConfig
125 typedef struct {
126  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
127  u8 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
128  u8 gain; ///< IR sensor signal's digital gain.
129  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
130  u8 reserved[0x5]; ///< Reserved.
131  IrsRect window_of_interest; ///< WindowOfInterest
132  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
133  u8 preprocess; ///< Preprocess
134  u8 preprocess_intensity_threshold; ///< PreprocessIntensityThreshold
135  u8 reserved2[0x2]; ///< Reserved.
137 
138 /// ClusteringProcessorConfig
139 typedef struct {
140  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
141  u32 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
142  u32 gain; ///< IR sensor signal's digital gain.
143  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
144  u8 reserved[0x7]; ///< Reserved.
145  IrsRect window_of_interest; ///< WindowOfInterest
146  u32 object_pixel_count_min; ///< ObjectPixelCountMin
147  u32 object_pixel_count_max; ///< ObjectPixelCountMax
148  u32 object_intensity_min; ///< ObjectIntensityMin
149  u8 is_external_light_filter_enabled; ///< IsExternalLightFilterEnabled
151 
152 /// PackedClusteringProcessorConfig
153 typedef struct {
154  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
155  u8 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
156  u8 gain; ///< IR sensor signal's digital gain.
157  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
158  u8 reserved[0x5]; ///< Reserved.
159  IrsRect window_of_interest; ///< WindowOfInterest
160  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
161  u32 object_pixel_count_min; ///< ObjectPixelCountMin
162  u32 object_pixel_count_max; ///< ObjectPixelCountMax
163  u8 object_intensity_min; ///< ObjectIntensityMin
164  u8 is_external_light_filter_enabled; ///< IsExternalLightFilterEnabled
165  u8 reserved2[0x2]; ///< Reserved.
167 
168 /// ImageTransferProcessorConfig
169 typedef struct {
170  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
171  u32 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
172  u32 gain; ///< IR sensor signal's digital gain.
173  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
174  u8 reserved[0x7]; ///< Reserved.
175  u32 format; ///< \ref IrsImageTransferProcessorFormat
177 
178 /// ImageTransferProcessorExConfig
179 typedef struct {
180  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
181  u32 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
182  u32 gain; ///< IR sensor signal's digital gain.
183  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
184  u8 reserved[0x7]; ///< Reserved.
185  u32 orig_format; ///< OrigFormat \ref IrsImageTransferProcessorFormat
186  u32 trimming_format; ///< TrimmingFormat \ref IrsImageTransferProcessorFormat
187  u16 trimming_start_x; ///< TrimmingStartX
188  u16 trimming_start_y; ///< TrimmingStartY
189  u8 is_external_light_filter_enabled; ///< IsExternalLightFilterEnabled
191 
192 /// PackedImageTransferProcessorConfig
193 typedef struct {
194  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
195  u8 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
196  u8 gain; ///< IR sensor signal's digital gain.
197  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
198  u8 reserved[0x5]; ///< Reserved.
199  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
200  u8 format; ///< \ref IrsImageTransferProcessorFormat
201  u8 reserved2[0x3]; ///< Reserved.
203 
204 /// PackedImageTransferProcessorExConfig
205 typedef struct {
206  u64 exposure_time; ///< IR Sensor exposure time in nanoseconds.
207  u8 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
208  u8 gain; ///< IR sensor signal's digital gain.
209  u8 is_negative_image_used; ///< Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
210  u8 reserved[0x5]; ///< Reserved.
211  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
212  u8 orig_format; ///< OrigFormat \ref IrsImageTransferProcessorFormat
213  u8 trimming_format; ///< TrimmingFormat \ref IrsImageTransferProcessorFormat
214  u16 trimming_start_x; ///< TrimmingStartX
215  u16 trimming_start_y; ///< TrimmingStartY
216  u8 is_external_light_filter_enabled; ///< IsExternalLightFilterEnabled
217  u8 reserved2[0x5]; ///< Reserved.
219 
220 /// ImageTransferProcessorState
221 typedef struct {
222  u64 sampling_number; ///< SamplingNumber
223  u32 ambient_noise_level; ///< AmbientNoiseLevel
224  u8 reserved[0x4]; ///< Reserved
226 
227 /// PackedPointingProcessorConfig
228 typedef struct {
229  IrsRect window_of_interest; ///< WindowOfInterest
230  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
232 
233 /// TeraPluginProcessorConfig
234 typedef struct {
235  u8 mode; ///< Mode
236  u8 unk_x1; ///< [6.0.0+] Unknown
237  u8 unk_x2; ///< [6.0.0+] Unknown
238  u8 unk_x3; ///< [6.0.0+] Unknown
240 
241 /// PackedTeraPluginProcessorConfig
242 typedef struct {
243  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
244  u8 mode; ///< Mode
245  u8 unk_x5; ///< [6.0.0+] This is set to 0x2 | (IrsTeraPluginProcessorConfig::unk_x1 << 7).
246  u8 unk_x6; ///< [6.0.0+] IrsTeraPluginProcessorConfig::unk_x2
247  u8 unk_x7; ///< [6.0.0+] IrsTeraPluginProcessorConfig::unk_x3
249 
250 /// IrLedProcessorConfig
251 typedef struct {
252  u32 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
254 
255 /// PackedIrLedProcessorConfig
256 typedef struct {
257  IrsPackedMcuVersion required_mcu_version; ///< RequiredMcuVersion
258  u8 light_target; ///< Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
259  u8 pad[0x3]; ///< Padding
261 
262 /// AdaptiveClusteringProcessorConfig
263 typedef struct {
264  u32 mode; ///< \ref IrsAdaptiveClusteringMode
265  u32 target_distance; ///< [6.0.0+] \ref IrsAdaptiveClusteringTargetDistance
267 
268 /// HandAnalysisConfig
269 typedef struct {
270  u32 mode; ///< \ref IrsHandAnalysisMode
272 
273 /// MomentStatistic
274 typedef struct {
275  float average_intensity; ///< AverageIntensity
276  float centroid_x; ///< CentroidX
277  float centroid_y; ///< CentroidY
279 
280 /// MomentProcessorState
281 typedef struct {
282  s64 sampling_number; ///< SamplingNumber
283  u64 timestamp; ///< TimeStamp
284 
285  u32 ambient_noise_level; ///< AmbientNoiseLevel
286  u8 reserved[0x4]; ///< Reserved
287  IrsMomentStatistic statistic[0x30]; ///< \ref IrsMomentStatistic
289 
290 /// ClusteringData
291 typedef struct {
292  float average_intensity; ///< AverageIntensity
293  float centroid_x; ///< CentroidX
294  float centroid_y; ///< CentroidY
295  u32 pixel_count; ///< PixelCount
296  u16 bound_x; ///< BoundX
297  u16 bound_y; ///< BoundY
298  u16 boundt_width; ///< BoundtWidth
299  u16 bound_height; ///< BoundHeight
301 
302 /// ClusteringProcessorState
303 typedef struct {
304  s64 sampling_number; ///< SamplingNumber
305  u64 timestamp; ///< TimeStamp
306 
307  u8 object_count; ///< ObjectCount
308  u8 reserved[0x3]; ///< Reserved
309  u32 ambient_noise_level; ///< AmbientNoiseLevel
310  IrsClusteringData data[0x10]; ///< \ref IrsClusteringData
312 
313 /// PointingProcessorMarkerState
314 typedef struct {
315  s64 sampling_number; ///< SamplingNumber
316  u64 timestamp; ///< TimeStamp
317 
318  struct {
319  u8 pointing_status; ///< PointingStatus
320  u8 reserved[0x3]; ///< Reserved
321  u8 unk_x4[0x4]; ///< Unknown
322  float unk_x8; ///< Unknown
323  float position_x; ///< PositionX
324  float position_y; ///< PositionY
325  float unk_x14; ///< Unknown
326  IrsRect window_of_interest; ///< WindowOfInterest
327  } data[3];
329 
330 /// PointingProcessorState
331 typedef struct {
332  s64 sampling_number; ///< SamplingNumber
333  u64 timestamp; ///< TimeStamp
334 
335  u32 pointing_status; ///< PointingStatus
336  float position_x; ///< PositionX
337  float position_y; ///< PositionY
338  u8 reserved[0x4]; ///< Reserved
340 
341 /// TeraPluginProcessorState
342 typedef struct {
343  s64 sampling_number; ///< SamplingNumber
344  u64 timestamp; ///< TimeStamp
345  u32 ambient_noise_level; ///< AmbientNoiseLevel
346  u8 plugin_data[0x12c]; ///< PluginData
348 
349 /// ProcessorState
350 typedef struct {
351  s64 start; ///< Start
352  u32 count; ///< Count
353  u32 pad; ///< Padding
354 
355  u8 data[0xe10]; ///< Contains an array of *ProcessorState, depending on IrsDeviceFormat::ir_sensor_mode.
357 
358 /// DeviceFormat
359 typedef struct {
360  u32 ir_camera_status; ///< \ref IrsIrCameraStatus
361  u32 ir_camera_internal_status; ///< \ref IrsIrCameraInternalStatus
362  u32 ir_sensor_mode; ///< \ref IrsIrSensorMode
363  u32 pad; ///< Padding
364 
365  IrsProcessorState processor_state; ///< \ref IrsProcessorState
367 
368 /// AruidFormat
369 typedef struct {
370  u64 ir_sensor_aruid; ///< IrSensorAruid
371  u32 ir_sensor_aruid_status; ///< IrSensorAruidStatus
372  u32 pad; ///< Padding
374 
375 /// StatusManager
376 typedef struct {
377  IrsDeviceFormat device_format[IRS_MAX_CAMERAS];
378  IrsAruidFormat aruid_format[0x5];
380 
381 /// Initialize irs.
383 
384 /// Exit irs.
385 void irsExit(void);
386 
387 /// Gets the Service object for the actual irs service session.
389 
390 /// Gets the address of the SharedMemory (\ref IrsStatusManager).
392 
393 /// Gets the \ref IrsIrCameraHandle for the specified controller.
395 
396 /// GetIrCameraStatus
398 
399 /// CheckFirmwareUpdateNecessity
400 /// When successful where the output flag is set, the user should use \ref hidLaShowControllerFirmwareUpdate.
401 /// Only available on [4.0.0+].
403 
404 /// GetImageProcessorStatus
405 /// Only available on [4.0.0+].
407 
408 /// Stop the current Processor.
409 /// \ref irsExit calls this with all IrCameraHandles which were not already used with \ref irsStopImageProcessor.
411 
412 /// Stop the current Processor, async.
413 /// Only available on [4.0.0+].
415 
416 /**
417  * @brief Run the MomentProcessor.
418  * @param[in] handle \ref IrsIrCameraHandle
419  * @param[in] config Input config.
420  */
422 
423 /**
424  * @brief Gets the states for MomentProcessor or IrLedProcessor.
425  * @note The official GetIrLedProcessorState is essentially the same as this, except it uses hard-coded count=1 with output-array on stack, without returning that data. Hence we don't implement a seperate func for that.
426  * @param[in] handle \ref IrsIrCameraHandle
427  * @param[out] states Output array of \ref IrsMomentProcessorState.
428  * @param[in] count Size of the states array in entries. Must be 1-5.
429  * @param[out] total_out Total output entries.
430  */
432 
433 /**
434  * @brief Calculates an \ref IrsMomentStatistic from the specified region in the input \ref IrsMomentProcessorState.
435  * @param[in] state \ref IrsMomentProcessorState
436  * @param[in] rect \ref IrsRect, containing the image width and height.
437  * @param[in] region_x Region x, must be 0-5 (clamped to this range otherwise). region_x = image_x/6.
438  * @param[in] region_y Region y, must be 0-7 (clamped to this range otherwise). region_y = image_y/8.
439  * @param[in] region_width Region width. region_x+region_width must be <=6 (clamped to this range otherwise).
440  * @param[in] region_height Region height. region_y+region_height must be <=8 (clamped to this range otherwise).
441  */
442 IrsMomentStatistic irsCalculateMomentRegionStatistic(const IrsMomentProcessorState *state, IrsRect rect, s32 region_x, s32 region_y, s32 region_width, s32 region_height);
443 
444 /**
445  * @brief Run the ClusteringProcessor.
446  * @param[in] handle \ref IrsIrCameraHandle
447  * @param[in] config Input config.
448  */
450 
451 /**
452  * @brief Gets the states for ClusteringProcessor.
453  * @param[in] handle \ref IrsIrCameraHandle
454  * @param[out] states Output array of \ref IrsClusteringProcessorState.
455  * @param[in] count Size of the states array in entries. Must be 1-5.
456  * @param[out] total_out Total output entries.
457  */
459 
460 /**
461  * @brief Run the ImageTransferProcessor.
462  * @param[in] handle \ref IrsIrCameraHandle
463  * @param[in] config Input config.
464  * @param[in] size Work-buffer size, must be 0x1000-byte aligned.
465  */
467 
468 /**
469  * @brief Run the ImageTransferExProcessor.
470  * @note Only available on [4.0.0+].
471  * @param[in] handle \ref IrsIrCameraHandle
472  * @param[in] config Input config.
473  * @param[in] size Work-buffer size, must be 0x1000-byte aligned.
474  */
476 
477 /// GetImageTransferProcessorState
479 
480 /**
481  * @brief Run the PointingProcessor.
482  * @param[in] handle \ref IrsIrCameraHandle
483  */
485 
486 /**
487  * @brief Gets the states for PointingProcessor.
488  * @param[in] handle \ref IrsIrCameraHandle
489  * @param[out] states Output array of \ref IrsPointingProcessorMarkerState.
490  * @param[in] count Size of the states array in entries. Must be 1-6.
491  * @param[out] total_out Total output entries.
492  */
494 
495 /**
496  * @brief Gets the states for \ref IrsPointingProcessorState.
497  * @note This uses \ref irsGetPointingProcessorMarkerStates, then converts the output to \ref IrsPointingProcessorState.
498  * @param[in] handle \ref IrsIrCameraHandle
499  * @param[out] states Output array of \ref IrsPointingProcessorState.
500  * @param[in] count Size of the states array in entries. Must be 1-6.
501  * @param[out] total_out Total output entries.
502  */
504 
505 /**
506  * @brief Run the TeraPluginProcessor.
507  * @param[in] handle \ref IrsIrCameraHandle
508  * @param[in] config Input config.
509  */
511 
512 /**
513  * @brief Gets the states for TeraPluginProcessor, filtered using the input params.
514  * @param[in] handle \ref IrsIrCameraHandle
515  * @param[out] states Output array of \ref IrsTeraPluginProcessorState.
516  * @param[in] count Size of the states array in entries. Must be 1-5.
517  * @param[in] sampling_number Minimum value for IrsTeraPluginProcessorState::sampling_number.
518  * @param[in] prefix_data Only used when prefix_bitcount is not 0. The first prefix_bitcount bits from prefix_data must match the first prefix_bitcount bits in IrsTeraPluginProcessorState::plugin_data.
519  * @param[in] prefix_bitcount Total bits for prefix_data.
520  * @param[out] total_out Total output entries.
521  */
522 Result irsGetTeraPluginProcessorStates(IrsIrCameraHandle handle, IrsTeraPluginProcessorState *states, s32 count, s64 sampling_number, u32 prefix_data, u32 prefix_bitcount, s32 *total_out);
523 
524 /**
525  * @brief Run the IrLedProcessor.
526  * @note Only available on [4.0.0+].
527  * @param[in] handle \ref IrsIrCameraHandle
528  * @param[in] config Input config.
529  */
531 
532 /**
533  * @brief Run the AdaptiveClusteringProcessor.
534  * @note Only available on [5.0.0+].
535  * @param[in] handle \ref IrsIrCameraHandle
536  * @param[in] config Input config.
537  */
539 
540 /**
541  * @brief Run HandAnalysis.
542  * @param[in] handle \ref IrsIrCameraHandle
543  * @param[in] config Input config.
544  */
546 
547 /**
548  * Gets the default configuration for MomentProcessor.
549  */
551 
552 /**
553  * Gets the default configuration for ClusteringProcessor.
554  */
556 
557 /**
558  * Gets the default configuration for ImageTransferProcessor.
559  * Defaults are exposure 300us, 8x digital gain, the rest is all-zero. Format is ::IrsImageTransferProcessorFormat_320x240.
560  */
562 
563 /**
564  * Gets the default configuration for ImageTransferProcessorEx.
565  * Defaults are exposure 300us, 8x digital gain, the rest is all-zero. OrigFormat/TrimmingFormat are ::IrsImageTransferProcessorFormat_320x240.
566  */
568 
569 /**
570  * Gets the default configuration for IrLedProcessor.
571  */
573  config->light_target = 0;
574 }
HidNpadIdType
HID controller IDs.
Definition: hid.h:214
Result irsGetIrCameraStatus(IrsIrCameraHandle handle, IrsIrCameraStatus *out)
GetIrCameraStatus.
Result irsGetImageTransferProcessorState(IrsIrCameraHandle handle, void *buffer, size_t size, IrsImageTransferProcessorState *state)
GetImageTransferProcessorState.
Result irsStopImageProcessor(IrsIrCameraHandle handle)
Stop the current Processor.
IrsImageTransferProcessorFormat
ImageTransferProcessorFormat. IR Sensor image resolution.
Definition: irs.h:53
@ IrsImageTransferProcessorFormat_40x30
[4.0.0+] 40x30
Definition: irs.h:57
@ IrsImageTransferProcessorFormat_80x60
80x60
Definition: irs.h:56
@ IrsImageTransferProcessorFormat_20x15
[4.0.0+] 20x15
Definition: irs.h:58
@ IrsImageTransferProcessorFormat_160x120
160x120
Definition: irs.h:55
@ IrsImageTransferProcessorFormat_320x240
320x240
Definition: irs.h:54
IrsAdaptiveClusteringTargetDistance
AdaptiveClusteringTargetDistance.
Definition: irs.h:68
@ IrsAdaptiveClusteringTargetDistance_Far
Far.
Definition: irs.h:71
@ IrsAdaptiveClusteringTargetDistance_Middle
Middle.
Definition: irs.h:70
@ IrsAdaptiveClusteringTargetDistance_Near
Near.
Definition: irs.h:69
void irsGetDefaultImageTransferProcessorExConfig(IrsImageTransferProcessorExConfig *config)
Gets the default configuration for ImageTransferProcessorEx.
Result irsGetIrCameraHandle(IrsIrCameraHandle *handle, HidNpadIdType id)
Gets the IrsIrCameraHandle for the specified controller.
Service * irsGetServiceSession(void)
Gets the Service object for the actual irs service session.
void irsExit(void)
Exit irs.
Result irsStopImageProcessorAsync(IrsIrCameraHandle handle)
Stop the current Processor, async.
Result irsRunTeraPluginProcessor(IrsIrCameraHandle handle, const IrsTeraPluginProcessorConfig *config)
Run the TeraPluginProcessor.
IrsIrCameraStatus
IrCameraStatus.
Definition: irs.h:16
@ IrsIrCameraStatus_Unsupported
Unsupported.
Definition: irs.h:18
@ IrsIrCameraStatus_Available
Available.
Definition: irs.h:17
@ IrsIrCameraStatus_Unconnected
Unconnected.
Definition: irs.h:19
IrsMomentStatistic irsCalculateMomentRegionStatistic(const IrsMomentProcessorState *state, IrsRect rect, s32 region_x, s32 region_y, s32 region_width, s32 region_height)
Calculates an IrsMomentStatistic from the specified region in the input IrsMomentProcessorState.
IrsHandAnalysisMode
HandAnalysisMode.
Definition: irs.h:75
@ IrsHandAnalysisMode_Image
Image.
Definition: irs.h:77
@ IrsHandAnalysisMode_SilhouetteAndImage
SilhouetteAndImage.
Definition: irs.h:78
@ IrsHandAnalysisMode_SilhouetteOnly
[4.0.0+] SilhouetteOnly
Definition: irs.h:79
@ IrsHandAnalysisMode_Silhouette
Silhouette.
Definition: irs.h:76
IrsImageProcessorStatus
ImageProcessorStatus.
Definition: irs.h:47
@ IrsImageProcessorStatus_Stopped
Stopped.
Definition: irs.h:48
@ IrsImageProcessorStatus_Running
Running.
Definition: irs.h:49
void * irsGetSharedmemAddr(void)
Gets the address of the SharedMemory (IrsStatusManager).
Result irsGetPointingProcessorStates(IrsIrCameraHandle handle, IrsPointingProcessorState *states, s32 count, s32 *total_out)
Gets the states for IrsPointingProcessorState.
void irsGetDefaultImageTransferProcessorConfig(IrsImageTransferProcessorConfig *config)
Gets the default configuration for ImageTransferProcessor.
Result irsRunImageTransferExProcessor(IrsIrCameraHandle handle, const IrsImageTransferProcessorExConfig *config, size_t size)
Run the ImageTransferExProcessor.
Result irsGetClusteringProcessorStates(IrsIrCameraHandle handle, IrsClusteringProcessorState *states, s32 count, s32 *total_out)
Gets the states for ClusteringProcessor.
Result irsGetImageProcessorStatus(IrsIrCameraHandle handle, IrsImageProcessorStatus *out)
GetImageProcessorStatus Only available on [4.0.0+].
Result irsRunAdaptiveClusteringProcessor(IrsIrCameraHandle handle, const IrsAdaptiveClusteringProcessorConfig *config)
Run the AdaptiveClusteringProcessor.
Result irsRunIrLedProcessor(IrsIrCameraHandle handle, const IrsIrLedProcessorConfig *config)
Run the IrLedProcessor.
IrsAdaptiveClusteringMode
AdaptiveClusteringMode.
Definition: irs.h:62
@ IrsAdaptiveClusteringMode_DynamicFov
DynamicFov.
Definition: irs.h:64
@ IrsAdaptiveClusteringMode_StaticFov
StaticFov.
Definition: irs.h:63
Result irsRunMomentProcessor(IrsIrCameraHandle handle, const IrsMomentProcessorConfig *config)
Run the MomentProcessor.
void irsGetMomentProcessorDefaultConfig(IrsMomentProcessorConfig *config)
Gets the default configuration for MomentProcessor.
Result irsCheckFirmwareUpdateNecessity(IrsIrCameraHandle handle, bool *out)
CheckFirmwareUpdateNecessity When successful where the output flag is set, the user should use hidLaS...
IrsIrSensorMode
IrSensorMode.
Definition: irs.h:36
@ IrsIrSensorMode_ClusteringProcessor
ClusteringProcessor.
Definition: irs.h:39
@ IrsIrSensorMode_PointingProcessor
PointingProcessor.
Definition: irs.h:41
@ IrsIrSensorMode_MomentProcessor
MomentProcessor.
Definition: irs.h:38
@ IrsIrSensorMode_IrLedProcessor
IrLedProcessor (doesn't apply to IrsDeviceFormat::ir_sensor_mode)
Definition: irs.h:43
@ IrsIrSensorMode_ImageTransferProcessor
ImageTransferProcessor.
Definition: irs.h:40
@ IrsIrSensorMode_None
None.
Definition: irs.h:37
@ IrsIrSensorMode_TeraPluginProcessor
TeraPluginProcessor.
Definition: irs.h:42
Result irsInitialize(void)
Initialize irs.
bool(* IrsValidationCb)(void *userdata, void *arg)
Internal validation callblack.
Definition: irs.h:83
Result irsRunPointingProcessor(IrsIrCameraHandle handle)
Run the PointingProcessor.
Result irsRunHandAnalysis(IrsIrCameraHandle handle, const IrsHandAnalysisConfig *config)
Run HandAnalysis.
static void irsGetIrLedProcessorDefaultConfig(IrsIrLedProcessorConfig *config)
Gets the default configuration for IrLedProcessor.
Definition: irs.h:572
Result irsGetMomentProcessorStates(IrsIrCameraHandle handle, IrsMomentProcessorState *states, s32 count, s32 *total_out)
Gets the states for MomentProcessor or IrLedProcessor.
IrsIrCameraInternalStatus
IrCameraInternalStatus.
Definition: irs.h:23
@ IrsIrCameraInternalStatus_Stopped
Stopped.
Definition: irs.h:24
@ IrsIrCameraInternalStatus_FirmwareVersionIsInvalid
FirmwareVersionIsInvalid.
Definition: irs.h:30
@ IrsIrCameraInternalStatus_Ready
[4.0.0+] Ready
Definition: irs.h:31
@ IrsIrCameraInternalStatus_FirmwareVersionRequested
FirmwareVersionRequested.
Definition: irs.h:29
@ IrsIrCameraInternalStatus_Unknown3
Unknown.
Definition: irs.h:27
@ IrsIrCameraInternalStatus_FirmwareUpdateNeeded
FirmwareUpdateNeeded.
Definition: irs.h:25
@ IrsIrCameraInternalStatus_Setting
[4.0.0+] Setting
Definition: irs.h:32
@ IrsIrCameraInternalStatus_Unknown4
Unknown.
Definition: irs.h:28
@ IrsIrCameraInternalStatus_Unknown2
Unknown.
Definition: irs.h:26
Result irsGetTeraPluginProcessorStates(IrsIrCameraHandle handle, IrsTeraPluginProcessorState *states, s32 count, s64 sampling_number, u32 prefix_data, u32 prefix_bitcount, s32 *total_out)
Gets the states for TeraPluginProcessor, filtered using the input params.
Result irsRunImageTransferProcessor(IrsIrCameraHandle handle, const IrsImageTransferProcessorConfig *config, size_t size)
Run the ImageTransferProcessor.
void irsGetClusteringProcessorDefaultConfig(IrsClusteringProcessorConfig *config)
Gets the default configuration for ClusteringProcessor.
Result irsRunClusteringProcessor(IrsIrCameraHandle handle, const IrsClusteringProcessorConfig *config)
Run the ClusteringProcessor.
Result irsGetPointingProcessorMarkerStates(IrsIrCameraHandle handle, IrsPointingProcessorMarkerState *states, s32 count, s32 *total_out)
Gets the states for PointingProcessor.
AdaptiveClusteringProcessorConfig.
Definition: irs.h:263
u32 mode
IrsAdaptiveClusteringMode
Definition: irs.h:264
u32 target_distance
[6.0.0+] IrsAdaptiveClusteringTargetDistance
Definition: irs.h:265
AruidFormat.
Definition: irs.h:369
u64 ir_sensor_aruid
IrSensorAruid.
Definition: irs.h:370
u32 pad
Padding.
Definition: irs.h:372
u32 ir_sensor_aruid_status
IrSensorAruidStatus.
Definition: irs.h:371
ClusteringData.
Definition: irs.h:291
u16 boundt_width
BoundtWidth.
Definition: irs.h:298
float average_intensity
AverageIntensity.
Definition: irs.h:292
float centroid_y
CentroidY.
Definition: irs.h:294
u16 bound_y
BoundY.
Definition: irs.h:297
u16 bound_x
BoundX.
Definition: irs.h:296
u32 pixel_count
PixelCount.
Definition: irs.h:295
u16 bound_height
BoundHeight.
Definition: irs.h:299
float centroid_x
CentroidX.
Definition: irs.h:293
ClusteringProcessorConfig.
Definition: irs.h:139
u8 is_external_light_filter_enabled
IsExternalLightFilterEnabled.
Definition: irs.h:149
u32 object_pixel_count_min
ObjectPixelCountMin.
Definition: irs.h:146
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:143
u32 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:141
u32 object_intensity_min
ObjectIntensityMin.
Definition: irs.h:148
u32 object_pixel_count_max
ObjectPixelCountMax.
Definition: irs.h:147
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:140
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:145
u32 gain
IR sensor signal's digital gain.
Definition: irs.h:142
ClusteringProcessorState.
Definition: irs.h:303
s64 sampling_number
SamplingNumber.
Definition: irs.h:304
u64 timestamp
TimeStamp.
Definition: irs.h:305
u32 ambient_noise_level
AmbientNoiseLevel.
Definition: irs.h:309
u8 object_count
ObjectCount.
Definition: irs.h:307
DeviceFormat.
Definition: irs.h:359
u32 pad
Padding.
Definition: irs.h:363
u32 ir_sensor_mode
IrsIrSensorMode
Definition: irs.h:362
u32 ir_camera_internal_status
IrsIrCameraInternalStatus
Definition: irs.h:361
u32 ir_camera_status
IrsIrCameraStatus
Definition: irs.h:360
IrsProcessorState processor_state
IrsProcessorState
Definition: irs.h:365
HandAnalysisConfig.
Definition: irs.h:269
u32 mode
IrsHandAnalysisMode
Definition: irs.h:270
ImageTransferProcessorConfig.
Definition: irs.h:169
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:170
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:173
u32 gain
IR sensor signal's digital gain.
Definition: irs.h:172
u32 format
IrsImageTransferProcessorFormat
Definition: irs.h:175
u32 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:171
ImageTransferProcessorExConfig.
Definition: irs.h:179
u16 trimming_start_x
TrimmingStartX.
Definition: irs.h:187
u16 trimming_start_y
TrimmingStartY.
Definition: irs.h:188
u8 is_external_light_filter_enabled
IsExternalLightFilterEnabled.
Definition: irs.h:189
u32 orig_format
OrigFormat IrsImageTransferProcessorFormat.
Definition: irs.h:185
u32 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:181
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:180
u32 trimming_format
TrimmingFormat IrsImageTransferProcessorFormat.
Definition: irs.h:186
u32 gain
IR sensor signal's digital gain.
Definition: irs.h:182
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:183
ImageTransferProcessorState.
Definition: irs.h:221
u32 ambient_noise_level
AmbientNoiseLevel.
Definition: irs.h:223
u64 sampling_number
SamplingNumber.
Definition: irs.h:222
IrCameraHandle.
Definition: irs.h:86
u8 player_number
PlayerNumber.
Definition: irs.h:87
u8 device_type
DeviceType.
Definition: irs.h:88
IrLedProcessorConfig.
Definition: irs.h:251
u32 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:252
IrsMomentProcessorConfig.
Definition: irs.h:113
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:119
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:117
u32 gain
IR sensor signal's digital gain.
Definition: irs.h:116
u32 preprocess
Preprocess.
Definition: irs.h:120
u32 preprocess_intensity_threshold
PreprocessIntensityThreshold.
Definition: irs.h:121
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:114
u32 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:115
MomentProcessorState.
Definition: irs.h:281
u32 ambient_noise_level
AmbientNoiseLevel.
Definition: irs.h:285
u64 timestamp
TimeStamp.
Definition: irs.h:283
s64 sampling_number
SamplingNumber.
Definition: irs.h:282
MomentStatistic.
Definition: irs.h:274
float centroid_y
CentroidY.
Definition: irs.h:277
float centroid_x
CentroidX.
Definition: irs.h:276
float average_intensity
AverageIntensity.
Definition: irs.h:275
PackedClusteringProcessorConfig.
Definition: irs.h:153
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:160
u32 object_pixel_count_min
ObjectPixelCountMin.
Definition: irs.h:161
u8 is_external_light_filter_enabled
IsExternalLightFilterEnabled.
Definition: irs.h:164
u32 object_pixel_count_max
ObjectPixelCountMax.
Definition: irs.h:162
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:154
u8 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:155
u8 gain
IR sensor signal's digital gain.
Definition: irs.h:156
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:157
u8 object_intensity_min
ObjectIntensityMin.
Definition: irs.h:163
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:159
PackedFunctionLevel.
Definition: irs.h:99
u8 ir_sensor_function_level
IrSensorFunctionLevel.
Definition: irs.h:100
PackedImageTransferProcessorConfig.
Definition: irs.h:193
u8 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:195
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:194
u8 gain
IR sensor signal's digital gain.
Definition: irs.h:196
u8 format
IrsImageTransferProcessorFormat
Definition: irs.h:200
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:199
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:197
PackedImageTransferProcessorExConfig.
Definition: irs.h:205
u8 gain
IR sensor signal's digital gain.
Definition: irs.h:208
u8 is_external_light_filter_enabled
IsExternalLightFilterEnabled.
Definition: irs.h:216
u16 trimming_start_x
TrimmingStartX.
Definition: irs.h:214
u8 orig_format
OrigFormat IrsImageTransferProcessorFormat.
Definition: irs.h:212
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:206
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:209
u8 trimming_format
TrimmingFormat IrsImageTransferProcessorFormat.
Definition: irs.h:213
u16 trimming_start_y
TrimmingStartY.
Definition: irs.h:215
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:211
u8 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:207
PackedIrLedProcessorConfig.
Definition: irs.h:256
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:257
u8 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:258
PackedMcuVersion.
Definition: irs.h:93
u16 major_version
MajorVersion.
Definition: irs.h:94
u16 minor_version
MinorVersion.
Definition: irs.h:95
PackedMomentProcessorConfig.
Definition: irs.h:125
u64 exposure_time
IR Sensor exposure time in nanoseconds.
Definition: irs.h:126
u8 preprocess
Preprocess.
Definition: irs.h:133
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:131
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:132
u8 preprocess_intensity_threshold
PreprocessIntensityThreshold.
Definition: irs.h:134
u8 light_target
Controls the IR leds. 0: All leds, 1: Bright group, 2: Dim group, 3: None.
Definition: irs.h:127
u8 gain
IR sensor signal's digital gain.
Definition: irs.h:128
u8 is_negative_image_used
Inverts the colors of the captured image. 0: Normal image, 1: Negative image.
Definition: irs.h:129
PackedPointingProcessorConfig.
Definition: irs.h:228
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:229
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:230
PackedTeraPluginProcessorConfig.
Definition: irs.h:242
u8 unk_x5
[6.0.0+] This is set to 0x2 | (IrsTeraPluginProcessorConfig::unk_x1 << 7).
Definition: irs.h:245
IrsPackedMcuVersion required_mcu_version
RequiredMcuVersion.
Definition: irs.h:243
u8 unk_x7
[6.0.0+] IrsTeraPluginProcessorConfig::unk_x3
Definition: irs.h:247
u8 mode
Mode.
Definition: irs.h:244
u8 unk_x6
[6.0.0+] IrsTeraPluginProcessorConfig::unk_x2
Definition: irs.h:246
PointingProcessorMarkerState.
Definition: irs.h:314
IrsRect window_of_interest
WindowOfInterest.
Definition: irs.h:326
float unk_x14
Unknown.
Definition: irs.h:325
s64 sampling_number
SamplingNumber.
Definition: irs.h:315
float position_x
PositionX.
Definition: irs.h:323
u8 pointing_status
PointingStatus.
Definition: irs.h:319
float position_y
PositionY.
Definition: irs.h:324
float unk_x8
Unknown.
Definition: irs.h:322
u64 timestamp
TimeStamp.
Definition: irs.h:316
PointingProcessorState.
Definition: irs.h:331
u64 timestamp
TimeStamp.
Definition: irs.h:333
float position_x
PositionX.
Definition: irs.h:336
float position_y
PositionY.
Definition: irs.h:337
s64 sampling_number
SamplingNumber.
Definition: irs.h:332
u32 pointing_status
PointingStatus.
Definition: irs.h:335
ProcessorState.
Definition: irs.h:350
s64 start
Start.
Definition: irs.h:351
u32 count
Count.
Definition: irs.h:352
u32 pad
Padding.
Definition: irs.h:353
Rect.
Definition: irs.h:105
s16 height
Height.
Definition: irs.h:109
s16 x
X.
Definition: irs.h:106
s16 y
Y.
Definition: irs.h:107
s16 width
Width.
Definition: irs.h:108
StatusManager.
Definition: irs.h:376
TeraPluginProcessorConfig.
Definition: irs.h:234
u8 unk_x1
[6.0.0+] Unknown
Definition: irs.h:236
u8 unk_x3
[6.0.0+] Unknown
Definition: irs.h:238
u8 mode
Mode.
Definition: irs.h:235
u8 unk_x2
[6.0.0+] Unknown
Definition: irs.h:237
TeraPluginProcessorState.
Definition: irs.h:342
s64 sampling_number
SamplingNumber.
Definition: irs.h:343
u64 timestamp
TimeStamp.
Definition: irs.h:344
u32 ambient_noise_level
AmbientNoiseLevel.
Definition: irs.h:345
Service object structure.
Definition: service.h:14
int64_t s64
64-bit signed integer.
Definition: types.h:28
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
int16_t s16
16-bit signed integer.
Definition: types.h:26
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
u32 Result
Function error code result type.
Definition: types.h:44
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition: types.h:92
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21