/*
 * Copyright (C) 2012-2026 MotionSystems
 * 
 * This file is part of ForceSeatMI SDK.
 *
 * www.motionsystems.eu
 *
 */

#ifndef FORCE_SEAT_MI_SFX_H
#define FORCE_SEAT_MI_SFX_H

#include "ForceSeatMI_Common.h"

typedef enum FSMI_SFX_EffectType
{
	// Effect is appended to the required position before trajectory generator uses the position.
	// It means that this effect affects state of the adaptive algorithms which are used to adjust motion platform
	// operation parameters to the signal dynamics. This effect might be also less pronounced if trajectory generator
	// is configured to use long acceleration ramps.
	// It is supported only by "PS" and "QS" motion platforms.
	FSMI_SFX_EffectType_SinusLevel2 = 0,

	// Effect is appended to the output (position) of the trajectory generator. It is NOT affected by the
	// trajectory generator configuration and it does NOT affect the adaptive algorithms. Result of this effect
	// might be different depending on the actuator hardware configuration (length/pitch).
	// It is supported only by "QS" motion platforms.
	FSMI_SFX_EffectType_SinusLevel3 = 1
} FSMI_SFX_EffectType;

typedef enum FSMI_SFX_AreaFlags
{
	// Effect is generated on the actuator(s) assigned to the front-left area of the cockpit.
	FSMI_SFX_AreaFlags_FrontLeft  = 1 << 0,

	// Effect is generated on the actuator(s) assigned to the front-right area of the cockpit.
	FSMI_SFX_AreaFlags_FrontRight = 1 << 1,

	// Effect is generated on the actuator(s) assigned to the rear-left area of the cockpit.
	FSMI_SFX_AreaFlags_RearLeft   = 1 << 2,

	// Effect is generated on the actuator(s) assigned to the rear-right area of the cockpit.
	FSMI_SFX_AreaFlags_RearRight  = 1 << 3,

	// Effect is generated on auxiliary actuator, e.g. seat belt tensioner.
	FSMI_SFX_AreaFlags_Aux1       = 1 << 4,

	// Effect is generated on auxiliary actuator, e.g. seat belt tensioner.
	FSMI_SFX_AreaFlags_Aux2       = 1 << 5
} FSMI_SFX_AreaFlags;

#pragma pack(push, 1)
typedef struct FSMI_SFX_Effect
{
	// Effect type. It is one of FSMI_SFX_EffectType.
	FSMI_UINT8 type;

	// Area where the effect should be generated. It is combination of FSMI_SFX_AreaFlags.
	FSMI_UINT16 area;

	// Frequency (Hz) of the effect, from 0 to 255. Not all effects support all frequencies.
	// - SinusL2: 0 to 100
	// - SinusL3: 0 to 100
	// - SinusL4: 0 to 100
	FSMI_UINT8 frequency;

	// Amplitude of the effect, from -1 to 1. Not all effects support full amplitudes.
	// - SinusL2: -0.12 to 0.12
	// - SinusL3: -0.12 to 0.12
	// - SinusL4: -0.12 to 0.12
	FSMI_FLOAT amplitude;

	// For future use
	FSMI_UINT8 reserved[8];
} FSMI_PACKED FSMI_SFX_Effect;

/*
 * This structure defines special effects that are generated by the hardware and are independent to
 * the primary telemetry or positioning data stream. Not all devices support this feature.
 */
typedef struct FSMI_SFX
{
	// Put here sizeof(FSMI_SFX).
	// NOTE: This field is mandatory.
	FSMI_UINT8  structSize;

	// Number of the effects specified in the below filed. From 0 to FSMI_SFX_MaxEffectsCount.
	FSMI_UINT8  effectsCount;

	// Specification of the effects
	FSMI_SFX_Effect effects[FSMI_SFX_MaxEffectsCount];
} FSMI_PACKED FSMI_SFX;

#pragma pack(pop)

#endif
