//This file was generated by the LASAL2 CodeGenerator  -- 
//Please, do not edit this file (it might be overwritten by the next generator run)
//{{LSL_DECLARATION

(*!
<Class
	Name               = "VaranManager_1"
	Revision           = "2.8"
	GUID               = "{9A3C5E5A-54D9-4CA5-A40F-EDA41B52FEAD}"
	RealtimeTask       = "false"
	CyclicTask         = "false"
	BackgroundTask     = "false"
	Sigmatek           = "true"
	OSInterface        = "false"
	HighPriority       = "false"
	Automatic          = "false"
	UpdateMode         = "Prescan"
	IconPath           = ".\Class\VaranManager_1\VaranManager.ico"
	SharedCommandTable = "true"
	Objectsize         = "(628,120)"
	Comment            = "class to handle a VaranManager component with 1 VARAN Out port">
	<Channels>
		<Server Name="VaranOut_1" GUID="{0BE4D2F2-F359-40DE-B933-9F51683D8A0B}" Class="Hub_Base" Visualized="true" Initialize="false" WriteProtected="true" Retentive="false" Comment="connect a varan client class"/>
		<Client Name="Hub_Base_Root0" Required="true" Internal="true"/>
	</Channels>
	<RevDoku>
		<Owner Company="Sigmatek"/>
		<Dokumentation Revision="2.8" Date="16.12.2024" Author="LanSte" Company="Sigmatek" Description="Added support for Get Required Wait Time"/>
		<Dokumentation Revision="2.7" Date="16.06.2023" Author="EisMic" Company="Sigmatek" Description="Added functionality to allow modules to give time to the OS during the post init phase (e.g. for safety SDO handling)."/>
		<Dokumentation Revision="2.6" Date="18.04.2023" Author="EisMic" Company="Sigmatek" Description="Fixed an access exception when more than 1 Flexhub object were used on CPUs with no VaranInterface available."/>
		<Dokumentation Revision="2.5" Date="15.06.2022" Author="RamAnd" Company="Sigmatek" Description="Added an interface for the VARAN Client classes to get their hardware version."/>
		<Dokumentation Revision="2.4" Date="09.12.2019" Author="LanSte" Company="Sigmatek" Description="Added Server ManagerProtocolVersion. InterframeGap is included in the resource calculation.&#13;&#10;Added Client InterframeGap."/>
		<Dokumentation Revision="2.3" Date="16.09.2019" Author="LazJos" Company="Sigmatek" Description="Added support for HWAlarms."/>
		<Dokumentation Revision="2.2" Date="28.01.2019" Author="EisMic" Company="Sigmatek" Description="Added functionality to give the OS the information which VaranManager runs on which processor core"/>
		<Dokumentation Revision="2.1" Date="29.05.2018" Author="EisMic" Company="Sigmatek" Description="Fixed an error that the VaranManager did not work on CPUs with a maintimer with 2ms or higher."/>
		<Dokumentation Revision="2.0" Date="26.03.2018" Author="EisMic" Company="Sigmatek" Description="Added support for 2nd VaranManager.&#13;&#10;Corrected an error that the CyWork is executed if ManagerOn &lt;&gt; 1.&#13;&#10;Removed VARANMANAGER_PROFILER define from source code.&#13;&#10;Removed client IRQTaskTime."/>
		<Dokumentation Revision="1.66" Date="07.03.2018" Author="EisMic" Company="Sigmatek" Description="Cywork will no longer be called if there are no VaranClient objects connected to the manager.&#13;&#10;The hardware will now be turned off in the method SetVaranDOError.&#13;&#10;Attached header files no longer point to the installation directory of LASAL but instead now point to the the source/interfaces folder.&#13;&#10;Fixed an error that when starting a project the time for the hardware on the Varan, i. e. after IsoStartPoint is too short, the status is not TimeSliceError but TimeSliceErrorIRQ."/>
		<Dokumentation Revision="1.65" Date="18.01.2018" Author="EisMic" Company="Sigmatek" Description="Corrected an error that all connected clients were called at the end of the post init phase, instead of just the ones which should be called."/>
		<Dokumentation Revision="1.64" Date="23.01.2018" Author="RamAnd" Company="Sigmatek" Description="Log messages have been standardized for easier maintenance, easier use in any class and to allow spam filtering. Code for the logging functions is now only located in HwControl."/>
		<Dokumentation Revision="1.63" Date="29.08.2017" Author="RamAnd" Company="Sigmatek" Description="The VaranManager can now tell the HwControl if it doesn&apos;t have any clients connected. In this case the HwControl is in charge of triggering the internal watchdog."/>
		<Dokumentation Revision="1.62" Date="11.04.2017" Author="RamAnd" Company="Sigmatek" Description="Required error at missing modules is now also provided with payload option active."/>
		<Dokumentation Revision="1.61" Date="31.03.2017" Author="EisMic" Company="Sigmatek" Description="Corrected error that required data objects were not started sometimes if payload was used.&#13;&#10;Corrected error with VaranMux if payload was used."/>
		<Dokumentation Revision="1.60" Date="14.02.2017" Author="ZoePat" Company="Sigmatek" Description="SdiasModules can now request to increase the PostInit timeout."/>
		<Dokumentation Revision="1.59" Date="07.12.2016" Author="ZoePat" Company="Sigmatek" Description="VaranManager is now disabled if there are no VaranClient objects connected. Can be enabled again by setting bEnableManagerWithNoModules=TRUE in first init run."/>
		<Dokumentation Revision="1.58" Date="10.02.2016" Author="EisMic" Company="Sigmatek" Description="CAN behind VARAN works now on Edge2 CPUs."/>
		<Dokumentation Revision="1.57" Date="11.11.2015" Author="ZoePat" Company="Sigmatek" Description="Check for unallowed safety topology."/>
		<Dokumentation Revision="1.56" Date="29.06.2015" Author="EisMic" Company="Sigmatek" Description="- Prevented access exception if a varanmanagertime greater 32ms was set at the client.&#13;&#10;- CyWork, RtWork, UpdateRTPostScan: Free Mutex if there are returns in the methods.&#13;&#10;- Electronic Typelabel: Supported more information at varanmanager module (eg. Vendorname, DeviceName, SerialNo, LicenseNo, OrderingNo,...)"/>
		<Dokumentation Revision="1.55" Date="21.05.2015" Author="EisMic" Company="Sigmatek" Description="Corrected handling of SyncFrameCounter in RtWork which could lead to a problem at isochrone CAN behind varan (e.g. CIV 521)."/>
		<Dokumentation Revision="1.54" Date="12.05.2015" Author="EisMic" Company="Sigmatek" Description="Added support for calculating resources for graphical hardware editor."/>
		<Dokumentation Revision="1.53" Date="15.04.2015" Author="RamAnd" Company="Sigmatek" Description="Added another step in initialisation to prevent watchdog error."/>
		<Dokumentation Revision="1.52" Date="15.04.2015" Author="RamAnd" Company="Sigmatek" Description="Added support for VaranMux."/>
		<Dokumentation Revision="1.51" Date="23.03.2015" Author="RamAnd" Company="Sigmatek" Description="Prevent crash if the user calls public methods and the VARAN interface is not available (e.g. on LARS)"/>
		<Dokumentation Revision="1.50" Date="24.01.2015" Author="RamAnd" Company="Sigmatek" Description="If a post init object is finished (completed or error) than it&apos;s still called during the post init phase to allow triggering of watchdogs.&#13;&#10;Furthermore this module is removed from the list of modules to wait for (creating DOs and Move-DOs)."/>
		<Dokumentation Revision="1.49" Date="25.11.2014" Author="LanSte" Company="Sigmatek" Description="Corrected IsoVaranTime calcualtion with MultivaranInterface.&#13;&#10;Corrected Trace Message when an unknown NewInst command was recieved."/>
		<Dokumentation Revision="1.48" Date="11.08.2014" Author="EisMic" Company="Sigmatek" Description="Deactivated Varan Error when running a programm in LARS."/>
		<Dokumentation Revision="1.47" Date="01.08.2014" Author="RamAnd" Company="Sigmatek" Description="Asynchron VARAN DOs may not have been started on ARM CPUs, because the image of the DOs wasn&apos;t copied correctly to the VM DPRAM."/>
		<Dokumentation Revision="1.46" Date="30.07.2014" Author="RamAnd" Company="Sigmatek" Description="Added flag for every post init object, so it is only called if it hasn&apos;t finished post init work yet."/>
		<Dokumentation Revision="1.45" Date="11.07.2014" Author="LanSte" Company="Sigmatek" Description="Added support for reading hardware diagnosis."/>
		<Dokumentation Revision="1.44" Date="19.05.2014" Author="LanSte" Company="Sigmatek" Description="Added support for INTERFACE_MULTIVARANMANAGER dol timing Methods. Removed PayloadMEM clients as they are not supported."/>
		<Dokumentation Revision="1.43" Date="15.04.2014" Author="RamAnd" Company="Sigmatek" Description="Changed initialisation:&#13;&#10; - Asynchron work is now independent of isochronous initialisation state machine&#13;&#10; - Removed thread for sorting DOs. This is now done in a seperate init step called by the HwControl"/>
		<Dokumentation Revision="1.42" Date="26.03.2014" Author="ZoePat" Company="Sigmatek" Description="Overwritten Servers deleted, because there is no need to change anything. Min_RtTime, Max_RtTime, Min_RtCallTime and Max_RtCallTime are now &quot;WriteProtected=false&quot;."/>
		<Dokumentation Revision="1.41" Date="11.03.2014" Author="EisMic" Company="Sigmatek" Description="Added Server IsoVaranTimeMax."/>
		<Dokumentation Revision="1.40" Date="12.02.2014" Author="RamAnd&#13;&#10;PieSte&#13;&#10;ZoePat" Company="Sigmatek" Description="Thread for sorting DOs is now created in init to prevent errors in task handling on Salamander systems.&#13;&#10;Changed min/max value for IsoStartPoint in base to get more flexibilty.&#13;&#10;Corrected AccessException if no VaranInterface is avaliable."/>
		<Dokumentation Revision="1.31" Date="04.02.2014" Author="ZoePat" Company="Sigmatek" Description="Corrected AccessException if no VaranInterface is avaliable."/>
		<Dokumentation Revision="1.30" Date="22.01.2014" Author="RamAnd&#13;&#10;&#13;&#10;PieSte" Company="Sigmatek" Description="Initialisation of VaranManager and SdiasManager has been reworked for cases where multiple Safety cpus are connected via VI021.&#13;&#10;Fixed free FileDate before use in Base VaranManager."/>
		<Dokumentation Revision="1.20" Date="04.12.2013" Author="LanSte&#13;&#10;RamAnd&#13;&#10;FucHer" Company="Sigmatek" Description="Added NewInst Method to allow force endeing PostInit on timeout.&#13;&#10;Fixed call to end VM own PostInit Phase.&#13;&#10;Added postinit call to prevent user classes being called before the Varanmanager has finished its config.&#13;&#10;Fixed case dureing startup where the ISO DOL was started twice in one cycle.&#13;&#10;The manager has added himself to the internal client list, which lead to writing 68 to the control server if a required error occured.&#13;&#10;Fixed crash if no VARAN interface was available, but objects of VARAN module classes were placed.&#13;&#10;Added payload support&#13;&#10;GetVaranPosition(): keyword AWL removed.  Mutex replaces CLI, STI."/>
		<Dokumentation Revision="1.10" Date="07.03.2013" Author="RamAnd" Company="Sigmatek" Description="Changed range of the safety NewInst commands. Range for HW-Classes: 0x8000-0x8FFF; Range for Safety HW-Classes: 0x8100-0x81FF"/>
		<Dokumentation Revision="1.4" Date="05.10.2011" Author="RamAnd" Company="Sigmatek" Description="The Client To_Multitask of the base class has been moved to the bottom, since it has no connection to the derivations."/>
		<Dokumentation Revision="1.3" Date="17.02.2011" Author="BleErn" Company="Sigmatek" Description="Content of corresponding LASAL Hardware Description file (.lhd) which is necessary for the hardware editor has been updated"/>
		<Dokumentation Revision="1.2" Date="15.10.2010" Author="RamAnd" Company="Sigmatek" Description="Added method AddMovDO for the move command in the VM."/>
		<Dokumentation Revision="1.1" Date="15.10.2010" Author="BleErn" Company="Sigmatek" Description="Added new method GetNsTimeBPLLTicks for easier internal time measurements.&#13;&#10;Added new methods AddDAClientRdData and SendDAClientWrData to access new direct access alternating buffer on VMC hardware.&#13;&#10;Function to display CDIAS/DIAS required error&#13;&#10;VaranManager crashed if the master was shut-down when the master was not started (eg. _NoVaranInterface on LARS)&#13;&#10;Read-Method of clients is now always called before using a value.&#13;&#10;Trace-Messages now only appear once&#13;&#10;Act_RtTime showed incorrect values if no hardware was connected&#13;&#10;Comment of Server ManagerOn was not complete&#13;&#10;Server SuperiorSystemOK now shows if VaranManagerClient functionality is not used&#13;&#10;Time-Measurement of VaranManager did not stop if Manager was set off but rest of system was still alive"/>
		<Dokumentation Revision="1.0" Date="13.07.2010" Author="BleErn" Company="Sigmatek" Description="Content of corresponding LASAL Hardware Description file (.lhd) which is necessary for the hardware editor has been corrected"/>
	</RevDoku>
	<Network Name="VaranManager_1">
		<!-- List of Components in this network -->
		<Components>
			<Object
				Name       = "_base"
				GUID       = "{B14264EC-37B0-4383-8218-E55E69FA2442}"
				Class      = "VaranManager"
				Position   = "(420,120)"
				Visualized = "true">
				<Channels>
					<Server Name="Act_RtCallTime"/>
					<Server Name="Act_RtTime"/>
					<Server Name="AsyVaranTime"/>
					<Server Name="Control"/>
					<Server Name="IsoVaranTime"/>
					<Server Name="IsoVaranTimeMax"/>
					<Server Name="ManagerOn"/>
					<Server Name="ManagerProtocolVersion"/>
					<Server Name="Max_RtCallTime"/>
					<Server Name="Max_RtTime"/>
					<Server Name="Min_RtCallTime"/>
					<Server Name="Min_RtTime"/>
					<Server Name="Release"/>
					<Server Name="RetryCounter"/>
					<Server Name="State"/>
					<Server Name="SuperiorSystemOK"/>
					<Client Name="CoreSelect" Value="0"/>
					<Client Name="InterframeGap"/>
					<Client Name="IsAlsoClient"/>
					<Client Name="IsoStartPoint"/>
					<Client Name="PayloadFrame"/>
					<Client Name="PreventManagerError"/>
					<Client Name="SafetyAsyMemRead"/>
					<Client Name="SafetyAsyMemWrite"/>
					<Client Name="SafetyIsoMemRead"/>
					<Client Name="SafetyIsoMemWrite"/>
					<Client Name="SuperiorSystemTime"/>
					<Client Name="To_HwControl"/>
					<Client Name="To_Multitask"/>
					<Client Name="VaranManagerNr" Value="0"/>
					<Client Name="VaranManagerTime" Value="1000000"/>
				</Channels>
			</Object>
			<Object
				Name       = "Hub_Base_Root0"
				GUID       = "{F934CCA3-05BF-4D92-9C62-69704186A95F}"
				Class      = "Hub_Base_Root"
				Position   = "(1470,1110)"
				Visualized = "true">
				<Channels>
					<Server Name="Control"/>
					<Client Name="Splitter_Place" Value="0"/>
					<Client Name="VaranConnect"/>
				</Channels>
			</Object>
		</Components>
		<Comments>
		</Comments>
		<!-- List of Connections in this network -->
		<Connections>
			<Connection Source="this.Control" Destination="_base.Control" Vertices="(1942,210),(1064,210),"/>
			<Connection Source="this.State" Destination="_base.State" Vertices="(1942,270),(1064,270),"/>
			<Connection Source="this.ManagerOn" Destination="_base.ManagerOn" Vertices="(1942,330),(1064,330),"/>
			<Connection Source="this.Release" Destination="_base.Release" Vertices="(1942,390),(1064,390),"/>
			<Connection Source="this.RetryCounter" Destination="_base.RetryCounter" Vertices="(1942,450),(1064,450),"/>
			<Connection Source="this.IsoVaranTime" Destination="_base.IsoVaranTime" Vertices="(1942,510),(1064,510),"/>
			<Connection Source="this.AsyVaranTime" Destination="_base.AsyVaranTime" Vertices="(1942,630),(1064,630),"/>
			<Connection Source="_base.To_HwControl" Destination="this.To_HwControl" Vertices="(420,210),(38,210),"/>
			<Connection Source="_base.VaranManagerTime" Destination="this.VaranManagerTime" Vertices="(420,270),(38,270),"/>
			<Connection Source="_base.VaranManagerNr" Destination="this.VaranManagerNr" Vertices="(420,330),(38,330),"/>
			<Connection Source="Hub_Base_Root0.VaranConnect" Destination="_base.Control" Vertices="(1470,1260),(1350,1260),(1350,210),(1064,210),"/>
			<Connection Source="this.VaranOut_1" Destination="Hub_Base_Root0.Control" Vertices="(1942,1170),(1800,1110),(1800,1110),(1770,1200),"/>
			<Connection Source="this.Act_RtTime" Destination="_base.Act_RtTime" Vertices="(1942,690),(1064,690),"/>
			<Connection Source="this.Min_RtTime" Destination="_base.Min_RtTime" Vertices="(1942,750),(1064,750),"/>
			<Connection Source="this.Max_RtTime" Destination="_base.Max_RtTime" Vertices="(1942,810),(1064,810),"/>
			<Connection Source="this.Act_RtCallTime" Destination="_base.Act_RtCallTime" Vertices="(1942,870),(1064,870),"/>
			<Connection Source="this.Min_RtCallTime" Destination="_base.Min_RtCallTime" Vertices="(1942,930),(1064,930),"/>
			<Connection Source="this.Max_RtCallTime" Destination="_base.Max_RtCallTime" Vertices="(1942,990),(1064,990),"/>
			<Connection Source="_base.IsoStartPoint" Destination="this.IsoStartPoint" Vertices="(420,450),(38,450),"/>
			<Connection Source="this.Hub_Base_Root0" Destination="Hub_Base_Root0.Control"/>
			<Connection Source="_base.PreventManagerError" Destination="this.PreventManagerError" Vertices="(420,390),(38,390),"/>
			<Connection Source="_base.IsAlsoClient" Destination="this.IsAlsoClient" Vertices="(420,510),(38,510),"/>
			<Connection Source="_base.SuperiorSystemTime" Destination="this.SuperiorSystemTime" Vertices="(420,570),(38,570),"/>
			<Connection Source="this.SuperiorSystemOK" Destination="_base.SuperiorSystemOK" Vertices="(1942,1050),(1064,1050),"/>
			<Connection Source="_base.PayloadFrame" Destination="this.PayloadFrame" Vertices="(420,930),(38,630),"/>
			<Connection Source="this.IsoVaranTimeMax" Destination="_base.IsoVaranTimeMax" Vertices="(1942,570),(1064,570),"/>
			<Connection Source="_base.CoreSelect" Destination="this.CoreSelect" Vertices="(420,990),(38,690),"/>
			<Connection Source="_base.InterframeGap" Destination="this.InterframeGap" Vertices="(420,1050),(38,750),"/>
			<Connection Source="this.ManagerProtocolVersion" Destination="_base.ManagerProtocolVersion" Vertices="(1942,1110),(1064,1110),"/>
		</Connections>
		<!-- Headerfiles -->
		<Options>
		</Options>
	</Network>
</Class>
*)
#pragma using VaranManager

VaranManager_1 : CLASS
: VaranManager
  //Servers:
	VaranOut_1 	: SvrChCmd_DINT;
  //Clients:
	Hub_Base_Root0 	: CltChCmd_Hub_Base_Root;
  //Variables:
  //Functions:
  //Tables:
	FUNCTION @STD
		VAR_OUTPUT
			ret_code	: CONFSTATES;
		END_VAR;
	FUNCTION GLOBAL TAB @CT_;
END_CLASS;

#pragma using Hub_Base_Root


//}}LSL_DECLARATION


FUNCTION GLOBAL TAB VaranManager_1::@CT_
0$UINT,
2#0100000000000000$UINT, //TY_VARANMANAGER_1
2$UINT, 8$UINT, (SIZEOF(::VaranManager_1))$UINT, 
1$UINT, 1$UINT, 0$UINT, 
TO_UDINT(1989862026), "VaranManager_1", //Class
TO_UDINT(2940693151), "VaranManager", 3$UINT, 8$UINT, //Baseclass
//Servers:
(::VaranManager_1.VaranOut_1.pMeth)$UINT, _CH_SVR_OBJ$UINT, 2#0000000000000000$UINT, TO_UDINT(2138873746), "VaranOut_1", 
//Clients:
(::VaranManager_1.Hub_Base_Root0.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000010$UINT, TO_UDINT(3781719598), "Hub_Base_Root0", TO_UDINT(1770276445), "Hub_Base_Root", 2$UINT, 11$UINT, 
END_FUNCTION


#define USER_CNT_VaranManager_1 35

TYPE
	_LSL_STD_VMETH	: STRUCT
			CmdTable	: CMDMETH;
			UserFcts	: ARRAY[0..USER_CNT_VaranManager_1] OF ^Void;
	END_STRUCT;
END_TYPE

FUNCTION VaranManager_1::@STD
	VAR_OUTPUT
		ret_code	: CONFSTATES;
	END_VAR
	VAR
		vmt	: _LSL_STD_VMETH;
		nCmdSize	: UINT;
	END_VAR

	ret_code	:= VaranManager::@STD();
	IF ret_code <> C_OK THEN
		RETURN;
	END_IF;
	nCmdSize		:= VaranManager_Base::Control.pMeth^.nCmds$UINT*SIZEOF(pVoid) + CMDMETH.Init;

	_memcpy((#vmt.CmdTable)$^USINT, VaranManager_Base::Control.pMeth, nCmdSize);
	vmt.CmdTable.nCmds		:= nSTDCMD + USER_CNT_VaranManager_1;
	VaranManager_Base::Control.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

	IF VaranManager_Base::Control.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	_memcpy((#vmt.CmdTable)$^USINT, VaranOut_1.pMeth, SIZEOF(CMDMETH));
	vmt.CmdTable.nCmds		:= nSTDCMD;
	VaranOut_1.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

	IF VaranOut_1.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;

END_FUNCTION

//{{LSL_IMPLEMENTATION
#pragma using HwControl
#pragma using Hub_Base

