Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support set_attributes_all (service 0x02) #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

filterdev
Copy link

@filterdev filterdev commented Sep 27, 2024

i needed support for set_attributes_all for simulation purposes, using pycomm3 as a client library and cpppo 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 bytes b'\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

  my_uint32[    0-0    ] <= [19] 
   my_int16[    0-0    ] <= [-2]

and on the client side

Fri Sep 27 15:51:43 2024: 0: Single S_A_A @0x0080/1 == True

details

  • added support for set_attributes_all requests in server and client
  • extended server.enip.get_attribute to naturally support set_attributes_all
  • added hex parsing in server.enip.client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant