Skip to content

Commit 3b92b49

Browse files
authored
Merge pull request #37 from Fluigent/version-21.3.0.0
Update SDK to version 21.3.0.0
2 parents 674b572 + d96a9a8 commit 3b92b49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+218
-58
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace fgt_sdk.Enums
2+
{
3+
public enum fgt_ERROR_REPORT_MODE
4+
{
5+
None,
6+
Print,
7+
}
8+
}

C#/fgt_sdk_csharp/fgtSdk.cs

+49-15
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,45 @@ public static class fgtSdk
1818
private const string FGT_SDK = "FGT_SDK";
1919
private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
2020
{
21-
var pDll = IntPtr.Zero;
22-
2321
if (libraryName != FGT_SDK)
24-
return pDll;
22+
{
23+
throw new NotSupportedException($"{libraryName} not supported");
24+
}
2525

2626
var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
2727
var basePath = Path.Combine(assemblyPath, "fgt_sdk_dlls");
28+
string osFolder;
29+
string libFile;
2830
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2931
{
30-
if (Environment.Is64BitProcess)
31-
pDll = NativeLibrary.Load(Path.Combine(basePath, "windows", "x64", "fgt_SDK.dll"));
32-
else
33-
pDll = NativeLibrary.Load(Path.Combine(basePath, "windows", "x86", "fgt_SDK.dll"));
32+
osFolder = "windows";
33+
libFile = "fgt_SDK.dll";
3434
}
3535
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
36-
pDll = NativeLibrary.Load(Path.Combine(basePath, "linux", "x64", "libfgt_SDK.so"));
36+
{
37+
osFolder = "linux";
38+
libFile = "libfgt_SDK.so";
39+
}
3740
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
38-
pDll = NativeLibrary.Load(Path.Combine(basePath, "mac", "x64", "libfgt_SDK.dylib"));
41+
{
42+
osFolder = "mac";
43+
libFile = "libfgt_SDK.dylib";
44+
}
3945
else
40-
throw new Exception("Operational system not supported!");
46+
throw new NotSupportedException("Operating system not supported");
47+
48+
var archFolder = RuntimeInformation.ProcessArchitecture switch
49+
{
4150

42-
if(pDll == null)
43-
throw new Exception("Error when loading library!");
51+
Architecture.X86 => "x86",
52+
Architecture.X64 => "x64",
53+
Architecture.Arm => "arm",
54+
Architecture.Arm64 => "arm64",
55+
Architecture arch => throw new NotSupportedException($"Architecture {arch} not supported"),
56+
};
4457

45-
return pDll;
58+
var libPath = Path.Combine(basePath, osFolder, archFolder, libFile);
59+
return NativeLibrary.Load(libPath);
4660
}
4761

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

273287
#endregion
274288

289+
private static fgt_ERROR_REPORT_MODE _errorReportMode;
275290
static fgtSdk()
276291
{
277292
NativeLibrary.SetDllImportResolver(typeof(fgtSdk).Assembly, ArchResolver);
293+
_errorReportMode = fgt_ERROR_REPORT_MODE.Print;
278294
}
279295

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

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

10691088
#endregion
10701089

1090+
/// <summary>
1091+
/// Sets a flag that defines how SDK errors should be reported.
1092+
/// </summary>
1093+
/// <remarks>
1094+
/// None: Only return the error code enum.
1095+
/// Print: Output the error message to the console.
1096+
/// </remarks>
1097+
/// <param name="mode">Report mode</param>
1098+
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
1099+
public static fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
1100+
{
1101+
_errorReportMode = mode;
1102+
return fgt_ERROR_CODE.OK;
1103+
}
1104+
10711105
#endregion
10721106

10731107
#region Destructor

C#/fgt_sdk_csharp/fgt_sdk.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
<Authors>Fluigent</Authors>
66
<Product>Fluigent Software Development Kit</Product>
77
<Description>C# Software Development Kit for Fluigent instruments</Description>
8-
<Version>21.2.0.0</Version>
8+
<Version>21.3.0.0</Version>
99
<PackageTags>Microfluidics, Control</PackageTags>
1010
<Platforms>AnyCPU;x64;x86</Platforms>
1111
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12-
<AssemblyVersion>21.2.0.0</AssemblyVersion>
12+
<AssemblyVersion>21.3.0.0</AssemblyVersion>
1313
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1414
<Copyright>Copyright (c) Fluigent 2021</Copyright>
1515
<RepositoryUrl>https://github.com/Fluigent/fgt-SDK</RepositoryUrl>
1616
<PackageProjectUrl>https://www.fluigent.com/</PackageProjectUrl>
17-
<FileVersion>21.2.0.0</FileVersion>
17+
<FileVersion>21.3.0.0</FileVersion>
1818
</PropertyGroup>
1919

2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

C++/fgt_SDK_Cpp/CMakeLists.txt

+38-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,52 @@
11
add_library(fgt_SDK SHARED IMPORTED)
22

3+
if(${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
4+
string(TOLOWER ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} TARGET_ARCHITECTURE)
5+
else()
6+
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} TARGET_ARCHITECTURE)
7+
endif()
8+
9+
set(ARCH_IS_X86 FALSE)
10+
set(ARCH_IS_ARM FALSE)
11+
set(ARCH_IS_64BITS FALSE)
12+
if(${TARGET_ARCHITECTURE} MATCHES "(x|amd)(86|64)")
13+
set(ARCH_IS_X86 TRUE)
14+
endif()
15+
if(${TARGET_ARCHITECTURE} MATCHES "(arm|aarch)")
16+
set(ARCH_IS_ARM TRUE)
17+
endif()
18+
if(${CMAKE_SIZEOF_VOID_P} MATCHES "8")
19+
set(ARCH_IS_64BITS TRUE)
20+
endif()
21+
322
if(WIN32)
4-
set(TARGET_ARCHITECTURE ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
5-
if(${TARGET_ARCHITECTURE} STREQUAL "X86")
23+
if(${ARCH_IS_X86} AND NOT ${ARCH_IS_64BITS})
624
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x86/fgt_SDK.dll)
725
set_property(TARGET fgt_SDK PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x86/fgt_SDK.lib)
8-
elseif(${TARGET_ARCHITECTURE} STREQUAL "x64")
26+
elseif(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
927
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x64/fgt_SDK.dll)
1028
set_property(TARGET fgt_SDK PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/dlls/windows/x64/fgt_SDK.lib)
1129
else()
12-
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported")
30+
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on Windows")
1331
endif()
32+
1433
elseif(UNIX AND NOT APPLE)
15-
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/x64/libfgt_SDK.so)
34+
if(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
35+
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/x64/libfgt_SDK.so)
36+
elseif(${ARCH_IS_ARM} AND NOT ${ARCH_IS_64BITS})
37+
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/arm/libfgt_SDK.so)
38+
elseif(${ARCH_IS_ARM} AND ${ARCH_IS_64BITS})
39+
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/linux/arm64/libfgt_SDK.so)
40+
else()
41+
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on Linux")
42+
endif()
43+
1644
elseif(APPLE)
17-
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/mac/x64/libfgt_SDK.dylib)
45+
if(${ARCH_IS_X86} AND ${ARCH_IS_64BITS})
46+
set_property(TARGET fgt_SDK PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dlls/mac/x64/libfgt_SDK.dylib)
47+
else()
48+
message(FATAL_ERROR "Architecture ${TARGET_ARCHITECTURE} not supported on macOS")
49+
endif()
1850
else()
1951
message(FATAL_ERROR "OS ${CMAKE_SYSTEM_NAME} not supported")
2052
endif()

C++/fgt_SDK_Cpp/dlls/fgt_SDK.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*
77
* Title: fgt_SDK.h
88
* Purpose: Functions API for Fluigent instruments
9-
* Version: 21.2.0.0
10-
* Date: 07/2021
9+
* Version: 21.3.0.0
10+
* Date: 11/2021
1111
*============================================================================*/
1212

1313
#ifndef _FGT_SDK_H
@@ -150,7 +150,7 @@ typedef struct
150150
/**
151151
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments (MFCS, MFCS-EZ, FRP, LineUP, IPS, ESS) are initialized.
152152
* This function is optional, directly calling a function will automatically creates the instance.
153-
* Only one instance can be opened at once. If called again, session is reinitialized.
153+
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
154154
* @param void
155155
* @return fgt_ERROR_CODE
156156
* @see fgt_close
427 KB
Binary file not shown.
508 KB
Binary file not shown.
-23.9 KB
Binary file not shown.
-18.8 KB
Binary file not shown.
-3 KB
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

C++/fgt_SDK_Cpp/fgt_SDK_Cpp.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Title: fgt_SDK_Cpp.cpp
88
* Purpose: Wrapper to fgt_SDK library
99
* Contains an interface to each dll function and type conversions
10-
* Version: 21.0.0.0
11-
* Date: 04/2021
10+
* Version: 21.3.0.0
11+
* Date: 09/2021
1212
*============================================================================*/
1313

1414
#include <iostream>
@@ -185,12 +185,14 @@ std::ostream& operator<<(std::ostream& str, const fgt_CHANNEL_INFO& info)
185185
return str;
186186
}
187187

188+
fgt_ERROR_REPORT_MODE error_report_mode = fgt_ERROR_REPORT_MODE::Print;
188189

189190
/** Manage pressure error and status, display details
190191
* Change this function for custom error management, returned fgt_ERROR_CODE can directly be used in main application
191192
* This functions calls Fgt_get_pressureStatus and displays error details */
192193
void Fgt_Manage_Pressure_Status(unsigned int pressureIndex, std::string calledFunctionName)
193194
{
195+
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
194196
fgt_INSTRUMENT_TYPE type;
195197
unsigned short controllerSN;
196198
unsigned char information;
@@ -214,6 +216,7 @@ void Fgt_Manage_Pressure_Status(unsigned int pressureIndex, std::string calledFu
214216
* This functions calls Fgt_get_sensorStatus and displays error details */
215217
void Fgt_Manage_Sensor_Status(unsigned int sensorIndex, std::string calledFunctionName)
216218
{
219+
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
217220
fgt_INSTRUMENT_TYPE type;
218221
unsigned short controllerSN;
219222
unsigned char information;
@@ -233,6 +236,7 @@ void Fgt_Manage_Sensor_Status(unsigned int sensorIndex, std::string calledFuncti
233236
* Change this function for custom error management, returned fgt_ERROR_CODE can directly be used in main application */
234237
void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionName)
235238
{
239+
if (error_report_mode == fgt_ERROR_REPORT_MODE::None) return;
236240
// If error display it
237241
if (error != fgt_ERROR_CODE::OK) std::cout << calledFunctionName << " error " << int(error) << " - " << error << std::endl;
238242
}
@@ -249,7 +253,7 @@ void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionN
249253
/**
250254
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments are initialized.
251255
* This function is optional, directly calling a function will automatically creates the instance.
252-
* Only one instance can be opened at once. If called again, session is reinitialized.
256+
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
253257
* @param void
254258
* @return fgt_ERROR_CODE
255259
* @see fgt_close
@@ -1072,3 +1076,9 @@ fgt_ERROR_CODE Fgt_set_manual(unsigned int pressureIndex, float value)
10721076
return returnCode;
10731077
}
10741078

1079+
fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
1080+
{
1081+
error_report_mode = mode;
1082+
return fgt_ERROR_CODE::OK;
1083+
}
1084+

C++/fgt_SDK_Cpp/fgt_SDK_Cpp.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* Title: fgt_SDK_Cpp.h
88
* Purpose: Wrapper to fgt_SDK library
99
* Contains an interface to each dll function and type conversions
10-
* Version: 21.0.0.0
11-
* Date: 04/2021
10+
* Version: 21.3.0.0
11+
* Date: 09/2021
1212
*============================================================================*/
1313

1414
#ifndef _FGT_SDK_CPP_H
@@ -26,6 +26,13 @@
2626
/*------------- Custom definitions and functions section -------------------*/
2727
/*============================================================================*/
2828

29+
// Defines how errors should be reported to the user
30+
enum class fgt_ERROR_REPORT_MODE
31+
{
32+
None,
33+
Print,
34+
};
35+
2936
/** Overload << operator for more intuitive enum display */
3037
/** fgt_ERROR_CODE: enumerator of all returned codes */
3138
std::ostream& operator<<(std::ostream& str, fgt_ERROR_CODE errCode);
@@ -83,7 +90,7 @@ void Fgt_Manage_Generic_Status(fgt_ERROR_CODE error, std::string calledFunctionN
8390
/**
8491
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments are initialized.
8592
* This function is optional, directly calling a function will automatically creates the instance.
86-
* Only one instance can be opened at once. If called again, session is reinitialized.
93+
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
8794
* @param void
8895
* @return fgt_ERROR_CODE
8996
* @see fgt_close
@@ -572,5 +579,13 @@ fgt_ERROR_CODE Fgt_set_purge(unsigned int controllerIndex, unsigned char purge);
572579
*/
573580
fgt_ERROR_CODE Fgt_set_manual(unsigned int pressureIndex, float value);
574581

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

576591
#endif

Fluigent SDK.pdf

773 Bytes
Binary file not shown.

LabVIEW/dlls/fgt_SDK.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*
77
* Title: fgt_SDK.h
88
* Purpose: Functions API for Fluigent instruments
9-
* Version: 21.2.0.0
10-
* Date: 07/2021
9+
* Version: 21.3.0.0
10+
* Date: 11/2021
1111
*============================================================================*/
1212

1313
#ifndef _FGT_SDK_H
@@ -150,7 +150,7 @@ typedef struct
150150
/**
151151
* @Description Initialize or reinitialize (if already opened) Fluigent SDK instance. All detected Fluigent instruments (MFCS, MFCS-EZ, FRP, LineUP, IPS, ESS) are initialized.
152152
* This function is optional, directly calling a function will automatically creates the instance.
153-
* Only one instance can be opened at once. If called again, session is reinitialized.
153+
* Only one instance can be opened at a time. If called again, any new instruments are added to the same instance.
154154
* @param void
155155
* @return fgt_ERROR_CODE
156156
* @see fgt_close

LabVIEW/dlls/fgt_SDK_32.dll

1 KB
Binary file not shown.

LabVIEW/dlls/fgt_SDK_64.dll

-3 KB
Binary file not shown.
Binary file not shown.

MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/fgt_SDK_32_prototype.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function [methodinfo,structs,enuminfo,ThunkLibName]=fgt_SDK_32_prototype
22
%FGT_SDK_32_PROTOTYPE Create structures to define interfaces found in 'fgt_SDK'.
33

4-
%This function was generated by loadlibrary.m parser version on Tue Jul 13 15:27:11 2021
4+
%This function was generated by loadlibrary.m parser version on Mon Nov 8 17:50:14 2021
55
%perl options:'fgt_SDK.i -outfile=fgt_SDK_32_prototype.m'
66
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
77
structs=[];enuminfo=[];fcnNum=1;
Binary file not shown.

MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/fgt_SDK_64_prototype.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function [methodinfo,structs,enuminfo,ThunkLibName]=fgt_SDK_64_prototype
22
%FGT_SDK_64_PROTOTYPE Create structures to define interfaces found in 'fgt_SDK'.
33

4-
%This function was generated by loadlibrary.m parser version on Tue Jul 13 15:27:11 2021
4+
%This function was generated by loadlibrary.m parser version on Mon Nov 8 17:50:14 2021
55
%perl options:'fgt_SDK.i -outfile=fgt_SDK_64_prototype.m -thunkfile=fgt_sdk_thunk_pcwin64.c -header=fgt_SDK.h'
66
ival={cell(1,0)}; % change 0 to the actual number of functions to preallocate the data.
77
structs=[];enuminfo=[];fcnNum=1;
Binary file not shown.
Binary file not shown.

MATLAB/Toolbox/SDK/Fluigent/+LowLevel/private/load_fgt.m

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
function load_fgt()
22
%LOAD_FGT Load the Fluigent SDK shared library
33

4+
global fgt_error_report_mode;
5+
46
if not(libisloaded('fgt_sdk'))
57

68
function_fullname = mfilename('fullpath');
@@ -16,6 +18,8 @@ function load_fgt()
1618
lib_path = fullfile( function_directory, 'fgt_SDK_32.dll');
1719
loadlibrary(lib_path,@fgt_SDK_32_prototype, 'alias', 'fgt_sdk');
1820
end
21+
22+
fgt_error_report_mode = 'print';
1923
end
2024

2125
end

0 commit comments

Comments
 (0)