Skip to content

Commit

Permalink
Backend support for volume control configured
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar-laxmi committed Feb 8, 2024
1 parent 795d94a commit ddd0c24
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Binary file modified app/__pycache__/views.cpython-311.pyc
Binary file not shown.
23 changes: 18 additions & 5 deletions app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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")
Expand Down

0 comments on commit ddd0c24

Please sign in to comment.