Esempio n. 1
0
  def __init__(self, device, bus):
    ClassLogger.__init__(self)

    self._device = device
    self._bus = bus

    self._properties = Bluez5Utils.properties(device.object_path, self._bus)
Esempio n. 2
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()
Esempio n. 3
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
Esempio n. 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)
Esempio n. 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()
Esempio n. 6
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)
Esempio n. 7
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
Esempio n. 8
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)
Esempio n. 9
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)
Esempio n. 10
0
  def __init__(self, adapter):
    ClassLogger.__init__(self)
    self.__adapter = adapter

    adapter_obj = adapter.adapter()
    adapter_obj.connect_to_signal('PropertyChanged', self.property_changed)
    adapter_obj.connect_to_signal('DeviceFound', self.device_found)
    adapter_obj.connect_to_signal('DeviceDisappeared', self.device_disappeared)
    adapter_obj.connect_to_signal('DeviceCreated', self.device_created)
    adapter_obj.connect_to_signal('DeviceRemoved', self.device_removed)
Esempio n. 11
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)
Esempio n. 12
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)
Esempio n. 13
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
Esempio n. 14
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)
Esempio n. 15
0
    def __init__(self, io_outputs):
        ClassLogger.__init__(self)

        self._ring_source = RingSourceSelector(io_outputs)
        self._ring_source.select_external(force=True)

        self._stop = threading.Event()
        self._outputs = io_outputs

        # De-energize hbridge
        self._outputs.ringer_enable(0)
        self._outputs.ringer_1(0)
        self._outputs.ringer_2(0)
Esempio n. 16
0
  def __init__(self, adapter, path):
    ClassLogger.__init__(self)
    dbus.service.Object.__init__(self, adapter.bus(), path)

    self.__path = path
    self.__capability = 'DisplayYesNo'

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

    adapter.adapter().RegisterAgent(path, self.__capability)
Esempio n. 17
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)
Esempio n. 18
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)
Esempio n. 19
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)
Esempio n. 20
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)
Esempio n. 21
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()
Esempio n. 22
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()
Esempio n. 23
0
  def __init__(self, bus):
    ClassLogger.__init__(self)

    self._bus = bus.system_bus()
Esempio n. 24
0
 def __init__(self):
   ClassLogger.__init__(self)
Esempio n. 25
0
    def __init__(self, bus):
        ClassLogger.__init__(self)

        self._bus = bus.system_bus()
Esempio n. 26
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)
Esempio n. 27
0
  def __init__(self, bus):
    ClassLogger.__init__(self)

    self.__bus = bus.session_bus()
Esempio n. 28
0
 def __init__(self, bus_provider, adapter_address = None):
   ClassLogger.__init__(self)
   self._adapter_address = adapter_address
   self._bus = bus_provider.system_bus()
Esempio n. 29
0
    def __init__(self, io_outputs):
        ClassLogger.__init__(self)

        self._outputs = io_outputs
        self._de_energize()
Esempio n. 30
0
    def __init__(self, bus_provider):
        ClassLogger.__init__(self)

        self._bus = bus_provider.system_bus()
Esempio n. 31
0
 def __init__(self):
     ClassLogger.__init__(self)
Esempio n. 32
0
  def __init__(self, bus_provider):
    ClassLogger.__init__(self)

    self._bus = bus_provider.system_bus()
Esempio n. 33
0
  def __init__(self):
    ClassLogger.__init__(self)

    self.cleanup_handlers = []
Esempio n. 34
0
 def __init__(self, bus_constructor, hci_device):
   ClassLogger.__init__(self)
   self.__hci_device = hci_device
   self.__bus_constructor = bus_constructor
Esempio n. 35
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)