Exemple #1
0
  def __init__(self, hfp, audio_gateway):
    ClassLogger.__init__(self)

    self.__audio_gateway_path = audio_gateway.path()

    self.__sound_io_interface = dbus.Interface(
      hfp.bus().get_object(
        DbusPaths.HFPD_SERVICE_NAME,
        DbusPaths.HFPD_SOUNDIO_OBJECT
      ),
      dbus_interface = DbusPaths.HFPD_SOUNDIO_INTERFACE_NAME
    )

    self.__sound_io_properties = dbus.Interface(
      hfp.bus().get_object(
        DbusPaths.HFPD_SERVICE_NAME,
        DbusPaths.HFPD_SOUNDIO_OBJECT
      ),
      dbus_interface = DbusPaths.DBUS_INTERFACE_PROPERTIES
    )

    self.__sound_io_interface.connect_to_signal('StateChanged', self.__state_changed)
    self.__sound_io_interface.connect_to_signal('MuteChanged', self.__mute_changed)
    self.__sound_io_interface.connect_to_signal('SkewNotify', self.__skew_notify)

    self.__sound_io_interface.MinBufferFillHint = 320 * 2
Exemple #2
0
  def __init__(self, device, bus):
    ClassLogger.__init__(self)

    self._device = device
    self._bus = bus

    self._properties = Bluez5Utils.properties(device.object_path, self._bus)
Exemple #3
0
  def __init__(self, hfp, audio_gateway_path):
    ClassLogger.__init__(self)

    self.__path = audio_gateway_path

    self.__ag_interface = dbus.Interface(
      hfp.bus().get_object(
        DbusPaths.HFPD_SERVICE_NAME,
        audio_gateway_path
      ),
      dbus_interface = DbusPaths.HFPD_AUDIOGATEWAY_INTERFACE_NAME
    )

    self.__ag_properties = dbus.Interface(
      hfp.bus().get_object(
        DbusPaths.HFPD_SERVICE_NAME,
        audio_gateway_path
      ),
      dbus_interface = DbusPaths.DBUS_INTERFACE_PROPERTIES
    )

    self.__ag_interface.connect_to_signal('StateChanged',
      self.__gateway_state_changed)
    self.__ag_interface.connect_to_signal('CallStateChanged',
      self.__call_state_changed)
    self.__ag_interface.connect_to_signal('AudioStateChanged',
      self.__audio_state_changed)
    self.__ag_interface.connect_to_signal('AutoReconnectChanged',
      self.__auto_reconnect_changed)
    self.__ag_interface.connect_to_signal('VoiceRecognitionActiveChanged',
      self.__voice_recognition_changed)
    self.__ag_interface.connect_to_signal('Ring',
      self.__ringing)

    self.__soundio = HfpSoundIo(hfp, self)
Exemple #4
0
  def __init__(self, bus, path):
    ClassLogger.__init__(self)
    dbus.service.Object.__init__(self, bus, path)

    self._path = path
    self._capability = 'KeyboardDisplay'

    #
    # These profile modes appear to cause the agent to ignore
    # pin and passcode requests...
    #
    #self._capability = 'NoInputNoOutput'
    #self._capability = 'DisplayOnly'
    #self._capability = 'KeyboardOnly'

    # Other types that seem to work
    #self._capability = 'KeyboardDisplay'
    #self._capability = 'DisplayYesNo'

    manager = dbus.Interface(
      bus.get_object(Bluez5Utils.SERVICE_NAME, '/org/bluez'),
      Bluez5Utils.AGENT_MANAGER_INTERFACE
    )

    manager.RegisterAgent(self._path, self._capability)
    manager.RequestDefaultAgent(self._path)
Exemple #5
0
  def __init__(self, path, bus):
    ClassLogger.__init__(self)

    self._bus = bus
    self._path = path

    self._hfp = dbus.Interface(
      self._bus.get_object(Ofono.SERVICE_NAME, self._path),
      Ofono.HFP_INTERFACE
    )

    self._voice_call_manager = dbus.Interface(
      self._bus.get_object(Ofono.SERVICE_NAME, self._path),
      Ofono.VOICE_CALL_MANAGER_INTERFACE
    )

    self._voice_call_manager.connect_to_signal('CallAdded', self._call_added)
    self._voice_call_manager.connect_to_signal('CallRemoved', self._call_removed)

    self._bus.add_signal_receiver(
      self._call_properties_changed,
      dbus_interface = Ofono.VOICE_CALL_INTERFACE,
      signal_name = 'PropertyChanged',
      path_keyword = 'path'
    )

    self._show_properties()
Exemple #6
0
  def __init__(self, bus_provider, server_address = None, microphone_source_hint = None, primary_audio_sink_hint = None):
    ClassLogger.__init__(self)

    self._bus = bus_provider.session_bus()
    self._server_address = server_address

    self._microphone_source_hint = microphone_source_hint
    self._primary_audio_sink_hint = primary_audio_sink_hint
Exemple #7
0
  def __init__(self, card_index = -1):
    ClassLogger.__init__(self)

    self._card_index = card_index
    self._speaker_mixer, self._microphone_mixer = \
      self._find_suitable_mixers(self._card_index)

    if not self._speaker_mixer or not self._microphone_mixer:
      raise Exception('An audio device with a speaker and a microphone mixer is required, but could not be found. card_index = "%s"' % self._card_index)
Exemple #8
0
  def __init__(self, bus_provider, adapter, hfp, audio):
    ClassLogger.__init__(self)

    self._bus = bus_provider.session_bus()

    self._adapter = adapter
    self._hfp = hfp
    self._audio = audio

    adapter.on_device_connected(self._device_connected)
    adapter.on_device_disconnected(self._device_disconnected)
Exemple #9
0
  def __init__(self, bus_provider, headset, ringer, hmi):
    ClassLogger.__init__(self)

    self._headset = headset
    self._ringer = ringer
    self._hmi = hmi

    self._bus = bus_provider.session_bus()

    self._bus.request_name(self.SERVICE_NAME)
    bus_name = dbus.service.BusName(self.SERVICE_NAME, bus = self._bus)
    dbus.service.Object.__init__(self, bus_name, self.OBJECT_PATH)
Exemple #10
0
  def __init__(self, layout):
    ClassLogger.__init__(self)

    # IO event callbacks occur in another thread, dbus/gdk need
    # to be made aware of this.
    gobject.threads_init()

    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)

    self._layout = layout
    for name, config in layout.iteritems():
      for point in ['pin', 'default']:
        Outputs._raise_if_not_in(point, config)

      self._conigure_output(name, config)
Exemple #11
0
  def __init__(self, layout):
    ClassLogger.__init__(self)

    # IO event callbacks occur in another thread, dbus/gdk need
    # to be made aware of this.
    gobject.threads_init()

    GPIO.setmode(GPIO.BCM)

    self._layout = layout
    for name, config in layout.iteritems():
      for point in ['pin', 'pull_up_down']:
        Inputs._raise_if_not_in(point, config)

      config = copy.deepcopy(config)
      config['name'] = name

      self._inputs_by_channel[config['pin']] = config
      self._configure_input(name, config)
Exemple #12
0
  def __init__(self, path, bus):
    ClassLogger.__init__(self)

    self._bus = bus
    self._path = path

    self._hfp = dbus.Interface(
      self._bus.get_object(Ofono.SERVICE_NAME, self._path),
      Ofono.HFP_INTERFACE
    )

    self._voice_call_manager = dbus.Interface(
      self._bus.get_object(Ofono.SERVICE_NAME, self._path),
      Ofono.VOICE_CALL_MANAGER_INTERFACE
    )

    self._voice_call_manager.connect_to_signal('CallAdded', self._call_added)
    self._voice_call_manager.connect_to_signal('CallRemoved', self._call_removed)

    self._show_properties()
Exemple #13
0
  def __init__(self, bus):
    ClassLogger.__init__(self)

    self.__bus = bus.session_bus()
Exemple #14
0
    def __init__(self, io_outputs):
        ClassLogger.__init__(self)

        self._outputs = io_outputs
        self._de_energize()
Exemple #15
0
  def __init__(self, bus):
    ClassLogger.__init__(self)

    self._bus = bus.system_bus()
Exemple #16
0
  def __init__(self):
    ClassLogger.__init__(self)

    self.cleanup_handlers = []
Exemple #17
0
  def __init__(self, bus_provider):
    ClassLogger.__init__(self)

    self._bus = bus_provider.system_bus()
Exemple #18
0
 def __init__(self, bus_provider, adapter_address = None):
   ClassLogger.__init__(self)
   self._adapter_address = adapter_address
   self._bus = bus_provider.system_bus()
Exemple #19
0
  def __init__(self, io_inputs, bell_ringer, headset):
    ClassLogger.__init__(self)

    self._state = Fysom({
      'initial': 'idle',
      'events': [

        #
        # Defines an event that makes a state transition:
        #
        # {'name': 'event_name', 'src': 'source_state_name', 'dst': 'destination_state_name'}
        #

        #
        # Ingress calling state transitions
        #
        {'name': 'incoming_call', 'src': 'idle',            'dst': 'ringing'},
        {'name': 'call_ended',    'src': 'ringing',         'dst': 'idle'},
        {'name': 'off_hook',      'src': 'ringing',         'dst': 'in_call'},
        # This might happen if the call was answered on the cell phone
        {'name': 'call_began',    'src': 'ringing',         'dst': 'in_call'},

        #
        # Egress calling state transitions
        #
        {'name': 'off_hook',          'src': 'idle',                    'dst': 'waiting_for_hand_crank'},
        {'name': 'hand_crank_turned', 'src': 'waiting_for_hand_crank',  'dst': '='},
        {'name': 'initiate_call',     'src': 'waiting_for_hand_crank',  'dst': 'initiating_call'},
        {'name': 'call_began',        'src': 'initiating_call',         'dst': 'in_call'},

        #
        # In-call state transitions
        #
        {'name': 'on_hook',       'src': '*',               'dst': 'idle'},

        #
        # Ignore these transitions:
        #

        # We don't care about call's ending in any other state except while ringing
        {'name': 'call_ended',      'src': '*',               'dst': '='},
        # Incoming calls in any state other than idle, do not cause a transition
        {'name': 'incoming_call',   'src': '*',               'dst': '='},
        # Ignore off-hook switch bouncing
        {'name': 'off_hook',        'src': '*',               'dst': '='},
        # Ignore magneto pulses unless waiting to initiate a call
        {'name': 'hand_crank_turned',  'src': '*',               'dst': '='},
      ],
      'callbacks': {
        'onchangestate': self._on_change_state,

        # State transition callbacks
        'onidle': self._on_idle,
        'onringing': self._on_ringing,
        'onin_call': self._on_in_call,
        'onhand_crank_turned': self._on_hand_crank_turned,
        'oninitiating_call': self._on_initiating_call,

        # Event callbacks
        'onincoming_call': self._on_incoming_call
      }
    })

    self._ringer = bell_ringer

    self._headset = headset
    self._headset.on_incoming_call(self._incoming_call)
    self._headset.on_call_began(self._call_began)
    self._headset.on_call_ended(self._call_ended)
    self._headset.on_device_connected(self._device_connected)

    self._inputs = io_inputs
    self._inputs.on_rising_edge('hook_switch', self._swich_hook_high)
    self._inputs.on_falling_edge('hook_switch', self._switch_hook_low)
    self._inputs.on_pulse('magneto_sense', self._magneto_pulsed)
Exemple #20
0
 def __init__(self):
   ClassLogger.__init__(self)