⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 busview.h

📁 BCAM 1394 Driver
💻 H
字号:
//-----------------------------------------------------------------------------
//  (c) 2002 by Basler Vision Technologies
//  Section:  Vision Components
//  Project:  BCAM
//  $Header: BusView.h, 9, 12.12.2002 17:26:07, Happe, A.$
//-----------------------------------------------------------------------------
/**
  \file     BusView.h
 *
  \brief  Declaration of the CBusView class.
 */
//-----------------------------------------------------------------------------


#if !defined(AFX_BUSVIEW_H__8C4B8AD5_7C21_11D5_920C_0090278E5E96__INCLUDED_)
#define AFX_BUSVIEW_H__8C4B8AD5_7C21_11D5_920C_0090278E5E96__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "resource.h"
#include "DialogView.h"

//------------------------------------------------------------------------------
// class CBusView
// Author: AHappe
// Date: 10.08.01
//------------------------------------------------------------------------------
/**
 * \brief   Tree view which shows the Bcam devcies found on the 1394 bus
 *
 * This class implements the bus viewer window, 
 * which allows the user to navigate the Bcam devices found on the 1394 bus.
 * The bus viewer window is registered for Bcam related device notifications 
 * sent by the plug and play manager. New devices are added to the tree, unplugged
 * devices are removed.
 * 
 */
//------------------------------------------------------------------------------
class CBusView :
public CDialogView<CBusView>
{
public:
  
  enum { IDD = IDD_BUSVIEW };
  
  BEGIN_MSG_MAP(CBusView)
    CHAIN_MSG_MAP(CDialogView<CBusView>)
    MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
    MESSAGE_HANDLER(WM_SIZE, OnSize)
    MESSAGE_HANDLER(WM_DESTROY, OnDestroy )
    MESSAGE_HANDLER(WM_DEVICECHANGE, OnDeviceChange)
    MESSAGE_HANDLER(WM_CONTEXTMENU, OnContextMenu)
    NOTIFY_HANDLER(IDC_BUSTREE, TVN_SELCHANGED, OnSelChanged)
    NOTIFY_HANDLER(IDC_BUSTREE, NM_DBLCLK, OnLButtonDblClk)
    REFLECT_NOTIFICATIONS()
  END_MSG_MAP()
    
  CBusView(CCameraManager& CameraManager, CMainFrame& MainFrame);
public:
  /// Different node types in the tree which shows the topology of the bus
  enum BusNode_t
  {
    /// Bcam device
    bnBcam
  };

  const char* UNABLE_TO_OPEN;

protected:

  //------------------------------------------------------------------------------
  // class CBusView::CBusNode
  // Author: 
  // Date: 
  //------------------------------------------------------------------------------
  /**
   *  \brief Base class for bus nodes 
   */
  //------------------------------------------------------------------------------
  class CBusNode 
  {
  public: 
    CBusNode(CString devName) :
        m_DeviceName(devName)
        {};
    virtual ~CBusNode() { ATLTRACE("~CBusNode()\n");};

    /// get Win32 device name
    CString DeviceName() const { return m_DeviceName;}
    /// get type of node
    virtual BusNode_t Type() const = 0;
  protected:
    CString m_DeviceName;
  }; // CBcam::CBusNode

  
  //------------------------------------------------------------------------------
  // class CBusView::CBcamBusNode
  // Author: 
  // Date: 
  //------------------------------------------------------------------------------
  /**
  * \brief Representation of a Bcam device node in the tree
  *
  */
  //------------------------------------------------------------------------------
  class CBcamBusNode : public CBusNode
  {
  public:
    /// Constructor. Opens the device.
    CBcamBusNode(CString devName)
      : CBusNode(devName)
    { /* NOP */ };

    /// Destructor. Closes the device
    virtual ~CBcamBusNode() { }
    /// get type of node
    virtual BusNode_t Type() const { return bnBcam; }
    

  protected:
  };  // CBcam::CBcamBusNode

  /// map tree item handels to associated CBusNode objects
  typedef map<HTREEITEM, CBusNode*> NodeMap_t;

public:
  /// A client informs us that the current device has changed ( e.g. the user activated an other 
  /// image view associated with an other device)
  void CurrentDeviceChanged(CCamera* pCamera);

protected:
  // Message Handlers

  LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  LRESULT OnContextMenu(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  /// Plug & play manager notifications about added/removed devices
  LRESULT OnDeviceChange(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
  /// Another tree item is selected
  LRESULT OnSelChanged(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  /// User has double clicked on a tree item
  LRESULT OnLButtonDblClk(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	  

  /// Invoke the error message box
  void ReportError(BcamException& e);

  /// Add a new device to the tree.
  void AddNode(CString devName, GUID guid);
  /// Remove a node from the tree
  void RemoveNode(CString devName);
  /// bool check if the device list alread contains a node for a given device
  bool ContainsNode(CString devName);
  /// Check device list for consistency
  void UpdateDeviceList();
  
  // Member variables

  /// reference to the viewer's camera manager object
  CCameraManager&         m_CameraManager;
  /// reference to the application's main window
  CMainFrame&             m_MainFrame;
  /// tree view control
  CTreeViewCtrl           m_TreeView;
  /// list with icons displayed in the tree view
  CImageList              m_ImageList;
  /// root item of the tree
  CTreeItem               m_RootItem;
  /// map which maps the tree items to node objects
  NodeMap_t               m_NodeMap;
};


#endif // !defined(AFX_BUSVIEW_H__8C4B8AD5_7C21_11D5_920C_0090278E5E96__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -