PDA

View Full Version : External Trigger



Thomas2
February 3, 2016, 13:02:54
Dear all,
I'm trying to enable the external trigger of a DFM 22BUC03-ML. When I use IC Capture everything works fine. Then I ran the C++ DemoApp. With the device properties dialog it works. But with the sample code:


///////////////////////////////////////////////////////////////////////////////
/*! Toggles whether the camera is triggered by an external signal.
*/
void CMainFrame::OnButtontriggertoggle()
{
bool bMustRestart = false;
bool success;

if ( m_Grabber.isLive() )
{
bMustRestart = true;
m_Grabber.stopLive();
}

if( m_Grabber.getExternalTrigger() )
{
success = m_Grabber.setExternalTrigger(false);
}
else
{
success = m_Grabber.setExternalTrigger( true );
}

if ( bMustRestart )
{
m_Grabber.startLive();
}
}

///////////////////////////////////////////////////////////////////////////////
/*! If the current video capture device supports the external trigger, the
trigger button in the toolbar will be enabled.
*/
void CMainFrame::OnUpdateButtontriggertoggle(CCmdUI* pCmdUI)
{
if( m_Grabber.hasExternalTrigger() && m_Grabber.isDevValid() )
{
pCmdUI->Enable(true);
pCmdUI->SetCheck(m_Grabber.getExternalTrigger());
}
else
{
pCmdUI->Enable(false);
pCmdUI->SetCheck(0);
}
}

setExternalTrigger always returns false, even if hasExternalTrigger returns true.
What do I wrong?

Kind regards,
Thomas

Stefan Geissler
February 3, 2016, 13:23:53
Good question.

If you have set
m_Grabber.setExternalTrigger( true );

does the live stream stop and you receive an image only, if the camera is triggered?

Do you use latest IC 3.4?

Thomas2
February 4, 2016, 12:08:56
Hi Stefan,
no, nothing happens. There is a short flickering because of the stopLive / startLive but then the live video continues. And if I enable the trigger in the device property dialog, m_Grabber.setExternalTrigger(false) also doesn't work. I tried IC 3.2 yesterday, but 3.4 right now: There is no difference.
My orignal application was also a 3.4 build. I wrote first a C# test program using the .NET component and I had no such problem, Now I try to porting the trigger on / off feature into an older C++ program.

Kind regards,
Thomas

Stefan Geissler
February 4, 2016, 12:27:51
Thomas

you may try this code to enable the trigger:


void Set_Trigger_Enable(Grabber* pGrabber, bool OnOff)
{
if( pGrabber->isDevValid() )
{
tIVCDSwitchPropertyPtr pSwitchItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_TriggerMode, VCDElement_Value ,pSwitchItf);

if( pSwitchItf != NULL )
{
pSwitchItf->setSwitch(OnOff);
}
}
}

Thomas2
February 4, 2016, 13:09:22
Stefan,
this works. Many thanks.

Thomas