From 82fbb8c7d2b39c63db2561f2cd6e1b772da5fee2 Mon Sep 17 00:00:00 2001 From: Kyle Hayes Date: Sun, 2 Jun 2024 13:08:40 -0700 Subject: [PATCH] Fixed accidental use of conn ID instead of config ID. --- src/examples/simple_multiple_tag_async.c | 28 ++++++++++++------------ src/examples/simple_single_tag_async.c | 8 +++---- src/examples/simple_single_tag_config.c | 6 ++--- src/examples/simple_single_tag_sync.c | 8 +++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/examples/simple_multiple_tag_async.c b/src/examples/simple_multiple_tag_async.c index 4888044..d61df87 100644 --- a/src/examples/simple_multiple_tag_async.c +++ b/src/examples/simple_multiple_tag_async.c @@ -55,7 +55,7 @@ */ int main(void) { - plc_comm_id_t conn_id = PLC_COMM_CONN_NULL_ID; + plc_comm_id_t conn_id = PLC_COMM_CONFIG_NULL_ID; plc_comm_id_t request_batch_id = PLC_COMM_REQUEST_BATCH_NULL_ID; plc_comm_id_t result_batch_id = PLC_COMM_RESULT_BATCH_NULL_ID; int32_t rc = PLC_COMM_STATUS_OK; @@ -69,42 +69,42 @@ int main(void) if(conn_id < 0) break; /* build a batch of requests. */ - request_batch_id = plc_comm_request_batch_init(conn_id, 10, PLC_COMM_CONN_NULL_ID); + request_batch_id = plc_comm_request_batch_init(conn_id, 10, PLC_COMM_CONFIG_NULL_ID); if(request_batch_id < 0) break; /* fill in the requests */ - rc = plc_comm_request_init(request_batch_id, 0, "MyDINTTag[0]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 0, "MyDINTTag[0]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 1, "MyDINTTag[1]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 1, "MyDINTTag[1]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 2, "MyDINTTag[2]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 2, "MyDINTTag[2]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 3, "MyDINTTag[3]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 3, "MyDINTTag[3]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 4, "MyDINTTag[4]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 4, "MyDINTTag[4]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 5, "MyDINTTag[5]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 5, "MyDINTTag[5]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 6, "MyDINTTag[6]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 6, "MyDINTTag[6]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 7, "MyDINTTag[7]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 7, "MyDINTTag[7]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 8, "MyDINTTag[8]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 8, "MyDINTTag[8]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; - rc = plc_comm_request_init(request_batch_id, 9, "MyDINTTag[9]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID); + rc = plc_comm_request_init(request_batch_id, 9, "MyDINTTag[9]", 1, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID); if(rc != PLC_COMM_STATUS_OK) break; /* a timeout of zero tell the library to queue up the batch of requests and then return. */ - result_batch_id = plc_comm_conn_do_request_batch(conn_id, request_batch_id, PLC_COMM_CONN_NULL_ID, 0); + result_batch_id = plc_comm_conn_do_request_batch(conn_id, request_batch_id, PLC_COMM_CONFIG_NULL_ID, 0); if(result_batch_id < 0) break; /* @@ -147,7 +147,7 @@ int main(void) printf("Connection opening failed with status %"PRId32"!\n", (int32_t)conn_id); rc = conn_id; } else { - if(conn_id != PLC_COMM_CONN_NULL_ID) { + if(conn_id != PLC_COMM_CONFIG_NULL_ID) { plc_comm_conn_dispose(conn_id, 5000); } } diff --git a/src/examples/simple_single_tag_async.c b/src/examples/simple_single_tag_async.c index 8814276..3f221be 100644 --- a/src/examples/simple_single_tag_async.c +++ b/src/examples/simple_single_tag_async.c @@ -55,7 +55,7 @@ */ int main(void) { - plc_comm_id_t conn_id = PLC_COMM_CONN_NULL_ID; + plc_comm_id_t conn_id = PLC_COMM_CONFIG_NULL_ID; plc_comm_id_t result_batch_id = PLC_COMM_RESULT_BATCH_NULL_ID; int32_t rc = PLC_COMM_STATUS_OK; int64_t end_time = (int64_t)0; @@ -63,11 +63,11 @@ int main(void) int32_t num_elements = 0; do { - conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONN_NULL_ID, 5000); + conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONFIG_NULL_ID, 5000); if(conn_id < 0) break; /* a timeout of zero tell the library to queue up the request and then return. */ - result_batch_id = plc_comm_conn_do_request(conn_id, "MyDINTTag", 10, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID, 0); + result_batch_id = plc_comm_conn_do_request(conn_id, "MyDINTTag", 10, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID, 0); if(result_batch_id < 0) break; /* @@ -105,7 +105,7 @@ int main(void) printf("Connection opening failed with status %"PRId32"!\n", (int32_t)conn_id); rc = conn_id; } else { - if(conn_id != PLC_COMM_CONN_NULL_ID) { + if(conn_id != PLC_COMM_CONFIG_NULL_ID) { plc_comm_conn_dispose(conn_id, 5000); } } diff --git a/src/examples/simple_single_tag_config.c b/src/examples/simple_single_tag_config.c index 8688bf8..03cc232 100644 --- a/src/examples/simple_single_tag_config.c +++ b/src/examples/simple_single_tag_config.c @@ -55,7 +55,7 @@ */ int main(void) { - plc_comm_id_t conn_id = PLC_COMM_CONN_NULL_ID; + plc_comm_id_t conn_id = PLC_COMM_CONFIG_NULL_ID; plc_comm_id_t config_id = PLC_COMM_CONFIG_NULL_ID; plc_comm_id_t result_batch_id = PLC_COMM_RESULT_BATCH_NULL_ID; int32_t rc = PLC_COMM_STATUS_OK; @@ -63,7 +63,7 @@ int main(void) int32_t num_elements = 0; do { - conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONN_NULL_ID, 5000); + conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONFIG_NULL_ID, 5000); if(conn_id < 0) break; /* get a config object for a request */ @@ -91,7 +91,7 @@ int main(void) printf("Connection opening failed with status %"PRId32"!\n", (int32_t)conn_id); rc = conn_id; } else { - if(conn_id != PLC_COMM_CONN_NULL_ID) { + if(conn_id != PLC_COMM_CONFIG_NULL_ID) { plc_comm_conn_dispose(conn_id, 5000); } } diff --git a/src/examples/simple_single_tag_sync.c b/src/examples/simple_single_tag_sync.c index 868a2ca..9be83fb 100644 --- a/src/examples/simple_single_tag_sync.c +++ b/src/examples/simple_single_tag_sync.c @@ -54,17 +54,17 @@ */ int main(void) { - plc_comm_id_t conn_id = PLC_COMM_CONN_NULL_ID; + plc_comm_id_t conn_id = PLC_COMM_CONFIG_NULL_ID; plc_comm_id_t result_batch_id = PLC_COMM_RESULT_BATCH_NULL_ID; int32_t rc = PLC_COMM_STATUS_OK; int32_t *tag_elements = NULL; int32_t num_elements = 0; do { - conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONN_NULL_ID, 5000); + conn_id = plc_comm_conn_open(PLC_COMM_PLC_TYPE_COMPACTLOGIX, "10.1.2.3", PLC_COMM_CONFIG_NULL_ID, 5000); if(conn_id < 0) break; - result_batch_id = plc_comm_conn_do_request(conn_id, "MyDINTTag", 10, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONN_NULL_ID, 5000); + result_batch_id = plc_comm_conn_do_request(conn_id, "MyDINTTag", 10, PLC_COMM_REQUEST_TYPE_READ, PLC_COMM_CONFIG_NULL_ID, 5000); if(result_batch_id < 0) break; rc = plc_comm_result_batch_get_status(result_batch_id); @@ -82,7 +82,7 @@ int main(void) printf("Connection opening failed with status %"PRId32"!\n", (int32_t)conn_id); rc = conn_id; } else { - if(conn_id != PLC_COMM_CONN_NULL_ID) { + if(conn_id != PLC_COMM_CONFIG_NULL_ID) { plc_comm_conn_dispose(conn_id, 5000); } }