Beispiel #1
0
/**\brief Check the 1394 subsystem for any connected cameras.
 * \ingroup camcore
 * \return
 *  - CAM_SUCCESS: Found at least one camera and have selected camera 0
 *  - CAM_ERROR: Found no cameras on the 1394 bus(es)
 *
 *   This function is now deprecated in favor of RefreshCameraList().  
 *   It is maintained for backwards compatibility and will be removed 
 *   in a future version.
 */
int C1394Camera::CheckLink()
{
	DllTrace(DLL_TRACE_ENTER,"ENTER CheckLink\n");
	if(RefreshCameraList() > 0)
	{
		SelectCamera(0);
		m_linkChecked = true;
		return 0;
	}
	return -1;
}
LRESULT ConnectCameraDlg::OnBtnRefresh(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
   int iItemCountBeforeRefresh = m_lcCameras.GetItemCount();

   RefreshCameraList();

   int iItemCount = m_lcCameras.GetItemCount();

   // select first item when list has updated
   if (iItemCount > 0 &&
       iItemCountBeforeRefresh != iItemCount &&
       m_lcCameras.GetSelectedIndex() == -1)
      m_lcCameras.SelectItem(0);

   return 0;
}
LRESULT ConnectCameraDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
   DoDataExchange(DDX_LOAD);

   CenterWindow(GetParent());

   DlgResize_Init(false, false);

   // load image lists
   {
      m_ilIcons.Create(16,15, ILC_MASK | ILC_COLOR32, 0, 0);
      CBitmap bmpIcons;
      bmpIcons.LoadBitmap(IDB_ICONS);
      m_ilIcons.Add(bmpIcons, RGB(255, 0, 255));
   }

   // set up cameras list
   {
      m_lcCameras.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
      m_lcCameras.SetImageList(m_ilIcons, LVSIL_SMALL);

      CRect rcCamera;
      m_lcCameras.GetClientRect(&rcCamera);

      m_lcCameras.InsertColumn(0, _T("Camera"), LVCFMT_LEFT, rcCamera.Width());

      RefreshCameraList();
   }

   if (m_lcCameras.GetItemCount() > 0)
      m_lcCameras.SelectItem(0);

   m_instance.AsyncWaitForCamera(std::bind(&ConnectCameraDlg::OnCameraAdded, this));

   return TRUE;
}