throwing errors and GetUsbListEntry, Matlab
Page 1 of 1
throwing errors and GetUsbListEntry, Matlab
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
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
Re: throwing errors and GetUsbListEntry, Matlab
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
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
Similar topics
» Error: STG2008 from Matlab
» McsUsbDLL.dll for 64 bit Matlab
» read mcd file in Matlab
» Using the McsUsbDLL library with 64-bit Matlab
» Can not read HDF5 MatlabData by matlab
» McsUsbDLL.dll for 64 bit Matlab
» read mcd file in Matlab
» Using the McsUsbDLL library with 64-bit Matlab
» Can not read HDF5 MatlabData by matlab
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|