25 Float = ("REAL" , "float" , "D", "UA_TYPES_FLOAT" , "UA_Float" ), |
25 Float = ("REAL" , "float" , "D", "UA_TYPES_FLOAT" , "UA_Float" ), |
26 Double = ("LREAL", "double" , "L", "UA_TYPES_DOUBLE" , "UA_Double" ), |
26 Double = ("LREAL", "double" , "L", "UA_TYPES_DOUBLE" , "UA_Double" ), |
27 ) |
27 ) |
28 |
28 |
29 UA_NODE_ID_types = { |
29 UA_NODE_ID_types = { |
30 "int" : "UA_NODEID_NUMERIC", |
30 "int" : ("UA_NODEID_NUMERIC", "{}" ), |
31 "string": "UA_NODEID_STRING", |
31 "str" : ("UA_NODEID_STRING" , '"{}"'), |
32 "UUIS" : "UA_NODEID_UUID", |
32 "UUIS" : ("UA_NODEID_UUID" , '"{}"'), |
33 } |
33 } |
34 |
34 |
35 lstcolnames = [ "Name", "NSIdx", "IdType", "Id", "Type", "IEC"] |
35 lstcolnames = [ "Name", "NSIdx", "IdType", "Id", "Type", "IEC"] |
36 lstcolwidths = [ 100, 50, 100, 100, 100, 50] |
36 lstcolwidths = [ 100, 50, 100, 100, 100, 50] |
37 lstcoltypess = [ str, int, str, str, str, int] |
37 lstcoltypess = [ str, int, str, str, str, int] |
548 publish = "" |
548 publish = "" |
549 ) |
549 ) |
550 for direction, data in self.iteritems(): |
550 for direction, data in self.iteritems(): |
551 iec_direction_prefix = {"input": "__I", "output": "__Q"}[direction] |
551 iec_direction_prefix = {"input": "__I", "output": "__Q"}[direction] |
552 for row in data: |
552 for row in data: |
553 name, ua_nsidx, ua_nodeid_type, ua_node_id, ua_type, iec_number = row |
553 name, ua_nsidx, ua_nodeid_type, _ua_node_id, ua_type, iec_number = row |
554 iec_type, C_type, iec_size_prefix, ua_type_enum, ua_type = UA_IEC_types[ua_type] |
554 iec_type, C_type, iec_size_prefix, ua_type_enum, ua_type = UA_IEC_types[ua_type] |
555 c_loc_name = iec_direction_prefix + iec_size_prefix + locstr + "_" + str(iec_number) |
555 c_loc_name = iec_direction_prefix + iec_size_prefix + locstr + "_" + str(iec_number) |
556 ua_nodeid_type = UA_NODE_ID_types[ua_nodeid_type] |
556 ua_nodeid_type, id_formating = UA_NODE_ID_types[ua_nodeid_type] |
|
557 ua_node_id = id_formating.format(_ua_node_id) |
557 |
558 |
558 formatdict["decl"] += """ |
559 formatdict["decl"] += """ |
559 DECL_VAR({ua_type}, {C_type}, {c_loc_name})""".format(**locals()) |
560 DECL_VAR({ua_type}, {C_type}, {c_loc_name})""".format(**locals()) |
560 formatdict["cleanup"] += """ |
561 formatdict["cleanup"] += """ |
561 FREE_VARIANT({ua_type}, {c_loc_name})""".format(**locals()) |
562 FREE_VARIANT({ua_type}, {c_loc_name})""".format(**locals()) |