Skip to content

Commit

Permalink
Merge pull request #69 from Fluigent/version-23.0.0.0
Browse files Browse the repository at this point in the history
Update SDK to version 23.0.0.0
  • Loading branch information
Ygor-Oliveira authored Jun 16, 2023
2 parents e158ea8 + 5b62bdf commit a23eee5
Show file tree
Hide file tree
Showing 73 changed files with 462 additions and 64 deletions.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/linux/arm/libfgt_SDK.so
Binary file not shown.
Binary file modified C#/StaticFiles/fgt_sdk_dlls/linux/arm64/libfgt_SDK.so
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.
71 changes: 63 additions & 8 deletions C#/fgt_sdk_csharp/fgtSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
}

var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
var basePath = Path.Combine(assemblyPath, "fgt_sdk_dlls");
var basePath = Path.Combine(assemblyPath, "runtimes");
string osFolder;
string libFile;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
osFolder = "windows";
libFile = "fgt_SDK.dll";
osFolder = "win";
libFile = "libfgt_SDK.dll";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Expand All @@ -44,7 +44,7 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
osFolder = "mac";
osFolder = "osx";
libFile = "libfgt_SDK.dylib";
}
else
Expand All @@ -62,12 +62,10 @@ private static IntPtr ArchResolver(string libraryName, Assembly assembly, DllImp
Architecture arch => throw new NotSupportedException($"Architecture {arch} not supported"),
};

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

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

#endregion

#region Logging
// unsigned char FGT_API fgt_set_log_verbosity(unsigned int verbosity);
[DllImport(FGT_SDK)]
private static extern byte fgt_set_log_verbosity(uint verbosity);

// unsigned char FGT_API fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue);
[DllImport(FGT_SDK)]
private static extern byte fgt_set_log_output_mode(byte output_to_file, byte output_to_stderr, byte output_to_queue);

// unsigned char FGT_API fgt_get_next_log(char log[2000]);
[DllImport(FGT_SDK)]
private static extern byte fgt_get_next_log([Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 2000)] char[] detail);
#endregion

#endregion

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

#endregion

#region Logging
/// <summary>
/// Sets the verbosity of the logging feature, i.e., how much data is logged.
/// </summary>
/// <param name="verbosity">The amount of data to log. Set to 0 to disable logging (default).
/// Set to 5 to log the maximum amount of data.</param>
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
public static fgt_ERROR_CODE Fgt_set_log_verbosity(uint verbosity)
{
var errCode = ErrCheck((fgt_ERROR_CODE)fgt_set_log_verbosity(verbosity), fgt_ERRCHECK_TYPE.Generic);
return errCode;
}

/// <summary>
/// Sets how the SDK outputs the log entries.
/// </summary>
/// <param name="output_to_file">Output log entries to a file in the current directory. Default: enabled.</param>
/// <param name="output_to_stderr">Output log entries to the stderr pipe (console). Default: disabled.</param>
/// <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>
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
public static fgt_ERROR_CODE Fgt_set_log_output_mode(bool output_to_file, bool output_to_stderr, bool output_to_queue)
{
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);
return errCode;
}

/// <summary>
/// Returns the next log entry stored in memory, if any, and removes it from the queue.
/// Will return an error if the queue is empty.Logs are only stored in memory if the corresponding
/// option is set with the <see cref="Fgt_set_log_output_mode"/> function.
/// Call this function repeatedly until an error is returned to retrieve all log entries.
/// </summary>
/// <returns>Error code <see cref="fgt_ERROR_CODE"/></returns>
public static (fgt_ERROR_CODE, string log) Fgt_get_next_log()
{
var log = new char[2000];
var errCode = ErrCheck((fgt_ERROR_CODE)fgt_get_next_log(log), fgt_ERRCHECK_TYPE.Generic);
if (errCode != fgt_ERROR_CODE.OK) { return (errCode, string.Empty); }
var logString = new string(log.TakeWhile(c => c != '\0').ToArray());
return (errCode, logString);
}
#endregion

/// <summary>
/// Sets a flag that defines how SDK errors should be reported.
/// </summary>
Expand Down
16 changes: 10 additions & 6 deletions C#/fgt_sdk_csharp/fgt_sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
<Authors>Fluigent</Authors>
<Product>Fluigent Software Development Kit</Product>
<Description>C# Software Development Kit for Fluigent instruments</Description>
<Version>22.2.0.0</Version>
<Version>23.0.0.0</Version>
<PackageTags>Microfluidics, Control</PackageTags>
<Platforms>AnyCPU;x64;x86</Platforms>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>22.2.0.0</AssemblyVersion>
<AssemblyVersion>23.0.0.0</AssemblyVersion>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Copyright>Copyright (c) Fluigent 2022</Copyright>
<Copyright>Copyright (c) Fluigent 2023</Copyright>
<RepositoryUrl>https://github.com/Fluigent/fgt-SDK</RepositoryUrl>
<PackageProjectUrl>https://www.fluigent.com/</PackageProjectUrl>
<FileVersion>22.2.0.0</FileVersion>
<FileVersion>23.0.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Include="..\StaticFiles\**" CopyToOutputDirectory="Always" LinkPath="fgt_sdk_dlls\" Pack="true" PackagePath="fgt_sdk_dlls\" />
<None Include="fgt_sdk.targets" CopyToOutputDirectory="Always" Pack="true" PackagePath="build\" />
<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" />
<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" />
<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/" />
<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/" />
<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/" />
<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/" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions C++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)

project(SDK_cpp_examples VERSION 22.2.0.0)
project(SDK_cpp_examples VERSION 23.0.0.0)
set(CMAKE_CXX_STANDARD 11)

add_subdirectory(fgt_SDK_Cpp)
add_subdirectory(Examples)
add_subdirectory(Examples)
51 changes: 42 additions & 9 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: 22.2.0.0
* Date: 01/2023
* Version: 23.0.0.0
* Date: 05/2023
*============================================================================*/

#ifndef _FGT_SDK_H
Expand Down Expand Up @@ -114,6 +114,7 @@ extern "C"
typedef int fgt_calibration_t;
typedef int fgt_switch_direction_t;
#endif

/** @Description Structure containing pressure or sensor identification and details */
typedef struct
{
Expand Down Expand Up @@ -454,7 +455,7 @@ typedef struct
unsigned char FGT_API fgt_set_sensorCalibration(unsigned int sensorIndex, fgt_calibration_t calibration);

/**
* @Description Get sensor's current calibration table. Not supported by IPS.
* @Description Get sensor's current calibration table. Only applicable to Flow Unit sensors.
* @param sensorIndex Index of sensor channel or unique ID
* @out *calibration fgt_SENSOR_CALIBRATION
* @return fgt_ERROR_CODE
Expand All @@ -465,7 +466,7 @@ typedef struct
* @Description Apply a custom scale factor on sensor read value. This function is useful in order to adapt read sensor value to physical measurement.
* 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.
* Scale factor is applied using following formula: scaled_value = a*sensor_value + b*sensor_value^2 + c*sensor_value^3
* Note that this scale is also used for the regulation. Not supported by IPS.
* Note that this scale is also used for the regulation. Only applicable to Flow Unit sensors.
* @param sensorIndex Index of sensor channel or unique ID
* @param float a proportional multiplier value
* @param float b square multiplier value
Expand All @@ -480,7 +481,7 @@ typedef struct
* 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.
* Scale factor is applied using following formula: scaled_value = a*sensor_value + b*sensor_value^2 + c*sensor_value^3
* When applying a custom scale factor, sensor range may increase very rapidly, SMax parameter is meant to limit this maximal value.
* 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.
* 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.
* @param sensorIndex Index of sensor channel or unique ID
* @param float a proportional multiplier value
* @param float b square multiplier value
Expand All @@ -505,8 +506,9 @@ typedef struct
* Custom sensors, outside Fluigent ones, can be used such as different flow-units, pressure, level ...
* However we do not guarantee full compatibility with all sensors. Regulation quality is linked to sensor precision and your set-up.
* In order to use this function, custom used sensor maximum range and measured values has to be updated at least once per second.
* Directly setting pressure on same pressureIndex will stop regulation. Not supported by IPS.
* This function must be called at 1Hz minimum or the regulation will stop.
* Directly setting pressure on same pressureIndex will stop regulation.
* This function must be called at least once per second to update the sensor measurement,
* or the regulation will stop.
* @param measure custom sensor measured value, no unit is required
* @param setpoint custom sensor regulation goal value, no unit is required
* @param pressureIndex Index of pressure channel or unique ID
Expand All @@ -525,7 +527,7 @@ typedef struct
unsigned char FGT_API fgt_get_pressureRange(unsigned int pressureIndex, float* Pmin, float* Pmax);

/**
* @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.
* @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.
* @param sensorIndex Index of sensor channel or unique ID
* @out Smin minimum measured sensor value
* @out Smax maximum measured sensor value
Expand Down Expand Up @@ -557,7 +559,7 @@ typedef struct

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

/*============================================================================*/
/*-------------------------------- Logging ---------------------------------*/
/*============================================================================*/

/**
* @Description Sets the verbosity of the logging feature, i.e., how much data is logged.
* @param verbosity The amount of data to log. Set to 0 to disable logging (default).
* Set to 5 to log the maximum amount of data.
* @return fgt_ERROR_CODE
*/
unsigned char FGT_API fgt_set_log_verbosity(unsigned int verbosity);

/**
* @Description Sets how the SDK outputs the log entries.
* @param output_to_file Output log entries to a file in the current directory. 1 to enable, 0 to disable. Default: enabled.
* @param output_to_stderr Output log entries to the stderr pipe (console). 1 to enable, 0 to disable. Default: disabled.
* @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.
* @return fgt_ERROR_CODE
*/
unsigned char FGT_API fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue);

/**
* @Description Returns the next log entry stored in memory, if any, and removes it from the queue.
* Will return an error if the queue is empty. Logs are only stored in memory if the corresponding option is set with the
* fgt_set_log_output_mode function. Call this function repeatedly until an error is returned to retrieve all log entries.
* @param log char array provided by the user, on which the log string will be copied.
* Must have at least 2000 bytes of available space.
* @return fgt_ERROR_CODE
*/
unsigned char FGT_API fgt_get_next_log(char log[2000]);


#ifdef __cplusplus
}
Expand Down
Binary file modified C++/fgt_SDK_Cpp/dlls/linux/arm/libfgt_SDK.so
Binary file not shown.
Binary file modified 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.
37 changes: 37 additions & 0 deletions C++/fgt_SDK_Cpp/fgt_SDK_Cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,43 @@ fgt_ERROR_CODE Fgt_set_sensorBypassValve(unsigned int sensorIndex, unsigned char
return returnCode;
}

/**
* @Description Sets the verbosity of the logging feature, i.e., how much data is logged.
* @param verbosity The amount of data to log. Set to 0 to disable logging (default).
* Set to 5 to log the maximum amount of data.
* @return fgt_ERROR_CODE
*/
fgt_ERROR_CODE Fgt_set_log_verbosity(unsigned int verbosity){
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_set_log_verbosity(verbosity));
return returnCode;
}

/**
* @Description Sets how the SDK outputs the log entries.
* @param output_to_file Output log entries to a file in the current directory. 1 to enable, 0 to disable. Default: enabled.
* @param output_to_stderr Output log entries to the stderr pipe (console). 1 to enable, 0 to disable. Default: disabled.
* @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.
* @return fgt_ERROR_CODE
*/
fgt_ERROR_CODE Fgt_set_log_output_mode(unsigned char output_to_file, unsigned char output_to_stderr, unsigned char output_to_queue){
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_set_log_output_mode(output_to_file, output_to_stderr, output_to_queue));
return returnCode;
}

/**
* @Description Returns the next log entry stored in memory, if any, and removes it from the queue.
* Will return an error if the queue is empty. Logs are only stored in memory if the corresponding option is set with the
* fgt_set_log_output_mode function. Call this function repeatedly until an error is returned to retrieve all log entries.
* @param log char array provided by the user, on which the log string will be copied.
* Must have at least 2000 bytes of available space.
* @return fgt_ERROR_CODE
*/
fgt_ERROR_CODE Fgt_get_next_log(std::string* log_entry){
char buffer[2000] = { 0 };
fgt_ERROR_CODE returnCode = fgt_ERROR_CODE(fgt_get_next_log(buffer));
*log_entry = buffer;
return returnCode;
}

fgt_ERROR_CODE Fgt_set_errorReportMode(fgt_ERROR_REPORT_MODE mode)
{
Expand Down
Loading

0 comments on commit a23eee5

Please sign in to comment.