Welcome to our user forum (read only mode).
Would you like to react to this message? Create an account in a few clicks or log in to continue.

throwing errors and GetUsbListEntry, Matlab

Go down

throwing errors and GetUsbListEntry, Matlab Empty throwing errors and GetUsbListEntry, Matlab

Post  JimHokanson Tue Jul 25, 2017 6:04 pm

I ran into an issue with having multiple devices (Mcs.Usb.CStg200xDownloadNet) connected to the same physical device. I was surprised to not find any errors, except for hard crashes (in this case of Matlab) when trying to make method calls with a device that had no serial number. While I can presumably do a better job ensuring a single connection to the device, I was surprised that no errors were being thrown.

Out of curiosity, I tried running code which gets the first entry from an entry list, with no devices attached. To my surprise I got back what looks like a valid device, although again the serial number was empty and the DeviceId (for example) had the following values:
IdVendor: None
IdProduct: None
BcdDevice: 0
BusType: MCS_UNDEFINED_BUS

Although it is clear that this is not a valid list entry, I am surprised that no error was thrown indicating an invalid request (i.e. requesting the first device when none are present - for GetUsbListEntry).

So the question is, is there some way of enabling errors. How is incorrect behavior supposed to be handled (in this case an in general)? Am I simply not seeing the documentation in regards to handling errors? My big concern is that I'll manage to do something wrong while convincing myself I am doing it right.

Thanks,
Jim

JimHokanson

Posts : 8
Join date : 2017-07-07

Back to top Go down

throwing errors and GetUsbListEntry, Matlab Empty Re: throwing errors and GetUsbListEntry, Matlab

Post  JimHokanson Tue Jul 25, 2017 6:20 pm

I should mention that in the case of the connection:
CMcsUsbNet.Connect

It does mention returning an error code (0 on success) which if non-zero can be interpreted with CUsbExceptionNet

And I also just found the EnableExceptions command for CMcsUsbNet.

This makes it clear that in some cases I need to be explicitly looking for exceptions. It also clears up my interactions with CMcsUsbNet, which is probably 99% of my code, but I'm still confused about the design approach for the other STG classes.

Thanks,
Jim

JimHokanson

Posts : 8
Join date : 2017-07-07

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum