Skip to content

Commit

Permalink
Release the collection of ios battery
Browse files Browse the repository at this point in the history
  • Loading branch information
rafa0128 committed Mar 20, 2023
1 parent 26b4607 commit 3418f85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion solox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

from __future__ import absolute_import

__version__ = '2.5.2'
__version__ = '2.5.3'
2 changes: 1 addition & 1 deletion solox/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h2 class="page-title">
</li>
<li class="list-inline-item">
<a href="https://github.com/smart-test-ti/SoloX/releases" target="_blank" class="link-secondary" rel="noopener">
{% if lan == 'cn' %} 版本 {% else %} Releases {% endif %} . V2.5.2
{% if lan == 'cn' %} 版本 {% else %} Releases {% endif %} . V2.5.3
</a>
</li>
</ul>
Expand Down
4 changes: 1 addition & 3 deletions solox/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1132,9 +1132,7 @@ <h6 class="dropdown-header">{% if lan == 'cn' %} 基础信息 {% else %} Base In
collectMem(device,pkgname);
collectNetwork(device,pkgname);
collectFps(device,pkgname);
if(platform === 'Android'){
collectBattery(device);
}
collectBattery(device);
}else{
if(lan == 'cn'){
SwalFire('error','执行错误','没有选择APP或者设备',2000);
Expand Down
17 changes: 10 additions & 7 deletions solox/view/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def initialize():
os.remove(filename)
result = {'status': 1, 'msg': 'initialize env success'}
except Exception as e:
traceback.print_exc()
result = {'status': 0, 'msg': str(e)}

return result
Expand Down Expand Up @@ -133,6 +134,7 @@ def getCpuRate():
result = {'status': 1, 'appCpuRate': appCpuRate, 'systemCpuRate': systemCpuRate}
except Exception as e:
logger.error(f'get cpu failed : {str(e)}')
traceback.print_exc()
result = {'status': 1, 'appCpuRate': 0, 'systemCpuRate': 0, 'first': 0, 'second': 0}
return result

Expand Down Expand Up @@ -167,6 +169,7 @@ def getMEM():
result = {'status': 1, 'totalPass': totalPass, 'nativePass': nativePass, 'dalvikPass': dalvikPass}
except Exception as e:
logger.error(f'get memory data failed : {str(e)}')
traceback.print_exc()
result = {'status': 1, 'totalPass': 0, 'nativePass': 0, 'dalvikPass': 0, 'first': 0, 'second': 0}
return result

Expand Down Expand Up @@ -201,6 +204,7 @@ def getNetWorkData():
result = {'status': 1, 'upflow': data[0], 'downflow': data[1]}
except Exception as e:
logger.error(f'get network data failed : {str(e)}')
traceback.print_exc()
result = {'status': 1, 'upflow': 0, 'downflow': 0, 'first': 0, 'second': 0}
return result

Expand Down Expand Up @@ -247,17 +251,16 @@ def getBattery():
platform = method._request(request, 'platform')
device = method._request(request, 'device')
try:
deviceId = d.getIdbyDevice(device, platform)
battery_monitor = Battery(deviceId=deviceId, platform=platform)
final = battery_monitor.getBattery()
if platform == 'Android':
deviceId = d.getIdbyDevice(device, platform)
battery_monitor = Battery(deviceId=deviceId, platform=platform)
final = battery_monitor.getBattery()
result = {'status': 1, 'level': final[0], 'temperature': final[1]}
else:
battery_monitor = Battery(deviceId='', platform=platform)
final = battery_monitor.getBattery()
result = {'status': 1, 'temperature': final[0], 'current': final[1], 'voltage': final[2], 'power': final[3]}
except Exception as e:
result = {'status': 1, 'level': 0, 'temperature': 0}
except Exception:
traceback.print_exc()
result = {'status': 1, 'level': 0, 'temperature': 0, 'current':0, 'voltage':0 , 'power':0}
return result


Expand Down

0 comments on commit 3418f85

Please sign in to comment.