Skip to content

Commit

Permalink
Fix NativeImport examples to reflect updated enum names
Browse files Browse the repository at this point in the history
  • Loading branch information
timyhac committed Jul 26, 2024
1 parent ae941f4 commit 605f792
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/CSharp NativeImport/CSharp NativeImport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="libplctag.NativeImport" Version="1.0.40" />
<PackageReference Include="libplctag.NativeImport" Version="2.0.0-alpha.2" />
</ItemGroup>

</Project>
14 changes: 5 additions & 9 deletions examples/CSharp NativeImport/Multithread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

using libplctag.NativeImport;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace NativeImport_Examples
{
Expand Down Expand Up @@ -47,7 +43,7 @@ static void thread_func(object data)
Console.WriteLine($"Locking in {tid}");
rc = plctag.plc_tag_lock(tag);

if (rc != (int)STATUS_CODES.PLCTAG_STATUS_OK)
if (rc != (int)STATUS.PLCTAG_STATUS_OK)
{
value = 1000;
break; /* punt, no lock */
Expand All @@ -56,7 +52,7 @@ static void thread_func(object data)
Console.WriteLine($"Reading in {tid}");
rc = plctag.plc_tag_read(tag, DATA_TIMEOUT);

if (rc != (int)STATUS_CODES.PLCTAG_STATUS_OK)
if (rc != (int)STATUS.PLCTAG_STATUS_OK)
{
value = 1001;
}
Expand Down Expand Up @@ -93,13 +89,13 @@ static void thread_func(object data)

static public int main()
{
int rc = (int)STATUS_CODES.PLCTAG_STATUS_OK;
int rc = (int)STATUS.PLCTAG_STATUS_OK;
Thread[] thread = new Thread[MAX_THREADS];
int num_threads;
int thread_id = 0;

/* check the library version. */
if (plctag.plc_tag_check_lib_version(2,1,0) != (int)STATUS_CODES.PLCTAG_STATUS_OK)
if (plctag.plc_tag_check_lib_version(2,1,0) != (int)STATUS.PLCTAG_STATUS_OK)
{
Console.WriteLine("Required compatible library version 2.1.0 not available!");
return 1;
Expand Down Expand Up @@ -130,7 +126,7 @@ static public int main()
return 0;
}

if ((rc = plctag.plc_tag_status(tag)) != (int)STATUS_CODES.PLCTAG_STATUS_OK)
if ((rc = plctag.plc_tag_status(tag)) != (int)STATUS.PLCTAG_STATUS_OK)
{
Console.WriteLine($"Error setting up tag internal state. {plctag.plc_tag_decode_error(rc)}");
plctag.plc_tag_destroy(tag);
Expand Down

0 comments on commit 605f792

Please sign in to comment.