Skip to content

Commit

Permalink
Attempt to better understand baug causing application to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
vigoux committed Jul 17, 2018
1 parent 7b72ef7 commit 9d9443d
Showing 1 changed file with 5 additions and 188 deletions.
193 changes: 5 additions & 188 deletions spectro.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,193 +161,6 @@ def __str__(self):

return "\n".join(self.AVA_EXCEPTION_CODES[self.code_nbr])

#
# #####
# # Struct definition
# #####
#
# class c_AvsIdentityType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_aSerialId", ctypes.c_char * 10), # NOT SURE
# ("m_aUserFriendlyId", ctypes.c_char * 64),
# ("m_Status", ctypes.c_int)] # c_DeviceStatus
#
#
# class c_BroadcastAnswerType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("InterfaceType", ctypes.c_ubyte),
# ("serial", ctypes.c_ubyte * AVS_SERIAL_LEN),
# ("port", ctypes.c_ushort),
# ("status", ctypes.c_ubyte),
# ("RemoteHostIp", ctypes.c_uint),
# ("LocalIp", ctypes.c_uint), # NOT SURE
# ("reserved", ctypes.c_ubyte * 4)]
#
#
# class c_ControlSettingsType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_StrobeControl", ctypes.c_ushort),
# ("m_LaserDelay", ctypes.c_uint),
# ("m_LaserWidth", ctypes.c_uint),
# ("m_LaserWaveLength", ctypes.c_float),
# ("m_StoreToRam", ctypes.c_ushort)]
#
#
# class c_DarkCorrectionType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Enable", ctypes.c_ubyte),
# ("m_ForgetPercentage", ctypes.c_ubyte)]
#
#
# class c_DeviceStatus(enum.Enum): # VERIFIED
# UNKNOWN = 0
# USB_AVAILABLE = 1
# USB_IN_USE_BY_APPLICATION = 2
# USB_IN_USE_BY_OTHER = 3
# ETH_AVAILABLE = 4
# ETH_IN_USE_BY_APPLICATION = 5
# ETH_IN_USE_BY_OTHER = 6
# ETH_ALREADY_IN_USE_USB = 7
#
#
# class c_DetectorType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_SensorType", ctypes.c_ubyte), # SensorType
# ("m_NrPixels", ctypes.c_ushort),
# ("m_aFit", ctypes.c_float * 5),
# ("m_NLEnable", ctypes.c_bool),
# ("m_aNLCorrect", ctypes.c_double * 8),
# ("m_aLowNLCounts", ctypes.c_double),
# ("m_aHighNLCounts", ctypes.c_double),
# ("m_Gain", ctypes.c_float * 2),
# ("m_Reserved", ctypes.c_float),
# ("m_Offset", ctypes.c_float * 2),
# ("m_ExtOffset", ctypes.c_float),
# ("m_DefectivePixels", ctypes.c_ushort * 30)]
#
#
# class c_DynamicStorageType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Nmsr", ctypes.c_int32),
# ("m_Reserved", ctypes.c_uint8 * 8)]
#
#
# class c_EthernetSettingsType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_IpAddr", ctypes.c_uint),
# ("m_NetMask", ctypes.c_uint),
# ("m_Gateway", ctypes.c_uint),
# ("m_DhcpEnabled", ctypes.c_ubyte),
# ("m_TcpPort", ctypes.c_ushort),
# ("m_LinkStatus", ctypes.c_ubyte)]
#
#
# class c_InterfaceType(enum.Enum): # VERIFIED
# RS232 = 0
# USB5216 = 1
# USBMINI = 2
# USB7010 = 3
# ETH7010 = 4
#
#
# class c_ProcessControlType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_AnalogLow", ctypes.c_float * 2),
# ("m_AnalogHigh", ctypes.c_float * 2),
# ("m_DigitalLow", ctypes.c_float * 10),
# ("m_DigitalHigh", ctypes.c_float * 10)]
#
#
# # SensorType
#
# class c_SmoothingType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_SmoothPix", ctypes.c_ushort),
# ("m_SmoothModel", ctypes.c_ubyte)]
#
#
# class c_SpectrumCalibrationType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Smoothing", c_SmoothingType),
# ("m_CalInttime", ctypes.c_float), # NOT SURE
# ("m_aCalibConvers", ctypes.c_float * 4096)]
#
#
# class c_SpectrumCorrectionType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_aSpectrumCorrect", ctypes.c_float * 4096)]
#
#
# class c_IrradianceType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_IntensityCalib", c_SpectrumCalibrationType),
# ("m_CalibrationType", ctypes.c_ubyte),
# ("m_FiberDiameter", ctypes.c_uint)]
#
#
# class c_TecControlType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Enable", ctypes.c_bool),
# ("m_Setpoint", ctypes.c_float),
# ("m_aFit", ctypes.c_float * 2)]
#
#
# class c_TempSensorType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_aFit", ctypes.c_float * 5)]
#
#
# class c_TimeStampType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Date", ctypes.c_ushort),
# ("m_Time", ctypes.c_ushort)]
#
#
# class c_TriggerType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Mode", ctypes.c_ubyte),
# ("m_Source", ctypes.c_ubyte),
# ("m_SourceType", ctypes.c_ubyte)]
#
#
# class c_MeasConfigType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_StartPixel", ctypes.c_ushort),
# ("m_StopPixel", ctypes.c_ushort),
# ("m_IntegrationTime", ctypes.c_float),
# ("m_IntegrationDelay", ctypes.c_uint),
# ("m_NrAverages", ctypes.c_uint),
# ("m_CorDynDark", c_DarkCorrectionType),
# ("m_Smoothing", c_SmoothingType),
# ("m_SaturationDetection", ctypes.c_ubyte),
# ("m_Trigger", c_TriggerType),
# ("m_Control", c_ControlSettingsType)]
#
#
# class c_StandaloneType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Enable", ctypes.c_bool),
# ("m_Meas", c_MeasConfigType),
# ("m_Nmsr", ctypes.c_short)]
#
#
# class c_DeviceConfigType(ctypes.Structure): # VERIFIED
#
# _fields_ = [("m_Len", ctypes.c_ushort),
# ("m_ConfigVersion", ctypes.c_ushort),
# ("m_aUserFriendlyId", ctypes.c_char * 64),
# ("m_Detector", c_DetectorType),
# ("m_Irradiance", c_IrradianceType),
# ("m_Reflectance", c_SpectrumCalibrationType),
# ("m_SpectrumCorrect", c_SpectrumCorrectionType),
# ("m_StandAlone", c_StandaloneType),
# ("m_DynamicStorage", c_DynamicStorageType),
# ("m_Temperature", c_TempSensorType * 3),
# ("m_TecControl", c_TecControlType),
# ("m_ProcessControl", c_ProcessControlType),
# ("m_EthernetSettings", c_EthernetSettingsType),
# ("m_aReserved", ctypes.c_ubyte * 13816)]

# %% CallBack Function Object for a better handling of measurments


Expand Down Expand Up @@ -393,7 +206,11 @@ def Callbackfunc(self, Avh_Pointer, int_pointer):
# Get the number of pixels.
logger_ASH.debug("{} : getting nr of pixels.".format(Avh_val))
numPix = ctypes.c_short()
avaspec.AVS_GetNumPixels(Avh_val, numPix)
try:
avaspec.AVS_GetNumPixels(Avh_val, numPix)
except Exception as e:
print(e)
raise e

# Prepare data structures and get pixel values.
logger_ASH.debug("{} : getting values.".format(Avh_val))
Expand Down

0 comments on commit 9d9443d

Please sign in to comment.