Skip to content

Commit

Permalink
id prefix/suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
divi255 committed Nov 3, 2020
1 parent 9b70fd3 commit 1af51bb
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions scripts/enip-logix/gen_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def generate(tag_list,
tag_file=None,
tag_data=None,
config=None,
id_prefix='',
id_suffix='',
output_stats=True):

def find_tag_in_struct(tag, data):
Expand Down Expand Up @@ -105,7 +107,7 @@ def gen_offset(o1, o2, int_if_possible=False):
'type':
DATA_TYPES[d['data_type']],
'set-id':
tag_name + '.' + tag
f'{id_prefix}{tag_name}.{tag}{id_suffix}'
})
return result

Expand All @@ -127,7 +129,7 @@ def gen_offset(o1, o2, int_if_possible=False):
TAG,
'process': [{
'offset': 0,
'set-id': TAG,
'set-id': f'{id_prefix}{TAG}{id_suffix}',
'type': DATA_TYPES[data['data_type']]
}]
})
Expand Down Expand Up @@ -189,6 +191,16 @@ def gen_offset(o1, o2, int_if_possible=False):
type=float,
default=DEFAULT_TIMEOUT)

ap.add_argument('--id-prefix',
metavar='VALUE',
help='ID prefix',
default='')

ap.add_argument('--id-suffix',
metavar='VALUE',
help='ID suffix',
default='')

a = ap.parse_args()

if a.source:
Expand All @@ -200,4 +212,8 @@ def gen_offset(o1, o2, int_if_possible=False):
else:
config = None

generate(tag_file=a.tag_file, tag_list=a.tag.split(','), config=config)
generate(tag_file=a.tag_file,
tag_list=a.tag.split(','),
config=config,
id_prefix=a.id_prefix,
id_suffix=a.id_suffix)

0 comments on commit 1af51bb

Please sign in to comment.