From 02d840a3fe35f9d8d0ee4c0ac092f3108346a9f7 Mon Sep 17 00:00:00 2001 From: timyhac Date: Sun, 3 May 2026 20:31:35 +1000 Subject: [PATCH] Adds the `CONN_STATUS` enum --- src/libplctag.NativeImport/CONN_STATUS.cs | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/libplctag.NativeImport/CONN_STATUS.cs diff --git a/src/libplctag.NativeImport/CONN_STATUS.cs b/src/libplctag.NativeImport/CONN_STATUS.cs new file mode 100644 index 0000000..bdd43ef --- /dev/null +++ b/src/libplctag.NativeImport/CONN_STATUS.cs @@ -0,0 +1,54 @@ +// 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 +{ + /// + /// You can query the connection status of a tag using the connection_status attribute + /// with : + /// + /// int status = plc_tag_get_int_attribute(tag, "connection_status", PLCTAG_CONN_STATUS_DOWN); + /// + /// + /// 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. + /// + /// + public enum CONN_STATUS + { + /// + /// Connected and ready for communication. + /// + PLCTAG_CONN_STATUS_UP = 0, + + /// + /// Not connected. + /// + PLCTAG_CONN_STATUS_DOWN = 1, + + /// + /// Disconnection in progress. + /// + PLCTAG_CONN_STATUS_DISCONNECTING = 2, + + /// + /// Connection in progress. + /// + PLCTAG_CONN_STATUS_CONNECTING = 3, + + /// + /// Waiting to reconnect after disconnect. + /// + PLCTAG_CONN_STATUS_IDLE_WAIT = 4, + + /// + /// Waiting to retry after error. + /// + PLCTAG_CONN_STATUS_ERR_WAIT = 5 + } +}