Skip to content
Open
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
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ csharp_preferred_modifier_order = public,private,protected,internal,static,exter
# Code-block preferences
csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = block_scoped
csharp_style_namespace_declarations = file_scoped
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = true

Expand Down
77 changes: 38 additions & 39 deletions src/libplctag.NativeImport/CONN_STATUS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,49 @@
// 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
namespace libplctag.NativeImport;

/// <summary>
/// You can query the connection status of a tag using the <c>connection_status</c> attribute
/// with <see cref="plctag.plc_tag_get_int_attribute"/>:
/// <code>
/// int status = plc_tag_get_int_attribute(tag, "connection_status", PLCTAG_CONN_STATUS_DOWN);
/// </code>
/// <para>
/// This attribute is read-only and can be queried at any time after tag creation.
/// It is useful for determining the current state of the connection to the PLC
/// and can be used in conjunction with callbacks to monitor connection lifecycle events.
/// </para>
/// </summary>
public enum CONN_STATUS
{
/// <summary>
/// You can query the connection status of a tag using the <c>connection_status</c> attribute
/// with <see cref="plctag.plc_tag_get_int_attribute"/>:
/// <code>
/// int status = plc_tag_get_int_attribute(tag, "connection_status", PLCTAG_CONN_STATUS_DOWN);
/// </code>
/// <para>
/// This attribute is read-only and can be queried at any time after tag creation.
/// It is useful for determining the current state of the connection to the PLC
/// and can be used in conjunction with callbacks to monitor connection lifecycle events.
/// </para>
/// Connected and ready for communication.
/// </summary>
public enum CONN_STATUS
{
/// <summary>
/// Connected and ready for communication.
/// </summary>
PLCTAG_CONN_STATUS_UP = 0,
PLCTAG_CONN_STATUS_UP = 0,

/// <summary>
/// Not connected.
/// </summary>
PLCTAG_CONN_STATUS_DOWN = 1,
/// <summary>
/// Not connected.
/// </summary>
PLCTAG_CONN_STATUS_DOWN = 1,

/// <summary>
/// Disconnection in progress.
/// </summary>
PLCTAG_CONN_STATUS_DISCONNECTING = 2,
/// <summary>
/// Disconnection in progress.
/// </summary>
PLCTAG_CONN_STATUS_DISCONNECTING = 2,

/// <summary>
/// Connection in progress.
/// </summary>
PLCTAG_CONN_STATUS_CONNECTING = 3,
/// <summary>
/// Connection in progress.
/// </summary>
PLCTAG_CONN_STATUS_CONNECTING = 3,

/// <summary>
/// Waiting to reconnect after disconnect.
/// </summary>
PLCTAG_CONN_STATUS_IDLE_WAIT = 4,
/// <summary>
/// Waiting to reconnect after disconnect.
/// </summary>
PLCTAG_CONN_STATUS_IDLE_WAIT = 4,

/// <summary>
/// Waiting to retry after error.
/// </summary>
PLCTAG_CONN_STATUS_ERR_WAIT = 5
}
}
/// <summary>
/// Waiting to retry after error.
/// </summary>
PLCTAG_CONN_STATUS_ERR_WAIT = 5
}
81 changes: 40 additions & 41 deletions src/libplctag.NativeImport/DEBUG_LEVEL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,51 @@
// 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
namespace libplctag.NativeImport;

/// <summary>
/// The library provides debugging output when enabled.
/// There are three ways to set the debug level (for historical reasons):
/// <list type="number">
/// <item>Adding a debug attribute to the attribute string when creating a tag: "protocol=XXX&amp;...&amp;debug=4".</item>
/// <item>Using the <see cref="plctag.plc_tag_set_int_attribute"/>function to set the debug attribute.</item>
/// <item>Using the <see cref="plctag.plc_tag_set_debug_level"/> function.</item>
/// </list>
/// The preferred method in code is the last one.
/// </summary>
public enum DEBUG_LEVEL
{
/// <summary>
/// The library provides debugging output when enabled.
/// There are three ways to set the debug level (for historical reasons):
/// <list type="number">
/// <item>Adding a debug attribute to the attribute string when creating a tag: "protocol=XXX&amp;...&amp;debug=4".</item>
/// <item>Using the <see cref="plctag.plc_tag_set_int_attribute"/>function to set the debug attribute.</item>
/// <item>Using the <see cref="plctag.plc_tag_set_debug_level"/> function.</item>
/// </list>
/// The preferred method in code is the last one.
/// Disables debugging output.
/// </summary>
public enum DEBUG_LEVEL
{
/// <summary>
/// Disables debugging output.
/// </summary>
PLCTAG_DEBUG_NONE = 0,
PLCTAG_DEBUG_NONE = 0,

/// <summary>
/// Only output errors. Generally these are fatal to the functioning of the library.
/// </summary>
PLCTAG_DEBUG_ERROR = 1,
/// <summary>
/// Only output errors. Generally these are fatal to the functioning of the library.
/// </summary>
PLCTAG_DEBUG_ERROR = 1,

/// <summary>
/// Outputs warnings such as error found when checking a malformed tag attribute string or when unexpected problems are reported from the PLC.
/// </summary>
PLCTAG_DEBUG_WARN = 2,
/// <summary>
/// Outputs warnings such as error found when checking a malformed tag attribute string or when unexpected problems are reported from the PLC.
/// </summary>
PLCTAG_DEBUG_WARN = 2,

/// <summary>
/// Outputs diagnostic information about the internal calls within the library.
/// Includes some packet dumps.
/// </summary>
PLCTAG_DEBUG_INFO = 3,
/// <summary>
/// Outputs diagnostic information about the internal calls within the library.
/// Includes some packet dumps.
/// </summary>
PLCTAG_DEBUG_INFO = 3,

/// <summary>
/// Outputs detailed diagnostic information about the code executing within the library including packet dumps.
/// </summary>
PLCTAG_DEBUG_DETAIL = 4,
/// <summary>
/// Outputs detailed diagnostic information about the code executing within the library including packet dumps.
/// </summary>
PLCTAG_DEBUG_DETAIL = 4,

/// <summary>
/// Outputs extremely detailed information.
/// Do not use this unless you are trying to debug detailed information about every mutex lock and release.
/// Will output many lines of output per millisecond.
/// You have been warned!
/// </summary>
PLCTAG_DEBUG_SPEW = 5
}
}
/// <summary>
/// Outputs extremely detailed information.
/// Do not use this unless you are trying to debug detailed information about every mutex lock and release.
/// Will output many lines of output per millisecond.
/// You have been warned!
/// </summary>
PLCTAG_DEBUG_SPEW = 5
}
73 changes: 36 additions & 37 deletions src/libplctag.NativeImport/DEBUG_MODULE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,40 @@
// 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
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
{
/// <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,
PLCTAG_MODULE_AB_CONNECTION = 24,
PLCTAG_MODULE_MB_CONNECTION = 25,
PLCTAG_MODULE_OMRON_CONNECTION = 26,
}
}
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,
PLCTAG_MODULE_AB_CONNECTION = 24,
PLCTAG_MODULE_MB_CONNECTION = 25,
PLCTAG_MODULE_OMRON_CONNECTION = 26,
}
Loading