libnx  v4.8.0
Data Structures | Macros | Typedefs | Enumerations | Functions
irs.h File Reference

HID IR sensor (irs) service IPC wrapper. More...

#include "../types.h"
#include "../sf/service.h"
#include "../services/hid.h"

Go to the source code of this file.

Data Structures

struct  IrsIrCameraHandle
 IrCameraHandle. More...
 
struct  IrsPackedMcuVersion
 PackedMcuVersion. More...
 
struct  IrsPackedFunctionLevel
 PackedFunctionLevel. More...
 
struct  IrsRect
 Rect. More...
 
struct  IrsMomentProcessorConfig
 IrsMomentProcessorConfig. More...
 
struct  IrsPackedMomentProcessorConfig
 PackedMomentProcessorConfig. More...
 
struct  IrsClusteringProcessorConfig
 ClusteringProcessorConfig. More...
 
struct  IrsPackedClusteringProcessorConfig
 PackedClusteringProcessorConfig. More...
 
struct  IrsImageTransferProcessorConfig
 ImageTransferProcessorConfig. More...
 
struct  IrsImageTransferProcessorExConfig
 ImageTransferProcessorExConfig. More...
 
struct  IrsPackedImageTransferProcessorConfig
 PackedImageTransferProcessorConfig. More...
 
struct  IrsPackedImageTransferProcessorExConfig
 PackedImageTransferProcessorExConfig. More...
 
struct  IrsImageTransferProcessorState
 ImageTransferProcessorState. More...
 
struct  IrsPackedPointingProcessorConfig
 PackedPointingProcessorConfig. More...
 
struct  IrsTeraPluginProcessorConfig
 TeraPluginProcessorConfig. More...
 
struct  IrsPackedTeraPluginProcessorConfig
 PackedTeraPluginProcessorConfig. More...
 
struct  IrsIrLedProcessorConfig
 IrLedProcessorConfig. More...
 
struct  IrsPackedIrLedProcessorConfig
 PackedIrLedProcessorConfig. More...
 
struct  IrsAdaptiveClusteringProcessorConfig
 AdaptiveClusteringProcessorConfig. More...
 
struct  IrsHandAnalysisConfig
 HandAnalysisConfig. More...
 
struct  IrsMomentStatistic
 MomentStatistic. More...
 
struct  IrsMomentProcessorState
 MomentProcessorState. More...
 
struct  IrsClusteringData
 ClusteringData. More...
 
struct  IrsClusteringProcessorState
 ClusteringProcessorState. More...
 
struct  IrsPointingProcessorMarkerState
 PointingProcessorMarkerState. More...
 
struct  IrsPointingProcessorState
 PointingProcessorState. More...
 
struct  IrsTeraPluginProcessorState
 TeraPluginProcessorState. More...
 
struct  IrsProcessorState
 ProcessorState. More...
 
struct  IrsDeviceFormat
 DeviceFormat. More...
 
struct  IrsAruidFormat
 AruidFormat. More...
 
struct  IrsStatusManager
 StatusManager. More...
 

Macros

#define IRS_MAX_CAMERAS   0x9
 

Typedefs

typedef bool(* IrsValidationCb) (void *userdata, void *arg)
 Internal validation callblack.
 

Enumerations

enum  IrsIrCameraStatus {
  IrsIrCameraStatus_Available = 0 ,
  IrsIrCameraStatus_Unsupported = 1 ,
  IrsIrCameraStatus_Unconnected = 2
}
 IrCameraStatus. More...
 
enum  IrsIrCameraInternalStatus {
  IrsIrCameraInternalStatus_Stopped = 0 ,
  IrsIrCameraInternalStatus_FirmwareUpdateNeeded = 1 ,
  IrsIrCameraInternalStatus_Unknown2 = 2 ,
  IrsIrCameraInternalStatus_Unknown3 = 3 ,
  IrsIrCameraInternalStatus_Unknown4 = 4 ,
  IrsIrCameraInternalStatus_FirmwareVersionRequested = 5 ,
  IrsIrCameraInternalStatus_FirmwareVersionIsInvalid = 6 ,
  IrsIrCameraInternalStatus_Ready = 7 ,
  IrsIrCameraInternalStatus_Setting = 8
}
 IrCameraInternalStatus. More...
 
enum  IrsIrSensorMode {
  IrsIrSensorMode_None = 0 ,
  IrsIrSensorMode_MomentProcessor = 1 ,
  IrsIrSensorMode_ClusteringProcessor = 2 ,
  IrsIrSensorMode_ImageTransferProcessor = 3 ,
  IrsIrSensorMode_PointingProcessor = 4 ,
  IrsIrSensorMode_TeraPluginProcessor = 5 ,
  IrsIrSensorMode_IrLedProcessor = 6
}
 IrSensorMode. More...
 
enum  IrsImageProcessorStatus {
  IrsImageProcessorStatus_Stopped = 0 ,
  IrsImageProcessorStatus_Running = 1
}
 ImageProcessorStatus. More...
 
enum  IrsImageTransferProcessorFormat {
  IrsImageTransferProcessorFormat_320x240 = 0 ,
  IrsImageTransferProcessorFormat_160x120 = 1 ,
  IrsImageTransferProcessorFormat_80x60 = 2 ,
  IrsImageTransferProcessorFormat_40x30 = 3 ,
  IrsImageTransferProcessorFormat_20x15 = 4
}
 ImageTransferProcessorFormat. IR Sensor image resolution. More...
 
enum  IrsAdaptiveClusteringMode {
  IrsAdaptiveClusteringMode_StaticFov = 0 ,
  IrsAdaptiveClusteringMode_DynamicFov = 1
}
 AdaptiveClusteringMode. More...
 
enum  IrsAdaptiveClusteringTargetDistance {
  IrsAdaptiveClusteringTargetDistance_Near = 0 ,
  IrsAdaptiveClusteringTargetDistance_Middle = 1 ,
  IrsAdaptiveClusteringTargetDistance_Far = 2
}
 AdaptiveClusteringTargetDistance. More...
 
enum  IrsHandAnalysisMode {
  IrsHandAnalysisMode_Silhouette = 1 ,
  IrsHandAnalysisMode_Image = 2 ,
  IrsHandAnalysisMode_SilhouetteAndImage = 3 ,
  IrsHandAnalysisMode_SilhouetteOnly = 4
}
 HandAnalysisMode. More...
 

Functions

Result irsInitialize (void)
 Initialize irs.
 
void irsExit (void)
 Exit irs.
 
ServiceirsGetServiceSession (void)
 Gets the Service object for the actual irs service session.
 
void * irsGetSharedmemAddr (void)
 Gets the address of the SharedMemory (IrsStatusManager).
 
Result irsGetIrCameraHandle (IrsIrCameraHandle *handle, HidNpadIdType id)
 Gets the IrsIrCameraHandle for the specified controller.
 
Result irsGetIrCameraStatus (IrsIrCameraHandle handle, IrsIrCameraStatus *out)
 GetIrCameraStatus.
 
Result irsCheckFirmwareUpdateNecessity (IrsIrCameraHandle handle, bool *out)
 CheckFirmwareUpdateNecessity When successful where the output flag is set, the user should use hidLaShowControllerFirmwareUpdate. More...
 
Result irsGetImageProcessorStatus (IrsIrCameraHandle handle, IrsImageProcessorStatus *out)
 GetImageProcessorStatus Only available on [4.0.0+].
 
Result irsStopImageProcessor (IrsIrCameraHandle handle)
 Stop the current Processor. More...
 
Result irsStopImageProcessorAsync (IrsIrCameraHandle handle)
 Stop the current Processor, async. More...
 
Result irsRunMomentProcessor (IrsIrCameraHandle handle, const IrsMomentProcessorConfig *config)
 Run the MomentProcessor. More...
 
Result irsGetMomentProcessorStates (IrsIrCameraHandle handle, IrsMomentProcessorState *states, s32 count, s32 *total_out)
 Gets the states for MomentProcessor or IrLedProcessor. More...
 
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. More...
 
Result irsRunClusteringProcessor (IrsIrCameraHandle handle, const IrsClusteringProcessorConfig *config)
 Run the ClusteringProcessor. More...
 
Result irsGetClusteringProcessorStates (IrsIrCameraHandle handle, IrsClusteringProcessorState *states, s32 count, s32 *total_out)
 Gets the states for ClusteringProcessor. More...
 
Result irsRunImageTransferProcessor (IrsIrCameraHandle handle, const IrsImageTransferProcessorConfig *config, size_t size)
 Run the ImageTransferProcessor. More...
 
Result irsRunImageTransferExProcessor (IrsIrCameraHandle handle, const IrsImageTransferProcessorExConfig *config, size_t size)
 Run the ImageTransferExProcessor. More...
 
Result irsGetImageTransferProcessorState (IrsIrCameraHandle handle, void *buffer, size_t size, IrsImageTransferProcessorState *state)
 GetImageTransferProcessorState.
 
Result irsRunPointingProcessor (IrsIrCameraHandle handle)
 Run the PointingProcessor. More...
 
Result irsGetPointingProcessorMarkerStates (IrsIrCameraHandle handle, IrsPointingProcessorMarkerState *states, s32 count, s32 *total_out)
 Gets the states for PointingProcessor. More...
 
Result irsGetPointingProcessorStates (IrsIrCameraHandle handle, IrsPointingProcessorState *states, s32 count, s32 *total_out)
 Gets the states for IrsPointingProcessorState. More...
 
Result irsRunTeraPluginProcessor (IrsIrCameraHandle handle, const IrsTeraPluginProcessorConfig *config)
 Run the TeraPluginProcessor. More...
 
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. More...
 
Result irsRunIrLedProcessor (IrsIrCameraHandle handle, const IrsIrLedProcessorConfig *config)
 Run the IrLedProcessor. More...
 
Result irsRunAdaptiveClusteringProcessor (IrsIrCameraHandle handle, const IrsAdaptiveClusteringProcessorConfig *config)
 Run the AdaptiveClusteringProcessor. More...
 
Result irsRunHandAnalysis (IrsIrCameraHandle handle, const IrsHandAnalysisConfig *config)
 Run HandAnalysis. More...
 
void irsGetMomentProcessorDefaultConfig (IrsMomentProcessorConfig *config)
 Gets the default configuration for MomentProcessor.
 
void irsGetClusteringProcessorDefaultConfig (IrsClusteringProcessorConfig *config)
 Gets the default configuration for ClusteringProcessor.
 
void irsGetDefaultImageTransferProcessorConfig (IrsImageTransferProcessorConfig *config)
 Gets the default configuration for ImageTransferProcessor. More...
 
void irsGetDefaultImageTransferProcessorExConfig (IrsImageTransferProcessorExConfig *config)
 Gets the default configuration for ImageTransferProcessorEx. More...
 
static void irsGetIrLedProcessorDefaultConfig (IrsIrLedProcessorConfig *config)
 Gets the default configuration for IrLedProcessor.
 

Detailed Description

HID IR sensor (irs) service IPC wrapper.

Author
yellows8

Enumeration Type Documentation

◆ IrsAdaptiveClusteringMode

AdaptiveClusteringMode.

Enumerator
IrsAdaptiveClusteringMode_StaticFov 

StaticFov.

IrsAdaptiveClusteringMode_DynamicFov 

DynamicFov.

◆ IrsAdaptiveClusteringTargetDistance

AdaptiveClusteringTargetDistance.

Enumerator
IrsAdaptiveClusteringTargetDistance_Near 

Near.

IrsAdaptiveClusteringTargetDistance_Middle 

Middle.

IrsAdaptiveClusteringTargetDistance_Far 

Far.

◆ IrsHandAnalysisMode

HandAnalysisMode.

Enumerator
IrsHandAnalysisMode_Silhouette 

Silhouette.

IrsHandAnalysisMode_Image 

Image.

IrsHandAnalysisMode_SilhouetteAndImage 

SilhouetteAndImage.

IrsHandAnalysisMode_SilhouetteOnly 

[4.0.0+] SilhouetteOnly

◆ IrsImageProcessorStatus

ImageProcessorStatus.

Enumerator
IrsImageProcessorStatus_Stopped 

Stopped.

IrsImageProcessorStatus_Running 

Running.

◆ IrsImageTransferProcessorFormat

ImageTransferProcessorFormat. IR Sensor image resolution.

Enumerator
IrsImageTransferProcessorFormat_320x240 

320x240

IrsImageTransferProcessorFormat_160x120 

160x120

IrsImageTransferProcessorFormat_80x60 

80x60

IrsImageTransferProcessorFormat_40x30 

[4.0.0+] 40x30

IrsImageTransferProcessorFormat_20x15 

[4.0.0+] 20x15

◆ IrsIrCameraInternalStatus

IrCameraInternalStatus.

Enumerator
IrsIrCameraInternalStatus_Stopped 

Stopped.

IrsIrCameraInternalStatus_FirmwareUpdateNeeded 

FirmwareUpdateNeeded.

IrsIrCameraInternalStatus_Unknown2 

Unknown.

IrsIrCameraInternalStatus_Unknown3 

Unknown.

IrsIrCameraInternalStatus_Unknown4 

Unknown.

IrsIrCameraInternalStatus_FirmwareVersionRequested 

FirmwareVersionRequested.

IrsIrCameraInternalStatus_FirmwareVersionIsInvalid 

FirmwareVersionIsInvalid.

IrsIrCameraInternalStatus_Ready 

[4.0.0+] Ready

IrsIrCameraInternalStatus_Setting 

[4.0.0+] Setting

◆ IrsIrCameraStatus

IrCameraStatus.

Enumerator
IrsIrCameraStatus_Available 

Available.

IrsIrCameraStatus_Unsupported 

Unsupported.

IrsIrCameraStatus_Unconnected 

Unconnected.

◆ IrsIrSensorMode

IrSensorMode.

Enumerator
IrsIrSensorMode_None 

None.

IrsIrSensorMode_MomentProcessor 

MomentProcessor.

IrsIrSensorMode_ClusteringProcessor 

ClusteringProcessor.

IrsIrSensorMode_ImageTransferProcessor 

ImageTransferProcessor.

IrsIrSensorMode_PointingProcessor 

PointingProcessor.

IrsIrSensorMode_TeraPluginProcessor 

TeraPluginProcessor.

IrsIrSensorMode_IrLedProcessor 

IrLedProcessor (doesn't apply to IrsDeviceFormat::ir_sensor_mode)

Function Documentation

◆ irsCalculateMomentRegionStatistic()

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.

Parameters
[in]stateIrsMomentProcessorState
[in]rectIrsRect, containing the image width and height.
[in]region_xRegion x, must be 0-5 (clamped to this range otherwise). region_x = image_x/6.
[in]region_yRegion y, must be 0-7 (clamped to this range otherwise). region_y = image_y/8.
[in]region_widthRegion width. region_x+region_width must be <=6 (clamped to this range otherwise).
[in]region_heightRegion height. region_y+region_height must be <=8 (clamped to this range otherwise).

◆ irsCheckFirmwareUpdateNecessity()

Result irsCheckFirmwareUpdateNecessity ( IrsIrCameraHandle  handle,
bool *  out 
)

CheckFirmwareUpdateNecessity When successful where the output flag is set, the user should use hidLaShowControllerFirmwareUpdate.

Only available on [4.0.0+].

◆ irsGetClusteringProcessorStates()

Result irsGetClusteringProcessorStates ( IrsIrCameraHandle  handle,
IrsClusteringProcessorState states,
s32  count,
s32 total_out 
)

Gets the states for ClusteringProcessor.

Parameters
[in]handleIrsIrCameraHandle
[out]statesOutput array of IrsClusteringProcessorState.
[in]countSize of the states array in entries. Must be 1-5.
[out]total_outTotal output entries.

◆ irsGetDefaultImageTransferProcessorConfig()

void irsGetDefaultImageTransferProcessorConfig ( IrsImageTransferProcessorConfig config)

Gets the default configuration for ImageTransferProcessor.

Defaults are exposure 300us, 8x digital gain, the rest is all-zero. Format is IrsImageTransferProcessorFormat_320x240.

◆ irsGetDefaultImageTransferProcessorExConfig()

void irsGetDefaultImageTransferProcessorExConfig ( IrsImageTransferProcessorExConfig config)

Gets the default configuration for ImageTransferProcessorEx.

Defaults are exposure 300us, 8x digital gain, the rest is all-zero. OrigFormat/TrimmingFormat are IrsImageTransferProcessorFormat_320x240.

◆ irsGetMomentProcessorStates()

Result irsGetMomentProcessorStates ( IrsIrCameraHandle  handle,
IrsMomentProcessorState states,
s32  count,
s32 total_out 
)

Gets the states for MomentProcessor or IrLedProcessor.

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.
Parameters
[in]handleIrsIrCameraHandle
[out]statesOutput array of IrsMomentProcessorState.
[in]countSize of the states array in entries. Must be 1-5.
[out]total_outTotal output entries.

◆ irsGetPointingProcessorMarkerStates()

Result irsGetPointingProcessorMarkerStates ( IrsIrCameraHandle  handle,
IrsPointingProcessorMarkerState states,
s32  count,
s32 total_out 
)

Gets the states for PointingProcessor.

Parameters
[in]handleIrsIrCameraHandle
[out]statesOutput array of IrsPointingProcessorMarkerState.
[in]countSize of the states array in entries. Must be 1-6.
[out]total_outTotal output entries.

◆ irsGetPointingProcessorStates()

Result irsGetPointingProcessorStates ( IrsIrCameraHandle  handle,
IrsPointingProcessorState states,
s32  count,
s32 total_out 
)

Gets the states for IrsPointingProcessorState.

Note
This uses irsGetPointingProcessorMarkerStates, then converts the output to IrsPointingProcessorState.
Parameters
[in]handleIrsIrCameraHandle
[out]statesOutput array of IrsPointingProcessorState.
[in]countSize of the states array in entries. Must be 1-6.
[out]total_outTotal output entries.

◆ irsGetTeraPluginProcessorStates()

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.

Parameters
[in]handleIrsIrCameraHandle
[out]statesOutput array of IrsTeraPluginProcessorState.
[in]countSize of the states array in entries. Must be 1-5.
[in]sampling_numberMinimum value for IrsTeraPluginProcessorState::sampling_number.
[in]prefix_dataOnly 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.
[in]prefix_bitcountTotal bits for prefix_data.
[out]total_outTotal output entries.

◆ irsRunAdaptiveClusteringProcessor()

Result irsRunAdaptiveClusteringProcessor ( IrsIrCameraHandle  handle,
const IrsAdaptiveClusteringProcessorConfig config 
)

Run the AdaptiveClusteringProcessor.

Note
Only available on [5.0.0+].
Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsRunClusteringProcessor()

Result irsRunClusteringProcessor ( IrsIrCameraHandle  handle,
const IrsClusteringProcessorConfig config 
)

Run the ClusteringProcessor.

Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsRunHandAnalysis()

Result irsRunHandAnalysis ( IrsIrCameraHandle  handle,
const IrsHandAnalysisConfig config 
)

Run HandAnalysis.

Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsRunImageTransferExProcessor()

Result irsRunImageTransferExProcessor ( IrsIrCameraHandle  handle,
const IrsImageTransferProcessorExConfig config,
size_t  size 
)

Run the ImageTransferExProcessor.

Note
Only available on [4.0.0+].
Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.
[in]sizeWork-buffer size, must be 0x1000-byte aligned.

◆ irsRunImageTransferProcessor()

Result irsRunImageTransferProcessor ( IrsIrCameraHandle  handle,
const IrsImageTransferProcessorConfig config,
size_t  size 
)

Run the ImageTransferProcessor.

Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.
[in]sizeWork-buffer size, must be 0x1000-byte aligned.

◆ irsRunIrLedProcessor()

Result irsRunIrLedProcessor ( IrsIrCameraHandle  handle,
const IrsIrLedProcessorConfig config 
)

Run the IrLedProcessor.

Note
Only available on [4.0.0+].
Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsRunMomentProcessor()

Result irsRunMomentProcessor ( IrsIrCameraHandle  handle,
const IrsMomentProcessorConfig config 
)

Run the MomentProcessor.

Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsRunPointingProcessor()

Result irsRunPointingProcessor ( IrsIrCameraHandle  handle)

Run the PointingProcessor.

Parameters
[in]handleIrsIrCameraHandle

◆ irsRunTeraPluginProcessor()

Result irsRunTeraPluginProcessor ( IrsIrCameraHandle  handle,
const IrsTeraPluginProcessorConfig config 
)

Run the TeraPluginProcessor.

Parameters
[in]handleIrsIrCameraHandle
[in]configInput config.

◆ irsStopImageProcessor()

Result irsStopImageProcessor ( IrsIrCameraHandle  handle)

Stop the current Processor.

irsExit calls this with all IrCameraHandles which were not already used with irsStopImageProcessor.

◆ irsStopImageProcessorAsync()

Result irsStopImageProcessorAsync ( IrsIrCameraHandle  handle)

Stop the current Processor, async.

Only available on [4.0.0+].