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

/*
 * This file defines pure C interface for ForceSeatMI. Check examples for details.
 */

#include "ForceSeatMI_Status.h"
#include "ForceSeatMI_Positioning.h"
#include "ForceSeatMI_Telemetry.h"
#include "ForceSeatMI_TelemetryACE.h"
#include "ForceSeatMI_TactileTransducers.h"
#include "ForceSeatMI_SFX.h"
#include "ForceSeatMI_Defines.h"
#include "ForceSeatMI_SeatBeltTensioner.h"

#if defined(__cplusplus) && ! defined(FSMI_CPP)
extern "C" {
#endif

	struct __FSMI_HandleType { int unused; };
	typedef struct __FSMI_HandleType* FSMI_Handle;

	/*
	 * It creates API object. It has to be called before any other functions are allowed.
	 * Remember to call ForceSeatMI_Delete to delete created object.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Handle FSMI_FATTR ForceSeatMI_Create(void);

	/*
	 * It deletes object created by ForceSeatMI_Create.
	 */
	FORCESEAT_MI_EXPORT
	void FSMI_FATTR ForceSeatMI_Delete(FSMI_Handle api);

	/*
	 * Call this function when the SIM is ready for sending data to the motion platform.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_BeginMotionControl(FSMI_Handle api);

	/*
	 * Call this function to when the SIM does not want to send any more data to the motion platform.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_EndMotionControl(FSMI_Handle api);

	/*
	 * Call this function to set required profile in ForceSeatPM application.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_ActivateProfile(FSMI_Handle api, const char* profileName);

	/*
	 * Call this function to set application ID.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SetAppID(FSMI_Handle api, const char* appId);

	/*
	 * Call this function to park the motion platform.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_Park(FSMI_Handle api, FSMI_UINT8 parkMode);

	/*
	 * It gets current status of the motion platform. This function can be called at any time.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_GetPlatformInfoEx(FSMI_Handle api,
	                                                   FSMI_PlatformInfo* platformInfo,
	                                                   FSMI_UINT32 platformInfoSize,
	                                                   FSMI_UINT32 timeout);

	/*
	 * Use this function if you want to specify position of the top table (top frame) in physical units (radians and milimeters).
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTablePosPhy(FSMI_Handle api,
	                                                    const FSMI_TopTablePositionPhysical* position);

	/*
	 * Use this function if you want to specify position of the top table (top frame) in physical units (radians and milimeters).
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 *
	 * NOTE: sfx, audioEffects and sbt (seat belt tensioner) are optional.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTablePosPhy3(FSMI_Handle api,
	                                                     const FSMI_TopTablePositionPhysical* position,
	                                                     const FSMI_SFX* sfx, 
	                                                     const FSMI_TactileAudioBasedFeedbackEffects* audioEffects,
	                                                     const FSMI_SbtData* sbt);

	/*
	 * Use this function if you want to specify transformation matrix for the top table (top frame). 
	 * It is recommended only for 6DoF in cases when rotation center is not in default point (0, 0, 0).
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTableMatrixPhy(FSMI_Handle api,
	                                                       const FSMI_TopTableMatrixPhysical* matrix);

	/*
	 * Use this function if you want to specify transformation matrix for the top table (top frame).
	 * It is recommended only for 6DoF in cases when rotation center is not in default point (0, 0, 0).
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 *
	 * NOTE: sfx, audioEffects and sbt (seat belt tensioner) are optional.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTableMatrixPhy3(FSMI_Handle api,
	                                                        const FSMI_TopTableMatrixPhysical* matrix,
	                                                        const FSMI_SFX* sfx,
	                                                        const FSMI_TactileAudioBasedFeedbackEffects* audioEffects,
	                                                        const FSMI_SbtData* sbt);

	/*
	 * It sends updated telemetry information to ForceSeatPM to ACE processor. 
	 * Make sure that 'state' field  is set correctly.
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTelemetryACE(FSMI_Handle api,
	                                                  const FSMI_TelemetryACE* telemetry);

	/*
	 * It sends updated telemetry information to ForceSeatPM to ACE processor. 
	 * Make sure that 'state' field  is set correctly.
	 * Make sure to call ForceSeatMI_BeginMotionControl before this function is called.
	 *
	 * NOTE: sfx, audioEffects and sbt (seat belt tensioner) are optional.
	 */
	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTelemetryACE3(FSMI_Handle api,
	                                                   const FSMI_TelemetryACE* telemetry,
	                                                   const FSMI_SFX* sfx, 
	                                                   const FSMI_TactileAudioBasedFeedbackEffects* audioEffects,
	                                                   const FSMI_SbtData* sbt);

	/*
	 * --------------------------------------------------------------------------------------------------------------
	 * NOTE: Below functions are provided for backward compatibility only and should not be used in new applications.
	 * --------------------------------------------------------------------------------------------------------------
	 */

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTelemetry(FSMI_Handle api,
	                                               const FSMI_Telemetry* telemetry);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTelemetry2(FSMI_Handle api,
	                                                const FSMI_Telemetry* telemetry,
	                                                const FSMI_SFX* sfx, 
	                                                const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTablePosLog(FSMI_Handle api,
	                                                    const FSMI_TopTablePositionLogical* position);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTablePosLog2(FSMI_Handle api,
	                                                     const FSMI_TopTablePositionLogical* position,
	                                                     const FSMI_SFX* sfx, 
	                                                     const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTelemetryACE2(FSMI_Handle api,
	                                                   const FSMI_TelemetryACE* telemetry,
	                                                   const FSMI_SFX* sfx, 
	                                                   const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTactileFeedbackEffects(FSMI_Handle api,
	                                                            const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTablePosPhy2(FSMI_Handle api,
	                                                     const FSMI_TopTablePositionPhysical* position,
	                                                     const FSMI_SFX* sfx, 
	                                                     const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

	FORCESEAT_MI_EXPORT
	FSMI_Bool FSMI_FATTR ForceSeatMI_SendTopTableMatrixPhy2(FSMI_Handle api,
	                                                        const FSMI_TopTableMatrixPhysical* matrix,
	                                                        const FSMI_SFX* sfx,
	                                                        const FSMI_TactileAudioBasedFeedbackEffects* audioEffects);

#if defined(__cplusplus) && ! defined(FSMI_CPP)
}
#endif

#endif
