Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allied vision device adapter #388

Merged
merged 44 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c7d7dbb
First prototype implementation Changes: - Image snapping - Live strea…
Jun 22, 2023
b533ed5
Property page support Changes: - Property page support - draft versio…
Jun 29, 2023
fee7a71
Property browser and refactoring Changes: - Code refactoring - Proper…
Jul 7, 2023
a0d5c80
Support for command features Changes: - Support for command features …
Jul 10, 2023
753deaa
ROI support Changes: - ROI support Author(s): - Maciej Scecelek
Jul 10, 2023
704332c
Device HUB and refactoring Changes: - Added device HUB type - Fixed i…
Jul 12, 2023
df6399f
Fixes Changes: - Fix to hide event/chunk category properties - Fix fo…
Jul 13, 2023
fa12156
Refactoring Changes: - Added error handling for symbols resolve and S…
Jul 14, 2023
0814a65
Refactoring Changes: - Refactoring of existing solution Author(s): - …
Jul 14, 2023
9edd882
Error handling Changes: - Error handling for issues related to the lo…
Jul 17, 2023
432e4ee
Few fixes Changes: - Removed RAW features from the list - Reduced Get…
Jul 18, 2023
bad9b85
Binning and ROI changes Changes: - Removed generic Binning to have Ve…
Jul 19, 2023
3bd5b99
Error handling Changes: - Error handling improvements - Created a bas…
Jul 21, 2023
f126db0
Property read-only handling and fixes Changes: - Changes to the handl…
Jul 24, 2023
6922c32
Pull request #1: Feature/UNISDK-3114 create jenkins jobs for building…
fklostermann-avt Jul 27, 2023
dafcc7d
Pixel Format support Changes: - Added helper class for pixel type con…
Jul 31, 2023
e22ecc5
Pixel format support Changes: - Fixed some memory leaks - Refactored …
Jul 31, 2023
f3d288b
Linux support changes Changes: - Base for Linux support Author(s): - …
Aug 7, 2023
25086b5
Linux support changes Changes: - Base for Linux support Author(s): - …
Aug 7, 2023
e9637bf
Linux support Changes: - Added changes required for linux build Authr…
Aug 7, 2023
1b86a41
Linux support Changes: - Linux support changes Author(s): - Maciej Sc…
Aug 9, 2023
ca41474
Deleted Jenkins folder since Jenkinsfile have been moved to the "micr…
fklostermann-avt Aug 18, 2023
8329e00
Make micro manager binning core property read-only and set a single a…
dlangenkamp-avt Sep 12, 2023
a9fc9c6
Enable readonly properties -> properties will be greyed out in proper…
fklostermann-avt Sep 12, 2023
73d2a29
Use dynamic_cast for downcasting; declare const where possible; use P…
fklostermann-avt Sep 13, 2023
bddc462
Fixed UNI-583 VimbaX shared libraries must be copied to "/usr/local/bin"
dlangenkamp-avt Sep 8, 2023
d839baa
Before a feature is read or written the locale is set to the current …
dlangenkamp-avt Sep 13, 2023
3143322
Fixed UNI-591 main window exposure setting not working
dlangenkamp-avt Sep 13, 2023
486e24f
Updated header
dlangenkamp-avt Sep 13, 2023
0562954
adjusted Windows VmbC dll search path: use <Vimba X>/bin instead of <…
fklostermann-avt Sep 14, 2023
b1e5013
refactored code with clang-format
fklostermann-avt Sep 14, 2023
79c401d
Added missing locale include
dlangenkamp-avt Sep 14, 2023
6562663
Run GVSPAdjustPacketSize after opening a GigE camera
fklostermann-avt Sep 14, 2023
7fc7f60
Ip and mac address features are now displayed correctly
dlangenkamp-avt Sep 14, 2023
16037a2
Fixed formatting
dlangenkamp-avt Sep 14, 2023
40afa77
ignore return from SetPropertyLimits when disabling a feature
fklostermann-avt Sep 14, 2023
cfa656e
Revert: Before a feature is read or written the locale is set to the …
dlangenkamp-avt Sep 15, 2023
3522d5a
Added missing changes
dlangenkamp-avt Sep 19, 2023
684f734
Fixed float property change always called
dlangenkamp-avt Sep 19, 2023
ea54eeb
Added missing this to OnPropertiesChanged calls
dlangenkamp-avt Sep 19, 2023
f5b7296
Pull request #16: Prepare Micro Manager Pull Request
fklostermann-avt Oct 2, 2023
b6848b7
AlliedVisionCamera: Use headers in 3rdparty
marktsuchida Oct 26, 2023
273a57d
Merge branch 'main' into allied-vision
marktsuchida Oct 26, 2023
8eb1882
AlliedVisionCamera: Set up with ./configure
marktsuchida Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,411 changes: 1,411 additions & 0 deletions DeviceAdapters/AlliedVisionCamera/AlliedVisionCamera.cpp

Large diffs are not rendered by default.

472 changes: 472 additions & 0 deletions DeviceAdapters/AlliedVisionCamera/AlliedVisionCamera.h

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions DeviceAdapters/AlliedVisionCamera/AlliedVisionCamera.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AlliedVisionCamera.h" />
<ClInclude Include="AlliedVisionDeviceBase.h" />
<ClInclude Include="AlliedVisionHub.h" />
<ClInclude Include="Loader\Constants.h" />
<ClInclude Include="Loader\LibLoader.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AlliedVisionCamera.cpp" />
<ClCompile Include="AlliedVisionDeviceBase.cpp" />
<ClCompile Include="AlliedVisionHub.cpp" />
<ClCompile Include="Loader\LibLoader.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MMDevice\MMDevice-SharedRuntime.vcxproj">
<Project>{b8c95f39-54bf-40a9-807b-598df2821d55}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{12e75cb0-4b48-4d7c-bb26-d928f18488c2}</ProjectGuid>
<RootNamespace>AlliedVisionCamera</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\buildscripts\VisualStudio\MMCommon.props" />
<Import Project="..\..\buildscripts\VisualStudio\MMDeviceAdapter.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\buildscripts\VisualStudio\MMCommon.props" />
<Import Project="..\..\buildscripts\VisualStudio\MMDeviceAdapter.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>C:\Program Files\Micro-Manager-2.0\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;ALLIEDVISIONCAMERA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
<AdditionalIncludeDirectories>$(MM_3RDPARTYPRIVATE)\AVT\VimbaX-2023-1-Win64\api\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;ALLIEDVISIONCAMERA_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile />
<AdditionalIncludeDirectories>$(MM_3RDPARTYPRIVATE)\AVT\VimbaX-2023-1-Win64\api\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="AlliedVisionCamera.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AlliedVisionHub.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="AlliedVisionDeviceBase.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Loader\Constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Loader\LibLoader.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="AlliedVisionCamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AlliedVisionHub.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="AlliedVisionDeviceBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Loader\LibLoader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "AlliedVisionDeviceBase.h"
85 changes: 85 additions & 0 deletions DeviceAdapters/AlliedVisionCamera/AlliedVisionDeviceBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*=============================================================================
Copyright (C) 2023 Allied Vision Technologies. All Rights Reserved.

This file is distributed under the BSD license.
License text is included with the source distribution.

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 ALLIEDVISIONDEVICEBASE_H
#define ALLIEDVISIONDEVICEBASE_H

#include "DeviceBase.h"
#include "Loader/LibLoader.h"

#define LOG_ERROR(err, message) logError(err, message, __FUNCTION__, __LINE__)

/**
* @brief Base class for Allied Vision devices
*/
template <typename T, typename U> class AlliedVisionDeviceBase : public CDeviceBase<T, U>
{
///////////////////////////////////////////////////////////////////////////////
// PUBLIC
///////////////////////////////////////////////////////////////////////////////
public:
/**
* @brief Constructor
*/
AlliedVisionDeviceBase()
{
CDeviceBase<T, U>::InitializeDefaultErrorMessages();
setApiErrorMessages();
};

/**
* @brief Destructor
*/
virtual ~AlliedVisionDeviceBase() = default;

void logError(int error, std::string message, std::string function = "", int line = 0) const
{
std::string prefix = "[" + function + "():" + std::to_string(line) + "] ";
CDeviceBase<T, U>::LogMessage(prefix + message);
CDeviceBase<T, U>::LogMessageCode(error);
}

///////////////////////////////////////////////////////////////////////////////
// PRIVATE
///////////////////////////////////////////////////////////////////////////////
private:
/**
* @brief Setup error messages for Vimba API
*/
void setApiErrorMessages()
{
CDeviceBase<T, U>::SetErrorText(VmbErrorApiNotStarted, "Vimba X API not started");
CDeviceBase<T, U>::SetErrorText(VmbErrorNotFound, "Device cannot be found");
CDeviceBase<T, U>::SetErrorText(VmbErrorDeviceNotOpen, "Device cannot be opened");
CDeviceBase<T, U>::SetErrorText(VmbErrorBadParameter, "Invalid parameter passed to the function");
CDeviceBase<T, U>::SetErrorText(VmbErrorNotImplemented, "Feature not implemented");
CDeviceBase<T, U>::SetErrorText(VmbErrorNotSupported, "Feature not supported");
CDeviceBase<T, U>::SetErrorText(VmbErrorUnknown, "Unknown error");
CDeviceBase<T, U>::SetErrorText(VmbErrorInvalidValue, "The value is not valid: either out of bounds or not an "
"increment of the minimum");
CDeviceBase<T, U>::SetErrorText(VmbErrorBadHandle, "Given device handle is not valid");
CDeviceBase<T, U>::SetErrorText(VmbErrorInvalidAccess, "Operation is invalid with the current access mode");
CDeviceBase<T, U>::SetErrorText(VmbErrorTimeout, "Timeout occured");
CDeviceBase<T, U>::SetErrorText(VmbErrorNotAvailable, "Something is not available");
CDeviceBase<T, U>::SetErrorText(VmbErrorNotInitialized, "Something is not initialized");
CDeviceBase<T, U>::SetErrorText(VmbErrorAlready, "The operation has been already done");
CDeviceBase<T, U>::SetErrorText(VmbErrorFeaturesUnavailable, "Feature is currently unavailable");
}
};

#endif
96 changes: 96 additions & 0 deletions DeviceAdapters/AlliedVisionCamera/AlliedVisionHub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*=============================================================================
Copyright (C) 2023 Allied Vision Technologies. All Rights Reserved.

This file is distributed under the BSD license.
License text is included with the source distribution.

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 "AlliedVisionHub.h"

#include "AlliedVisionCamera.h"

AlliedVisionHub::AlliedVisionHub() :
m_sdk(std::make_shared<VimbaXApi>())
{
}

int AlliedVisionHub::DetectInstalledDevices()
{
LogMessage("Detecting installed cameras...");
VmbUint32_t camNum;
// Get the number of connected cameras first
VmbError_t err = m_sdk->VmbCamerasList_t(nullptr, 0, &camNum, 0);
if (VmbErrorSuccess == err)
{
VmbCameraInfo_t *camInfo = new VmbCameraInfo_t[camNum];

// Get the cameras
err = m_sdk->VmbCamerasList_t(camInfo, camNum, &camNum, sizeof *camInfo);

if (err == VmbErrorSuccess)
{
for (VmbUint32_t i = 0; i < camNum; ++i)
{
if (camInfo[i].permittedAccess & VmbAccessModeFull)
{
MM::Device *pDev = new AlliedVisionCamera(camInfo[i].cameraIdString);
AddInstalledDevice(pDev);
}
}
}

delete[] camInfo;
}
else
{
LOG_ERROR(err, "Cannot get installed devices!");
}

return err;
}

int AlliedVisionHub::Initialize()
{
LogMessage("Init HUB");
if (m_sdk->isInitialized())
{
return DEVICE_OK;
}
else
{
LOG_ERROR(VmbErrorApiNotStarted, "SDK not initialized!");
return VmbErrorApiNotStarted;
}
}

int AlliedVisionHub::Shutdown()
{
LogMessage("Shutting down HUB");
return DEVICE_OK;
}

void AlliedVisionHub::GetName(char *name) const
{
CDeviceUtils::CopyLimitedString(name, g_hubName);
}

bool AlliedVisionHub::Busy()
{
return false;
}

std::shared_ptr<VimbaXApi> &AlliedVisionHub::getSDK()
{
return m_sdk;
}
Loading