** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
func parseParams(params *[]string) (*mbParams, error) {
if p.ReqType, err = getReqType((*params)[0]); err != nil {
if p.Serial, err = getSerial((*params)[0]); err != nil {
if p.NetAddr, err = getNetAddr((*params)[0]); err != nil {
return nil, fmt.Errorf("Unsupported modbus protocol")
if p.SlaveID, err = getSlaveID(params, 1, p.ReqType); err != nil {
if p.FuncID, err = getFuncID(params, 2); err != nil {
if p.MemAddr, p.FuncID, err = getMemAddr(params, 3, p.FuncID); err != nil {
if p.RetType, err = getRetType(params, 5, p.FuncID); err != nil {