342 C_type, iec_size_prefix = MQTT_IEC_types[iec_type] |
343 C_type, iec_size_prefix = MQTT_IEC_types[iec_type] |
343 c_loc_name = "__Q" + iec_size_prefix + locstr + "_" + str(iec_number) |
344 c_loc_name = "__Q" + iec_size_prefix + locstr + "_" + str(iec_number) |
344 |
345 |
345 formatdict["decl"] += """ |
346 formatdict["decl"] += """ |
346 DECL_VAR({iec_type}, {C_type}, {c_loc_name})""".format(**locals()) |
347 DECL_VAR({iec_type}, {C_type}, {c_loc_name})""".format(**locals()) |
347 formatdict["init"] += """ |
348 formatdict["init_pubsub"] += """ |
348 INIT_PUBLICATION({Topic}, {QoS}, {C_type}, {c_loc_name}, {Retained})""".format(**locals()) |
349 INIT_PUBLICATION({Topic}, {QoS}, {C_type}, {c_loc_name}, {Retained})""".format(**locals()) |
349 formatdict["publish"] += """ |
350 formatdict["publish"] += """ |
350 WRITE_VALUE({c_loc_name}, {C_type})""".format(**locals()) |
351 WRITE_VALUE({c_loc_name}, {C_type})""".format(**locals()) |
351 formatdict["publish_changes"] += """ |
352 formatdict["publish_changes"] += """ |
352 PUBLISH_CHANGE({Topic}, {QoS}, {C_type}, {c_loc_name}, {Retained})""".format(**locals()) |
353 PUBLISH_CHANGE({Topic}, {QoS}, {C_type}, {c_loc_name}, {Retained})""".format(**locals()) |
358 c_loc_name = "__I" + iec_size_prefix + locstr + "_" + str(iec_number) |
359 c_loc_name = "__I" + iec_size_prefix + locstr + "_" + str(iec_number) |
359 formatdict["decl"] += """ |
360 formatdict["decl"] += """ |
360 DECL_VAR({iec_type}, {C_type}, {c_loc_name})""".format(**locals()) |
361 DECL_VAR({iec_type}, {C_type}, {c_loc_name})""".format(**locals()) |
361 formatdict["topics"] += """ |
362 formatdict["topics"] += """ |
362 INIT_TOPIC({Topic}, {iec_type}, {c_loc_name})""".format(**locals()) |
363 INIT_TOPIC({Topic}, {iec_type}, {c_loc_name})""".format(**locals()) |
363 formatdict["init"] += """ |
364 formatdict["init_pubsub"] += """ |
364 INIT_SUBSCRIPTION({Topic}, {QoS})""".format(**locals()) |
365 INIT_SUBSCRIPTION({Topic}, {QoS})""".format(**locals()) |
365 formatdict["retrieve"] += """ |
366 formatdict["retrieve"] += """ |
366 READ_VALUE({c_loc_name}, {C_type})""".format(**locals()) |
367 READ_VALUE({c_loc_name}, {C_type})""".format(**locals()) |
367 |
368 |
368 Ccode = c_template.format(**formatdict) |
369 Ccode = c_template.format(**formatdict) |