added trigger out
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+519
-33
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "hama.h"
|
||||
// --- includes from DCMAPI ----
|
||||
// #include
|
||||
#include "dcamprop.h"
|
||||
//
|
||||
|
||||
|
||||
@@ -36,12 +36,27 @@ Hama::Hama(const char* portName, int cameraId, int maxBuffers, size_t maxMemory,
|
||||
printf("[DEBUG] === Constructor ADHama ===\n");
|
||||
printf("[DEBUG] driverName: %s\n", driverName);
|
||||
|
||||
createParam( HamaName, asynParamOctet, &hHamaName);
|
||||
createParam( hSensorModeString, asynParamInt32, &hSensorMode);
|
||||
createParam( hReadoutSpeedString, asynParamInt32, &hReadoutSpeed);
|
||||
createParam( hReadoutDirectionString, asynParamInt32, &hReadoutDirection);
|
||||
|
||||
//General
|
||||
|
||||
createParam( HamaName, asynParamOctet, &hHamaName);
|
||||
createParam( hVendorString, asynParamOctet, &hVendor);
|
||||
createParam( hModelString, asynParamOctet, &hModel);
|
||||
createParam( hCameraIDString, asynParamOctet, &hCameraID);
|
||||
createParam( hBusString, asynParamOctet, &hBus);
|
||||
createParam( hCameraVersionString, asynParamOctet, &hCameraVersion);
|
||||
createParam( hDriverVersionString, asynParamOctet, &hDriverVersion);
|
||||
createParam( hModuleVersionString, asynParamOctet, &hModuleVersion);
|
||||
createParam( hDcamApiVersionString, asynParamOctet, &hDcamApiVersion);
|
||||
|
||||
//Sensor Mode and Speed
|
||||
createParam( hSensorModeString, asynParamInt32, &hSensorMode);
|
||||
createParam( hReadoutSpeedString, asynParamInt32, &hReadoutSpeed);
|
||||
createParam( hReadoutDirectionString, asynParamInt32, &hReadoutDirection);
|
||||
|
||||
//Trigger
|
||||
createParam( hTriggerModeString, asynParamInt32, &hTriggerMode);
|
||||
createParam( hTriggerSourceString, asynParamInt32, &hTriggerSource);
|
||||
createParam( hTriggerActiveString, asynParamInt32, &hTriggerActive);
|
||||
createParam( hTriggerGlobalExposureString, asynParamInt32, &hTriggerGlobalExposure);
|
||||
createParam( hTriggerPolarityString, asynParamInt32, &hTriggerPolarity);
|
||||
@@ -50,22 +65,339 @@ Hama::Hama(const char* portName, int cameraId, int maxBuffers, size_t maxMemory,
|
||||
createParam( hTriggerDelayString, asynParamFloat64, &hTriggerDelay);
|
||||
createParam( hInternalTriggerHandlingString, asynParamInt32, &hInternalTriggerHandling);
|
||||
|
||||
createParam( hSensorTemperatureString, asynParamFloat64, &hSensorTemperature);
|
||||
createParam( hSensorCoolerString, asynParamInt32, &hSensorCooler);
|
||||
createParam( hSensorCoolerStatusString, asynParamInt32, &hSensorCoolerStatus);
|
||||
// createParam(
|
||||
//Sensor cooler
|
||||
createParam( hSensorTemperatureString, asynParamFloat64, &hSensorTemperature);
|
||||
createParam( hSensorCoolerString, asynParamInt32, &hSensorCooler);
|
||||
createParam( hSensorCoolerStatusString, asynParamInt32, &hSensorCoolerStatus);
|
||||
|
||||
//Binning and ROI
|
||||
createParam( hBinningString, asynParamInt32, &hBinning);
|
||||
createParam( hSubarrayHPosString, asynParamInt32, &hSubarrayHPos);
|
||||
createParam( hSubarrayHSizeString, asynParamInt32, &hSubarrayHSize);
|
||||
createParam( hSubarrayVPosString, asynParamInt32, &hSubarrayVPos);
|
||||
createParam( hSubarrayVSizeString, asynParamInt32, &hSubarrayVSize);
|
||||
createParam( hSubarrayModeString, asynParamInt32, &hSubarrayMode);
|
||||
|
||||
//Feature
|
||||
createParam( hExposureTimeString, asynParamFloat64, &hExposureTime);
|
||||
|
||||
//ALU
|
||||
createParam( hDefectCorrectModeString, asynParamInt32, &hDefectCorrectMode);
|
||||
createParam( hHotPixelCorrectLevelString, asynParamInt32, &hHotPixelCorrectLevel);
|
||||
createParam( hIntensityLutModeString, asynParamInt32, &hIntensityLutMode);
|
||||
createParam( hIntensityLutPageString, asynParamInt32, &hIntensityLutPage);
|
||||
|
||||
//output trigger
|
||||
createParam( hNumberOfOutputTriggerConnectorString, asynParamInt32, &hNumberOfOutputTriggerConnector);
|
||||
createParam( hOutputTriggerSource0String, asynParamInt32, &hOutputTriggerSource0),
|
||||
createParam( hOutputTriggerSource1String, asynParamInt32, &hOutputTriggerSource1);
|
||||
createParam( hOutputTriggerSource2String, asynParamInt32, &hOutputTriggerSource2);
|
||||
createParam( hOutputTriggerPolarity0String, asynParamInt32, &hOutputTriggerPolarity0);
|
||||
createParam( hOutputTriggerPolarity1String, asynParamInt32, &hOutputTriggerPolarity1);
|
||||
createParam( hOutputTriggerPolarity2String, asynParamInt32, &hOutputTriggerPolarity2);
|
||||
createParam( hOutputTriggerActive0String, asynParamInt32, &hOutputTriggerActive0);
|
||||
createParam( hOutputTriggerActive1String, asynParamInt32, &hOutputTriggerActive1);
|
||||
createParam( hOutputTriggerActive2String, asynParamInt32, &hOutputTriggerActive2);
|
||||
createParam( hOutputTriggerDelay0String, asynParamFloat64, &hOutputTriggerDelay0);
|
||||
createParam( hOutputTriggerDelay1String, asynParamFloat64, &hOutputTriggerDelay1);
|
||||
createParam( hOutputTriggerDelay2String, asynParamFloat64, &hOutputTriggerDelay2);
|
||||
createParam( hOutputTriggerPeriod0String, asynParamFloat64, &hOutputTriggerPeriod0);
|
||||
createParam( hOutputTriggerPeriod1String, asynParamFloat64, &hOutputTriggerPeriod1);
|
||||
createParam( hOutputTriggerPeriod2String, asynParamFloat64, &hOutputTriggerPeriod2);
|
||||
createParam( hOutputTriggerKind0String, asynParamInt32, &hOutputTriggerKind0);
|
||||
createParam( hOutputTriggerKind1String, asynParamInt32, &hOutputTriggerKind1);
|
||||
createParam( hOutputTriggerKind2String, asynParamInt32, &hOutputTriggerKind2);
|
||||
createParam( hOutputTriggerBaseSensor0String, asynParamInt32, &hOutputTriggerBaseSensor0);
|
||||
createParam( hOutputTriggerBaseSensor1String, asynParamInt32, &hOutputTriggerBaseSensor1);
|
||||
createParam( hOutputTriggerBaseSensor2String, asynParamInt32, &hOutputTriggerBaseSensor2);
|
||||
createParam( hOutTriggerPreHsyncCountString, asynParamInt32, &hOutTriggerPreHsyncCount);
|
||||
|
||||
//Master Puls
|
||||
//Synchronious Timing
|
||||
//System Information
|
||||
|
||||
createParam( hColorTypeString, asynParamInt32, &hColorType);
|
||||
createParam( hBitPerChannelString, asynParamInt32, &hBitPerChannel);
|
||||
createParam( hImageWidthString, asynParamInt32, &hImageWidth);
|
||||
createParam( hImageHeightString, asynParamInt32, &hImageHeight);
|
||||
createParam( hImageRowBytesString, asynParamInt32, &hImageRowbytes);
|
||||
createParam( hImageFrameBytesString, asynParamInt32, &hImageFramebytes);
|
||||
createParam( hImageTopOffsetBytesString, asynParamInt32, &hImageTopOffsetBytes);
|
||||
createParam( hImagePixelTypeString, asynParamInt32, &hImagePixelType);
|
||||
createParam( hBufferRowbytesString, asynParamInt32, &hBufferRowbytes);
|
||||
createParam( hBufferFramebytesString, asynParamInt32, &hBufferFramebytes);
|
||||
createParam( hBufferTopOffsetBytesString, asynParamInt32, &hBufferTopOffsetBytes);
|
||||
createParam( hBufferPixelTypeString, asynParamInt32, &hBufferPixelType);
|
||||
createParam( hRecordFixedBytesPerFileString, asynParamInt32, &hRecordFixedBytesPerFile);
|
||||
createParam( hRecordFixedBytesPerSessionString, asynParamInt32, &hRecordFixedBytesPerSession);
|
||||
createParam( hRecordFixedBytesPerFrameString, asynParamInt32, &hRecordFixedBytesPerFrame);
|
||||
createParam( hSystemAliveString, asynParamInt32, &hSystemAlive);
|
||||
createParam( hConversionFactorCoeffString, asynParamFloat64, &hConversionFactorCoeff);
|
||||
createParam( hConversionFactorOffsetString, asynParamFloat64, &hConversionFactorOffset);
|
||||
createParam( hNumberOfViewString, asynParamInt32, &hNumberOfView);
|
||||
createParam( hImageDetectorPixelWidthString, asynParamFloat64, &hImageDetectorPixelWidth);
|
||||
createParam( hImageDetectorPixelHeightString, asynParamFloat64, &hImageDetectorPixelHeight);
|
||||
createParam( hImageDetectorPixelNumHorzString, asynParamInt32, &hImageDetectorPixelNumHorz);
|
||||
createParam( hImageDetectorPixelNumVertString, asynParamInt32, &hImageDetectorPixelNumVert);
|
||||
|
||||
|
||||
connectCamera();
|
||||
|
||||
connectCamera();
|
||||
|
||||
int err = 0;
|
||||
/*
|
||||
err |= getParameter(DCAM_IDPROP_SENSORMODE);
|
||||
err |= getParameter(DCAM_IDPROP_READOUTSPEED);
|
||||
err |= getParameter(DCAM_IDPROP_READOUT_DIRECTION);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGERSOURCE);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGER_MODE);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGERACTIVE);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGER_GLOBALEXPOSURE);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGERPOLARITY);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGER_CONNECTOR);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGERTIMES);
|
||||
err |= getParameter(DCAM_IDPROP_TRIGGERDELAY);
|
||||
err |= getParameter(DCAM_IDPROP_INTERNALTRIGGER_HANDLING);
|
||||
*/
|
||||
|
||||
err |= getParameterStr(DCAM_IDSTR_VENDOR);
|
||||
err |= getParameterStr(DCAM_IDSTR_MODEL);
|
||||
err |= getParameterStr(DCAM_IDSTR_CAMERAID);
|
||||
err |= getParameterStr(DCAM_IDSTR_BUS);
|
||||
err |= getParameterStr(DCAM_IDSTR_CAMERAVERSION);
|
||||
err |= getParameterStr(DCAM_IDSTR_DRIVERVERSION);
|
||||
err |= getParameterStr(DCAM_IDSTR_MODULEVERSION);
|
||||
err |= getParameterStr(DCAM_IDSTR_DCAMAPIVERSION);
|
||||
|
||||
printf("[DEBUG] Error = %d\n", err);
|
||||
printf("[DEBUG] === END Constructor ADHama ===\n");
|
||||
}
|
||||
//============================================================================
|
||||
Hama::~Hama(){
|
||||
// not sure if the destructor has to be define here...
|
||||
printf("[DEBUG] === Destructor ADHama ===\n");
|
||||
//Hama::~Hama(){
|
||||
// // not sure if the destructor has to be define here...
|
||||
// printf("[DEBUG] === Destructor ADHama ===\n");
|
||||
//}
|
||||
|
||||
//============================================================================
|
||||
int Hama::getParameterStr(int propertyID){
|
||||
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
char text[256];
|
||||
DCAMDEV_STRING param;
|
||||
memset( ¶m, 0, sizeof(param) );
|
||||
param.size = sizeof(param);
|
||||
param.text = text;
|
||||
param.textbytes = sizeof(text);
|
||||
param.iString = propertyID;
|
||||
|
||||
switch (propertyID){
|
||||
case DCAM_IDSTR_VENDOR:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hVendor, text);
|
||||
printf("[DEBUG]::VENDOR %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_MODEL:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hModel, text);
|
||||
printf("[DEBUG]::MODEL %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_CAMERAID:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hCameraID, text);
|
||||
printf("[DEBUG]::CAMERAID %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_BUS:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hBus, text);
|
||||
printf("[DEBUG]::BUS %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_CAMERAVERSION:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hCameraVersion, text);
|
||||
printf("[DEBUG]::CAMERAVERSION %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_DRIVERVERSION:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hDriverVersion, text);
|
||||
printf("[DEBUG]::DRIVERVERSION %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_MODULEVERSION:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hModuleVersion, text);
|
||||
printf("[DEBUG]::MODULEVERSION %s\n", text);
|
||||
break;
|
||||
case DCAM_IDSTR_DCAMAPIVERSION:
|
||||
dcamdev_getstring(m_hdcam, ¶m);
|
||||
status = setStringParam(hDcamApiVersion, text);
|
||||
printf("[DEBUG]::DCAMPVERSION %s\n", text);
|
||||
break;
|
||||
default:
|
||||
printf("[DEBUG]::NOT SUPPORTED\n");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* Do callbacks so higher layers see any changes */
|
||||
status = (asynStatus) callParamCallbacks();
|
||||
|
||||
// asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: port=%s, value=%d, status=%d\n",
|
||||
// driverName, functionName, this->portName, value, (int)status);
|
||||
return int(status);
|
||||
}
|
||||
//============================================================================
|
||||
int Hama::getParameter(int propertyID){
|
||||
printf("\n[DEBUG] Function:getProperty\n");
|
||||
|
||||
double value = 0;
|
||||
dcamprop_getvalue(m_hdcam, propertyID, &value);
|
||||
|
||||
switch (propertyID){
|
||||
case DCAM_IDPROP_SENSORMODE:
|
||||
printf("The SENSOR MODE = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_READOUTSPEED:
|
||||
printf("The READOUT SPEED = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_READOUT_DIRECTION:
|
||||
printf("The READOUT DIRECTION = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGERSOURCE:
|
||||
printf("The = TRIGGER SOURCE = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGER_MODE:
|
||||
printf("The TRIGGER MODE = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGERACTIVE:
|
||||
printf("The TRIGGER ACTIVE = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGER_GLOBALEXPOSURE:
|
||||
printf("The TRIGGER GLOBAL EXPOSURE = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGERPOLARITY:
|
||||
printf("The TRIGGER POLARITY = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGER_CONNECTOR:
|
||||
printf("The TRIGGER CONNECTOR = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGERTIMES:
|
||||
printf("The TRIGGER TIMES = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_TRIGGERDELAY:
|
||||
printf("The TRIGGER DELAY = %f\n", value);
|
||||
break;
|
||||
|
||||
case DCAM_IDPROP_INTERNALTRIGGER_HANDLING:
|
||||
printf("The INTERNAL TRIGGE HANDLING = %f\n", value);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("The = %f\n", value);
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int Hama::setParameter(int paramIndex){
|
||||
/*
|
||||
setIntegerParam(ADBinY, 2048);
|
||||
setIntegerParam(ADBinX, 2048);
|
||||
setIntegerParam(NDNDimensions, 1);
|
||||
setIntegerParam(NDArrayCounter, 1);
|
||||
setIntegerParam(NDDataType, NDUInt16);
|
||||
setIntegerParam(NDColorMode, NDColorModeMono);
|
||||
setIntegerParam(NDArraySizeZ, 0);
|
||||
setIntegerParam(NDArraySize, 5000000);
|
||||
setStringParam(ADStringToServer, "<not used by driver>");
|
||||
setStringParam(ADStringFromServer, "<not used by driver>");
|
||||
setStringParam(ADManufacturer, "Hamamatsu");
|
||||
*/
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
int Hama::getProperties(){
|
||||
printf("\n[DEBUG] Function:getProperties\n");
|
||||
|
||||
int32 iProp = 0; // property IDs
|
||||
|
||||
double value = 50;
|
||||
dcamprop_getvalue(m_hdcam, DCAM_IDPROP_SENSORTEMPERATURE, &value);
|
||||
printf("The SENSOR TEMPERATURE = %f\n", value);
|
||||
|
||||
DCAMERR err;
|
||||
err = dcamprop_getnextid( m_hdcam, &iProp, DCAMPROP_OPTION_SUPPORT );
|
||||
if( failed(err) ) {
|
||||
printError( m_hdcam, err, "dcamprop_getnextid()", "IDPROP:0x%08x, OPTION:SUPPORT", 0 );
|
||||
return err;
|
||||
}
|
||||
|
||||
do{
|
||||
// get property name
|
||||
char text[ 64 ];
|
||||
err = dcamprop_getname( m_hdcam, iProp, text, sizeof(text) );
|
||||
if( failed(err) ) {
|
||||
printError( m_hdcam, err, "dcamprop_getname()", "IDPROP:0x%08x", iProp );
|
||||
return err;
|
||||
}
|
||||
|
||||
printf( "0x%08x: %s\n", iProp, text );
|
||||
|
||||
// get property attribute
|
||||
DCAMPROP_ATTR basepropattr;
|
||||
memset( &basepropattr, 0, sizeof(basepropattr) );
|
||||
basepropattr.cbSize = sizeof(basepropattr);
|
||||
basepropattr.iProp = iProp;
|
||||
|
||||
err = dcamprop_getattr( m_hdcam, &basepropattr );
|
||||
if( !failed(err) ) {
|
||||
|
||||
#if SHOW_PROPERTY_ATTRIBUTE
|
||||
// show property attribute
|
||||
//dcamcon_show_propertyattr( basepropattr );
|
||||
#endif
|
||||
|
||||
#if SHOW_PROPERTY_MODEVALUELIST
|
||||
// show mode value list of property
|
||||
//if( (basepropattr.attribute & DCAMPROP_TYPE_MASK) == DCAMPROP_TYPE_MODE )
|
||||
// dcamcon_show_supportmodevalues( m_hdcam, iProp, basepropattr.valuemin );
|
||||
#endif
|
||||
|
||||
#if SHOW_PROPERTY_ARRAYELEMENT
|
||||
// show array element
|
||||
//if( basepropattr.attribute2 & DCAMPROP_ATTR2_ARRAYBASE )
|
||||
// dcamcon_show_arrayelement( m_hdcam, basepropattr );
|
||||
#endif
|
||||
}
|
||||
|
||||
// get next property id
|
||||
err = dcamprop_getnextid( m_hdcam, &iProp, DCAMPROP_OPTION_SUPPORT );
|
||||
if( failed(err) ) {
|
||||
// no more supported property id
|
||||
return err;
|
||||
}
|
||||
|
||||
} while( iProp != 0 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
//============================================================================
|
||||
|
||||
asynStatus Hama::writeInt32(asynUser *pasynUser, epicsInt32 value){
|
||||
@@ -76,42 +408,82 @@ asynStatus Hama::writeInt32(asynUser *pasynUser, epicsInt32 value){
|
||||
int function = pasynUser->reason;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
// getParamName(index, ¶mName);
|
||||
printf("[DEBUG]::writeInt32\t");
|
||||
|
||||
if (function == hSensorMode) {
|
||||
//set_integration_time();
|
||||
getParamName(function, ¶mName);
|
||||
|
||||
|
||||
if (function == ADAcquire) {
|
||||
printf("function ADAcquire\n");
|
||||
}
|
||||
else if (function == ADImageMode) {
|
||||
printf("function ADImageMode\n");
|
||||
}
|
||||
else if (function == ADTriggerMode) {
|
||||
printf("function ADTriggerMode\n");
|
||||
}
|
||||
else if (function == ADNumExposures) {
|
||||
printf("function ADNumExposures\n");
|
||||
}
|
||||
else if (function == ADMinX) {
|
||||
printf("function ADMinX\n");
|
||||
}
|
||||
else if (function == ADMinY) {
|
||||
printf("function ADMinY\n");
|
||||
}
|
||||
else if (function == ADSizeX) {
|
||||
printf("function ADSizeX\n");
|
||||
}
|
||||
else if (function == ADSizeY) {
|
||||
printf("function ADSizeY\n");
|
||||
}
|
||||
else if (function == ADReadStatus) {
|
||||
printf("function ADReadStatus\n");
|
||||
}
|
||||
else if (function == hSensorMode) {
|
||||
setIntegerParam(function, value);
|
||||
printf("function SensorMode\n");
|
||||
}
|
||||
else if (function == hReadoutSpeed) {
|
||||
printf("function ReadoutSpeed\n");
|
||||
|
||||
}
|
||||
else if (function == hReadoutDirection) {
|
||||
// Update the calculated spectrum
|
||||
//update_data_spectrum();
|
||||
printf("function ReadoutDirection\n");
|
||||
}
|
||||
else if (function == hColorType) {
|
||||
// Check if implmemented in QEPro
|
||||
printf("function ColorType\n");
|
||||
}
|
||||
else if (function == hBitPerChannel) {
|
||||
// Check if implmemented in QEPro
|
||||
printf("function BitPerChannel\n");
|
||||
}
|
||||
else if (function == hTriggerSource) {
|
||||
//getIntegerParam(P_triggerMode, &triggerMode);
|
||||
//api->spectrometerSetTriggerMode( device_id, spectrometer_feature_id, &error, triggerMode);
|
||||
printf("function TriggerSorce\n");
|
||||
double value_d = 0;
|
||||
getIntegerParam(function, &value);
|
||||
printf("value = %d, value_d = %f\n", value, value_d);
|
||||
dcamprop_setvalue(m_hdcam, DCAM_IDPROP_TRIGGERSOURCE, value);
|
||||
dcamprop_getvalue(m_hdcam, DCAM_IDPROP_TRIGGERSOURCE, &value_d);
|
||||
printf("value = %d, value_d = %f\n", value, value_d);
|
||||
setIntegerParam(function, value_d);
|
||||
}
|
||||
else{
|
||||
printf("function ELSE.... \n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Do callbacks so higher layers see any changes */
|
||||
status = (asynStatus) callParamCallbacks();
|
||||
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER, "%s:%s: port=%s, value=%d, status=%d\n",
|
||||
driverName, functionName, this->portName, value, (int)status);
|
||||
if (status)
|
||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||
"%s:%s: error, status=%d function=%d, paramName=%s, value=%d\n",
|
||||
driverName, functionName, status, function, paramName, value);
|
||||
else
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: function=%d, paramName=%s, value=%d\n",
|
||||
driverName, functionName, function, paramName, value);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -120,23 +492,137 @@ return status;
|
||||
|
||||
asynStatus Hama::writeFloat64(asynUser *pasynUser, epicsFloat64 value){
|
||||
|
||||
printf("[DEBUG]::writeFloat64\t");
|
||||
const char* functionName = "writeFloat64";
|
||||
const char *paramName;
|
||||
|
||||
int function = pasynUser->reason;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
|
||||
getParamName(function, ¶mName);
|
||||
|
||||
setDoubleParam(function, value);
|
||||
|
||||
status = (asynStatus) callParamCallbacks();
|
||||
|
||||
if (status)
|
||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||
"%s:%s: error, status=%d function=%d, paramName=%s, value=%f\n",
|
||||
driverName, functionName, status, function, paramName, value);
|
||||
else
|
||||
asynPrint(pasynUser, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: function=%d, paramName=%s, value=%f\n",
|
||||
driverName, functionName, function, paramName, value);
|
||||
|
||||
|
||||
|
||||
return(asynSuccess);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
asynStatus Hama::readEnum(asynUser *pasynUser, char *strings[], int values[],
|
||||
int severities[], size_t nElements, size_t *nIn){
|
||||
|
||||
|
||||
printf("[DEBUG]::readEnum\t");
|
||||
const char* functionName = "readEnum";
|
||||
const char *paramName;
|
||||
|
||||
int function = pasynUser->reason;
|
||||
asynStatus status = asynSuccess;
|
||||
|
||||
|
||||
getParamName(function, ¶mName);
|
||||
|
||||
|
||||
double value = 0;
|
||||
dcamprop_getvalue(m_hdcam, function, &value);
|
||||
|
||||
// dcamprop_setvalue(m_hdcam, function, value);
|
||||
|
||||
if (function == hSensorMode) {
|
||||
printf("function Sensor Mode\n");
|
||||
}
|
||||
else if (function == hReadoutDirection) {
|
||||
printf("function Readout Direction\n");
|
||||
}
|
||||
else if (function == hTriggerSource) {
|
||||
printf("function Trigger Source\n");
|
||||
dcamprop_getvalue(m_hdcam, DCAM_IDPROP_TRIGGERSOURCE, &value);
|
||||
setIntegerParam(function, value);
|
||||
|
||||
}
|
||||
else if (function == hTriggerMode) {
|
||||
printf("function Trigger Mode\n");
|
||||
}
|
||||
else if (function == hTriggerActive) {
|
||||
printf("function Trigger Active\n");
|
||||
}
|
||||
else if (function == hTriggerGlobalExposure) {
|
||||
printf("function Trigger Global Exposure\n");
|
||||
}
|
||||
else if (function == hTriggerPolarity) {
|
||||
printf("function Trigger Polarity\n");
|
||||
}
|
||||
else if (function == hTriggerConnector) {
|
||||
printf("function TriggerConnector\n");
|
||||
}
|
||||
else if (function == hInternalTriggerHandling) {
|
||||
printf("function Internal Trigger Handling\n");
|
||||
}
|
||||
else if (function == hSensorCooler) {
|
||||
printf("function Sensor Cooler\n");
|
||||
}
|
||||
else if (function == hSensorCoolerStatus){
|
||||
printf("function Sensor Cooler Status\n");
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////
|
||||
else if (function == hColorType) {
|
||||
printf("function Color Type\n");
|
||||
}
|
||||
else if (function == hImagePixelType) {
|
||||
printf("function Image Pixel Type\n");
|
||||
}
|
||||
else if (function == hBufferPixelType) {
|
||||
printf("function Buffer Pixel Type\n");
|
||||
}
|
||||
else if (function == hSystemAlive) {
|
||||
printf("function System Alive\n");
|
||||
}
|
||||
else if (function == hTimeStampProducer) {
|
||||
printf("function Time Stamp Producer\n");
|
||||
}
|
||||
else if (function == hFrameStampProducer) {
|
||||
printf("function Frame Stamp producer\n");
|
||||
}
|
||||
// else if (function == ) {
|
||||
// printf("function \n");
|
||||
// }
|
||||
// else if (function == ) {
|
||||
// printf("function \n");
|
||||
// }
|
||||
// else if (function == ) {
|
||||
// printf("function \n");
|
||||
// }
|
||||
else {
|
||||
printf("function ELSE....\n");
|
||||
}
|
||||
*nIn = 0;
|
||||
|
||||
status = (asynStatus) callParamCallbacks();
|
||||
|
||||
asynPrint(pasynUserSelf, ASYN_TRACEIO_DRIVER,
|
||||
"%s:%s: entry, function=%d, string=%s\n", driverName, functionName, function, strings[0]);
|
||||
|
||||
return(asynSuccess);
|
||||
}
|
||||
|
||||
*/
|
||||
//============================================================================
|
||||
|
||||
void Hama::report(FILE *fp, int details){
|
||||
|
||||
printf("[DEBUG]::report\n");
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@@ -204,7 +690,7 @@ int Hama::disconnectCamera(void){
|
||||
|
||||
static const char *functionName = "disconnectCamera";
|
||||
|
||||
int status;
|
||||
int status = 0;
|
||||
|
||||
|
||||
if(m_hdcam == NULL) {
|
||||
@@ -260,7 +746,7 @@ void Hama::printError(HDCAM hdcam, DCAMERR errid, const char* apiname, const cha
|
||||
DCAMERR err;
|
||||
dcamdev_string( err, hdcam, errid, errtext, sizeof(errtext) );
|
||||
|
||||
printf( "FAILED: (DCAMERR)0x%08X %s @ %s", errid, errtext, apiname );
|
||||
printf( "-[ERROR]- (DCAMERR) 0x%08X %s @ %s", errid, errtext, apiname );
|
||||
|
||||
if( fmt != NULL ) {
|
||||
printf( " : " );
|
||||
|
||||
+84
-68
@@ -6,58 +6,66 @@
|
||||
|
||||
|
||||
|
||||
#define HamaName "Name" /* asynOctet ro */
|
||||
#define hFrameRateString "H_FRAME_RATE" /* asynOctet ro */
|
||||
#define hFrameRateString "H_FRAME_RATE" /* asynOctet ro */
|
||||
#define HamaName "Name" /* asynOctet ro */
|
||||
#define hVendorString "H_VENDOR" /* asynOctet ro */
|
||||
#define hModelString "H_MODEL" /* asynOctet ro */
|
||||
#define hCameraIDString "H_CAMERAID" /* asynOctet ro */
|
||||
#define hBusString "H_BUS" /* asynOctet ro */
|
||||
#define hCameraVersionString "H_CAMERA_VERSION" /* asynOctet ro */
|
||||
#define hDriverVersionString "H_DRIVER_VERSION" /* asynOctet ro */
|
||||
#define hModuleVersionString "H_MODULE_VERSION" /* asynOctet ro */
|
||||
#define hDcamApiVersionString "H_DCAM_API_VERSION" /* asynOctet ro */
|
||||
|
||||
// Sensor mode and speed
|
||||
#define hSensorModeString "H_SENSOR_MODE" /* asynint32 rw */
|
||||
#define hReadoutSpeedString "H_READOUT_SPEED" /* asynInt32 rw */
|
||||
#define hReadoutDirectionString "H_READOUT_DIRECTION" /* asynInt32 rw */
|
||||
#define hSensorModeString "H_SENSOR_MODE" /* asynint32 rw */
|
||||
#define hReadoutSpeedString "H_READOUT_SPEED" /* asynInt32 rw */
|
||||
#define hReadoutDirectionString "H_READOUT_DIRECTION" /* asynIekt32 rw */
|
||||
|
||||
// Trigger
|
||||
#define hTriggerSourceString "H_TRIGGER_SOURCE" /* asynInt32 rw */
|
||||
#define hTriggerModeString "H_TRIGGER_MODE" /* asynInt32 rw */
|
||||
#define hTriggerActiveString "H_TRIGGER_ACTIVE" /* asynInt32 rw */
|
||||
#define hTriggerGlobalExposureString "H_TRIGGER_GLOBAR_EXPOSURE" /* asynInt32 rw */
|
||||
#define hTriggerPolarityString "H_TRIGGER_POLARITY" /* asynInt32 rw */
|
||||
#define hTriggerConnectorString "H_TRIGGER_CONNECTOR" /* asynInt32 rw */
|
||||
#define hTriggerTimesString "H_TRIGGER_TIMES" /* asynInt32 rw */
|
||||
#define hTriggerDelayString "H_TRIGGER_DELAY" /* asynFloat64 rw */
|
||||
#define hInternalTriggerHandlingString "H_INTERNAL_TRIGGER_HANDLING" /* asynInt32 rw */
|
||||
#define hTriggerSourceString "H_TRIGGER_SOURCE" /* asynInt32 rw */
|
||||
#define hTriggerModeString "H_TRIGGER_MODE" /* asynInt32 rw */
|
||||
#define hTriggerActiveString "H_TRIGGER_ACTIVE" /* asynInt32 rw */
|
||||
#define hTriggerGlobalExposureString "H_TRIGGER_GLOBAL_EXPOSURE" /* asynInt32 rw */
|
||||
#define hTriggerPolarityString "H_TRIGGER_POLARITY" /* asynInt32 rw */
|
||||
#define hTriggerConnectorString "H_TRIGGER_CONNECTOR" /* asynInt32 rw */
|
||||
#define hTriggerTimesString "H_TRIGGER_TIMES" /* asynInt32 rw */
|
||||
#define hTriggerDelayString "H_TRIGGER_DELAY" /* asynFloat64 rw */
|
||||
#define hInternalTriggerHandlingString "H_INTERNAL_TRIGGER_HANDLING" /* asynInt32 rw */
|
||||
|
||||
// Sensor cooler
|
||||
#define hSensorTemperatureString "H_SENSOR_TEMPERATURE" /* asynFloat64 ro */
|
||||
#define hSensorCoolerString "H_SENSOR_COOLER" /* asynInt32 rw */
|
||||
#define hSensorCoolerString "H_SENSOR_COOLER" /* asynInt32 rw */
|
||||
#define hSensorCoolerStatusString "H_SENSOR_COOLER_STATUS" /* asynInt32 ro */
|
||||
|
||||
// Binning and ROI
|
||||
#define hBinningString "H_BINNING" /* asynInt32 rw */
|
||||
#define hSubarrayHPosString "H_SUBARRAY_HPOST" /* asynInt32 rw */
|
||||
#define hSubarrayHSizeString "H_SUBARRAY_HSIZE" /* asynInt32 rw */
|
||||
#define hSubarrayVPosString "H_SUBARRAY_VPOS" /* asynInt32 rw */
|
||||
#define hSubarrayVSizeString "H_SUBARRAY_VPOS" /* asynInt32 rw */
|
||||
#define hSubarrayModeString "H_SUBARRAY_MODE" /* asynInt32 rw */
|
||||
#define hBinningString "H_BINNING" /* asynInt32 rw */
|
||||
#define hSubarrayHPosString "H_SUBARRAY_HPOST" /* asynInt32 rw */
|
||||
#define hSubarrayHSizeString "H_SUBARRAY_HSIZE" /* asynInt32 rw */
|
||||
#define hSubarrayVPosString "H_SUBARRAY_VPOS" /* asynInt32 rw */
|
||||
#define hSubarrayVSizeString "H_SUBARRAY_VPOS" /* asynInt32 rw */
|
||||
#define hSubarrayModeString "H_SUBARRAY_MODE" /* asynInt32 rw */
|
||||
// #define hFrameBundleMode (usb3 only not implemented)
|
||||
// #define hFrameBundleNumber (usb3 only not implemented)
|
||||
|
||||
// Feature
|
||||
#define hExposureTimeString "H_EXPOSURE_TIME" /* asynFloat64 rw */
|
||||
#define hExposureTimeString "H_EXPOSURE_TIME" /* asynFloat64 rw */
|
||||
|
||||
// ALU
|
||||
#define hDefectCorrectModeString "H_DEFECT_CORRECT_MODE" /* asynInt32 rw */
|
||||
#define hHotPixelCorrectLevelString "H_HOT_PIXEL_CORRECT_LEVEL" /* asynInt32 rw */
|
||||
#define hIntensityLutModeString "H_INTENSITY_LUT_MODE" /* asynInt32 rw */
|
||||
#define hIntensityLutPageString "H_INTENSITY_LUT_PAGE" /* asynInt32 ro */
|
||||
#define hExtractionModeString "H_EXTRACTION_MODE" /* asynInt32 ro */
|
||||
#define hExtractionModeString "H_EXTRACTION_MODE" /* asynInt32 ro */
|
||||
|
||||
// output trigger
|
||||
#define hNumberOfOutputTriggerConnectorsString "H_NUMBER_OUTPUT_TRIGGER_CONNECTORS" /* asynInt32 ro */
|
||||
#define hNumberOfOutputTriggerConnectorString "H_NUMBER_OUTPUT_TRIGGER_CONNECTOR" /* asynInt32 ro */
|
||||
#define hOutputTriggerSource0String "H_OUTPUT_TRIGGER_SOURCE0" /* asynInt32 rw */
|
||||
#define hOutputTriggerSource1String "H_OUTPUT_TRIGGER_SOURCE1" /* asynInt32 rw */
|
||||
#define hOutputTriggerSource2String "H_OUTPUT_TRIGGER_SOURCE2" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity0String "H_OUTPUT_TRIGGER_POLARITY0" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity1String "H_OUTPUT_TRIGGER_POLARITY1" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity2String "H_OUTPUT_TRIGGER_POLARITY2" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity0String "H_OUTPUT_TRIGGER_POLARITY0" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity1String "H_OUTPUT_TRIGGER_POLARITY1" /* asynInt32 rw */
|
||||
#define hOutputTriggerPolarity2String "H_OUTPUT_TRIGGER_POLARITY2" /* asynInt32 rw */
|
||||
#define hOutputTriggerActive0String "H_OUTPUT_TRIGGER_ACTIVE0" /* asynInt32 ro */
|
||||
#define hOutputTriggerActive1String "H_OUTPUT_TRIGGER_ACTIVE1" /* asynInt32 ro */
|
||||
#define hOutputTriggerActive2String "H_OUTPUT_TRIGGER_ACTIVE2" /* asynInt32 ro */
|
||||
@@ -70,56 +78,54 @@
|
||||
#define hOutputTriggerKind0String "H_OUTPUT_TRIGGER_KIND0" /* asynInt32 rw */
|
||||
#define hOutputTriggerKind1String "H_OUTPUT_TRIGGER_KIND1" /* asynInt32 rw */
|
||||
#define hOutputTriggerKind2String "H_OUTPUT_TRIGGER_KIND2" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor0String "H_OUTPUT_TRIGGER_BASE_SENSOR0" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor1String "H_OUTPUT_TRIGGER_BASE_SENSOR1" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor2String "H_OUTPUT_TRIGGER_BASE_SENSOR2" /* asynInt32 rw */
|
||||
#define hOutTriggerPreHsyncCountString "H_OUTPUT_TRIGGER_PRE_HSYNC_COUNT" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor0String "H_OUTPUT_TRIGGER_BASE_SENSOR0" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor1String "H_OUTPUT_TRIGGER_BASE_SENSOR1" /* asynInt32 rw */
|
||||
#define hOutputTriggerBaseSensor2String "H_OUTPUT_TRIGGER_BASE_SENSOR2" /* asynInt32 rw */
|
||||
#define hOutTriggerPreHsyncCountString "H_OUTPUT_TRIGGER_PRE_HSYNC_COUNT" /* asynInt32 rw */
|
||||
|
||||
// Master Puls
|
||||
#define hMasterPulseModeString "H_MASTERPULSE_MODE" /* asynInt32 rw */
|
||||
#define hMasterPulseTriggerSourceString "H_MASTERPULSE_TRIGGER_SOURCE" /* asynInt32 rw */
|
||||
#define hMasterPulseTriggerSourceString "H_MASTERPULSE_TRIGGER_SOURCE" /* asynInt32 rw */
|
||||
#define hMasterPulseIntervalString "H_MASTERPULSE_INTERVAL" /* asynFloat64 rw */
|
||||
#define hMasterPulseBurstTimesString "H_MASTERPULSE_BURST_TIMES" /* asynInt32 rw */
|
||||
#define hMasterPulseBurstTimesString "H_MASTERPULSE_BURST_TIMES" /* asynInt32 rw */
|
||||
|
||||
// Synchronious Timing
|
||||
#define hTimingReadoutTimeString "H_TIMING_READOUT_TIME" /* asynFloat64 ro */
|
||||
#define hTimingCyclicTriggerPeriodString "H_TIMING_CYCLIC_TRIGGER_PERIOD" /* asynFloat64 ro */
|
||||
#define hTimingMinTriggerBlankingString "H_TIMING_MIN_TRIGGER_BLANKING" /* asynFloat64 ro */
|
||||
#define hTimingMinTriggerIntervalString "H_TIMING_MIN_TRIGGER_INTERVAL" /* asynFloat64 ro */
|
||||
#define hTimingGlobalExposureDelayString "H_TIMING_GLOBAL_EXPOSURE_DELAY" /* asynFloat64 ro */
|
||||
#define hTimingCyclicTriggerPeriodString "H_TIMING_CYCLIC_TRIGGER_PERIOD" /* asynFloat64 ro */
|
||||
#define hTimingMinTriggerBlankingString "H_TIMING_MIN_TRIGGER_BLANKING" /* asynFloat64 ro */
|
||||
#define hTimingMinTriggerIntervalString "H_TIMING_MIN_TRIGGER_INTERVAL" /* asynFloat64 ro */
|
||||
#define hTimingGlobalExposureDelayString "H_TIMING_GLOBAL_EXPOSURE_DELAY" /* asynFloat64 ro */
|
||||
#define hTimingExposureString "H_TIMING_EXPOSURE" /* asynInt32 ro */
|
||||
#define hTimingInvalidExposurePeriodString "H_TIMING_INVALID_EXPOSURE_PERIOD" /* asynFloat64 ro */
|
||||
#define hInternalFrameRateString "H_INTERNAL_FRAME_RATE" /* asynFloat64 rw */
|
||||
#define hInternalFrameIntervalString "H_INTERNAL_FRAME_INTERVAL" /* asynFloat64 rw */
|
||||
#define hInternalLineSpeedString "H_INTERNAL_LINE_SPEED" /* asynFloat64 rw */
|
||||
#define hInternalLineIntervalString "H_INTERNAL_LINE_INTERVAL" /* asynFloat64 rw */
|
||||
#define hInternalFrameRateString "H_INTERNAL_FRAME_RATE" /* asynFloat64 rw */
|
||||
#define hInternalFrameIntervalString "H_INTERNAL_FRAME_INTERVAL" /* asynFloat64 rw */
|
||||
#define hInternalLineSpeedString "H_INTERNAL_LINE_SPEED" /* asynFloat64 rw */
|
||||
#define hInternalLineIntervalString "H_INTERNAL_LINE_INTERVAL" /* asynFloat64 rw */
|
||||
|
||||
// System information
|
||||
#define hColorTypeString "H_COLOR_TYPE" /* asynInt32 ro */
|
||||
#define hBitPerChannelString "H_BIT_PER_CHANNEL" /* asynInt32 rw */
|
||||
#define hImageWidthString "H_IMAGE_WIDTH" /* asynInt32 ro */
|
||||
#define hImageHeightString "H_IMAGE_HEIGHT" /* asynInt32 ro */
|
||||
#define hColorTypeString "H_COLOR_TYPE" /* asynInt32 ro */
|
||||
#define hBitPerChannelString "H_BIT_PER_CHANNEL" /* asynInt32 rw */
|
||||
#define hImageWidthString "H_IMAGE_WIDTH" /* asynInt32 ro */
|
||||
#define hImageHeightString "H_IMAGE_HEIGHT" /* asynInt32 ro */
|
||||
#define hImageRowBytesString "H_IMAGE_ROWBYTES" /* asynInt32 ro */
|
||||
#define hImageFrameBytesString "H_IMAGE_FRAMEBYTES" /* asynInt32 ro */
|
||||
#define hImageTopOffsetBytesString "H_IMAGE_TOP_OFFSETBYTES" /* asynInt32 ro */
|
||||
#define hImagePixelTypeString "H_IMAGE_PIXEL_TYPE" /* asynInt32 rw */
|
||||
#define hImageFrameBytesString "H_IMAGE_FRAMEBYTES" /* asynInt32 ro */
|
||||
#define hImageTopOffsetBytesString "H_IMAGE_TOP_OFFSETBYTES" /* asynInt32 ro */
|
||||
#define hImagePixelTypeString "H_IMAGE_PIXEL_TYPE" /* asynInt32 rw */
|
||||
#define hBufferRowbytesString "H_BUFFER_ROWBYTES" /* asynInt32 ro */
|
||||
#define hBufferFramebytesString "H_BUFFER_FRAMEBYTES" /* asynInt32 ro */
|
||||
#define hBufferTopOffsetBytesString "H_BUFFER_TOP_OFFSETBYTES" /* asynInt32 ro */
|
||||
#define hBufferPixelTypeString "H_BUFFER_PIXEL_TYPE" /* asynInt32 ro */
|
||||
#define hRecordFixedBytesPerFileString "H_RECORD_FIXED_BYTES_PER_FILE" /* asynInt32 ro */
|
||||
#define hBufferFramebytesString "H_BUFFER_FRAMEBYTES" /* asynInt32 ro */
|
||||
#define hBufferTopOffsetBytesString "H_BUFFER_TOP_OFFSETBYTES" /* asynInt32 ro */
|
||||
#define hBufferPixelTypeString "H_BUFFER_PIXEL_TYPE" /* asynInt32 ro */
|
||||
#define hRecordFixedBytesPerFileString "H_RECORD_FIXED_BYTES_PER_FILE" /* asynInt32 ro */
|
||||
#define hRecordFixedBytesPerSessionString "H_RECORD_FIXED_BYTES_PER_SESION" /* asynInt32 ro */
|
||||
#define hRecordFixedBytesPerFrameString "H_RECORD_FIXED_BYTES_PER_FRAME" /* asynInt32 ro */
|
||||
#define hSystemAliveString "H_SYSTEM_ALIVE" /* asynInt32 ro */
|
||||
#define hConversionFactorCoeffString "H_CONVERSION_FACTOR_COEF" /* asynFloat64 ro */
|
||||
#define hConversionFactorOffsetString "H_CONVERSION_FACTOR_OFFSET" /* asynFloat64 ro */
|
||||
#define hNumberOfViewString "H_NUMBER_OF_VIEW" /* asynInt32 ro */
|
||||
#define hImageDetectorPixelWidthString "H_IMAGE_DETECTOR_PIXEL_WIDTH" /* asynFloat64 ro */
|
||||
#define hImageDetectorPixelHeightString "H_IMAGE_DETECTOR_PIXEL_HEIGHT" /* asynFloat64 ro */
|
||||
#define hImageDetectorPixelNumHorzString "H_IMAGE_DETECTOR_PIXEL_NUM_HORZ" /* asynInt32 ro */
|
||||
#define hImageDetectorPixelNumVertString "H_IMAGE_DETECTOR_PIXEL_NUM_VERT" /* asynInt32 ro */
|
||||
#define hTimeStampProducerString "H_TIMESTAMP_PRODUCER" /* asynInt32 ro */
|
||||
#define hFrameStampProducerString "H_FRAMESTAMP_PRODUCER" /* asynInt32 ro */
|
||||
#define hRecordFixedBytesPerFrameString "H_RECORD_FIXED_BYTES_PER_FRAME" /* asynInt32 ro */
|
||||
#define hSystemAliveString "H_SYSTEM_ALIVE" /* asynInt32 ro */
|
||||
#define hConversionFactorCoeffString "H_CONVERSION_FACTOR_COEF" /* asynFloat64 ro */
|
||||
#define hConversionFactorOffsetString "H_CONVERSION_FACTOR_OFFSET"/* asynFloat64 ro */
|
||||
#define hNumberOfViewString "H_NUMBER_OF_VIEW" /* asynInt32 ro */
|
||||
#define hImageDetectorPixelWidthString "H_IMAGE_DETECTOR_PIXEL_WIDTH" /* asynFloat64 ro */
|
||||
#define hImageDetectorPixelHeightString "H_IMAGE_DETECTOR_PIXEL_HEIGHT" /* asynFloat64 ro */
|
||||
#define hImageDetectorPixelNumHorzString "H_IMAGE_DETECTOR_PIXEL_NUM_HORZ" /* asynInt32 ro */
|
||||
#define hImageDetectorPixelNumVertString "H_IMAGE_DETECTOR_PIXEL_NUM_VERT" /* asynInt32 ro */
|
||||
|
||||
|
||||
|
||||
@@ -128,18 +134,26 @@ class Hama : public ADDriver {
|
||||
|
||||
public:
|
||||
Hama(const char*, int, int, size_t, int, int, int);
|
||||
~Hama();
|
||||
// ~Hama();
|
||||
/* override ADDriver methods */
|
||||
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
||||
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
|
||||
virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[],
|
||||
int severities[], size_t nElements, size_t *nIn);
|
||||
//virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[],
|
||||
// int severities[], size_t nElements, size_t *nIn);
|
||||
virtual void report(FILE *fp, int details);
|
||||
|
||||
protected:
|
||||
int hFrameRate;
|
||||
#define FIRST_HAMA_PARAM hFrameRate
|
||||
int hHamaName;
|
||||
int hVendor;
|
||||
int hModel;
|
||||
int hCameraID;
|
||||
int hBus;
|
||||
int hCameraVersion;
|
||||
int hDriverVersion;
|
||||
int hModuleVersion;
|
||||
int hDcamApiVersion;
|
||||
int hSensorMode;
|
||||
int hReadoutSpeed;
|
||||
int hReadoutDirection;
|
||||
@@ -193,7 +207,7 @@ protected:
|
||||
int hRecordFixedBytesPerFile;
|
||||
int hRecordFixedBytesPerSession;
|
||||
int hRecordFixedBytesPerFrame;
|
||||
int hNumberOfOutputTriggerConnectors;
|
||||
int hNumberOfOutputTriggerConnector;
|
||||
int hOutputTriggerSource0;
|
||||
int hOutputTriggerSource1;
|
||||
int hOutputTriggerSource2;
|
||||
@@ -218,7 +232,7 @@ protected:
|
||||
int hOutTriggerPreHsyncCount;
|
||||
int hMasterPulseMode;
|
||||
int hMasterPulseTriggerSource;
|
||||
int hMAsterPulseInterval;
|
||||
int hMasterPulseInterval;
|
||||
int hMasterPulseBurstTimes;
|
||||
int hSystemAlive;
|
||||
int hConversionFactorCoeff;
|
||||
@@ -255,6 +269,8 @@ private:
|
||||
int dcamdev_string( DCAMERR& err, HDCAM hdcam, int32 idStr, char* text, int32 textbytes );
|
||||
int setParameter(int paramIndex);
|
||||
int getParameter(int paramIndex);
|
||||
int getParameterStr(int paramIndex);
|
||||
int getProperties();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,8 +13,14 @@ epicsEnvSet("NCHANS", "2048")
|
||||
# iocshLoad("$(adhama_DIR)ADHama.iocsh")
|
||||
|
||||
devHamamatsuConfig("$(PORT)", $(CAMERA), 0, 0, 0, 0, 10)
|
||||
|
||||
dbLoadRecords("$(adhama_DIR)db/hama.db","P=$(PREFIX),R=cam1:,PORT=$(PORT),ADDR=0,TIMEOUT=1")
|
||||
|
||||
asynSetTraceMask("$(PORT)",-1,0x9)
|
||||
asynSetTraceIOMask("$(PORT)",-1,0x2)
|
||||
|
||||
|
||||
iocInit()
|
||||
dbpf Hama:cam1:PoolUsedMem.SCAN 0
|
||||
# end-of-line required
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Vendored
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,243 @@
|
||||
// console/misc/common.cpp
|
||||
//
|
||||
|
||||
#include "console4.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(c)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
inline const int my_dcamdev_string( DCAMERR& err, HDCAM hdcam, int32 idStr, char* text, int32 textbytes )
|
||||
{
|
||||
DCAMDEV_STRING param;
|
||||
memset( ¶m, 0, sizeof(param) );
|
||||
param.size = sizeof(param);
|
||||
param.text = text;
|
||||
param.textbytes = textbytes;
|
||||
param.iString = idStr;
|
||||
|
||||
err = dcamdev_getstring( hdcam, ¶m );
|
||||
return ! failed( err );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
void dcamcon_show_dcamerr( HDCAM hdcam, DCAMERR errid, const char* apiname, const char* fmt, ... )
|
||||
{
|
||||
char errtext[ 256 ];
|
||||
|
||||
DCAMERR err;
|
||||
my_dcamdev_string( err, hdcam, errid, errtext, sizeof(errtext) );
|
||||
|
||||
printf( "FAILED: (DCAMERR)0x%08X %s @ %s", errid, errtext, apiname );
|
||||
|
||||
if( fmt != NULL )
|
||||
{
|
||||
printf( " : " );
|
||||
|
||||
va_list arg;
|
||||
va_start(arg,fmt);
|
||||
vprintf( fmt, arg );
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
void dcamcon_show_dcamdev_info( HDCAM hdcam )
|
||||
{
|
||||
char model[ 256 ];
|
||||
char cameraid[ 64 ];
|
||||
char bus[ 64 ];
|
||||
|
||||
DCAMERR err;
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_MODEL, model, sizeof(model) ) )
|
||||
{
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_MODEL)\n" );
|
||||
}
|
||||
else
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_CAMERAID, cameraid, sizeof(cameraid)) )
|
||||
{
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_CAMERAID)\n" );
|
||||
}
|
||||
else
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_BUS, bus, sizeof(bus) ) )
|
||||
{
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_BUS)\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "%s (%s) on %s\n", model, cameraid, bus );
|
||||
}
|
||||
}
|
||||
|
||||
// show HDCAM camera information by text.
|
||||
void dcamcon_show_dcamdev_info_detail( HDCAM hdcam )
|
||||
{
|
||||
char buf[ 256 ];
|
||||
|
||||
DCAMERR err;
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_VENDOR, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_VENDOR)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_VENDOR = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_MODEL, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_MODEL)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_MODEL = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_CAMERAID, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_CAMERAID)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_CAMERAID = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_BUS, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_BUS)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_BUS = %s\n", buf );
|
||||
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_CAMERAVERSION, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_CAMERAVERSION)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_CAMERAVERSION = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_DRIVERVERSION, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_DRIVERVERSION)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_DRIVERVERSION = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_MODULEVERSION, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_MODULEVERSION)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_MODULEVERSION = %s\n", buf );
|
||||
|
||||
if( ! my_dcamdev_string( err, hdcam, DCAM_IDSTR_DCAMAPIVERSION, buf, sizeof(buf) ) )
|
||||
dcamcon_show_dcamerr( hdcam, err, "dcamdev_getstring(DCAM_IDSTR_DCAMAPIVERSION)\n" );
|
||||
else
|
||||
printf( "DCAM_IDSTR_DCAMAPIVERSION = %s\n", buf );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// initialize DCAM-API and get HDCAM camera handle.
|
||||
|
||||
HDCAM dcamcon_init_open()
|
||||
{
|
||||
// Initialize DCAM-API ver 4.0
|
||||
DCAMAPI_INIT apiinit;
|
||||
memset( &apiinit, 0, sizeof(apiinit) );
|
||||
apiinit.size = sizeof(apiinit);
|
||||
|
||||
DCAMERR err;
|
||||
err = dcamapi_init( &apiinit );
|
||||
if( failed( err ) )
|
||||
{
|
||||
// failure
|
||||
dcamcon_show_dcamerr( NULL, err, "dcamapi_init()" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32 nDevice = apiinit.iDeviceCount;
|
||||
ASSERT( nDevice > 0 ); // nDevice must be larger than 0
|
||||
|
||||
int32 iDevice;
|
||||
|
||||
// show all camera information by text
|
||||
for( iDevice = 0; iDevice < nDevice; iDevice++ )
|
||||
{
|
||||
dcamcon_show_dcamdev_info( (HDCAM)(intptr_t)iDevice );
|
||||
}
|
||||
|
||||
if( nDevice > 1 )
|
||||
{
|
||||
// choose one camera from the list if there are two or more cameras.
|
||||
printf( "choose one of camera from above list by index (0-%d) >", nDevice-1 );
|
||||
|
||||
iDevice = -1;
|
||||
|
||||
char buf[256];
|
||||
while( fgets( buf, sizeof(buf), stdin ) != NULL )
|
||||
{
|
||||
if( _stricmp( buf, "exit" ) == 0 || _stricmp( buf, "exit\n" ) == 0 )
|
||||
{
|
||||
iDevice = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
iDevice = atoi( buf );
|
||||
if( 0 <= iDevice && iDevice < nDevice )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iDevice = 0;
|
||||
}
|
||||
|
||||
if( 0 <= iDevice && iDevice < nDevice )
|
||||
{
|
||||
// open specified camera
|
||||
DCAMDEV_OPEN devopen;
|
||||
memset( &devopen, 0, sizeof(devopen) );
|
||||
devopen.size = sizeof(devopen);
|
||||
devopen.index = iDevice;
|
||||
err = dcamdev_open( &devopen );
|
||||
if( ! failed(err) )
|
||||
{
|
||||
HDCAM hdcam = devopen.hdcam;
|
||||
|
||||
dcamcon_show_dcamdev_info_detail( hdcam );
|
||||
|
||||
// success
|
||||
return hdcam;
|
||||
}
|
||||
|
||||
dcamcon_show_dcamerr( (HDCAM)(intptr_t)iDevice, err, "dcamdev_open()", "index is %d\n", iDevice );
|
||||
}
|
||||
|
||||
// uninitialize DCAM-API
|
||||
dcamapi_uninit();
|
||||
|
||||
// failure
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---
|
||||
|
||||
BOOL console_prompt(const char* prompt, char* buf, int32 bufsize )
|
||||
{
|
||||
fputs( prompt, stdout );
|
||||
if( fgets( buf, bufsize, stdin ) == NULL )
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//---
|
||||
void output_data(const char* filename, char* buf, int32 bufsize )
|
||||
{
|
||||
#if defined( WIN32 )
|
||||
HANDLE hFile = CreateFileA( filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
|
||||
if( hFile != INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD dw;
|
||||
WriteFile( hFile, buf, bufsize, &dw, NULL );
|
||||
CloseHandle( hFile );
|
||||
}
|
||||
#else
|
||||
FILE *fp = fopen( filename, "w+b" );
|
||||
if( fp != NULL )
|
||||
{
|
||||
fwrite( buf, bufsize, 1, fp );
|
||||
fclose( fp );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// console/misc/common.h
|
||||
//
|
||||
|
||||
void dcamcon_show_dcamerr( HDCAM hdcam, DCAMERR errid, const char* apiname, const char* fmt=0, ... );
|
||||
|
||||
HDCAM dcamcon_init_open();
|
||||
void dcamcon_show_dcamdev_info( HDCAM hdcam );
|
||||
|
||||
//---
|
||||
|
||||
BOOL console_prompt(const char* prompt, char* buf, int32 bufsize );
|
||||
void output_data( const char* filename, char* buf, int32 bufsize );
|
||||
@@ -0,0 +1,153 @@
|
||||
// console4.h
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
// Windows
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#else // ! WIN32
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined( LINUX )
|
||||
|
||||
// Linux
|
||||
|
||||
#include <pthread.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#elif defined( MACOSX )
|
||||
|
||||
// Mac
|
||||
// No carbon
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
#endif // WIN32
|
||||
|
||||
// common headers
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// DCAM-API headers
|
||||
|
||||
#ifndef _NO_DCAMAPI
|
||||
|
||||
#ifndef DCAMAPI_VER
|
||||
#define DCAMAPI_VER 4000
|
||||
#endif
|
||||
|
||||
#ifndef DCAMAPI_VERMIN
|
||||
#define DCAMAPI_VERMIN 4000
|
||||
#endif
|
||||
|
||||
#if defined( LINUX )
|
||||
#include "dcamapi4.h"
|
||||
#include "dcamprop.h"
|
||||
#else
|
||||
#include "../../../inc/dcamapi4.h"
|
||||
#include "../../../inc/dcamprop.h"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
#pragma comment(lib,"../../../lib/win64/dcamapi.lib")
|
||||
#elif defined(WIN32)
|
||||
#pragma comment(lib,"../../../lib/win32/dcamapi.lib")
|
||||
#endif
|
||||
|
||||
#endif // _NO_DCAMAPI
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
// define common macro
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(c)
|
||||
#endif
|
||||
|
||||
// absorb different function
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#if defined(UNICODE) || defined(_UNICODE)
|
||||
#define _T(str) L##str
|
||||
#else
|
||||
#define _T(str) str
|
||||
#endif
|
||||
|
||||
#elif defined( MACOSX ) || __ppc64__ || __i386__ || __x86_64__ || defined( LINUX )
|
||||
|
||||
#define _T(str) str
|
||||
|
||||
#endif
|
||||
|
||||
// absorb Visual Studio 2005 and later
|
||||
|
||||
#if ! defined(WIN32) || _MSC_VER < 1400
|
||||
|
||||
#define _stricmp(str1, str2) strncasecmp( str1, str2, strlen(str2) )
|
||||
#define sprintf_s snprintf
|
||||
|
||||
#define BOOL int
|
||||
#define BYTE uint8_t
|
||||
#define WORD uint16_t
|
||||
#define DWORD uint32_t
|
||||
#define LONGLONG int64_t
|
||||
|
||||
#define MAX_PATH 256
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define LARGE_INTEGER int64_t
|
||||
|
||||
inline int fopen_s( FILE** fpp, const char* filename, const char* filemode )
|
||||
{
|
||||
*fpp = fopen( filename, filemode );
|
||||
if( fpp == NULL )
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void Sleep( DWORD dwMillseconds )
|
||||
{
|
||||
#if defined( MACOSX )
|
||||
int usec = dwMillseconds * 1000;
|
||||
usleep(usec);
|
||||
#else // expect defined( LINUX )
|
||||
struct timespec t;
|
||||
t.tv_sec = dwMillseconds / 1000;
|
||||
t.tv_nsec = ( dwMillseconds % 1000 ) * 1000000;
|
||||
nanosleep( &t, NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void* memcpy_s( void* dst, size_t dstsize, const void* src, size_t srclen )
|
||||
{
|
||||
if( dstsize < srclen )
|
||||
return memcpy( dst, src, dstsize );
|
||||
else
|
||||
return memcpy( dst, src, srclen );
|
||||
}
|
||||
|
||||
inline char* strcpy_s( char* dst, size_t dstsize, const char* src )
|
||||
{
|
||||
return (char*)memcpy_s( dst, dstsize, src, strlen(src) );
|
||||
}
|
||||
|
||||
inline char* strcat_s( char* dst, size_t dstsize, const char* src )
|
||||
{
|
||||
size_t dstused = strlen(dst);
|
||||
strcpy_s( dst + dstused, dstsize - dstused, src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
@@ -0,0 +1,5 @@
|
||||
// console/dcamapix.h
|
||||
|
||||
#define DCAM_GUID_MYAPP { 0x12345678, 0xabcd, 0x01ef, { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef } }
|
||||
|
||||
#define DCAMAPI_INITOPTION_A_SAMPLE 0x00000001
|
||||
@@ -0,0 +1,648 @@
|
||||
// dyndcam4.cpp
|
||||
|
||||
#include "console4.h"
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
typedef DCAMERR DCAMAPI proc_api_init( DCAMAPI_INIT* param );
|
||||
typedef DCAMERR DCAMAPI proc_api_uninit();
|
||||
typedef DCAMERR DCAMAPI proc_dev_open( DCAMDEV_OPEN* param );
|
||||
typedef DCAMERR DCAMAPI proc_dev_close( HDCAM h );
|
||||
typedef DCAMERR DCAMAPI proc_dev_showpanel( HDCAM h, int32 iKind );
|
||||
typedef DCAMERR DCAMAPI proc_dev_getcapability( HDCAM h, DCAMDEV_CAPABILITY* param );
|
||||
typedef DCAMERR DCAMAPI proc_dev_getstring( HDCAM h, DCAMDEV_STRING* param );
|
||||
typedef DCAMERR DCAMAPI proc_dev_setdata( HDCAM h, DCAMDATA_HDR* param );
|
||||
typedef DCAMERR DCAMAPI proc_dev_getdata( HDCAM h, DCAMDATA_HDR* param );
|
||||
typedef DCAMERR DCAMAPI proc_prop_getattr( HDCAM h, DCAMPROP_ATTR* param );
|
||||
typedef DCAMERR DCAMAPI proc_prop_getvalue( HDCAM h, int32 iProp, double* pValue );
|
||||
typedef DCAMERR DCAMAPI proc_prop_setvalue( HDCAM h, int32 iProp, double fValue );
|
||||
typedef DCAMERR DCAMAPI proc_prop_setgetvalue( HDCAM h, int32 iProp, double* pValue, int32 option );
|
||||
typedef DCAMERR DCAMAPI proc_prop_queryvalue( HDCAM h, int32 iProp, double* pValue, int32 option );
|
||||
typedef DCAMERR DCAMAPI proc_prop_getnextid( HDCAM h, int32* pProp, int32 option );
|
||||
typedef DCAMERR DCAMAPI proc_prop_getname( HDCAM h, int32 iProp, char* text, int32 textbytes );
|
||||
typedef DCAMERR DCAMAPI proc_prop_getvaluetext( HDCAM h, DCAMPROP_VALUETEXT* param );
|
||||
typedef DCAMERR DCAMAPI proc_buf_alloc( HDCAM h, int32 framecount );// call dcambuf_release() to free.
|
||||
typedef DCAMERR DCAMAPI proc_buf_attach( HDCAM h, const DCAMBUF_ATTACH* param );
|
||||
typedef DCAMERR DCAMAPI proc_buf_release( HDCAM h, int32 iKind );
|
||||
typedef DCAMERR DCAMAPI proc_buf_lockframe( HDCAM h, DCAMBUF_FRAME* pFrame );
|
||||
typedef DCAMERR DCAMAPI proc_buf_copyframe( HDCAM h, DCAMBUF_FRAME* pFrame );
|
||||
typedef DCAMERR DCAMAPI proc_buf_copymetadata( HDCAM h, DCAM_METADATAHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_cap_start( HDCAM h, int32 mode );
|
||||
typedef DCAMERR DCAMAPI proc_cap_stop( HDCAM h );
|
||||
typedef DCAMERR DCAMAPI proc_cap_status( HDCAM h, int32* pStatus );
|
||||
typedef DCAMERR DCAMAPI proc_cap_transferinfo( HDCAM h, DCAMCAP_TRANSFERINFO* param );
|
||||
typedef DCAMERR DCAMAPI proc_cap_firetrigger( HDCAM h, int32 iKind );
|
||||
typedef DCAMERR DCAMAPI proc_cap_record( HDCAM h, HDCAMREC hrec );
|
||||
typedef DCAMERR DCAMAPI proc_wait_open( DCAMWAIT_OPEN* param );
|
||||
typedef DCAMERR DCAMAPI proc_wait_close( HDCAMWAIT hWait );
|
||||
typedef DCAMERR DCAMAPI proc_wait_start( HDCAMWAIT hWait, DCAMWAIT_START* param );
|
||||
typedef DCAMERR DCAMAPI proc_wait_abort( HDCAMWAIT hWait );
|
||||
typedef DCAMERR DCAMAPI proc_rec_openA( DCAMREC_OPENA* param );
|
||||
typedef DCAMERR DCAMAPI proc_rec_openW( DCAMREC_OPENW* param );
|
||||
typedef DCAMERR DCAMAPI proc_rec_close( HDCAMREC hrec );
|
||||
typedef DCAMERR DCAMAPI proc_rec_lockframe( HDCAMREC hrec, DCAMREC_FRAME* pFrame );
|
||||
typedef DCAMERR DCAMAPI proc_rec_copyframe( HDCAMREC hrec, DCAMREC_FRAME* pFrame );
|
||||
typedef DCAMERR DCAMAPI proc_rec_writemetadata( HDCAMREC hrec, const DCAM_METADATAHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_rec_lockmetadata( HDCAMREC hrec, DCAM_METADATAHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_rec_copymetadata( HDCAMREC hrec, DCAM_METADATAHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_rec_lockmetadatablock( HDCAMREC hrec, DCAM_METADATABLOCKHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_rec_copymetadatablock( HDCAMREC hrec, DCAM_METADATABLOCKHDR* hdr );
|
||||
typedef DCAMERR DCAMAPI proc_rec_pause( HDCAMREC hrec );
|
||||
typedef DCAMERR DCAMAPI proc_rec_resume( HDCAMREC hrec );
|
||||
typedef DCAMERR DCAMAPI proc_rec_status( HDCAMREC hrec, DCAMREC_STATUS* pStatus );
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
static HINSTANCE hInstDcamapi4;
|
||||
|
||||
static struct {
|
||||
proc_api_init* api_init;
|
||||
proc_api_uninit* api_uninit;
|
||||
proc_dev_open* dev_open;
|
||||
proc_dev_close* dev_close;
|
||||
proc_dev_showpanel* dev_showpanel;
|
||||
proc_dev_getcapability* dev_getcapability;
|
||||
proc_dev_getstring* dev_getstring;
|
||||
proc_dev_setdata* dev_setdata;
|
||||
proc_dev_getdata* dev_getdata;
|
||||
proc_prop_getattr* prop_getattr;
|
||||
proc_prop_getvalue* prop_getvalue;
|
||||
proc_prop_setvalue* prop_setvalue;
|
||||
proc_prop_setgetvalue* prop_setgetvalue;
|
||||
proc_prop_queryvalue* prop_queryvalue;
|
||||
proc_prop_getnextid* prop_getnextid;
|
||||
proc_prop_getname* prop_getname;
|
||||
proc_prop_getvaluetext* prop_getvaluetext;
|
||||
proc_buf_alloc* buf_alloc;
|
||||
proc_buf_attach* buf_attach;
|
||||
proc_buf_release* buf_release;
|
||||
proc_buf_lockframe* buf_lockframe;
|
||||
proc_buf_copyframe* buf_copyframe;
|
||||
proc_buf_copymetadata* buf_copymetadata;
|
||||
proc_cap_start* cap_start;
|
||||
proc_cap_stop* cap_stop;
|
||||
proc_cap_status* cap_status;
|
||||
proc_cap_transferinfo* cap_transferinfo;
|
||||
proc_cap_firetrigger* cap_firetrigger;
|
||||
proc_cap_record* cap_record;
|
||||
proc_wait_open* wait_open;
|
||||
proc_wait_close* wait_close;
|
||||
proc_wait_start* wait_start;
|
||||
proc_wait_abort* wait_abort;
|
||||
proc_rec_openA* rec_openA;
|
||||
proc_rec_openW* rec_openW;
|
||||
proc_rec_close* rec_close;
|
||||
proc_rec_lockframe* rec_lockframe;
|
||||
proc_rec_copyframe* rec_copyframe;
|
||||
proc_rec_writemetadata* rec_writemetadata;
|
||||
proc_rec_lockmetadata* rec_lockmetadata;
|
||||
proc_rec_copymetadata* rec_copymetadata;
|
||||
proc_rec_lockmetadatablock* rec_lockmetadatablock;
|
||||
proc_rec_copymetadatablock* rec_copymetadatablock;
|
||||
proc_rec_pause* rec_pause;
|
||||
proc_rec_resume* rec_resume;
|
||||
proc_rec_status* rec_status;
|
||||
} entry;
|
||||
|
||||
static FARPROC getproc( const char* procname )
|
||||
{
|
||||
return GetProcAddress( hInstDcamapi4, procname );
|
||||
}
|
||||
|
||||
static void load_dcamapi4()
|
||||
{
|
||||
if( hInstDcamapi4 != NULL )
|
||||
return; // nothing to do.
|
||||
|
||||
hInstDcamapi4 = LoadLibrary( _T("dcamapi.dll") );
|
||||
if( hInstDcamapi4 == NULL )
|
||||
return; // DLL is not found
|
||||
|
||||
if( (entry.api_init = (proc_api_init*) getproc( "dcamapi_init" ) ) != NULL
|
||||
&& (entry.api_uninit = (proc_api_uninit*) getproc( "dcamapi_uninit" ) ) != NULL
|
||||
&& (entry.dev_open = (proc_dev_open*) getproc( "dcamdev_open" ) ) != NULL
|
||||
&& (entry.dev_close = (proc_dev_close*) getproc( "dcamdev_close" ) ) != NULL
|
||||
&& (entry.dev_showpanel = (proc_dev_showpanel*) getproc( "dcamdev_showpanel" ) ) != NULL
|
||||
&& (entry.dev_getcapability = (proc_dev_getcapability*) getproc( "dcamdev_getcapability" ) ) != NULL
|
||||
&& (entry.dev_getstring = (proc_dev_getstring*) getproc( "dcamdev_getstring" ) ) != NULL
|
||||
&& (entry.dev_setdata = (proc_dev_setdata*) getproc( "dcamdev_setdata" ) ) != NULL
|
||||
&& (entry.dev_getdata = (proc_dev_getdata*) getproc( "dcamdev_getdata" ) ) != NULL
|
||||
&& (entry.prop_getattr = (proc_prop_getattr*) getproc( "dcamprop_getattr" ) ) != NULL
|
||||
&& (entry.prop_getvalue = (proc_prop_getvalue*) getproc( "dcamprop_getvalue" ) ) != NULL
|
||||
&& (entry.prop_setvalue = (proc_prop_setvalue*) getproc( "dcamprop_setvalue" ) ) != NULL
|
||||
&& (entry.prop_setgetvalue = (proc_prop_setgetvalue*) getproc( "dcamprop_setgetvalue" ) ) != NULL
|
||||
&& (entry.prop_queryvalue = (proc_prop_queryvalue*) getproc( "dcamprop_queryvalue" ) ) != NULL
|
||||
&& (entry.prop_getnextid = (proc_prop_getnextid*) getproc( "dcamprop_getnextid" ) ) != NULL
|
||||
&& (entry.prop_getname = (proc_prop_getname*) getproc( "dcamprop_getname" ) ) != NULL
|
||||
&& (entry.prop_getvaluetext = (proc_prop_getvaluetext*) getproc( "dcamprop_getvaluetext" ) ) != NULL
|
||||
&& (entry.buf_alloc = (proc_buf_alloc*) getproc( "dcambuf_alloc" ) ) != NULL
|
||||
&& (entry.buf_attach = (proc_buf_attach*) getproc( "dcambuf_attach" ) ) != NULL
|
||||
&& (entry.buf_release = (proc_buf_release*) getproc( "dcambuf_release" ) ) != NULL
|
||||
&& (entry.buf_lockframe = (proc_buf_lockframe*) getproc( "dcambuf_lockframe" ) ) != NULL
|
||||
&& (entry.buf_copyframe = (proc_buf_copyframe*) getproc( "dcambuf_copyframe" ) ) != NULL
|
||||
&& (entry.buf_copymetadata = (proc_buf_copymetadata*) getproc( "dcambuf_copymetadata" ) ) != NULL
|
||||
&& (entry.cap_start = (proc_cap_start*) getproc( "dcamcap_start" ) ) != NULL
|
||||
&& (entry.cap_stop = (proc_cap_stop*) getproc( "dcamcap_stop" ) ) != NULL
|
||||
&& (entry.cap_status = (proc_cap_status*) getproc( "dcamcap_status" ) ) != NULL
|
||||
&& (entry.cap_transferinfo = (proc_cap_transferinfo*) getproc( "dcamcap_transferinfo" ) ) != NULL
|
||||
&& (entry.cap_firetrigger = (proc_cap_firetrigger*) getproc( "dcamcap_firetrigger" ) ) != NULL
|
||||
&& (entry.cap_record = (proc_cap_record*) getproc( "dcamcap_record" ) ) != NULL
|
||||
&& (entry.wait_open = (proc_wait_open*) getproc( "dcamwait_open" ) ) != NULL
|
||||
&& (entry.wait_close = (proc_wait_close*) getproc( "dcamwait_close" ) ) != NULL
|
||||
&& (entry.wait_start = (proc_wait_start*) getproc( "dcamwait_start" ) ) != NULL
|
||||
&& (entry.wait_abort = (proc_wait_abort*) getproc( "dcamwait_abort" ) ) != NULL
|
||||
&& (entry.rec_openA = (proc_rec_openA*) getproc( "dcamrec_openA" ) ) != NULL
|
||||
&& (entry.rec_openW = (proc_rec_openW*) getproc( "dcamrec_openW" ) ) != NULL
|
||||
&& (entry.rec_close = (proc_rec_close*) getproc( "dcamrec_close" ) ) != NULL
|
||||
&& (entry.rec_lockframe = (proc_rec_lockframe*) getproc( "dcamrec_lockframe" ) ) != NULL
|
||||
&& (entry.rec_copyframe = (proc_rec_copyframe*) getproc( "dcamrec_copyframe" ) ) != NULL
|
||||
&& (entry.rec_writemetadata = (proc_rec_writemetadata*) getproc( "dcamrec_writemetadata" ) ) != NULL
|
||||
&& (entry.rec_lockmetadata = (proc_rec_lockmetadata*) getproc( "dcamrec_lockmetadata" ) ) != NULL
|
||||
&& (entry.rec_copymetadata = (proc_rec_copymetadata*) getproc( "dcamrec_copymetadata" ) ) != NULL
|
||||
&& (entry.rec_lockmetadatablock= (proc_rec_lockmetadatablock*) getproc( "dcamrec_lockmetadatablock" ) ) != NULL
|
||||
&& (entry.rec_copymetadatablock= (proc_rec_copymetadatablock*) getproc( "dcamrec_copymetadatablock" ) ) != NULL
|
||||
&& (entry.rec_pause = (proc_rec_pause*) getproc( "dcamrec_pause" ) ) != NULL
|
||||
&& (entry.rec_resume = (proc_rec_resume*) getproc( "dcamrec_resume" ) ) != NULL
|
||||
&& (entry.rec_status = (proc_rec_status*) getproc( "dcamrec_status" ) ) != NULL )
|
||||
return; // success
|
||||
|
||||
// DCAMAPI.DLL does not include all entry.
|
||||
memset( &entry, 0, sizeof(entry) );
|
||||
|
||||
return; // failed
|
||||
}
|
||||
|
||||
static void unload_dcamapi4()
|
||||
{
|
||||
if( hInstDcamapi4 != NULL )
|
||||
{
|
||||
FreeLibrary( hInstDcamapi4 );
|
||||
}
|
||||
|
||||
memset( &entry, 0, sizeof(entry) );
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamapi_init( DCAMAPI_INIT* param )
|
||||
{
|
||||
load_dcamapi4();
|
||||
|
||||
if( entry.api_init == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.api_init( param );
|
||||
}
|
||||
|
||||
DCAMERR DCAMAPI dcamapi_uninit()
|
||||
{
|
||||
DCAMERR err = DCAMERR_NOMODULE;
|
||||
|
||||
if( entry.api_uninit != NULL )
|
||||
err = entry.api_uninit();
|
||||
|
||||
unload_dcamapi4();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_open( DCAMDEV_OPEN* param )
|
||||
{
|
||||
if( entry.dev_open == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_open( param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_close( HDCAM h )
|
||||
{
|
||||
if( entry.dev_close == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_close( h );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_showpanel( HDCAM h, int32 iKind )
|
||||
{
|
||||
if( entry.dev_showpanel == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_showpanel( h, iKind );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_getcapability( HDCAM h, DCAMDEV_CAPABILITY* param )
|
||||
{
|
||||
if( entry.dev_getcapability == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_getcapability( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_getstring( HDCAM h, DCAMDEV_STRING* param )
|
||||
{
|
||||
if( entry.dev_getstring == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_getstring( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_setdata( HDCAM h, DCAMDATA_HDR* param )
|
||||
{
|
||||
if( entry.dev_setdata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_setdata( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamdev_getdata( HDCAM h, DCAMDATA_HDR* param )
|
||||
{
|
||||
if( entry.dev_getdata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.dev_getdata( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_getattr( HDCAM h, DCAMPROP_ATTR* param )
|
||||
{
|
||||
if( entry.prop_getattr == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_getattr( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_getvalue( HDCAM h, int32 iProp, double* pValue )
|
||||
{
|
||||
if( entry.prop_getvalue == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_getvalue( h, iProp, pValue );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_setvalue( HDCAM h, int32 iProp, double fValue )
|
||||
{
|
||||
if( entry.prop_setvalue == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_setvalue( h, iProp, fValue );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_setgetvalue( HDCAM h, int32 iProp, double* pValue, int32 option )
|
||||
{
|
||||
if( entry.prop_setgetvalue == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_setgetvalue( h, iProp, pValue, option );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_queryvalue( HDCAM h, int32 iProp, double* pValue, int32 option )
|
||||
{
|
||||
if( entry.prop_queryvalue == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_queryvalue( h, iProp, pValue, option );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_getnextid( HDCAM h, int32* pProp, int32 option )
|
||||
{
|
||||
if( entry.prop_getnextid == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_getnextid( h, pProp, option );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_getname( HDCAM h, int32 iProp, char* text, int32 textbytes )
|
||||
{
|
||||
if( entry.prop_getname == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_getname( h, iProp, text, textbytes );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamprop_getvaluetext( HDCAM h, DCAMPROP_VALUETEXT* param )
|
||||
{
|
||||
if( entry.prop_getvaluetext == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.prop_getvaluetext( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_alloc( HDCAM h, int32 framecount )
|
||||
{
|
||||
if( entry.buf_alloc == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_alloc( h, framecount );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_attach( HDCAM h, const DCAMBUF_ATTACH* param )
|
||||
{
|
||||
if( entry.buf_attach == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_attach( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_release( HDCAM h, int32 iKind )
|
||||
{
|
||||
if( entry.buf_release == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_release( h, iKind );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_lockframe( HDCAM h, DCAMBUF_FRAME* pFrame )
|
||||
{
|
||||
if( entry.buf_lockframe == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_lockframe( h, pFrame );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_copyframe( HDCAM h, DCAMBUF_FRAME* pFrame )
|
||||
{
|
||||
if( entry.buf_copyframe == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_copyframe( h, pFrame );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcambuf_copymetadata( HDCAM h, DCAM_METADATAHDR* hdr )
|
||||
{
|
||||
if( entry.buf_copymetadata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.buf_copymetadata( h, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_start( HDCAM h, int32 mode )
|
||||
{
|
||||
if( entry.cap_start == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_start( h, mode );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_stop( HDCAM h )
|
||||
{
|
||||
if( entry.cap_stop == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_stop( h );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_status( HDCAM h, int32* pStatus )
|
||||
{
|
||||
if( entry.cap_status == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_status( h, pStatus );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_transferinfo( HDCAM h, DCAMCAP_TRANSFERINFO* param )
|
||||
{
|
||||
if( entry.cap_transferinfo == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_transferinfo( h, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_firetrigger( HDCAM h, int32 iKind )
|
||||
{
|
||||
if( entry.cap_firetrigger == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_firetrigger( h, iKind );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamcap_record( HDCAM h, HDCAMREC hrec )
|
||||
{
|
||||
if( entry.cap_record == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.cap_record( h, hrec );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamwait_open( DCAMWAIT_OPEN* param )
|
||||
{
|
||||
if( entry.wait_open == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.wait_open( param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamwait_close( HDCAMWAIT hWait )
|
||||
{
|
||||
if( entry.wait_close == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.wait_close( hWait );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamwait_start( HDCAMWAIT hWait, DCAMWAIT_START* param )
|
||||
{
|
||||
if( entry.wait_start == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.wait_start( hWait, param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamwait_abort( HDCAMWAIT hWait )
|
||||
{
|
||||
if( entry.wait_abort == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.wait_abort( hWait );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_openA( DCAMREC_OPENA* param )
|
||||
{
|
||||
if( entry.rec_openA == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_openA( param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_openW( DCAMREC_OPENW* param )
|
||||
{
|
||||
if( entry.rec_openW == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_openW( param );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_close( HDCAMREC hrec )
|
||||
{
|
||||
if( entry.rec_close == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_close( hrec );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_lockframe( HDCAMREC hrec, DCAMREC_FRAME* pFrame )
|
||||
{
|
||||
if( entry.rec_lockframe == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_lockframe( hrec, pFrame );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_copyframe( HDCAMREC hrec, DCAMREC_FRAME* pFrame )
|
||||
{
|
||||
if( entry.rec_copyframe == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_copyframe( hrec, pFrame );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_writemetadata( HDCAMREC hrec, const DCAM_METADATAHDR* hdr )
|
||||
{
|
||||
if( entry.rec_writemetadata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_writemetadata( hrec, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_lockmetadata( HDCAMREC hrec, DCAM_METADATAHDR* hdr )
|
||||
{
|
||||
if( entry.rec_lockmetadata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_lockmetadata( hrec, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_copymetadata( HDCAMREC hrec, DCAM_METADATAHDR* hdr )
|
||||
{
|
||||
if( entry.rec_copymetadata == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_copymetadata( hrec, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_lockmetadatablock( HDCAMREC hrec, DCAM_METADATABLOCKHDR* hdr )
|
||||
{
|
||||
if( entry.rec_lockmetadatablock == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_lockmetadatablock( hrec, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_copymetadatablock( HDCAMREC hrec, DCAM_METADATABLOCKHDR* hdr )
|
||||
{
|
||||
if( entry.rec_copymetadatablock == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_copymetadatablock( hrec, hdr );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_pause( HDCAMREC hrec )
|
||||
{
|
||||
if( entry.rec_pause == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_pause( hrec );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_resume( HDCAMREC hrec )
|
||||
{
|
||||
if( entry.rec_resume == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_resume( hrec );
|
||||
}
|
||||
|
||||
/* ---------------- */
|
||||
|
||||
DCAMERR DCAMAPI dcamrec_status( HDCAMREC hrec, DCAMREC_STATUS* pStatus )
|
||||
{
|
||||
if( entry.rec_status == NULL )
|
||||
return DCAMERR_NOMODULE;
|
||||
|
||||
return entry.rec_status( hrec, pStatus );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// qthread.cpp :
|
||||
//
|
||||
|
||||
#include "console4.h"
|
||||
#include "qthread.h"
|
||||
|
||||
#if defined( WIN32 )
|
||||
|
||||
qthread::~qthread()
|
||||
{
|
||||
if( m_thread != NULL )
|
||||
{
|
||||
CloseHandle( m_thread );
|
||||
}
|
||||
}
|
||||
|
||||
qthread::qthread()
|
||||
{
|
||||
m_thread = NULL;
|
||||
m_exitcode = 0;
|
||||
}
|
||||
|
||||
int32 qthread::start()
|
||||
{
|
||||
DWORD dwThreadID;
|
||||
m_thread = CreateThread( NULL, 0, threadentry, this, NULL, &dwThreadID );
|
||||
return m_thread != NULL;
|
||||
}
|
||||
|
||||
int32 qthread::wait_terminate()
|
||||
{
|
||||
WaitForSingleObject( m_thread, INFINITE );
|
||||
return m_exitcode;
|
||||
}
|
||||
|
||||
DWORD WINAPI qthread::threadentry( LPVOID pparam )
|
||||
{
|
||||
qthread* pThis = (qthread*)pparam;
|
||||
|
||||
pThis->m_exitcode = pThis->main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined( MACOSX ) || __ppc64__ || __i386__ || __x86_64__
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
qthread::~qthread()
|
||||
{
|
||||
}
|
||||
|
||||
qthread::qthread()
|
||||
{
|
||||
m_thread = NULL;
|
||||
m_exitcode = 0;
|
||||
}
|
||||
|
||||
int32 qthread::start()
|
||||
{
|
||||
pthread_create( (pthread_t*)&m_thread, NULL, threadentry, this );
|
||||
return m_thread != NULL;
|
||||
}
|
||||
|
||||
int32 qthread::wait_terminate()
|
||||
{
|
||||
void* ret;
|
||||
if( pthread_join( (pthread_t)m_thread, &ret ) == 0 )
|
||||
pthread_detach( (pthread_t)m_thread );
|
||||
|
||||
return m_exitcode;
|
||||
}
|
||||
|
||||
void* qthread::threadentry(void* pparam )
|
||||
{
|
||||
qthread* pThis = (qthread*)pparam;
|
||||
|
||||
pThis->main();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
#error unknown operating system: qthread.cpp
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
// qthread.h
|
||||
//
|
||||
|
||||
class qthread
|
||||
{
|
||||
protected:
|
||||
virtual ~qthread();
|
||||
qthread();
|
||||
|
||||
public:
|
||||
int32 start();
|
||||
int32 wait_terminate();
|
||||
|
||||
protected:
|
||||
virtual int32 main() = 0;
|
||||
|
||||
protected:
|
||||
void* m_thread;
|
||||
int32 m_exitcode;
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
static DWORD WINAPI threadentry( LPVOID pparam );
|
||||
|
||||
#elif defined( MACOSX ) || __ppc64__ || __i386__ || __x86_64__ || __aarch64__ || __arm__
|
||||
|
||||
static void* threadentry(void* pparam );
|
||||
|
||||
#else
|
||||
#error unknown operating system: class qthread
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user