// ============================================================================= void LogBuffer::Load( PvConfigurationReader &aReader ) { PvResult lResult; PvString lPvStr; // Always load from a blank setup! ResetConfig(); // bool mGenICamEnabled; lResult = aReader.Restore( TAG_GENICAMENABLED, lPvStr ); if ( lResult.IsOK() ) { mGenICamEnabled = ( lPvStr == VAL_TRUE ); } // bool mBufferAllEnabled; lResult = aReader.Restore( TAG_BUFFERALLENABLED, lPvStr ); if ( lResult.IsOK() ) { mBufferAllEnabled = ( lPvStr == VAL_TRUE ); } // bool mBufferErrorEnabled; lResult = aReader.Restore( TAG_BUFFERERRORENABLED, lPvStr ); if ( lResult.IsOK() ) { mBufferErrorEnabled = ( lPvStr == VAL_TRUE ); } // QString mFilename; lResult = aReader.Restore( TAG_LOGFILENAME, lPvStr ); if ( lResult.IsOK() ) { SetFilename( lPvStr.GetAscii() ); } // bool mWriteToFileEnabled; lResult = aReader.Restore( TAG_WRITETOFILEENABLED, lPvStr ); if ( lResult.IsOK() ) { SetWriteToFileEnabled( lPvStr == VAL_TRUE ); } }
void PvDualSourceSample::Disconnect() { // Close all configuration child windows CloseGenWindow( mDeviceBrowser ); CloseGenWindow( Stream1Browser ); CloseGenWindow( Stream2Browser ); if ( mSource1->IsOpened() ) { PvResult lResult = mSource1->Close(); if ( !lResult.IsOK() ) { PvMessageBox( this, lResult ); } } if ( mSource2->IsOpened() ) { PvResult lResult = mSource2->Close(); if ( !lResult.IsOK() ) { PvMessageBox( this, lResult ); } } if ( mDevice.IsConnected() ) { PvResult lResult = mDevice.Disconnect(); if ( !lResult.IsOK() ) { PvMessageBox( this, lResult ); } } mSource1Widget->GetDisplay()->Clear(); mSource2Widget->GetDisplay()->Clear(); // Sync the UI with our new status EnableInterface(); }
void PleoraVideo::SetParameter(const std::string& name, const std::string& value) { PvGenParameter* par = lDeviceParams->Get(PvString(name.c_str())); if(par) { PvResult r = par->FromString(PvString(value.c_str())); if(!r.IsOK()){ pango_print_error("Error setting parameter %s to:%s Reason:%s\n", name.c_str(), value.c_str(), r.GetDescription().GetAscii()); } else { pango_print_info("Setting parameter %s to:%s\n", name.c_str(), value.c_str()); } } else { pango_print_error("Parameter %s not recognized\n", name.c_str()); } }
int ImperxStream::Initialize() { std::cout << "ImperxStream::Initialize starting" << std::endl; if(lDeviceInfo == NULL) { std::cout << "ImperxStream::Initialize No device connected!" << std::endl; return -1; } // Negotiate streaming packet size lDevice.NegotiatePacketSize(); // Open stream - have the PvDevice do it for us std::cout << "ImperxStream::Initialize Opening Stream to Device" << std::endl; PvResult lResult = lStream.Open( lDeviceInfo->GetIPAddress() ); if(!lResult.IsOK()) { std::cout << "ImperxStream::Initialize error on opening stream: " << lResult << std::endl; return -1; } // Reading payload size from device PvInt64 lSize = 0; lDeviceParams->GetIntegerValue( "PayloadSize", lSize ); // Set the Buffer size and the Buffer count std::cout << "ImperxStream::Initialize Setting Buffer Size" << std::endl; lPipeline.SetBufferSize( static_cast<PvUInt32>( lSize ) ); lPipeline.SetBufferCount( 32 ); // Increase for high frame rate without missing block IDs // Have to set the Device IP destination to the Stream lDevice.SetStreamDestination( lStream.GetLocalIPAddress(), lStream.GetLocalPort() ); // IMPORTANT: the pipeline needs to be "armed", or started before // we instruct the device to send us images std::cout << "ImperxStream::Initialize Starting Pipeline" << std::endl; lPipeline.Start(); // Get stream parameters/stats std::cout << "ImperxStream::Initialize Get Stream Parameters" << std::endl; lStreamParams = lStream.GetParameters(); // TLParamsLocked is optional but when present, it MUST be set to 1 // before sending the AcquisitionStart command lDeviceParams->SetIntegerValue( "TLParamsLocked", 1 ); std::cout << "ImperxStream::Initialize Resetting timestamp counter..." << std::endl; lDeviceParams->ExecuteCommand( "GevTimestampControlReset" ); std::cout << "ImperxStream::Initialize Exiting" << std::endl; return 0; }
PvResult Source::StopAcquisition() { PvGenStateStack lState( mDevice->GetGenParameters() ); if ( mMultiSource ) { // Push change on stack, will be reset when lState goes out of scope lState.SetEnumValue( "SourceSelector", mSourceIndex ); } // Use acquisition manager to send the acquisition stop command to the device PvResult lResult = mAcquisitionManager->Stop(); if ( !lResult.IsOK() ) { return lResult; } return PvResult::Code::OK; }
MLTCam::MLTCam() { data = new ushort[IMAGE_WIDTH*IMAGE_HEIGHT]; PvDeviceFinderWnd lFinderWnd; if (! lFinderWnd.ShowModal().IsOK() ) { return; } lDeviceInfo = (PvDeviceInfo*)lFinderWnd.GetSelected(); PvResult lResult; if( lDeviceInfo != NULL ) { qDebug() << "MLTCam::Connecting to" << lDeviceInfo->GetManufacturerInfo().GetAscii(); lDevice = PvDevice::CreateAndConnect(lDeviceInfo, &lResult ); if ( lResult.IsOK() ) { qDebug() << "MLTCam::Connected"; } } else { qDebug() << "MLTCam::No device found"; } lResult = lDevice->GetParameters()->GetIntegerValue("Height",height); if ( height != 2944) InitializationCam(); lStream = OpenStream( lDeviceInfo); qDebug() << "MLTCam::OpenStream"; ConfigureStream( lDevice, lStream ); qDebug() << "MLTCam::ConfigureStream"; CreateStreamBuffers( lDevice, lStream, &lBufferList ); qDebug() << "MLTCam::CreateStreamBuffers"; }
PvResult Source::SetAcquisitionMode( const QString &aAcquisitionMode ) { PvGenStateStack lState( mDevice->GetGenParameters() ); if ( mMultiSource ) { // Push change on stack, will be reset when lState goes out of scope lState.SetEnumValue( "SourceSelector", mSourceIndex ); } PvGenEnum *lMode = mDevice->GetGenParameters()->GetEnum( "AcquisitionMode" ); if ( lMode != NULL ) { PvResult lResult = lMode->SetValue( aAcquisitionMode.toAscii().data() ); if ( !lResult.IsOK() ) { return lResult; } } return PvResult::Code::OK; }
PvResult Source::StopStreaming() { if ( !mStream->IsOpen() || // Not initialized yet !mPipeline->IsStarted() ) // Not streaming { return PvResult::Code::NOT_INITIALIZED; } // Stop display thread if ( mDisplayThread->IsRunning() ) { mDisplayThread->Stop( false ); } // Release acquisition manager if ( mAcquisitionManager != NULL ) { mAcquisitionManager->UnregisterEventSink( this ); delete mAcquisitionManager; mAcquisitionManager = NULL; } // Stop pipeline PvResult lResult = mPipeline->Stop(); if ( !lResult.IsOK() ) { return lResult; } // Wait for the display thread to be completed if ( mDisplayThread != NULL ) { mDisplayThread->WaitComplete(); } return PvResult::Code::OK; }
PvResult Source::StartAcquisition() { PvGenStateStack lState( mDevice->GetGenParameters() ); if ( mMultiSource ) { // Push change on stack, will be reset when lState goes out of scope lState.SetEnumValue( "SourceSelector", mSourceIndex ); } // Get payload size PvUInt32 lPayloadSize = GetPayloadSize(); if ( lPayloadSize > 0 ) { // Propagate to pipeline to make sure buffers are big enough mPipeline->SetBufferSize( lPayloadSize ); } // Reset pipeline mPipeline->Reset(); mBuffersReallocated = false; // Reset stream statistics PvGenCommand *lResetStats = mStream->GetParameters()->GetCommand( "Reset" ); lResetStats->Execute(); // Reset dislay thread stats (mostly frames displayed per seconds) mDisplayThread->ResetStatistics(); // Use acquisition manager to send the acquisition start command to the device PvResult lResult = mAcquisitionManager->Start(); if ( !lResult.IsOK() ) { return lResult; } return PvResult::Code::OK; }
void ImperxStream::Stream(unsigned char *frame, Semaphore &frame_semaphore, Flag &stream_flag) { // The pipeline is already "armed", we just have to tell the device // to start sending us images printf( "Sending StartAcquisition command to device\n" ); lDeviceParams->ExecuteCommand( "AcquisitionStart" ); char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; PvInt64 lImageCountVal = 0; double lFrameRateVal = 0.0; double lBandwidthVal = 0.0; // Acquire images until the user instructs us to stop printf( "\n<press a key to stop streaming>\n" ); while ( stream_flag.check() ) { std::cout << "here\n"; // Retrieve next buffer PvBuffer *lBuffer = NULL; PvResult lOperationResult; PvResult lResult = lPipeline.RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult ); if ( lResult.IsOK() ) { if ( lOperationResult.IsOK() ) { // Process Buffer lStreamParams->GetIntegerValue( "ImagesCount", lImageCountVal ); lStreamParams->GetFloatValue( "AcquisitionRateAverage", lFrameRateVal ); lStreamParams->GetFloatValue( "BandwidthAverage", lBandwidthVal ); // If the buffer contains an image, display width and height PvUInt32 lWidth = 0, lHeight = 0; if ( lBuffer->GetPayloadType() == PvPayloadTypeImage ) { // Get image specific buffer interface PvImage *lImage = lBuffer->GetImage(); // Read width, height lWidth = lBuffer->GetImage()->GetWidth(); lHeight = lBuffer->GetImage()->GetHeight(); stream_flag.raise(); } std::cout << lWidth << " " << lHeight << "\n"; } // We have an image - do some processing (...) and VERY IMPORTANT, // release the buffer back to the pipeline //semaphore thing //get all in there. //a semaphore thing lPipeline.ReleaseBuffer( lBuffer ); } else { // Timeout printf( "%c Timeout\r", lDoodle[ lDoodleIndex ] ); } ++lDoodleIndex %= 6; } }
void ImperxStream::Snap(cv::Mat &frame) { // The pipeline is already "armed", we just have to tell the device // to start sending us images printf( "Sending StartAcquisition command to device\n" ); lDeviceParams->ExecuteCommand( "AcquisitionStart" ); char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; PvInt64 lImageCountVal = 0; double lFrameRateVal = 0.0; double lBandwidthVal = 0.0; std::cout << "here\n"; // Retrieve next buffer PvBuffer *lBuffer = NULL; PvResult lOperationResult; PvResult lResult = lPipeline.RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult ); if ( lResult.IsOK() ) { if ( lOperationResult.IsOK() ) { // Process Buffer lStreamParams->GetIntegerValue( "ImagesCount", lImageCountVal ); lStreamParams->GetFloatValue( "AcquisitionRateAverage", lFrameRateVal ); lStreamParams->GetFloatValue( "BandwidthAverage", lBandwidthVal ); // If the buffer contains an image, display width and height int lWidth = 0, lHeight = 0; if ( lBuffer->GetPayloadType() == PvPayloadTypeImage ) { // Get image specific buffer interface PvImage *lImage = lBuffer->GetImage(); // Read width, height lWidth = (int) lImage->GetWidth(); lHeight = (int) lImage->GetHeight(); unsigned char *img = lImage->GetDataPointer(); // cv::Mat lframe(lHeight,lWidth,CV_8UC1,img, cv::Mat::AUTO_STEP); // lframe.copyTo(frame); for (int m = 0; m < lHeight; m++) { for (int n = 0; n < lWidth; n++) { frame.at<unsigned char>(m,n) = img[m*lWidth + n]; // std::cout << (short int) img[n*lHeight +m] << " "; } } } else { std::cout << "No image\n"; } std::cout << lWidth << " " << lHeight << "\n"; } else { std::cout << "Damaged Result\n"; } // We have an image - do some processing (...) and VERY IMPORTANT, // release the buffer back to the pipeline //semaphore thing //get all in there. //a semaphore thing lPipeline.ReleaseBuffer( lBuffer ); } else { std::cout << "Timeout\n"; } ++lDoodleIndex %= 6; }
int ImperxStream::Connect() { PvResult lResult; // Create an GEV system and an interface. PvSystem lSystem; // Find all GEV Devices on the network. lSystem.SetDetectionTimeout( 2000 ); lResult = lSystem.Find(); if( !lResult.IsOK() ) { printf( "PvSystem::Find Error: %s", lResult.GetCodeString().GetAscii() ); return -1; } // Get the number of GEV Interfaces that were found using GetInterfaceCount. PvUInt32 lInterfaceCount = lSystem.GetInterfaceCount(); // Display information about all found interface // For each interface, display information about all devices. for( PvUInt32 x = 0; x < lInterfaceCount; x++ ) { // get pointer to each of interface PvInterface * lInterface = lSystem.GetInterface( x ); printf( "Interface %i\nMAC Address: %s\nIP Address: %s\nSubnet Mask: %s\n\n", x, lInterface->GetMACAddress().GetAscii(), lInterface->GetIPAddress().GetAscii(), lInterface->GetSubnetMask().GetAscii() ); // Get the number of GEV devices that were found using GetDeviceCount. PvUInt32 lDeviceCount = lInterface->GetDeviceCount(); for( PvUInt32 y = 0; y < lDeviceCount ; y++ ) { lDeviceInfo = lInterface->GetDeviceInfo( y ); printf( "Device %i\nMAC Address: %s\nIP Address: %s\nSerial number: %s\n\n", y, lDeviceInfo->GetMACAddress().GetAscii(), lDeviceInfo->GetIPAddress().GetAscii(), lDeviceInfo->GetSerialNumber().GetAscii() ); } } // Connect to the last GEV Device found. if( lDeviceInfo != NULL ) { printf( "Connecting to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); lResult = lDevice.Connect( lDeviceInfo ); if ( !lResult.IsOK() ) { printf( "Unable to connect to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); } else { printf( "Successfully connected to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); } } else { printf( "No device found\n" ); } // Get device parameters need to control streaming lDeviceParams = lDevice.GetGenParameters(); return 0; }
int main( int aCount, const char ** aArgs ) { char lDeviceAddress[1024]; char lMulticastAddress[1024]; char lLocalAddress[1024]; memset( lLocalAddress, 0, 1024 ); sprintf( lMulticastAddress, "239.192.1.1" ); memset( lDeviceAddress, 0, 1024 ); bool lPassive = true; PvUInt32 lChannel = 0; PvUInt16 lHostPort = 1042; PvResult lResult; for ( int i=1; i<aCount; i++ ) { std::string lString = aArgs[i]; if ( lString.find( "--hostport" ) != std::string::npos ) { sscanf( aArgs[i], "--hostport=%d", &lHostPort ); } else if ( lString.find( "--localaddress" ) != std::string::npos ) { sscanf( aArgs[i], "--localaddress=%s", lLocalAddress ); } else if ( lString.find( "--multicastaddress" ) != std::string::npos ) { sscanf( aArgs[i], "--multicastaddress=%s", lMulticastAddress ); } else if ( lString.find( "--deviceaddress" ) != std::string::npos ) { sscanf( aArgs[i], "--deviceaddress=%s", lDeviceAddress ); } else if ( lString.find( "--unicast" ) != std::string::npos ) { memset( lMulticastAddress, 0, 1024 ); } else if ( lString.find( "--connectdevice" ) != std::string::npos ) { lPassive = false; } else if ( lString.find( "--channel" ) != std::string::npos ) { sscanf( aArgs[i], "--channel=%d", &lChannel ); } else if ( lString.find( "--help" ) != std::string::npos ) { PrintHelp(); return 0; } else { printf( "Did not recognize argument %s\n", aArgs[i] ); PrintHelp(); return 1; } } if ( strlen( lDeviceAddress ) == 0 ) { // No device address specified. Prompt with the device finder. PvDeviceFinderWnd lWnd; if ( !lWnd.ShowModal().IsOK() ) { printf( "No GEV device selected.\n" ); return 1; } PvDeviceInfo* lInfo = lWnd.GetSelected(); sprintf( lDeviceAddress, "%s", lInfo->GetIPAddress().GetAscii() ); } PvStream lStream; if ( strlen( lMulticastAddress ) == 0 ) { lResult = lStream.Open( lDeviceAddress, lHostPort, lChannel, lLocalAddress ); printf( "Receiving from device %s on interface %s:%d\n", lDeviceAddress, lStream.GetLocalIPAddress().GetAscii(), lStream.GetLocalPort() ); } else { lResult = lStream.Open( lDeviceAddress, lMulticastAddress, lHostPort, lChannel, lLocalAddress ); printf( "Receiving from multicast address %s:%d (device %s) on interface %s:%d\n", lMulticastAddress, lHostPort, lDeviceAddress, lStream.GetLocalIPAddress().GetAscii(), lStream.GetLocalPort() ); } if ( !lResult.IsOK() ) { printf( "Failed opening the incoming stream: %s\n", lResult.GetDescription().GetAscii() ); return 1; } PvPipeline lPipeline( &lStream ); PvDevice lDevice; PvGenParameterArray *lDeviceParams = NULL; if ( !lPassive ) { lResult = lDevice.Connect( lDeviceAddress ); if ( !lResult.IsOK() ) { printf( "Failed connecting to the device to set its destination and initiate an AcquisitionStart: %s\n", lResult.GetDescription().GetAscii() ); printf( "If the eBUS Transmitter to receive from doesn't have full device capabilities, add the --passive command line option and initiate streaming manually.\n" ); return 1; } lDevice.SetStreamDestination( lStream.GetLocalIPAddress(), lStream.GetLocalPort(), lChannel ); // Get device parameters need to control streaming lDeviceParams = lDevice.GetGenParameters(); // Reading payload size from device. Otherwise, the pipeline may miss the first several images. PvInt64 lReceivePayloadSize = 0; lDeviceParams->GetIntegerValue( "PayloadSize", lReceivePayloadSize ); // Set the Buffer size and the Buffer count lPipeline.SetBufferSize( static_cast<PvUInt32>( lReceivePayloadSize ) ); } lPipeline.SetBufferCount( 16 ); // Increase for high frame rate without missing block IDs lPipeline.Start(); if ( !lPassive ) { // TLParamsLocked is optional but when present, it MUST be set to 1 // before sending the AcquisitionStart command lDeviceParams->SetIntegerValue( "TLParamsLocked", 1 ); lDeviceParams->ExecuteCommand( "GevTimestampControlReset" ); // The pipeline is already "armed", we just have to tell the device // to start sending us images lDeviceParams->ExecuteCommand( "AcquisitionStart" ); } // Get stream parameters/stats PvGenParameterArray *lStreamParams = lStream.GetParameters(); printf( "Press any key to stop receiving. \n" ); char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; PvInt64 lImageCountVal = 0; double lFrameRateVal = 0.0; double lBandwidthVal = 0.0; while ( !PvKbHit() ) { PvBuffer *lBuffer = NULL; PvResult lOperationResult; PvResult lResult = lPipeline.RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult ); if ( lResult.IsOK() ) { if ( lOperationResult.IsOK() ) { // // We now have a valid buffer. This is where you would typically process the buffer. // ----------------------------------------------------------------------------------------- // ... lStreamParams->GetIntegerValue( "ImagesCount", lImageCountVal ); lStreamParams->GetFloatValue( "AcquisitionRateAverage", lFrameRateVal ); lStreamParams->GetFloatValue( "BandwidthAverage", lBandwidthVal ); printf( "%c BlockID: %016llX %.01f FPS %.01f Mb/s\r", lDoodle[ lDoodleIndex ], lBuffer->GetBlockID(), lFrameRateVal, lBandwidthVal / 1000000.0 ); } // We have an image - do some processing (...) and VERY IMPORTANT, // release the buffer back to the pipeline lPipeline.ReleaseBuffer( lBuffer ); } else { printf( "%c Timeout\r", lDoodle[ lDoodleIndex ] ); } ++lDoodleIndex %= 6; } }
bool StartSlave() { // Let the user select the device to receive from PvString lDeviceIP; if ( !SelectDevice( lDeviceIP ) ) { return false; } // Create the PvStream object PvStream lStream; // Create the PvPipeline object PvPipeline lPipeline( &lStream ); // Create a PvPipeline event sink (used to trap buffer too small events) PipelineEventSink lPipelineEventSink; lPipeline.RegisterEventSink( &lPipelineEventSink ); // Open stream printf( "Opening stream\n" ); lStream.Open( lDeviceIP, "239.192.1.1", 1042 ); // IMPORTANT: the pipeline needs to be "armed", or started before // we instruct the device to send us images printf( "Starting pipeline\n" ); lPipeline.SetBufferCount( 16 ); lPipeline.Start(); // Get stream parameters/stats PvGenParameterArray *lStreamParams = lStream.GetParameters(); PvGenInteger *lCount = dynamic_cast<PvGenInteger *>( lStreamParams->Get( "ImagesCount" ) ); PvGenFloat *lFrameRate = dynamic_cast<PvGenFloat *>( lStreamParams->Get( "AcquisitionRateAverage" ) ); PvGenFloat *lBandwidth = dynamic_cast<PvGenFloat *>( lStreamParams->Get( "BandwidthAverage" ) ); PvGenBoolean *lIgnoreMissingPackets = dynamic_cast<PvGenBoolean *>( lStreamParams->Get( "IgnoreMissingPackets" ) ); // Disabling resend packets lIgnoreMissingPackets->SetValue( true ); char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; PvInt64 lImageCountVal = 0; double lFrameRateVal = 0.0; double lBandwidthVal = 0.0; // Acquire images until the user instructs us to stop printf( "\n<press a key to stop receiving>\n" ); while ( !PvKbHit() ) { // Retrieve next buffer PvBuffer *lBuffer = NULL; PvResult lOperationResult; PvResult lResult = lPipeline.RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult ); if ( lResult.IsOK() ) { if (lOperationResult.IsOK()) { // // We now have a valid buffer. This is where you would typically process the buffer. // ----------------------------------------------------------------------------------------- // ... lCount->GetValue( lImageCountVal ); lFrameRate->GetValue( lFrameRateVal ); lBandwidth->GetValue( lBandwidthVal ); // If the buffer contains an image, display width and height PvUInt32 lWidth = 0, lHeight = 0; if ( lBuffer->GetPayloadType() == PvPayloadTypeImage ) { // Get image specific buffer interface PvImage *lImage = lBuffer->GetImage(); // Read width, height lWidth = lBuffer->GetImage()->GetWidth(); lHeight = lBuffer->GetImage()->GetHeight(); } printf( "%c BlockID: %016llX W: %i H: %i %.01f FPS %.01f Mb/s\r", lDoodle[ lDoodleIndex ], lBuffer->GetBlockID(), lWidth, lHeight, lFrameRateVal, lBandwidthVal / 1000000.0 ); } // We have an image - do some processing (...) and VERY IMPORTANT, // release the buffer back to the pipeline lPipeline.ReleaseBuffer( lBuffer ); } else { // Timeout printf( "%c Timeout\r", lDoodle[ lDoodleIndex ] ); } ++lDoodleIndex %= 6; } PvGetChar(); // Flush key buffer for next stop printf( "\n\n" ); // We stop the pipeline - letting the object lapse out of // scope would have had the destructor do the same, but we do it anyway printf( "Stop pipeline\n" ); lPipeline.Stop(); // Now close the stream. Also optionnal but nice to have printf( "Closing stream\n" ); lStream.Close(); // Unregister pipeline event sink. Optional but nice to have. lPipeline.UnregisterEventSink( &lPipelineEventSink ); return true; }
bool AcquireImages(CamInfo* cams, int numCams) { int i; PvResult result; // Initialize Camera System PvSystem system; system.SetDetectionTimeout(2000); result = system.Find(); if(!result.IsOK()){ printf("PvSystem::Find Error: %s", result.GetCodeString().GetAscii()); return false; } PvDevice lDevice[numCams]; PvGenParameterArray *lDeviceParams[numCams]; PvStream lStream[numCams]; PvPipeline *lPipeline[numCams]; for(i=0; i < numCams; i++){ PvDeviceInfo* lDeviceInfo = NULL; PvDeviceInfo* tempInfo; // Get the number of GEV Interfaces that were found using GetInterfaceCount. PvUInt32 lInterfaceCount = system.GetInterfaceCount(); // For each interface, check MAC Address against passed address for( PvUInt32 x = 0; x < lInterfaceCount; x++ ) { // get pointer to each of interface PvInterface * lInterface = system.GetInterface( x ); // Get the number of GEV devices that were found using GetDeviceCount. PvUInt32 lDeviceCount = lInterface->GetDeviceCount(); for( PvUInt32 y = 0; y < lDeviceCount ; y++ ) { tempInfo = lInterface->GetDeviceInfo( y ); if(strlen(cams[i].MACAddress) == strlen(tempInfo->GetMACAddress().GetAscii()) && strncmp(cams[i].MACAddress,tempInfo->GetMACAddress().GetAscii(),strlen(cams[i].MACAddress)) == 0){ lDeviceInfo = tempInfo; break; } } } // If no device is selected, abort if( lDeviceInfo == NULL ) { printf( "No device selected.\n" ); return false; } // Connect to the GEV Device printf( "Connecting to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); if ( !lDevice[i].Connect( lDeviceInfo ).IsOK() ) { printf( "Unable to connect to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); return false; } printf( "Successfully connected to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); printf( "\n" ); // Get device parameters need to control streaming lDeviceParams[i] = lDevice[i].GetGenParameters(); // Negotiate streaming packet size lDevice[i].NegotiatePacketSize(); // Open stream - have the PvDevice do it for us printf( "Opening stream to device\n" ); lStream[i].Open( lDeviceInfo->GetIPAddress() ); // Create the PvPipeline object lPipeline[i] = new PvPipeline( &lStream[i] ); // Reading payload size from device PvInt64 lSize = 0; lDeviceParams[i]->GetIntegerValue( "PayloadSize", lSize ); // Set the Buffer size and the Buffer count lPipeline[i]->SetBufferSize( static_cast<PvUInt32>( lSize ) ); lPipeline[i]->SetBufferCount( 16 ); // Increase for high frame rate without missing block IDs // Have to set the Device IP destination to the Stream lDevice[i].SetStreamDestination( lStream[i].GetLocalIPAddress(), lStream[i].GetLocalPort() ); } PvGenParameterArray *lStreamParams[numCams]; for(i=0; i < numCams; i++){ // IMPORTANT: the pipeline needs to be "armed", or started before // we instruct the device to send us images printf( "Starting pipeline %d\n",i); lPipeline[i]->Start(); // Get stream parameters/stats lStreamParams[i] = lStream[i].GetParameters(); // TLParamsLocked is optional but when present, it MUST be set to 1 // before sending the AcquisitionStart command lDeviceParams[i]->SetIntegerValue( "TLParamsLocked", 1 ); printf( "Resetting timestamp counter...\n" ); lDeviceParams[i]->ExecuteCommand( "GevTimestampControlReset" ); // The pipeline is already "armed", we just have to tell the device // to start sending us images printf( "Sending StartAcquisition command to device\n" ); lDeviceParams[i]->ExecuteCommand( "AcquisitionStart" ); } char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; PvInt64 lImageCountVal = 0; double lFrameRateVal = 0.0; double lBandwidthVal = 0.0; PvInt64 lPipelineBlocksDropped = 0; // Acquire images until the user instructs us to stop printf( "\n<press the enter key to stop streaming>\n" ); //PvBufferWriter writer; char filePath[MAXFILEPATH]; PvUInt32 lWidth = 4096, lHeight = 9250; while ( running ) { for(i=0; i < numCams; i++){ // Retrieve next buffer PvBuffer *lBuffer = NULL; PvResult lOperationResult; PvResult lResult = lPipeline[i]->RetrieveNextBuffer( &lBuffer, 1000, &lOperationResult ); if ( lResult.IsOK() ) { if ( lOperationResult.IsOK() ) { lStreamParams[i]->GetIntegerValue( "ImagesCount", lImageCountVal ); lStreamParams[i]->GetFloatValue( "AcquisitionRateAverage", lFrameRateVal ); lStreamParams[i]->GetFloatValue( "BandwidthAverage", lBandwidthVal ); lStreamParams[i]->GetIntegerValue("PipelineBlocksDropped", lPipelineBlocksDropped); filePath[0] = '\0'; sprintf(filePath,"%s/%s%04X.tif",cams[i].filename,cams[i].prefix,lBuffer->GetBlockID()); TIFF *out = TIFFOpen(filePath,"w"); TIFFSetField(out, TIFFTAG_IMAGEWIDTH, lWidth); TIFFSetField(out, TIFFTAG_IMAGELENGTH, lHeight); TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1); TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8); TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_NONE); TIFFWriteEncodedStrip(out,0,lBuffer->GetDataPointer(),lWidth*lHeight); TIFFClose(out); printf( "%d:%s%c Timestamp: %016llX BlockID: %04X %.01f FPS %d DROP %.01f Mb/s\r\n",i, cams[i].prefix, lDoodle[ lDoodleIndex ], lBuffer->GetTimestamp(), lBuffer->GetBlockID(), lFrameRateVal, lPipelineBlocksDropped, lBandwidthVal / 1000000.0 ); } else { printf("%d: ERROR Code: %s, Description: %s\r\n",i,lOperationResult.GetCodeString().GetAscii(),lOperationResult.GetDescription().GetAscii()); } // We have an image - do some processing (...) // VERY IMPORTANT: // release the buffer back to the pipeline lPipeline[i]->ReleaseBuffer( lBuffer ); usleep(200); } else { // Timeout printf( "%d:%s%c Timeout\r\n",i, cams[i].prefix,lDoodle[ lDoodleIndex ]); } } ++lDoodleIndex %= 6; } //_getch(); // Flush key buffer for next stop printf( "\n\n" ); for(i=0; i < numCams; i++){ // Tell the device to stop sending images printf( "Sending AcquisitionStop command to the device\n" ); lDeviceParams[i]->ExecuteCommand( "AcquisitionStop" ); // If present reset TLParamsLocked to 0. Must be done AFTER the // streaming has been stopped lDeviceParams[i]->SetIntegerValue( "TLParamsLocked", 0 ); // We stop the pipeline - letting the object lapse out of // scope would have had the destructor do the same, but we do it anyway printf( "Stop pipeline\n" ); lPipeline[i]->Stop(); delete lPipeline[i]; // Now close the stream. Also optionnal but nice to have printf( "Closing stream\n" ); lStream[i].Close(); // Finally disconnect the device. Optional, still nice to have printf( "Disconnecting device\n" ); lDevice[i].Disconnect(); } return true; }
void PleoraVideo::SetDeviceParams(Params& p) { lStart = dynamic_cast<PvGenCommand*>( lDeviceParams->Get( "AcquisitionStart" ) ); lStop = dynamic_cast<PvGenCommand*>( lDeviceParams->Get( "AcquisitionStop" ) ); for(Params::ParamMap::iterator it = p.params.begin(); it != p.params.end(); it++) { if(it->first == "get_temperature"){ getTemp = p.Get<bool>("get_temperature",false); } else { if (it->second == "Execute") { // This is a command, deal with it accordingly. PvGenCommand* cmd = dynamic_cast<PvGenCommand*>(lDeviceParams->Get(it->first.c_str())); if(cmd) { PvResult r = cmd->Execute(); if(!r.IsOK()){ pango_print_error("Error executing command %s Reason:%s\n", it->first.c_str(), r.GetDescription().GetAscii()); } else { pango_print_info("Executed Command %s\n", it->first.c_str()); } bool done; int attempts = 20; do { cmd->IsDone(done); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); attempts--; } while(!done && (attempts > 0)); if(attempts == 0) { pango_print_error("Timeout while waiting for command %s done\n", it->first.c_str()); } } else { pango_print_error("Command %s not recognized\n", it->first.c_str()); } } else { try { PvGenParameter* par = lDeviceParams->Get(PvString(it->first.c_str())); if(par) { PvResult r = par->FromString(PvString(it->second.c_str())); if(!r.IsOK()){ pango_print_error("Error setting parameter %s to:%s Reason:%s\n", it->first.c_str(), it->second.c_str(), r.GetDescription().GetAscii()); } else { pango_print_info("Setting parameter %s to:%s\n", it->first.c_str(), it->second.c_str()); } } else { pango_print_error("Parameter %s not recognized\n", it->first.c_str()); } } catch(std::runtime_error e) { pango_print_error("Set parameter %s: %s\n", it->first.c_str(), e.what()); } } } } // Get Handles to properties we'll be using. lAnalogGain = lDeviceParams->GetInteger("AnalogGain"); lGamma = lDeviceParams->GetFloat("Gamma"); lAnalogBlackLevel = lDeviceParams->GetInteger("AnalogBlackLevel"); lExposure = lDeviceParams->GetFloat("ExposureTime"); lAquisitionMode = lDeviceParams->GetEnum("AcquisitionMode"); lTriggerSource = lDeviceParams->GetEnum("TriggerSource"); lTriggerMode = lDeviceParams->GetEnum("TriggerMode"); if(getTemp) { lTemperatureCelcius = lDeviceParams->GetFloat("DeviceTemperatureCelsius"); pango_print_warn("Warning: get_temperature might add a blocking call taking several ms to each frame read."); } }
int ImperxStream::Connect(const std::string &IP) { PvResult lResult; // Create an GEV system and an interface. PvSystem lSystem; // Find all GEV Devices on the network. lSystem.SetDetectionTimeout( 2000 ); lResult = lSystem.Find(); if( !lResult.IsOK() ) { //Failed to find PvAnything printf( "PvSystem::Find Error: %s", lResult.GetCodeString().GetAscii() ); return -1; } // Get the number of GEV Interfaces that were found using GetInterfaceCount. PvUInt32 lInterfaceCount = lSystem.GetInterfaceCount(); // Search through interfaces for any devices // Check devices for correct target IP for( PvUInt32 x = 0; x < lInterfaceCount; x++ ) { // get pointer to each of interface PvInterface * lInterface = lSystem.GetInterface( x ); // Get the number of GEV devices that were found using GetDeviceCount. PvUInt32 lDeviceCount = lInterface->GetDeviceCount(); for( PvUInt32 y = 0; y < lDeviceCount ; y++ ) { PvDeviceInfo *tDeviceInfo = lInterface->GetDeviceInfo( y ); std::string laddress(tDeviceInfo->GetIPAddress().GetAscii()); if (!laddress.compare(IP)) { lDeviceInfo = tDeviceInfo; printf( "Interface %i\nMAC Address: %s\nIP Address: %s\nSubnet Mask: %s\n\n", x, lInterface->GetMACAddress().GetAscii(), lInterface->GetIPAddress().GetAscii(), lInterface->GetSubnetMask().GetAscii() ); printf( "Device %i\nMAC Address: %s\nIP Address: %s\nSerial number: %s\n\n", y, tDeviceInfo->GetMACAddress().GetAscii(), tDeviceInfo->GetIPAddress().GetAscii(), tDeviceInfo->GetSerialNumber().GetAscii() ); } } } // Connect to the last GEV Device found. if( lDeviceInfo != NULL ) { printf( "Connecting to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); lResult = lDevice.Connect( lDeviceInfo ); if ( !lResult.IsOK() ) { printf( "Unable to connect to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); } else { printf( "Successfully connected to %s\n", lDeviceInfo->GetMACAddress().GetAscii() ); } } else { printf( "No device found\n" ); } // Get device parameters need to control streaming PvGenParameterArray *lDeviceParams = lDevice.GetGenParameters(); return 0; }
int main( int aCount, const char ** aArgs ) { // Creates default configuration, parse command line parameters Config lConfig; lConfig.ParseCommandLine( aCount, aArgs ); // Create video source VideoSource lSource( lConfig.GetDeviceAddress() ); lSource.Connect(); lSource.StartAcquisition(); // Get video source properties PvUInt32 lWidth = lSource.GetWidth(); PvUInt32 lHeight = lSource.GetHeight(); PvPixelType lPixelFormat = lSource.GetPixelFormat(); PvUInt32 lSize = lWidth * lHeight; // Allocate transmit buffers PvBufferList lBuffers; PvBufferList lFreeBuffers; for ( PvUInt32 i = 0; i < lConfig.GetBufferCount(); i++ ) { // Alloc new buffer PvBuffer *lBuffer = new PvBuffer(); lBuffer->SetID( i ); // Add to both buffer list and free buffer list lBuffers.push_back( lBuffer ); lFreeBuffers.push_back( lBuffer ); } // Create transmitter, set packet size PvTransmitterRaw lTransmitter; lTransmitter.SetPacketSize( lConfig.GetPacketSize() ); // Create virtual device (used for discovery) PvVirtualDevice lDevice; lDevice.StartListening( lConfig.GetSourceAddress() ); cout << "Listening for device discovery requests on " << lConfig.GetSourceAddress() << endl; // Open transmitter - sets destination and source PvResult lResult = lTransmitter.Open( lConfig.GetDestinationAddress(), lConfig.GetDestinationPort(), lConfig.GetSourceAddress(), lConfig.GetSourcePort() ); if ( !lResult.IsOK() ) { cout << "Failed to open a connection to the transmitter." << endl; return 1; } cout << "Transmission stream opened:" << endl; cout << "Source: " << lTransmitter.GetSourceIPAddress().GetAscii() << " port " << lTransmitter.GetSourcePort() << endl; cout << "Destination: " << lConfig.GetDestinationAddress() << " port " << lConfig.GetDestinationPort() << endl; if ( !lConfig.GetSilent() ) { cout << "Press any key to begin transmitting.\r"; PvWaitForKeyPress(); } cout << "Press any key to stop transmitting." << endl; // Set maximum throughput (just to even out traffic, as we control throughput at the source) if ( lConfig.GetFPS() != 0 ) { // Multiply image size (in bits) by FPS float lMax = static_cast<float>( lSize ) * 8; lMax *= lConfig.GetFPS(); // Since we control throughput at the source, make sure maximum throughput is slightly // higher than what we need. We want to even out packet traffic, not slow down source frame rate lMax *= 1.1f; // Set max throughput lTransmitter.SetMaxPayloadThroughput( lMax ); } char lDoodle[] = "|\\-|-/"; int lDoodleIndex = 0; // Reset transmitter stats lTransmitter.ResetStats(); // Used to transmit at a steady frame rate PvFPSStabilizer lStabilizer; // Seed used to generate the test pattern unsigned char lSeed = 0; // Acquisition/transmission loop while( !PvKbHit() ) { // Step 1: If timing is right to meet desired FPS, generate pattern, transmit if ( ( lConfig.GetFPS() == 0 ) || lStabilizer.IsTimeToDisplay( (PvUInt32)lConfig.GetFPS() ) ) { // Are there buffers available for transmission? if ( lFreeBuffers.size() > 0 ) { // Retrieve buffer from list PvBuffer *lBuffer = lFreeBuffers.front(); lFreeBuffers.pop_front(); // Get, transform and copy image into buffer if ( lSource.FillBuffer( lBuffer, &lTransmitter ) ) { // Queue the buffer for transmission lTransmitter.QueueBuffer( lBuffer ); } else { // No source image, put buffer back in free list lFreeBuffers.push_front( lBuffer ); } } } // Step 2: Retrieve free buffer(s), display stats and requeue PvBuffer *lBuffer = NULL; while ( lTransmitter.RetrieveFreeBuffer( &lBuffer, 0 ).IsOK() ) { // Queue buffers back in available buffer list lFreeBuffers.push_back( lBuffer ); // Buffer transmission complete, dislay stats cout << fixed << setprecision( 1 ); cout << lDoodle[ lDoodleIndex ] << " "; cout << "Transmitted " << lTransmitter.GetBlocksTransmitted() << " blocks "; cout << "at " << lTransmitter.GetAverageTransmissionRate() << " "; cout << "(" << lTransmitter.GetInstantaneousTransmissionRate() << ") FPS "; cout << lTransmitter.GetAveragePayloadThroughput() / 1000000.0f << " "; cout << "(" << lTransmitter.GetInstantaneousPayloadThroughput() / 1000000.0f << ") Mb/s \r"; ++lDoodleIndex %= 6; } } // Close transmitter (will also abort buffers) lTransmitter.Close(); // Free buffers PvBufferList::iterator lIt = lBuffers.begin(); while ( lIt != lBuffers.end() ) { delete ( *lIt ); lIt++; } // Stop video source lSource.StopAcquisition(); lSource.Disconnect(); // Stop virtual device lDevice.StopListening(); }
bool AcquireImages() { PvResult lResult; PvDeviceInfo *lDeviceInfo = NULL; PvSystem lSystem; PvStream lStream; lSystem.SetDetectionTimeout( 20000 ); lResult = lSystem.Find(); if( !lResult.IsOK() ) { cout << "PvSystem::Find Error: " << lResult.GetCodeString().GetAscii(); return -1; } PvUInt32 lInterfaceCount = lSystem.GetInterfaceCount(); for( PvUInt32 x = 0; x < lInterfaceCount; x++ ) { PvInterface * lInterface = lSystem.GetInterface( x ); cout << "Ethernet Interface " << endl; cout << "IP Address: " << lInterface->GetIPAddress().GetAscii() << endl; cout << "Subnet Mask: " << lInterface->GetSubnetMask().GetAscii() << endl << endl; PvUInt32 lDeviceCount = lInterface->GetDeviceCount(); for( PvUInt32 y = 0; y < lDeviceCount ; y++ ) { lDeviceInfo = lInterface->GetDeviceInfo( y ); cout << "ThermoCam " << endl; cout << "IP Address: " << lDeviceInfo->GetIPAddress().GetAscii() << endl; } } if( lDeviceInfo != NULL ) { cout << "Connecting to " << lDeviceInfo->GetIPAddress().GetAscii() << endl; PvDevice lDevice; lResult = lDevice.Connect( lDeviceInfo ); if ( !lResult.IsOK() ) { cout << "Unable to connect to " << lDeviceInfo->GetIPAddress().GetAscii() << endl; } else { cout << "Successfully connected to " << lDeviceInfo->GetIPAddress().GetAscii() << endl; lResult = lDevice.NegotiatePacketSize( ); if ( !lResult.IsOK() ) { cout << endl; cout << " Failed to negotiate a packet size setting GevSCPSPacketSize to original value"; PvSleepMs( 2500 ); } cout << endl; cout << "3. Open stream......"; lResult = lStream.Open( lDeviceInfo->GetIPAddress() ); if ( !lResult.IsOK() ) { cout << endl; cout << " Failed to open stream"; return 0; } lDevice.SetStreamDestination( lStream.GetLocalIPAddress(), lStream.GetLocalPort() ); PvInt64 lPayloadSize; lDevice.GetGenParameters()->GetIntegerValue( "PayloadSize", lPayloadSize ); PvBuffer * lBuffer = new PvBuffer(); lBuffer->Alloc( static_cast<PvUInt32>( lPayloadSize ) ); PvBuffer *lPtr = NULL; PvImage *lImage = NULL; cout << endl; cout << "5. Grab one image" << endl; lStream.QueueBuffer( lBuffer ); lDevice.GetGenParameters()->SetIntegerValue( "TLParamsLocked", 1 ); lDevice.GetGenParameters()->ExecuteCommand( "AcquisitionStart" ); PvResult lStreamResult; lResult = lStream.RetrieveBuffer( &lPtr, &lStreamResult, 10000 ); lDevice.GetGenParameters()->ExecuteCommand( "AcquisitionStop" ); lDevice.GetGenParameters()->SetIntegerValue( "TLParamsLocked", 0 ); PvInt64 lWidth = 0, lHeight = 0; PvGenParameterArray *lDeviceParams = lDevice.GetGenParameters(); lDeviceParams->GetIntegerValue( "Width", lWidth); lDeviceParams->GetIntegerValue( "Height", lHeight); cvNamedWindow("OpenCV: ThermoCam",CV_WINDOW_NORMAL); cv::Mat raw_lImage(cv::Size(lWidth,lHeight),CV_8U); if ( lResult.IsOK() ) { if ( lStreamResult.IsOK() ) { cout << endl; cout << "6. Using RGB Filter"; lImage=lPtr->GetImage(); lPtr->GetImage()->Alloc(lImage->GetWidth(),lImage->GetHeight(),PvPixelMono8); cout << " a. Save the original image into ImageOriginal.bmp"; PvBufferWriter lBufferWriter; lBufferWriter.Store(lPtr,"ThermoCam.bmp",PvBufferFormatBMP); } lImage->Attach(raw_lImage.data,lImage->GetWidth(),lImage->GetHeight(),PvPixelMono8); //cv::imshow("OpenCV: ThermoCam",raw_lImage); cv::FileStorage fs("ThermoCam.xml",cv::FileStorage::WRITE); fs << "raw_lImage" << raw_lImage; fs.release(); //if(cv::waitKey(1000) >= 0) break; lPtr->Free(); } lBuffer->Free(); lDevice.ResetStreamDestination(); lStream.Close(); lDevice.Disconnect(); return true; } } else { cout << "No device found" << endl; } return 0; }
void MLTCam::InitializationCam() { PvResult lResult; lResult = lDevice->GetParameters()->SetIntegerValue("AuthorizationCodeDFU", 0x77771111); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("TileSelector", "ReadAWriteA"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0x80000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0x80000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep(3000); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xB5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xB5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xC5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xC5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep(3000); lResult = lDevice->GetParameters()->SetIntegerValue("AuthorizationCodeDFU", 0x77771111); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("TileSelector", "ReadAWriteA"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xE5000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xE5000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep (100); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0x95000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0x95000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep (100); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep (100); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xB5000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xB5000001); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep (100); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xC5080000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xC5080000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep (100); lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("TileUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xA50000AA); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xB5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xB5000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0xC5200000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0xC5200000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AccessCodeDFU", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("RemoteUpdReg", 0x86000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->ExecuteCommand("RemoteUpdCom"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep(3000); lResult = lDevice->GetParameters()->SetIntegerValue("AuthorizationCodeDFU", 0x00000000); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("TileSelector", "ReadAWriteA"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("TileVoltageADCREF", 3400); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("InstalledTiles", "A"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("Binning", "Binning1x1"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("BinningMode", "Bsel1Bsel2"); if ( !lResult.IsOK()) qDebug() << "Error!"; mySleep(1000); lResult = lDevice->GetParameters()->SetIntegerValue("Width", 2304); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("Height", 2944); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("TimeFix", 400); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("TimePulse", 60); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("Attenuation", "div1"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("FlashTime", 0); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("ReadDelay", 1); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("OffsetX", 0); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("OffsetY", 0); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("ReadingDirection", "FromCenter"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("GapMultiCapture", 0); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AutoDarkOffset", 0); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetEnumValue("TestImageSelector", "Off"); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("AcquisitionFrameCount", 1); if ( !lResult.IsOK()) qDebug() << "Error!"; lResult = lDevice->GetParameters()->SetIntegerValue("SyncConfiguration", 0x03700); if ( !lResult.IsOK()) qDebug() << "Error!"; qDebug() << "MLTCam::Initialization continue"; }