Esempio n. 1
0
def _start_loop():
    loop = gobject.MainLoop()
    try:
        logger.debug('starting main loop')
        loop.run()
    except KeyboardInterrupt:
        logger.debug('exiting')
        loop.quit()
Esempio n. 2
0
def _start_loop():
    loop = gobject.MainLoop()
    try:
        logger.debug('starting main loop')
        loop.run()
    except KeyboardInterrupt:
        logger.debug('exiting')
        loop.quit()
Esempio n. 3
0
 def read(self):
     if not self._fd:
         return None
     try:
         data = os.read(self._fd, 4096)
         position = self.HEADER_SIZE
         if data[position] != self.FRAME_MARKER:
             logger.debug('marker not found')
             return None
         return data[position:]
     except OSError:
         return None
Esempio n. 4
0
 def on_property_changed(self, name, value):
     if name != 'State':
         logger.debug('unknown property "%s" changed on audio source', name)
         return
     logger.debug('audio source state changed to "%s"', value)
     if value in ('connected', 'disconnected'):
         if self._state == 'playing':
             Endpoint.release_file_descriptor()
             reader.set_file_descriptor(None)
     if value == 'playing':
         fd = Endpoint.get_file_descriptor()
         reader.set_file_descriptor(fd)
     self._state = value
Esempio n. 5
0
 def on_property_changed(self, name, value):
     if name != 'State':
         logger.debug('unknown property "%s" changed on audio source', name)
         return
     logger.debug('audio source state changed to "%s"', value)
     if value in ('connected', 'disconnected'):
         if self._state == 'playing':
             Endpoint.release_file_descriptor()
             reader.set_file_descriptor(None)
     if value == 'playing':
         fd = Endpoint.get_file_descriptor()
         reader.set_file_descriptor(fd)
     self._state = value
Esempio n. 6
0
 def get_file_descriptor(cls):
     endpoint = cls.get()
     logger.debug('acquiring endpoint transport')
     fd, _, _ = endpoint._transport.Acquire('r')
     return fd.take()
Esempio n. 7
0
 def __del__(self):
     logger.debug('deinitializing pysbc')
     #TODO: деинициализировать иначе
     pysbc.deinit()
Esempio n. 8
0
 def __init__(self):
     logger.debug('initializing pysbc')
     pysbc.init()
Esempio n. 9
0
 def release_file_descriptor(cls):
     endpoint = cls.get()
     logger.debug('releasing endpoint transport')
     endpoint._transport.Release('r')
Esempio n. 10
0
 def SelectConfiguration(self, caps):
     logger.debug('selecting endpoint configuration')
     return SBC_CONFIGURATION
Esempio n. 11
0
 def SetConfiguration(self, transport_path, config):
     logger.debug('setting up endpoint configuration')
     bus = _get_bus()
     self._transport = dbus.Interface(
         bus.get_object('org.bluez', transport_path),
         'org.bluez.MediaTransport')
Esempio n. 12
0
 def ClearConfiguration(self):
     logger.debug('clearing endpoint configuration')
Esempio n. 13
0
 def Release(self):
     logger.debug('releasing endpoint')
     self._transport = None
Esempio n. 14
0
 def release_file_descriptor(cls):
     endpoint = cls.get()
     logger.debug('releasing endpoint transport')
     endpoint._transport.Release('r')
Esempio n. 15
0
 def get_file_descriptor(cls):
     endpoint = cls.get()
     logger.debug('acquiring endpoint transport')
     fd, _, _ = endpoint._transport.Acquire('r')
     return fd.take()
Esempio n. 16
0
 def Release(self):
     logger.debug('releasing endpoint')
     self._transport = None
Esempio n. 17
0
 def SelectConfiguration(self, caps):
     logger.debug('selecting endpoint configuration')
     return SBC_CONFIGURATION
Esempio n. 18
0
 def SetConfiguration(self, transport_path, config):
     logger.debug('setting up endpoint configuration')
     bus = _get_bus()
     self._transport = dbus.Interface(bus.get_object('org.bluez', transport_path), 'org.bluez.MediaTransport')
Esempio n. 19
0
 def ClearConfiguration(self):
     logger.debug('clearing endpoint configuration')