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

using System;
using System.Runtime.InteropServices;

namespace MotionSystems
{
	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public struct FSMI_SbtChannelData
	{
		/// <summary>
		/// 0..1
		/// </summary>
		public float force;

		/// <summary>
		/// 0..1
		/// </summary>
		public float sfxAmplitude; 
		public byte  sfxFrequency;
	}

	[StructLayout(LayoutKind.Sequential, Pack = 1)]
	public struct FSMI_SbtData
	{
		/// <summary>
		/// put here sizeof(FSMI_SbtData).
		/// </summary>
		public byte structSize; 

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)FSMI_Defines.SBT_ChannelsCount)]
		public FSMI_SbtChannelData[] channels;

		/// <summary>
		/// Helper method to create a structure with preallocated space for nested structures
		/// </summary>
		public static FSMI_SbtData Prepare()
		{
			var tmp        = new FSMI_SbtData();
			tmp.structSize = (byte)Marshal.SizeOf(tmp);
			tmp.channels   = new FSMI_SbtChannelData[(int)FSMI_Defines.SBT_ChannelsCount];
			return tmp;
		}
	}
}
