support set_attributes_all (service 0x02) #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
i needed support for set_attributes_all for simulation purposes, using
pycomm3
as a client library andcpppo
as the Ethernet/IP server (no Logix). i am pretty sure someone else can benefit from this.example/how to
set up server with two attributes in the same object
0x80/1
:python3 -m cpppo.server.enip --print my_uint32@0x80/1/1=UDINT my_int16@0x80/1/2=INT
set all the objects attributes at once using a byte array (hex parsing is supported). in this example, the first four bytes
b'\x13\x00\x00\x00' == UDINT.produce(19)
target the unsigned 32-bit integer and the last two bytesb'\xfe\xff' == INT.produce(-2)
are meant for the signed 16-bit integer:python3 -m cpppo.server.enip.get_attribute -a localhost @0x80/1=0x13,0x00,0x00,0x00,0xfe,0xff
this will result in the following output on the server side
and on the client side
Fri Sep 27 15:51:43 2024: 0: Single S_A_A @0x0080/1 == True
details
set_attributes_all
requests in server and clientserver.enip.get_attribute
to naturally supportset_attributes_all
server.enip.client