aboutsummaryrefslogtreecommitdiff
path: root/parrot_zik/model/version1.py
blob: 324cc9f6f70604a3815539cb5861dfc759ea4537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from parrot_zik.model.base import ParrotZikBase
from parrot_zik.resource_manager import Version1ResourceManager


class ParrotZikVersion1(ParrotZikBase):
    def __init__(self, resource_manager):
        super(ParrotZikVersion1, self).__init__(
            resource_manager.get_resource_manager(
                Version1ResourceManager))

    @property
    def version(self):
        answer = self.resource_manager.get('/api/software/version')
        return answer.software['version']

    @property
    def battery_level(self):
        return int(self.get_battery_level('level'))

    @property
    def lou_reed_mode(self):
        answer = self.resource_manager.get("/api/audio/specific_mode/enabled")
        return self._result_to_bool(
            answer.audio.specific_mode["enabled"])

    @lou_reed_mode.setter
    def lou_reed_mode(self, arg):
        self.resource_manager.set("/api/audio/specific_mode/enabled", arg)

    @property
    def concert_hall(self):
        answer = self.resource_manager.get("/api/audio/sound_effect/enabled")
        return self._result_to_bool(
            answer.audio.sound_effect["enabled"])

    @concert_hall.setter
    def concert_hall(self, arg):
        self.resource_manager.set("/api/audio/sound_effect/enabled", arg)

    @property
    def cancel_noise(self):
        answer = self.resource_manager.get("/api/audio/noise_cancellation/enabled")
        return self._result_to_bool(
            answer.audio.noise_cancellation["enabled"])

    @cancel_noise.setter
    def cancel_noise(self, arg):
        self.resource_manager.set("/api/audio/noise_cancellation/enabled", arg)