AVT相机arm版本SDK
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
PROJECT_NAME = CameraFactory
|
||||
|
||||
PROJECT_DIR = ../..
|
||||
EXAMPLES_DIR = $(PROJECT_DIR)/..
|
||||
VIMBASDK_DIR = $(EXAMPLES_DIR)/../..
|
||||
MAKE_INCLUDE_DIR = $(CURDIR)/$(EXAMPLES_DIR)/Build/Make
|
||||
|
||||
include $(MAKE_INCLUDE_DIR)/Common.mk
|
||||
|
||||
CONFIG_DIR = $(ARCH)_$(WORDSIZE)bit
|
||||
BIN_FILE = $(PROJECT_NAME)
|
||||
BIN_DIR = binary/$(CONFIG_DIR)
|
||||
OBJ_DIR = object/$(CONFIG_DIR)
|
||||
BIN_PATH = $(BIN_DIR)/$(BIN_FILE)
|
||||
|
||||
all: $(BIN_PATH)
|
||||
|
||||
include $(MAKE_INCLUDE_DIR)/VimbaCPP.mk
|
||||
|
||||
SOURCE_DIR = $(PROJECT_DIR)/Source
|
||||
INCLUDE_DIRS = -I$(SOURCE_DIR) \
|
||||
-I$(EXAMPLES_DIR) \
|
||||
|
||||
LIBS = $(VIMBACPP_LIBS)
|
||||
|
||||
DEFINES =
|
||||
|
||||
CFLAGS = $(COMMON_CFLAGS) \
|
||||
$(VIMBACPP_CFLAGS)
|
||||
|
||||
OBJ_FILES = $(OBJ_DIR)/CameraFactory.o \
|
||||
$(OBJ_DIR)/program.o \
|
||||
$(OBJ_DIR)/FindCameras.o
|
||||
|
||||
DEPENDENCIES = VimbaCPP
|
||||
|
||||
$(OBJ_DIR)/%.o: $(SOURCE_DIR)/%.cpp $(OBJ_DIR)
|
||||
$(CXX) -c $(INCLUDE_DIRS) $(DEFINES) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN_PATH): $(DEPENDENCIES) $(OBJ_FILES) $(BIN_DIR)
|
||||
$(CXX) $(ARCH_CFLAGS) -o $(BIN_PATH) $(OBJ_FILES) $(LIBS) -Wl,-rpath,'$$ORIGIN'
|
||||
|
||||
clean:
|
||||
$(RM) binary -r -f
|
||||
$(RM) object -r -f
|
||||
|
||||
$(OBJ_DIR):
|
||||
$(MKDIR) -p $(OBJ_DIR)
|
||||
|
||||
$(BIN_DIR):
|
||||
$(MKDIR) -p $(BIN_DIR)
|
||||
@@ -0,0 +1,208 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
|
||||
|
||||
Redistribution of this file, in original or modified form, without
|
||||
prior written consent of Allied Vision Technologies is prohibited.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
File: CameraFactory.cpp
|
||||
|
||||
Description: The CameraFactory example will create a suitable object for
|
||||
each known interface. The user can create his own factory and
|
||||
camera classes for customization.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#include "CameraFactory.h"
|
||||
|
||||
namespace AVT {
|
||||
namespace VmbAPI {
|
||||
namespace Examples {
|
||||
|
||||
/*=============================================================================
|
||||
FirewireCamera class
|
||||
=============================================================================*/
|
||||
|
||||
FirewireCamera::FirewireCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess )
|
||||
: Camera( pCameraID, pCameraName, pCameraModel,
|
||||
pCameraSerialNumber, pInterfaceID, interfaceType)
|
||||
{
|
||||
}
|
||||
|
||||
// A custom camera function
|
||||
void FirewireCamera::addonFireWire( std::string &info )
|
||||
{
|
||||
info = "1394 interface connection detected";
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
GigECamera class
|
||||
=============================================================================*/
|
||||
|
||||
GigECamera::GigECamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess )
|
||||
: Camera( pCameraID, pCameraName, pCameraModel,
|
||||
pCameraSerialNumber, pInterfaceID, interfaceType)
|
||||
{
|
||||
}
|
||||
|
||||
// A custom camera function
|
||||
void GigECamera::addonGigE( std::string &info )
|
||||
{
|
||||
info = "Ethernet interface connection detected";
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
USBCamera class
|
||||
=============================================================================*/
|
||||
|
||||
USBCamera::USBCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess )
|
||||
: Camera( pCameraID, pCameraName, pCameraModel,
|
||||
pCameraSerialNumber, pInterfaceID, interfaceType)
|
||||
{
|
||||
}
|
||||
|
||||
// A custom camera function
|
||||
void USBCamera::addonUSB( std::string &info )
|
||||
{
|
||||
info = "USB interface connection detected";
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
CLCamera class
|
||||
=============================================================================*/
|
||||
|
||||
CLCamera::CLCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess )
|
||||
: Camera( pCameraID, pCameraName, pCameraModel,
|
||||
pCameraSerialNumber, pInterfaceID, interfaceType)
|
||||
{
|
||||
}
|
||||
|
||||
// A custom camera function
|
||||
void CLCamera::addonCL( std::string &info )
|
||||
{
|
||||
info = "CL interface connection detected";
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
UserCameraFactory class
|
||||
=============================================================================*/
|
||||
|
||||
CameraPtr UserCameraFactory::CreateCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess)
|
||||
{
|
||||
// create camera class, depending on camera interface type
|
||||
if ( VmbInterfaceFirewire == interfaceType )
|
||||
{
|
||||
return FirewireCamera_t( new FirewireCamera( pCameraID,
|
||||
pCameraName,
|
||||
pCameraModel,
|
||||
pCameraSerialNumber,
|
||||
pInterfaceID,
|
||||
interfaceType,
|
||||
pInterfaceName,
|
||||
pInterfaceSerialNumber,
|
||||
interfacePermittedAccess));
|
||||
}
|
||||
else if ( VmbInterfaceEthernet == interfaceType )
|
||||
{
|
||||
return GigECamera_t( new GigECamera( pCameraID,
|
||||
pCameraName,
|
||||
pCameraModel,
|
||||
pCameraSerialNumber,
|
||||
pInterfaceID,
|
||||
interfaceType,
|
||||
pInterfaceName,
|
||||
pInterfaceSerialNumber,
|
||||
interfacePermittedAccess));
|
||||
}
|
||||
else if ( VmbInterfaceUsb == interfaceType )
|
||||
{
|
||||
return USBCamera_t( new USBCamera( pCameraID,
|
||||
pCameraName,
|
||||
pCameraModel,
|
||||
pCameraSerialNumber,
|
||||
pInterfaceID,
|
||||
interfaceType,
|
||||
pInterfaceName,
|
||||
pInterfaceSerialNumber,
|
||||
interfacePermittedAccess));
|
||||
}
|
||||
else if ( VmbInterfaceCL == interfaceType )
|
||||
{
|
||||
return CLCamera_t( new CLCamera( pCameraID,
|
||||
pCameraName,
|
||||
pCameraModel,
|
||||
pCameraSerialNumber,
|
||||
pInterfaceID,
|
||||
interfaceType,
|
||||
pInterfaceName,
|
||||
pInterfaceSerialNumber,
|
||||
interfacePermittedAccess));
|
||||
}
|
||||
else // unknown camera interface
|
||||
{
|
||||
// use default camera class
|
||||
return Camera_t( new Camera( pCameraID,
|
||||
pCameraName,
|
||||
pCameraModel,
|
||||
pCameraSerialNumber,
|
||||
pInterfaceID,
|
||||
interfaceType));
|
||||
}
|
||||
}
|
||||
|
||||
}}} // namespace AVT::VmbAPI::Examples
|
||||
|
||||
152
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/CameraFactory.h
Normal file
152
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/CameraFactory.h
Normal file
@@ -0,0 +1,152 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
|
||||
|
||||
Redistribution of this file, in original or modified form, without
|
||||
prior written consent of Allied Vision Technologies is prohibited.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
File: CameraFactory.h
|
||||
|
||||
Description: The CameraFactory example will create a suitable object for
|
||||
each known interface. The user can create his own factory and
|
||||
camera classes for customization.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#ifndef AVT_VMBAPI_EXAMPLES_CAMERAFACTORY
|
||||
#define AVT_VMBAPI_EXAMPLES_CAMERAFACTORY
|
||||
|
||||
#include "VimbaCPP/Include/VimbaCPP.h"
|
||||
|
||||
namespace AVT {
|
||||
namespace VmbAPI {
|
||||
namespace Examples {
|
||||
|
||||
class UserCameraFactory;
|
||||
class FirewireCamera;
|
||||
class GigECamera;
|
||||
class USBCamera;
|
||||
class CLCamera;
|
||||
|
||||
typedef SP_DECL( UserCameraFactory ) UserCameraFactory_t;
|
||||
typedef SP_DECL( FirewireCamera ) FirewireCamera_t;
|
||||
typedef SP_DECL( GigECamera ) GigECamera_t;
|
||||
typedef SP_DECL( USBCamera ) USBCamera_t;
|
||||
typedef SP_DECL( CLCamera ) CLCamera_t;
|
||||
typedef SP_DECL( Camera ) Camera_t;
|
||||
|
||||
//
|
||||
// A class that derives from standard Vimba Camera with a function specific to fire wire
|
||||
//
|
||||
class FirewireCamera:
|
||||
public Camera
|
||||
{
|
||||
public:
|
||||
FirewireCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess );
|
||||
|
||||
void addonFireWire( std::string &info ); // custom camera function
|
||||
};
|
||||
|
||||
//
|
||||
// A class that derives from standard Vimba Camera with a function specific to GigE
|
||||
//
|
||||
class GigECamera:
|
||||
public Camera
|
||||
{
|
||||
public:
|
||||
GigECamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess );
|
||||
|
||||
void addonGigE( std::string &info ); // custom camera function
|
||||
};
|
||||
|
||||
//
|
||||
// A class that derives from standard Vimba Camera with a function specific to USB
|
||||
//
|
||||
class USBCamera:
|
||||
public Camera
|
||||
{
|
||||
public:
|
||||
USBCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess );
|
||||
|
||||
void addonUSB( std::string &info ); // custom camera function
|
||||
};
|
||||
|
||||
//
|
||||
// A class that derives from standard Vimba Camera with a functions specific to CL
|
||||
//
|
||||
class CLCamera:
|
||||
public Camera
|
||||
{
|
||||
public:
|
||||
CLCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess );
|
||||
|
||||
void addonCL( std::string &info ); // custom camera function
|
||||
};
|
||||
|
||||
//
|
||||
// A class with a static factory method creating specific camera classes dependent on the interface type
|
||||
//
|
||||
class UserCameraFactory :
|
||||
public ICameraFactory
|
||||
{
|
||||
public:
|
||||
CameraPtr CreateCamera( const char *pCameraID,
|
||||
const char *pCameraName,
|
||||
const char *pCameraModel,
|
||||
const char *pCameraSerialNumber,
|
||||
const char *pInterfaceID,
|
||||
VmbInterfaceType interfaceType,
|
||||
const char *pInterfaceName,
|
||||
const char *pInterfaceSerialNumber,
|
||||
VmbAccessModeType interfacePermittedAccess);
|
||||
};
|
||||
|
||||
}}} // namespace AVT::VmbAPI::Examples
|
||||
|
||||
#endif
|
||||
162
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/FindCameras.cpp
Normal file
162
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/FindCameras.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
|
||||
|
||||
Redistribution of this file, in original or modified form, without
|
||||
prior written consent of Allied Vision Technologies is prohibited.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
File: FindCameras.cpp
|
||||
|
||||
Description: Find and print a custom string for each known customized camera.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "FindCameras.h"
|
||||
#include "CameraFactory.h"
|
||||
|
||||
#include "VimbaCPP/Include/VimbaCPP.h"
|
||||
#include "Common/StreamSystemInfo.h"
|
||||
#include "Common/ErrorCodeToMessage.h"
|
||||
namespace AVT {
|
||||
namespace VmbAPI {
|
||||
namespace Examples {
|
||||
|
||||
//
|
||||
// Detects all connected physical cameras and creates polymorphic classes (all inheriting from Vimba Camera class)
|
||||
// depending on the camera's interface type.
|
||||
// Starts up the API
|
||||
// Creates the objects and prints them out
|
||||
// Shuts down the API and exits
|
||||
//
|
||||
void FindCameras::Print()
|
||||
{
|
||||
VimbaSystem& sys = VimbaSystem::GetInstance(); // Get a reference to the VimbaSystem singleton
|
||||
VmbErrorType err = sys.Startup(); // Initialize the Vimba API
|
||||
CameraPtrVector cameras; // A vector of std::shared_ptr<AVT::VmbAPI::Camera> objects
|
||||
|
||||
std::string strName; // The name of the cam
|
||||
VmbInterfaceType interfaceType; // The interface type of the cam
|
||||
std::string strInfo; // The custom information
|
||||
|
||||
std::stringstream strError;
|
||||
|
||||
|
||||
|
||||
if( VmbErrorSuccess == err )
|
||||
{
|
||||
std::cout<<"Vimba C++ API Version "<<sys<<"\n";
|
||||
|
||||
// Set user factory as default camera object creator.
|
||||
ICameraFactoryPtr factPtr = UserCameraFactory_t( new UserCameraFactory() );
|
||||
err = sys.RegisterCameraFactory( factPtr );
|
||||
if( VmbErrorSuccess == err )
|
||||
{
|
||||
err = sys.GetCameras( cameras ); // Fetch all cameras known to Vimba
|
||||
if( VmbErrorSuccess == err )
|
||||
{
|
||||
std::cout << "Cameras found: " << cameras.size() <<"\n\n";
|
||||
|
||||
// Query the name and interface of all known cameras and print them out.
|
||||
// We don't have to open the cameras for that.
|
||||
for( CameraPtrVector::const_iterator iter = cameras.begin();
|
||||
cameras.end() != iter;
|
||||
++iter )
|
||||
{
|
||||
err = (*iter)->GetName( strName );
|
||||
if( VmbErrorSuccess != err )
|
||||
{
|
||||
strError << "[Could not get camera name. Error code: " << err <<"("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "]";
|
||||
strName.assign( strError.str() );
|
||||
}
|
||||
|
||||
err = (*iter)->GetInterfaceType( interfaceType );
|
||||
if( VmbErrorSuccess != err )
|
||||
{
|
||||
strError << "[Could not get camera interface. Error code: " << err << "("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "]";
|
||||
strInfo = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
strInfo = "none";
|
||||
switch( interfaceType )
|
||||
{
|
||||
case VmbInterfaceFirewire:
|
||||
{
|
||||
FirewireCamera_t fcam = SP_DYN_CAST( *iter, FirewireCamera );
|
||||
if ( fcam != NULL )
|
||||
fcam->addonFireWire( strInfo );
|
||||
break;
|
||||
}
|
||||
case VmbInterfaceEthernet:
|
||||
{
|
||||
GigECamera_t gcam = SP_DYN_CAST( *iter, GigECamera );
|
||||
if ( gcam != NULL )
|
||||
gcam->addonGigE( strInfo );
|
||||
break;
|
||||
}
|
||||
case VmbInterfaceUsb:
|
||||
{
|
||||
USBCamera_t ucam = SP_DYN_CAST( *iter, USBCamera );
|
||||
if ( ucam != NULL )
|
||||
ucam->addonUSB( strInfo );
|
||||
break;
|
||||
}
|
||||
case VmbInterfaceCL:
|
||||
{
|
||||
CLCamera_t ccam = SP_DYN_CAST( *iter, CLCamera );
|
||||
if ( ccam != NULL )
|
||||
ccam->addonCL( strInfo );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cout <<"/// Camera Name: " << strName
|
||||
<<"\n/// Custom Info: " << strInfo
|
||||
<<"\n\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Could not list cameras. Error code: " << err <<"("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "\n";
|
||||
}
|
||||
|
||||
sys.Shutdown(); // Close Vimba
|
||||
}
|
||||
else
|
||||
{
|
||||
strError << "[Could not set user camera factory. Error code: " << err << "("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "]";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Could not start system. Error code: " << err <<"("<<AVT::VmbAPI::Examples::ErrorCodeToMessage(err)<<")"<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}}} // namespace AVT::VmbAPI::Examples
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
|
||||
|
||||
Redistribution of this file, in original or modified form, without
|
||||
prior written consent of Allied Vision Technologies is prohibited.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
File: FindCameras.h
|
||||
|
||||
Description: Find and print a custom string for each known customized camera.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#ifndef AVT_VMBAPI_EXAMPLES_FINDCAMERAS
|
||||
#define AVT_VMBAPI_EXAMPLES_FINDCAMERAS
|
||||
|
||||
namespace AVT {
|
||||
namespace VmbAPI {
|
||||
namespace Examples {
|
||||
|
||||
class FindCameras
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Detects all connected physical cameras and creates polymorphic classes (all inheriting from Vimba Camera class)
|
||||
// depending on the camera's interface type.
|
||||
// Starts up the API
|
||||
// Creates the objects and prints them out
|
||||
// Shuts down the API and exits
|
||||
//
|
||||
static void Print();
|
||||
};
|
||||
|
||||
}}} // namespace AVT::VmbAPI::Examples
|
||||
|
||||
#endif
|
||||
47
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/program.cpp
Normal file
47
Vimba_6_0/VimbaCPP/Examples/CameraFactory/Source/program.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
|
||||
|
||||
Redistribution of this file, in original or modified form, without
|
||||
prior written consent of Allied Vision Technologies is prohibited.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
File: program.cpp
|
||||
|
||||
Description: Main entry point of CameraFactory example of VimbaCPP.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=============================================================================*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "FindCameras.h"
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
std::cout << "\n";
|
||||
std::cout << "///////////////////////////////////////\n";
|
||||
std::cout << "/// Vimba API CameraFactory Example ///\n";
|
||||
std::cout << "///////////////////////////////////////\n\n";
|
||||
|
||||
if( 1 < argc )
|
||||
{
|
||||
std::cout << "No parameters expected. Execution will not be affected by the provided parameter(s).\n\n";
|
||||
}
|
||||
|
||||
AVT::VmbAPI::Examples::FindCameras::Print();
|
||||
|
||||
std::cout << "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user