ppannuto / python-saleae

Python library to control a Saleae Logic Analyzer
Apache License 2.0
124 stars 55 forks source link

EXPORT_ANALYZER data response #21

Closed ohhorob closed 8 years ago

ohhorob commented 8 years ago

Page 22 of Logic Socket API Users Guide details an optional third parameter to have the analyzer data returned in the socket response.

Add a third, optional parameter to have the results piped back through the TCP socket to you.

This change exposes that with a kwarg data_response=<boolean> to enable that feature.

I'm currently using this to receive two Async Serial decodes (RX and TX) and merge them into a single CSV where each RX and TX are a column, and everything is sorted by timestamp.

ppannuto commented 8 years ago

Looks cool, thanks.

One question as I've never used this feature of Saleae, is that response a giant string? Would it possibly make more sense for the library to return a more useful parsed data object (array of arrays perhaps)?

ohhorob commented 8 years ago

Yeah, it is just a big 'ol string.

I have set my Analyzers to export CSV and that's what I get via the API, but I'm not sure if you can get the text format too? The API examples only show CSV, and it doesn't appear to expose any way to configure the export before asking for it.

If we can confirm that the API only returns CSV, it would be very useful to parse the response into an array of named tuples.

ppannuto commented 8 years ago

@Marcus10110 can you confirm whether the API will reliably return CSV data?

ohhorob commented 8 years ago

Any suggested changes for me to make before taking this PR?

ppannuto commented 8 years ago

Naw, I'd hoped Mark would be able to reply, but it could be something that just isn't stable yet / they don't have a good answer for yet, which is understandable. It's a bit of a niche corner.

We could add a response_format parameter or s/t like that in the future to coerce one way or another w/out breaking backward compatibility.

I'll let this sit for another 24h or so on the off chance that this thread bumped back to top of Mark's inbox, o/w I'll just go forward with unformatted string as a response.