Skip to content

Commit

Permalink
chore: Added the "COUNTER" type to the C version of the S7 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdutz committed Nov 15, 2024
1 parent 9511939 commit 573180a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 37 deletions.
1 change: 1 addition & 0 deletions plc4c/generated-sources/s7/include/transport_size.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum plc4c_s7_read_write_transport_size {
plc4c_s7_read_write_transport_size_UDINT = 0x0B,
plc4c_s7_read_write_transport_size_LINT = 0x0C,
plc4c_s7_read_write_transport_size_ULINT = 0x0D,
plc4c_s7_read_write_transport_size_COUNTER = 0x1C,
plc4c_s7_read_write_transport_size_REAL = 0x0E,
plc4c_s7_read_write_transport_size_LREAL = 0x0F,
plc4c_s7_read_write_transport_size_CHAR = 0x10,
Expand Down
83 changes: 46 additions & 37 deletions plc4c/generated-sources/s7/src/transport_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_value_of(c
if(strcmp(value_string, "ULINT") == 0) {
return plc4c_s7_read_write_transport_size_ULINT;
}
if(strcmp(value_string, "COUNTER") == 0) {
return plc4c_s7_read_write_transport_size_COUNTER;
}
if(strcmp(value_string, "REAL") == 0) {
return plc4c_s7_read_write_transport_size_REAL;
}
Expand Down Expand Up @@ -162,7 +165,7 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_value_of(c
}

int plc4c_s7_read_write_transport_size_num_values() {
return 32;
return 33;
}

plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_value_for_index(int index) {
Expand Down Expand Up @@ -207,60 +210,63 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_value_for_
return plc4c_s7_read_write_transport_size_ULINT;
}
case 13: {
return plc4c_s7_read_write_transport_size_REAL;
return plc4c_s7_read_write_transport_size_COUNTER;
}
case 14: {
return plc4c_s7_read_write_transport_size_LREAL;
return plc4c_s7_read_write_transport_size_REAL;
}
case 15: {
return plc4c_s7_read_write_transport_size_CHAR;
return plc4c_s7_read_write_transport_size_LREAL;
}
case 16: {
return plc4c_s7_read_write_transport_size_WCHAR;
return plc4c_s7_read_write_transport_size_CHAR;
}
case 17: {
return plc4c_s7_read_write_transport_size_STRING;
return plc4c_s7_read_write_transport_size_WCHAR;
}
case 18: {
return plc4c_s7_read_write_transport_size_WSTRING;
return plc4c_s7_read_write_transport_size_STRING;
}
case 19: {
return plc4c_s7_read_write_transport_size_S5TIME;
return plc4c_s7_read_write_transport_size_WSTRING;
}
case 20: {
return plc4c_s7_read_write_transport_size_TIME;
return plc4c_s7_read_write_transport_size_S5TIME;
}
case 21: {
return plc4c_s7_read_write_transport_size_LTIME;
return plc4c_s7_read_write_transport_size_TIME;
}
case 22: {
return plc4c_s7_read_write_transport_size_DATE;
return plc4c_s7_read_write_transport_size_LTIME;
}
case 23: {
return plc4c_s7_read_write_transport_size_TIME_OF_DAY;
return plc4c_s7_read_write_transport_size_DATE;
}
case 24: {
return plc4c_s7_read_write_transport_size_TOD;
return plc4c_s7_read_write_transport_size_TIME_OF_DAY;
}
case 25: {
return plc4c_s7_read_write_transport_size_LTIME_OF_DAY;
return plc4c_s7_read_write_transport_size_TOD;
}
case 26: {
return plc4c_s7_read_write_transport_size_LTOD;
return plc4c_s7_read_write_transport_size_LTIME_OF_DAY;
}
case 27: {
return plc4c_s7_read_write_transport_size_DATE_AND_TIME;
return plc4c_s7_read_write_transport_size_LTOD;
}
case 28: {
return plc4c_s7_read_write_transport_size_DT;
return plc4c_s7_read_write_transport_size_DATE_AND_TIME;
}
case 29: {
return plc4c_s7_read_write_transport_size_DATE_AND_LTIME;
return plc4c_s7_read_write_transport_size_DT;
}
case 30: {
return plc4c_s7_read_write_transport_size_LDT;
return plc4c_s7_read_write_transport_size_DATE_AND_LTIME;
}
case 31: {
return plc4c_s7_read_write_transport_size_LDT;
}
case 32: {
return plc4c_s7_read_write_transport_size_DTL;
}
default: {
Expand Down Expand Up @@ -352,7 +358,7 @@ bool plc4c_s7_read_write_transport_size_get_supported__s7_300(plc4c_s7_read_writ
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return false;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return true;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down Expand Up @@ -464,7 +470,7 @@ bool plc4c_s7_read_write_transport_size_get_supported__logo(plc4c_s7_read_write_
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return true;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return false;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down Expand Up @@ -576,8 +582,8 @@ uint8_t plc4c_s7_read_write_transport_size_get_code(plc4c_s7_read_write_transpor
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return 0;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
return 0;
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return 28;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
return 0;
Expand Down Expand Up @@ -632,6 +638,9 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_get_first_
case 19: {
return plc4c_s7_read_write_transport_size_WCHAR;
}
case 28: {
return plc4c_s7_read_write_transport_size_COUNTER;
}
default: {
return -1;
}
Expand Down Expand Up @@ -721,8 +730,8 @@ uint8_t plc4c_s7_read_write_transport_size_get_size_in_bytes(plc4c_s7_read_write
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return 8;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
return 8;
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return 2;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
return 8;
Expand Down Expand Up @@ -848,7 +857,7 @@ bool plc4c_s7_read_write_transport_size_get_supported__s7_400(plc4c_s7_read_writ
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return false;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return true;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down Expand Up @@ -960,8 +969,8 @@ bool plc4c_s7_read_write_transport_size_get_supported__s7_1200(plc4c_s7_read_wri
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return false;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
return false;
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return true;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
return false;
Expand Down Expand Up @@ -1072,7 +1081,7 @@ uint8_t plc4c_s7_read_write_transport_size_get_short_name(plc4c_s7_read_write_tr
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return 'X';
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return 'X';
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down Expand Up @@ -1196,7 +1205,7 @@ bool plc4c_s7_read_write_transport_size_get_supported__s7_1500(plc4c_s7_read_wri
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return true;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return true;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down Expand Up @@ -1308,8 +1317,8 @@ plc4c_s7_read_write_data_transport_size plc4c_s7_read_write_transport_size_get_d
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return plc4c_s7_read_write_data_transport_size_BYTE_WORD_DWORD;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
return plc4c_s7_read_write_data_transport_size_BYTE_WORD_DWORD;
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return plc4c_s7_read_write_data_transport_size_OCTET_STRING;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
return plc4c_s7_read_write_data_transport_size_BYTE_WORD_DWORD;
Expand Down Expand Up @@ -1340,8 +1349,8 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_get_first_
case plc4c_s7_read_write_transport_size_INT: /* '0x06' */{
return plc4c_s7_read_write_transport_size_INT;
}
case plc4c_s7_read_write_transport_size_CHAR: /* '0x10' */{
return plc4c_s7_read_write_transport_size_CHAR;
case plc4c_s7_read_write_transport_size_COUNTER: /* '0x1C' */{
return plc4c_s7_read_write_transport_size_COUNTER;
}
case plc4c_s7_read_write_transport_size_REAL: /* '0x0E' */{
return plc4c_s7_read_write_transport_size_REAL;
Expand Down Expand Up @@ -1435,8 +1444,8 @@ char* plc4c_s7_read_write_transport_size_get_data_protocol_id(plc4c_s7_read_writ
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return "IEC61131_LTIME_OF_DAY";
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
return "IEC61131_DATE_AND_TIME";
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return "IEC61131_INT";
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
return "IEC61131_DATE_AND_TIME";
Expand Down Expand Up @@ -1626,7 +1635,7 @@ plc4c_s7_read_write_transport_size plc4c_s7_read_write_transport_size_get_base_t
case plc4c_s7_read_write_transport_size_LTOD: { /* '0x1B' */
return -1;
}
case plc4c_s7_read_write_transport_size_DATE_AND_TIME: { /* '0x1C' */
case plc4c_s7_read_write_transport_size_COUNTER: { /* '0x1C' */
return -1;
}
case plc4c_s7_read_write_transport_size_DT: { /* '0x1D' */
Expand Down

0 comments on commit 573180a

Please sign in to comment.