Hi Robert,

Looking at the code
for 
plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/base/protocol/EipProtocolLogic.java
at line 133. It looks as though the 2 bit format value can be used as a
discriminator for the format of that field. It being 0 when it is 8 bits,
and 1 when it's 16 bits.

Some variation of this could work.

[discriminatedType LogicalSegmentType
[discriminator uint 3 logicalSegmentType]
[typeSwitch logicalSegmentType
['0x00' ClassID
[simple LogicalSegmentInstance field]
]
['0x01' InstanceID
[simple LogicalSegmentInstance field]
]
['0x02' MemberID
[simple LogicalSegmentInstance field]
]
]
]

[discriminatedType LogicalSegmentInstance
[discriminator uint 2 format]
[typeSwitch format
['0x00' EightBitField
[simple uint 8 segmentClass]
]
['0x01' SixteenBitField
[simple uint 16 instance]
]
]
]

Kind Regards

Ben

On Thu, Feb 22, 2024 at 4:25 AM R Thayer <thayer...@cox.net> wrote:

> Chris, all,
>
> What is the recommended way to define the spec in the
> plc4x/protocols/eip/src/main/resources/protocols/eip/eip.mspec
>
> The current definitions for
> PathSegment/LogicalSegment/InstanceSegment/InstanceId are defined for 8-bit
> values (see below).  We have live traffic for a 0x52 CipConnectedRead
> request that contains 16-bit values for both the path segment and the
> instance ID, e.g. 0x25002000 w the instance being LE.  There are class
> segment and a member segment are both 8-bit.  the format 2 bit value is 1
> for the instance.
>
> We can overload the LogicalSegment with a LogicalSegment16, but as the
> format value is currently read down in the instance segment, i wasn't sure
> how to approach it.  It is straightforward to edit the generated java to
> read ahead but that doesn't  fit the mspec way (afaik).
>
> This is part of a MultiServiceRequest where Service #1 includes an 8-bit
> instanceId and Services #12 &#13 include the 16-bit.
>
>
> I can see how the decriminator fields but wasn't sure how to define the
> look ahead so that is generated properly.
>
> Any thoughts?
>
> Thanks!
> Bob
>
> [discriminatedType PathSegment
>     [discriminator  uint    3   pathSegment         ]
>     [typeSwitch pathSegment
>         ['0x00'      PortSegment
>             [simple PortSegmentType     segmentType]
>         ]
>         ['0x01'      LogicalSegment
>             [simple LogicalSegmentType  segmentType]
>         ]
>         ['0x04'      DataSegment
>             [simple DataSegmentType     segmentType]
>         ]
>     ]
> ]
> [discriminatedType LogicalSegmentType
>     [discriminator  uint    3   logicalSegmentType]
>     [typeSwitch logicalSegmentType
>         ['0x00' ClassID
>             [simple uint    2   format]
>             [simple uint    8   segmentClass]
>         ]
>         ['0x01' InstanceID
>             [simple uint    2   format]
>             [simple uint    8   instance]
>         ]
>         ['0x02' MemberID
>             [simple uint    2   format]
>             [simple uint    8   instance]
>         ]
>     ]
> ]
> [type   InstanceSegment
>     [simple     uint    3    pathSegmentType]
>     [simple     uint    3    logicalSegmentType]
>     [simple     uint    2    logicalSegmentFormat]
>     [simple     uint    8    instance]
> ]
>
>
>
>
> > On 02/16/2024 2:56 PM EST R Thayer <thayer...@cox.net> wrote:
> >
> >
> > Chris,
> >
> > I created a fresh instance of the plc4x project and ran
> >
> > ./mvnw -P update-generated-code,.os-mac-x86_64,skip-prerequisite-check
> -pl :plc4j-driver-eip -am clean package
> >
> > which ran to completion and regenerated the files.   As a sanity check I
> updated the eip.mspec with one of my changes and reran the compiler and it
> worked as expected.
> >
> > Thanks for the quick response and pointer!
> >
> > Bob
> >
> >
> >
> > > On 02/16/2024 1:32 AM EST Christofer Dutz <christofer.d...@c-ware.de>
> wrote:
> > >
> > >
> > > Hi Robert,
> > >
> > > happy to help you with that.
> > >
> > > In general, I’ll be working on updating the documentation after the
> next release (which I’ll start after finishing this mail)
> > > But for now: We’ve introduced some minor changes to the build, so
> you’ll need to make sure the following maven profiles are enabled:
> > >
> > >
> > >   *   with-java (Without it, generally nothing java-related will be
> built at all)
> > >   *   update-generated-code (Without it, the code generation will not
> be performed at all)
> > >
> > >
> > > So, if you run the following command:
> > >
> > >
> > > ./mvnw -Pwith-java,update-generated-code -pl :plc4j-driver-eip -am
> clean package
> > >
> > > It will generally build the java eip driver and all modules it depends
> on.
> > >
> > > Hope that helps and looking forward to some pull-requests ;-)
> > >
> > >
> > > Chris
> > >
> > >
> > >
> > > Von: R Thayer <thayer...@cox.net>
> > > Datum: Freitag, 16. Februar 2024 um 02:25
> > > An: dev@plc4x.apache.org <dev@plc4x.apache.org>
> > > Betreff: Re: Re-generated Generated Sources
> > > All,
> > > What is the process to regenerate generated sources?
> > >
> > > New to plc4x but have live EIP/CIP traffic that i'm trying to model
> with the eip.mspec and need to close the circle of
> eip.mspec==>generated-code in the plc4j/drivers/eip/src/main/generated to
> verify correct mspec.  Working through
> ParserSerializerTestsuiteLittleEndian.xml to model MultipleServiceR/R
> > >
> > > The website discusses it and suggests "mvn compile".
> > > This thinks it works but does not regenerate nor replace the files.
> > >
> > > Thanks,
> > >
> > > Robert Thayer
> > > CC Software, Inc.
> > > 702-726-1034
>

Reply via email to