//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               = "_LMCModuleBase"
	Revision           = "1.1"
	GUID               = "{A5E497C3-5245-436D-817A-5F9FDBDD18F5}"
	RealtimeTask       = "false"
	CyclicTask         = "false"
	BackgroundTask     = "false"
	Sigmatek           = "true"
	OSInterface        = "false"
	HighPriority       = "false"
	Automatic          = "false"
	UpdateMode         = "Prescan"
	IconPath           = ".\Class\_AxisBase\LMCAxis.ico"
	SharedCommandTable = "true"
	Objectsize         = "(480,120)"
	Comment            = "derive this class to implement user defined calculations">
	<Channels>
		<Server Name="ClassSvr" GUID="{2B4D740B-45C7-47A4-9CEB-6B1E46D49984}" Visualized="false" Initialize="false" WriteProtected="false" Retentive="false" Comment=" 0 ... login was successful&#13;&#10;-1 ... index out of range"/>
		<Client Name="_LMCAxis" Required="true" Internal="false" Comment="objectchannel "/>
		<Client Name="Config" Required="false" Internal="false" Comment="0 ... position-offset&#13;&#10;10 ... PreRtWork&#13;&#10;11 ... PostRtWork"/>
		<Client Name="Index" Required="false" Internal="false" Comment="calling order"/>
	</Channels>
	<RevDoku>
		<Owner Company="Sigmatek" Author="HasHan"/>
		<Dokumentation Revision="1.1" Date="2024-06-17" Author="StePhi" Company="Sigmatek" Description="Bugfix: Return values of NewInst with uiCmd-Index 0 and 1 to manipulate ActPos and SetPos fixed."/>
		<Dokumentation Revision="1.0" Date="2019-03-04" Author="HasHan" Company="Sigmatek" Description="creation"/>
	</RevDoku>
</Class>
*)
_LMCModuleBase : CLASS
  //Servers:
	ClassSvr 	: SvrChCmd_DINT;
  //Clients:
	_LMCAxis 	: CltChCmd__LMCAxisBase;
	Index 	: CltCh_DINT;
	Config 	: CltCh_DINT;
  //Variables:
		pCNCVars 	: ^CNCInternalStruct;
  //Functions:
	
	FUNCTION VIRTUAL GLOBAL Init;
	
	FUNCTION VIRTUAL GLOBAL ClassSvr::NewInst
		VAR_INPUT
			pPara 	: ^CmdStruct;
			pResult 	: ^results;
		END_VAR
		VAR_OUTPUT
			ret_code 	: iprStates;
		END_VAR;
  //Tables:
	FUNCTION @STD
		VAR_OUTPUT
			ret_code	: CONFSTATES;
		END_VAR;
	FUNCTION GLOBAL TAB @CT_;
END_CLASS;

#pragma usingLtd _LMCAxisBase


//}}LSL_DECLARATION


FUNCTION GLOBAL TAB _LMCModuleBase::@CT_
0$UINT,
2#0100000000000000$UINT, //TY__LMCMODULEBASE
1$UINT, 1$UINT, (SIZEOF(::_LMCModuleBase))$UINT, 
1$UINT, 3$UINT, 0$UINT, 
TO_UDINT(4023155754), "_LMCModuleBase", //Class
TO_UDINT(0), 0, 0$UINT, 0$UINT, //Baseclass
//Servers:
(::_LMCModuleBase.ClassSvr.pMeth)$UINT, _CH_CMD$UINT, 2#0000000000000000$UINT, TO_UDINT(619352855), "ClassSvr", 
//Clients:
(::_LMCModuleBase._LMCAxis.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000010$UINT, TO_UDINT(1422175863), "_LMCAxis", TO_UDINT(280984637), "_LMCAxisBase", 2$UINT, 110$UINT, 
(::_LMCModuleBase.Index.pCh)$UINT, _CH_CLT_DATA$UINT, 2#0000000000000000$UINT, TO_UDINT(1999087025), "Index", 
(::_LMCModuleBase.Config.pCh)$UINT, _CH_CLT_DATA$UINT, 2#0000000000000000$UINT, TO_UDINT(611510522), "Config", 
END_FUNCTION


#define USER_CNT__LMCModuleBase 0

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

FUNCTION _LMCModuleBase::@STD
	VAR_OUTPUT
		ret_code	: CONFSTATES;
	END_VAR
	VAR
		vmt	: _LSL_STD_VMETH;
	END_VAR

	//Command Methods
	InitCmdTable (nCmd := nSTDCMD + USER_CNT__LMCModuleBase, pCmd := #vmt.CmdTable);
	vmt.CmdTable.NewInstr		:= #NewInst();
	vmt.CmdTable.Write		:= #M_WR_DIRECT();
	vmt.CmdTable.Init		:= #Init();
	ClassSvr.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

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

END_FUNCTION

//{{LSL_IMPLEMENTATION

FUNCTION VIRTUAL GLOBAL _LMCModuleBase::Init

  if _FirstScan then
    if IsClientConnected(#_LMCAxis) = 1 then
      ClassSvr := _LMCAxis.Login(this, Index, Config);
    end_if;
  end_if;

END_FUNCTION


FUNCTION VIRTUAL GLOBAL _LMCModuleBase::ClassSvr::NewInst
	VAR_INPUT
		pPara 	: ^CmdStruct;
		pResult 	: ^results;
	END_VAR
	VAR_OUTPUT
		ret_code 	: iprStates;
	END_VAR
  
  ret_code := BUSY;
  
  case pPara^.uiCmd of
    //******************************************************************************************************
    0: //BinAct manipulation
    //******************************************************************************************************
      pResult^.aData$DINT := 0;
      ret_code := READY;
      
    //******************************************************************************************************
    1: //TrapPosAct/RoundPosAct manipulation
    //******************************************************************************************************
      pResult^.aData$DINT := 0;
      ret_code := READY;
      
    //******************************************************************************************************
    10: //PreRtWork
    //******************************************************************************************************
      pResult^.aData$DINT := pPara^.aPara[0];
      ret_code := READY;
      
    //******************************************************************************************************
    11: //PostRtWork
    //******************************************************************************************************
      pResult^.aData$DINT := pPara^.aPara[0];
      ret_code := READY;
      
  end_case;
  
END_FUNCTION
