pro mxidl case !VERSION.OS_FAMILY of 'MacOS' : defsysv, '!mxidl_library', 'libMxIdl.dylib' 'unix' : defsysv, '!mxidl_library', 'libMxIdl.so' 'vms' : defsysv, '!mxidl_library', 'libMxIdl.olb' 'Windows' : defsysv, '!mxidl_library', 'libMxIdl.dll' endcase rc = call_external( !mxidl_library, 'mxidl_init', /CDECL ) end ;--------------------------------------------------------------------------- function mx_string_to_byte_array, string temp_byte_array = byte( string ) byte_array = [ temp_byte_array, byte(0) ] return, byte_array end ;--------------------------------------------------------------------------- function mx_setup_database, database_filename database_filename_byte_array = mx_string_to_byte_array( database_filename ) mx_database = call_external( !mxidl_library, 'mxidl_setup_database', $ database_filename_byte_array, $ /CDECL, /UL64_VALUE ) return, mx_database end function mx_get_record, mx_database, record_name record_name_byte_array = mx_string_to_byte_array( record_name ) mx_record = call_external( !mxidl_library, 'mxidl_get_record', $ mx_database, record_name_byte_array, $ /CDECL, /UL64_VALUE ) return, mx_record end ;--------------------------------------------------------------------------- function mx_network_field_init, server_record, nf_name nf_datatype = 0L nf_max_dimensions = 8L nf_num_dimensions = 0L nf_array_size = lonarr(nf_max_dimensions) nf_name_byte_array = mx_string_to_byte_array( nf_name ) nf_address = call_external( !mxidl_library, 'mxidl_network_field_init', $ server_record, nf_name_byte_array, $ nf_max_dimensions, nf_datatype, $ nf_num_dimensions, nf_array_size, $ /CDECL, /UL64_VALUE ) if ( nf_num_dimensions eq 0 ) then begin nf_array_size = nf_array_size[0:0] endif else begin nf_array_size = nf_array_size[0:(nf_num_dimensions-1)] endelse nf = { server:server_record, name:nf_name, address:nf_address, $ datatype:nf_datatype, num_dimensions:nf_num_dimensions, $ array_size:nf_array_size } print, "mx_network_field_init: datatype = ", nf.datatype return, nf end ;-------- function mx_get, nf idl_type_string = 7 switch( nf.num_dimensions ) of 0: begin value = 0L break end 1: begin value = lonarr( nf.array_size[0] ) break end else: begin print, "Num dimensions > 1 are not yet supported." end endswitch print, "mx_get: datatype = ", nf.datatype if ( nf.datatype eq idl_type_string ) then begin value = byte( value[0] ) endif else begin value = fix( value, type=nf.datatype ) endelse rc = call_external( !mxidl_library, 'mxidl_get', nf.address, nf.datatype, $ nf.num_dimensions, nf.array_size, value ) return, value end ;-------- pro mx_put, nf, value idl_type_string = 7 if ( nf.datatype eq idl_type_string ) then begin value = mx_string_to_byte_array( value ) endif rc = call_external( !mxidl_library, 'mxidl_put', nf.address, nf.datatype, $ nf.num_dimensions, nf.array_size, value ) end ;--------------------------------------------------------------------------- function mx_area_detector_get_image_format, area_detector image_format = call_external( !mxidl_library, $ 'mxidl_area_detector_get_image_format', $ area_detector, /CDECL ) return, image_format end pro mx_area_detector_set_image_format, area_detector, image_format image_format = long( image_format ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_image_format', $ area_detector, /CDECL ) end ;-------- function mx_area_detector_get_correction_flags, area_detector correction_flags = call_external( !mxidl_library, $ 'mxidl_area_detector_get_correction_flags', $ area_detector, /CDECL ) return, correction_flags end pro mx_area_detector_set_correction_flags, area_detector, correction_flags correction_flags = ulong( correction_flags ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_correction_flags', $ area_detector, /CDECL ) end ;-------- function mx_area_detector_get_sequence_parameters, area_detector sequence_type = 0L num_parameters = 0L parameter_array = dblarr(250) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_get_sequence_parameters', $ area_detector, sequence_type, $ num_parameters, parameter_array, /CDECL ) parameters = { sequence_type:sequence_type, num_parameters:num_parameters, $ parameter_array:parameter_array } return, parameters end ;-------- function mx_area_detector_get_trigger_mode, area_detector trigger_mode = call_external( !mxidl_library, $ 'mxidl_area_detector_get_trigger_mode', $ area_detector, /CDECL ) return, trigger_mode end pro mx_area_detector_set_trigger_mode, area_detector, trigger_mode trigger_mode = long( trigger_mode ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_trigger_mode', $ area_detector, trigger_mode, /CDECL ) end ;-------- function mx_area_detector_get_framesize, area_detector framesize = lonarr(2) rc = call_external( !mxidl_library, 'mxidl_area_detector_get_framesize', $ area_detector, framesize, /CDECL ) return, framesize end function mx_area_detector_get_bytes_per_frame, area_detector bytes_per_frame = call_external( !mxidl_library, $ 'mxidl_area_detector_get_bytes_per_frame', $ area_detector, /CDECL ) return, bytes_per_frame end function mx_area_detector_get_bytes_per_pixel, area_detector bytes_per_pixel = 0.0D rc = call_external( !mxidl_library, $ 'mxidl_area_detector_get_bytes_per_pixel', $ area_detector, bytes_per_pixel, /CDECL ) return, bytes_per_pixel end ;-------- pro mx_area_detector_set_one_shot_mode, area_detector, exposure_time exposure_time = double(exposure_time) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_one_shot_mode', $ area_detector, exposure_time, /CDECL ) end pro mx_area_detector_set_multiframe_mode, area_detector, $ num_frames, exposure_time, frame_time num_frames = long( round(num_frames) ) exposure_time = double( exposure_time ) frame_time = double( frame_time ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_multiframe_mode', $ area_detector, num_frames, exposure_time, $ frame_time, /CDECL ) end pro mx_area_detector_set_strobe_mode, area_detector, $ num_frames, exposure_time num_frames = long( round(num_frames) ) exposure_time = double( exposure_time ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_strobe_mode', $ area_detector, num_frames, exposure_time, $ /CDECL ) end pro mx_area_detector_set_duration_mode, area_detector, num_frames num_frames = long( round(num_frames) ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_duration_mode', $ area_detector, num_frames, /CDECL ) end pro mx_area_detector_set_gated_mode, area_detector, $ num_frames, exposure_time, gate_time num_frames = long( round(num_frames) ) exposure_time = double( exposure_time ) gate_time = double( gate_time ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_set_gated_mode', $ area_detector, num_frames, exposure_time, $ gate_time, /CDECL ) end ;-------- pro mx_area_detector_arm, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_arm', $ area_detector, /CDECL ) end pro mx_area_detector_trigger, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_trigger', $ area_detector, /CDECL ) end pro mx_area_detector_start, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_start', $ area_detector, /CDECL ) end pro mx_area_detector_stop, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_stop', $ area_detector, /CDECL ) end pro mx_area_detector_abort, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_abort', $ area_detector, /CDECL ) end ;-------- function mx_area_detector_get_last_frame_number, area_detector last_frame_number = call_external( !mxidl_library, $ 'mxidl_area_detector_get_last_frame_number', $ area_detector, /CDECL ) return, last_frame_number end function mx_area_detector_get_total_num_frames, area_detector total_num_frames = call_external( !mxidl_library, $ 'mxidl_area_detector_get_total_num_frames', $ area_detector, /CDECL ) return, total_num_frames end function mx_area_detector_get_status, area_detector ad_status = call_external( !mxidl_library, $ 'mxidl_area_detector_get_status', $ area_detector, /CDECL, /UL_VALUE ) return, ad_status end function mx_area_detector_get_extended_status, area_detector extended_status = lonarr( 3 ) rc = call_external( !mxidl_library, $ 'mxidl_area_detector_get_extended_status', $ area_detector, extended_status, /CDECL ) return, extended_status end ;-------- pro mx_area_detector_readout_frame, area_detector, frame_number frame_number = long( frame_number ) rc = call_external( !mxidl_library, 'mxidl_area_detector_readout_frame', $ area_detector, frame_number, /CDECL ) end pro mx_area_detector_correct_frame, area_detector rc = call_external( !mxidl_library, 'mxidl_area_detector_correct_frame', $ area_detector, /CDECL ) end function mx_area_detector_transfer_frame, area_detector, frame_type, image_frame frame_type = long( frame_type ) rc = call_external( !mxidl_library, 'mxidl_area_detector_transfer_frame', $ area_detector, frame_type, image_frame, /CDECL ) return, 0 end ;---------------------------------------------------------------------------