Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
f6b7565e
Commit
f6b7565e
authored
Mar 20, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Modbus): Тестовая сборка с новым modbus (добавлена функция 43/14)
parent
ded0405d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
6 deletions
+51
-6
mbrtutester.cc
Utilities/MBTester/mbrtutester.cc
+44
-1
mbtcptester.cc
Utilities/MBTester/mbtcptester.cc
+0
-1
libuniset.spec
conf/libuniset.spec
+4
-1
configure.ac
configure.ac
+2
-2
libUniSetMBSlave.pc.in
extensions/ModbusSlave/libUniSetMBSlave.pc.in
+1
-1
No files found.
Utilities/MBTester/mbrtutester.cc
View file @
f6b7565e
...
...
@@ -20,6 +20,7 @@ static struct option longopts[] = {
{
"write0F"
,
required_argument
,
0
,
'm'
},
{
"write10"
,
required_argument
,
0
,
'w'
},
{
"diag08"
,
required_argument
,
0
,
'o'
},
{
"read4314"
,
required_argument
,
0
,
'e'
},
// { "readfile14", required_argument, 0, 'g' },
// { "writefile15", required_argument, 0, 'p' },
{
"filetransfer66"
,
required_argument
,
0
,
'u'
},
...
...
@@ -47,6 +48,7 @@ static void print_help()
printf
(
"[--read03] slaveaddr reg count - read from reg (from slaveaddr). Default: count=1
\n
"
);
printf
(
"[--read04] slaveaddr reg count - read from reg (from slaveaddr). Default: count=1
\n
"
);
printf
(
"[--diag08] slaveaddr subfunc [dat] - diagnostics request
\n
"
);
printf
(
"[--read4314] slaveaddr devID objID - (0x2B/0x0E): read device identification (devID=[1...4], objID=[0..255])
\n
"
);
// printf("[--readfile14] slaveaddr fileID - read file from slaveaddr).\n");
// printf("[--writefile15] slaveaddr id filename - write file to slaveaddr).\n");
printf
(
"[--filetransfer66] slaveaddr fileID [filename] - get file from slaveaddr. Default save to 'fileID.transfer'
\n
"
);
...
...
@@ -75,6 +77,8 @@ enum Command
cmdRead02
,
cmdRead03
,
cmdRead04
,
cmdRead43_13
,
cmdRead43_14
,
cmdWrite05
,
cmdWrite06
,
cmdWrite0F
,
...
...
@@ -113,10 +117,12 @@ int main( int argc, char **argv )
string
tofile
(
""
);
int
use485
=
0
;
int
ncycles
=
-
1
;
ModbusRTU
::
ModbusByte
devID
=
0
;
ModbusRTU
::
ModbusByte
objID
=
0
;
try
{
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:"
,
longopts
,
&
optindex
))
!=
-
1
)
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hva:w:z:m:r:x:c:b:d:s:t:qn:u:yl:t:o:
e:
"
,
longopts
,
&
optindex
))
!=
-
1
)
{
switch
(
opt
)
{
...
...
@@ -167,7 +173,26 @@ int main( int argc, char **argv )
if
(
checkArg
(
optind
+
1
,
argc
,
argv
)
)
dat
=
uni_atoi
(
argv
[
optind
+
1
]);
break
;
case
'e'
:
{
if
(
cmd
==
cmdNOP
)
cmd
=
cmdRead43_14
;
slaveaddr
=
ModbusRTU
::
str2mbAddr
(
optarg
);
if
(
optind
>
argc
)
{
cerr
<<
"read command error: bad or no arguments..."
<<
endl
;
return
1
;
}
if
(
checkArg
(
optind
,
argc
,
argv
)
)
devID
=
ModbusRTU
::
str2mbData
(
argv
[
optind
]);
if
(
checkArg
(
optind
+
1
,
argc
,
argv
)
)
objID
=
uni_atoi
(
argv
[
optind
+
1
]);
}
break
;
case
'f'
:
cmd
=
cmdWrite05
;
case
'z'
:
...
...
@@ -459,6 +484,24 @@ int main( int argc, char **argv )
}
break
;
case
cmdRead43_14
:
{
if
(
verb
)
{
cout
<<
"read4314: slaveaddr="
<<
ModbusRTU
::
addr2str
(
slaveaddr
)
<<
" devID="
<<
ModbusRTU
::
dat2str
(
devID
)
<<
" objID="
<<
ModbusRTU
::
dat2str
(
objID
)
<<
endl
;
}
ModbusRTU
::
MEIMessageRetRDI
ret
=
mb
.
read4314
(
slaveaddr
,
devID
,
objID
);
if
(
verb
)
cout
<<
"(reply): "
<<
ret
<<
endl
;
else
cout
<<
"(reply): devID='"
<<
(
int
)
ret
.
devID
<<
"' objNum='"
<<
(
int
)
ret
.
objNum
<<
"'"
<<
endl
<<
ret
.
dlist
<<
endl
;
}
break
;
case
cmdWrite05
:
{
if
(
verb
)
...
...
Utilities/MBTester/mbtcptester.cc
View file @
f6b7565e
...
...
@@ -153,7 +153,6 @@ int main( int argc, char **argv )
objID
=
uni_atoi
(
argv
[
optind
+
1
]);
}
break
;
case
'f'
:
cmd
=
cmdWrite05
;
case
'z'
:
...
...
conf/libuniset.spec
View file @
f6b7565e
...
...
@@ -7,7 +7,7 @@
Name: libuniset
Version: 1.6
Release: alt
6
Release: alt
7
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -319,6 +319,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Wed Mar 20 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt7
- modbus: add new function 0x2B/0x0E(43/14)"Read device identification"
* Tue Mar 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.6-alt6
- python: add __init__.py
...
...
configure.ac
View file @
f6b7565e
...
...
@@ -3,7 +3,7 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset], [1.
5
.1], pv@etersoft.ru)
AC_INIT([uniset], [1.
6
.1], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
# AC_CONFIG_MACRO_DIR([m4])
...
...
@@ -30,7 +30,7 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
LIBVER=1:
5
:1
LIBVER=1:
6
:1
AC_SUBST(LIBVER)
# Checks for libraries.
...
...
extensions/ModbusSlave/libUniSetMBSlave.pc.in
View file @
f6b7565e
...
...
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libUniSetMBSlave
Description: Support library for UniSetModbusSlave
Requires: libUniSetExtensions libUniSetSharedMemory
Version:
1.1.1
Version:
@VERSION@
Libs: -L${libdir} -lUniSetMBSlave
Cflags: -I${includedir}/uniset
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment