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

MID1201 #90

Closed
sosborne-control2k opened this issue Jul 5, 2022 · 2 comments
Closed

MID1201 #90

sosborne-control2k opened this issue Jul 5, 2022 · 2 comments
Assignees

Comments

@sosborne-control2k
Copy link

sosborne-control2k commented Jul 5, 2022

Hi, I get Object Reference not set to instance error on 1201 but not 1202 - adding:

ProcessDataFields(package);

on line 113 of https://github.com/Rickedb/OpenProtocolInterpreter/blob/master/src/OpenProtocolInterpreter/Result/Mid1201.cs
fixed for me.

Thanks for great package.

@Rickedb Rickedb added the bug fix label Aug 8, 2022
@Rickedb
Copy link
Owner

Rickedb commented Aug 8, 2022

Hello @sosborne-control2k Thanks! Gonna try to update it as soon as possible!

@OscardLucas
Copy link

Additional this bug i found two more in the MID1201.
PD. ProcessDataFields method should be added on line 125, after set the Index and size of Fields that are assigned at run time

Description:
On Parse Method for MID1201
VariableDataFields throws null exeption when trying to convert dataFieldsListField Value to List. This parameter is not sent when number of data fields is 000, that causes null exception.
As documentation especifies, section 5.9.1.4 on Table 120, Data fields section: "This section is repeated Number of data fields times. If Number of data fields = 000, this section is not sent"

Solution
I evaluate the NumberOfDataFields before assign the value.
Replace
VariableDataFields = _varDataFieldListConverter.Convert(dataFieldListField.Value).ToList();
with
VariableDataFields = NumberOfDataFields > 0 ? _varDataFieldListConverter.Convert(dataFieldListField.Value).ToList() : VariableDataFields;


Description
TIME DataField for MID1201 is not properly parsed due incorrect size property.

Solution
On RegisterDataFields method for MID1201 change TIME Field size.
Replace
new DataField((int)DataFields.TIME, 36, 4, '0', DataField.PaddingOrientations.LEFT_PADDED, false),
with
new DataField((int)DataFields.TIME, 36, 19, '0', DataField.PaddingOrientations.LEFT_PADDED, false),

Additional Information
Working with MTFocus 6000 controller
With this response both errors can be reproduced.
"006912010010 00 00200100000001532022-11-14:09:35:1000000100001000\0"

Rickedb added a commit that referenced this issue May 14, 2023
@Rickedb Rickedb self-assigned this May 14, 2023
@Rickedb Rickedb added the bug label May 14, 2023
@Rickedb Rickedb closed this as completed May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants