Beispiel #1
0
        /// <summary>Calls a job method.</summary>
        /// <param name="method">The job method to call.</param>
        /// <param name="arguments">
        /// An object with public properties representing argument names and values to bind to parameters in the job
        /// method. In addition to parameter values, these may also include binding data values.
        /// </param>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>A <see cref="Task"/> that will call the job method.</returns>
        public Task CallAsync(string method, object arguments, CancellationToken cancellationToken = default(CancellationToken))
        {
            ThrowIfDisposed();

            IDictionary <string, object> argumentsDictionary = ObjectDictionaryConverter.AsDictionary(arguments);

            return(CallAsync(method, argumentsDictionary, cancellationToken));
        }
Beispiel #2
0
        public override bool Execute(string source)
        {
            bool result        = false;
            var  eposDevice    = Device as Epos4Device;
            var  communication = eposDevice?.Communication;
            bool commandResult = false;

            if (communication != null)
            {
                ushort index         = 0;
                byte   subIndex      = 0;
                byte   channelNumber = 0;

                GetParameterValue("Channel", ref channelNumber);
                GetParameterValue("Index", ref index);
                GetParameterValue("SubIndex", ref subIndex);

                if (eposDevice.ObjectDictionary is Epos4ObjectDictionary obd)
                {
                    var channelParameter = obd.GetRecorderChannelParameter(channelNumber);

                    if (channelParameter != null)
                    {
                        commandResult = communication.SetObject(channelParameter.Index,
                                                                channelParameter.SubIndex,
                                                                ObjectDictionaryConverter.ConvertAddressToByteArray(index, subIndex));
                    }
                }

                SetParameterValue("ErrorCode", communication.LastErrorCode);
                SetParameterValue("Result", commandResult);

                result = true;
            }

            return(result);
        }
Beispiel #3
0
        public override bool Execute(string source)
        {
            bool result        = false;
            var  eposDevice    = Device as Epos4Device;
            var  communication = eposDevice?.Communication;
            bool commandResult = false;

            if (communication != null)
            {
                ushort index     = 0;
                byte   subIndex  = 0;
                byte   mode      = 0;
                uint   highValue = 0;
                uint   lowValue  = 0;
                uint   mask      = 0;

                if (eposDevice.ObjectDictionary is Epos4ObjectDictionary objectDictionary)
                {
                    var triggerModeParameter      = objectDictionary.GetRecorderTriggerModeParameter();
                    var triggerHighValueParameter = objectDictionary.GetRecorderTriggerHighValueParameter();
                    var triggerLowValueParameter  = objectDictionary.GetRecorderTriggerLowValueParameter();
                    var triggerVariableParameter  = objectDictionary.GetRecorderTriggerVariableParameter();
                    var triggerMaskParameter      = objectDictionary.GetRecorderTriggerMaskParameter();

                    commandResult = eposDevice.ReadParameterValue(triggerModeParameter, out mode);

                    if (commandResult)
                    {
                        commandResult =
                            eposDevice.ReadParameterValue(triggerMaskParameter, out mask);
                    }

                    if (commandResult)
                    {
                        commandResult =
                            eposDevice.ReadParameterValue(triggerHighValueParameter, out highValue);
                    }

                    if (commandResult)
                    {
                        commandResult =
                            eposDevice.ReadParameterValue(triggerLowValueParameter, out lowValue);
                    }

                    if (commandResult)
                    {
                        commandResult =
                            eposDevice.ReadParameterValue(triggerVariableParameter, out uint triggerVariable);

                        ObjectDictionaryConverter.ConvertToAddress(BitConverter.GetBytes(triggerVariable), ref index, ref subIndex);
                    }
                }

                SetParameterValue("Index", index);
                SetParameterValue("SubIndex", subIndex);
                SetParameterValue("Mask", mask);
                SetParameterValue("Mode", mode);
                SetParameterValue("HighValue", highValue);
                SetParameterValue("LowValue", lowValue);

                SetParameterValue("ErrorCode", communication.LastErrorCode);
                SetParameterValue("Result", commandResult);

                result = true;
            }

            return(result);
        }