Skip to content

Commit

Permalink
Merge pull request #376 from libplctag/get_byte_array_attribute
Browse files Browse the repository at this point in the history
Update to libplctag core v2.6.0 and expose new API `plc_tag_get_byte_array_attribute(...)`
  • Loading branch information
timyhac authored Jun 15, 2024
2 parents a5636d2 + 59bfc5d commit b19627e
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 74 deletions.
8 changes: 6 additions & 2 deletions src/libplctag.NativeImport/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static class NativeMethods
public static extern int plc_tag_unregister_callback(Int32 tag_id);





[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_register_logger), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
Expand All @@ -60,7 +60,7 @@ static class NativeMethods
public static extern int plc_tag_unregister_logger(Int32 tag_id);





[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_lock), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
Expand Down Expand Up @@ -106,6 +106,10 @@ static class NativeMethods
public static extern int plc_tag_set_int_attribute(Int32 tag, [MarshalAs(UnmanagedType.LPStr)] string attrib_name, int new_value);


[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_get_byte_array_attribute), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
public static extern int plc_tag_get_byte_array_attribute(Int32 tag, [MarshalAs(UnmanagedType.LPStr)] string attrib_name, [In] byte[] buffer, int buffer_length);


[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_get_uint64), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern UInt64 plc_tag_get_uint64(Int32 tag, int offset);

Expand Down
6 changes: 6 additions & 0 deletions src/libplctag.NativeImport/plctag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ public static int plc_tag_set_int_attribute(Int32 tag, string attrib_name, int n
return NativeMethods.plc_tag_set_int_attribute(tag, attrib_name, new_value);
}

public static int plc_tag_get_byte_array_attribute(Int32 tag, string attrib_name, byte[] buffer, int buffer_length)
{
ExtractLibraryIfRequired();
return NativeMethods.plc_tag_get_byte_array_attribute(tag, attrib_name, buffer, buffer_length);
}

public static UInt64 plc_tag_get_uint64(Int32 tag, int offset)
{
ExtractLibraryIfRequired();
Expand Down
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/linux_ARM/libplctag.so
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/linux_ARM64/libplctag.so
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/linux_x64/libplctag.so
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/linux_x86/libplctag.so
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/osx_ARM64/libplctag.dylib
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/osx_x64/libplctag.dylib
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/win_ARM/plctag.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/win_ARM64/plctag.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/win_x64/plctag.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/libplctag.NativeImport/runtime/win_x86/plctag.dll
Git LFS file not shown
3 changes: 2 additions & 1 deletion src/libplctag/INativeTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ interface INativeTag
long plc_tag_get_int64(int tag, int offset);
sbyte plc_tag_get_int8(int tag, int offset);
int plc_tag_get_int_attribute(int tag, string attrib_name, int default_value);
int plc_tag_set_int_attribute(int tag, string attrib_name, int new_value);
int plc_tag_get_byte_array_attribute(int tag, string attrib_name, byte[] buffer, int buffer_length);
int plc_tag_get_size(int tag);
int plc_tag_set_size(int tag, int new_size);
ushort plc_tag_get_uint16(int tag, int offset);
Expand All @@ -50,7 +52,6 @@ interface INativeTag
int plc_tag_set_int32(int tag, int offset, int val);
int plc_tag_set_int64(int tag, int offset, long val);
int plc_tag_set_int8(int tag, int offset, sbyte val);
int plc_tag_set_int_attribute(int tag, string attrib_name, int new_value);
int plc_tag_set_uint16(int tag, int offset, ushort val);
int plc_tag_set_uint32(int tag, int offset, uint val);
int plc_tag_set_uint64(int tag, int offset, ulong val);
Expand Down
Loading

0 comments on commit b19627e

Please sign in to comment.