Skip to content

Commit

Permalink
Fixed up some attr naming to correctly show usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-github committed Jun 2, 2024
1 parent 592c0c3 commit 562b35d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/examples/simple_single_tag_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main(void)
if(config_id < 0) break;

/* set up config for the output translated data buffer. Pass a pointer and a size IN BYTES. */
rc = plc_comm_config_set_attr_buf(config_id, PLC_COMM_ATTR_RESULT_TRANSLATED_DATA_BUF, &tag_elements[0], (int32_t)(uint32_t)sizeof(tag_elements));
rc = plc_comm_config_set_attr_buf(config_id, PLC_COMM_ATTR_REQUEST_TRANSLATED_DATA_BUF, &tag_elements[0], (int32_t)(uint32_t)sizeof(tag_elements));
if(rc != PLC_COMM_STATUS_OK) break;

/* Pass the config so that the request knows to use the tag_element array directly. */
Expand All @@ -81,6 +81,7 @@ int main(void)
rc = plc_comm_result_batch_get_status(result_batch_id);
if(rc != PLC_COMM_STATUS_OK) break;

/* we can access the tag_elements array directly. The mapping set up in the result config*/
for(int i=0; i < num_elements; i++) {
printf("data[%d] = %d (%08x)\n", i, tag_elements[i], tag_elements[i]);
}
Expand Down
3 changes: 3 additions & 0 deletions src/lib/include/plc_comm.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ LIB_EXTERN int32_t plc_comm_conn_dispose(plc_comm_id_t conn_id, int32_t timeout_

/* request definitions */

typedef enum {
PLC_COMM_ATTR_REQUEST_TRANSLATED_DATA_BUF = ((1 << PLC_COMM_ATTR_ID_SHIFT) | PLC_COMM_ATTR_TYPE_BUF | PLC_COMM_ATTR_ACCESS_READ | PLC_COMM_ATTR_ACCESS_WRITE),
} plc_comm_request_attr_t;

LIB_EXTERN plc_comm_id_t plc_comm_request_batch_init(plc_comm_id_t conn_id, int32_t num_requests, plc_comm_id_t config_id);
LIB_EXTERN int32_t plc_comm_request_batch_get_status(plc_comm_id_t request_batch_id);
Expand Down

0 comments on commit 562b35d

Please sign in to comment.