micrOSDevToolKit 2.9.11__py3-none-any.whl → 2.10.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of micrOSDevToolKit might be problematic. Click here for more details.

Files changed (35) hide show
  1. micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +19 -19
  2. micrOS/source/Common.py +4 -4
  3. micrOS/source/InterConnect.py +14 -11
  4. micrOS/source/LM_intercon.py +3 -0
  5. micrOS/source/LM_light_sensor.py +7 -15
  6. micrOS/source/LM_oled_ui.py +18 -22
  7. micrOS/source/LM_oledui.py +13 -16
  8. micrOS/source/LM_presence.py +8 -11
  9. micrOS/source/LM_system.py +7 -6
  10. micrOS/source/LM_telegram.py +21 -16
  11. micrOS/source/Shell.py +22 -19
  12. micrOS/source/Tasks.py +30 -15
  13. micrOS/source/Web.py +3 -2
  14. micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
  15. {micrOSDevToolKit-2.9.11.dist-info → micrOSDevToolKit-2.10.2.dist-info}/METADATA +11 -14
  16. {micrOSDevToolKit-2.9.11.dist-info → micrOSDevToolKit-2.10.2.dist-info}/RECORD +35 -35
  17. toolkit/dashboard_apps/SystemTest.py +17 -6
  18. toolkit/lib/micrOSClient.py +25 -6
  19. toolkit/socketClient.py +2 -3
  20. toolkit/workspace/precompiled/Common.mpy +0 -0
  21. toolkit/workspace/precompiled/InterConnect.mpy +0 -0
  22. toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
  23. toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
  24. toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
  25. toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
  26. toolkit/workspace/precompiled/LM_presence.mpy +0 -0
  27. toolkit/workspace/precompiled/LM_system.mpy +0 -0
  28. toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
  29. toolkit/workspace/precompiled/Shell.mpy +0 -0
  30. toolkit/workspace/precompiled/Tasks.mpy +0 -0
  31. toolkit/workspace/precompiled/Web.mpy +0 -0
  32. {micrOSDevToolKit-2.9.11.data → micrOSDevToolKit-2.10.2.data}/scripts/devToolKit.py +0 -0
  33. {micrOSDevToolKit-2.9.11.dist-info → micrOSDevToolKit-2.10.2.dist-info}/LICENSE +0 -0
  34. {micrOSDevToolKit-2.9.11.dist-info → micrOSDevToolKit-2.10.2.dist-info}/WHEEL +0 -0
  35. {micrOSDevToolKit-2.9.11.dist-info → micrOSDevToolKit-2.10.2.dist-info}/top_level.txt +0 -0
@@ -426,11 +426,22 @@ def check_intercon(host=None):
426
426
  break
427
427
  return _state, _output
428
428
 
429
+ def run_intercon_hello(tout):
430
+ nonlocal host
431
+ cmd_list = [f'hello >>{host}']
432
+ _output = CLIENT.execute(cmd_list, tout=8)
433
+ _new_intercon = True
434
+ if "hello:" in _output[1]: # TODO: remove...
435
+ # LEGACY WAY: FALLBACK
436
+ cmd_list = ['intercon sendcmd "{}" "hello" >json'.format(host)]
437
+ _output = CLIENT.execute(cmd_list, tout=tout)
438
+ _new_intercon = False
439
+ return _new_intercon, _output
440
+
429
441
  info_msg = '[ST] Check device-device connectivity'
430
442
  print(info_msg)
431
443
  host = 'test.local' if host is None else host
432
- cmd_list = ['intercon sendcmd "{}" "hello" >json'.format(host)]
433
- output = CLIENT.execute(cmd_list, tout=8)
444
+ new_intercon, output = run_intercon_hello(tout=8)
434
445
  output = _convert_return_to_dict(output)
435
446
  device_was_found = False
436
447
  if output[0] is False or output[1] is None:
@@ -443,7 +454,7 @@ def check_intercon(host=None):
443
454
  elif len(output[1]) > 1 and "hello" in output[1]['verdict']:
444
455
  response_state, response = _get_intercon_output(output[1]['tag'])
445
456
  # Valid input on online device
446
- output = "Device was found: {}:{}".format(host, f"{output}: {response}")
457
+ output = "Device was found: {}:{} version: {}".format(host, f"{output}: {response}", "NEW" if new_intercon else "LEGACY")
447
458
  state = True & response_state, f'{info_msg}:\n\t\t{output}'
448
459
  device_was_found = True
449
460
  else:
@@ -451,13 +462,13 @@ def check_intercon(host=None):
451
462
 
452
463
  if device_was_found:
453
464
  # DO Negative testing as well
454
- cmd_list = ['intercon sendcmd "notavailable.local" "hello" >json']
455
- output_neg = CLIENT.execute(cmd_list, tout=15)
465
+ host = "notavailable.local"
466
+ _, output_neg = run_intercon_hello(tout=20)
456
467
  output_neg = _convert_return_to_dict(output_neg)
457
468
  state_neg = False, output_neg
458
469
  if len(output_neg[1]) > 1 and "hello" in output_neg[1]['verdict']:
459
470
  response_state, response = _get_intercon_output(output_neg[1]['tag'])
460
- output_neg = f'Device was not found: "notavailable.local":{output_neg}: {response}'
471
+ output_neg = f'Device was not found: {host}":{output_neg}: {response}'
461
472
  state_neg = True & response_state, output_neg
462
473
  return state[0] & state_neg[0], "{}\n\t\tNegative test: {}".format(state[1], state_neg[1])
463
474
  return state
@@ -85,10 +85,22 @@ class micrOSClient:
85
85
 
86
86
  @staticmethod
87
87
  def validate_ipv4(str_in):
88
- pattern = "^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$"
89
- if bool(re.match(pattern, str_in)):
90
- return True
91
- return False
88
+ parts = str_in.split(".")
89
+ # An IPv4 address must have exactly 4 parts
90
+ if len(parts) != 4:
91
+ return False
92
+ for part in parts:
93
+ # Each part must be a number and not empty
94
+ if not part.isdigit():
95
+ return False
96
+ num = int(part)
97
+ # Each number must be in the valid range (0-255)
98
+ if num < 0 or num > 255:
99
+ return False
100
+ # Prevents leading zeros (e.g., "01" is invalid)
101
+ if part != str(num):
102
+ return False
103
+ return True
92
104
 
93
105
  def __connect(self, timeout):
94
106
  # Server connection - create socket
@@ -312,13 +324,20 @@ class micrOSClient:
312
324
 
313
325
  history = load_command_history(self.telnet_prompt) # History: Beta feature
314
326
  print(self.telnet_prompt, end="")
327
+ is_empty = False # Empty input support
315
328
  while True:
316
329
  try:
317
- cmd = input() # CANNOT contain prompt - it is coming back from response data
318
- # send command
330
+ # INPUT HANDLING
331
+ cmd = input(self.telnet_prompt if is_empty else '') # CANNOT contain prompt - it is coming back from response data
332
+ if len(cmd.strip()) == 0:
333
+ is_empty = True
334
+ continue
335
+ is_empty = False
336
+ # SEND COMMAND
319
337
  output = self.send_cmd(cmd, timeout=timeout, stream=True)
320
338
  if not (history is None or output is None) and "Shell: for hints type help." not in output: # History: Beta feature
321
339
  history.add_history(cmd)
340
+ # OUTPUT HANDLING
322
341
  if 'Bye!' in str(output):
323
342
  break
324
343
  if output is None:
toolkit/socketClient.py CHANGED
@@ -215,9 +215,8 @@ class ConnectionData:
215
215
  # Generate line printout
216
216
  base_info = "{uid}{spr1}{fuid}".format(uid=uid, spr1=spacer1, fuid=fuid)
217
217
  spacer1 = " " * (spr_offset2 - len(base_info))
218
- data_line_str = "{base}{spr2}{ip}\t{stat}\t\t{version}\t\t{elapt}" \
219
- .format(base=base_info, spr2=spacer1, ip=ip,
220
- stat=is_online, version=version_data, elapt=elapsed_time)
218
+ spacer2 = "\t" if len(version_data) > 7 else "\t\t"
219
+ data_line_str = f"{base_info}{spacer1}{ip}\t{is_online}\t\t{version_data}{spacer2}{elapsed_time}"
221
220
  return data_line_str, online_ip
222
221
  return None
223
222
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file