"use strict";var TcHmi;!function(TcHmi){!function(Functions){!function(Beckhoff){Beckhoff.Increment=function(ctx,symbol,maxValue,stepWidth){if(!ctx)throw new TypeError("Parameter 'ctx' must be defined.");if(!ctx.success||!ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are missing.");if("function"!=typeof ctx.success||"function"!=typeof ctx.error)throw new TypeError("Parameter 'ctx' must be defined properly. Either 'success' or 'error' or both are not of type 'function'.");null!=symbol?symbol instanceof TcHmi.Symbol?symbol.readEx(function(data){if(data.error!==TcHmi.Errors.NONE)return void ctx.error(data.error,{code:data.error,message:TcHmi.Errors[data.error],reason:"Symbol value read failed",domain:"TcHmi.Functions.Beckhoff.Increment",errors:data.details?[data.details]:void 0});let value=TcHmi.ValueConverter.toNumber(data.value);if(null===value)return void ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Symbol value is no number.",domain:"TcHmi.Functions.Beckhoff.Increment"});let convertedStepWidth=TcHmi.ValueConverter.toNumber(stepWidth,1);isNaN(convertedStepWidth)&&(convertedStepWidth=1),value+=convertedStepWidth;let convertedMaxValue=TcHmi.ValueConverter.toNumber(maxValue);null===convertedMaxValue||isNaN(convertedMaxValue)||convertedMaxValue>=value?symbol.write(value,function(data){data.error===TcHmi.Errors.NONE?ctx.success():ctx.error(data.error,{code:data.error,message:TcHmi.Errors[data.error],reason:"Symbol value write failed",domain:"TcHmi.Functions.Beckhoff.Increment",errors:data.details?[data.details]:void 0})}):ctx.success()}):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Parameter is no symbol.",domain:"TcHmi.Functions.Beckhoff.Increment"}):ctx.error(TcHmi.Errors.E_PARAMETER_INVALID,{code:TcHmi.Errors.E_PARAMETER_INVALID,message:TcHmi.Errors[TcHmi.Errors.E_PARAMETER_INVALID],reason:"Requested symbol is not set.",domain:"TcHmi.Functions.Beckhoff.Increment"})}}(Functions.Beckhoff||(Functions.Beckhoff={}))}(TcHmi.Functions||(TcHmi.Functions={}))}(TcHmi||(TcHmi={})),TcHmi.Functions.registerFunctionEx("Increment","TcHmi.Functions.Beckhoff",TcHmi.Functions.Beckhoff.Increment);