luxonis / XLink

A cross-platform library for communicating with devices over various physical links.
Apache License 2.0
12 stars 18 forks source link

Added arg to fetch usb speed and Myriad X serial number #1

Closed saching13 closed 3 years ago

saching13 commented 3 years ago

XLinkConnect() in the wrapper takes an extra argument which will hold the serial number and the usb speed from the connection.

Previous added similar requests on Boot functions which I removed since it was not necessary.

SzabolcsGergely commented 3 years ago

I'd prefer not to change the interface of functions in Xlink because you have to propagate it through different layers, would be better saving the metadata in an internal structure in Xlink and accessing through a getter. @saching13

saching13 commented 3 years ago

Please refactor this as @szabi-luxonis mentioned. Consider exposing this data in a structured manner with added API instead of changed. Prefer structured data: XLinkPublicDefines.h: struct/enum Speed / UsbSpeed which holds the actual speed type, and similar for serial number.

Don't deserialize to a char* in a human readable form and send that around, prefer strong types.

Be aware that XLink is Win/Mac&Linux as well as USB & PCIe so try to make minimal changes, which remain platform independent.

@themarpe @szabi-luxonis/ I Used enum like you mentioend for the speed and created a static variable to store it and added a getter to acces it. And as of the Mx serial id I used a char array and created a getter for it too. I am not sure if char array is the right way to do it in 'C'. If there is a better way, open to suggestions.