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

EDS to/from protobuffer conversion #137

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

nimrof
Copy link
Collaborator

@nimrof nimrof commented Oct 6, 2024

Solution uses AutoMapper that is a mapper solution, not the greatest and newest, but it works on .net framework without to much changes.
It solves mapping by itself if the names and mostly equal and imho one of its best features is that the test will fail if there is something that is not mapped or ignored. So you need to have 100% coverage and if will fail if you add new members/fields that are not mapped.

Going forward i think it is best to make own classes that does the mapping to separate the mapping from other stuff related to the format, so that is why the file and class is named [type]Mapping

Before i convert from draft i need more test

@nimrof nimrof added the enhancement New feature or request label Oct 6, 2024
@nimrof nimrof self-assigned this Oct 6, 2024
@nimrof nimrof linked an issue Oct 6, 2024 that may be closed by this pull request
@trojanobelix trojanobelix marked this pull request as ready for review October 7, 2024 08:22
@CANopenNode
Copy link
Owner

AutoMapper seems nice solution to me.

Probably EDSsharp class will be simplified in some parts, as its sole purpose will be to read and write EDS file. Is that so?

@nimrof
Copy link
Collaborator Author

nimrof commented Oct 11, 2024

Probably EDSsharp class will be simplified in some parts, as its sole purpose will be to read and write EDS file. Is that so?

Yes, but no plan to remove anything in EDSSharp until protobuffer has replaced EDSSharp

@nimrof
Copy link
Collaborator Author

nimrof commented Nov 16, 2024

Hi @CANopenNode & @trojanobelix,

Need a little help here with the eds access types:

Does this look correct?

EDSsharp.AccessType.rw == OdSubObject.Types.AccessPDO.Tr & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.ro == OdSubObject.Types.AccessPDO.T & OdSubObject.Types.AccessSDO.Ro
EDSsharp.AccessType.wo == OdSubObject.Types.AccessPDO.R & OdSubObject.Types.AccessSDO.Wo
EDSsharp.AccessType.rwr == OdSubObject.Types.AccessPDO.T & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.rww == OdSubObject.Types.AccessPDO.R & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.@const == OdSubObject.Types.AccessPDO.R & OdSubObject.Types.AccessSDO.Ro
EDSsharp.AccessType.UNKNOWN == OdSubObject.Types.AccessPDO.No & OdSubObject.Types.AccessSDO.No

@CANopenNode
Copy link
Owner

From standard:

The value indicates the access type for this object, represented by the following strings („ro“ - read only, „wo“ - write only, „rw“ - read/write, „rwr“ - read/write on process input, „rww“ - read/write on process output, „const“ - constant value) . The “rwr” indicates that the related object is read or is written using SDO, but is only mapped to TPDO. The “rww” indicates that the related object is read and is written using SDO, but is only mapped to a RPDO.`

I would use (not sure for const):

EDSsharp.AccessType.ro == OdSubObject.Types.AccessSDO.Ro
EDSsharp.AccessType.wo == OdSubObject.Types.AccessSDO.Wo
EDSsharp.AccessType.rwr == OdSubObject.Types.AccessPDO.T & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.rww == OdSubObject.Types.AccessPDO.R & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.rw == (OdSubObject.Types.AccessPDO.Tr or No) & OdSubObject.Types.AccessSDO.Rw
EDSsharp.AccessType.UNKNOWN == OdSubObject.Types.AccessSDO.No

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

Successfully merging this pull request may close these issues.

EDS <-> protobuffer
2 participants