Skip to content

Commit

Permalink
Merge pull request #37 from Fluigent/version-21.3.0.0
Browse files Browse the repository at this point in the history
Update SDK to version 21.3.0.0
  • Loading branch information
mtrellet authored Nov 18, 2021
2 parents 674b572 + d96a9a8 commit 3b92b49
Show file tree
Hide file tree
Showing 59 changed files with 218 additions and 58 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/linux/x64/libfgt_SDK.so
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/mac/x64/libfgt_SDK.dylib
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/windows/x64/fgt_SDK.dll
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/windows/x64/fgt_SDK.lib
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/windows/x86/fgt_SDK.dll
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/windows/x86/fgt_SDK.lib
Binary file not shown.
8 changes: 8 additions & 0 deletions C#/fgt_sdk_csharp/Enums/fgt_ERROR_REPORT_MODE.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace fgt_sdk.Enums
{
public enum fgt_ERROR_REPORT_MODE
{
None,
Print,
}
}
64 changes: 49 additions & 15 deletions C#/fgt_sdk_csharp/fgtSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,45 @@ public static class fgtSdk
private const string FGT_SDK = "FGT_SDK";
private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
{
var pDll = IntPtr.Zero;

if (libraryName != FGT_SDK)
return pDll;
{
throw new NotSupportedException($"{libraryName} not supported");
}

var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
var basePath = Path.Combine(assemblyPath, "fgt_sdk_dlls");
string osFolder;
string libFile;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (Environment.Is64BitProcess)
pDll = NativeLibrary.Load(Path.Combine(basePath, "windows", "x64", "fgt_SDK.dll"));
else
pDll = NativeLibrary.Load(Path.Combine(basePath, "windows", "x86", "fgt_SDK.dll"));
osFolder = "windows";
libFile = "fgt_SDK.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
pDll = NativeLibrary.Load(Path.Combine(basePath, "linux", "x64", "libfgt_SDK.so"));
{
osFolder = "linux";
libFile = "libfgt_SDK.so";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
pDll = NativeLibrary.Load(Path.Combine(basePath, "mac", "x64", "libfgt_SDK.dylib"));
{
osFolder = "mac";
libFile = "libfgt_SDK.dylib";
}
else
throw new Exception("Operational system not supported!");
throw new NotSupportedException("Operating system not supported");

var archFolder = RuntimeInformation.ProcessArchitecture switch
{

if(pDll == null)
throw new Exception("Error when loading library!");
Architecture.X86 => "x86",
Architecture.X64 => "x64",
Architecture.Arm => "arm",
Architecture.Arm64 => "arm64",
Architecture arch => throw new NotSupportedException($"Architecture {arch} not supported"),
};

return pDll;
var libPath = Path.Combine(basePath, osFolder, archFolder, libFile);
return NativeLibrary.Load(libPath);
}

#region Imported functions
Expand Down Expand Up @@ -272,9 +286,11 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp

#endregion

private static fgt_ERROR_REPORT_MODE _errorReportMode;
static fgtSdk()
{
NativeLibrary.SetDllImportResolver(typeof(fgtSdk).Assembly, ArchResolver);
_errorReportMode = fgt_ERROR_REPORT_MODE.Print;
}

#region Private methods
Expand All @@ -289,7 +305,10 @@ static fgtSdk()
/// <returns>The error code <see cref="fgt_ERROR_CODE"/> that was returned by the low level function</returns>
private static fgt_ERROR_CODE ErrCheck(fgt_ERROR_CODE errorCode, fgt_ERRCHECK_TYPE type, uint index = 0, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "")
{
if (errorCode == fgt_ERROR_CODE.OK) return errorCode;
if (_errorReportMode == fgt_ERROR_REPORT_MODE.None || errorCode == fgt_ERROR_CODE.OK)
{
return errorCode;
}

fgt_ERROR_CODE localErrorCode;
fgt_INSTRUMENT_TYPE instrumentType;
Expand Down Expand Up @@ -327,7 +346,7 @@ private static fgt_ERROR_CODE ErrCheck(fgt_ERROR_CODE errorCode, fgt_ERRCHECK_TY
/// <summary>
/// Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments (MFCS, MFCS-EZ, FRP, LineUP, IPS) are initialized.
/// This function is optional, directly calling a function will automatically creates the instance.
/// Only one instance can be opened at once.If called again, session is reinitialized.
/// Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
/// </summary>
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
public static fgt_ERROR_CODE Fgt_init()
Expand Down Expand Up @@ -1068,6 +1087,21 @@ public static fgt_ERROR_CODE Fgt_set_manual(uint pressureIndex, float value)

#endregion

/// <summary>
/// Sets a flag that defines how SDK errors should be reported.
/// </summary>
/// <remarks>
/// None: Only return the error code enum.
/// Print: Output the error message to the console.
/// </remarks>
/// <param name="mode">Report mode</param>
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
public static fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
{
_errorReportMode = mode;
return fgt_ERROR_CODE.OK;
}

#endregion

#region Destructor
Expand Down
6 changes: 3 additions & 3 deletions C#/fgt_sdk_csharp/fgt_sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<Authors>Fluigent</Authors>
<Product>Fluigent Software Development Kit</Product>
<Description>C# Software Development Kit for Fluigent instruments</Description>
<Version>21.2.0.0</Version>
<Version>21.3.0.0</Version>
<PackageTags>Microfluidics, Control</PackageTags>
<Platforms>AnyCPU;x64;x86</Platforms>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>21.2.0.0</AssemblyVersion>
<AssemblyVersion>21.3.0.0</AssemblyVersion>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright (c) Fluigent 2021</Copyright>
<RepositoryUrl>https://github.com/Fluigent/fgt-SDK</RepositoryUrl>
<PackageProjectUrl>https://www.fluigent.com/</PackageProjectUrl>
<FileVersion>21.2.0.0</FileVersion>
<FileVersion>21.3.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
44 changes: 38 additions & 6 deletions C++/fgt_SDK_Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
add_library(fgt_SDK SHARED IMPORTED)

if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
string(TOLOWER ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} TARGET_ARCHITECTURE)
else()
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE)
endif()

set(ARCH_IS_X86 FALSE)
set(ARCH_IS_ARM FALSE)
set(ARCH_IS_64BITS FALSE)
if(${TARGET_ARCHITECTURE} MATCHES "(x|amd)(86|64)")
set(ARCH_IS_X86 TRUE)
endif()
if(${TARGET_ARCHITECTURE} MATCHES "(arm|aarch)")
set(ARCH_IS_ARM TRUE)
endif()
if(${CMAKE_SIZEOF_VOID_P} MATCHES "8")
set(ARCH_IS_64BITS TRUE)
endif()

if(WIN32)
set(TARGET_ARCHITECTURE ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
if(${TARGET_ARCHITECTURE} STREQUAL "X86")
if(${ARCH_IS_X86} AND NOT ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x86/fgt_SDK.dll)
set_property(TARGET fgt_SDK PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x86/fgt_SDK.lib)
elseif(${TARGET_ARCHITECTURE} STREQUAL "x64")
elseif(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x64/fgt_SDK.dll)
set_property(TARGET fgt_SDK PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x64/fgt_SDK.lib)
else()
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported")
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on Windows")
endif()

elseif(UNIX AND NOT APPLE)
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/x64/libfgt_SDK.so)
if(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/x64/libfgt_SDK.so)
elseif(${ARCH_IS_ARM} AND NOT ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/arm/libfgt_SDK.so)
elseif(${ARCH_IS_ARM} AND ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/arm64/libfgt_SDK.so)
else()
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on Linux")
endif()

elseif(APPLE)
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/mac/x64/libfgt_SDK.dylib)
if(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/mac/x64/libfgt_SDK.dylib)
else()
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on macOS")
endif()
else()
message(FATAL_ERROR "OS ${CMAKE_SYSTEM_NAME} not supported")
endif()
Expand Down
6 changes: 3 additions & 3 deletions C++/fgt_SDK_Cpp/dlls/fgt_SDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*
* Title: fgt_SDK.h
* Purpose: Functions API for Fluigent instruments
* Version: 21.2.0.0
* Date: 07/2021
* Version: 21.3.0.0
* Date: 11/2021
*============================================================================*/

#ifndef _FGT_SDK_H
Expand Down Expand Up @@ -150,7 +150,7 @@ typedef struct
/**
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments (MFCS, MFCS-EZ, FRP, LineUP, IPS, ESS) are initialized.
* This function is optional, directly calling a function will automatically creates the instance.
* Only one instance can be opened at once. If called again, session is reinitialized.
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
* @param void
* @return fgt_ERROR_CODE
* @see fgt_close
Expand Down
Binary file added C++/fgt_SDK_Cpp/dlls/linux/arm/libfgt_SDK.so
Binary file not shown.
Binary file added C++/fgt_SDK_Cpp/dlls/linux/arm64/libfgt_SDK.so
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/linux/x64/libfgt_SDK.so
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/mac/x64/libfgt_SDK.dylib
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/windows/x64/fgt_SDK.dll
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/windows/x64/fgt_SDK.lib
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/windows/x86/fgt_SDK.dll
Binary file not shown.
Binary file modified C++/fgt_SDK_Cpp/dlls/windows/x86/fgt_SDK.lib
Binary file not shown.
16 changes: 13 additions & 3 deletions C++/fgt_SDK_Cpp/fgt_SDK_Cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Title: fgt_SDK_Cpp.cpp
* Purpose: Wrapper to fgt_SDK library
* Contains an interface to each dll function and type conversions
* Version: 21.0.0.0
* Date: 04/2021
* Version: 21.3.0.0
* Date: 09/2021
*============================================================================*/

#include <iostream>
Expand Down Expand Up @@ -185,12 +185,14 @@ std::ostream& operator<<(std::ostream& str, const fgt_CHANNEL_INFO& info)
return str;
}

fgt_ERROR_REPORT_MODE error_report_mode = fgt_ERROR_REPORT_MODE::Print;

/** Manage pressure error and status, display details
* Change this function for custom error management, returned fgt_ERROR_CODE can directly be used in main application
* This functions calls Fgt_get_pressureStatus and displays error details */
void Fgt_Manage_Pressure_Status(unsigned int pressureIndex, std::string calledFunctionName)
{
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
fgt_INSTRUMENT_TYPE type;
unsigned short controllerSN;
unsigned char information;
Expand All @@ -214,6 +216,7 @@ void Fgt_Manage_Pressure_Status(unsigned int pressureIndex, std::string calledFu
* This functions calls Fgt_get_sensorStatus and displays error details */
void Fgt_Manage_Sensor_Status(unsigned int sensorIndex, std::string calledFunctionName)
{
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
fgt_INSTRUMENT_TYPE type;
unsigned short controllerSN;
unsigned char information;
Expand All @@ -233,6 +236,7 @@ void Fgt_Manage_Sensor_Status(unsigned int sensorIndex, std::string calledFuncti
* Change this function for custom error management, returned fgt_ERROR_CODE can directly be used in main application */
void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionName)
{
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
// If error display it
if (error != fgt_ERROR_CODE::OK) std::cout << calledFunctionName << " error " << int(error) << " - " << error << std::endl;
}
Expand All @@ -249,7 +253,7 @@ void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionN
/**
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments are initialized.
* This function is optional, directly calling a function will automatically creates the instance.
* Only one instance can be opened at once. If called again, session is reinitialized.
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
* @param void
* @return fgt_ERROR_CODE
* @see fgt_close
Expand Down Expand Up @@ -1072,3 +1076,9 @@ fgt_ERROR_CODE Fgt_set_manual(unsigned int pressureIndex, float value)
return returnCode;
}

fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
{
error_report_mode = mode;
return fgt_ERROR_CODE::OK;
}

21 changes: 18 additions & 3 deletions C++/fgt_SDK_Cpp/fgt_SDK_Cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Title: fgt_SDK_Cpp.h
* Purpose: Wrapper to fgt_SDK library
* Contains an interface to each dll function and type conversions
* Version: 21.0.0.0
* Date: 04/2021
* Version: 21.3.0.0
* Date: 09/2021
*============================================================================*/

#ifndef _FGT_SDK_CPP_H
Expand All @@ -26,6 +26,13 @@
/*------------- Custom definitions and functions section -------------------*/
/*============================================================================*/

// Defines how errors should be reported to the user
enum class fgt_ERROR_REPORT_MODE
{
None,
Print,
};

/** Overload << operator for more intuitive enum display */
/** fgt_ERROR_CODE: enumerator of all returned codes */
std::ostream& operator<<(std::ostream& str, fgt_ERROR_CODE errCode);
Expand Down Expand Up @@ -83,7 +90,7 @@ void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionN
/**
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments are initialized.
* This function is optional, directly calling a function will automatically creates the instance.
* Only one instance can be opened at once. If called again, session is reinitialized.
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
* @param void
* @return fgt_ERROR_CODE
* @see fgt_close
Expand Down Expand Up @@ -572,5 +579,13 @@ fgt_ERROR_CODE Fgt_set_purge(unsigned int controllerIndex, unsigned char purge);
*/
fgt_ERROR_CODE Fgt_set_manual(unsigned int pressureIndex, float value);

/**
* @Description Sets a flag that defines how SDK errors should be reported.
* @param mode The report mode to use.
* None: Only return the error code enum.
* Print: Output the error message to the console.
* @return fgt_ERROR_CODE
*/
fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode);

#endif
Binary file modified Fluigent SDK.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions LabVIEW/dlls/fgt_SDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*
* Title: fgt_SDK.h
* Purpose: Functions API for Fluigent instruments
* Version: 21.2.0.0
* Date: 07/2021
* Version: 21.3.0.0
* Date: 11/2021
*============================================================================*/

#ifndef _FGT_SDK_H
Expand Down Expand Up @@ -150,7 +150,7 @@ typedef struct
/**
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments (MFCS, MFCS-EZ, FRP, LineUP, IPS, ESS) are initialized.
* This function is optional, directly calling a function will automatically creates the instance.
* Only one instance can be opened at once. If called again, session is reinitialized.
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
* @param void
* @return fgt_ERROR_CODE
* @see fgt_close
Expand Down
Binary file modified LabVIEW/dlls/fgt_SDK_32.dll
Binary file not shown.
Binary file modified LabVIEW/dlls/fgt_SDK_64.dll
Binary file not shown.
Binary file modified MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/fgt_SDK_32.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [methodinfo,structs,enuminfo,ThunkLibName]=fgt_SDK_32_prototype
%FGT_SDK_32_PROTOTYPE Create structures to define interfaces found in 'fgt_SDK'.

%This function was generated by loadlibrary.m parser version on Tue Jul 13 15:27:11 2021
%This function was generated by loadlibrary.m parser version on Mon Nov 8 17:50:14 2021
%perl options:'fgt_SDK.i -outfile=fgt_SDK_32_prototype.m'
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
structs=[];enuminfo=[];fcnNum=1;
Expand Down
Binary file modified MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/fgt_SDK_64.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function [methodinfo,structs,enuminfo,ThunkLibName]=fgt_SDK_64_prototype
%FGT_SDK_64_PROTOTYPE Create structures to define interfaces found in 'fgt_SDK'.

%This function was generated by loadlibrary.m parser version on Tue Jul 13 15:27:11 2021
%This function was generated by loadlibrary.m parser version on Mon Nov 8 17:50:14 2021
%perl options:'fgt_SDK.i -outfile=fgt_SDK_64_prototype.m -thunkfile=fgt_sdk_thunk_pcwin64.c -header=fgt_SDK.h'
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
structs=[];enuminfo=[];fcnNum=1;
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/load_fgt.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
function load_fgt()
%LOAD_FGT Load the Fluigent SDK shared library

global fgt_error_report_mode;

if not(libisloaded('fgt_sdk'))

function_fullname = mfilename('fullpath');
Expand All @@ -16,6 +18,8 @@ function load_fgt()
lib_path = fullfile( function_directory, 'fgt_SDK_32.dll');
loadlibrary(lib_path,@fgt_SDK_32_prototype, 'alias', 'fgt_sdk');
end

fgt_error_report_mode = 'print';
end

end
Expand Down
Loading

0 comments on commit 3b92b49

Please sign in to comment.