181 # annotate.Integer, ...) |
181 # annotate.Integer, ...) |
182 ("device" , _("Serial Port") , ctypes.c_char_p, MB_StrippedString), |
182 ("device" , _("Serial Port") , ctypes.c_char_p, MB_StrippedString), |
183 ("baud" , _("Baud Rate") , ctypes.c_int, MB_Baud ), |
183 ("baud" , _("Baud Rate") , ctypes.c_int, MB_Baud ), |
184 ("parity" , _("Parity") , ctypes.c_int, MB_Parity ), |
184 ("parity" , _("Parity") , ctypes.c_int, MB_Parity ), |
185 ("stop_bits" , _("Stop Bits") , ctypes.c_int, MB_StopBits ), |
185 ("stop_bits" , _("Stop Bits") , ctypes.c_int, MB_StopBits ), |
186 ("slave_id" , _("Slave ID") , ctypes.c_ulonglong, annotate.Integer) |
186 ("slave_id" , _("Slave ID") , ctypes.c_ubyte, annotate.Integer) |
187 ] |
187 ] |
188 |
188 |
189 |
189 |
190 |
190 |
191 |
191 |
226 |
226 |
227 # Add the addr_type and node_type to the data that will be saved to file |
227 # Add the addr_type and node_type to the data that will be saved to file |
228 # This allows us to confirm the saved data contains the correct addr_type |
228 # This allows us to confirm the saved data contains the correct addr_type |
229 # when loading from file |
229 # when loading from file |
230 save_info = {} |
230 save_info = {} |
231 save_info["addr_type"] = ["addr_type"] |
231 save_info["addr_type"] = WebNode_entry["addr_type"] |
232 save_info["node_type"] = WebNode_entry["node_type"] |
232 save_info["node_type"] = WebNode_entry["node_type"] |
233 save_info["config" ] = newConfig |
233 save_info["config" ] = newConfig |
234 |
234 |
235 filename = WebNode_entry["filename"] |
235 filename = WebNode_entry["filename"] |
236 |
236 |
260 addr_type of the WebNode_id), then return None |
260 addr_type of the WebNode_id), then return None |
261 """ |
261 """ |
262 filename = _WebNodeList[WebNode_id]["filename"] |
262 filename = _WebNodeList[WebNode_id]["filename"] |
263 try: |
263 try: |
264 #if os.path.isfile(filename): |
264 #if os.path.isfile(filename): |
265 save_info = json.load(open(filename)) |
265 save_info = json.load(open(os.path.realpath(filename))) |
266 except Exception: |
266 except Exception: |
267 return None |
267 return None |
268 |
268 |
269 if save_info["addr_type"] != _WebNodeList[WebNode_id]["addr_type"]: |
269 if save_info["addr_type"] != _WebNodeList[WebNode_id]["addr_type"]: |
270 return None |
270 return None |