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

SHDR: SetUnavailable #21

Closed
MRIIOT opened this issue Mar 30, 2022 · 4 comments
Closed

SHDR: SetUnavailable #21

MRIIOT opened this issue Mar 30, 2022 · 4 comments

Comments

@MRIIOT
Copy link

MRIIOT commented Mar 30, 2022

Expected behavior: Calling adapter.SetUnavailable should send new SHDR to Agent with value of UNAVAILABLE.
Current behavior: It does not.

DataItem before setting UNAVAILABLE.

image

DataItem after setting UNAVAILABLE.

image

Comparison in UpdateDataItem.

image

image

PatrickRitchie added a commit that referenced this issue Mar 30, 2022
@PatrickRitchie
Copy link
Contributor

Commit 26fc936 should have fixed this issue.

var axesDataItem = new ShdrDataItem("f_sim_p1_axes", "X Y Z S");
adapter.AddDataItem(axesDataItem);

2022-03-30T21:02:26.7850000Z|f_sim_p1_axes|X Y Z S

adapter.SetUnavailable();

2022-03-30T21:03:17.8750000Z|f_sim_p1_axes|UNAVAILABLE

This was an issue where I was updating the instance of the ObservationInput object that was in the cached List when setting to Unavailable. This was updating the same object in the List so the "existing.ChangeId != dataItem.ChangeId" comparison was always going to be equal.

I added a few new methods for handling this that instantiate new ObservationInput objects and add them to the cached List. This will prevent the behavior described above. I also added an optional Timestamp parameter to those methods along with any other Unavailable related method.

I tested this with DataItem, Message, Condition, TimeSeries, DataSet, and Table Observations and they all seemed to work correctly.

@PatrickRitchie
Copy link
Contributor

Has anyone still had issues with this in the latest versions? If not, I will close this issue.

@MRIIOT
Copy link
Author

MRIIOT commented May 5, 2022

I think I was waiting for a Nuget release to test this. But close it.

@PatrickRitchie
Copy link
Contributor

Ok thanks for letting me know. This update should be in any of the newest Nuget packages.

A link to the latest package is below:
MTConnect.NET - Nuget

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

No branches or pull requests

2 participants