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

docs do not seem to say what GetSampleOfNextEdge() returns if no edge is yet seen in the future data. #36

Open
dgrinbe2 opened this issue Aug 28, 2024 · 2 comments

Comments

@dgrinbe2
Copy link

docs do not seem to say what GetSampleOfNextEdge returns if no edge is yet seen in the future data. The API implies that this func is nonblocksing, so, what does it do?

@Marcus10110
Copy link
Contributor

GetSampleOfNextEdge will not return until another edge has been found. If another edge is never found, GetSampleOfNextEdge will never return, and once the capture has been completed (or if it's already ended) the analyzer WorkerThread will exit.

functions like GetSampleOfNextEdge that block until a new edge has been found are ideal in situations where you have either not yet found the first frame or have just finished processing and committing a frame, where the desired behavior is for the analyzer to just stop once it's run out of data to process.

WouldAdvancingCauseTransition and WouldAdvancingToAbsPositionCauseTransition are very useful for checking a fixed range of time for a transition. This is useful if you're looking for an optional trailing edge at the end of a frame, and you still need to commit the frame even if no transition is present. These are specifically useful in protocols where the position of the transition you're looking for falls within some maximum duration.

DoMoreTransitionsExistInCurrentData is a general purpose function that will always return a value, until the analyzer is deleted or restarted. It will also automatically throttle the WorkerThread once the end of the data has reached, so if your analyzer calls this in an infinite loop, it will not waste significant CPU time. DoMoreTransitionsExistInCurrentData is mainly useful in the case where you have 2 or more channels, and you need to identify which channel has the nearest transition, if any. The analyzer API does not have any built-in functionality for searching or advancing more than one channel at a time, unfortunately, so this function is mainly used to fill that purpose.

@dgrinbe2
Copy link
Author

dgrinbe2 commented Sep 5, 2024

It seems like DoMoreTransitionsExistInCurrentData() combined with GetSampleOfNextEdge() will do what i want: tell me IF an edge exists and if so: when, but not hang me if it does not. Thank you.

I did not see a mention of DoMoreTransitionsExistInCurrentData() in the api docs here: https://github.com/saleae/SampleAnalyzer/blob/master/docs/Analyzer_API.md

it might be a good idea to add it, in case someone else seeks the same thing I did.

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