picture client side ready

This commit is contained in:
Senad Uka
2016-10-01 17:01:37 +02:00
parent a594cc05d0
commit 317fdb93ed
5 changed files with 57 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import RPi.GPIO as GPIO
import config
from camera import make_transfer_picture
class Changer(object):
@@ -45,6 +46,8 @@ class Changer(object):
if in_valve_change is not None:
in_valve_change()
self.fulfill_picture_request()
return self.local_state
def open_in_valve(self):
@@ -63,6 +66,12 @@ class Changer(object):
GPIO.output(config.GPIO_PIN_OUT_VALVE, GPIO.LOW)
self.local_state['out_valve'] = 'closed'
def fulfill_picture_request(self):
if self.remote_state['transfer_picture'] == 'true':
make_transfer_picture()
self.local_state['transfer_picture'] = 'false'
def validate_states(self):
if self.local_state is None or self.remote_state is None:
raise ClassNotReadyException("Both local and remote states must be present!")