diff options
author | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2016-02-05 13:55:17 +0100 |
---|---|---|
committer | Marek Siarkowicz <mareksiarkowicz@gmail.com> | 2016-02-05 13:55:17 +0100 |
commit | 92e47683fc783a2dbd3d9737af40eb0b3372af61 (patch) | |
tree | a9cb773685d4e178db90a30b3926faaa85a7cd71 /parrot_zik | |
parent | 19cafba037f55fa962e5819950cb1b1f7332180e (diff) | |
parent | d6e3eb4ffb88959503cf41870dab72446ace6b46 (diff) | |
download | pyParrotZikTCP-92e47683fc783a2dbd3d9737af40eb0b3372af61.tar.xz pyParrotZikTCP-92e47683fc783a2dbd3d9737af40eb0b3372af61.zip |
Merge pull request #7 from PsycheEYE/noisecontrol
Added functionality to change noise cancellation mode
Diffstat (limited to '')
-rw-r--r-- | parrot_zik/interface/version2.py | 14 | ||||
-rw-r--r-- | parrot_zik/model/version2.py | 4 | ||||
-rw-r--r-- | parrot_zik/resource_manager.py | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/parrot_zik/interface/version2.py b/parrot_zik/interface/version2.py index b378a88..e6076ed 100644 --- a/parrot_zik/interface/version2.py +++ b/parrot_zik/interface/version2.py @@ -23,23 +23,23 @@ class ParrotZikVersion2Interface(ParrotZikBaseInterface): self.noise_control_cancelation_max = MenuItem( "Max Calcelation", functools.partial( self.toggle_noise_cancelation, - NoiseControlTypes.NOISE_CONTROL_MAX), checkitem=True, sensitive=False) + NoiseControlTypes.NOISE_CONTROL_MAX), checkitem=True) self.noise_control_cancelation_on = MenuItem( "Normal Cancelation", functools.partial( self.toggle_noise_cancelation, - NoiseControlTypes.NOISE_CONTROL_ON), checkitem=True, sensitive=False) + NoiseControlTypes.NOISE_CONTROL_ON), checkitem=True) self.noise_control_off = MenuItem( "Off", functools.partial( self.toggle_noise_cancelation, - NoiseControlTypes.NOISE_CONTROL_OFF), checkitem=True, sensitive=False) + NoiseControlTypes.NOISE_CONTROL_OFF), checkitem=True) self.noise_control_street_mode = MenuItem( "Street Mode", functools.partial( self.toggle_noise_cancelation, - NoiseControlTypes.STREET_MODE), checkitem=True, sensitive=False) + NoiseControlTypes.STREET_MODE), checkitem=True) self.noise_control_street_mode_max = MenuItem( "Street Mode Max", functools.partial( self.toggle_noise_cancelation, - NoiseControlTypes.STREET_MODE_MAX), checkitem=True, sensitive=False) + NoiseControlTypes.STREET_MODE_MAX), checkitem=True) self.noise_cancelation_submenu.append(self.noise_control_cancelation_max) self.noise_cancelation_submenu.append(self.noise_control_cancelation_on) self.noise_cancelation_submenu.append(self.noise_control_off) @@ -112,6 +112,8 @@ class ParrotZikVersion2Interface(ParrotZikBaseInterface): self.flight_mode.set_active(self.parrot.flight_mode) self._read_sound_effect_room() self._read_sound_effect_angle() + self.head_detection.set_active(self.parrot.head_detection) + sound_effect = self.parrot.sound_effect self.room_sound_effect_enabled.set_active(sound_effect) @@ -234,4 +236,4 @@ class ParrotZikVersion2Interface(ParrotZikBaseInterface): self.parrot.head_detection = self.head_detection.get_active() self.head_detection.set_active(self.parrot.head_detection) except resource_manager.DeviceDisconnected: - self.deactivate()
\ No newline at end of file + self.deactivate() diff --git a/parrot_zik/model/version2.py b/parrot_zik/model/version2.py index 11b4d51..0cbdc1a 100644 --- a/parrot_zik/model/version2.py +++ b/parrot_zik/model/version2.py @@ -73,7 +73,7 @@ class ParrotZikVersion2(ParrotZikBase): @noise_control.setter def noise_control(self, arg): - pass + self.resource_manager.set('/api/audio/noise_control', arg) @property def noise_control_enabled(self): @@ -103,7 +103,7 @@ class NoiseControl(object): return self.type == other.type and self.value == other.value def __str__(self): - return '{}++{}'.format(self.type, self.value) + return '{}&value={}'.format(self.type, self.value) class NoiseControlTypes: diff --git a/parrot_zik/resource_manager.py b/parrot_zik/resource_manager.py index c2dae2f..aa141cb 100644 --- a/parrot_zik/resource_manager.py +++ b/parrot_zik/resource_manager.py @@ -132,7 +132,7 @@ class Version2ResourceManager(ResourceManagerBase): '/api/audio/equalizer/preset_value': ['set'], '/api/audio/noise_cancellation/enabled': ['get', 'set'], '/api/audio/noise_control/enabled': ['get', 'set'], - '/api/audio/noise_control': ['get'], + '/api/audio/noise_control': ['get', 'set'], '/api/audio/noise_control/phone_mode': ['get', 'set'], '/api/audio/noise': ['get'], '/api/audio/param_equalizer/value': ['set'], |