Skip to content

Commit 26df7ed

Browse files
authored
Merge pull request #30 from Fluigent/version-21.0.0.0
Update SDK to version 21.0.0.0
2 parents be7b550 + fe90685 commit 26df7ed

File tree

326 files changed

+3216
-5600
lines changed

Some content is hidden

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

326 files changed

+3216
-5600
lines changed

C#/Examples/Advanced Custom Sensor Regulation/Advanced Custom Sensor Regulation.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<RootNamespace>Advanced_Custom_Sensor_Regulation</RootNamespace>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
88
</PropertyGroup>

C#/Examples/Advanced Features/Advanced Features.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<RootNamespace>Advanced_Features</RootNamespace>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
88
</PropertyGroup>

C#/Examples/Advanced Parallel Pressure Control/Advanced Parallel Pressure Control.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<RootNamespace>Advanced_Parallel_Pressure_Control</RootNamespace>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
88
</PropertyGroup>

C#/Examples/Advanced Specific Multiple Instruments/Advanced Specific Multiple Instruments.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88

C#/Examples/Basic Get Instruments Info/Basic Get Instruments Info.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88

C#/Examples/Basic Get Instruments Info/Program.cs

+21-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static void Main(string[] args)
2020
Console.WriteLine($"Total number of controller(s): {controllersCount}");
2121

2222
fgt_ERROR_CODE errCode;
23-
int pressureChannelsCount, sensorChannelsCount, ttlChannelsCount;
23+
int pressureChannelsCount, sensorChannelsCount, ttlChannelsCount, valveChannelsCount;
2424

2525
if (controllersCount > 0)
2626
{
@@ -49,6 +49,10 @@ static void Main(string[] args)
4949
(errCode, ttlChannelsCount) = fgtSdk.Fgt_get_TtlChannelCount();
5050
Console.WriteLine($"Total number of TTL channels: {ttlChannelsCount}{Environment.NewLine}");
5151

52+
// Get total number of initialized TTL channel(s)
53+
(errCode, valveChannelsCount) = fgtSdk.Fgt_get_valveChannelCount();
54+
Console.WriteLine($"Total number of valve channels: {valveChannelsCount}{Environment.NewLine}");
55+
5256
// Get detailed information about all controller(s)
5357
List<fgt_CONTROLLER_INFO> controllerInfos;
5458
(errCode, controllerInfos) = fgtSdk.Fgt_get_controllersInfo();
@@ -107,6 +111,22 @@ static void Main(string[] args)
107111
$"ID: {ttlChannelsInfo[index].IndexId}{Environment.NewLine}" +
108112
$"Type: {ttlChannelsInfo[index].InstrType}{Environment.NewLine}");
109113
}
114+
115+
// Get detailed information about all valve channels
116+
List<(fgt_CHANNEL_INFO channelInfo, fgt_VALVE_TYPE valveType)> valveChannelsInfo;
117+
(errCode, valveChannelsInfo) = fgtSdk.Fgt_get_valveChannelsInfo();
118+
for (var index = 0; index < valveChannelsCount; index++)
119+
{
120+
Console.WriteLine($"Valve channel info at index: {index}{Environment.NewLine}" +
121+
$"Controller SN: {valveChannelsInfo[index].channelInfo.ControllerSN}{Environment.NewLine}" +
122+
$"Device SN: {valveChannelsInfo[index].channelInfo.DeviceSN}{Environment.NewLine}" +
123+
$"Firmware: {valveChannelsInfo[index].channelInfo.Firmware}{Environment.NewLine}" +
124+
$"Position: {valveChannelsInfo[index].channelInfo.Position}{Environment.NewLine}" +
125+
$"Index: {valveChannelsInfo[index].channelInfo.Index}{Environment.NewLine}" +
126+
$"ID: {valveChannelsInfo[index].channelInfo.IndexId}{Environment.NewLine}" +
127+
$"Type: {valveChannelsInfo[index].channelInfo.InstrType}{Environment.NewLine}" +
128+
$"Valve type: {valveChannelsInfo[index].valveType}{Environment.NewLine}");
129+
}
110130
}
111131
else
112132
{

C#/Examples/Basic Read Sensor Data/Basic Read Sensor Data.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<RootNamespace>Read_Sensor_Data</RootNamespace>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
88
</PropertyGroup>

C#/Examples/Basic Sensor Regulation/Basic Sensor Regulation.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88

C#/Examples/Basic Set Pressure/Basic Set Pressure.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
77
</PropertyGroup>
88

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<RootNamespace>Basic_Set_Valve_Position</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\fgt_sdk_csharp\fgt_sdk.csproj" />
11+
</ItemGroup>
12+
13+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using fgt_sdk;
2+
using fgt_sdk.Enums;
3+
using System;
4+
5+
namespace fgt_sdk_example_basic_set_valve_position
6+
{
7+
internal static class Program
8+
{
9+
/// <summary>
10+
/// This example shows how to change the position of a valve
11+
/// Hardware setup: at least one Fluigent valve controller(M-Switch, L-Switch,
12+
/// 2-Switch or P-Switch)
13+
/// </summary>
14+
/// <param name="args"></param>
15+
private static void Main(string[] args)
16+
{
17+
fgt_ERROR_CODE errCode;
18+
19+
// Initialize session with all detected Fluigent instrument(s)
20+
// This step is optional, if not called session will be automatically created
21+
errCode = fgtSdk.Fgt_init();
22+
23+
if (errCode == fgt_ERROR_CODE.OK)
24+
{
25+
// Get number of valves
26+
int valveCount;
27+
(_, valveCount) = fgtSdk.Fgt_get_valveChannelCount();
28+
29+
for (uint valveIndex = 0U; valveIndex < valveCount; valveIndex++)
30+
{
31+
(fgt_ERROR_CODE _, int currentPosition) = fgtSdk.Fgt_get_valvePosition(valveIndex);
32+
Console.WriteLine($"Valve {valveIndex} is at position {currentPosition}");
33+
// Get all available positions for this valve
34+
(fgt_ERROR_CODE _, int maxPosition) = fgtSdk.Fgt_get_valveRange(valveIndex);
35+
// Set valve to each of the available positions, waiting for it to switch each time
36+
for (int position = 0; position <= maxPosition; position++)
37+
{
38+
fgtSdk.Fgt_set_valvePosition(valveIndex, position);
39+
(_, currentPosition) = fgtSdk.Fgt_get_valvePosition(valveIndex);
40+
Console.WriteLine($"Valve {valveIndex} is at position {currentPosition}");
41+
}
42+
// Return valve to default position
43+
fgtSdk.Fgt_set_valvePosition(valveIndex, 0);
44+
}
45+
}
46+
else
47+
{
48+
if (errCode == fgt_ERROR_CODE.No_instr_found)
49+
{
50+
Console.WriteLine("Please make sure that your hardware setup matches this example's requirements and that all instruments are connected to the computer");
51+
}
52+
}
53+
54+
// Close session
55+
fgtSdk.Fgt_close();
56+
}
57+
}
58+
}

C#/README.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## C# Fluigent Software Development Kit
2+
3+
C# Fluigent SDK wrapper is a multi-platform middleware built with .NET Core 3.1 for the fgt_SDK library, compatible with Windows (x86 and x64), Linux (x64) and macOS (x64).
4+
* [Repository content](#repository-content)
5+
* [Quick start](#quick-start)
6+
* [Install nuget using Visual Studio](#install-nuget-using-visual-studio)
7+
* [Install nuget using terminal](#install-nuget-using-terminal)
8+
* [Building instructions](#building-instructions)
9+
* [Build using Visual Studio](#build-using-visual-studio)
10+
* [Build using dotnet command-line interface](#build-using-dotnet-command-line-interface)
11+
* [FAQ](#faq)
12+
13+
## Repository content
14+
15+
This repository consists of the following directories:
16+
17+
+ **fgt_sdk_csharp** with the middleware source code
18+
+ **StaticFiles** with compiled fgt_SDK libraries for each supported platform and architecture
19+
+ **UnitTests** project with a couple of low level test cases
20+
+ **Examples** of how to use the wrapper:
21+
+ **Basic Get Instruments Info** - retrieve information example about Fluigent instruments: type, controller, serial number and unique ID
22+
+ **Basic Read Sensor Data** - a basic example to show how to retrieve the data from the sensor channel
23+
+ **Basic Sensor Regulation** - simple example to set a flowrate and sinusoidal profile
24+
+ **Basic Set Pressure** - simple example to set a pressure and ramp profile
25+
+ **Basic Set Valve Position** - simple example to set the positions of valves
26+
+ **Advanced Custom Sensor Regulation** - use a custom sensor example different from Fluigent ones and regulate pressure
27+
+ **Advanced Features** - advanced features example such as limits, units and calibration
28+
+ **Advanced Parallel Pressure Control** - advanced example using threads in order to apply pressure asynchronously
29+
+ **Advanced Specific Multiple Instruments** - example use of specific channels ID and multiple connected instruments
30+
31+
## Quick start
32+
The fastest and easiest way to start working with the C# wrapper for Fluigent SDK is to use the NuGeT dependency. However, you can also build the wrapper source with examples by yourself (for that check the [Building instructions](#building-instructions) section).
33+
34+
### Install nuget using Visual Studio
35+
In order to install **fgt_sdk** package you have right-click your project in the solution explorer and choose **Manage NuGeT packages...**. In the search input type **fgt_sdk**, set **nuget.org** as a package source and click install. If you cannot find the package, you can alternatively download the latest **release** from GitHub that contains the NuGeT. Then you can install the package locally by adding a new **package source** that points to a folder containing **fgt_sdk.X.X.X.nupkg** archive.
36+
37+
Useful links:
38+
39+
- [Create a .NET console application using Visual Studio](https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio)
40+
- [Manage NuGet packages in Visual Studio for Windows](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-visual-studio)
41+
- [Manage NuGet packages in Visual Studio for Mac](https://docs.microsoft.com/en-us/visualstudio/mac/nuget-walkthrough?toc=/nuget/toc.json&view=vsmac-2019)
42+
43+
### Install nuget using terminal
44+
Alternatively, you can use the terminal in order to install the **fgt_sdk** package. Here are the links to the tutorials on how to manage packages using:
45+
46+
- [dotnet command-line interface](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-dotnet-cli)
47+
- [nuget command-line interface](https://docs.microsoft.com/en-us/nuget/consume-packages/install-use-packages-nuget-cli)
48+
49+
## Building instructions
50+
51+
In order to build the project make sure you have **.NET Core 3.1 SDK and .NET Core Runtime** installed. You can download the missing platform [here](https://dotnet.microsoft.com/download).
52+
53+
### Build using Visual Studio
54+
55+
Open the `fgt_sdk_csharp.sln` file in Visual Studio. From the `Build` menu choose `Build Solution` option. In order to run an example change the startup item in the toolbar menu to the chosen project and from the `Debug` menu choose `Start Debugging`.
56+
You can find compiled package under a following path:
57+
`\fgt_sdk_csharp\bin\{build type}\fgt_sdk.X.X.X.nupkg`
58+
59+
### Build using dotnet command-line interface
60+
Open the terminal in the root directory (where the file `fgt-sdk-csharp.sln` is located). Build the project using a command below
61+
```sh
62+
dotnet build
63+
```
64+
This command will build the middleware project, produce a nuget package and compile all the examples.
65+
In order to run the example execute the `dotnet run` command with the `project` parameter:
66+
```sh
67+
dotnet run --project ./Examples/{example folder}/{example name}.csproj
68+
```
69+
70+
## FAQ
71+
Are you stuck with an error in your code? Find a couple of useful tips below! If it does not help to solve your problem and you think that you found a bug, consider adding a new issue on our [GitHub repository](https://github.com/Fluigent/fgt-SDK "GitHub repository").
72+
73+
+ *Why Fluigent class `fgtSdk` is undefined?*
74+
75+
Make sure that you include the namespace with the `using` directive
76+
```csharp
77+
using fgt_sdk;
78+
```
-188 KB
Binary file not shown.
-470 KB
Binary file not shown.

0 commit comments

Comments
 (0)