changeset 2655 | d2b2ee04bfa1 |
parent 2654 | 7575050a80c5 |
child 2664 | a26a8e182190 |
2654:7575050a80c5 | 2655:d2b2ee04bfa1 |
---|---|
55 """ |
55 """ |
56 Outputs a string to be used on C files |
56 Outputs a string to be used on C files |
57 params: child - the correspondent subplugin in Beremiz |
57 params: child - the correspondent subplugin in Beremiz |
58 """ |
58 """ |
59 node_init_template = '''/*node %(locnodestr)s*/ |
59 node_init_template = '''/*node %(locnodestr)s*/ |
60 {"%(locnodestr)s", "%(config_name)s", %(slaveid)s, {naf_tcp, {.tcp = {%(host)s, "%(port)s", DEF_CLOSE_ON_SILENCE}}}, -1 /* mb_nd */, 0 /* init_state */}''' |
60 {"%(locnodestr)s", "%(config_name)s", "%(host)s", "%(port)s", %(slaveid)s, {naf_tcp, {.tcp = {NULL, NULL, DEF_CLOSE_ON_SILENCE}}}, -1 /* mb_nd */, 0 /* init_state */}''' |
61 |
61 |
62 location = ".".join(map(str, child.GetCurrentLocation())) |
62 location = ".".join(map(str, child.GetCurrentLocation())) |
63 config_name, host, port, slaveid = GetCTVals(child, range(4)) |
63 config_name, host, port, slaveid = GetCTVals(child, range(4)) |
64 if host == "#ANY#": |
64 if host == "#ANY#": |
65 host = 'INADDR_ANY' |
65 host = '' |
66 else: |
|
67 host = '"' + host + '"' |
|
68 # slaveid = GetCTVal(child, 2) |
66 # slaveid = GetCTVal(child, 2) |
69 # if int(slaveid) not in xrange(256): |
67 # if int(slaveid) not in xrange(256): |
70 # self.GetCTRoot().logger.write_error("Error: Wrong slave ID in %s server node\nModbus Plugin C code returns empty\n"%location) |
68 # self.GetCTRoot().logger.write_error("Error: Wrong slave ID in %s server node\nModbus Plugin C code returns empty\n"%location) |
71 # return None |
69 # return None |
72 |
70 |
119 """ |
117 """ |
120 Outputs a string to be used on C files |
118 Outputs a string to be used on C files |
121 params: child - the correspondent subplugin in Beremiz |
119 params: child - the correspondent subplugin in Beremiz |
122 """ |
120 """ |
123 node_init_template = '''/*node %(locnodestr)s*/ |
121 node_init_template = '''/*node %(locnodestr)s*/ |
124 {"%(locnodestr)s", "%(config_name)s", %(slaveid)s, {naf_rtu, {.rtu = {"%(device)s", %(baud)s /*baud*/, %(parity)s /*parity*/, 8 /*data bits*/, %(stopbits)s, 0 /* ignore echo */}}}, -1 /* mb_nd */, 0 /* init_state */}''' |
122 {"%(locnodestr)s", "%(config_name)s", "%(device)s", "",%(slaveid)s, {naf_rtu, {.rtu = {NULL, %(baud)s /*baud*/, %(parity)s /*parity*/, 8 /*data bits*/, %(stopbits)s, 0 /* ignore echo */}}}, -1 /* mb_nd */, 0 /* init_state */}''' |
125 |
123 |
126 location = ".".join(map(str, child.GetCurrentLocation())) |
124 location = ".".join(map(str, child.GetCurrentLocation())) |
127 config_name, device, baud, parity, stopbits, slaveid = GetCTVals(child, range(6)) |
125 config_name, device, baud, parity, stopbits, slaveid = GetCTVals(child, range(6)) |
128 |
126 |
129 node_dict = {"locnodestr": location, |
127 node_dict = {"locnodestr": location, |