Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/libplctag.NativeImport/DEBUG_MODULE.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) libplctag.NET contributors
// https://github.com/libplctag/libplctag.NET
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

namespace libplctag.NativeImport
{
/// <summary>
/// The library supports setting debug levels for individual modules.
/// This allows for fine-grained control over which subsystems produce debug output.
/// Used with <see cref="plctag.plc_tag_set_debug_module_level"/> and <see cref="plctag.plc_tag_get_debug_module_level"/>.
/// </summary>
public enum DEBUG_MODULE
{
PLCTAG_MODULE_LIB = 0,
PLCTAG_MODULE_INIT = 1,
PLCTAG_MODULE_VERSION = 2,
PLCTAG_MODULE_UTILS = 3,
PLCTAG_MODULE_AB_SESSION = 4,
PLCTAG_MODULE_AB_PCCC = 5,
PLCTAG_MODULE_AB_CIP = 6,
PLCTAG_MODULE_AB_COMMON = 7,
PLCTAG_MODULE_AB_EIP_CIP = 8,
PLCTAG_MODULE_AB_EIP_CIP_SPECIAL = 9,
PLCTAG_MODULE_AB_EIP_LGX_PCCC = 10,
PLCTAG_MODULE_AB_EIP_PLC5_PCCC = 11,
PLCTAG_MODULE_AB_EIP_PLC5_DHP = 12,
PLCTAG_MODULE_AB_EIP_SLC_PCCC = 13,
PLCTAG_MODULE_AB_EIP_SLC_DHP = 14,
PLCTAG_MODULE_AB_ERROR = 15,
PLCTAG_MODULE_OMRON_CONN = 16,
PLCTAG_MODULE_OMRON_CIP = 17,
PLCTAG_MODULE_OMRON_COMMON = 18,
PLCTAG_MODULE_OMRON_STANDARD_TAG = 19,
PLCTAG_MODULE_OMRON_RAW_TAG = 20,
PLCTAG_MODULE_MODBUS = 21,
PLCTAG_MODULE_SYSTEM = 22,
PLCTAG_MODULE_PLATFORM = 23
}
}
12 changes: 12 additions & 0 deletions src/libplctag.NativeImport/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ static NativeMethods()
public static extern void plc_tag_set_debug_level(int debug_level);


[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_get_debug_level), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int plc_tag_get_debug_level();


[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_set_debug_module_level), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int plc_tag_set_debug_module_level(int module, int debug_level);


[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_get_debug_module_level), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int plc_tag_get_debug_module_level(int module);



[DllImport(DLL_NAME, EntryPoint = nameof(plc_tag_get_string), CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)]
public static extern int plc_tag_get_string(Int32 tag_id, int string_start_offset, StringBuilder buffer, int buffer_length);
Expand Down
15 changes: 15 additions & 0 deletions src/libplctag.NativeImport/plctag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,21 @@ public static void plc_tag_set_debug_level(int debug_level)
NativeMethods.plc_tag_set_debug_level(debug_level);
}

public static int plc_tag_get_debug_level()
{
return NativeMethods.plc_tag_get_debug_level();
}

public static int plc_tag_set_debug_module_level(int module, int debug_level)
{
return NativeMethods.plc_tag_set_debug_module_level(module, debug_level);
}

public static int plc_tag_get_debug_module_level(int module)
{
return NativeMethods.plc_tag_get_debug_module_level(module);
}



public static int plc_tag_get_string(Int32 tag_id, int string_start_offset, StringBuilder buffer, int buffer_length)
Expand Down
Loading