From ddd0c243d38168f4ebec1ba5f8095a2e0468dc3d Mon Sep 17 00:00:00 2001 From: Kumar-laxmi Date: Thu, 8 Feb 2024 15:51:27 +0530 Subject: [PATCH] Backend support for volume control configured --- app/__pycache__/views.cpython-311.pyc | Bin 65193 -> 66530 bytes app/views.py | 23 ++++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/__pycache__/views.cpython-311.pyc b/app/__pycache__/views.cpython-311.pyc index cb649504742b74d055b5f1c850df8f701a363f45..7b3f9d6a7d48a87fb918a9ff4fad2f8d65129f35 100644 GIT binary patch delta 2512 zcmds(T}V@57{_<^;hN_tc1pLYu?@7Lxjf=hFEq8W6)3S%jEJ)7j(VIJNgqmTDF>KculQFzgT^V{>hU*~!Lyzlew z-dEMT^Xl|FX=$kn@~CI#_-k)x(?4Y@ISO;xMrs6`vkV7BHT14LJ|+C3reQ@Vwc4cc zs*G!`(D(1?o0gZzi^8gF@W;a~Ur5KR@lyk8XB1Ri0xzBx^YDoL~4hpO=deM4~*@kR13P7;hM-e}Xu&rWBB zwWgrf^onLDE2o(Vo&Tc15vCnM+JP$!!`Qq{x49a0{)Gm}4H+LI7|ii>3;jGY+gi^RO) z`I2>nS;u2nh^>pTbs?rc!qf+udc0t?{|`!+B`V#Bgx0=5ui#Bk+PM*>pXOLKC&<7l zypWT<`4YAN^UYYEAd$t1S`x(BzY%dB=30tRl7TnL8%R?4YQl6)kgkDks4siTR)yKB zhixI&8DX6v#uZ^)K?cto_eeJDcct{%R83JWxZKi5%}Dnxqfa0(z7BLr3eAlECX z=%|k%2b~6U3*Zbu59kLB;3qqGaD`yXWowLB0T^greNZ0s?OVemFeaoM+;$Z%D$Fg3 z%gmi5GZjqr;ekSPy_`W2_`l6St|YMxk|aReV6Bw|aM~^t6_RYbCe-oKH71D;u3-}0 zhvL=fxOJnGPv3^4D~XG4kTa#c2mdk=u}~EsqBBW|nw1cjOS4x5EL}H5`3!70M0;F_ z6Lu5zS-NY#>dc5T{vOor>1yuaJxGk^;rUsEbbRp2Q6)`Di_fp;Q$zUTQhvrTOqaJ` zE?9^0+|sm3{;TC-}-+5Bn%CB delta 1773 zcmc(fT}YEr7{}kUZ#T6W?!z&A9XLhNHpyu-Ei=p@No#3n%Q<_OZaP1XvlP;4NZAJw z9#cUGFZxjHMpocuffwB=BD4l}(Oq2yL3e8Bc{kTC)Zs;S;QaVM=RLgV|9?N8ulGdr zo5JK*Nl9{sj)l2pSJRipB2~Ud%E{d5C1RM@bcTnG@f{*5N|wb%bRi^nbFNOG`-a3QYQ0b$y_aVhF6O<;84o$1qr0lAc4Jr;lDxFST zR~YAxtSO3D6~*L@!Av~bYEmsv5KJ)SgEkGBAlErg*e;-VU~tlH#uN3$?U|DkbCO+B zNJ&b)uH44V%P#Oya4p>PBH$9B1YiZ6pqLj$qQC+?L@WW+kuhCn$yF+c==@nj5jR;- zrJu0R=B=wtV`s_9^uoWJFxkf72C&))s3WubY)t19|~v0QennAK*0LCg2uD3hoCf z0}KE(9kP8?A+@a`&jTw=FGhw-62a6yc@HvUyq%Vj`RvRZ7^at!E^QMdn zK0zMTdnPyoSEC7b4WRlHARl&z1CTN^i4C5Yq2tpMZQmXNv>5Fet^gJwODl^i-j>3m#i%M9tc_|E5&>R8=ugT ze18(TKcXb%FVX|6{>BEu78A((JYz(I|ZkMZ|i(_bb7`g~<2DCg)K*!PZcNJ(ua9)N=e=t#`N}!BF8CCpRoN~$|ME$=3 DyZmi{ diff --git a/app/views.py b/app/views.py index 185078c82..9ad99b419 100644 --- a/app/views.py +++ b/app/views.py @@ -114,8 +114,9 @@ def breathUpdate(request): return HttpResponse("Request method is not a POST") def mitralVolumeChange(request): + global current_mitral_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_mitral_valve_sound: volume = request.POST['rangeValue'] os.system('amixer -c 3 set Speaker {}%'.format(volume)) print('Mitral Valve\'s Volume updated to {}%'.format(volume)) @@ -124,33 +125,45 @@ def mitralVolumeChange(request): return HttpResponse("Request method is not a POST") def aorticVolumeChange(request): + global current_aortic_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_aortic_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 4 set Speaker {}%'.format(volume)) + print('Aortic Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def pulmonaryVolumeChange(request): + global current_pulmonary_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_pulmonary_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 5 set Speaker {}%'.format(volume)) + print('Pulmonary Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def tricuspidVolumeChange(request): + global current_tricuspid_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_tricuspid_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 6 set Speaker {}%'.format(volume)) + print('Tricuspid Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST") def erbVolumeChange(request): + global current_erb_valve_sound if request.method == 'POST': - if request.POST['identifier'] == 'normal_heart': + if request.POST['identifier'] == current_erb_valve_sound: volume = request.POST['rangeValue'] + os.system('amixer -c 7 set Speaker {}%'.format(volume)) + print('Erb Valve\'s Volume updated to {}%'.format(volume)) return JsonResponse({'message': 'Success!'}) else: return HttpResponse("Request method is not a POST")