Пример #1
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self._essid_state = EssidState(context, self)
     self._passwd_state = PasswdState(context, self)
     self._sleep_state = SleepState(context, self)
     self._sub_state = None
Пример #2
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self.password = ""
     self._allowed_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[]^_`{|}\x01\x02"
     self._chars_pos = 0
     self._cursor_pos = 0
Пример #3
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self._track_nb = 1
     self._playing_state = PlayingState(self._ctxt, self._track_nb, self)
     self._choosing_state = ChooseStationState(self._ctxt, self)
     self._volume_state = VolumeState(self._ctxt, self)
     self._sub_state = None
Пример #4
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self.encoder_pressed = False
     self._clock_rolling_text = ScrollingText(self._get_time_text,
                                              self._time_callback,
                                              display_size=20,
                                              refresh_rate=1)
     self._clock_rolling_text.start()
     self._clock_rolling_text.pause()
Пример #5
0
 def __init__(self, ctxt, owner):
     RadioState.__init__(self, ctxt, owner)
     self.logger = logging.getLogger(type(self).__name__)
     # Timeout thread
     self._timeout = None
     self._timeout_value = ctxt.rsc.volume_timeout
     self._increment = ctxt.rsc.volume_increment
     # initialize volume from mpc
     try:
         proc = subprocess.Popen(["mpc", "volume"],
                                 stdout=subprocess.PIPE,
                                 universal_newlines=True)
         out, err = proc.communicate()
         self._volume = int(out.split(":")[1].strip().strip("%"))
     except:
         self._volume = 20
Пример #6
0
 def __init__(self, ctxt, track_nb, owner):
     """ Initialisation
     """
     RadioState.__init__(self, ctxt, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self.track_nb = track_nb
     self._lcd = ctxt.lcd
     self._rsc = ctxt.rsc
     self._wifi_level = 0
     self.random_msg = ""
     self._random_msg_display = ScrollingText(
         self._random_msg,
         self._random_msg_callback,
         display_size=20,
         refresh_rate=0,
         scroll_begin_delay=self._rsc.scroll_begin,
         scroll_end_delay=self._rsc.scroll_end,
         scroll_rate=self._rsc.scroll_rate)
     self._random_msg_display.pause()
     self._random_msg_display.start()
     # The name of the radio is not updated automatically when setting refresh_rate = 0
     self._name_display = ScrollingText(
         self._radio_name,
         self._radio_name_callback,
         display_size=20,
         refresh_rate=0,
         scroll_begin_delay=self._rsc.scroll_begin,
         scroll_end_delay=self._rsc.scroll_end,
         scroll_rate=self._rsc.scroll_rate)
     self._name_display.pause()
     self._name_display.start()
     # The title of the track is updated automatically every 5 seconds
     self._title_display = ScrollingText(
         self._track_title,
         self._track_title_callback,
         display_size=20,
         refresh_rate=1,
         scroll_begin_delay=self._rsc.scroll_begin,
         scroll_end_delay=self._rsc.scroll_end,
         scroll_rate=self._rsc.scroll_rate)
     self._title_display.pause()
     self._title_display.start()
Пример #7
0
    def __init__(self, context, owner):
        RadioState.__init__(self, context, owner)
        self.logger = logging.getLogger(type(self).__name__)

        # Random msg inittialisation
        self.random_msg = ""
        self._random_msg_display = ScrollingText(
            self._random_msg,
            self._random_msg_callback,
            display_size=20,
            refresh_rate=0,
            scroll_begin_delay=self._ctxt.rsc.scroll_begin,
            scroll_end_delay=self._ctxt.rsc.scroll_end,
            scroll_rate=self._ctxt.rsc.scroll_rate)
        self._random_msg_display.start()
        self._random_msg_display.pause()

        # clock initialisation
        self._clock_rolling_text = ScrollingText(self._get_time_text,
                                                 self._time_callback,
                                                 display_size=5,
                                                 refresh_rate=1)
        self._clock_rolling_text.start()
        self._clock_rolling_text.pause()

        self._blink_thread = None
        self._blinking = False
        # substates
        self._volume_state = VolumeState(self._ctxt, self)
        self._idle_state = BtIdleState(self._ctxt, self)
        self._sub_state = None

        # ensure the bluetooth device is pairable
        subprocess.call(["bluetoothctl", "pairable", "on"])
        subprocess.call(["bluetoothctl", "agent", "NoInputNoOutput"])
        subprocess.call(["bluetoothctl", "default-agent"])

        return
Пример #8
0
 def __init__(self, ctxt, owner):
     RadioState.__init__(self, ctxt, owner)
     self.target_nb = 0
     self.playlist = self._ctxt.rsc.playlist
     self._timeout = None
Пример #9
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     return
Пример #10
0
 def __init__(self, context, owner):
     RadioState.__init__(self, context, owner)
     self.logger = logging.getLogger(type(self).__name__)
     self._essid_nb = 0
     self._ids = []
     self.essid = ""