Skip to content

Commit a23eee5

Browse files
Merge pull request #69 from Fluigent/version-23.0.0.0
Update SDK to version 23.0.0.0
2 parents e158ea8 + 5b62bdf commit a23eee5

File tree

73 files changed

+462
-64
lines changed

Some content is hidden

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

73 files changed

+462
-64
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
676 Bytes
Binary file not shown.
Binary file not shown.
726 Bytes
Binary file not shown.

C#/fgt_sdk_csharp/fgtSdk.cs

+63-8
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
2929
}
3030

3131
var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
32-
var basePath = Path.Combine(assemblyPath, "fgt_sdk_dlls");
32+
var basePath = Path.Combine(assemblyPath, "runtimes");
3333
string osFolder;
3434
string libFile;
3535
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
3636
{
37-
osFolder = "windows";
38-
libFile = "fgt_SDK.dll";
37+
osFolder = "win";
38+
libFile = "libfgt_SDK.dll";
3939
}
4040
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
4141
{
@@ -44,7 +44,7 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
4444
}
4545
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
4646
{
47-
osFolder = "mac";
47+
osFolder = "osx";
4848
libFile = "libfgt_SDK.dylib";
4949
}
5050
else
@@ -62,12 +62,10 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
6262
Architecture arch => throw new NotSupportedException($"Architecture {arch} not supported"),
6363
};
6464

65-
var libPath = Path.Combine(basePath, osFolder, archFolder, libFile);
65+
var libPath = Path.Combine(basePath, $"{osFolder}-{archFolder}", "native", libFile);
6666
if (!File.Exists(libPath))
6767
{
68-
// Native library can be placed in the root folder containing the executable that uses it
69-
// When doing so, prepend "lib" on Windows to avoid a name collision with the assembly DLL
70-
libPath = Path.Combine(assemblyPath, libFile.StartsWith("lib") ? libFile : "lib" + libFile);
68+
libPath = Path.Combine(assemblyPath, libFile);
7169
}
7270

7371
_nativeLibPointer = NativeLibrary.Load(libPath);
@@ -340,6 +338,20 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
340338

341339
#endregion
342340

341+
#region Logging
342+
// unsigned char FGT_API fgt_set_log_verbosity(unsigned int verbosity);
343+
[DllImport(FGT_SDK)]
344+
private static extern byte fgt_set_log_verbosity(uint verbosity);
345+
346+
// unsigned char FGT_API fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue);
347+
[DllImport(FGT_SDK)]
348+
private static extern byte fgt_set_log_output_mode(byte output_to_file, byte output_to_stderr, byte output_to_queue);
349+
350+
// unsigned char FGT_API fgt_get_next_log(char log[2000]);
351+
[DllImport(FGT_SDK)]
352+
private static extern byte fgt_get_next_log([Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 2000)] char[] detail);
353+
#endregion
354+
343355
#endregion
344356

345357
private static fgt_ERROR_REPORT_MODE _errorReportMode;
@@ -1289,6 +1301,49 @@ public static fgt_ERROR_CODE Fgt_set_sensorBypassValve(uint sensorIndex, bool st
12891301

12901302
#endregion
12911303

1304+
#region Logging
1305+
/// <summary>
1306+
/// Sets the verbosity of the logging feature, i.e., how much data is logged.
1307+
/// </summary>
1308+
/// <param name="verbosity">The amount of data to log. Set to 0 to disable logging (default).
1309+
/// Set to 5 to log the maximum amount of data.</param>
1310+
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
1311+
public static fgt_ERROR_CODE Fgt_set_log_verbosity(uint verbosity)
1312+
{
1313+
var errCode = ErrCheck((fgt_ERROR_CODE)fgt_set_log_verbosity(verbosity), fgt_ERRCHECK_TYPE.Generic);
1314+
return errCode;
1315+
}
1316+
1317+
/// <summary>
1318+
/// Sets how the SDK outputs the log entries.
1319+
/// </summary>
1320+
/// <param name="output_to_file">Output log entries to a file in the current directory. Default: enabled.</param>
1321+
/// <param name="output_to_stderr">Output log entries to the stderr pipe (console). Default: disabled.</param>
1322+
/// <param name="output_to_queue">Store log entries in memory. They can be retrieved via the <see cref="Fgt_get_next_log"/> function. Default: disabled.</param>
1323+
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
1324+
public static fgt_ERROR_CODE Fgt_set_log_output_mode(bool output_to_file, bool output_to_stderr, bool output_to_queue)
1325+
{
1326+
var errCode = ErrCheck((fgt_ERROR_CODE)fgt_set_log_output_mode((byte)(output_to_file ? 1 : 0), (byte)(output_to_stderr ? 1 : 0), (byte)(output_to_queue ? 1 : 0)), fgt_ERRCHECK_TYPE.Generic);
1327+
return errCode;
1328+
}
1329+
1330+
/// <summary>
1331+
/// Returns the next log entry stored in memory, if any, and removes it from the queue.
1332+
/// Will return an error if the queue is empty.Logs are only stored in memory if the corresponding
1333+
/// option is set with the <see cref="Fgt_set_log_output_mode"/> function.
1334+
/// Call this function repeatedly until an error is returned to retrieve all log entries.
1335+
/// </summary>
1336+
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
1337+
public static (fgt_ERROR_CODE, string log) Fgt_get_next_log()
1338+
{
1339+
var log = new char[2000];
1340+
var errCode = ErrCheck((fgt_ERROR_CODE)fgt_get_next_log(log), fgt_ERRCHECK_TYPE.Generic);
1341+
if (errCode != fgt_ERROR_CODE.OK) { return (errCode, string.Empty); }
1342+
var logString = new string(log.TakeWhile(c => c != '\0').ToArray());
1343+
return (errCode, logString);
1344+
}
1345+
#endregion
1346+
12921347
/// <summary>
12931348
/// Sets a flag that defines how SDK errors should be reported.
12941349
/// </summary>

C#/fgt_sdk_csharp/fgt_sdk.csproj

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

2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
2121
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2222
</PropertyGroup>
2323
<ItemGroup>
24-
<None Include="..\StaticFiles\**" CopyToOutputDirectory="Always" LinkPath="fgt_sdk_dlls\" Pack="true" PackagePath="fgt_sdk_dlls\" />
25-
<None Include="fgt_sdk.targets" CopyToOutputDirectory="Always" Pack="true" PackagePath="build\" />
24+
<None Include="../StaticFiles/fgt_sdk_dlls/windows/x86/fgt_SDK.dll" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/win-x86/native/libfgt_SDK.dll" PackagePath="runtimes/win-x86/native/libfgt_SDK.dll" />
25+
<None Include="../StaticFiles/fgt_sdk_dlls/windows/x64/fgt_SDK.dll" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/win-x64/native/libfgt_SDK.dll" PackagePath="runtimes/win-x64/native/libfgt_SDK.dll" />
26+
<None Include="../StaticFiles/fgt_sdk_dlls/linux/x64/libfgt_SDK.so" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/linux-x64/native/libfgt_SDK.so" PackagePath="runtimes/linux-x64/native/" />
27+
<None Include="../StaticFiles/fgt_sdk_dlls/linux/arm/libfgt_SDK.so" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/linux-arm/native/libfgt_SDK.so" PackagePath="runtimes/linux-arm/native/" />
28+
<None Include="../StaticFiles/fgt_sdk_dlls/linux/arm64/libfgt_SDK.so" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/linux-arm64/native/libfgt_SDK.so" PackagePath="runtimes/linux-arm64/native/" />
29+
<None Include="../StaticFiles/fgt_sdk_dlls/mac/x64/libfgt_SDK.dylib" CopyToOutputDirectory="PreserveNewest" Pack="true" Link="runtimes/osx-x64/native/libfgt_SDK.dylib" PackagePath="runtimes/osx-x64/native/" />
2630
</ItemGroup>
2731
</Project>

C++/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
project(SDK_cpp_examples VERSION 22.2.0.0)
3+
project(SDK_cpp_examples VERSION 23.0.0.0)
44
set(CMAKE_CXX_STANDARD 11)
55

66
add_subdirectory(fgt_SDK_Cpp)
7-
add_subdirectory(Examples)
7+
add_subdirectory(Examples)

C++/fgt_SDK_Cpp/dlls/fgt_SDK.h

+42-9
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: 22.2.0.0
10-
* Date: 01/2023
9+
* Version: 23.0.0.0
10+
* Date: 05/2023
1111
*============================================================================*/
1212

1313
#ifndef _FGT_SDK_H
@@ -114,6 +114,7 @@ extern "C"
114114
typedef int fgt_calibration_t;
115115
typedef int fgt_switch_direction_t;
116116
#endif
117+
117118
/** @Description Structure containing pressure or sensor identification and details */
118119
typedef struct
119120
{
@@ -454,7 +455,7 @@ typedef struct
454455
unsigned char FGT_API fgt_set_sensorCalibration(unsigned int sensorIndex, fgt_calibration_t calibration);
455456

456457
/**
457-
* @Description Get sensor's current calibration table. Not supported by IPS.
458+
* @Description Get sensor's current calibration table. Only applicable to Flow Unit sensors.
458459
* @param sensorIndex Index of sensor channel or unique ID
459460
* @out *calibration fgt_SENSOR_CALIBRATION
460461
* @return fgt_ERROR_CODE
@@ -465,7 +466,7 @@ typedef struct
465466
* @Description Apply a custom scale factor on sensor read value. This function is useful in order to adapt read sensor value to physical measurement.
466467
* For example if a flow-unit is used with a special oil and it's calibration table is set to H2O, read flowrate is not correct.
467468
* Scale factor is applied using following formula: scaled_value = a*sensor_value + b*sensor_value^2 + c*sensor_value^3
468-
* Note that this scale is also used for the regulation. Not supported by IPS.
469+
* Note that this scale is also used for the regulation. Only applicable to Flow Unit sensors.
469470
* @param sensorIndex Index of sensor channel or unique ID
470471
* @param float a proportional multiplier value
471472
* @param float b square multiplier value
@@ -480,7 +481,7 @@ typedef struct
480481
* For example if a flow-unit is used with a special oil and it's calibration table is set to H2O, read flowrate is not correct.
481482
* Scale factor is applied using following formula: scaled_value = a*sensor_value + b*sensor_value^2 + c*sensor_value^3
482483
* When applying a custom scale factor, sensor range may increase very rapidly, SMax parameter is meant to limit this maximal value.
483-
* This function purpose is to be used with the regulation in order to avoid too high maximum range on the sensor. Not supported by IPS.
484+
* This function purpose is to be used with the regulation in order to avoid too high maximum range on the sensor. Only applicable to Flow Unit sensors.
484485
* @param sensorIndex Index of sensor channel or unique ID
485486
* @param float a proportional multiplier value
486487
* @param float b square multiplier value
@@ -505,8 +506,9 @@ typedef struct
505506
* Custom sensors, outside Fluigent ones, can be used such as different flow-units, pressure, level ...
506507
* However we do not guarantee full compatibility with all sensors. Regulation quality is linked to sensor precision and your set-up.
507508
* In order to use this function, custom used sensor maximum range and measured values has to be updated at least once per second.
508-
* Directly setting pressure on same pressureIndex will stop regulation. Not supported by IPS.
509-
* This function must be called at 1Hz minimum or the regulation will stop.
509+
* Directly setting pressure on same pressureIndex will stop regulation.
510+
* This function must be called at least once per second to update the sensor measurement,
511+
* or the regulation will stop.
510512
* @param measure custom sensor measured value, no unit is required
511513
* @param setpoint custom sensor regulation goal value, no unit is required
512514
* @param pressureIndex Index of pressure channel or unique ID
@@ -525,7 +527,7 @@ typedef struct
525527
unsigned char FGT_API fgt_get_pressureRange(unsigned int pressureIndex, float* Pmin, float* Pmax);
526528

527529
/**
528-
* @Description Get sensor minimum and maximum range. Returned values takes into account set unit, default value is 'µl/min' in case of flow-units and 'mbar' for pressure sensors.
530+
* @Description Get sensor minimum and maximum range. Returned values takes into account set unit, default value is 'µl/min' in case of Flow Units and 'mbar' for pressure sensors.
529531
* @param sensorIndex Index of sensor channel or unique ID
530532
* @out Smin minimum measured sensor value
531533
* @out Smax maximum measured sensor value
@@ -557,7 +559,7 @@ typedef struct
557559

558560
/**
559561
* @Description Set on a running regulation pressure response time. Minimal value is 2 for FlowEZ, 6 for MFCS controllers.
560-
* This function is useful if a more smooth response is wanted. Not supported by IPS.
562+
* This function is useful if a more smooth response is wanted.
561563
* @param sensorIndex Index of sensor channel or unique ID
562564
* @param responseTime pressure response time in seconds
563565
* @return fgt_ERROR_CODE
@@ -747,6 +749,37 @@ typedef struct
747749
*/
748750
unsigned char FGT_API fgt_set_sensorBypassValve(unsigned int sensorIndex, unsigned char state);
749751

752+
/*============================================================================*/
753+
/*-------------------------------- Logging ---------------------------------*/
754+
/*============================================================================*/
755+
756+
/**
757+
* @Description Sets the verbosity of the logging feature, i.e., how much data is logged.
758+
* @param verbosity The amount of data to log. Set to 0 to disable logging (default).
759+
* Set to 5 to log the maximum amount of data.
760+
* @return fgt_ERROR_CODE
761+
*/
762+
unsigned char FGT_API fgt_set_log_verbosity(unsigned int verbosity);
763+
764+
/**
765+
* @Description Sets how the SDK outputs the log entries.
766+
* @param output_to_file Output log entries to a file in the current directory. 1 to enable, 0 to disable. Default: enabled.
767+
* @param output_to_stderr Output log entries to the stderr pipe (console). 1 to enable, 0 to disable. Default: disabled.
768+
* @param output_to_queue Store log entries in memory. They can be retrieved via the fgt_get_next_log function. 1 to enable, 0 to disable. Default: disabled.
769+
* @return fgt_ERROR_CODE
770+
*/
771+
unsigned char FGT_API fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue);
772+
773+
/**
774+
* @Description Returns the next log entry stored in memory, if any, and removes it from the queue.
775+
* Will return an error if the queue is empty. Logs are only stored in memory if the corresponding option is set with the
776+
* fgt_set_log_output_mode function. Call this function repeatedly until an error is returned to retrieve all log entries.
777+
* @param log char array provided by the user, on which the log string will be copied.
778+
* Must have at least 2000 bytes of available space.
779+
* @return fgt_ERROR_CODE
780+
*/
781+
unsigned char FGT_API fgt_get_next_log(char log[2000]);
782+
750783

751784
#ifdef __cplusplus
752785
}
120 KB
Binary file not shown.
124 KB
Binary file not shown.
140 KB
Binary file not shown.
228 KB
Binary file not shown.
114 KB
Binary file not shown.
676 Bytes
Binary file not shown.
114 KB
Binary file not shown.
726 Bytes
Binary file not shown.

C++/fgt_SDK_Cpp/fgt_SDK_Cpp.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,43 @@ fgt_ERROR_CODE Fgt_set_sensorBypassValve(unsigned int sensorIndex, unsigned char
12311231
return returnCode;
12321232
}
12331233

1234+
/**
1235+
* @Description Sets the verbosity of the logging feature, i.e., how much data is logged.
1236+
* @param verbosity The amount of data to log. Set to 0 to disable logging (default).
1237+
* Set to 5 to log the maximum amount of data.
1238+
* @return fgt_ERROR_CODE
1239+
*/
1240+
fgt_ERROR_CODE Fgt_set_log_verbosity(unsigned int verbosity){
1241+
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_set_log_verbosity(verbosity));
1242+
return returnCode;
1243+
}
1244+
1245+
/**
1246+
* @Description Sets how the SDK outputs the log entries.
1247+
* @param output_to_file Output log entries to a file in the current directory. 1 to enable, 0 to disable. Default: enabled.
1248+
* @param output_to_stderr Output log entries to the stderr pipe (console). 1 to enable, 0 to disable. Default: disabled.
1249+
* @param output_to_queue Store log entries in memory. They can be retrieved via the fgt_get_next_log function. 1 to enable, 0 to disable. Default: disabled.
1250+
* @return fgt_ERROR_CODE
1251+
*/
1252+
fgt_ERROR_CODE Fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue){
1253+
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_set_log_output_mode(output_to_file, output_to_stderr, output_to_queue));
1254+
return returnCode;
1255+
}
1256+
1257+
/**
1258+
* @Description Returns the next log entry stored in memory, if any, and removes it from the queue.
1259+
* Will return an error if the queue is empty. Logs are only stored in memory if the corresponding option is set with the
1260+
* fgt_set_log_output_mode function. Call this function repeatedly until an error is returned to retrieve all log entries.
1261+
* @param log char array provided by the user, on which the log string will be copied.
1262+
* Must have at least 2000 bytes of available space.
1263+
* @return fgt_ERROR_CODE
1264+
*/
1265+
fgt_ERROR_CODE Fgt_get_next_log(std::string* log_entry){
1266+
char buffer[2000] = { 0 };
1267+
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_get_next_log(buffer));
1268+
*log_entry = buffer;
1269+
return returnCode;
1270+
}
12341271

12351272
fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
12361273
{

0 commit comments

Comments
 (0)